@sanity/cli-build 6.0.2 → 6.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.
@@ -1,7 +1,29 @@
1
+ import { i as CreateWorkspaceManifest } from "./types-Dj4qu4gT.js";
1
2
  import { ProjectRootResult } from "@sanity/cli-core/types";
2
3
  import { SchemaValidationProblemGroup } from "@sanity/types";
3
- import { extractSchema } from "@sanity/schema/_internal";
4
4
  import { StudioManifest, Workspace } from "sanity";
5
+ import { z } from "zod/mini";
6
+ import { extractSchema } from "@sanity/schema/_internal";
7
+ declare const buildStudioSchemasAndManifestsWorkerData: z.ZodMiniObject<{
8
+ configPath: z.ZodMiniString<string>;
9
+ isExternal: z.ZodMiniBoolean<boolean>;
10
+ outPath: z.ZodMiniString<string>;
11
+ projectId: z.ZodMiniString<string>;
12
+ verbose: z.ZodMiniBoolean<boolean>;
13
+ workDir: z.ZodMiniString<string>;
14
+ }, z.core.$strip>;
15
+ type BuildStudioSchemasAndManifestsWorkerData = z.infer<typeof buildStudioSchemasAndManifestsWorkerData>;
16
+ type BuildStudioSchemasAndManifestsWorkerSuccess = {
17
+ studioManifest: StudioManifest | null;
18
+ type: 'success';
19
+ workspaceManifests: CreateWorkspaceManifest[];
20
+ };
21
+ /**
22
+ * 1. Extracts the create manifest in dist/static (tar/gzipped with studio)
23
+ * 2. Uploads the schema to lexicon
24
+ * 3. Creates a studio manifest (which can be sent to populus)
25
+ */
26
+ declare function buildStudioSchemasAndManifests(applicationId: string, options: BuildStudioSchemasAndManifestsWorkerData): Promise<BuildStudioSchemasAndManifestsWorkerSuccess>;
5
27
  declare function getAggregatedSeverity(groupOrGroups: SchemaValidationProblemGroup | SchemaValidationProblemGroup[]): 'error' | 'warning';
6
28
  declare function formatSchemaValidation(validation: SchemaValidationProblemGroup[]): string;
