@sanity/cli-build 6.4.1 → 6.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,15 @@
1
1
  import { RESOURCE_BINDINGS_ENTRY_IMPORT } from '@sanity/workbench-cli/build';
2
+ // The user module (`sanity.config.*`, or the app's `App`) is the first import
3
+ // after resource bindings. ESM evaluates static imports in source order, and
4
+ // `react-dom` reads `__REACT_DEVTOOLS_GLOBAL_HOOK__` once at module init, so a
5
+ // side-effect import at the top of the user module (for example
6
+ // `react-devtools-cdt-mcp/register`) only runs before react-dom if the user
7
+ // module is requested before `sanity` / `react-dom/client`.
2
8
  const entryModule = `
3
9
  // This file is auto-generated on 'sanity dev'
4
10
  // Modifications to this file is automatically discarded
5
- %RESOURCE_BINDINGS_IMPORT%import {renderStudio} from "sanity"
6
- import studioConfig from %STUDIO_CONFIG_LOCATION%
11
+ %RESOURCE_BINDINGS_IMPORT%import studioConfig from %STUDIO_CONFIG_LOCATION%
12
+ import {renderStudio} from "sanity"
7
13
 
8
14
  renderStudio(
9
15
  document.getElementById("sanity"),
@@ -27,9 +33,9 @@ renderStudio(
27
33
  const appEntryModule = `
28
34
  // This file is auto-generated on 'sanity dev'
29
35
  // Modifications to this file is automatically discarded
30
- %RESOURCE_BINDINGS_IMPORT%import {createRoot} from 'react-dom/client'
36
+ %RESOURCE_BINDINGS_IMPORT%import App from %ENTRY%
37
+ import {createRoot} from 'react-dom/client'
31
38
  import {createElement} from 'react'
32
- import App from %ENTRY%
33
39
 
34
40
  const root = createRoot(document.getElementById('root'))
