@sanity/cli-build 6.0.0 → 6.0.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.
@@ -162,8 +162,9 @@ declare function writeManifestFile({ outPath, workDir, workspaceManifests }: Wri
162
162
  interface ExtractManifestOptions extends Pick<WriteManifestFileOptions, 'outPath' | 'workDir'> {
163
163
  /** Absolute path to the studio's `sanity.config.(ts|js)` entry file. */
164
164
  path: string;
165
+ applicationId?: string;
165
166
  }
166
- declare function extractManifest({ outPath, path, workDir }: ExtractManifestOptions): Promise<void>;
167
+ declare function extractManifest({ applicationId, outPath, path, workDir }: ExtractManifestOptions): Promise<void>;
167
168
  /**
168
169
  * Extracts manifest data from an array of workspaces
169
170
  */
@@ -3,7 +3,7 @@ import { relative, resolve } from 'node:path';
3
3
  import { doImport, getCliConfigUncached } from '@sanity/cli-core';
4
4
  import { getErrorMessage } from '@sanity/cli-core/errors';
5
5
  import { spinner } from '@sanity/cli-core/ux';
6
- import { isWorkbenchApp } from '@sanity/workbench-cli';
6
+ import { isWorkbenchApp, isWorkbenchConfig } from '@sanity/workbench-cli';
7
7
  import { coreAppManifestSchema } from './types.js';
8
8
  /**
9
9
  * The title change a deploy would sync from the manifest to the user
@@ -70,6 +70,11 @@ const sanitizeIconPath = new URL('sanitizeIcon.js', import.meta.url).href;
70
70
  if (!app) {
71
71
  return undefined;
72
72
  }
73
+ // A config-only project (the Media Library) carries no icon or title and has
74
+ // no manifest by design — skip silently rather than warn about a missing one.
75
+ if (isWorkbenchConfig(app)) {
76
+ return undefined;
77
+ }
73
78
  const spin = spinner('Extracting manifest').start();
74
79
  try {
75
80
  let icon;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/extractCoreAppManifest.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport {relative, resolve} from 'node:path'\n\nimport {doImport, getCliConfigUncached} from '@sanity/cli-core'\nimport {getErrorMessage} from '@sanity/cli-core/errors'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {isWorkbenchApp} from '@sanity/workbench-cli'\n\nimport {type sanitizeIcon as sanitizeIconFn} from './sanitizeIcon.js'\nimport {type CoreAppManifest, coreAppManifestSchema} from './types.js'\n\ninterface ExtractCoreAppManifestOptions {\n workDir: string\n}\n\n/**\n * The title change a deploy would sync from the manifest to the user\n * application, or null when the titles already match (or none is set).\n *\n * @internal\n */\nexport function resolveTitleUpdate(\n manifest: CoreAppManifest | undefined,\n application: {title: string | null},\n): {from: string | null; to: string} | null {\n if (manifest?.title === undefined || manifest.title === application.title) {\n return null\n }\n return {from: application.title, to: manifest.title}\n}\n\nconst sanitizeIconPath = new URL('sanitizeIcon.js', import.meta.url).href\n\n/**\n * Lazy-load {@link sanitizeIconFn} so `isomorphic-dompurify` (and its jsdom\n * dependency) stays out of the CLI's eager import graph. The studio manifest\n * resolver lazy-loads its icon machinery for the same reason; this path runs in\n * the main process (not the manifest worker), so only an app deploy that\n * actually has an icon pays the cost.\n */\nasync function lazySanitizeIcon(): Promise<typeof sanitizeIconFn> {\n const mod = await doImport(sanitizeIconPath)\n return mod.sanitizeIcon\n}\n\n/**\n * Resolves app.icon from config (a file path) to a sanitized SVG string. Used\n * both for the manifest and, on deploy, for the icon shipped to Brett — the\n * manifest expects the SVG inline, not a path.\n *\n * The file is sanitized through the same allowlist as the studio manifest's\n * icon resolver (see {@link lazySanitizeIcon}) so both manifest paths inline the\n * same trusted subset of SVG markup.\n * @internal\n */\nexport async function readIconFromPath(workDir: string, iconPath: string): Promise<string> {\n const resolvedPath = resolve(workDir, iconPath)\n const pathRelativeToWorkDir = relative(workDir, resolvedPath)\n if (pathRelativeToWorkDir.startsWith('..')) {\n throw new Error(\n `Icon path \"${iconPath}\" resolves outside the project directory and is not allowed.`,\n )\n }\n\n let content: string\n try {\n content = await readFile(resolvedPath, 'utf8')\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(\n `Could not read icon file at \"${iconPath}\" (resolved: ${resolvedPath}): ${message}`,\n {cause: err},\n )\n }\n\n const trimmed = content.trim()\n if (!/<svg[\\s>]/i.test(trimmed)) {\n throw new Error(\n `Icon file at \"${iconPath}\" does not contain an SVG element. App manifest icons must be SVG files.`,\n )\n }\n\n const sanitizeIcon = await lazySanitizeIcon()\n return sanitizeIcon(trimmed)\n}\n\n/**\n * Unlike studio manifest extraction, skips schema/tool parsing. The config's\n * `app.icon` is a file path; its content is read and inlined in the manifest.\n */\nexport async function extractCoreAppManifest(\n options: ExtractCoreAppManifestOptions,\n): Promise<CoreAppManifest | undefined> {\n const {workDir} = options\n const {app} = await getCliConfigUncached(workDir)\n if (!app) {\n return undefined\n }\n\n const spin = spinner('Extracting manifest').start()\n\n try {\n let icon: string | undefined\n if (app.icon) {\n icon = await readIconFromPath(workDir, app.icon)\n }\n\n if (!icon && !app.title) {\n spin.info('Manifest creation skipped: no icon or title found in app configuration')\n return undefined\n }\n\n const workbench = isWorkbenchApp(app) ? app : undefined\n\n const manifest: CoreAppManifest = coreAppManifestSchema.parse({\n version: '1',\n ...(workbench?.dock ? {dock: workbench.dock} : {}),\n ...(icon ? {icon} : {}),\n ...(app.title ? {title: app.title} : {}),\n ...(workbench?.slug ? {slug: workbench.slug} : {}),\n })\n\n spin.succeed(`Extracted manifest`)\n\n return manifest\n } catch (err) {\n const message = getErrorMessage(err)\n spin.fail(message)\n throw err\n }\n}\n"],"names":["readFile","relative","resolve","doImport","getCliConfigUncached","getErrorMessage","spinner","isWorkbenchApp","coreAppManifestSchema","resolveTitleUpdate","manifest","application","title","undefined","from","to","sanitizeIconPath","URL","url","href","lazySanitizeIcon","mod","sanitizeIcon","readIconFromPath","workDir","iconPath","resolvedPath","pathRelativeToWorkDir","startsWith","Error","content","err","message","String","cause","trimmed","trim","test","extractCoreAppManifest","options","app","spin","start","icon","info","workbench","parse","version","dock","slug","succeed","fail"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AACzC,SAAQC,QAAQ,EAAEC,OAA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AAC,cAAc,EAAEJ,SAAS,wEAAwE,CAAC;IAEvG;IAEA,MAAMH,eAAe,MAAMF;IAC3B,OAAOE,aAAaa;AACtB;AAEA;;;CAGC,GACD,OAAO,eAAeG,uBACpBC,OAAsC;IAEtC,MAAM,EAACf,OAAO,EAAC,GAAGe;IAClB,MAAM,EAACC,GAAG,EAAC,GAAG,MAAMpC,qBAAqBoB;IACzC,IAAI,CAACgB,KAAK;QACR,OAAO3B;IACT;IAEA,MAAM4B,OAAOnC,QAAQ,uBAAuBoC,KAAK;IAEjD,IAAI;QACF,IAAIC;QACJ,IAAIH,IAAIG,IAAI,EAAE;YACZA,OAAO,MAAMpB,iBAAiBC,SAASgB,IAAIG,IAAI;QACjD;QAEA,IAAI,CAACA,QAAQ,CAACH,IAAI5B,KAAK,EAAE;YACvB6B,KAAKG,IAAI,CAAC;YACV,OAAO/B;QACT;QAEA,MAAMgC,YAAYtC,eAAeiC,OAAOA,MAAM3B;QAE9C,MAAMH,WAA4BF,sBAAsBsC,KAAK,CAAC;YAC5DC,SAAS;YACT,GAAIF,WAAWG,OAAO;gBAACA,MAAMH,UAAUG,IAAI;YAAA,IAAI,CAAC,CAAC;YACjD,GAAIL,OAAO;gBAACA;YAAI,IAAI,CAAC,CAAC;YACtB,GAAIH,IAAI5B,KAAK,GAAG;gBAACA,OAAO4B,IAAI5B,KAAK;YAAA,IAAI,CAAC,CAAC;YACvC,GAAIiC,WAAWI,OAAO;gBAACA,MAAMJ,UAAUI,IAAI;YAAA,IAAI,CAAC,CAAC;QACnD;QAEAR,KAAKS,OAAO,CAAC,CAAC,kBAAkB,CAAC;QAEjC,OAAOxC;IACT,EAAE,OAAOqB,KAAK;QACZ,MAAMC,UAAU3B,gBAAgB0B;QAChCU,KAAKU,IAAI,CAACnB;QACV,MAAMD;IACR;AACF"}
