@sanity/cli-build 6.0.1 → 6.1.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
  }
@@ -162,8 +51,9 @@ declare function writeManifestFile({ outPath, workDir, workspaceManifests }: Wri
162
51
  interface ExtractManifestOptions extends Pick<WriteManifestFileOptions, 'outPath' | 'workDir'> {
163
52
  /** Absolute path to the studio's `sanity.config.(ts|js)` entry file. */
164
53
  path: string;
54
+ applicationId?: string;
165
55
  }
166
- declare function extractManifest({ outPath, path, workDir }: ExtractManifestOptions): Promise<void>;
56
+ declare function extractManifest({ applicationId, outPath, path, workDir }: ExtractManifestOptions): Promise<void>;
167
57
  /**
168
58
  * Extracts manifest data from an array of workspaces
169
59
  */
@@ -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
@@ -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"}
@@ -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,mCAAkC;AAGlE,SAAQC,qBAAqB,QAAO,6BAA4B;AAEhE,MAAMC,QAAQJ,SAAS;AAEvB;;;CAGC,GACD,OAAO,eAAeK,qCACpBC,OAEC;IAED,IAAIR,cAAc;QAChB,MAAM,IAAIS,MACR;IAEJ;IAEA,MAAM,EAACC,UAAU,EAAEC,UAAU,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEC,yBAAyB,EAAC,GAC7FR;IAEFF,MAAM,6DAA6DI;IACnE,MAAMO,aAAa,MAAMhB,oBAAoBS;IAC7CJ,MAAM,iBAAiBW;IAEvB,IAAIA,WAAWC,MAAM,KAAK,GAAG;QAC3B,MAAM,IAAIT,MAAM;IAClB;IAEA,wFAAwF;IACxF,wFAAwF;IACxF,MAAMU,qBAAqB,MAAMhB,yBAAyBc,YAAYF;IAEtET,MAAM,yBAAyBK,aAAa,aAAa;IAEzD,IAAIS;IAEJ,IAAIT,YAAY;;QACb,CAACS,eAAe,GAAG,MAAMC,qBAAqB;YAC7CR;YACAC;YACAC;YACAI;YACAH;YACAC;QACF;IACF,OAAO;;QACJ,CAACG,eAAe,GAAG,MAAME,qBAAqB;YAC7CV;YACAC;YACAC;YACAC;YACAI;YACAH;YACAC;QACF;IACF;IACA,OAAO;QACLG;QACAG,MAAM;QACNJ;IACF;AACF;AAEA;;;;CAIC,GACD,eAAeE,qBAAqB,EAClCR,SAAS,EACTC,OAAO,EACPC,OAAO,EACPI,kBAAkB,EAClBH,yBAAyB,EACzBC,UAAU,EAQX;IACC,MAAM,CAACG,eAAe,GAAG,MAAMI,QAAQC,GAAG,CAAC;QACzCpB,sBAAsB;YACpBQ;YACAC;YACAC;YACAE;QACF;QACAD,6BAA6BA,0BAA0BG;KACxD;IAED,OAAO;QAACC;KAAe;AACzB;AAEA;;;;;;;;CAQC,GACD,eAAeE,qBAAqB,EAClCV,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPI,kBAAkB,EAClBH,yBAAyB,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.1",
3
+ "version": "6.1.0",
4
4
  "description": "Internal Sanity package for building studios and apps",
5
5
  "keywords": [
6
6
  "cli",
@@ -56,11 +56,11 @@
56
56
  "@sanity/schema": "^6.7.0",
57
57
  "@sanity/telemetry": "^1.1.0",
58
58
  "@sanity/types": "^6.7.0",
59
- "@vitejs/plugin-react": "^6.1.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,14 +68,14 @@
68
68
  "react": "^19.2.7",
69
69
  "react-is": "^19.2.7",
70
70
  "semver": "^7.8.1",
71
- "vite": "^8.2.1",
71
+ "vite": "^8.2.2",
72
72
  "zod": "^4.4.3",
73
- "@sanity/workbench-cli": "^2.2.2",
74
- "@sanity/cli-core": "^3.4.0"
73
+ "@sanity/cli-core": "^3.5.1",
74
+ "@sanity/workbench-cli": "^2.2.4"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/compat": "^2.1.0",
78
- "@sanity/pkg-utils": "^12.2.0",
78
+ "@sanity/pkg-utils": "^12.3.4",
79
79
  "@sanity/ui": "^3.5.0",
80
80
  "@swc/cli": "^0.8.1",
81
81
  "@swc/core": "^1.15.43",
@@ -90,16 +90,16 @@
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
95
  "sanity": "^6.7.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
- "@sanity/eslint-config-cli": "^1.1.3",
101
- "@sanity/cli-test": "14.0.0",
102
- "@repo/tsconfig": "3.70.0"
100
+ "@repo/tsconfig": "3.70.0",
101
+ "@sanity/cli-test": "15.1.0",
102
+ "@sanity/eslint-config-cli": "^1.1.3"
103
103
  },
104
104
  "peerDependencies": {
105
105
  "babel-plugin-react-compiler": "*",