Repository navigation
Conversation
🦋 Changeset detectedLatest commit: bd3379e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Bundle Stats —
|
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 2.4 KB | - |
| Internal (gzip) | 926 B | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 411ms | -3ms, -0.7% |
bin:sanity
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.91 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 1.57s | -8ms, -0.5% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against cody/groq-file-types-ea75 (48508c7f)
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 127.8 KB | - |
| Internal (gzip) | 33.1 KB | - |
| Bundled (raw) | 22.96 MB | - |
| Bundled (gzip) | 3.71 MB | - |
| Import time | 317ms | -4ms, -1.2% |
🗺️ @sanity/cli-core:. treemap too large to embed · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-build
Compared against cody/groq-file-types-ea75 (48508c7f)
@sanity/cli-build/_internal/build
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 118.7 KB | - |
| Internal (gzip) | 30.0 KB | - |
| Bundled (raw) | 18.11 MB | - |
| Bundled (gzip) | 3.66 MB | - |
| Import time | 673ms | -15ms, -2.2% |
@sanity/cli-build/_internal/env
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 1.8 KB | - |
| Internal (gzip) | 644 B | - |
| Bundled (raw) | 1.30 MB | - |
| Bundled (gzip) | 331.9 KB | - |
| Import time | 126ms | -3ms, -2.5% |
@sanity/cli-build/_internal/extract
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 42.8 KB | - |
| Internal (gzip) | 10.3 KB | - |
| Bundled (raw) | 11.89 MB | - |
| Bundled (gzip) | 2.24 MB | - |
| Import time | 418ms | -3ms, -0.7% |
@sanity/cli-build/_internal/manifest
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 31.0 KB | - |
| Internal (gzip) | 7.8 KB | - |
| Bundled (raw) | 842.0 KB | - |
| Bundled (gzip) | 213.9 KB | - |
| Import time | 414ms | -8ms, -1.8% |
🗺️ ./_internal/env · ./_internal/manifest · 2 treemaps too large to embed · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against cody/groq-file-types-ea75 (48508c7f)
| Metric | Value | vs cody/groq-file-types-ea75 (48508c7) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
Coverage Delta
No baseline available — showing current coverage for 10 changed files Overall Coverage
|
c01a55d to
bd3379e
Compare
|
Superseded by sanity-io/codegen#176 (typed |
Description
PR B of the
@sanity/groq-filesstack, on top of #2035 (PR A). Adds the TypeScript 7.1 content mapper so.groqimports are typed from the live buffer with no*.d.groq.tson disk, with one schema per folder for workspaces that query several projects or datasets.{ "contentMappers": [ { "package": "@sanity/groq-files", "extensions": [".groq"], "options": { "resources": [ {"path": "src/blog", "schema": "schemas/blog.json"}, {"path": ["src/shop", "src/checkout"], "schema": "schemas/shop.json"} ] } } ] }src/jsonrpc.ts: JSON-RPC 2.0 over stdio withContent-Lengthframing. Unparseable JSON is-32700 Parse error; valid JSON that is not a request, and a badContent-Length, is-32600 Invalid Requestechoing theidwhen there is one. Notifications get no reply.donesettles after the last in-flight answer once stdin ends.src/contentMapper.ts:initialize/openProject/transform/closeProject. Options areschema(one file, relative to the tsconfig, default./schema.json) andresources([{path: string | string[], schema}], mirroringtypegen.resourcesinsanity.cli.ts). A.groqfile is typed against the schema of the deepest resourcepaththat contains it, falling back toschema; each resource has its ownTypeGenerator.configIdentityis a hash over every schema file andwatchedFileslists them all. Malformed options are option diagnostics with a precisepath(["resources", 1, "schema"]), and the well-formed rest still applies. A project without a tsconfig (configFileName === "") requires absolute paths, since TS 7.1 starts the process inside the installed package.src/bin/contentMapper.ts: the always-start entry (dist/bin/contentMapper.js) referenced frompackage.jsontypescript.contentMapper.exec.Why
resourcesinside one entry rather than onecontentMappersentry per folder: TypeScript 7.1 registers a mapper by extension only. The tsconfig entry is{package, extensions, options}with noinclude/glob (contentmapper.Definitionin typescript-go), and two entries for.groqare rejected withTS18067: Content mapper file extension '.groq' is registered by more than one content mapper. Separate entries do work with separate extensions (.groqand.shop.groq); the smoke test proves both the rejection and that alternative, and the README documents it.Registration is the top-level
contentMappersfield oftsconfig.json(not insidecompilerOptions; TS 7.1.0-beta reports TS5023 for that). Sources: Announcing TypeScript 7.1 Beta, microsoft/typescript-go#4712.What to review
packages/@sanity/groq-files/src/contentMapper.ts(readOptions,readResource,resourceFor),jsonrpc.ts,bin/contentMapper.tspackage.jsontypescript.contentMapper, knip entry, README "Several projects or datasets" sectionsrc/__tests__/exampleProject.ts: the shared example copy, tsconfig builder andcheck.tstype assertions used by PR A'stsctest and the TS 7.1 smoke testTesting
13 unit tests for the mapper and framing: full round trip, utf-8-only host refused, syntax error yields a module plus a
sanity-groqdiagnostic, option diagnostics (not an object, wrong type, relative paths without a tsconfig, malformedresourcesentries), two folders with two schemas (bloggets the enum from the example schema,shopgetssku: string; price: number, aproductquery underblogisArray<never>, a file outside every resource gets the fallback with a pointed note,shopping/is not insideshop), split and packed frames, parse error vs invalid request, thrown-error mapping,endwhile a request is in flight,errorevent.contentMapper.ts71.test.tsis an opt-in smoke test against a real TypeScript 7.1tsc(GROQ_FILES_TSC71=...): three cases, all passing locally againsttypescript@7.1.0-beta:tsc --runExternalCodewith PR A'scheck.tsassertions, then a syntax error reported asbad.groq(1,17): error sanity-groq2;resourcestypingblog/andshop/against two schemas;.groqrejected withTS18067, then.groq+.shop.groqentries passing.Build,
build:types, typecheck, lint, format, publint, and knip pass.Notes for release
N/A