1
+ {"version":3,"sources":["../../../src/actions/manifest/extractCoreAppManifest.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport {relative, resolve} from 'node:path'\n\nimport {doImport, getCliConfigUncached} from '@sanity/cli-core'\nimport {getErrorMessage} from '@sanity/cli-core/errors'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {isWorkbenchApp, isWorkbenchConfig} from '@sanity/workbench-cli'\n\nimport {type sanitizeIcon as sanitizeIconFn} from './sanitizeIcon.js'\nimport {type CoreAppManifest, coreAppManifestSchema} from './types.js'\n\ninterface ExtractCoreAppManifestOptions {\n workDir: string\n}\n\n/**\n * The title change a deploy would sync from the manifest to the user\n * application, or null when the titles already match (or none is set).\n *\n * @internal\n */\nexport function resolveTitleUpdate(\n manifest: CoreAppManifest | undefined,\n application: {title: string | null},\n): {from: string | null; to: string} | null {\n if (manifest?.title === undefined || manifest.title === application.title) {\n return null\n }\n return {from: application.title, to: manifest.title}\n}\n\nconst sanitizeIconPath = new URL('sanitizeIcon.js', import.meta.url).href\n\n/**\n * Lazy-load {@link sanitizeIconFn} so `isomorphic-dompurify` (and its jsdom\n * dependency) stays out of the CLI's eager import graph. The studio manifest\n * resolver lazy-loads its icon machinery for the same reason; this path runs in\n * the main process (not the manifest worker), so only an app deploy that\n * actually has an icon pays the cost.\n */\nasync function lazySanitizeIcon(): Promise<typeof sanitizeIconFn> {\n const mod = await doImport(sanitizeIconPath)\n return mod.sanitizeIcon\n}\n\n/**\n * Resolves app.icon from config (a file path) to a sanitized SVG string. Used\n * both for the manifest and, on deploy, for the icon shipped to Brett — the\n * manifest expects the SVG inline, not a path.\n *\n * The file is sanitized through the same allowlist as the studio manifest's\n * icon resolver (see {@link lazySanitizeIcon}) so both manifest paths inline the\n * same trusted subset of SVG markup.\n * @internal\n */\nexport async function readIconFromPath(workDir: string, iconPath: string): Promise<string> {\n const resolvedPath = resolve(workDir, iconPath)\n const pathRelativeToWorkDir = relative(workDir, resolvedPath)\n if (pathRelativeToWorkDir.startsWith('..')) {\n throw new Error(\n `Icon path \"${iconPath}\" resolves outside the project directory and is not allowed.`,\n )\n }\n\n let content: string\n try {\n content = await readFile(resolvedPath, 'utf8')\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(\n `Could not read icon file at \"${iconPath}\" (resolved: ${resolvedPath}): ${message}`,\n {cause: err},\n )\n }\n\n const trimmed = content.trim()\n if (!/<svg[\\s>]/i.test(trimmed)) {\n throw new Error(\n `Icon file at \"${iconPath}\" does not contain an SVG element. App manifest icons must be SVG files.`,\n )\n }\n\n const sanitizeIcon = await lazySanitizeIcon()\n return sanitizeIcon(trimmed)\n}\n\n/**\n * Unlike studio manifest extraction, skips schema/tool parsing. The config's\n * `app.icon` is a file path; its content is read and inlined in the manifest.\n */\nexport async function extractCoreAppManifest(\n options: ExtractCoreAppManifestOptions,\n): Promise<CoreAppManifest | undefined> {\n const {workDir} = options\n const {app} = await getCliConfigUncached(workDir)\n if (!app) {\n return undefined\n }\n\n // A config-only project (the Media Library) carries no icon or title and has\n // no manifest by design — skip silently rather than warn about a missing one.\n if (isWorkbenchConfig(app)) {\n return undefined\n }\n\n const spin = spinner('Extracting manifest').start()\n\n try {\n let icon: string | undefined\n if (app.icon) {\n icon = await readIconFromPath(workDir, app.icon)\n }\n\n if (!icon && !app.title) {\n spin.info('Manifest creation skipped: no icon or title found in app configuration')\n return undefined\n }\n\n const workbench = isWorkbenchApp(app) ? app : undefined\n\n const manifest: CoreAppManifest = coreAppManifestSchema.parse({\n version: '1',\n ...(workbench?.dock ? {dock: workbench.dock} : {}),\n ...(icon ? {icon} : {}),\n ...(app.title ? {title: app.title} : {}),\n ...(workbench?.slug ? {slug: workbench.slug} : {}),\n })\n\n spin.succeed(`Extracted manifest`)\n\n return manifest\n } catch (err) {\n const message = getErrorMessage(err)\n spin.fail(message)\n throw err\n }\n}\n"],"names":["readFile","relative","resolve","doImport","getCliConfigUncached","getErrorMessage","spinner","isWorkbenchApp","isWorkbenchConfig","coreAppManifestSchema","resolveTitleUpdate","manifest","application","title","undefined","from","to","sanitizeIconPath","URL","url","href","lazySanitizeIcon","mod","sanitizeIcon","readIconFromPath","workDir","iconPath","resolvedPath","pathRelativeToWorkDir","startsWith","Error","content","err","message","String","cause","trimmed","trim","test","extractCoreAppManifest","options","app","spin","start","icon","info","workbench","parse","version","dock","slug","succeed","fail"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AACzC,SAAQC,QAAQ,EAAEC,OAAO,QAAO,YAAW;AAE3C,SAAQC,QAAQ,EAAEC,oBAAoB,QAAO,mBAAkB;AAC/D,SAAQC,eAAe,QAAO,0BAAyB;AACvD,SAAQC,OAAO,QAAO,sBAAqB;AAC3C,SAAQC,cAAc,EAAEC,iBAAiB,QAAO,wBAAuB;AAGvE,SAA8BC,qBAAqB,QAAO,aAAY;AAMtE;;;;;CAKC,GACD,OAAO,SAASC,mBACdC,QAAqC,EACrCC,WAAmC;IAEnC,IAAID,UAAUE,UAAUC,aAAaH,SAASE,KAAK,KAAKD,YAAYC,KAAK,EAAE;QACzE,OAAO;IACT;IACA,OAAO;QAACE,MAAMH,YAAYC,KAAK;QAAEG,IAAIL,SAASE,KAAK;IAAA;AACrD;AAEA,MAAMI,mBAAmB,IAAIC,IAAI,mBAAmB,YAAYC,GAAG,EAAEC,IAAI;AAEzE;;;;;;CAMC,GACD,eAAeC;IACb,MAAMC,MAAM,MAAMnB,SAASc;IAC3B,OAAOK,IAAIC,YAAY;AACzB;AAEA;;;;;;;;;CASC,GACD,OAAO,eAAeC,iBAAiBC,OAAe,EAAEC,QAAgB;IACtE,MAAMC,eAAezB,QAAQuB,SAASC;IACtC,MAAME,wBAAwB3B,SAASwB,SAASE;IAChD,IAAIC,sBAAsBC,UAAU,CAAC,OAAO;QAC1C,MAAM,IAAIC,MACR,CAAC,WAAW,EAAEJ,SAAS,4DAA4D,CAAC;IAExF;IAEA,IAAIK;IACJ,IAAI;QACFA,UAAU,MAAM/B,SAAS2B,cAAc;IACzC,EAAE,OAAOK,KAAK;QACZ,MAAMC,UAAUD,eAAeF,QAAQE,IAAIC,OAAO,GAAGC,OAAOF;QAC5D,MAAM,IA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AC,CAAC;QACnD;QAEAR,KAAKS,OAAO,CAAC,CAAC,kBAAkB,CAAC;QAEjC,OAAOxC;IACT,EAAE,OAAOqB,KAAK;QACZ,MAAMC,UAAU5B,gBAAgB2B;QAChCU,KAAKU,IAAI,CAACnB;QACV,MAAMD;IACR;AACF"}
@@ -4,7 +4,7 @@ import { SchemaExtractionError } from '../schema/utils/SchemaExtractionError.js'
4
4
  import { manifestDebug } from './debug.js';
5
5
  import { writeManifestFile } from './writeManifestFile.js';
6
6
  const CREATE_TIMER = 'create-manifest';
7
- export async function extractManifest({ outPath, path, workDir }) {
7
+ export async function extractManifest({ applicationId, outPath, path, workDir }) {
8
8
  manifestDebug('Project root %o', {
9
9
  directory: workDir,
10
10
  path
@@ -14,6 +14,7 @@ export async function extractManifest({ outPath, path, workDir }) {
14
14
  const spin = spinner('Extracting manifest').start();
15
15
  try {
16
16
  const result = await studioWorkerTask(new URL('extractManifest.worker.js', import.meta.url), {
17
+ applicationId,
17
18
  name: 'extractManifest',
18
19
  studioRootPath: workDir,
19
20
  workerData: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/extractManifest.ts"],"sourcesContent":["import {getTimer, studioWorkerTask} from '@sanity/cli-core'\nimport {spinner} from '@sanity/cli-core/ux'\n\nimport {type ExtractSchemaWorkerError} from '../schema/types.js'\nimport {SchemaExtractionError} from '../schema/utils/SchemaExtractionError.js'\nimport {manifestDebug} from './debug.js'\nimport {type CreateWorkspaceManifest, type ExtractManifestWorkerData} from './types.js'\nimport {writeManifestFile, type WriteManifestFileOptions} from './writeManifestFile.js'\n\nconst CREATE_TIMER = 'create-manifest'\n\ninterface ExtractManifestWorkerResult {\n type: 'success'\n workspaceManifests: CreateWorkspaceManifest[]\n}\n\ntype ExtractManifestWorkerMessage = ExtractManifestWorkerResult | ExtractSchemaWorkerError\n\ninterface ExtractManifestOptions extends Pick<WriteManifestFileOptions, 'outPath' | 'workDir'> {\n /** Absolute path to the studio's `sanity.config.(ts|js)` entry file. */\n path: string\n}\n\nexport async function extractManifest({\n outPath,\n path,\n workDir,\n}: ExtractManifestOptions): Promise<void> {\n manifestDebug('Project root %o', {directory: workDir, path})\n\n const timer = getTimer()\n timer.start(CREATE_TIMER)\n const spin = spinner('Extracting manifest').start()\n\n try {\n const result = await studioWorkerTask<ExtractManifestWorkerMessage>(\n new URL('extractManifest.worker.js', import.meta.url),\n {\n name: 'extractManifest',\n studioRootPath: workDir,\n workerData: {configPath: path, workDir} satisfies ExtractManifestWorkerData,\n },\n )\n\n manifestDebug('Result %o', result)\n\n if (result.type === 'error') {\n throw new SchemaExtractionError(result.error, result.validation)\n }\n\n await writeManifestFile({\n outPath,\n workDir,\n workspaceManifests: result.workspaceManifests,\n })\n\n const manifestDuration = timer.end(CREATE_TIMER)\n\n spin.succeed(`Extracted manifest (${manifestDuration.toFixed(0)}ms)`)\n } catch (err) {\n manifestDebug('Error extracting manifest', err)\n spin.fail()\n\n throw err\n }\n}\n"],"names":["getTimer","studioWorkerTask","spinner","SchemaExtractionError","manifestDebug","writeManifestFile","CREATE_TIMER","extractManifest","outPath","path","workDir","directory","timer","start","spin","result","URL","url","name","studioRootPath","workerData","configPath","type","error","validation","workspaceManifests","manifestDuration","end","succeed","toFixed","err","fail"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,gBAAgB,QAAO,mBAAkB;AAC3D,SAAQC,OAAO,QAAO,sBAAqB;AAG3C,SAAQC,qBAAqB,QAAO,2CAA0C;AAC9E,SAAQC,aAAa,QAAO,aAAY;AAExC,SAAQC,iBAAiB,QAAsC,yBAAwB;AAEvF,MAAMC,eAAe;AAcrB,OAAO,eAAeC,gBAAgB,EACpCC,OAAO,EACPC,IAAI,EACJC,OAAO,EACgB;IACvBN,cAAc,mBAAmB;QAACO,WAAWD;QAASD;IAAI;IAE1D,MAAMG,QAAQZ;IACdY,MAAMC,KAAK,CAACP;IACZ,MAAMQ,OAAOZ,QAAQ,uBAAuBW,KAAK;IAEjD,IAAI;QACF,MAAME,SAAS,MAAMd,iBACnB,IAAIe,IAAI,6BAA6B,YAAYC,GAAG,GACpD;YACEC,MAAM;YACNC,gBAAgBT;YAChBU,YAAY;gBAACC,YAAYZ;gBAAMC;YAAO;QACxC;QAGFN,cAAc,aAAaW;QAE3B,IAAIA,OAAOO,IAAI,KAAK,SAAS;YAC3B,MAAM,IAAInB,sBAAsBY,OAAOQ,KAAK,EAAER,OAAOS,UAAU;QACjE;QAEA,MAAMnB,kBAAkB;YACtBG;YACAE;YACAe,oBAAoBV,OAAOU,kBAAkB;QAC/C;QAEA,MAAMC,mBAAmBd,MAAMe,GAAG,CAACrB;QAEnCQ,KAAKc,OAAO,CAAC,CAAC,oBAAoB,EAAEF,iBAAiBG,OAAO,CAAC,GAAG,GAAG,CAAC;IACtE,EAAE,OAAOC,KAAK;QACZ1B,cAAc,6BAA6B0B;QAC3ChB,KAAKiB,IAAI;QAET,MAAMD;IACR;AACF"}
1
+ {"version":3,"sources":["../../../src/actions/manifest/extractManifest.ts"],"sourcesContent":["import {getTimer, studioWorkerTask} from '@sanity/cli-core'\nimport {spinner} from '@sanity/cli-core/ux'\n\nimport {type ExtractSchemaWorkerError} from '../schema/types.js'\nimport {SchemaExtractionError} from '../schema/utils/SchemaExtractionError.js'\nimport {manifestDebug} from './debug.js'\nimport {type CreateWorkspaceManifest, type ExtractManifestWorkerData} from './types.js'\nimport {writeManifestFile, type WriteManifestFileOptions} from './writeManifestFile.js'\n\nconst CREATE_TIMER = 'create-manifest'\n\ninterface ExtractManifestWorkerResult {\n type: 'success'\n workspaceManifests: CreateWorkspaceManifest[]\n}\n\ntype ExtractManifestWorkerMessage = ExtractManifestWorkerResult | ExtractSchemaWorkerError\n\ninterface ExtractManifestOptions extends Pick<WriteManifestFileOptions, 'outPath' | 'workDir'> {\n /** Absolute path to the studio's `sanity.config.(ts|js)` entry file. */\n path: string\n\n applicationId?: string\n}\n\nexport async function extractManifest({\n applicationId,\n outPath,\n path,\n workDir,\n}: ExtractManifestOptions): Promise<void> {\n manifestDebug('Project root %o', {directory: workDir, path})\n\n const timer = getTimer()\n timer.start(CREATE_TIMER)\n const spin = spinner('Extracting manifest').start()\n\n try {\n const result = await studioWorkerTask<ExtractManifestWorkerMessage>(\n new URL('extractManifest.worker.js', import.meta.url),\n {\n applicationId,\n name: 'extractManifest',\n studioRootPath: workDir,\n workerData: {configPath: path, workDir} satisfies ExtractManifestWorkerData,\n },\n )\n\n manifestDebug('Result %o', result)\n\n if (result.type === 'error') {\n throw new SchemaExtractionError(result.error, result.validation)\n }\n\n await writeManifestFile({\n outPath,\n workDir,\n workspaceManifests: result.workspaceManifests,\n })\n\n const manifestDuration = timer.end(CREATE_TIMER)\n\n spin.succeed(`Extracted manifest (${manifestDuration.toFixed(0)}ms)`)\n } catch (err) {\n manifestDebug('Error extracting manifest', err)\n spin.fail()\n\n throw err\n }\n}\n"],"names":["getTimer","studioWorkerTask","spinner","SchemaExtractionError","manifestDebug","writeManifestFile","CREATE_TIMER","extractManifest","applicationId","outPath","path","workDir","directory","timer","start","spin","result","URL","url","name","studioRootPath","workerData","configPath","type","error","validation","workspaceManifests","manifestDuration","end","succeed","toFixed","err","fail"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,gBAAgB,QAAO,mBAAkB;AAC3D,SAAQC,OAAO,QAAO,sBAAqB;AAG3C,SAAQC,qBAAqB,QAAO,2CAA0C;AAC9E,SAAQC,aAAa,QAAO,aAAY;AAExC,SAAQC,iBAAiB,QAAsC,yBAAwB;AAEvF,MAAMC,eAAe;AAgBrB,OAAO,eAAeC,gBAAgB,EACpCC,aAAa,EACbC,OAAO,EACPC,IAAI,EACJC,OAAO,EACgB;IACvBP,cAAc,mBAAmB;QAACQ,WAAWD;QAASD;IAAI;IAE1D,MAAMG,QAAQb;IACda,MAAMC,KAAK,CAACR;IACZ,MAAMS,OAAOb,QAAQ,uBAAuBY,KAAK;IAEjD,IAAI;QACF,MAAME,SAAS,MAAMf,iBACnB,IAAIgB,IAAI,6BAA6B,YAAYC,GAAG,GACpD;YACEV;YACAW,MAAM;YACNC,gBAAgBT;YAChBU,YAAY;gBAACC,YAAYZ;gBAAMC;YAAO;QACxC;QAGFP,cAAc,aAAaY;QAE3B,IAAIA,OAAOO,IAAI,KAAK,SAAS;YAC3B,MAAM,IAAIpB,sBAAsBa,OAAOQ,KAAK,EAAER,OAAOS,UAAU;QACjE;QAEA,MAAMpB,kBAAkB;YACtBI;YACAE;YACAe,oBAAoBV,OAAOU,kBAAkB;QAC/C;QAEA,MAAMC,mBAAmBd,MAAMe,GAAG,CAACtB;QAEnCS,KAAKc,OAAO,CAAC,CAAC,oBAAoB,EAAEF,iBAAiBG,OAAO,CAAC,GAAG,GAAG,CAAC;IACtE,EAAE,OAAOC,KAAK;QACZ3B,cAAc,6BAA6B2B;QAC3ChB,KAAKiB,IAAI;QAET,MAAMD;IACR;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-build",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Internal Sanity package for building studios and apps",
5
5
  "keywords": [
6
6
  "cli",
@@ -70,8 +70,8 @@
70
70
  "semver": "^7.8.1",
71
71
  "vite": "^8.2.1",
72
72
  "zod": "^4.4.3",
73
- "@sanity/cli-core": "^3.4.0",
74
- "@sanity/workbench-cli": "^2.2.1"
73
+ "@sanity/cli-core": "^3.5.0",
74
+ "@sanity/workbench-cli": "^2.2.3"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/compat": "^2.1.0",
@@ -98,7 +98,7 @@
98
98
  "vitest": "^4.1.11",
99
99
  "@repo/package.config": "0.0.1",
100
100
  "@repo/tsconfig": "3.70.0",
101
- "@sanity/cli-test": "14.0.0",
101
+ "@sanity/cli-test": "15.0.0",
102
102
  "@sanity/eslint-config-cli": "^1.1.3"
103
103
  },
104
104
  "peerDependencies": {