35
41
  const element = createElement(App)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/build/getEntryModule.ts"],"sourcesContent":["import {RESOURCE_BINDINGS_ENTRY_IMPORT} from '@sanity/workbench-cli/build'\n\nconst entryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import {renderStudio} from \"sanity\"\nimport studioConfig from %STUDIO_CONFIG_LOCATION%\n\nrenderStudio(\n document.getElementById(\"sanity\"),\n studioConfig,\n {reactStrictMode: %STUDIO_REACT_STRICT_MODE%, basePath: %STUDIO_BASE_PATH%}\n)\n`\n\nconst noConfigEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import {renderStudio} from \"sanity\"\n\nconst studioConfig = {missingConfigFile: true}\n\nrenderStudio(\n document.getElementById(\"sanity\"),\n studioConfig,\n {reactStrictMode: %STUDIO_REACT_STRICT_MODE%, basePath: %STUDIO_BASE_PATH%}\n)\n`\n\nconst appEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import {createRoot} from 'react-dom/client'\nimport {createElement} from 'react'\nimport App from %ENTRY%\n\nconst root = createRoot(document.getElementById('root'))\nconst element = createElement(App)\nroot.render(element)\n`\n\n// A branded app with no \\`entry\\` (sanity-io/workbench spec 002-workbench-extension-api, US5) has no navigable app view, so there's no\n// \\`App\\` to import or render standalone — it contributes panels/services to the\n// workbench instead. The page stays valid (no broken import) for the dev server.\nconst noAppViewEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%const root = document.getElementById('root')\nif (root) {\n root.textContent = 'This application has no app view.'\n}\n`\n\nexport function getEntryModule(options: {\n basePath?: string\n entry?: string\n isApp?: boolean\n isBlueprints?: boolean\n reactStrictMode: boolean | undefined\n relativeConfigLocation: string | null\n}): string {\n const {basePath, entry, isApp, isBlueprints, reactStrictMode, relativeConfigLocation} = options\n\n // Under Blueprints the entry statically imports the resource-bindings module\n // first (writeSanityRuntime emits it); otherwise the placeholder resolves to\n // nothing so the import — and the module — are absent.\n const withBindings = (module: string): string =>\n module.replace(\n /%RESOURCE_BINDINGS_IMPORT%/,\n isBlueprints ? `${RESOURCE_BINDINGS_ENTRY_IMPORT}\\n` : '',\n )\n\n if (isApp) {\n return withBindings(\n entry ? appEntryModule.replace(/%ENTRY%/, JSON.stringify(entry)) : noAppViewEntryModule,\n )\n }\n\n const sourceModule = relativeConfigLocation ? entryModule : noConfigEntryModule\n\n return withBindings(\n sourceModule\n .replace(\n /%STUDIO_REACT_STRICT_MODE%/,\n reactStrictMode === undefined ? 'undefined' : JSON.stringify(reactStrictMode),\n )\n .replace(/%STUDIO_CONFIG_LOCATION%/, JSON.stringify(relativeConfigLocation))\n .replace(/%STUDIO_BASE_PATH%/, JSON.stringify(basePath || '/')),\n )\n}\n"],"names":["RESOURCE_BINDINGS_ENTRY_IMPORT","entryModule","noConfigEntryModule","appEntryModule","noAppViewEntryModule","getEntryModule","options","basePath","entry","isApp","isBlueprints","reactStrictMode","relativeConfigLocation","withBindings","module","replace","JSON","stringify","sourceModule","undefined"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,8BAA6B;AAE1E,MAAMC,cAAc,CAAC;;;;;;;;;;;AAWrB,CAAC;AAED,MAAMC,sBAAsB,CAAC;;;;;;;;;;;;AAY7B,CAAC;AAED,MAAMC,iBAAiB,CAAC;;;;;;;;;;AAUxB,CAAC;AAED,uIAAuI;AACvI,iFAAiF;AACjF,iFAAiF;AACjF,MAAMC,uBAAuB,CAAC;;;;;;;AAO9B,CAAC;AAED,OAAO,SAASC,eAAeC,OAO9B;IACC,MAAM,EAACC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,EAAEC,eAAe,EAAEC,sBAAsB,EAAC,GAAGN;IAExF,6EAA6E;IAC7E,6EAA6E;IAC7E,uDAAuD;IACvD,MAAMO,eAAe,CAACC,SACpBA,OAAOC,OAAO,CACZ,8BACAL,eAAe,GAAGV,+BAA+B,EAAE,CAAC,GAAG;IAG3D,IAAIS,OAAO;QACT,OAAOI,aACLL,QAAQL,eAAeY,OAAO,CAAC,WAAWC,KAAKC,SAAS,CAACT,UAAUJ;IAEvE;IAEA,MAAMc,eAAeN,yBAAyBX,cAAcC;IAE5D,OAAOW,aACLK,aACGH,OAAO,CACN,8BACAJ,oBAAoBQ,YAAY,cAAcH,KAAKC,SAAS,CAACN,kBAE9DI,OAAO,CAAC,4BAA4BC,KAAKC,SAAS,CAACL,yBACnDG,OAAO,CAAC,sBAAsBC,KAAKC,SAAS,CAACV,YAAY;AAEhE"}
1
+ {"version":3,"sources":["../../../src/actions/build/getEntryModule.ts"],"sourcesContent":["import {RESOURCE_BINDINGS_ENTRY_IMPORT} from '@sanity/workbench-cli/build'\n\n// The user module (`sanity.config.*`, or the app's `App`) is the first import\n// after resource bindings. ESM evaluates static imports in source order, and\n// `react-dom` reads `__REACT_DEVTOOLS_GLOBAL_HOOK__` once at module init, so a\n// side-effect import at the top of the user module (for example\n// `react-devtools-cdt-mcp/register`) only runs before react-dom if the user\n// module is requested before `sanity` / `react-dom/client`.\nconst entryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import studioConfig from %STUDIO_CONFIG_LOCATION%\nimport {renderStudio} from \"sanity\"\n\nrenderStudio(\n document.getElementById(\"sanity\"),\n studioConfig,\n {reactStrictMode: %STUDIO_REACT_STRICT_MODE%, basePath: %STUDIO_BASE_PATH%}\n)\n`\n\nconst noConfigEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import {renderStudio} from \"sanity\"\n\nconst studioConfig = {missingConfigFile: true}\n\nrenderStudio(\n document.getElementById(\"sanity\"),\n studioConfig,\n {reactStrictMode: %STUDIO_REACT_STRICT_MODE%, basePath: %STUDIO_BASE_PATH%}\n)\n`\n\nconst appEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%import App from %ENTRY%\nimport {createRoot} from 'react-dom/client'\nimport {createElement} from 'react'\n\nconst root = createRoot(document.getElementById('root'))\nconst element = createElement(App)\nroot.render(element)\n`\n\n// A branded app with no \\`entry\\` (sanity-io/workbench spec 002-workbench-extension-api, US5) has no navigable app view, so there's no\n// \\`App\\` to import or render standalone — it contributes panels/services to the\n// workbench instead. The page stays valid (no broken import) for the dev server.\nconst noAppViewEntryModule = `\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file is automatically discarded\n%RESOURCE_BINDINGS_IMPORT%const root = document.getElementById('root')\nif (root) {\n root.textContent = 'This application has no app view.'\n}\n`\n\nexport function getEntryModule(options: {\n basePath?: string\n entry?: string\n isApp?: boolean\n isBlueprints?: boolean\n reactStrictMode: boolean | undefined\n relativeConfigLocation: string | null\n}): string {\n const {basePath, entry, isApp, isBlueprints, reactStrictMode, relativeConfigLocation} = options\n\n // Under Blueprints the entry statically imports the resource-bindings module\n // first (writeSanityRuntime emits it); otherwise the placeholder resolves to\n // nothing so the import — and the module — are absent.\n const withBindings = (module: string): string =>\n module.replace(\n /%RESOURCE_BINDINGS_IMPORT%/,\n isBlueprints ? `${RESOURCE_BINDINGS_ENTRY_IMPORT}\\n` : '',\n )\n\n if (isApp) {\n return withBindings(\n entry ? appEntryModule.replace(/%ENTRY%/, JSON.stringify(entry)) : noAppViewEntryModule,\n )\n }\n\n const sourceModule = relativeConfigLocation ? entryModule : noConfigEntryModule\n\n return withBindings(\n sourceModule\n .replace(\n /%STUDIO_REACT_STRICT_MODE%/,\n reactStrictMode === undefined ? 'undefined' : JSON.stringify(reactStrictMode),\n )\n .replace(/%STUDIO_CONFIG_LOCATION%/, JSON.stringify(relativeConfigLocation))\n .replace(/%STUDIO_BASE_PATH%/, JSON.stringify(basePath || '/')),\n )\n}\n"],"names":["RESOURCE_BINDINGS_ENTRY_IMPORT","entryModule","noConfigEntryModule","appEntryModule","noAppViewEntryModule","getEntryModule","options","basePath","entry","isApp","isBlueprints","reactStrictMode","relativeConfigLocation","withBindings","module","replace","JSON","stringify","sourceModule","undefined"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,8BAA6B;AAE1E,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,gEAAgE;AAChE,4EAA4E;AAC5E,4DAA4D;AAC5D,MAAMC,cAAc,CAAC;;;;;;;;;;;AAWrB,CAAC;AAED,MAAMC,sBAAsB,CAAC;;;;;;;;;;;;AAY7B,CAAC;AAED,MAAMC,iBAAiB,CAAC;;;;;;;;;;AAUxB,CAAC;AAED,uIAAuI;AACvI,iFAAiF;AACjF,iFAAiF;AACjF,MAAMC,uBAAuB,CAAC;;;;;;;AAO9B,CAAC;AAED,OAAO,SAASC,eAAeC,OAO9B;IACC,MAAM,EAACC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,EAAEC,eAAe,EAAEC,sBAAsB,EAAC,GAAGN;IAExF,6EAA6E;IAC7E,6EAA6E;IAC7E,uDAAuD;IACvD,MAAMO,eAAe,CAACC,SACpBA,OAAOC,OAAO,CACZ,8BACAL,eAAe,GAAGV,+BAA+B,EAAE,CAAC,GAAG;IAG3D,IAAIS,OAAO;QACT,OAAOI,aACLL,QAAQL,eAAeY,OAAO,CAAC,WAAWC,KAAKC,SAAS,CAACT,UAAUJ;IAEvE;IAEA,MAAMc,eAAeN,yBAAyBX,cAAcC;IAE5D,OAAOW,aACLK,aACGH,OAAO,CACN,8BACAJ,oBAAoBQ,YAAY,cAAcH,KAAKC,SAAS,CAACN,kBAE9DI,OAAO,CAAC,4BAA4BC,KAAKC,SAAS,CAACL,yBACnDG,OAAO,CAAC,sBAAsBC,KAAKC,SAAS,CAACV,YAAY;AAEhE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-build",
3
- "version": "6.4.1",
3
+ "version": "6.4.2",
4
4
  "description": "Internal Sanity package for building studios and apps",
5
5
  "keywords": [
6
6
  "cli",
@@ -52,12 +52,12 @@
52
52
  "dependencies": {
53
53
  "@oclif/core": "^4.11.14",
54
54
  "@rolldown/plugin-babel": "^0.2.3",
55
- "@sanity/cli-core": "^3.8.0",
55
+ "@sanity/cli-core": "^3.8.1",
56
56
  "@sanity/generate-help-url": "^4.0.0",
57
57
  "@sanity/schema": "^6.15.0",
58
58
  "@sanity/telemetry": "^1.1.0",
59
59
  "@sanity/types": "^6.15.0",
60
- "@sanity/workbench-cli": "^2.6.0",
60
+ "@sanity/workbench-cli": "^2.8.0",
61
61
  "@vitejs/plugin-react": "^6.1.1",
62
62
  "chokidar": "^5.0.0",
63
63
  "cjs-module-lexer": "^2.2.1",
@@ -79,7 +79,7 @@
79
79
  "@eslint/compat": "^2.1.0",
80
80
  "@repo/package.config": "0.0.1",
81
81
  "@repo/tsconfig": "3.70.0",
82
- "@sanity/cli-test": "18.0.0",
82
+ "@sanity/cli-test": "18.0.1",
83
83
  "@sanity/eslint-config-cli": "^1.1.3",
84
84
  "@sanity/pkg-utils": "^12.3.4",
85
85
  "@sanity/ui": "^4.2.1",