@sanity/cli 8.1.0 → 8.2.0
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.
- package/dist/server/devServer.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +15 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/devServer.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {\n extendViteConfigWithUserConfig,\n getViteConfig,\n writeSanityRuntime,\n} from '@sanity/cli-build/_internal/build'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from '@sanity/cli-build/_internal/env'\nimport {CliConfig, getCliTelemetry, type UserViteConfig} from '@sanity/cli-core'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {type
|
|
1
|
+
{"version":3,"sources":["../../src/server/devServer.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {\n extendViteConfigWithUserConfig,\n getViteConfig,\n writeSanityRuntime,\n} from '@sanity/cli-build/_internal/build'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from '@sanity/cli-build/_internal/env'\nimport {CliConfig, getCliTelemetry, type UserViteConfig} from '@sanity/cli-core'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {type FSWatcher} from 'chokidar'\nimport {createServer, type InlineConfig, type ViteDevServer} from 'vite'\n\nimport {serverDebug} from './serverDebug.js'\nimport {sanityTypegenPlugin} from './vite/plugin-typegen.js'\n\nconst debug = serverDebug.extend('dev')\n\nexport interface DevServerOptions {\n basePath: string\n cwd: string\n httpPort: number\n\n reactCompiler: CliConfig['reactCompiler']\n reactStrictMode: boolean | undefined\n\n staticPath: string\n\n appTitle?: string\n /** Enable Vite's experimental bundled dev mode (`experimental.bundledDev`). */\n bundledDev?: boolean\n entry?: string\n exposes?: WorkbenchExposes\n httpHost?: string\n isApp?: boolean\n isWorkbenchApp?: boolean\n projectName?: string\n schemaExtraction?: CliConfig['schemaExtraction']\n typegen?: CliConfig['typegen']\n vite?: UserViteConfig\n /** The workbench app's bus identity (`__SANITY_APP_ID__`). */\n workbenchAppId?: string\n}\n\ninterface DevServer {\n close(): Promise<void>\n server: ViteDevServer\n\n watcher?: FSWatcher\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<DevServer> {\n const {\n appTitle,\n basePath,\n bundledDev,\n cwd,\n entry,\n exposes,\n httpHost,\n httpPort,\n isApp,\n isWorkbenchApp,\n reactCompiler,\n reactStrictMode,\n schemaExtraction,\n typegen,\n vite: extendViteConfig,\n workbenchAppId,\n } = options\n\n debug('Writing Sanity runtime files')\n const {entries, watcher} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode,\n watch: true,\n })\n\n debug('Resolving vite config')\n const mode = 'development'\n\n function getEnvironmentVariables() {\n return isApp\n ? getAppEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n : getStudioEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n }\n\n let viteConfig: InlineConfig = await getViteConfig({\n additionalPlugins: [\n // Add typegen when enabled\n ...(typegen?.enabled\n ? [\n sanityTypegenPlugin({\n config: typegen,\n telemetryLogger: getCliTelemetry(),\n workDir: cwd,\n }),\n ]\n : []),\n ],\n basePath,\n cwd,\n entries,\n exposes,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n mode: 'development',\n reactCompiler,\n schemaExtraction,\n server: {host: httpHost, port: httpPort},\n workbenchAppId,\n })\n\n // Opt into Vite's experimental bundled dev mode. Set before the user-config\n // extension below so a `vite` override in sanity.cli.ts still has final say.\n //\n // Bundled mode bundles the app up front from an HTML entry, defaulting to\n // `<root>/index.html`. Sanity has no such file — it serves a virtual document\n // rewritten to `.sanity/runtime/index.html` — so point the bundler at the real\n // runtime HTML, otherwise the build fails with UNRESOLVED_ENTRY.\n //\n // Also force `strictExecutionOrder` so shared chunks cannot evaluate before the\n // entry chunk's react-refresh preamble (which otherwise throws\n // \"@vitejs/plugin-react can't detect preamble\").\n // See https://github.com/vitejs/vite-plugin-react/issues/1191\n if (bundledDev) {\n const existingRolldown = viteConfig.build?.rolldownOptions\n const existingOutput = existingRolldown?.output\n viteConfig = {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n rolldownOptions: {\n ...existingRolldown,\n input: path.join(cwd, '.sanity', 'runtime', 'index.html'),\n output: Array.isArray(existingOutput)\n ? existingOutput.map((entry) => ({...entry, strictExecutionOrder: true}))\n : {...existingOutput, strictExecutionOrder: true},\n },\n },\n experimental: {...viteConfig.experimental, bundledDev: true},\n }\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const server = await createServer(viteConfig)\n\n debug('Listening on specified port')\n await server.listen()\n\n return {\n close: async () => {\n if (watcher) {\n await watcher.close()\n }\n await server.close()\n },\n server,\n watcher,\n }\n}\n"],"names":["path","extendViteConfigWithUserConfig","getViteConfig","writeSanityRuntime","getAppEnvironmentVariables","getStudioEnvironmentVariables","getCliTelemetry","createServer","serverDebug","sanityTypegenPlugin","debug","extend","startDevServer","options","appTitle","basePath","bundledDev","cwd","entry","exposes","httpHost","httpPort","isApp","isWorkbenchApp","reactCompiler","reactStrictMode","schemaExtraction","typegen","vite","extendViteConfig","workbenchAppId","entries","watcher","watch","mode","getEnvironmentVariables","jsonEncode","prefix","viteConfig","additionalPlugins","enabled","config","telemetryLogger","workDir","server","host","port","existingRolldown","build","rolldownOptions","existingOutput","output","input","join","Array","isArray","map","strictExecutionOrder","experimental","command","listen","close"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SACEC,8BAA8B,EAC9BC,aAAa,EACbC,kBAAkB,QACb,oCAAmC;AAC1C,SACEC,0BAA0B,EAC1BC,6BAA6B,QACxB,kCAAiC;AACxC,SAAmBC,eAAe,QAA4B,mBAAkB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AY;QACd,MAAM+B,mBAAmBT,WAAWU,KAAK,EAAEC;QAC3C,MAAMC,iBAAiBH,kBAAkBI;QACzCb,aAAa;YACX,GAAGA,UAAU;YACbU,OAAO;gBACL,GAAGV,WAAWU,KAAK;gBACnBC,iBAAiB;oBACf,GAAGF,gBAAgB;oBACnBK,OAAOpD,KAAKqD,IAAI,CAACpC,KAAK,WAAW,WAAW;oBAC5CkC,QAAQG,MAAMC,OAAO,CAACL,kBAClBA,eAAeM,GAAG,CAAC,CAACtC,QAAW,CAAA;4BAAC,GAAGA,KAAK;4BAAEuC,sBAAsB;wBAAI,CAAA,KACpE;wBAAC,GAAGP,cAAc;wBAAEO,sBAAsB;oBAAI;gBACpD;YACF;YACAC,cAAc;gBAAC,GAAGpB,WAAWoB,YAAY;gBAAE1C,YAAY;YAAI;QAC7D;IACF;IAEA,sDAAsD;IACtD,IAAIa,kBAAkB;QACpBS,aAAa,MAAMrC,+BACjB;YAAC0D,SAAS;YAASzB;QAAI,GACvBI,YACAT;IAEJ;IAEAnB,MAAM;IACN,MAAMkC,SAAS,MAAMrC,aAAa+B;IAElC5B,MAAM;IACN,MAAMkC,OAAOgB,MAAM;IAEnB,OAAO;QACLC,OAAO;YACL,IAAI7B,SAAS;gBACX,MAAMA,QAAQ6B,KAAK;YACrB;YACA,MAAMjB,OAAOiB,KAAK;QACpB;QACAjB;QACAZ;IACF;AACF"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
"wrap-ansi": "^9.0.2",
|
|
123
123
|
"yaml": "^2.9.0",
|
|
124
124
|
"zod": "^4.4.3",
|
|
125
|
-
"@sanity/cli-build": "^5.
|
|
126
|
-
"@sanity/
|
|
127
|
-
"@sanity/cli
|
|
125
|
+
"@sanity/cli-build": "^5.3.0",
|
|
126
|
+
"@sanity/cli-core": "^3.2.0",
|
|
127
|
+
"@sanity/workbench-cli": "^2.0.2"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@eslint/compat": "^2.1.0",
|
|
131
|
-
"@sanity/pkg-utils": "^12.
|
|
131
|
+
"@sanity/pkg-utils": "^12.2.0",
|
|
132
132
|
"@sanity/ui": "^3.5.0",
|
|
133
133
|
"@swc/cli": "^0.8.1",
|
|
134
134
|
"@swc/core": "^1.15.43",
|
|
@@ -145,29 +145,34 @@
|
|
|
145
145
|
"@types/tar-fs": "^2.0.4",
|
|
146
146
|
"@types/tar-stream": "^3.1.4",
|
|
147
147
|
"@types/which": "^3.0.4",
|
|
148
|
-
"@vitest/coverage-istanbul": "^4.1.
|
|
148
|
+
"@vitest/coverage-istanbul": "^4.1.11",
|
|
149
149
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
150
150
|
"eslint": "^10.7.0",
|
|
151
151
|
"get-it": "^9.5.0",
|
|
152
152
|
"jsdom": "^29.1.1",
|
|
153
153
|
"nock": "^14.0.15",
|
|
154
154
|
"oclif": "^4.23.27",
|
|
155
|
+
"oxc-transform-react": "^0.145.0",
|
|
155
156
|
"publint": "^0.3.21",
|
|
156
157
|
"rimraf": "^6.0.1",
|
|
157
158
|
"sanity": "^6.7.0",
|
|
158
159
|
"typescript": "^6.0.3",
|
|
159
|
-
"vitest": "^4.1.
|
|
160
|
-
"@repo/package.config": "0.0.1",
|
|
160
|
+
"vitest": "^4.1.11",
|
|
161
161
|
"@repo/tsconfig": "3.70.0",
|
|
162
|
-
"@
|
|
162
|
+
"@repo/package.config": "0.0.1",
|
|
163
|
+
"@sanity/cli-test": "12.0.0",
|
|
163
164
|
"@sanity/eslint-config-cli": "1.1.3"
|
|
164
165
|
},
|
|
165
166
|
"peerDependencies": {
|
|
166
|
-
"babel-plugin-react-compiler": "*"
|
|
167
|
+
"babel-plugin-react-compiler": "*",
|
|
168
|
+
"oxc-transform-react": "*"
|
|
167
169
|
},
|
|
168
170
|
"peerDependenciesMeta": {
|
|
169
171
|
"babel-plugin-react-compiler": {
|
|
170
172
|
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"oxc-transform-react": {
|
|
175
|
+
"optional": true
|
|
171
176
|
}
|
|
172
177
|
},
|
|
173
178
|
"engines": {
|