7
29
  interface ExtractOptions {
@@ -58,6 +80,13 @@ declare class SchemaExtractionError extends Error {
58
80
  validation?: SchemaValidationProblemGroup[];
59
81
  constructor(message: string, validation?: SchemaValidationProblemGroup[]);
60
82
  }
83
+ /**
84
+ * This function must only be called from another worker process.
85
+ * @param options - The worker options
86
+ */
87
+ declare function workerBuildStudioSchemasAndManifests(options: BuildStudioSchemasAndManifestsWorkerData & {
88
+ workspaceManifestsHandler?: (workspaceManifests: CreateWorkspaceManifest[]) => Promise<void>;
89
+ }): Promise<BuildStudioSchemasAndManifestsWorkerSuccess>;
61
90
  interface SchemaExtractedTraceAttributes {
62
91
  enforceRequiredFields: boolean;
63
92
  schemaAllTypesCount: number;
@@ -84,5 +113,5 @@ interface SchemaDeployTraceData {
84
113
  declare const SchemaExtractedTrace: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaExtractedTraceAttributes, void>;
85
114
  declare const SchemaExtractionWatchModeTrace: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaExtractionWatchModeAttributes, void>;
86
115
  declare const SchemaDeploy: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaDeployTraceData, void>;
87
- export { type ExtractOptions, SchemaDeploy, SchemaExtractedTrace, SchemaExtractionError, SchemaExtractionWatchModeTrace, createSchemaPatternMatcher, extractValidationFromSchemaError, formatSchemaValidation, getAggregatedSeverity, getExtractOptions, runSchemaExtraction, uploadSchemaToLexicon };
116
+ export { type ExtractOptions, SchemaDeploy, SchemaExtractedTrace, SchemaExtractionError, SchemaExtractionWatchModeTrace, buildStudioSchemasAndManifests, createSchemaPatternMatcher, extractValidationFromSchemaError, formatSchemaValidation, getAggregatedSeverity, getExtractOptions, runSchemaExtraction, uploadSchemaToLexicon, workerBuildStudioSchemasAndManifests };
88
117
  //# sourceMappingURL=extract.d.ts.map
@@ -1,3 +1,4 @@
1
+ export { buildStudioSchemasAndManifests } from '../../actions/schema/buildStudioSchemasAndManifests.js';
1
2
  export { formatSchemaValidation, getAggregatedSeverity } from '../../actions/schema/formatSchemaValidation.js';
2
3
  export { getExtractOptions } from '../../actions/schema/getExtractOptions.js';
3
4
  export { createSchemaPatternMatcher } from '../../actions/schema/matchSchemaPattern.js';
@@ -5,6 +6,7 @@ export { runSchemaExtraction } from '../../actions/schema/runSchemaExtraction.js
5
6
  export { uploadSchemaToLexicon } from '../../actions/schema/uploadSchemaToLexicon.js';
6
7
  export { extractValidationFromSchemaError } from '../../actions/schema/utils/extractValidationFromSchemaError.js';
7
8
  export { SchemaExtractionError } from '../../actions/schema/utils/SchemaExtractionError.js';
9
+ export { workerBuildStudioSchemasAndManifests } from '../../actions/schema/workerBuildStudioSchemasAndManifests.js';
8
10
  export { SchemaDeploy, SchemaExtractedTrace, SchemaExtractionWatchModeTrace } from '../../telemetry/extractSchema.telemetry.js';
9
11
 
10
12
  //# sourceMappingURL=extract.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/_exports/_internal/extract.ts"],"sourcesContent":["export {\n formatSchemaValidation,\n getAggregatedSeverity,\n} from '../../actions/schema/formatSchemaValidation.js'\nexport {type ExtractOptions, getExtractOptions} from '../../actions/schema/getExtractOptions.js'\nexport {createSchemaPatternMatcher} from '../../actions/schema/matchSchemaPattern.js'\nexport {runSchemaExtraction} from '../../actions/schema/runSchemaExtraction.js'\nexport {uploadSchemaToLexicon} from '../../actions/schema/uploadSchemaToLexicon.js'\nexport {extractValidationFromSchemaError} from '../../actions/schema/utils/extractValidationFromSchemaError.js'\nexport {SchemaExtractionError} from '../../actions/schema/utils/SchemaExtractionError.js'\nexport {\n SchemaDeploy,\n SchemaExtractedTrace,\n SchemaExtractionWatchModeTrace,\n} from '../../telemetry/extractSchema.telemetry.js'\n"],"names":["formatSchemaValidation","getAggregatedSeverity","getExtractOptions","createSchemaPatternMatcher","runSchemaExtraction","uploadSchemaToLexicon","extractValidationFromSchemaError","SchemaExtractionError","SchemaDeploy","SchemaExtractedTrace","SchemaExtractionWatchModeTrace"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,qBAAqB,QAChB,iDAAgD;AACvD,SAA6BC,iBAAiB,QAAO,4CAA2C;AAChG,SAAQC,0BAA0B,QAAO,6CAA4C;AACrF,SAAQC,mBAAmB,QAAO,8CAA6C;AAC/E,SAAQC,qBAAqB,QAAO,gDAA+C;AACnF,SAAQC,gCAAgC,QAAO,iEAAgE;AAC/G,SAAQC,qBAAqB,QAAO,sDAAqD;AACzF,SACEC,YAAY,EACZC,oBAAoB,EACpBC,8BAA8B,QACzB,6CAA4C"}
1
+ {"version":3,"sources":["../../../src/_exports/_internal/extract.ts"],"sourcesContent":["export {buildStudioSchemasAndManifests} from '../../actions/schema/buildStudioSchemasAndManifests.js'\nexport {\n formatSchemaValidation,\n getAggregatedSeverity,\n} from '../../actions/schema/formatSchemaValidation.js'\nexport {type ExtractOptions, getExtractOptions} from '../../actions/schema/getExtractOptions.js'\nexport {createSchemaPatternMatcher} from '../../actions/schema/matchSchemaPattern.js'\nexport {runSchemaExtraction} from '../../actions/schema/runSchemaExtraction.js'\nexport {uploadSchemaToLexicon} from '../../actions/schema/uploadSchemaToLexicon.js'\nexport {extractValidationFromSchemaError} from '../../actions/schema/utils/extractValidationFromSchemaError.js'\nexport {SchemaExtractionError} from '../../actions/schema/utils/SchemaExtractionError.js'\nexport {workerBuildStudioSchemasAndManifests} from '../../actions/schema/workerBuildStudioSchemasAndManifests.js'\nexport {\n SchemaDeploy,\n SchemaExtractedTrace,\n SchemaExtractionWatchModeTrace,\n} from '../../telemetry/extractSchema.telemetry.js'\n"],"names":["buildStudioSchemasAndManifests","formatSchemaValidation","getAggregatedSeverity","getExtractOptions","createSchemaPatternMatcher","runSchemaExtraction","uploadSchemaToLexicon","extractValidationFromSchemaError","SchemaExtractionError","workerBuildStudioSchemasAndManifests","SchemaDeploy","SchemaExtractedTrace","SchemaExtractionWatchModeTrace"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,yDAAwD;AACrG,SACEC,sBAAsB,EACtBC,qBAAqB,QAChB,iDAAgD;AACvD,SAA6BC,iBAAiB,QAAO,4CAA2C;AAChG,SAAQC,0BAA0B,QAAO,6CAA4C;AACrF,SAAQC,mBAAmB,QAAO,8CAA6C;AAC/E,SAAQC,qBAAqB,QAAO,gDAA+C;AACnF,SAAQC,gCAAgC,QAAO,iEAAgE;AAC/G,SAAQC,qBAAqB,QAAO,sDAAqD;AACzF,SAAQC,oCAAoC,QAAO,+DAA8D;AACjH,SACEC,YAAY,EACZC,oBAAoB,EACpBC,8BAA8B,QACzB,6CAA4C"}
@@ -1,117 +1,6 @@
1
- import { SanityDocumentLike, Schema } from "@sanity/types";
2
- import { MediaLibraryConfig, Workspace } from "sanity";
3
- import "zod/mini";
4
- import { CoreAppManifest, StudioManifest } from "@sanity/cli-core";
5
- declare const SANITY_WORKSPACE_SCHEMA_ID_PREFIX = "_.schemas";
6
- declare const CURRENT_WORKSPACE_SCHEMA_VERSION = "2025-05-01";
7
- type ManifestSerializable = boolean | ManifestSerializable[] | number | string | {
8
- [k: string]: ManifestSerializable;
9
- };
10
- interface CreateManifest {
11
- createdAt: string;
12
- studioVersion: string | null;
13
- version: number;
14
- workspaces: ManifestWorkspaceFile[];
15
- }
16
- interface ManifestWorkspaceFile extends Omit<CreateWorkspaceManifest, 'schema' | 'tools'> {
17
- schema: string;
18
- tools: string;
19
- }
20
- interface CreateWorkspaceManifest {
21
- basePath: string;
22
- dataset: string;
23
- /**
24
- * returns null in the case of the icon not being able to be stringified
25
- */
26
- icon: string | null;
27
- name: string;
28
- projectId: string;
29
- schema: ManifestSchemaType[];
30
- tools: ManifestTool[];
31
- mediaLibrary?: MediaLibraryConfig;
32
- subtitle?: string;
33
- title?: string;
34
- }
35
- interface ManifestSchemaType {
36
- name: string;
37
- type: string;
38
- deprecated?: {
39
- reason: string;
40
- };
41
- fields?: ManifestField[];
42
- fieldsets?: ManifestFieldset[];
43
- hidden?: 'conditional' | boolean;
44
- lists?: ManifestTitledValue[];
45
- marks?: {
46
- annotations?: ManifestArrayMember[];
47
- decorators?: ManifestTitledValue[];
48
- };
49
- of?: ManifestArrayMember[];
50
- options?: Record<string, ManifestSerializable>;
51
- preview?: {
52
- select: Record<string, string>;
53
- };
54
- readOnly?: 'conditional' | boolean;
55
- styles?: ManifestTitledValue[];
56
- title?: string;
57
- to?: ManifestReferenceMember[];
58
- validation?: ManifestValidationGroup[];
59
- }
60
- interface ManifestFieldset {
61
- [index: string]: ManifestSerializable | undefined;
62
- name: string;
63
- title?: string;
64
- }
65
- interface ManifestTitledValue {
66
- value: string;
67
- title?: string;
68
- }
69
- type ManifestArrayMember = Omit<ManifestSchemaType, 'name'> & {
70
- name?: string;
71
- };
72
- type ManifestReferenceMember = Omit<ManifestSchemaType, 'name'> & {
73
- name?: string;
74
- };
75
- type ManifestField = ManifestSchemaType & {
76
- fieldset?: string;
77
- };
78
- interface ManifestValidationGroup {
79
- rules: ManifestValidationRule[];
80
- level?: 'error' | 'info' | 'warning';
81
- message?: string;
82
- }
83
- type ManifestValidationRule = {
84
- [index: string]: ManifestSerializable | undefined;
85
- constraint?: ManifestSerializable;
86
- flag: string;
87
- };
88
- interface ManifestTool {
89
- /**
90
- * returns null in the case of the icon not being able to be stringified
91
- */
92
- icon: string | null;
93
- name: string;
94
- title: string;
95
- type: string | null;
96
- }
97
- type DefaultWorkspaceSchemaId = `${typeof SANITY_WORKSPACE_SCHEMA_ID_PREFIX}.${string}`;
98
- type PrefixedWorkspaceSchemaId = `${DefaultWorkspaceSchemaId}.${string}`;
99
- type WorkspaceSchemaId = DefaultWorkspaceSchemaId | PrefixedWorkspaceSchemaId;
100
- interface StoredWorkspaceSchema extends SanityDocumentLike {
101
- _id: WorkspaceSchemaId;
102
- _type: 'system.schema';
103
- /**
104
- * The API expects JSON coming in, but will store a string to save on attribute paths.
105
- * Consumers must use JSON.parse on the value, but we deploy to the API using ManifestSchemaType[]
106
- */
107
- schema: ManifestSchemaType[] | string;
108
- version: typeof CURRENT_WORKSPACE_SCHEMA_VERSION | undefined;
109
- workspace: {
110
- name: string;
111
- title?: string;
112
- };
113
- tag?: string;
114
- }
1
+ import { a as DefaultWorkspaceSchemaId, c as StoredWorkspaceSchema, i as CreateWorkspaceManifest, l as StudioManifest, n as CoreAppManifest, o as ManifestSchemaType, r as CreateManifest, s as SANITY_WORKSPACE_SCHEMA_ID_PREFIX, t as CURRENT_WORKSPACE_SCHEMA_VERSION, u as WorkspaceSchemaId } from "./types-Dj4qu4gT.js";
2
+ import { Schema } from "@sanity/types";
3
+ import { Workspace } from "sanity";
115
4
  interface ExtractCoreAppManifestOptions {
116
5
  workDir: string;
117
6
  }
@@ -0,0 +1,116 @@
1
+ import { SanityDocumentLike } from "@sanity/types";
2
+ import { MediaLibraryConfig } from "sanity";
3
+ import { z } from "zod/mini";
4
+ import { CoreAppManifest, StudioManifest as StudioManifest$1 } from "@sanity/cli-core";
5
+ declare const SANITY_WORKSPACE_SCHEMA_ID_PREFIX = "_.schemas";
6
+ declare const CURRENT_WORKSPACE_SCHEMA_VERSION = "2025-05-01";
7
+ type ManifestSerializable = boolean | ManifestSerializable[] | number | string | {
8
+ [k: string]: ManifestSerializable;
9
+ };
10
+ interface CreateManifest {
11
+ createdAt: string;
12
+ studioVersion: string | null;
13
+ version: number;
14
+ workspaces: ManifestWorkspaceFile[];
15
+ }
16
+ interface ManifestWorkspaceFile extends Omit<CreateWorkspaceManifest, 'schema' | 'tools'> {
17
+ schema: string;
18
+ tools: string;
19
+ }
20
+ interface CreateWorkspaceManifest {
21
+ basePath: string;
22
+ dataset: string;
23
+ /**
24
+ * returns null in the case of the icon not being able to be stringified
25
+ */
26
+ icon: string | null;
27
+ name: string;
28
+ projectId: string;
29
+ schema: ManifestSchemaType[];
30
+ tools: ManifestTool[];
31
+ mediaLibrary?: MediaLibraryConfig;
32
+ subtitle?: string;
33
+ title?: string;
34
+ }
35
+ interface ManifestSchemaType {
36
+ name: string;
37
+ type: string;
38
+ deprecated?: {
39
+ reason: string;
40
+ };
41
+ fields?: ManifestField[];
42
+ fieldsets?: ManifestFieldset[];
43
+ hidden?: 'conditional' | boolean;
44
+ lists?: ManifestTitledValue[];
45
+ marks?: {
46
+ annotations?: ManifestArrayMember[];
47
+ decorators?: ManifestTitledValue[];
48
+ };
49
+ of?: ManifestArrayMember[];
50
+ options?: Record<string, ManifestSerializable>;
51
+ preview?: {
52
+ select: Record<string, string>;
53
+ };
54
+ readOnly?: 'conditional' | boolean;
55
+ styles?: ManifestTitledValue[];
56
+ title?: string;
57
+ to?: ManifestReferenceMember[];
58
+ validation?: ManifestValidationGroup[];
59
+ }
60
+ interface ManifestFieldset {
61
+ [index: string]: ManifestSerializable | undefined;
62
+ name: string;
63
+ title?: string;
64
+ }
65
+ interface ManifestTitledValue {
66
+ value: string;
67
+ title?: string;
68
+ }
69
+ type ManifestArrayMember = Omit<ManifestSchemaType, 'name'> & {
70
+ name?: string;
71
+ };
72
+ type ManifestReferenceMember = Omit<ManifestSchemaType, 'name'> & {
73
+ name?: string;
74
+ };
75
+ type ManifestField = ManifestSchemaType & {
76
+ fieldset?: string;
77
+ };
78
+ interface ManifestValidationGroup {
79
+ rules: ManifestValidationRule[];
80
+ level?: 'error' | 'info' | 'warning';
81
+ message?: string;
82
+ }
83
+ type ManifestValidationRule = {
84
+ [index: string]: ManifestSerializable | undefined;
85
+ constraint?: ManifestSerializable;
86
+ flag: string;
87
+ };
88
+ interface ManifestTool {
89
+ /**
90
+ * returns null in the case of the icon not being able to be stringified
91
+ */
92
+ icon: string | null;
93
+ name: string;
94
+ title: string;
95
+ type: string | null;
96
+ }
97
+ type DefaultWorkspaceSchemaId = `${typeof SANITY_WORKSPACE_SCHEMA_ID_PREFIX}.${string}`;
98
+ type PrefixedWorkspaceSchemaId = `${DefaultWorkspaceSchemaId}.${string}`;
99
+ type WorkspaceSchemaId = DefaultWorkspaceSchemaId | PrefixedWorkspaceSchemaId;
100
+ interface StoredWorkspaceSchema extends SanityDocumentLike {
101
+ _id: WorkspaceSchemaId;
102
+ _type: 'system.schema';
103
+ /**
104
+ * The API expects JSON coming in, but will store a string to save on attribute paths.
105
+ * Consumers must use JSON.parse on the value, but we deploy to the API using ManifestSchemaType[]
106
+ */
107
+ schema: ManifestSchemaType[] | string;
108
+ version: typeof CURRENT_WORKSPACE_SCHEMA_VERSION | undefined;
109
+ workspace: {
110
+ name: string;
111
+ title?: string;
112
+ };
113
+ tag?: string;
114
+ }
115
+ export { DefaultWorkspaceSchemaId as a, StoredWorkspaceSchema as c, CreateWorkspaceManifest as i, StudioManifest$1 as l, CoreAppManifest as n, ManifestSchemaType as o, CreateManifest as r, SANITY_WORKSPACE_SCHEMA_ID_PREFIX as s, CURRENT_WORKSPACE_SCHEMA_VERSION as t, WorkspaceSchemaId as u };
116
+ //# sourceMappingURL=types-Dj4qu4gT.d.ts.map
@@ -17,15 +17,15 @@ import { resolveEntries, writeSanityRuntime } from './writeSanityRuntime.js';
17
17
  * (remote-entry, mf-manifest) — skip client-specific steps like
18
18
  * runtime generation, static file copies, and favicons.
19
19
  */ if (isWorkbenchApp) {
20
- // A workbench remote can also serve itself standalone. When
21
- // `SANITY_INTERNAL_IS_WORKBENCH_REMOTE` is set, emit an SPA (index.html +
22
- // bootstrap + favicons) into the same `dist` as the federation output via a
23
- // dedicated `client` environment (see plugin-sanity-environment). Skipped for
24
- // a dock-only app (no `./App` to mount), matching `exposesApp` in plugin.ts.
25
- const emitSpa = process.env.SANITY_INTERNAL_IS_WORKBENCH_REMOTE === 'true' && !(isApp && !entry);
20
+ // Every federated app and studio also serves itself standalone: emit an SPA
21
+ // (index.html + bootstrap + favicons) into the same `dist` as the federation
22
+ // output via a dedicated `client` environment (see plugin-sanity-environment).
23
+ // Skipped for a dock-only app (no `./App` to mount), matching `exposesApp` in
24
+ // plugin.ts.
25
+ const emitSpa = !(isApp && !entry);
26
26
  let entries;
27
27
  if (emitSpa) {
28
- buildDebug('Writing Sanity runtime files (workbench remote SPA)');
28
+ buildDebug('Writing Sanity runtime files (standalone SPA)');
29
29
  ({ entries } = await writeSanityRuntime({
30
30
  appTitle,
31
31
  basePath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/build/buildStaticFiles.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type CliConfig, type UserViteConfig} from '@sanity/cli-core/types'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {build, createBuilder} from 'vite'\n\nimport {copyDir} from '../../util/copyDir.js'\nimport {type AutoUpdatesBuildConfig} from './autoUpdates.js'\nimport {buildDebug} from './buildDebug.js'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from './getEnvironmentVariables.js'\nimport {extendViteConfigWithUserConfig, finalizeViteConfig, getViteConfig} from './getViteConfig.js'\nimport {writeFavicons} from './writeFavicons.js'\nimport {resolveEntries, writeSanityRuntime} from './writeSanityRuntime.js'\n\nexport interface ChunkModule {\n name: string\n renderedLength: number\n}\n\nexport interface ChunkStats {\n modules: ChunkModule[]\n name: string\n}\n\ninterface StaticBuildOptions {\n basePath: string\n cwd: string\n outputDir: string\n\n appTitle?: string\n autoUpdates?: AutoUpdatesBuildConfig\n entry?: string\n exposes?: WorkbenchExposes\n isApp?: boolean\n /** Workbench app (opted in via `defineApplication`) — drives the federation build. */\n isWorkbenchApp?: boolean\n minify?: boolean\n profile?: boolean\n reactCompiler?: CliConfig['reactCompiler']\n schemaExtraction?: CliConfig['schemaExtraction']\n sourceMap?: boolean\n vite?: UserViteConfig\n /** The workbench app's bus identity (`__SANITY_APP_ID__`). */\n workbenchAppId?: string\n}\n\n/**\n * Builds static files\n *\n * @internal\n */\nexport async function buildStaticFiles(\n options: StaticBuildOptions,\n): Promise<{chunks: ChunkStats[]}> {\n const {\n appTitle,\n autoUpdates,\n basePath,\n cwd,\n entry,\n exposes,\n isApp,\n isWorkbenchApp,\n minify = true,\n outputDir,\n reactCompiler,\n schemaExtraction,\n sourceMap = false,\n vite: extendViteConfig,\n workbenchAppId,\n } = options\n\n const mode = 'production'\n\n /* Federation builds only produce the federation environment\n * (remote-entry, mf-manifest) — skip client-specific steps like\n * runtime generation, static file copies, and favicons.\n */\n if (isWorkbenchApp) {\n // A workbench remote can also serve itself standalone. When\n // `SANITY_INTERNAL_IS_WORKBENCH_REMOTE` is set, emit an SPA (index.html +\n // bootstrap + favicons) into the same `dist` as the federation output via a\n // dedicated `client` environment (see plugin-sanity-environment). Skipped for\n // a dock-only app (no `./App` to mount), matching `exposesApp` in plugin.ts.\n const emitSpa = process.env.SANITY_INTERNAL_IS_WORKBENCH_REMOTE === 'true' && !(isApp && !entry)\n\n let entries: Awaited<ReturnType<typeof resolveEntries>>\n if (emitSpa) {\n buildDebug('Writing Sanity runtime files (workbench remote SPA)')\n ;({entries} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode: false,\n watch: false,\n }))\n } else {\n buildDebug('Resolving entries for federation build')\n entries = await resolveEntries({cwd, entry, isApp, isWorkbenchApp})\n }\n\n buildDebug('Resolving vite config (federation)')\n let viteConfig = await getViteConfig({\n basePath,\n cwd,\n entries,\n exposes,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n minify,\n mode,\n outputDir,\n reactCompiler,\n // Schema extraction is a build-time artifact, not a client-specific step,\n // so a federated studio extracts its schema like the legacy studio build.\n schemaExtraction,\n sourceMap,\n workbenchAppId,\n })\n\n // Apply the user's Vite config so plugins like `@vanilla-extract/vite-plugin`\n // transform source files before the federation environment is bundled.\n // `finalizeViteConfig` is intentionally skipped: the federation environment\n // has its own entry and does not use `.sanity/runtime/app.js`.\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n if (emitSpa) {\n const fromPath = path.join(cwd, 'static')\n const staticPath = path.join(outputDir, 'static')\n buildDebug(`Copying static files from ${fromPath} to output dir`)\n await copyDir(fromPath, staticPath)\n buildDebug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n }\n\n buildDebug('Bundling federation environment')\n const builder = await createBuilder(viteConfig)\n await builder.buildApp()\n buildDebug('Bundling complete')\n // TODO: add stats here\n return {chunks: []}\n }\n\n buildDebug('Writing Sanity runtime files')\n const {entries} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode: false,\n watch: false,\n })\n\n function getEnvironmentVariables() {\n return isApp\n ? getAppEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n : getStudioEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n }\n\n buildDebug('Resolving vite config')\n let viteConfig = await getViteConfig({\n autoUpdates,\n basePath,\n cwd,\n entries,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n minify,\n mode,\n outputDir,\n reactCompiler,\n schemaExtraction,\n sourceMap,\n })\n\n if (extendViteConfig) {\n const defaultViteConfig = viteConfig\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n viteConfig = await finalizeViteConfig(viteConfig, defaultViteConfig)\n }\n\n const fromPath = path.join(cwd, 'static')\n // Copy files placed in /static to the built /static\n buildDebug(`Copying static files from ${fromPath} to output dir`)\n const staticPath = path.join(outputDir, 'static')\n await copyDir(fromPath, staticPath)\n\n // Write favicons, not overwriting ones that already exist, to static folder\n buildDebug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n\n buildDebug('Bundling using vite')\n const bundle = await build(viteConfig)\n buildDebug('Bundling complete')\n\n // For typescript only - this shouldn't ever be the case given we're not watching\n if (Array.isArray(bundle) || !('output' in bundle)) {\n return {chunks: []}\n }\n\n const stats: ChunkStats[] = []\n for (const chunk of bundle.output) {\n if (chunk.type !== 'chunk') {\n continue\n }\n\n stats.push({\n modules: Object.entries(chunk.modules).map(([rawFilePath, chunkModule]) => {\n const filePath = rawFilePath.startsWith('\\u0000')\n ? rawFilePath.slice('\\u0000'.length)\n : rawFilePath\n\n return {\n name: path.isAbsolute(filePath) ? path.relative(cwd, filePath) : filePath,\n renderedLength: chunkModule.renderedLength,\n }\n }),\n name: chunk.name,\n })\n }\n\n return {chunks: stats}\n}\n"],"names":["path","build","createBuilder","copyDir","buildDebug","getAppEnvironmentVariables","getStudioEnvironmentVariables","extendViteConfigWithUserConfig","finalizeViteConfig","getViteConfig","writeFavicons","resolveEntries","writeSanityRuntime","buildStaticFiles","options","appTitle","autoUpdates","basePath","cwd","entry","exposes","isApp","isWorkbenchApp","minify","outputDir","reactCompiler","schemaExtraction","sourceMap","vite","extendViteConfig","workbenchAppId","mode","emitSpa","process","env","SANITY_INTERNAL_IS_WORKBENCH_REMOTE","entries","reactStrictMode","watch","viteConfig","getEnvironmentVariables","command","fromPath","join","staticPath","faviconBasePath","replace","builder","buildApp","chunks","jsonEncode","prefix","defaultViteConfig","bundle","Array","isArray","stats","chunk","output","type","push","modules","Object","map","rawFilePath","chunkModule","filePath","startsWith","slice","length","name","isAbsolute","relative","renderedLength"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAI5B,SAAQC,KAAK,EAAEC,aAAa,QAAO,OAAM;AAEzC,SAAQC,OAAO,QAAO,wBAAuB;AAE7C,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SACEC,0BAA0B,EAC1BC,6BAA6B,QACxB,+BAA8B;AACrC,SAAQC,8BAA8B,EAAEC,kBAAkB,EAAEC,aAAa,QAAO,qBAAoB;AACpG,SAAQC,aAAa,QAAO,qBAAoB;AAChD,SAAQC,cAAc,EAAEC,kBAAkB,QAAO,0BAAyB;AAkC1E;;;;CAIC,GACD,OAAO,eAAeC,iBACpBC,OAA2B;IAE3B,MAAM,EACJC,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,GAAG,EACHC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,cAAc,EACdC,SAAS,IAAI,EACbC,SAAS,EACTC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,KAAK,EACjBC,MAAMC,gBAAgB,EACtBC,cAA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B,EAAE;IAC9B,KAAK,MAAMC,SAASJ,OAAOK,MAAM,CAAE;QACjC,IAAID,MAAME,IAAI,KAAK,SAAS;YAC1B;QACF;QAEAH,MAAMI,IAAI,CAAC;YACTC,SAASC,OAAO1B,OAAO,CAACqB,MAAMI,OAAO,EAAEE,GAAG,CAAC,CAAC,CAACC,aAAaC,YAAY;gBACpE,MAAMC,WAAWF,YAAYG,UAAU,CAAC,YACpCH,YAAYI,KAAK,CAAC,SAASC,MAAM,IACjCL;gBAEJ,OAAO;oBACLM,MAAMtE,KAAKuE,UAAU,CAACL,YAAYlE,KAAKwE,QAAQ,CAACtD,KAAKgD,YAAYA;oBACjEO,gBAAgBR,YAAYQ,cAAc;gBAC5C;YACF;YACAH,MAAMb,MAAMa,IAAI;QAClB;IACF;IAEA,OAAO;QAACrB,QAAQO;IAAK;AACvB"}
1
+ {"version":3,"sources":["../../../src/actions/build/buildStaticFiles.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type CliConfig, type UserViteConfig} from '@sanity/cli-core/types'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {build, createBuilder} from 'vite'\n\nimport {copyDir} from '../../util/copyDir.js'\nimport {type AutoUpdatesBuildConfig} from './autoUpdates.js'\nimport {buildDebug} from './buildDebug.js'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from './getEnvironmentVariables.js'\nimport {extendViteConfigWithUserConfig, finalizeViteConfig, getViteConfig} from './getViteConfig.js'\nimport {writeFavicons} from './writeFavicons.js'\nimport {resolveEntries, writeSanityRuntime} from './writeSanityRuntime.js'\n\nexport interface ChunkModule {\n name: string\n renderedLength: number\n}\n\nexport interface ChunkStats {\n modules: ChunkModule[]\n name: string\n}\n\ninterface StaticBuildOptions {\n basePath: string\n cwd: string\n outputDir: string\n\n appTitle?: string\n autoUpdates?: AutoUpdatesBuildConfig\n entry?: string\n exposes?: WorkbenchExposes\n isApp?: boolean\n /** Workbench app (opted in via `defineApplication`) — drives the federation build. */\n isWorkbenchApp?: boolean\n minify?: boolean\n profile?: boolean\n reactCompiler?: CliConfig['reactCompiler']\n schemaExtraction?: CliConfig['schemaExtraction']\n sourceMap?: boolean\n vite?: UserViteConfig\n /** The workbench app's bus identity (`__SANITY_APP_ID__`). */\n workbenchAppId?: string\n}\n\n/**\n * Builds static files\n *\n * @internal\n */\nexport async function buildStaticFiles(\n options: StaticBuildOptions,\n): Promise<{chunks: ChunkStats[]}> {\n const {\n appTitle,\n autoUpdates,\n basePath,\n cwd,\n entry,\n exposes,\n isApp,\n isWorkbenchApp,\n minify = true,\n outputDir,\n reactCompiler,\n schemaExtraction,\n sourceMap = false,\n vite: extendViteConfig,\n workbenchAppId,\n } = options\n\n const mode = 'production'\n\n /* Federation builds only produce the federation environment\n * (remote-entry, mf-manifest) — skip client-specific steps like\n * runtime generation, static file copies, and favicons.\n */\n if (isWorkbenchApp) {\n // Every federated app and studio also serves itself standalone: emit an SPA\n // (index.html + bootstrap + favicons) into the same `dist` as the federation\n // output via a dedicated `client` environment (see plugin-sanity-environment).\n // Skipped for a dock-only app (no `./App` to mount), matching `exposesApp` in\n // plugin.ts.\n const emitSpa = !(isApp && !entry)\n\n let entries: Awaited<ReturnType<typeof resolveEntries>>\n if (emitSpa) {\n buildDebug('Writing Sanity runtime files (standalone SPA)')\n ;({entries} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode: false,\n watch: false,\n }))\n } else {\n buildDebug('Resolving entries for federation build')\n entries = await resolveEntries({cwd, entry, isApp, isWorkbenchApp})\n }\n\n buildDebug('Resolving vite config (federation)')\n let viteConfig = await getViteConfig({\n basePath,\n cwd,\n entries,\n exposes,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n minify,\n mode,\n outputDir,\n reactCompiler,\n // Schema extraction is a build-time artifact, not a client-specific step,\n // so a federated studio extracts its schema like the legacy studio build.\n schemaExtraction,\n sourceMap,\n workbenchAppId,\n })\n\n // Apply the user's Vite config so plugins like `@vanilla-extract/vite-plugin`\n // transform source files before the federation environment is bundled.\n // `finalizeViteConfig` is intentionally skipped: the federation environment\n // has its own entry and does not use `.sanity/runtime/app.js`.\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n if (emitSpa) {\n const fromPath = path.join(cwd, 'static')\n const staticPath = path.join(outputDir, 'static')\n buildDebug(`Copying static files from ${fromPath} to output dir`)\n await copyDir(fromPath, staticPath)\n buildDebug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n }\n\n buildDebug('Bundling federation environment')\n const builder = await createBuilder(viteConfig)\n await builder.buildApp()\n buildDebug('Bundling complete')\n // TODO: add stats here\n return {chunks: []}\n }\n\n buildDebug('Writing Sanity runtime files')\n const {entries} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode: false,\n watch: false,\n })\n\n function getEnvironmentVariables() {\n return isApp\n ? getAppEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n : getStudioEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n }\n\n buildDebug('Resolving vite config')\n let viteConfig = await getViteConfig({\n autoUpdates,\n basePath,\n cwd,\n entries,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n minify,\n mode,\n outputDir,\n reactCompiler,\n schemaExtraction,\n sourceMap,\n })\n\n if (extendViteConfig) {\n const defaultViteConfig = viteConfig\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n viteConfig = await finalizeViteConfig(viteConfig, defaultViteConfig)\n }\n\n const fromPath = path.join(cwd, 'static')\n // Copy files placed in /static to the built /static\n buildDebug(`Copying static files from ${fromPath} to output dir`)\n const staticPath = path.join(outputDir, 'static')\n await copyDir(fromPath, staticPath)\n\n // Write favicons, not overwriting ones that already exist, to static folder\n buildDebug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n\n buildDebug('Bundling using vite')\n const bundle = await build(viteConfig)\n buildDebug('Bundling complete')\n\n // For typescript only - this shouldn't ever be the case given we're not watching\n if (Array.isArray(bundle) || !('output' in bundle)) {\n return {chunks: []}\n }\n\n const stats: ChunkStats[] = []\n for (const chunk of bundle.output) {\n if (chunk.type !== 'chunk') {\n continue\n }\n\n stats.push({\n modules: Object.entries(chunk.modules).map(([rawFilePath, chunkModule]) => {\n const filePath = rawFilePath.startsWith('\\u0000')\n ? rawFilePath.slice('\\u0000'.length)\n : rawFilePath\n\n return {\n name: path.isAbsolute(filePath) ? path.relative(cwd, filePath) : filePath,\n renderedLength: chunkModule.renderedLength,\n }\n }),\n name: chunk.name,\n })\n }\n\n return {chunks: stats}\n}\n"],"names":["path","build","createBuilder","copyDir","buildDebug","getAppEnvironmentVariables","getStudioEnvironmentVariables","extendViteConfigWithUserConfig","finalizeViteConfig","getViteConfig","writeFavicons","resolveEntries","writeSanityRuntime","buildStaticFiles","options","appTitle","autoUpdates","basePath","cwd","entry","exposes","isApp","isWorkbenchApp","minify","outputDir","reactCompiler","schemaExtraction","sourceMap","vite","extendViteConfig","workbenchAppId","mode","emitSpa","entries","reactStrictMode","watch","viteConfig","getEnvironmentVariables","command","fromPath","join","staticPath","faviconBasePath","replace","builder","buildApp","chunks","jsonEncode","prefix","defaultViteConfig","bundle","Array","isArray","stats","chunk","output","type","push","modules","Object","map","rawFilePath","chunkModule","filePath","startsWith","slice","length","name","isAbsolute","relative","renderedLength"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAI5B,SAAQC,KAAK,EAAEC,aAAa,QAAO,OAAM;AAEzC,SAAQC,OAAO,QAAO,wBAAuB;AAE7C,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SACEC,0BAA0B,EAC1BC,6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WAAW;IACxC,MAAMrB,QAAQoC,UAAUE;IAExB,4EAA4E;IAC5ErC,WAAW;IACX,MAAMsC,kBAAkB,GAAGzB,SAAS0B,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;IAChE,MAAMjC,cAAcgC,iBAAiBD;IAErCrC,WAAW;IACX,MAAM8C,SAAS,MAAMjD,MAAMmC;IAC3BhC,WAAW;IAEX,iFAAiF;IACjF,IAAI+C,MAAMC,OAAO,CAACF,WAAW,CAAE,CAAA,YAAYA,MAAK,GAAI;QAClD,OAAO;YAACJ,QAAQ,EAAE;QAAA;IACpB;IAEA,MAAMO,QAAsB,EAAE;IAC9B,KAAK,MAAMC,SAASJ,OAAOK,MAAM,CAAE;QACjC,IAAID,MAAME,IAAI,KAAK,SAAS;YAC1B;QACF;QAEAH,MAAMI,IAAI,CAAC;YACTC,SAASC,OAAO1B,OAAO,CAACqB,MAAMI,OAAO,EAAEE,GAAG,CAAC,CAAC,CAACC,aAAaC,YAAY;gBACpE,MAAMC,WAAWF,YAAYG,UAAU,CAAC,YACpCH,YAAYI,KAAK,CAAC,SAASC,MAAM,IACjCL;gBAEJ,OAAO;oBACLM,MAAMnE,KAAKoE,UAAU,CAACL,YAAY/D,KAAKqE,QAAQ,CAACnD,KAAK6C,YAAYA;oBACjEO,gBAAgBR,YAAYQ,cAAc;gBAC5C;YACF;YACAH,MAAMb,MAAMa,IAAI;QAClB;IACF;IAEA,OAAO;QAACrB,QAAQO;IAAK;AACvB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/purifyConfig.ts"],"sourcesContent":["import {type Config} from 'isomorphic-dompurify'\n\n/**\n * This file maintains our sanitization configuration for DOMPurify.\n * We use an allowlist for tags and attributes to ensure that only safe\n * elements and attributes are allowed.\n *\n * This is easier to loosen as specs develop & use-cases are discovered.\n */\n\n///////// Tags\n\nconst HTML_TAGS = ['img', 'style']\n\nconst SVG_TAGS = [\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n] as const\n\nconst SVG_FILTER_TAGS = [\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n] as const\n\nconst ALLOWED_TAGS: Config['ALLOWED_TAGS'] = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS]\n\n///////// Attributes\n\nconst HTML_ATTRIBUTES = [\n 'alt',\n 'class',\n 'crossorigin',\n 'decoding',\n 'elementtiming',\n 'fetchpriority',\n 'height',\n 'loading',\n 'src',\n 'srcset',\n 'style',\n 'width',\n]\n\nconst SVG_ATTRIBUTES = [\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'amplitude',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'exponent',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'intercept',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'slope',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'tablevalues',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n] as const\n\nconst ALLOWED_ATTR: Config['ALLOWED_ATTR'] = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES]\n\nconst config = {\n ALLOWED_ATTR,\n ALLOWED_TAGS,\n /**\n * Required to allow for the use of `style` tags,\n * namely rendering the style tags from `styled-components`\n */\n FORCE_BODY: true,\n} satisfies Config\n\nexport {config}\n"],"names":["HTML_TAGS","SVG_TAGS","SVG_FILTER_TAGS","ALLOWED_TAGS","HTML_ATTRIBUTES","SVG_ATTRIBUTES","ALLOWED_ATTR","config","FORCE_BODY"],"mappings":"AAEA;;;;;;CAMC,GAED,cAAc;AAEd,MAAMA,YAAY;IAAC;IAAO;CAAQ;AAElC,MAAMC,WAAW;IACf;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAIF;OAAaD;OAAcE;CAAgB;AAE5F,oBAAoB;AAEpB,MAAME,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,iBAAiB;IACrB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAID;OAAmBD;CAAgB;AAEpF,MAAMG,SAAS;IACbD;IACAH;IACA;;;GAGC,GACDK,YAAY;AACd;AAEA,SAAQD,MAAM,GAAC"}
1
+ {"version":3,"sources":["../../../src/actions/manifest/purifyConfig.ts"],"sourcesContent":["import type DOMPurify from 'isomorphic-dompurify'\n\ntype Config = NonNullable<Parameters<typeof DOMPurify.sanitize>[1]>\n\n/**\n * This file maintains our sanitization configuration for DOMPurify.\n * We use an allowlist for tags and attributes to ensure that only safe\n * elements and attributes are allowed.\n *\n * This is easier to loosen as specs develop & use-cases are discovered.\n */\n\n///////// Tags\n\nconst HTML_TAGS = ['img', 'style']\n\nconst SVG_TAGS = [\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n] as const\n\nconst SVG_FILTER_TAGS = [\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n] as const\n\nconst ALLOWED_TAGS: Config['ALLOWED_TAGS'] = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS]\n\n///////// Attributes\n\nconst HTML_ATTRIBUTES = [\n 'alt',\n 'class',\n 'crossorigin',\n 'decoding',\n 'elementtiming',\n 'fetchpriority',\n 'height',\n 'loading',\n 'src',\n 'srcset',\n 'style',\n 'width',\n]\n\nconst SVG_ATTRIBUTES = [\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'amplitude',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'exponent',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'intercept',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'slope',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'tablevalues',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n] as const\n\nconst ALLOWED_ATTR: Config['ALLOWED_ATTR'] = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES]\n\nconst config = {\n ALLOWED_ATTR,\n ALLOWED_TAGS,\n /**\n * Required to allow for the use of `style` tags,\n * namely rendering the style tags from `styled-components`\n */\n FORCE_BODY: true,\n} satisfies Config\n\nexport {config}\n"],"names":["HTML_TAGS","SVG_TAGS","SVG_FILTER_TAGS","ALLOWED_TAGS","HTML_ATTRIBUTES","SVG_ATTRIBUTES","ALLOWED_ATTR","config","FORCE_BODY"],"mappings":"AAIA;;;;;;CAMC,GAED,cAAc;AAEd,MAAMA,YAAY;IAAC;IAAO;CAAQ;AAElC,MAAMC,WAAW;IACf;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAIF;OAAaD;OAAcE;CAAgB;AAE5F,oBAAoB;AAEpB,MAAME,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,iBAAiB;IACrB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAID;OAAmBD;CAAgB;AAEpF,MAAMG,SAAS;IACbD;IACAH;IACA;;;GAGC,GACDK,YAAY;AACd;AAEA,SAAQD,MAAM,GAAC"}
@@ -1,4 +1,4 @@
1
- import DOMPurify from 'isomorphic-dompurify';
1
+ import { sanitize } from 'isomorphic-dompurify';
2
2
  import { config } from './purifyConfig.js';
3
3
  /**
4
4
  * Sanitize icon markup against the manifest allowlist (see {@link config}).
@@ -7,7 +7,7 @@ import { config } from './purifyConfig.js';
7
7
  * every icon we inline — whether rendered from a React component or read from
8
8
  * a file on disk — passes through the exact same trusted subset of SVG/HTML.
9
9
  */ export function sanitizeIcon(html) {
10
- return DOMPurify.sanitize(html.trim(), config);
10
+ return sanitize(html.trim(), config);
11
11
  }
12
12
 
13
13
  //# sourceMappingURL=sanitizeIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/sanitizeIcon.ts"],"sourcesContent":["import DOMPurify from 'isomorphic-dompurify'\n\nimport {config} from './purifyConfig.js'\n\n/**\n * Sanitize icon markup against the manifest allowlist (see {@link config}).\n *\n * Shared by the studio manifest icon resolver and the core app manifest so\n * every icon we inline — whether rendered from a React component or read from\n * a file on disk — passes through the exact same trusted subset of SVG/HTML.\n */\nexport function sanitizeIcon(html: string): string {\n return DOMPurify.sanitize(html.trim(), config)\n}\n"],"names":["DOMPurify","config","sanitizeIcon","html","sanitize","trim"],"mappings":"AAAA,OAAOA,eAAe,uBAAsB;AAE5C,SAAQC,MAAM,QAAO,oBAAmB;AAExC;;;;;;CAMC,GACD,OAAO,SAASC,aAAaC,IAAY;IACvC,OAAOH,UAAUI,QAAQ,CAACD,KAAKE,IAAI,IAAIJ;AACzC"}
1
+ {"version":3,"sources":["../../../src/actions/manifest/sanitizeIcon.ts"],"sourcesContent":["import {sanitize} from 'isomorphic-dompurify'\n\nimport {config} from './purifyConfig.js'\n\n/**\n * Sanitize icon markup against the manifest allowlist (see {@link config}).\n *\n * Shared by the studio manifest icon resolver and the core app manifest so\n * every icon we inline — whether rendered from a React component or read from\n * a file on disk — passes through the exact same trusted subset of SVG/HTML.\n */\nexport function sanitizeIcon(html: string): string {\n return sanitize(html.trim(), config)\n}\n"],"names":["sanitize","config","sanitizeIcon","html","trim"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,uBAAsB;AAE7C,SAAQC,MAAM,QAAO,oBAAmB;AAExC;;;;;;CAMC,GACD,OAAO,SAASC,aAAaC,IAAY;IACvC,OAAOH,SAASG,KAAKC,IAAI,IAAIH;AAC/B"}
@@ -0,0 +1,51 @@
1
+ import { getCliTelemetry, studioWorkerTask, subdebug } from '@sanity/cli-core';
2
+ import { SchemaBuild } from '../../telemetry/extractSchema.telemetry.js';
3
+ import { SchemaExtractionError } from './utils/SchemaExtractionError.js';
4
+ const debug = subdebug('buildStudioSchemasAndManifests');
5
+ /**
6
+ * 1. Extracts the create manifest in dist/static (tar/gzipped with studio)
7
+ * 2. Uploads the schema to lexicon
8
+ * 3. Creates a studio manifest (which can be sent to populus)
9
+ */ export async function buildStudioSchemasAndManifests(applicationId, options) {
10
+ const { configPath, isExternal, outPath, projectId, verbose, workDir } = options;
11
+ const trace = getCliTelemetry().trace(SchemaBuild, {
12
+ // If the studio is externally hosted, we don't need to extract the manifest
13
+ extractManifest: !isExternal,
14
+ manifestDir: outPath
15
+ });
16
+ try {
17
+ trace.start();
18
+ const result = await studioWorkerTask(new URL('buildStudioSchemasAndManifests.worker.js', import.meta.url), {
19
+ applicationId,
20
+ env: {
21
+ ...process.env,
22
+ // Workers don't inherit TTY state — propagate color support from parent
23
+ ...process.stdout.isTTY && !process.env.NO_COLOR ? {
24
+ FORCE_COLOR: '1'
25
+ } : {}
26
+ },
27
+ name: 'buildStudioSchemasAndManifests',
28
+ studioRootPath: workDir,
29
+ workerData: {
30
+ configPath,
31
+ isExternal,
32
+ outPath,
33
+ projectId,
34
+ verbose,
35
+ workDir
36
+ }
37
+ });
38
+ debug('Result %o', result);
39
+ // If the schema is required, we throw an error
40
+ if (result.type === 'error') {
41
+ throw new SchemaExtractionError(result.error, result.validation);
42
+ }
43
+ trace.complete();
44
+ return result;
45
+ } catch (err) {
46
+ trace.error(err);
47
+ throw err;
48
+ }
49
+ }
50
+
51
+ //# sourceMappingURL=buildStudioSchemasAndManifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/schema/buildStudioSchemasAndManifests.ts"],"sourcesContent":["import {getCliTelemetry, studioWorkerTask, subdebug} from '@sanity/cli-core'\nimport {type SchemaValidationProblemGroup} from '@sanity/types'\nimport {type StudioManifest} from 'sanity'\n\nimport {SchemaBuild} from '../../telemetry/extractSchema.telemetry.js'\nimport {CreateWorkspaceManifest} from '../manifest/types.js'\nimport {type BuildStudioSchemasAndManifestsWorkerData} from './types.js'\nimport {SchemaExtractionError} from './utils/SchemaExtractionError.js'\n\nexport type BuildStudioSchemasAndManifestsWorkerSuccess = {\n studioManifest: StudioManifest | null\n type: 'success'\n workspaceManifests: CreateWorkspaceManifest[]\n}\ntype BuildStudioSchemasAndManifestsWorkerError = {\n error: string\n type: 'error'\n validation?: SchemaValidationProblemGroup[]\n}\nexport type BuildStudioSchemasAndManifestsWorkerMessage =\n | BuildStudioSchemasAndManifestsWorkerError\n | BuildStudioSchemasAndManifestsWorkerSuccess\n\nconst debug = subdebug('buildStudioSchemasAndManifests')\n\n/**\n * 1. Extracts the create manifest in dist/static (tar/gzipped with studio)\n * 2. Uploads the schema to lexicon\n * 3. Creates a studio manifest (which can be sent to populus)\n */\nexport async function buildStudioSchemasAndManifests(\n applicationId: string,\n options: BuildStudioSchemasAndManifestsWorkerData,\n): Promise<BuildStudioSchemasAndManifestsWorkerSuccess> {\n const {configPath, isExternal, outPath, projectId, verbose, workDir} = options\n\n const trace = getCliTelemetry().trace(SchemaBuild, {\n // If the studio is externally hosted, we don't need to extract the manifest\n extractManifest: !isExternal,\n manifestDir: outPath,\n })\n\n try {\n trace.start()\n const result = await studioWorkerTask<BuildStudioSchemasAndManifestsWorkerMessage>(\n new URL('buildStudioSchemasAndManifests.worker.js', import.meta.url),\n {\n applicationId,\n env: {\n ...process.env,\n // Workers don't inherit TTY state — propagate color support from parent\n ...(process.stdout.isTTY && !process.env.NO_COLOR ? {FORCE_COLOR: '1'} : {}),\n },\n name: 'buildStudioSchemasAndManifests',\n studioRootPath: workDir,\n workerData: {\n configPath,\n isExternal,\n outPath,\n projectId,\n verbose,\n workDir,\n } satisfies BuildStudioSchemasAndManifestsWorkerData,\n },\n )\n\n debug('Result %o', result)\n\n // If the schema is required, we throw an error\n if (result.type === 'error') {\n throw new SchemaExtractionError(result.error, result.validation)\n }\n\n trace.complete()\n return result\n } catch (err) {\n trace.error(err)\n throw err\n }\n}\n"],"names":["getCliTelemetry","studioWorkerTask","subdebug","SchemaBuild","SchemaExtractionError","debug","buildStudioSchemasAndManifests","applicationId","options","configPath","isExternal","outPath","projectId","verbose","workDir","trace","extractManifest","manifestDir","start","result","URL","url","env","process","stdout","isTTY","NO_COLOR","FORCE_COLOR","name","studioRootPath","workerData","type","error","validation","complete","err"],"mappings":"AAAA,SAAQA,eAAe,EAAEC,gBAAgB,EAAEC,QAAQ,QAAO,mBAAkB;AAI5E,SAAQC,WAAW,QAAO,6CAA4C;AAGtE,SAAQC,qBAAqB,QAAO,mCAAkC;AAgBtE,MAAMC,QAAQH,SAAS;AAEvB;;;;CAIC,GACD,OAAO,eAAeI,+BACpBC,aAAqB,EACrBC,OAAiD;IAEjD,MAAM,EAACC,UAAU,EAAEC,UAAU,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAC,GAAGN;IAEvE,MAAMO,QAAQf,kBAAkBe,KAAK,CAACZ,aAAa;QACjD,4EAA4E;QAC5Ea,iBAAiB,CAACN;QAClBO,aAAaN;IACf;IAEA,IAAI;QACFI,MAAMG,KAAK;QACX,MAAMC,SAAS,MAAMlB,iBACnB,IAAImB,IAAI,4CAA4C,YAAYC,GAAG,GACnE;YACEd;YACAe,KAAK;gBACH,GAAGC,QAAQD,GAAG;gBACd,wEAAwE;gBACxE,GAAIC,QAAQC,MAAM,CAACC,KAAK,IAAI,CAACF,QAAQD,GAAG,CAACI,QAAQ,GAAG;oBAACC,aAAa;gBAAG,IAAI,CAAC,CAAC;YAC7E;YACAC,MAAM;YACNC,gBAAgBf;YAChBgB,YAAY;gBACVrB;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACF;QACF;QAGFT,MAAM,aAAac;QAEnB,+CAA+C;QAC/C,IAAIA,OAAOY,IAAI,KAAK,SAAS;YAC3B,MAAM,IAAI3B,sBAAsBe,OAAOa,KAAK,EAAEb,OAAOc,UAAU;QACjE;QAEAlB,MAAMmB,QAAQ;QACd,OAAOf;IACT,EAAE,OAAOgB,KAAK;QACZpB,MAAMiB,KAAK,CAACG;QACZ,MAAMA;IACR;AACF"}
@@ -0,0 +1,27 @@
1
+ import { isMainThread, parentPort, workerData } from 'node:worker_threads';
2
+ import { subdebug } from '@sanity/cli-core';
3
+ import { buildStudioSchemasAndManifestsWorkerData } from './types.js';
4
+ import { extractValidationFromSchemaError } from './utils/extractValidationFromSchemaError.js';
5
+ import { workerBuildStudioSchemasAndManifests } from './workerBuildStudioSchemasAndManifests.js';
6
+ const debug = subdebug('buildStudioSchemasAndManifests.worker');
7
+ async function main() {
8
+ if (isMainThread || !parentPort) {
9
+ throw new Error('Should only be run in a worker!');
10
+ }
11
+ const options = buildStudioSchemasAndManifestsWorkerData.parse(workerData);
12
+ try {
13
+ const message = await workerBuildStudioSchemasAndManifests(options);
14
+ parentPort.postMessage(message);
15
+ } catch (error) {
16
+ debug('Error deploying studio schemas and manifests', error);
17
+ const validation = await extractValidationFromSchemaError(error, options.workDir);
18
+ parentPort.postMessage({
19
+ error: error instanceof Error ? error.message : String(error),
20
+ type: 'error',
21
+ validation
22
+ });
23
+ }
24
+ }
25
+ await main();
26
+
27
+ //# sourceMappingURL=buildStudioSchemasAndManifests.worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/schema/buildStudioSchemasAndManifests.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {subdebug} from '@sanity/cli-core'\n\nimport {type BuildStudioSchemasAndManifestsWorkerMessage} from './buildStudioSchemasAndManifests.js'\nimport {buildStudioSchemasAndManifestsWorkerData} from './types.js'\nimport {extractValidationFromSchemaError} from './utils/extractValidationFromSchemaError.js'\nimport {workerBuildStudioSchemasAndManifests} from './workerBuildStudioSchemasAndManifests.js'\n\nconst debug = subdebug('buildStudioSchemasAndManifests.worker')\n\nasync function main() {\n if (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n }\n\n const options = buildStudioSchemasAndManifestsWorkerData.parse(workerData)\n\n try {\n const message = await workerBuildStudioSchemasAndManifests(options)\n\n parentPort.postMessage(message)\n } catch (error) {\n debug('Error deploying studio schemas and manifests', error)\n const validation = await extractValidationFromSchemaError(error, options.workDir)\n parentPort.postMessage({\n error: error instanceof Error ? error.message : String(error),\n type: 'error',\n validation,\n } satisfies BuildStudioSchemasAndManifestsWorkerMessage)\n }\n}\n\nawait main()\n"],"names":["isMainThread","parentPort","workerData","subdebug","buildStudioSchemasAndManifestsWorkerData","extractValidationFromSchemaError","workerBuildStudioSchemasAndManifests","debug","main","Error","options","parse","message","postMessage","error","validation","workDir","String","type"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,QAAQ,QAAO,mBAAkB;AAGzC,SAAQC,wCAAwC,QAAO,aAAY;AACnE,SAAQC,gCAAgC,QAAO,8CAA6C;AAC5F,SAAQC,oCAAoC,QAAO,4CAA2C;AAE9F,MAAMC,QAAQJ,SAAS;AAEvB,eAAeK;IACb,IAAIR,gBAAgB,CAACC,YAAY;QAC/B,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAMC,UAAUN,yCAAyCO,KAAK,CAACT;IAE/D,IAAI;QACF,MAAMU,UAAU,MAAMN,qCAAqCI;QAE3DT,WAAWY,WAAW,CAACD;IACzB,EAAE,OAAOE,OAAO;QACdP,MAAM,gDAAgDO;QACtD,MAAMC,aAAa,MAAMV,iCAAiCS,OAAOJ,QAAQM,OAAO;QAChFf,WAAWY,WAAW,CAAC;YACrBC,OAAOA,iBAAiBL,QAAQK,MAAMF,OAAO,GAAGK,OAAOH;YACvDI,MAAM;YACNH;QACF;IACF;AACF;AAEA,MAAMP"}
@@ -5,5 +5,13 @@ export const extractSchemaWorkerData = z.object({
5
5
  workDir: z.string(),
6
6
  workspaceName: z.optional(z.string())
7
7
  });
8
+ export const buildStudioSchemasAndManifestsWorkerData = z.object({
9
+ configPath: z.string(),
10
+ isExternal: z.boolean(),
11
+ outPath: z.string(),
12
+ projectId: z.string(),
13
+ verbose: z.boolean(),
14
+ workDir: z.string()
15
+ });
8
16
 
9
17
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/schema/types.ts"],"sourcesContent":["import {type SchemaValidationProblemGroup} from '@sanity/types'\nimport {z} from 'zod/mini'\n\nexport const extractSchemaWorkerData = z.object({\n configPath: z.string(),\n enforceRequiredFields: z.boolean(),\n workDir: z.string(),\n workspaceName: z.optional(z.string()),\n})\n\nexport type ExtractSchemaWorkerData = z.infer<typeof extractSchemaWorkerData>\n\n/** @internal */\nexport interface ExtractSchemaWorkerError {\n error: string\n type: 'error'\n\n validation?: SchemaValidationProblemGroup[]\n}\n"],"names":["z","extractSchemaWorkerData","object","configPath","string","enforceRequiredFields","boolean","workDir","workspaceName","optional"],"mappings":"AACA,SAAQA,CAAC,QAAO,WAAU;AAE1B,OAAO,MAAMC,0BAA0BD,EAAEE,MAAM,CAAC;IAC9CC,YAAYH,EAAEI,MAAM;IACpBC,uBAAuBL,EAAEM,OAAO;IAChCC,SAASP,EAAEI,MAAM;IACjBI,eAAeR,EAAES,QAAQ,CAACT,EAAEI,MAAM;AACpC,GAAE"}
1
+ {"version":3,"sources":["../../../src/actions/schema/types.ts"],"sourcesContent":["import {type SchemaValidationProblemGroup} from '@sanity/types'\nimport {z} from 'zod/mini'\n\nexport const extractSchemaWorkerData = z.object({\n configPath: z.string(),\n enforceRequiredFields: z.boolean(),\n workDir: z.string(),\n workspaceName: z.optional(z.string()),\n})\n\nexport type ExtractSchemaWorkerData = z.infer<typeof extractSchemaWorkerData>\n\n/** @internal */\nexport interface ExtractSchemaWorkerError {\n error: string\n type: 'error'\n\n validation?: SchemaValidationProblemGroup[]\n}\n\nexport const buildStudioSchemasAndManifestsWorkerData = z.object({\n configPath: z.string(),\n isExternal: z.boolean(),\n outPath: z.string(),\n projectId: z.string(),\n verbose: z.boolean(),\n workDir: z.string(),\n})\n\nexport type BuildStudioSchemasAndManifestsWorkerData = z.infer<\n typeof buildStudioSchemasAndManifestsWorkerData\n>\n"],"names":["z","extractSchemaWorkerData","object","configPath","string","enforceRequiredFields","boolean","workDir","workspaceName","optional","buildStudioSchemasAndManifestsWorkerData","isExternal","outPath","projectId","verbose"],"mappings":"AACA,SAAQA,CAAC,QAAO,WAAU;AAE1B,OAAO,MAAMC,0BAA0BD,EAAEE,MAAM,CAAC;IAC9CC,YAAYH,EAAEI,MAAM;IACpBC,uBAAuBL,EAAEM,OAAO;IAChCC,SAASP,EAAEI,MAAM;IACjBI,eAAeR,EAAES,QAAQ,CAACT,EAAEI,MAAM;AACpC,GAAE;AAYF,OAAO,MAAMM,2CAA2CV,EAAEE,MAAM,CAAC;IAC/DC,YAAYH,EAAEI,MAAM;IACpBO,YAAYX,EAAEM,OAAO;IACrBM,SAASZ,EAAEI,MAAM;IACjBS,WAAWb,EAAEI,MAAM;IACnBU,SAASd,EAAEM,OAAO;IAClBC,SAASP,EAAEI,MAAM;AACnB,GAAE"}
@@ -0,0 +1,100 @@
1
+ import { isMainThread } from 'node:worker_threads';
2
+ import { getStudioWorkspaces, subdebug } from '@sanity/cli-core';
3
+ import { extractWorkspaceManifest } from '../manifest/extractWorkspaceManifest.js';
4
+ import { writeManifestFile } from '../manifest/writeManifestFile.js';
5
+ import { uploadSchemaToLexicon } from './uploadSchemaToLexicon.js';
6
+ const debug = subdebug('buildStudioSchemasAndManifests.worker');
7
+ /**
8
+ * This function must only be called from another worker process.
9
+ * @param options - The worker options
10
+ */ export async function workerBuildStudioSchemasAndManifests(options) {
11
+ if (isMainThread) {
12
+ throw new Error('workerBuildStudioSchemasAndManifests should only be called from a worker thread');
13
+ }
14
+ const { configPath, isExternal, outPath, projectId, verbose, workDir, workspaceManifestsHandler } = options;
15
+ debug('Building studio schemas and manifests from config path %s', configPath);
16
+ const workspaces = await getStudioWorkspaces(configPath);
17
+ debug('Workspaces %o', workspaces);
18
+ if (workspaces.length === 0) {
19
+ throw new Error('No workspaces found');
20
+ }
21
+ // Extract manifest data (including ManifestSchemaType[]) once, while Schema objects are
22
+ // still live. Both writeWorkspaceToDist and updateWorkspacesSchemas consume the result.
23
+ const workspaceManifests = await extractWorkspaceManifest(workspaces, workDir);
24
+ debug('Handling build for %s', isExternal ? 'external' : 'internal');
25
+ let studioManifest;
26
+ if (isExternal) {
27
+ ;
28
+ [studioManifest] = await handleExternalStudio({
29
+ projectId,
30
+ verbose,
31
+ workDir,
32
+ workspaceManifests,
33
+ workspaceManifestsHandler,
34
+ workspaces
35
+ });
36
+ } else {
37
+ ;
38
+ [studioManifest] = await handleInternalStudio({
39
+ outPath,
40
+ projectId,
41
+ verbose,
42
+ workDir,
43
+ workspaceManifests,
44
+ workspaceManifestsHandler,
45
+ workspaces
46
+ });
47
+ }
48
+ return {
49
+ studioManifest,
50
+ type: 'success',
51
+ workspaceManifests
52
+ };
53
+ }
54
+ /**
55
+ * External deployments:
56
+ * 1. Update the workspace schemas to the /schemas endpoint IF --schema-required is passed
57
+ * 2. Call the workspace manifest handler if provided to update server-side schemas
58
+ */ async function handleExternalStudio({ projectId, verbose, workDir, workspaceManifests, workspaceManifestsHandler, workspaces }) {
59
+ const [studioManifest] = await Promise.all([
60
+ uploadSchemaToLexicon({
61
+ projectId,
62
+ verbose,
63
+ workDir,
64
+ workspaces
65
+ }),
66
+ workspaceManifestsHandler && workspaceManifestsHandler(workspaceManifests)
67
+ ]);
68
+ return [
69
+ studioManifest
70
+ ];
71
+ }
72
+ /**
73
+ *
74
+ * Internal deployments:
75
+ * 1. Write the workspace manifests to the dist directory
76
+ * 2. Update the workspaces schemas to the /schemas endpoint
77
+ * 3. Call the workspace manifest handler if provided to update server-side schemas
78
+ *
79
+ * @param workspaces - The workspaces to deploy
80
+ */ async function handleInternalStudio({ outPath, projectId, verbose, workDir, workspaceManifests, workspaceManifestsHandler, workspaces }) {
81
+ const [studioManifest] = await Promise.all([
82
+ uploadSchemaToLexicon({
83
+ projectId,
84
+ verbose,
85
+ workDir,
86
+ workspaces
87
+ }),
88
+ writeManifestFile({
89
+ outPath,
90
+ workDir,
91
+ workspaceManifests
92
+ }),
93
+ workspaceManifestsHandler && workspaceManifestsHandler(workspaceManifests)
94
+ ]);
95
+ return [
96
+ studioManifest
97
+ ];
98
+ }
99
+
100
+ //# sourceMappingURL=workerBuildStudioSchemasAndManifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/schema/workerBuildStudioSchemasAndManifests.ts"],"sourcesContent":["import {isMainThread} from 'node:worker_threads'\n\nimport {getStudioWorkspaces, subdebug} from '@sanity/cli-core'\nimport {type StudioManifest, type Workspace} from 'sanity'\n\nimport {extractWorkspaceManifest} from '../manifest/extractWorkspaceManifest.js'\nimport {type CreateWorkspaceManifest} from '../manifest/types.js'\nimport {writeManifestFile} from '../manifest/writeManifestFile.js'\nimport {type BuildStudioSchemasAndManifestsWorkerSuccess} from './buildStudioSchemasAndManifests.js'\nimport {type BuildStudioSchemasAndManifestsWorkerData} from './types.js'\nimport {uploadSchemaToLexicon} from './uploadSchemaToLexicon.js'\n\nconst debug = subdebug('buildStudioSchemasAndManifests.worker')\n\n/**\n * This function must only be called from another worker process.\n * @param options - The worker options\n */\nexport async function workerBuildStudioSchemasAndManifests(\n options: BuildStudioSchemasAndManifestsWorkerData & {\n workspaceManifestsHandler?: (workspaceManifests: CreateWorkspaceManifest[]) => Promise<void>\n },\n): Promise<BuildStudioSchemasAndManifestsWorkerSuccess> {\n if (isMainThread) {\n throw new Error(\n 'workerBuildStudioSchemasAndManifests should only be called from a worker thread',\n )\n }\n\n const {configPath, isExternal, outPath, projectId, verbose, workDir, workspaceManifestsHandler} =\n options\n\n debug('Building studio schemas and manifests from config path %s', configPath)\n const workspaces = await getStudioWorkspaces(configPath)\n debug('Workspaces %o', workspaces)\n\n if (workspaces.length === 0) {\n throw new Error('No workspaces found')\n }\n\n // Extract manifest data (including ManifestSchemaType[]) once, while Schema objects are\n // still live. Both writeWorkspaceToDist and updateWorkspacesSchemas consume the result.\n const workspaceManifests = await extractWorkspaceManifest(workspaces, workDir)\n\n debug('Handling build for %s', isExternal ? 'external' : 'internal')\n\n let studioManifest: StudioManifest | null\n\n if (isExternal) {\n ;[studioManifest] = await handleExternalStudio({\n projectId,\n verbose,\n workDir,\n workspaceManifests,\n workspaceManifestsHandler,\n workspaces,\n })\n } else {\n ;[studioManifest] = await handleInternalStudio({\n outPath,\n projectId,\n verbose,\n workDir,\n workspaceManifests,\n workspaceManifestsHandler,\n workspaces,\n })\n }\n return {\n studioManifest,\n type: 'success',\n workspaceManifests,\n }\n}\n\n/**\n * External deployments:\n * 1. Update the workspace schemas to the /schemas endpoint IF --schema-required is passed\n * 2. Call the workspace manifest handler if provided to update server-side schemas\n */\nasync function handleExternalStudio({\n projectId,\n verbose,\n workDir,\n workspaceManifests,\n workspaceManifestsHandler,\n workspaces,\n}: {\n projectId: string\n verbose: boolean\n workDir: string\n workspaceManifests: CreateWorkspaceManifest[]\n workspaceManifestsHandler?: (workspaceManifests: CreateWorkspaceManifest[]) => Promise<void>\n workspaces: Workspace[]\n}): Promise<[StudioManifest | null]> {\n const [studioManifest] = await Promise.all([\n uploadSchemaToLexicon({\n projectId,\n verbose,\n workDir,\n workspaces,\n }),\n workspaceManifestsHandler && workspaceManifestsHandler(workspaceManifests),\n ])\n\n return [studioManifest]\n}\n\n/**\n *\n * Internal deployments:\n * 1. Write the workspace manifests to the dist directory\n * 2. Update the workspaces schemas to the /schemas endpoint\n * 3. Call the workspace manifest handler if provided to update server-side schemas\n *\n * @param workspaces - The workspaces to deploy\n */\nasync function handleInternalStudio({\n outPath,\n projectId,\n verbose,\n workDir,\n workspaceManifests,\n workspaceManifestsHandler,\n workspaces,\n}: {\n outPath: string\n projectId: string\n verbose: boolean\n workDir: string\n workspaceManifests: CreateWorkspaceManifest[]\n workspaceManifestsHandler?: (workspaceManifests: CreateWorkspaceManifest[]) => Promise<void>\n workspaces: Workspace[]\n}): Promise<[StudioManifest | null]> {\n const [studioManifest] = await Promise.all([\n uploadSchemaToLexicon({\n projectId,\n verbose,\n workDir,\n workspaces,\n }),\n writeManifestFile({outPath, workDir, workspaceManifests}),\n workspaceManifestsHandler && workspaceManifestsHandler(workspaceManifests),\n ])\n\n return [studioManifest]\n}\n"],"names":["isMainThread","getStudioWorkspaces","subdebug","extractWorkspaceManifest","writeManifestFile","uploadSchemaToLexicon","debug","workerBuildStudioSchemasAndManifests","options","Error","configPath","isExternal","outPath","projectId","verbose","workDir","workspaceManifestsHandler","workspaces","length","workspaceManifests","studioManifest","handleExternalStudio","handleInternalStudio","type","Promise","all"],"mappings":"AAAA,SAAQA,YAAY,QAAO,sBAAqB;AAEhD,SAAQC,mBAAmB,EAAEC,QAAQ,QAAO,mBAAkB;AAG9D,SAAQC,wBAAwB,QAAO,0CAAyC;AAEhF,SAAQC,iBAAiB,QAAO,mCA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EACzBC,UAAU,EASX;IACC,MAAM,CAACG,eAAe,GAAG,MAAMI,QAAQC,GAAG,CAAC;QACzCpB,sBAAsB;YACpBQ;YACAC;YACAC;YACAE;QACF;QACAb,kBAAkB;YAACQ;YAASG;YAASI;QAAkB;QACvDH,6BAA6BA,0BAA0BG;KACxD;IAED,OAAO;QAACC;KAAe;AACzB"}
@@ -1,4 +1,9 @@
1
1
  import { defineTrace } from '@sanity/telemetry';
2
+ export const SchemaBuild = defineTrace({
3
+ description: 'Schema build action was executed',
4
+ name: 'Schema Built',
5
+ version: 0
6
+ });
2
7
  export const SchemaExtractedTrace = defineTrace({
3
8
  description: 'Trace emitted when extracting schema',
4
9
  name: 'Schema Extracted',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/telemetry/extractSchema.telemetry.ts"],"sourcesContent":["import {defineTrace} from '@sanity/telemetry'\n\ninterface SchemaExtractedTraceAttributes {\n enforceRequiredFields: boolean\n schemaAllTypesCount: number\n schemaDocumentTypesCount: number\n\n schemaFormat: string\n schemaTypesCount: number\n}\n\ntype SchemaExtractionWatchModeAttributes =\n | {\n averageExtractionDuration: number\n extractionFailedCount: number\n extractionSuccessfulCount: number\n step: 'stopped'\n watcherDuration: number\n }\n | {\n enforceRequiredFields: boolean\n schemaFormat: string\n step: 'started'\n }\n\ninterface SchemaDeployTraceData {\n manifestDir: string\n schemaRequired: boolean\n\n extractManifest?: boolean\n}\n\nexport const SchemaExtractedTrace = defineTrace<SchemaExtractedTraceAttributes>({\n description: 'Trace emitted when extracting schema',\n name: 'Schema Extracted',\n version: 0,\n})\n\nexport const SchemaExtractionWatchModeTrace = defineTrace<SchemaExtractionWatchModeAttributes>({\n description: 'Trace emitted when schema extraction watch mode is run',\n name: 'Schema Extraction Watch Mode',\n version: 0,\n})\n\nexport const SchemaDeploy = defineTrace<SchemaDeployTraceData>({\n description:\n 'Schema deploy action was executed, either via sanity schema deploy or as sanity deploy',\n name: 'Schema Deployed',\n version: 1,\n})\n"],"names":["defineTrace","SchemaExtractedTrace","description","name","version","SchemaExtractionWatchModeTrace","SchemaDeploy"],"mappings":"AAAA,SAAQA,WAAW,QAAO,oBAAmB;AAgC7C,OAAO,MAAMC,uBAAuBD,YAA4C;IAC9EE,aAAa;IACbC,MAAM;IACNC,SAAS;AACX,GAAE;AAEF,OAAO,MAAMC,iCAAiCL,YAAiD;IAC7FE,aAAa;IACbC,MAAM;IACNC,SAAS;AACX,GAAE;AAEF,OAAO,MAAME,eAAeN,YAAmC;IAC7DE,aACE;IACFC,MAAM;IACNC,SAAS;AACX,GAAE"}
1
+ {"version":3,"sources":["../../src/telemetry/extractSchema.telemetry.ts"],"sourcesContent":["import {defineTrace} from '@sanity/telemetry'\n\ninterface SchemaExtractedTraceAttributes {\n enforceRequiredFields: boolean\n schemaAllTypesCount: number\n schemaDocumentTypesCount: number\n\n schemaFormat: string\n schemaTypesCount: number\n}\n\ntype SchemaExtractionWatchModeAttributes =\n | {\n averageExtractionDuration: number\n extractionFailedCount: number\n extractionSuccessfulCount: number\n step: 'stopped'\n watcherDuration: number\n }\n | {\n enforceRequiredFields: boolean\n schemaFormat: string\n step: 'started'\n }\n\ninterface SchemaBuildTraceData {\n manifestDir: string\n\n extractManifest?: boolean\n}\n\ninterface SchemaDeployTraceData {\n manifestDir: string\n schemaRequired: boolean\n\n extractManifest?: boolean\n}\n\nexport const SchemaBuild = defineTrace<SchemaBuildTraceData>({\n description: 'Schema build action was executed',\n name: 'Schema Built',\n version: 0,\n})\n\nexport const SchemaExtractedTrace = defineTrace<SchemaExtractedTraceAttributes>({\n description: 'Trace emitted when extracting schema',\n name: 'Schema Extracted',\n version: 0,\n})\n\nexport const SchemaExtractionWatchModeTrace = defineTrace<SchemaExtractionWatchModeAttributes>({\n description: 'Trace emitted when schema extraction watch mode is run',\n name: 'Schema Extraction Watch Mode',\n version: 0,\n})\n\nexport const SchemaDeploy = defineTrace<SchemaDeployTraceData>({\n description:\n 'Schema deploy action was executed, either via sanity schema deploy or as sanity deploy',\n name: 'Schema Deployed',\n version: 1,\n})\n"],"names":["defineTrace","SchemaBuild","description","name","version","SchemaExtractedTrace","SchemaExtractionWatchModeTrace","SchemaDeploy"],"mappings":"AAAA,SAAQA,WAAW,QAAO,oBAAmB;AAsC7C,OAAO,MAAMC,cAAcD,YAAkC;IAC3DE,aAAa;IACbC,MAAM;IACNC,SAAS;AACX,GAAE;AAEF,OAAO,MAAMC,uBAAuBL,YAA4C;IAC9EE,aAAa;IACbC,MAAM;IACNC,SAAS;AACX,GAAE;AAEF,OAAO,MAAME,iCAAiCN,YAAiD;IAC7FE,aAAa;IACbC,MAAM;IACNC,SAAS;AACX,GAAE;AAEF,OAAO,MAAMG,eAAeP,YAAmC;IAC7DE,aACE;IACFC,MAAM;IACNC,SAAS;AACX,GAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-build",
3
- "version": "6.0.2",
3
+ "version": "6.2.0",
4
4
  "description": "Internal Sanity package for building studios and apps",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,14 +53,14 @@
53
53
  "@oclif/core": "^4.11.14",
54
54
  "@rolldown/plugin-babel": "^0.2.3",
55
55
  "@sanity/generate-help-url": "^4.0.0",
56
- "@sanity/schema": "^6.7.0",
56
+ "@sanity/schema": "^6.11.0",
57
57
  "@sanity/telemetry": "^1.1.0",
58
- "@sanity/types": "^6.7.0",
59
- "@vitejs/plugin-react": "^6.1.0",
58
+ "@sanity/types": "^6.11.0",
59
+ "@vitejs/plugin-react": "^6.1.1",
60
60
  "chokidar": "^5.0.0",
61
- "cjs-module-lexer": "^2.2.0",
61
+ "cjs-module-lexer": "^2.2.1",
62
62
  "empathic": "^2.0.1",
63
- "isomorphic-dompurify": "^2.36.0",
63
+ "isomorphic-dompurify": "~3.3.0",
64
64
  "lodash-es": "^4.18.1",
65
65
  "node-html-parser": "^7.1.0",
66
66
  "oneline": "^2.0.0",
@@ -68,15 +68,15 @@
68
68
  "react": "^19.2.7",
69
69
  "react-is": "^19.2.7",
70
70
  "semver": "^7.8.1",
71
- "vite": "^8.2.1",
72
- "zod": "^4.4.3",
73
- "@sanity/cli-core": "^3.5.0",
74
- "@sanity/workbench-cli": "^2.2.3"
71
+ "vite": "^8.2.2",
72
+ "zod": "^4.5.2",
73
+ "@sanity/cli-core": "^3.6.0",
74
+ "@sanity/workbench-cli": "^2.3.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/compat": "^2.1.0",
78
- "@sanity/pkg-utils": "^12.2.0",
79
- "@sanity/ui": "^3.5.0",
78
+ "@sanity/pkg-utils": "^12.3.4",
79
+ "@sanity/ui": "^3.5.4",
80
80
  "@swc/cli": "^0.8.1",
81
81
  "@swc/core": "^1.15.43",
82
82
  "@types/lodash-es": "^4.17.12",
@@ -90,21 +90,21 @@
90
90
  "babel-plugin-react-compiler": "^1.0.0",
91
91
  "eslint": "^10.7.0",
92
92
  "magic-string": "^0.30.21",
93
- "oxc-transform-react": "^0.145.0",
93
+ "oxc-transform-react": "^0.147.0",
94
94
  "publint": "^0.3.21",
95
- "sanity": "^6.7.0",
95
+ "sanity": "^6.11.0",
96
96
  "styled-components": "^6.4.3",
97
97
  "typescript": "^6.0.3",
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": "15.0.0",
101
+ "@sanity/cli-test": "16.0.0",
102
102
  "@sanity/eslint-config-cli": "^1.1.3"
103
103
  },
104
104
  "peerDependencies": {
105
105
  "babel-plugin-react-compiler": "*",
106
106
  "oxc-transform-react": "*",
107
- "sanity": "^6.7.0"
107
+ "sanity": "^6.11.0"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "babel-plugin-react-compiler": {