@sanity/cli 6.6.0 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -4
- package/dist/actions/auth/login/login.js +4 -1
- package/dist/actions/auth/login/login.js.map +1 -1
- package/dist/actions/build/buildApp.js +4 -5
- package/dist/actions/build/buildApp.js.map +1 -1
- package/dist/actions/build/buildStaticFiles.js +12 -4
- package/dist/actions/build/buildStaticFiles.js.map +1 -1
- package/dist/actions/build/buildStudio.js +6 -14
- package/dist/actions/build/buildStudio.js.map +1 -1
- package/dist/actions/build/{getStudioEnvironmentVariables.js → getEnvironmentVariables.js} +15 -19
- package/dist/actions/build/getEnvironmentVariables.js.map +1 -0
- package/dist/actions/deploy/deployStudio.js +1 -2
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/deploy/deployStudioSchemasAndManifests.js +1 -2
- package/dist/actions/deploy/deployStudioSchemasAndManifests.js.map +1 -1
- package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js +1 -1
- package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js.map +1 -1
- package/dist/actions/dev/startStudioDevServer.js +1 -1
- package/dist/actions/dev/startStudioDevServer.js.map +1 -1
- package/dist/actions/documents/validateDocuments.worker.js +1 -2
- package/dist/actions/documents/validateDocuments.worker.js.map +1 -1
- package/dist/actions/graphql/SchemaError.js +1 -1
- package/dist/actions/graphql/SchemaError.js.map +1 -1
- package/dist/actions/init/initAction.js +32 -1
- package/dist/actions/init/initAction.js.map +1 -1
- package/dist/actions/init/scaffoldTemplate.js +32 -18
- package/dist/actions/init/scaffoldTemplate.js.map +1 -1
- package/dist/actions/init/templates/index.js +2 -0
- package/dist/actions/init/templates/index.js.map +1 -1
- package/dist/actions/init/templates/pageBuilder.js +32 -0
- package/dist/actions/init/templates/pageBuilder.js.map +1 -0
- package/dist/actions/init/types.js +2 -1
- package/dist/actions/init/types.js.map +1 -1
- package/dist/actions/manifest/extractManifest.js +1 -1
- package/dist/actions/manifest/extractManifest.js.map +1 -1
- package/dist/actions/manifest/extractManifest.worker.js +1 -1
- package/dist/actions/manifest/extractManifest.worker.js.map +1 -1
- package/dist/actions/mcp/editorConfigs.js +51 -11
- package/dist/actions/mcp/editorConfigs.js.map +1 -1
- package/dist/actions/mcp/promptForMCPSetup.js +16 -11
- package/dist/actions/mcp/promptForMCPSetup.js.map +1 -1
- package/dist/actions/mcp/setupMCP.js +180 -61
- package/dist/actions/mcp/setupMCP.js.map +1 -1
- package/dist/actions/mcp/types.js.map +1 -1
- package/dist/actions/schema/deploySchemas.js +1 -1
- package/dist/actions/schema/deploySchemas.js.map +1 -1
- package/dist/actions/schema/extractSanityWorkspace.worker.js +1 -1
- package/dist/actions/schema/extractSanityWorkspace.worker.js.map +1 -1
- package/dist/actions/schema/extractSchema.js +1 -4
- package/dist/actions/schema/extractSchema.js.map +1 -1
- package/dist/actions/schema/extractSchemaWatcher.js +1 -4
- package/dist/actions/schema/extractSchemaWatcher.js.map +1 -1
- package/dist/actions/schema/getExtractOptions.js +8 -18
- package/dist/actions/schema/getExtractOptions.js.map +1 -1
- package/dist/actions/schema/types.js +0 -6
- package/dist/actions/schema/types.js.map +1 -1
- package/dist/actions/schema/validateAction.js +1 -1
- package/dist/actions/schema/validateAction.js.map +1 -1
- package/dist/actions/schema/validateSchema.worker.js +1 -2
- package/dist/actions/schema/validateSchema.worker.js.map +1 -1
- package/dist/actions/schema/watchExtractSchema.js +1 -1
- package/dist/actions/schema/watchExtractSchema.js.map +1 -1
- package/dist/actions/skills/readSkillState.js +54 -0
- package/dist/actions/skills/readSkillState.js.map +1 -0
- package/dist/actions/skills/setupSkills.js +73 -0
- package/dist/actions/skills/setupSkills.js.map +1 -0
- package/dist/commands/build.js +9 -22
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cors/add.js +5 -5
- package/dist/commands/cors/add.js.map +1 -1
- package/dist/commands/datasets/export.js +9 -0
- package/dist/commands/datasets/export.js.map +1 -1
- package/dist/commands/docs/read.js +33 -12
- package/dist/commands/docs/read.js.map +1 -1
- package/dist/commands/init.js +12 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/manifest/extract.js +1 -2
- package/dist/commands/manifest/extract.js.map +1 -1
- package/dist/commands/mcp/configure.js +2 -1
- package/dist/commands/mcp/configure.js.map +1 -1
- package/dist/commands/schemas/deploy.js +1 -2
- package/dist/commands/schemas/deploy.js.map +1 -1
- package/dist/exports/_internal.d.ts +2 -1
- package/dist/exports/_internal.js +1 -1
- package/dist/exports/_internal.js.map +1 -1
- package/dist/server/devServer.js +25 -4
- package/dist/server/devServer.js.map +1 -1
- package/dist/server/previewServer.js +1 -1
- package/dist/server/previewServer.js.map +1 -1
- package/dist/services/mcp.js +1 -1
- package/dist/services/mcp.js.map +1 -1
- package/dist/telemetry/init.telemetry.js.map +1 -1
- package/oclif.manifest.json +134 -118
- package/package.json +15 -16
- package/templates/page-builder/README.md +9 -0
- package/templates/page-builder/schemaTypes/hero.js +31 -0
- package/templates/page-builder/schemaTypes/index.js +19 -0
- package/templates/page-builder/static/.gitkeep +0 -0
- package/dist/actions/build/buildDebug.js +0 -4
- package/dist/actions/build/buildDebug.js.map +0 -1
- package/dist/actions/build/buildVendorDependencies.js +0 -149
- package/dist/actions/build/buildVendorDependencies.js.map +0 -1
- package/dist/actions/build/checkStudioDependencyVersions.js +0 -155
- package/dist/actions/build/checkStudioDependencyVersions.js.map +0 -1
- package/dist/actions/build/createExternalFromImportMap.js +0 -11
- package/dist/actions/build/createExternalFromImportMap.js.map +0 -1
- package/dist/actions/build/decorateIndexWithAutoGeneratedWarning.js +0 -13
- package/dist/actions/build/decorateIndexWithAutoGeneratedWarning.js.map +0 -1
- package/dist/actions/build/decorateIndexWithBridgeScript.js +0 -17
- package/dist/actions/build/decorateIndexWithBridgeScript.js.map +0 -1
- package/dist/actions/build/decorateIndexWithStagingScript.js +0 -16
- package/dist/actions/build/decorateIndexWithStagingScript.js.map +0 -1
- package/dist/actions/build/getAppEnvVars.js +0 -9
- package/dist/actions/build/getAppEnvVars.js.map +0 -1
- package/dist/actions/build/getEntryModule.js +0 -46
- package/dist/actions/build/getEntryModule.js.map +0 -1
- package/dist/actions/build/getPossibleDocumentComponentLocations.js +0 -11
- package/dist/actions/build/getPossibleDocumentComponentLocations.js.map +0 -1
- package/dist/actions/build/getStudioEnvVars.js +0 -9
- package/dist/actions/build/getStudioEnvVars.js.map +0 -1
- package/dist/actions/build/getStudioEnvironmentVariables.js.map +0 -1
- package/dist/actions/build/getViteConfig.js +0 -219
- package/dist/actions/build/getViteConfig.js.map +0 -1
- package/dist/actions/build/normalizeBasePath.js +0 -9
- package/dist/actions/build/normalizeBasePath.js.map +0 -1
- package/dist/actions/build/renderDocument.js +0 -50
- package/dist/actions/build/renderDocument.js.map +0 -1
- package/dist/actions/build/renderDocument.worker.js +0 -9
- package/dist/actions/build/renderDocument.worker.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/addTimestampImportMapScriptToHtml.js +0 -79
- package/dist/actions/build/renderDocumentWorker/addTimestampImportMapScriptToHtml.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/components/BasicDocument.js +0 -61
- package/dist/actions/build/renderDocumentWorker/components/BasicDocument.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/components/DefaultDocument.js +0 -165
- package/dist/actions/build/renderDocumentWorker/components/DefaultDocument.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/components/Favicons.js +0 -28
- package/dist/actions/build/renderDocumentWorker/components/Favicons.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/components/GlobalErrorHandler.js +0 -178
- package/dist/actions/build/renderDocumentWorker/components/GlobalErrorHandler.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/components/NoJavascript.js +0 -51
- package/dist/actions/build/renderDocumentWorker/components/NoJavascript.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/getDocumentComponent.js +0 -41
- package/dist/actions/build/renderDocumentWorker/getDocumentComponent.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/getDocumentHtml.js +0 -55
- package/dist/actions/build/renderDocumentWorker/getDocumentHtml.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/renderDocumentWorker.js +0 -31
- package/dist/actions/build/renderDocumentWorker/renderDocumentWorker.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/tryLoadDocumentComponent.js +0 -30
- package/dist/actions/build/renderDocumentWorker/tryLoadDocumentComponent.js.map +0 -1
- package/dist/actions/build/renderDocumentWorker/types.js +0 -5
- package/dist/actions/build/renderDocumentWorker/types.js.map +0 -1
- package/dist/actions/build/writeSanityRuntime.js +0 -64
- package/dist/actions/build/writeSanityRuntime.js.map +0 -1
- package/dist/actions/docs/normalizeDocsPath.js +0 -15
- package/dist/actions/docs/normalizeDocsPath.js.map +0 -1
- package/dist/actions/schema/extractSanitySchema.worker.js +0 -33
- package/dist/actions/schema/extractSanitySchema.worker.js.map +0 -1
- package/dist/actions/schema/formatSchemaValidation.js +0 -78
- package/dist/actions/schema/formatSchemaValidation.js.map +0 -1
- package/dist/actions/schema/matchSchemaPattern.js +0 -22
- package/dist/actions/schema/matchSchemaPattern.js.map +0 -1
- package/dist/actions/schema/runSchemaExtraction.js +0 -39
- package/dist/actions/schema/runSchemaExtraction.js.map +0 -1
- package/dist/actions/schema/utils/SchemaExtractionError.js +0 -10
- package/dist/actions/schema/utils/SchemaExtractionError.js.map +0 -1
- package/dist/actions/schema/utils/extractValidationFromSchemaError.js +0 -12
- package/dist/actions/schema/utils/extractValidationFromSchemaError.js.map +0 -1
- package/dist/constants.js +0 -8
- package/dist/constants.js.map +0 -1
- package/dist/server/vite/plugin-sanity-build-entries.js +0 -67
- package/dist/server/vite/plugin-sanity-build-entries.js.map +0 -1
- package/dist/server/vite/plugin-sanity-favicons.js +0 -72
- package/dist/server/vite/plugin-sanity-favicons.js.map +0 -1
- package/dist/server/vite/plugin-sanity-runtime-rewrite.js +0 -18
- package/dist/server/vite/plugin-sanity-runtime-rewrite.js.map +0 -1
- package/dist/server/vite/plugin-schema-extraction.js +0 -201
- package/dist/server/vite/plugin-schema-extraction.js.map +0 -1
- package/dist/telemetry/build.telemetry.js +0 -13
- package/dist/telemetry/build.telemetry.js.map +0 -1
- package/dist/telemetry/extractSchema.telemetry.js +0 -18
- package/dist/telemetry/extractSchema.telemetry.js.map +0 -1
- package/dist/util/getWorkspace.js +0 -18
- package/dist/util/getWorkspace.js.map +0 -1
package/oclif.manifest.json
CHANGED
|
@@ -675,6 +675,12 @@
|
|
|
675
675
|
"allowNo": false,
|
|
676
676
|
"type": "boolean"
|
|
677
677
|
},
|
|
678
|
+
"skills": {
|
|
679
|
+
"description": "Install Sanity agent skills globally for detected AI editors",
|
|
680
|
+
"name": "skills",
|
|
681
|
+
"allowNo": true,
|
|
682
|
+
"type": "boolean"
|
|
683
|
+
},
|
|
678
684
|
"template": {
|
|
679
685
|
"description": "Project template to use [default: \"clean\"]",
|
|
680
686
|
"exclusive": [
|
|
@@ -1767,6 +1773,10 @@
|
|
|
1767
1773
|
{
|
|
1768
1774
|
"command": "<%= config.bin %> <%= command.id %> staging staging.tar.gz --types products,shops",
|
|
1769
1775
|
"description": "Export specific document types"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
"command": "<%= config.bin %> <%= command.id %> moviedb moviedb.tar.gz --no-strict-asset-verification",
|
|
1779
|
+
"description": "Export dataset without aborting on asset verification failures"
|
|
1770
1780
|
}
|
|
1771
1781
|
],
|
|
1772
1782
|
"flags": {
|
|
@@ -1818,6 +1828,12 @@
|
|
|
1818
1828
|
"allowNo": false,
|
|
1819
1829
|
"type": "boolean"
|
|
1820
1830
|
},
|
|
1831
|
+
"no-strict-asset-verification": {
|
|
1832
|
+
"description": "Do not abort the export when an asset fails hash or content-length verification",
|
|
1833
|
+
"name": "no-strict-asset-verification",
|
|
1834
|
+
"allowNo": false,
|
|
1835
|
+
"type": "boolean"
|
|
1836
|
+
},
|
|
1821
1837
|
"overwrite": {
|
|
1822
1838
|
"description": "Overwrite any file with the same name",
|
|
1823
1839
|
"name": "overwrite",
|
|
@@ -2896,6 +2912,45 @@
|
|
|
2896
2912
|
"undeploy.js"
|
|
2897
2913
|
]
|
|
2898
2914
|
},
|
|
2915
|
+
"manifest:extract": {
|
|
2916
|
+
"aliases": [],
|
|
2917
|
+
"args": {},
|
|
2918
|
+
"description": "Extract studio configuration as JSON manifest files.\n\nNote: This command is experimental and subject to change. It is currently intended for use with Create only.",
|
|
2919
|
+
"examples": [
|
|
2920
|
+
{
|
|
2921
|
+
"command": "<%= config.bin %> <%= command.id %>",
|
|
2922
|
+
"description": "Extracts manifests"
|
|
2923
|
+
},
|
|
2924
|
+
{
|
|
2925
|
+
"command": "<%= config.bin %> <%= command.id %> --path /public/static",
|
|
2926
|
+
"description": "Extracts manifests into /public/static"
|
|
2927
|
+
}
|
|
2928
|
+
],
|
|
2929
|
+
"flags": {
|
|
2930
|
+
"path": {
|
|
2931
|
+
"description": "Optional path to specify destination directory of the manifest files",
|
|
2932
|
+
"name": "path",
|
|
2933
|
+
"default": "dist/static",
|
|
2934
|
+
"hasDynamicHelp": false,
|
|
2935
|
+
"multiple": false,
|
|
2936
|
+
"type": "option"
|
|
2937
|
+
}
|
|
2938
|
+
},
|
|
2939
|
+
"hasDynamicHelp": false,
|
|
2940
|
+
"hiddenAliases": [],
|
|
2941
|
+
"id": "manifest:extract",
|
|
2942
|
+
"pluginAlias": "@sanity/cli",
|
|
2943
|
+
"pluginName": "@sanity/cli",
|
|
2944
|
+
"pluginType": "core",
|
|
2945
|
+
"strict": true,
|
|
2946
|
+
"isESM": true,
|
|
2947
|
+
"relativePath": [
|
|
2948
|
+
"dist",
|
|
2949
|
+
"commands",
|
|
2950
|
+
"manifest",
|
|
2951
|
+
"extract.js"
|
|
2952
|
+
]
|
|
2953
|
+
},
|
|
2899
2954
|
"hooks:attempt": {
|
|
2900
2955
|
"aliases": [],
|
|
2901
2956
|
"args": {
|
|
@@ -3144,45 +3199,6 @@
|
|
|
3144
3199
|
"logs.js"
|
|
3145
3200
|
]
|
|
3146
3201
|
},
|
|
3147
|
-
"manifest:extract": {
|
|
3148
|
-
"aliases": [],
|
|
3149
|
-
"args": {},
|
|
3150
|
-
"description": "Extract studio configuration as JSON manifest files.\n\nNote: This command is experimental and subject to change. It is currently intended for use with Create only.",
|
|
3151
|
-
"examples": [
|
|
3152
|
-
{
|
|
3153
|
-
"command": "<%= config.bin %> <%= command.id %>",
|
|
3154
|
-
"description": "Extracts manifests"
|
|
3155
|
-
},
|
|
3156
|
-
{
|
|
3157
|
-
"command": "<%= config.bin %> <%= command.id %> --path /public/static",
|
|
3158
|
-
"description": "Extracts manifests into /public/static"
|
|
3159
|
-
}
|
|
3160
|
-
],
|
|
3161
|
-
"flags": {
|
|
3162
|
-
"path": {
|
|
3163
|
-
"description": "Optional path to specify destination directory of the manifest files",
|
|
3164
|
-
"name": "path",
|
|
3165
|
-
"default": "dist/static",
|
|
3166
|
-
"hasDynamicHelp": false,
|
|
3167
|
-
"multiple": false,
|
|
3168
|
-
"type": "option"
|
|
3169
|
-
}
|
|
3170
|
-
},
|
|
3171
|
-
"hasDynamicHelp": false,
|
|
3172
|
-
"hiddenAliases": [],
|
|
3173
|
-
"id": "manifest:extract",
|
|
3174
|
-
"pluginAlias": "@sanity/cli",
|
|
3175
|
-
"pluginName": "@sanity/cli",
|
|
3176
|
-
"pluginType": "core",
|
|
3177
|
-
"strict": true,
|
|
3178
|
-
"isESM": true,
|
|
3179
|
-
"relativePath": [
|
|
3180
|
-
"dist",
|
|
3181
|
-
"commands",
|
|
3182
|
-
"manifest",
|
|
3183
|
-
"extract.js"
|
|
3184
|
-
]
|
|
3185
|
-
},
|
|
3186
3202
|
"mcp:configure": {
|
|
3187
3203
|
"aliases": [],
|
|
3188
3204
|
"args": {},
|
|
@@ -4147,84 +4163,6 @@
|
|
|
4147
4163
|
"validate.js"
|
|
4148
4164
|
]
|
|
4149
4165
|
},
|
|
4150
|
-
"telemetry:disable": {
|
|
4151
|
-
"aliases": [],
|
|
4152
|
-
"args": {},
|
|
4153
|
-
"description": "Disable telemetry for your account",
|
|
4154
|
-
"examples": [
|
|
4155
|
-
{
|
|
4156
|
-
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4157
|
-
"description": "Disable telemetry for your account"
|
|
4158
|
-
}
|
|
4159
|
-
],
|
|
4160
|
-
"flags": {},
|
|
4161
|
-
"hasDynamicHelp": false,
|
|
4162
|
-
"hiddenAliases": [],
|
|
4163
|
-
"id": "telemetry:disable",
|
|
4164
|
-
"pluginAlias": "@sanity/cli",
|
|
4165
|
-
"pluginName": "@sanity/cli",
|
|
4166
|
-
"pluginType": "core",
|
|
4167
|
-
"strict": true,
|
|
4168
|
-
"isESM": true,
|
|
4169
|
-
"relativePath": [
|
|
4170
|
-
"dist",
|
|
4171
|
-
"commands",
|
|
4172
|
-
"telemetry",
|
|
4173
|
-
"disable.js"
|
|
4174
|
-
]
|
|
4175
|
-
},
|
|
4176
|
-
"telemetry:enable": {
|
|
4177
|
-
"aliases": [],
|
|
4178
|
-
"args": {},
|
|
4179
|
-
"description": "Enable telemetry for your account",
|
|
4180
|
-
"examples": [
|
|
4181
|
-
{
|
|
4182
|
-
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4183
|
-
"description": "Enable telemetry for your account"
|
|
4184
|
-
}
|
|
4185
|
-
],
|
|
4186
|
-
"flags": {},
|
|
4187
|
-
"hasDynamicHelp": false,
|
|
4188
|
-
"hiddenAliases": [],
|
|
4189
|
-
"id": "telemetry:enable",
|
|
4190
|
-
"pluginAlias": "@sanity/cli",
|
|
4191
|
-
"pluginName": "@sanity/cli",
|
|
4192
|
-
"pluginType": "core",
|
|
4193
|
-
"strict": true,
|
|
4194
|
-
"isESM": true,
|
|
4195
|
-
"relativePath": [
|
|
4196
|
-
"dist",
|
|
4197
|
-
"commands",
|
|
4198
|
-
"telemetry",
|
|
4199
|
-
"enable.js"
|
|
4200
|
-
]
|
|
4201
|
-
},
|
|
4202
|
-
"telemetry:status": {
|
|
4203
|
-
"aliases": [],
|
|
4204
|
-
"args": {},
|
|
4205
|
-
"description": "Check telemetry status for your account",
|
|
4206
|
-
"examples": [
|
|
4207
|
-
{
|
|
4208
|
-
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4209
|
-
"description": "Check telemetry status for your account"
|
|
4210
|
-
}
|
|
4211
|
-
],
|
|
4212
|
-
"flags": {},
|
|
4213
|
-
"hasDynamicHelp": false,
|
|
4214
|
-
"hiddenAliases": [],
|
|
4215
|
-
"id": "telemetry:status",
|
|
4216
|
-
"pluginAlias": "@sanity/cli",
|
|
4217
|
-
"pluginName": "@sanity/cli",
|
|
4218
|
-
"pluginType": "core",
|
|
4219
|
-
"strict": true,
|
|
4220
|
-
"isESM": true,
|
|
4221
|
-
"relativePath": [
|
|
4222
|
-
"dist",
|
|
4223
|
-
"commands",
|
|
4224
|
-
"telemetry",
|
|
4225
|
-
"status.js"
|
|
4226
|
-
]
|
|
4227
|
-
},
|
|
4228
4166
|
"tokens:add": {
|
|
4229
4167
|
"aliases": [],
|
|
4230
4168
|
"args": {
|
|
@@ -4427,6 +4365,84 @@
|
|
|
4427
4365
|
"list.js"
|
|
4428
4366
|
]
|
|
4429
4367
|
},
|
|
4368
|
+
"telemetry:disable": {
|
|
4369
|
+
"aliases": [],
|
|
4370
|
+
"args": {},
|
|
4371
|
+
"description": "Disable telemetry for your account",
|
|
4372
|
+
"examples": [
|
|
4373
|
+
{
|
|
4374
|
+
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4375
|
+
"description": "Disable telemetry for your account"
|
|
4376
|
+
}
|
|
4377
|
+
],
|
|
4378
|
+
"flags": {},
|
|
4379
|
+
"hasDynamicHelp": false,
|
|
4380
|
+
"hiddenAliases": [],
|
|
4381
|
+
"id": "telemetry:disable",
|
|
4382
|
+
"pluginAlias": "@sanity/cli",
|
|
4383
|
+
"pluginName": "@sanity/cli",
|
|
4384
|
+
"pluginType": "core",
|
|
4385
|
+
"strict": true,
|
|
4386
|
+
"isESM": true,
|
|
4387
|
+
"relativePath": [
|
|
4388
|
+
"dist",
|
|
4389
|
+
"commands",
|
|
4390
|
+
"telemetry",
|
|
4391
|
+
"disable.js"
|
|
4392
|
+
]
|
|
4393
|
+
},
|
|
4394
|
+
"telemetry:enable": {
|
|
4395
|
+
"aliases": [],
|
|
4396
|
+
"args": {},
|
|
4397
|
+
"description": "Enable telemetry for your account",
|
|
4398
|
+
"examples": [
|
|
4399
|
+
{
|
|
4400
|
+
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4401
|
+
"description": "Enable telemetry for your account"
|
|
4402
|
+
}
|
|
4403
|
+
],
|
|
4404
|
+
"flags": {},
|
|
4405
|
+
"hasDynamicHelp": false,
|
|
4406
|
+
"hiddenAliases": [],
|
|
4407
|
+
"id": "telemetry:enable",
|
|
4408
|
+
"pluginAlias": "@sanity/cli",
|
|
4409
|
+
"pluginName": "@sanity/cli",
|
|
4410
|
+
"pluginType": "core",
|
|
4411
|
+
"strict": true,
|
|
4412
|
+
"isESM": true,
|
|
4413
|
+
"relativePath": [
|
|
4414
|
+
"dist",
|
|
4415
|
+
"commands",
|
|
4416
|
+
"telemetry",
|
|
4417
|
+
"enable.js"
|
|
4418
|
+
]
|
|
4419
|
+
},
|
|
4420
|
+
"telemetry:status": {
|
|
4421
|
+
"aliases": [],
|
|
4422
|
+
"args": {},
|
|
4423
|
+
"description": "Check telemetry status for your account",
|
|
4424
|
+
"examples": [
|
|
4425
|
+
{
|
|
4426
|
+
"command": "<%= config.bin %> telemetry <%= command.id %>",
|
|
4427
|
+
"description": "Check telemetry status for your account"
|
|
4428
|
+
}
|
|
4429
|
+
],
|
|
4430
|
+
"flags": {},
|
|
4431
|
+
"hasDynamicHelp": false,
|
|
4432
|
+
"hiddenAliases": [],
|
|
4433
|
+
"id": "telemetry:status",
|
|
4434
|
+
"pluginAlias": "@sanity/cli",
|
|
4435
|
+
"pluginName": "@sanity/cli",
|
|
4436
|
+
"pluginType": "core",
|
|
4437
|
+
"strict": true,
|
|
4438
|
+
"isESM": true,
|
|
4439
|
+
"relativePath": [
|
|
4440
|
+
"dist",
|
|
4441
|
+
"commands",
|
|
4442
|
+
"telemetry",
|
|
4443
|
+
"status.js"
|
|
4444
|
+
]
|
|
4445
|
+
},
|
|
4430
4446
|
"users:invite": {
|
|
4431
4447
|
"aliases": [],
|
|
4432
4448
|
"args": {
|
|
@@ -5098,5 +5114,5 @@
|
|
|
5098
5114
|
]
|
|
5099
5115
|
}
|
|
5100
5116
|
},
|
|
5101
|
-
"version": "6.
|
|
5117
|
+
"version": "6.7.0"
|
|
5102
5118
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -51,26 +51,24 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@oclif/core": "^4.
|
|
54
|
+
"@oclif/core": "^4.11.0",
|
|
55
55
|
"@oclif/plugin-help": "^6.2.45",
|
|
56
56
|
"@oclif/plugin-not-found": "^3.2.81",
|
|
57
57
|
"@sanity/client": "^7.22.0",
|
|
58
|
-
"@sanity/codegen": "^6.0
|
|
58
|
+
"@sanity/codegen": "^6.1.0",
|
|
59
59
|
"@sanity/descriptors": "^1.3.0",
|
|
60
|
-
"@sanity/export": "^6.
|
|
60
|
+
"@sanity/export": "^6.2.0",
|
|
61
61
|
"@sanity/generate-help-url": "^4.0.0",
|
|
62
62
|
"@sanity/id-utils": "^1.0.0",
|
|
63
63
|
"@sanity/import": "^6.0.1",
|
|
64
64
|
"@sanity/migrate": "^6.1.2",
|
|
65
|
-
"@sanity/runtime-cli": "^15.
|
|
66
|
-
"@sanity/schema": "^5.
|
|
65
|
+
"@sanity/runtime-cli": "^15.1.2",
|
|
66
|
+
"@sanity/schema": "^5.26.0",
|
|
67
67
|
"@sanity/telemetry": "^0.9.0",
|
|
68
68
|
"@sanity/template-validator": "^3.1.0",
|
|
69
|
-
"@sanity/types": "^5.
|
|
70
|
-
"@sanity/ui": "^3.1.14",
|
|
69
|
+
"@sanity/types": "^5.26.0",
|
|
71
70
|
"@sanity/worker-channels": "^2.0.0",
|
|
72
71
|
"@vercel/frameworks": "3.21.1",
|
|
73
|
-
"@vitejs/plugin-react": "^5.2.0",
|
|
74
72
|
"chokidar": "^5.0.0",
|
|
75
73
|
"console-table-printer": "^2.15.0",
|
|
76
74
|
"date-fns": "^4.1.0",
|
|
@@ -90,7 +88,6 @@
|
|
|
90
88
|
"lodash-es": "^4.18.1",
|
|
91
89
|
"minimist": "^1.2.8",
|
|
92
90
|
"nanoid": "^5.1.6",
|
|
93
|
-
"node-html-parser": "^7.0.1",
|
|
94
91
|
"oneline": "^2.0.0",
|
|
95
92
|
"open": "^11.0.0",
|
|
96
93
|
"p-map": "^7.0.3",
|
|
@@ -105,6 +102,7 @@
|
|
|
105
102
|
"react-is": "^19.2.4",
|
|
106
103
|
"rxjs": "^7.8.2",
|
|
107
104
|
"semver": "^7.7.4",
|
|
105
|
+
"skills": "^1.5.7",
|
|
108
106
|
"smol-toml": "^1.6.1",
|
|
109
107
|
"tar": "^7.5.13",
|
|
110
108
|
"tar-fs": "^3.1.2",
|
|
@@ -112,24 +110,25 @@
|
|
|
112
110
|
"tinyglobby": "^0.2.16",
|
|
113
111
|
"tsx": "^4.21.0",
|
|
114
112
|
"typeid-js": "^1.2.0",
|
|
115
|
-
"vite": "^7.3.
|
|
113
|
+
"vite": "^7.3.3",
|
|
116
114
|
"which": "^6.0.1",
|
|
117
115
|
"yaml": "^2.8.4",
|
|
118
116
|
"zod": "^4.3.6",
|
|
119
|
-
"@sanity/cli-build": "^0.
|
|
117
|
+
"@sanity/cli-build": "^0.2.0",
|
|
120
118
|
"@sanity/cli-core": "^1.3.2"
|
|
121
119
|
},
|
|
122
120
|
"devDependencies": {
|
|
123
121
|
"@eslint/compat": "^2.0.5",
|
|
124
122
|
"@sanity/pkg-utils": "^10.4.18",
|
|
123
|
+
"@sanity/ui": "^3.2.0",
|
|
125
124
|
"@swc/cli": "^0.8.1",
|
|
126
125
|
"@swc/core": "^1.15.33",
|
|
127
126
|
"@types/debug": "^4.1.13",
|
|
128
127
|
"@types/gunzip-maybe": "^1.4.3",
|
|
129
|
-
"@types/jsdom": "^28.0.
|
|
128
|
+
"@types/jsdom": "^28.0.3",
|
|
130
129
|
"@types/lodash-es": "^4.17.12",
|
|
131
130
|
"@types/minimist": "^1.2.5",
|
|
132
|
-
"@types/node": "^20.19.
|
|
131
|
+
"@types/node": "^20.19.41",
|
|
133
132
|
"@types/picomatch": "^4.0.3",
|
|
134
133
|
"@types/react": "^19.2.14",
|
|
135
134
|
"@types/react-dom": "^19.2.3",
|
|
@@ -141,12 +140,12 @@
|
|
|
141
140
|
"@vitest/coverage-istanbul": "^4.1.5",
|
|
142
141
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
143
142
|
"eslint": "^10.2.1",
|
|
144
|
-
"jsdom": "^29.
|
|
143
|
+
"jsdom": "^29.1.1",
|
|
145
144
|
"nock": "^14.0.14",
|
|
146
145
|
"oclif": "^4.23.0",
|
|
147
146
|
"publint": "^0.3.18",
|
|
148
147
|
"rimraf": "^6.0.1",
|
|
149
|
-
"sanity": "^5.
|
|
148
|
+
"sanity": "^5.26.0",
|
|
150
149
|
"typescript": "^5.9.3",
|
|
151
150
|
"vite-tsconfig-paths": "^6.1.1",
|
|
152
151
|
"vitest": "^4.1.5",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Sanity Page Builder Studio
|
|
2
|
+
|
|
3
|
+
Congratulations, you have now installed the Sanity Content Studio, an open-source real-time content editing environment connected to the Sanity backend.
|
|
4
|
+
|
|
5
|
+
Now you can do the following things:
|
|
6
|
+
|
|
7
|
+
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
|
+
- [Join the Sanity community](https://www.sanity.io/community/join?utm_source=readme)
|
|
9
|
+
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'hero',
|
|
5
|
+
title: 'Hero',
|
|
6
|
+
type: 'object',
|
|
7
|
+
fields: [
|
|
8
|
+
defineField({
|
|
9
|
+
name: 'heading',
|
|
10
|
+
title: 'Heading',
|
|
11
|
+
type: 'string',
|
|
12
|
+
validation: (rule) => rule.required(),
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'body',
|
|
16
|
+
title: 'Body',
|
|
17
|
+
type: 'text',
|
|
18
|
+
rows: 3,
|
|
19
|
+
}),
|
|
20
|
+
defineField({
|
|
21
|
+
name: 'image',
|
|
22
|
+
title: 'Image',
|
|
23
|
+
type: 'imageBlock',
|
|
24
|
+
}),
|
|
25
|
+
defineField({
|
|
26
|
+
name: 'cta',
|
|
27
|
+
title: 'Call to action',
|
|
28
|
+
type: 'cta',
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {createPresetsRegistry} from '@sanity/presets'
|
|
2
|
+
|
|
3
|
+
import hero from './hero'
|
|
4
|
+
|
|
5
|
+
const {defineCta, defineImage, definePage, defineRichText} = createPresetsRegistry({
|
|
6
|
+
link: {internalTypes: ['page']},
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export const schemaTypes = [
|
|
10
|
+
definePage({
|
|
11
|
+
name: 'page',
|
|
12
|
+
title: 'Page',
|
|
13
|
+
pageBuilderBlocks: ['hero', 'imageBlock', 'cta', 'richText'],
|
|
14
|
+
}),
|
|
15
|
+
hero,
|
|
16
|
+
defineImage({name: 'imageBlock', title: 'Image'}),
|
|
17
|
+
defineCta({name: 'cta', title: 'Call to action'}),
|
|
18
|
+
defineRichText({name: 'richText', title: 'Rich text'}),
|
|
19
|
+
]
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/buildDebug.ts"],"sourcesContent":["import {subdebug} from '@sanity/cli-core'\n\nexport const buildDebug = subdebug('build')\n"],"names":["subdebug","buildDebug"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,OAAO,MAAMC,aAAaD,SAAS,SAAQ"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { getLocalPackageDir, getLocalPackageVersion } from '@sanity/cli-core';
|
|
3
|
-
import { gt, minVersion, rcompare, satisfies } from 'semver';
|
|
4
|
-
import { build } from 'vite';
|
|
5
|
-
import { SANITY_CACHE_DIR } from '../../constants.js';
|
|
6
|
-
import { createExternalFromImportMap } from './createExternalFromImportMap.js';
|
|
7
|
-
// Directory where vendor packages will be stored
|
|
8
|
-
const VENDOR_DIR = 'vendor';
|
|
9
|
-
// Define the vendor packages and their corresponding versions and entry points
|
|
10
|
-
const VENDOR_IMPORTS = {
|
|
11
|
-
react: {
|
|
12
|
-
'^19.2.0': {
|
|
13
|
-
'.': './cjs/react.production.js',
|
|
14
|
-
'./compiler-runtime': './cjs/react-compiler-runtime.production.js',
|
|
15
|
-
'./jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.js',
|
|
16
|
-
'./jsx-runtime': './cjs/react-jsx-runtime.production.js',
|
|
17
|
-
'./package.json': './package.json'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
'react-dom': {
|
|
21
|
-
'^19.2.0': {
|
|
22
|
-
'.': './cjs/react-dom.production.js',
|
|
23
|
-
'./client': './cjs/react-dom-client.production.js',
|
|
24
|
-
'./package.json': './package.json',
|
|
25
|
-
'./server': './cjs/react-dom-server-legacy.browser.production.js',
|
|
26
|
-
'./server.browser': './cjs/react-dom-server-legacy.browser.production.js',
|
|
27
|
-
'./static': './cjs/react-dom-server.browser.production.js',
|
|
28
|
-
'./static.browser': './cjs/react-dom-server.browser.production.js'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const STYLED_COMPONENTS_IMPORTS = {
|
|
33
|
-
'styled-components': {
|
|
34
|
-
'^6.1.0': {
|
|
35
|
-
'.': './dist/styled-components.browser.esm.js',
|
|
36
|
-
'./package.json': './package.json'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Builds the ESM browser compatible versions of the vendor packages
|
|
42
|
-
* specified in VENDOR_IMPORTS. Returns the `imports` object of an import map.
|
|
43
|
-
*/ export async function buildVendorDependencies({ basePath, cwd, isApp, outputDir }) {
|
|
44
|
-
const entry = {};
|
|
45
|
-
const imports = {};
|
|
46
|
-
// If we're building an app, we don't need to build the styled-components package
|
|
47
|
-
const vendorImports = isApp ? VENDOR_IMPORTS : {
|
|
48
|
-
...VENDOR_IMPORTS,
|
|
49
|
-
...STYLED_COMPONENTS_IMPORTS
|
|
50
|
-
};
|
|
51
|
-
// Iterate over each package and its version ranges in VENDOR_IMPORTS
|
|
52
|
-
for (const [packageName, ranges] of Object.entries(vendorImports)){
|
|
53
|
-
const version = await getLocalPackageVersion(packageName, cwd);
|
|
54
|
-
if (!version) {
|
|
55
|
-
throw new Error(`Could not get version for '${packageName}'`);
|
|
56
|
-
}
|
|
57
|
-
// Sort version ranges in descending order
|
|
58
|
-
const sortedRanges = Object.keys(ranges).toSorted((range1, range2)=>{
|
|
59
|
-
const min1 = minVersion(range1);
|
|
60
|
-
const min2 = minVersion(range2);
|
|
61
|
-
if (!min1) throw new Error(`Could not parse range '${range1}'`);
|
|
62
|
-
if (!min2) throw new Error(`Could not parse range '${range2}'`);
|
|
63
|
-
// sort them in reverse so we can rely on array `.find` below
|
|
64
|
-
return rcompare(min1.version, min2.version);
|
|
65
|
-
});
|
|
66
|
-
// Find the first version range that satisfies the package version
|
|
67
|
-
const matchedRange = sortedRanges.find((range)=>satisfies(version, range));
|
|
68
|
-
if (!matchedRange) {
|
|
69
|
-
const min = minVersion(sortedRanges.at(-1));
|
|
70
|
-
if (!min) {
|
|
71
|
-
throw new Error(`Could not find a minimum version for package '${packageName}'`);
|
|
72
|
-
}
|
|
73
|
-
if (gt(min.version, version)) {
|
|
74
|
-
throw new Error(`Package '${packageName}' requires at least ${min.version}.`);
|
|
75
|
-
}
|
|
76
|
-
throw new Error(`Version '${version}' of package '${packageName}' is not supported yet.`);
|
|
77
|
-
}
|
|
78
|
-
const subpaths = ranges[matchedRange];
|
|
79
|
-
// Resolve the actual package directory using Node module resolution,
|
|
80
|
-
// so that hoisted packages in monorepos/workspaces are found correctly
|
|
81
|
-
const packageDir = getLocalPackageDir(packageName, cwd);
|
|
82
|
-
// Iterate over each subpath and its corresponding entry point
|
|
83
|
-
for (const [subpath, relativeEntryPoint] of Object.entries(subpaths)){
|
|
84
|
-
const specifier = path.posix.join(packageName, subpath);
|
|
85
|
-
const chunkName = path.posix.join(packageName, path.relative(packageName, specifier) || 'index');
|
|
86
|
-
entry[chunkName] = path.join(packageDir, relativeEntryPoint);
|
|
87
|
-
imports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, `${chunkName}.mjs`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Use Vite to build the packages into the output directory
|
|
91
|
-
let buildResult = await build({
|
|
92
|
-
appType: 'custom',
|
|
93
|
-
build: {
|
|
94
|
-
commonjsOptions: {
|
|
95
|
-
strictRequires: 'auto'
|
|
96
|
-
},
|
|
97
|
-
emptyOutDir: false,
|
|
98
|
-
lib: {
|
|
99
|
-
entry,
|
|
100
|
-
formats: [
|
|
101
|
-
'es'
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
minify: true,
|
|
105
|
-
outDir: path.join(outputDir, VENDOR_DIR),
|
|
106
|
-
rollupOptions: {
|
|
107
|
-
external: createExternalFromImportMap({
|
|
108
|
-
imports
|
|
109
|
-
}),
|
|
110
|
-
output: {
|
|
111
|
-
chunkFileNames: '[name]-[hash].mjs',
|
|
112
|
-
entryFileNames: '[name]-[hash].mjs',
|
|
113
|
-
exports: 'named',
|
|
114
|
-
format: 'es'
|
|
115
|
-
},
|
|
116
|
-
treeshake: {
|
|
117
|
-
preset: 'recommended'
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
// Define a custom cache directory so that sanity's vite cache
|
|
122
|
-
// does not conflict with any potential local vite projects
|
|
123
|
-
cacheDir: `${SANITY_CACHE_DIR}/vite-vendor`,
|
|
124
|
-
configFile: false,
|
|
125
|
-
define: {
|
|
126
|
-
'process.env.NODE_ENV': JSON.stringify('production')
|
|
127
|
-
},
|
|
128
|
-
logLevel: 'silent',
|
|
129
|
-
mode: 'production',
|
|
130
|
-
root: cwd
|
|
131
|
-
});
|
|
132
|
-
buildResult = Array.isArray(buildResult) ? buildResult : [
|
|
133
|
-
buildResult
|
|
134
|
-
];
|
|
135
|
-
// Create a map of the original import specifiers to their hashed filenames
|
|
136
|
-
const hashedImports = {};
|
|
137
|
-
const output = buildResult.flatMap((i)=>i.output);
|
|
138
|
-
for (const chunk of output){
|
|
139
|
-
if (chunk.type === 'asset') continue;
|
|
140
|
-
for (const [specifier, originalPath] of Object.entries(imports)){
|
|
141
|
-
if (originalPath.endsWith(`${chunk.name}.mjs`)) {
|
|
142
|
-
hashedImports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, chunk.fileName);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return hashedImports;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//# sourceMappingURL=buildVendorDependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/buildVendorDependencies.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {getLocalPackageDir, getLocalPackageVersion} from '@sanity/cli-core'\nimport {gt, minVersion, rcompare, satisfies} from 'semver'\nimport {build} from 'vite'\n\nimport {SANITY_CACHE_DIR} from '../../constants.js'\nimport {createExternalFromImportMap} from './createExternalFromImportMap.js'\n\n// Directory where vendor packages will be stored\nconst VENDOR_DIR = 'vendor'\n\n/**\n * A type representing the imports of vendor packages, defining specific entry\n * points for various versions and subpaths of the packages.\n *\n * The `VendorImports` object is used to build ESM browser-compatible versions\n * of the specified packages. This approach ensures that the appropriate version\n * and entry points are used for each package, enabling compatibility and proper\n * functionality in the browser environment.\n *\n * ## Rationale\n *\n * The rationale for this structure is to handle different versions of the\n * packages carefully, especially major versions. Major version bumps often\n * introduce breaking changes, so the module scheme for the package needs to be\n * checked when there is a major version update. However, minor and patch\n * versions are generally backward compatible, so they are handled more\n * leniently. By assuming that new minor versions are compatible, we avoid\n * unnecessary warnings and streamline the update process.\n *\n * If a new minor version introduces an additional subpath export within the\n * package of this version range, the corresponding package can add a more\n * specific version range that includes the new subpath. This design allows for\n * flexibility and ease of maintenance, ensuring that the latest features and\n * fixes are incorporated without extensive manual intervention.\n *\n * An additional subpath export within the package of this version range that\n * could cause the build to break if that new export is used, can be treated as\n * a bug fix. It might make more sense to our users that this new subpath isn't\n * supported yet until we address it as a bug fix. This approach helps maintain\n * stability and prevents unexpected issues during the build process.\n *\n * ## Structure\n * The `VendorImports` type is a nested object where:\n * - The keys at the first level represent the package names.\n * - The keys at the second level represent the version ranges (e.g., `^19.0.0`).\n * - The keys at the third level represent the subpaths within the package (e.g., `.` for the main entry point).\n * - The values at the third level are the relative paths to the corresponding entry points within the package.\n *\n * This structure allows for precise specification of the entry points for\n * different versions and subpaths, ensuring that the correct files are used\n * during the build process.\n */\ntype VendorImports = {\n [packageName: string]: {\n [versionRange: string]: {\n [subpath: string]: string\n }\n }\n}\n\n// Define the vendor packages and their corresponding versions and entry points\nconst VENDOR_IMPORTS: VendorImports = {\n react: {\n '^19.2.0': {\n '.': './cjs/react.production.js',\n './compiler-runtime': './cjs/react-compiler-runtime.production.js',\n './jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.js',\n './jsx-runtime': './cjs/react-jsx-runtime.production.js',\n './package.json': './package.json',\n },\n },\n 'react-dom': {\n '^19.2.0': {\n '.': './cjs/react-dom.production.js',\n './client': './cjs/react-dom-client.production.js',\n './package.json': './package.json',\n './server': './cjs/react-dom-server-legacy.browser.production.js',\n './server.browser': './cjs/react-dom-server-legacy.browser.production.js',\n './static': './cjs/react-dom-server.browser.production.js',\n './static.browser': './cjs/react-dom-server.browser.production.js',\n },\n },\n}\n\nconst STYLED_COMPONENTS_IMPORTS = {\n 'styled-components': {\n '^6.1.0': {\n '.': './dist/styled-components.browser.esm.js',\n './package.json': './package.json',\n },\n },\n}\n\ninterface VendorBuildOptions {\n basePath: string\n cwd: string\n isApp: boolean\n outputDir: string\n}\n\n/**\n * Builds the ESM browser compatible versions of the vendor packages\n * specified in VENDOR_IMPORTS. Returns the `imports` object of an import map.\n */\nexport async function buildVendorDependencies({\n basePath,\n cwd,\n isApp,\n outputDir,\n}: VendorBuildOptions): Promise<Record<string, string>> {\n const entry: Record<string, string> = {}\n const imports: Record<string, string> = {}\n\n // If we're building an app, we don't need to build the styled-components package\n const vendorImports = isApp ? VENDOR_IMPORTS : {...VENDOR_IMPORTS, ...STYLED_COMPONENTS_IMPORTS}\n\n // Iterate over each package and its version ranges in VENDOR_IMPORTS\n for (const [packageName, ranges] of Object.entries(vendorImports)) {\n const version = await getLocalPackageVersion(packageName, cwd)\n if (!version) {\n throw new Error(`Could not get version for '${packageName}'`)\n }\n\n // Sort version ranges in descending order\n const sortedRanges = Object.keys(ranges).toSorted((range1, range2) => {\n const min1 = minVersion(range1)\n const min2 = minVersion(range2)\n\n if (!min1) throw new Error(`Could not parse range '${range1}'`)\n if (!min2) throw new Error(`Could not parse range '${range2}'`)\n\n // sort them in reverse so we can rely on array `.find` below\n return rcompare(min1.version, min2.version)\n })\n\n // Find the first version range that satisfies the package version\n const matchedRange = sortedRanges.find((range) => satisfies(version, range))\n\n if (!matchedRange) {\n const min = minVersion(sortedRanges.at(-1)!)\n if (!min) {\n throw new Error(`Could not find a minimum version for package '${packageName}'`)\n }\n\n if (gt(min.version, version)) {\n throw new Error(`Package '${packageName}' requires at least ${min.version}.`)\n }\n\n throw new Error(`Version '${version}' of package '${packageName}' is not supported yet.`)\n }\n\n const subpaths = ranges[matchedRange]\n\n // Resolve the actual package directory using Node module resolution,\n // so that hoisted packages in monorepos/workspaces are found correctly\n const packageDir = getLocalPackageDir(packageName, cwd)\n\n // Iterate over each subpath and its corresponding entry point\n for (const [subpath, relativeEntryPoint] of Object.entries(subpaths)) {\n const specifier = path.posix.join(packageName, subpath)\n const chunkName = path.posix.join(\n packageName,\n path.relative(packageName, specifier) || 'index',\n )\n\n entry[chunkName] = path.join(packageDir, relativeEntryPoint)\n imports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, `${chunkName}.mjs`)\n }\n }\n\n // removes the `RollupWatcher` type\n type BuildResult = Exclude<Awaited<ReturnType<typeof build>>, {close: unknown}>\n\n // Use Vite to build the packages into the output directory\n let buildResult = (await build({\n appType: 'custom',\n build: {\n commonjsOptions: {strictRequires: 'auto'},\n emptyOutDir: false, // Rely on CLI to do this\n lib: {entry, formats: ['es']},\n minify: true,\n outDir: path.join(outputDir, VENDOR_DIR),\n rollupOptions: {\n external: createExternalFromImportMap({imports}),\n output: {\n chunkFileNames: '[name]-[hash].mjs',\n entryFileNames: '[name]-[hash].mjs',\n exports: 'named',\n format: 'es',\n },\n treeshake: {preset: 'recommended'},\n },\n },\n // Define a custom cache directory so that sanity's vite cache\n // does not conflict with any potential local vite projects\n cacheDir: `${SANITY_CACHE_DIR}/vite-vendor`,\n configFile: false,\n define: {'process.env.NODE_ENV': JSON.stringify('production')},\n logLevel: 'silent',\n mode: 'production',\n root: cwd,\n })) as BuildResult\n\n buildResult = Array.isArray(buildResult) ? buildResult : [buildResult]\n\n // Create a map of the original import specifiers to their hashed filenames\n const hashedImports: Record<string, string> = {}\n const output = buildResult.flatMap((i) => i.output)\n\n for (const chunk of output) {\n if (chunk.type === 'asset') continue\n\n for (const [specifier, originalPath] of Object.entries(imports)) {\n if (originalPath.endsWith(`${chunk.name}.mjs`)) {\n hashedImports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, chunk.fileName)\n }\n }\n }\n\n return hashedImports\n}\n"],"names":["path","getLocalPackageDir","getLocalPackageVersion","gt","minVersion","rcompare","satisfies","build","SANITY_CACHE_DIR","createExternalFromImportMap","VENDOR_DIR","VENDOR_IMPORTS","react","STYLED_COMPONENTS_IMPORTS","buildVendorDependencies","basePath","cwd","isApp","outputDir","entry","imports","vendorImports","packageName","ranges","Object","entries","version","Error","sortedRanges","keys","toSorted","range1","range2","min1","min2","matchedRange","find","range","min","at","subpaths","packageDir","subpath","relativeEntryPoint","specifier","posix","join","chunkName","relative","buildResult","appType","commonjsOptions","strictRequires","emptyOutDir","lib","formats","minify","outDir","rollupOptions","external","output","chunkFileNames","entryFileNames","exports","format","treeshake","preset","cacheDir","configFile","define","JSON","stringify","logLevel","mode","root","Array","isArray","hashedImports","flatMap","i","chunk","type","originalPath","endsWith","name","fileName"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SAAQC,kBAAkB,EAAEC,sBAAsB,QAAO,mBAAkB;AAC3E,SAAQC,EAAE,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,QAAO,SAAQ;AAC1D,SAAQC,KAAK,QAAO,OAAM;AAE1B,SAAQC,gBAAgB,QAAO,qBAAoB;AACnD,SAAQC,2BAA2B,QAAO,mCAAkC;AAE5E,iDAAiD;AACjD,MAAMC,aAAa;AAoDnB,+EAA+E;AAC/E,MAAMC,iBAAgC;IACpCC,OAAO;QACL,WAAW;YACT,KAAK;YACL,sBAAsB;YACtB,qBAAqB;YACrB,iBAAiB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