@sanity/cli 7.2.3 → 7.4.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/bin/run.js +3 -12
- package/dist/actions/auth/authServer.js +37 -20
- package/dist/actions/auth/authServer.js.map +1 -1
- package/dist/actions/backup/assertDatasetExist.js +3 -3
- package/dist/actions/backup/assertDatasetExist.js.map +1 -1
- package/dist/actions/build/buildApp.js +15 -5
- package/dist/actions/build/buildApp.js.map +1 -1
- package/dist/actions/build/buildStaticFiles.js +57 -5
- package/dist/actions/build/buildStaticFiles.js.map +1 -1
- package/dist/actions/build/buildStudio.js +13 -5
- package/dist/actions/build/buildStudio.js.map +1 -1
- package/dist/actions/build/handlePrereleaseVersions.js +2 -2
- package/dist/actions/build/handlePrereleaseVersions.js.map +1 -1
- package/dist/actions/dataset/resolveDataset.js +2 -2
- package/dist/actions/dataset/resolveDataset.js.map +1 -1
- package/dist/actions/deploy/deployApp.js +43 -5
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +14 -2
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/deploy/viewDeployment.js +32 -0
- package/dist/actions/deploy/viewDeployment.js.map +1 -0
- package/dist/actions/dev/devAction.js +219 -4
- package/dist/actions/dev/devAction.js.map +1 -1
- package/dist/actions/dev/registration/deriveInterfaces.js +46 -0
- package/dist/actions/dev/registration/deriveInterfaces.js.map +1 -0
- package/dist/actions/dev/registration/extractDevServerManifest.js +30 -0
- package/dist/actions/dev/registration/extractDevServerManifest.js.map +1 -0
- package/dist/actions/dev/registration/interfaceSetId.js +41 -0
- package/dist/actions/dev/registration/interfaceSetId.js.map +1 -0
- package/dist/actions/dev/registration/startDevManifestWatcher.js +104 -0
- package/dist/actions/dev/registration/startDevManifestWatcher.js.map +1 -0
- package/dist/actions/dev/registration/startDevServerRegistration.js +121 -0
- package/dist/actions/dev/registration/startDevServerRegistration.js.map +1 -0
- package/dist/actions/dev/servers/getDashboardAppUrl.js.map +1 -0
- package/dist/actions/dev/servers/getDevServerConfig.js +45 -0
- package/dist/actions/dev/servers/getDevServerConfig.js.map +1 -0
- package/dist/actions/dev/servers/startAppDevServer.js +78 -0
- package/dist/actions/dev/servers/startAppDevServer.js.map +1 -0
- package/dist/actions/dev/{startStudioDevServer.js → servers/startStudioDevServer.js} +20 -16
- package/dist/actions/dev/servers/startStudioDevServer.js.map +1 -0
- package/dist/actions/dev/types.js +7 -1
- package/dist/actions/dev/types.js.map +1 -1
- package/dist/actions/dev/workbench/startWorkbenchDevServer.js +276 -0
- package/dist/actions/dev/workbench/startWorkbenchDevServer.js.map +1 -0
- package/dist/actions/dev/workbench/writeWorkbenchRuntime.js +66 -0
- package/dist/actions/dev/workbench/writeWorkbenchRuntime.js.map +1 -0
- package/dist/actions/init/bootstrapLocalTemplate.js +15 -3
- package/dist/actions/init/bootstrapLocalTemplate.js.map +1 -1
- package/dist/actions/init/bootstrapTemplate.js +3 -2
- package/dist/actions/init/bootstrapTemplate.js.map +1 -1
- package/dist/actions/init/createAppCliConfig.js +5 -2
- package/dist/actions/init/createAppCliConfig.js.map +1 -1
- package/dist/actions/init/createCliConfig.js +5 -3
- package/dist/actions/init/createCliConfig.js.map +1 -1
- package/dist/actions/init/createStudioConfig.js.map +1 -1
- package/dist/actions/init/initAction.js +11 -4
- package/dist/actions/init/initAction.js.map +1 -1
- package/dist/actions/init/initApp.js +2 -1
- package/dist/actions/init/initApp.js.map +1 -1
- package/dist/actions/init/initStudio.js +2 -1
- package/dist/actions/init/initStudio.js.map +1 -1
- package/dist/actions/init/scaffoldTemplate.js +6 -14
- package/dist/actions/init/scaffoldTemplate.js.map +1 -1
- package/dist/actions/init/templates/pageBuilder.js +1 -1
- package/dist/actions/init/templates/pageBuilder.js.map +1 -1
- package/dist/actions/init/types.js +1 -0
- package/dist/actions/init/types.js.map +1 -1
- package/dist/actions/manifest/{extractAppManifest.js → extractCoreAppManifest.js} +30 -11
- package/dist/actions/manifest/extractCoreAppManifest.js.map +1 -0
- package/dist/actions/manifest/extractManifest.js +7 -7
- package/dist/actions/manifest/extractManifest.js.map +1 -1
- package/dist/actions/manifest/iconResolver.js +2 -3
- package/dist/actions/manifest/iconResolver.js.map +1 -1
- package/dist/actions/manifest/sanitizeIcon.js +13 -0
- package/dist/actions/manifest/sanitizeIcon.js.map +1 -0
- package/dist/actions/manifest/types.js +4 -9
- package/dist/actions/manifest/types.js.map +1 -1
- package/dist/actions/manifest/writeManifestFile.js +1 -1
- package/dist/actions/manifest/writeManifestFile.js.map +1 -1
- package/dist/actions/mcp/editorConfigs.js +26 -2
- package/dist/actions/mcp/editorConfigs.js.map +1 -1
- package/dist/actions/mcp/setupMCP.js +24 -25
- package/dist/actions/mcp/setupMCP.js.map +1 -1
- package/dist/actions/mcp/types.js.map +1 -1
- package/dist/actions/skills/configureSkills.js +49 -0
- package/dist/actions/skills/configureSkills.js.map +1 -0
- package/dist/actions/skills/readSkillState.js +40 -5
- package/dist/actions/skills/readSkillState.js.map +1 -1
- package/dist/actions/skills/setupSkills.js +47 -6
- package/dist/actions/skills/setupSkills.js.map +1 -1
- package/dist/actions/skills/skillCandidates.js +40 -0
- package/dist/actions/skills/skillCandidates.js.map +1 -0
- package/dist/actions/telemetry/telemetryDisclosure.js +2 -3
- package/dist/actions/telemetry/telemetryDisclosure.js.map +1 -1
- package/dist/actions/tokens/validateRole.js +3 -3
- package/dist/actions/tokens/validateRole.js.map +1 -1
- package/dist/commands/backups/disable.js +1 -1
- package/dist/commands/backups/disable.js.map +1 -1
- package/dist/commands/backups/download.js +1 -1
- package/dist/commands/backups/download.js.map +1 -1
- package/dist/commands/backups/enable.js +1 -1
- package/dist/commands/backups/enable.js.map +1 -1
- package/dist/commands/backups/list.js +1 -1
- package/dist/commands/backups/list.js.map +1 -1
- package/dist/commands/datasets/embeddings/disable.js +1 -0
- package/dist/commands/datasets/embeddings/disable.js.map +1 -1
- package/dist/commands/datasets/embeddings/enable.js +1 -0
- package/dist/commands/datasets/embeddings/enable.js.map +1 -1
- package/dist/commands/datasets/embeddings/status.js +1 -0
- package/dist/commands/datasets/embeddings/status.js.map +1 -1
- package/dist/commands/dev.js +11 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.js +7 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/manifest/extract.js +7 -2
- package/dist/commands/manifest/extract.js.map +1 -1
- package/dist/commands/mcp/configure.js +1 -0
- package/dist/commands/mcp/configure.js.map +1 -1
- package/dist/commands/skills/install.js +40 -0
- package/dist/commands/skills/install.js.map +1 -0
- package/dist/commands/tokens/add.js +1 -1
- package/dist/commands/tokens/add.js.map +1 -1
- package/dist/exports/index.d.ts +6 -0
- package/dist/exports/index.js +8 -0
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/runtime.d.ts +41 -0
- package/dist/exports/runtime.js +13 -0
- package/dist/exports/runtime.js.map +1 -0
- package/dist/hooks/prerun/setupTelemetry.js +3 -1
- package/dist/hooks/prerun/setupTelemetry.js.map +1 -1
- package/dist/server/devServer.js +8 -3
- package/dist/server/devServer.js.map +1 -1
- package/dist/services/documents.js +0 -1
- package/dist/services/documents.js.map +1 -1
- package/dist/telemetry/skills.telemetry.js +8 -0
- package/dist/telemetry/skills.telemetry.js.map +1 -0
- package/dist/util/compareDependencyVersions.js +1 -1
- package/dist/util/compareDependencyVersions.js.map +1 -1
- package/dist/util/determineIsApp.js +12 -1
- package/dist/util/determineIsApp.js.map +1 -1
- package/dist/util/getSharedServerConfig.js +2 -1
- package/dist/util/getSharedServerConfig.js.map +1 -1
- package/dist/util/resolveLatestVersions.js +20 -2
- package/dist/util/resolveLatestVersions.js.map +1 -1
- package/dist/util/resolveReactStrictMode.js +11 -0
- package/dist/util/resolveReactStrictMode.js.map +1 -0
- package/oclif.config.js +2 -1
- package/oclif.manifest.json +146 -113
- package/package.json +29 -23
- package/templates/page-builder/schemaTypes/index.js +1 -1
- package/dist/actions/build/checkRequiredDependencies.js +0 -124
- package/dist/actions/build/checkRequiredDependencies.js.map +0 -1
- package/dist/actions/build/getAutoUpdatesImportMap.js +0 -66
- package/dist/actions/build/getAutoUpdatesImportMap.js.map +0 -1
- package/dist/actions/dev/getDashboardAppUrl.js.map +0 -1
- package/dist/actions/dev/getDevServerConfig.js +0 -32
- package/dist/actions/dev/getDevServerConfig.js.map +0 -1
- package/dist/actions/dev/startAppDevServer.js +0 -59
- package/dist/actions/dev/startAppDevServer.js.map +0 -1
- package/dist/actions/dev/startStudioDevServer.js.map +0 -1
- package/dist/actions/manifest/extractAppManifest.js.map +0 -1
- /package/dist/actions/dev/{getDashboardAppUrl.js → servers/getDashboardAppUrl.js} +0 -0
package/oclif.manifest.json
CHANGED
|
@@ -710,6 +710,13 @@
|
|
|
710
710
|
"allowNo": true,
|
|
711
711
|
"type": "boolean"
|
|
712
712
|
},
|
|
713
|
+
"unstable--workbench": {
|
|
714
|
+
"description": "Opt into workbench: scaffolds the CLI config with unstable_defineApp",
|
|
715
|
+
"hidden": true,
|
|
716
|
+
"name": "unstable--workbench",
|
|
717
|
+
"allowNo": true,
|
|
718
|
+
"type": "boolean"
|
|
719
|
+
},
|
|
713
720
|
"visibility": {
|
|
714
721
|
"description": "Visibility mode for dataset",
|
|
715
722
|
"name": "visibility",
|
|
@@ -3227,118 +3234,6 @@
|
|
|
3227
3234
|
"configure.js"
|
|
3228
3235
|
]
|
|
3229
3236
|
},
|
|
3230
|
-
"openapi:get": {
|
|
3231
|
-
"aliases": [],
|
|
3232
|
-
"args": {
|
|
3233
|
-
"slug": {
|
|
3234
|
-
"description": "Slug of the OpenAPI specification to retrieve",
|
|
3235
|
-
"name": "slug",
|
|
3236
|
-
"required": true
|
|
3237
|
-
}
|
|
3238
|
-
},
|
|
3239
|
-
"description": "Get an OpenAPI specification by slug",
|
|
3240
|
-
"examples": [
|
|
3241
|
-
{
|
|
3242
|
-
"command": "<%= config.bin %> <%= command.id %> query",
|
|
3243
|
-
"description": "Get a specification (YAML format, default)"
|
|
3244
|
-
},
|
|
3245
|
-
{
|
|
3246
|
-
"command": "<%= config.bin %> <%= command.id %> query --format=json",
|
|
3247
|
-
"description": "Get specification in JSON format"
|
|
3248
|
-
},
|
|
3249
|
-
{
|
|
3250
|
-
"command": "<%= config.bin %> <%= command.id %> query --web",
|
|
3251
|
-
"description": "Open specification in browser"
|
|
3252
|
-
},
|
|
3253
|
-
{
|
|
3254
|
-
"command": "<%= config.bin %> <%= command.id %> query > query-api.yaml",
|
|
3255
|
-
"description": "Pipe to file"
|
|
3256
|
-
}
|
|
3257
|
-
],
|
|
3258
|
-
"flags": {
|
|
3259
|
-
"format": {
|
|
3260
|
-
"description": "Output format: yaml (default), json",
|
|
3261
|
-
"name": "format",
|
|
3262
|
-
"default": "yaml",
|
|
3263
|
-
"hasDynamicHelp": false,
|
|
3264
|
-
"multiple": false,
|
|
3265
|
-
"options": [
|
|
3266
|
-
"yaml",
|
|
3267
|
-
"json"
|
|
3268
|
-
],
|
|
3269
|
-
"type": "option"
|
|
3270
|
-
},
|
|
3271
|
-
"web": {
|
|
3272
|
-
"char": "w",
|
|
3273
|
-
"description": "Open in web browser",
|
|
3274
|
-
"name": "web",
|
|
3275
|
-
"allowNo": false,
|
|
3276
|
-
"type": "boolean"
|
|
3277
|
-
}
|
|
3278
|
-
},
|
|
3279
|
-
"hasDynamicHelp": false,
|
|
3280
|
-
"hiddenAliases": [],
|
|
3281
|
-
"id": "openapi:get",
|
|
3282
|
-
"pluginAlias": "@sanity/cli",
|
|
3283
|
-
"pluginName": "@sanity/cli",
|
|
3284
|
-
"pluginType": "core",
|
|
3285
|
-
"strict": true,
|
|
3286
|
-
"isESM": true,
|
|
3287
|
-
"relativePath": [
|
|
3288
|
-
"dist",
|
|
3289
|
-
"commands",
|
|
3290
|
-
"openapi",
|
|
3291
|
-
"get.js"
|
|
3292
|
-
]
|
|
3293
|
-
},
|
|
3294
|
-
"openapi:list": {
|
|
3295
|
-
"aliases": [],
|
|
3296
|
-
"args": {},
|
|
3297
|
-
"description": "List all available OpenAPI specifications",
|
|
3298
|
-
"examples": [
|
|
3299
|
-
{
|
|
3300
|
-
"command": "<%= config.bin %> <%= command.id %>",
|
|
3301
|
-
"description": "List all available OpenAPI specs"
|
|
3302
|
-
},
|
|
3303
|
-
{
|
|
3304
|
-
"command": "<%= config.bin %> <%= command.id %> --json",
|
|
3305
|
-
"description": "List with JSON output"
|
|
3306
|
-
},
|
|
3307
|
-
{
|
|
3308
|
-
"command": "<%= config.bin %> <%= command.id %> --web",
|
|
3309
|
-
"description": "Open HTTP Reference in browser"
|
|
3310
|
-
}
|
|
3311
|
-
],
|
|
3312
|
-
"flags": {
|
|
3313
|
-
"json": {
|
|
3314
|
-
"description": "Output JSON",
|
|
3315
|
-
"name": "json",
|
|
3316
|
-
"allowNo": false,
|
|
3317
|
-
"type": "boolean"
|
|
3318
|
-
},
|
|
3319
|
-
"web": {
|
|
3320
|
-
"char": "w",
|
|
3321
|
-
"description": "Open HTTP Reference in web browser",
|
|
3322
|
-
"name": "web",
|
|
3323
|
-
"allowNo": false,
|
|
3324
|
-
"type": "boolean"
|
|
3325
|
-
}
|
|
3326
|
-
},
|
|
3327
|
-
"hasDynamicHelp": false,
|
|
3328
|
-
"hiddenAliases": [],
|
|
3329
|
-
"id": "openapi:list",
|
|
3330
|
-
"pluginAlias": "@sanity/cli",
|
|
3331
|
-
"pluginName": "@sanity/cli",
|
|
3332
|
-
"pluginType": "core",
|
|
3333
|
-
"strict": true,
|
|
3334
|
-
"isESM": true,
|
|
3335
|
-
"relativePath": [
|
|
3336
|
-
"dist",
|
|
3337
|
-
"commands",
|
|
3338
|
-
"openapi",
|
|
3339
|
-
"list.js"
|
|
3340
|
-
]
|
|
3341
|
-
},
|
|
3342
3237
|
"media:create-aspect": {
|
|
3343
3238
|
"aliases": [],
|
|
3344
3239
|
"args": {},
|
|
@@ -3629,6 +3524,118 @@
|
|
|
3629
3524
|
"import.js"
|
|
3630
3525
|
]
|
|
3631
3526
|
},
|
|
3527
|
+
"openapi:get": {
|
|
3528
|
+
"aliases": [],
|
|
3529
|
+
"args": {
|
|
3530
|
+
"slug": {
|
|
3531
|
+
"description": "Slug of the OpenAPI specification to retrieve",
|
|
3532
|
+
"name": "slug",
|
|
3533
|
+
"required": true
|
|
3534
|
+
}
|
|
3535
|
+
},
|
|
3536
|
+
"description": "Get an OpenAPI specification by slug",
|
|
3537
|
+
"examples": [
|
|
3538
|
+
{
|
|
3539
|
+
"command": "<%= config.bin %> <%= command.id %> query",
|
|
3540
|
+
"description": "Get a specification (YAML format, default)"
|
|
3541
|
+
},
|
|
3542
|
+
{
|
|
3543
|
+
"command": "<%= config.bin %> <%= command.id %> query --format=json",
|
|
3544
|
+
"description": "Get specification in JSON format"
|
|
3545
|
+
},
|
|
3546
|
+
{
|
|
3547
|
+
"command": "<%= config.bin %> <%= command.id %> query --web",
|
|
3548
|
+
"description": "Open specification in browser"
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
"command": "<%= config.bin %> <%= command.id %> query > query-api.yaml",
|
|
3552
|
+
"description": "Pipe to file"
|
|
3553
|
+
}
|
|
3554
|
+
],
|
|
3555
|
+
"flags": {
|
|
3556
|
+
"format": {
|
|
3557
|
+
"description": "Output format: yaml (default), json",
|
|
3558
|
+
"name": "format",
|
|
3559
|
+
"default": "yaml",
|
|
3560
|
+
"hasDynamicHelp": false,
|
|
3561
|
+
"multiple": false,
|
|
3562
|
+
"options": [
|
|
3563
|
+
"yaml",
|
|
3564
|
+
"json"
|
|
3565
|
+
],
|
|
3566
|
+
"type": "option"
|
|
3567
|
+
},
|
|
3568
|
+
"web": {
|
|
3569
|
+
"char": "w",
|
|
3570
|
+
"description": "Open in web browser",
|
|
3571
|
+
"name": "web",
|
|
3572
|
+
"allowNo": false,
|
|
3573
|
+
"type": "boolean"
|
|
3574
|
+
}
|
|
3575
|
+
},
|
|
3576
|
+
"hasDynamicHelp": false,
|
|
3577
|
+
"hiddenAliases": [],
|
|
3578
|
+
"id": "openapi:get",
|
|
3579
|
+
"pluginAlias": "@sanity/cli",
|
|
3580
|
+
"pluginName": "@sanity/cli",
|
|
3581
|
+
"pluginType": "core",
|
|
3582
|
+
"strict": true,
|
|
3583
|
+
"isESM": true,
|
|
3584
|
+
"relativePath": [
|
|
3585
|
+
"dist",
|
|
3586
|
+
"commands",
|
|
3587
|
+
"openapi",
|
|
3588
|
+
"get.js"
|
|
3589
|
+
]
|
|
3590
|
+
},
|
|
3591
|
+
"openapi:list": {
|
|
3592
|
+
"aliases": [],
|
|
3593
|
+
"args": {},
|
|
3594
|
+
"description": "List all available OpenAPI specifications",
|
|
3595
|
+
"examples": [
|
|
3596
|
+
{
|
|
3597
|
+
"command": "<%= config.bin %> <%= command.id %>",
|
|
3598
|
+
"description": "List all available OpenAPI specs"
|
|
3599
|
+
},
|
|
3600
|
+
{
|
|
3601
|
+
"command": "<%= config.bin %> <%= command.id %> --json",
|
|
3602
|
+
"description": "List with JSON output"
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
"command": "<%= config.bin %> <%= command.id %> --web",
|
|
3606
|
+
"description": "Open HTTP Reference in browser"
|
|
3607
|
+
}
|
|
3608
|
+
],
|
|
3609
|
+
"flags": {
|
|
3610
|
+
"json": {
|
|
3611
|
+
"description": "Output JSON",
|
|
3612
|
+
"name": "json",
|
|
3613
|
+
"allowNo": false,
|
|
3614
|
+
"type": "boolean"
|
|
3615
|
+
},
|
|
3616
|
+
"web": {
|
|
3617
|
+
"char": "w",
|
|
3618
|
+
"description": "Open HTTP Reference in web browser",
|
|
3619
|
+
"name": "web",
|
|
3620
|
+
"allowNo": false,
|
|
3621
|
+
"type": "boolean"
|
|
3622
|
+
}
|
|
3623
|
+
},
|
|
3624
|
+
"hasDynamicHelp": false,
|
|
3625
|
+
"hiddenAliases": [],
|
|
3626
|
+
"id": "openapi:list",
|
|
3627
|
+
"pluginAlias": "@sanity/cli",
|
|
3628
|
+
"pluginName": "@sanity/cli",
|
|
3629
|
+
"pluginType": "core",
|
|
3630
|
+
"strict": true,
|
|
3631
|
+
"isESM": true,
|
|
3632
|
+
"relativePath": [
|
|
3633
|
+
"dist",
|
|
3634
|
+
"commands",
|
|
3635
|
+
"openapi",
|
|
3636
|
+
"list.js"
|
|
3637
|
+
]
|
|
3638
|
+
},
|
|
3632
3639
|
"projects:create": {
|
|
3633
3640
|
"aliases": [],
|
|
3634
3641
|
"args": {
|
|
@@ -4165,6 +4172,32 @@
|
|
|
4165
4172
|
"validate.js"
|
|
4166
4173
|
]
|
|
4167
4174
|
},
|
|
4175
|
+
"skills:install": {
|
|
4176
|
+
"aliases": [],
|
|
4177
|
+
"args": {},
|
|
4178
|
+
"description": "Install Sanity agent skills for detected AI editors (Antigravity, Claude Code, Cline, Cline CLI, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, VS Code, VS Code Insiders)",
|
|
4179
|
+
"examples": [
|
|
4180
|
+
{
|
|
4181
|
+
"command": "<%= config.bin %> <%= command.id %>",
|
|
4182
|
+
"description": "Install Sanity agent skills for detected AI editors"
|
|
4183
|
+
}
|
|
4184
|
+
],
|
|
4185
|
+
"flags": {},
|
|
4186
|
+
"hasDynamicHelp": false,
|
|
4187
|
+
"hiddenAliases": [],
|
|
4188
|
+
"id": "skills:install",
|
|
4189
|
+
"pluginAlias": "@sanity/cli",
|
|
4190
|
+
"pluginName": "@sanity/cli",
|
|
4191
|
+
"pluginType": "core",
|
|
4192
|
+
"strict": true,
|
|
4193
|
+
"isESM": true,
|
|
4194
|
+
"relativePath": [
|
|
4195
|
+
"dist",
|
|
4196
|
+
"commands",
|
|
4197
|
+
"skills",
|
|
4198
|
+
"install.js"
|
|
4199
|
+
]
|
|
4200
|
+
},
|
|
4168
4201
|
"telemetry:disable": {
|
|
4169
4202
|
"aliases": [],
|
|
4170
4203
|
"args": {},
|
|
@@ -5116,5 +5149,5 @@
|
|
|
5116
5149
|
]
|
|
5117
5150
|
}
|
|
5118
5151
|
},
|
|
5119
|
-
"version": "7.
|
|
5152
|
+
"version": "7.4.0"
|
|
5120
5153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -45,30 +45,35 @@
|
|
|
45
45
|
"source": "./src/exports/_internal.ts",
|
|
46
46
|
"default": "./dist/exports/_internal.js"
|
|
47
47
|
},
|
|
48
|
+
"./runtime": {
|
|
49
|
+
"source": "./src/exports/runtime.ts",
|
|
50
|
+
"default": "./dist/exports/runtime.js"
|
|
51
|
+
},
|
|
48
52
|
"./package.json": "./package.json"
|
|
49
53
|
},
|
|
50
54
|
"publishConfig": {
|
|
51
55
|
"access": "public"
|
|
52
56
|
},
|
|
53
57
|
"dependencies": {
|
|
54
|
-
"@oclif/core": "^4.11.
|
|
55
|
-
"@oclif/plugin-help": "^6.2.
|
|
58
|
+
"@oclif/core": "^4.11.7",
|
|
59
|
+
"@oclif/plugin-help": "^6.2.52",
|
|
56
60
|
"@oclif/plugin-not-found": "^3.2.87",
|
|
57
|
-
"@sanity/client": "^7.
|
|
58
|
-
"@sanity/codegen": "^7.0.
|
|
61
|
+
"@sanity/client": "^7.23.0",
|
|
62
|
+
"@sanity/codegen": "^7.0.3",
|
|
59
63
|
"@sanity/descriptors": "^1.3.0",
|
|
60
64
|
"@sanity/export": "^6.2.0",
|
|
61
65
|
"@sanity/generate-help-url": "^4.0.0",
|
|
62
66
|
"@sanity/id-utils": "^1.0.0",
|
|
63
67
|
"@sanity/import": "^6.0.3",
|
|
64
|
-
"@sanity/migrate": "^7.0.
|
|
65
|
-
"@sanity/runtime-cli": "^
|
|
66
|
-
"@sanity/schema": "^6.
|
|
68
|
+
"@sanity/migrate": "^7.0.3",
|
|
69
|
+
"@sanity/runtime-cli": "^17.0.0",
|
|
70
|
+
"@sanity/schema": "^6.1.0",
|
|
67
71
|
"@sanity/telemetry": "^1.1.0",
|
|
68
72
|
"@sanity/template-validator": "^3.1.0",
|
|
69
|
-
"@sanity/types": "^6.
|
|
73
|
+
"@sanity/types": "^6.1.0",
|
|
70
74
|
"@sanity/worker-channels": "^2.0.0",
|
|
71
|
-
"@vercel/frameworks": "3.
|
|
75
|
+
"@vercel/frameworks": "3.29.0",
|
|
76
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
72
77
|
"chokidar": "^5.0.0",
|
|
73
78
|
"console-table-printer": "^2.15.0",
|
|
74
79
|
"date-fns": "^4.4.0",
|
|
@@ -110,48 +115,49 @@
|
|
|
110
115
|
"tinyglobby": "^0.2.17",
|
|
111
116
|
"tsx": "^4.22.4",
|
|
112
117
|
"typeid-js": "^1.2.0",
|
|
113
|
-
"vite": "^8.0
|
|
118
|
+
"vite": "^8.1.0",
|
|
114
119
|
"which": "^6.0.1",
|
|
115
120
|
"yaml": "^2.9.0",
|
|
116
121
|
"zod": "^4.4.3",
|
|
117
|
-
"@sanity/cli-build": "^1.
|
|
118
|
-
"@sanity/cli-core": "^2.
|
|
122
|
+
"@sanity/cli-build": "^1.1.1",
|
|
123
|
+
"@sanity/cli-core": "^2.1.1",
|
|
124
|
+
"@sanity/workbench-cli": "^1.1.0"
|
|
119
125
|
},
|
|
120
126
|
"devDependencies": {
|
|
121
127
|
"@eslint/compat": "^2.1.0",
|
|
122
|
-
"@sanity/pkg-utils": "^10.5.
|
|
128
|
+
"@sanity/pkg-utils": "^10.5.8",
|
|
123
129
|
"@sanity/ui": "^3.2.0",
|
|
124
130
|
"@swc/cli": "^0.8.1",
|
|
125
|
-
"@swc/core": "^1.15.
|
|
131
|
+
"@swc/core": "^1.15.41",
|
|
126
132
|
"@types/debug": "^4.1.13",
|
|
127
133
|
"@types/gunzip-maybe": "^1.4.3",
|
|
128
134
|
"@types/jsdom": "^28.0.3",
|
|
129
135
|
"@types/lodash-es": "^4.17.12",
|
|
130
136
|
"@types/minimist": "^1.2.5",
|
|
131
|
-
"@types/node": "^20.
|
|
137
|
+
"@types/node": "^22.20.0",
|
|
132
138
|
"@types/picomatch": "^4.0.3",
|
|
133
|
-
"@types/react": "^19.2.
|
|
139
|
+
"@types/react": "^19.2.17",
|
|
134
140
|
"@types/react-dom": "^19.2.3",
|
|
135
141
|
"@types/react-is": "^19.2.0",
|
|
136
142
|
"@types/semver": "^7.7.1",
|
|
137
143
|
"@types/tar-fs": "^2.0.4",
|
|
138
144
|
"@types/tar-stream": "^3.1.4",
|
|
139
145
|
"@types/which": "^3.0.4",
|
|
140
|
-
"@vitest/coverage-istanbul": "^4.1.
|
|
146
|
+
"@vitest/coverage-istanbul": "^4.1.9",
|
|
141
147
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
142
148
|
"es-module-lexer": "^2.1.0",
|
|
143
149
|
"eslint": "^10.4.1",
|
|
144
150
|
"jsdom": "^29.1.1",
|
|
145
151
|
"nock": "^14.0.15",
|
|
146
|
-
"oclif": "^4.23.
|
|
152
|
+
"oclif": "^4.23.16",
|
|
147
153
|
"publint": "^0.3.21",
|
|
148
154
|
"rimraf": "^6.0.1",
|
|
149
|
-
"sanity": "^6.
|
|
155
|
+
"sanity": "^6.1.0",
|
|
150
156
|
"typescript": "^5.9.3",
|
|
151
|
-
"vitest": "^4.1.
|
|
157
|
+
"vitest": "^4.1.9",
|
|
152
158
|
"@repo/package.config": "0.0.1",
|
|
153
159
|
"@repo/tsconfig": "3.70.0",
|
|
154
|
-
"@sanity/cli-test": "
|
|
160
|
+
"@sanity/cli-test": "2.0.1",
|
|
155
161
|
"@sanity/eslint-config-cli": "1.1.2"
|
|
156
162
|
},
|
|
157
163
|
"peerDependencies": {
|
|
@@ -163,7 +169,7 @@
|
|
|
163
169
|
}
|
|
164
170
|
},
|
|
165
171
|
"engines": {
|
|
166
|
-
"node": ">=
|
|
172
|
+
"node": ">=22.12"
|
|
167
173
|
},
|
|
168
174
|
"scripts": {
|
|
169
175
|
"build": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ src --ignore '**/*.test.ts' --ignore '**/__tests__/**'",
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { getLocalPackageVersion, readPackageJson } from '@sanity/cli-core';
|
|
3
|
-
import { oneline } from 'oneline';
|
|
4
|
-
import { minVersion, satisfies } from 'semver';
|
|
5
|
-
const defaultStudioManifestProps = {
|
|
6
|
-
name: 'studio',
|
|
7
|
-
version: '1.0.0'
|
|
8
|
-
};
|
|
9
|
-
const styledComponentsVersionRange = '^6.1.15';
|
|
10
|
-
/**
|
|
11
|
-
* Checks that the studio has declared and installed the required dependencies
|
|
12
|
-
* needed by the Sanity modules. While we generally use regular, explicit
|
|
13
|
-
* dependencies in modules, there are certain dependencies that are better
|
|
14
|
-
* served being peer dependencies, such as react and styled-components.
|
|
15
|
-
*
|
|
16
|
-
* If these dependencies are not installed/declared, we report an error
|
|
17
|
-
* and instruct the user to install them manually.
|
|
18
|
-
*
|
|
19
|
-
* Additionally, returns the version of the 'sanity' dependency from the package.json.
|
|
20
|
-
*/ export async function checkRequiredDependencies(options) {
|
|
21
|
-
const { isApp, output, workDir: studioPath } = options;
|
|
22
|
-
// currently there's no check needed for core apps,
|
|
23
|
-
// but this should be removed once they are more mature
|
|
24
|
-
if (isApp) {
|
|
25
|
-
return {
|
|
26
|
-
installedSanityVersion: ''
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const [studioPackageManifest, installedStyledComponentsVersion, installedSanityVersion] = await Promise.all([
|
|
30
|
-
readPackageJson(path.join(studioPath, 'package.json'), {
|
|
31
|
-
defaults: defaultStudioManifestProps,
|
|
32
|
-
skipSchemaValidation: true
|
|
33
|
-
}),
|
|
34
|
-
getLocalPackageVersion('styled-components', studioPath),
|
|
35
|
-
getLocalPackageVersion('sanity', studioPath)
|
|
36
|
-
]);
|
|
37
|
-
const wantedStyledComponentsVersionRange = styledComponentsVersionRange;
|
|
38
|
-
// Retrieve the version of the 'sanity' dependency
|
|
39
|
-
if (!installedSanityVersion) {
|
|
40
|
-
output.error('Failed to read the installed sanity version.', {
|
|
41
|
-
exit: 1
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
installedSanityVersion: ''
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
// The studio _must_ now declare `styled-components` as a dependency. If it's not there,
|
|
48
|
-
// we'll want to automatically _add it_ to the manifest and tell the user to reinstall
|
|
49
|
-
// dependencies before running whatever command was being run
|
|
50
|
-
const declaredStyledComponentsVersion = studioPackageManifest.dependencies?.['styled-components'] || studioPackageManifest?.devDependencies?.['styled-components'];
|
|
51
|
-
if (!declaredStyledComponentsVersion) {
|
|
52
|
-
output.error(oneline`
|
|
53
|
-
Declared dependency \`styled-components\` is not installed - run
|
|
54
|
-
\`npm install\`, \`yarn install\` or \`pnpm install\` to install it before re-running this command.
|
|
55
|
-
`, {
|
|
56
|
-
exit: 1
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
installedSanityVersion
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
// We ignore catalog identifiers since we check the actual version anyway
|
|
63
|
-
const isStyledComponentsVersionRangeInCatalog = declaredStyledComponentsVersion.startsWith('catalog:');
|
|
64
|
-
// Theoretically the version specified in package.json could be incorrect, eg `foo`
|
|
65
|
-
let minDeclaredStyledComponentsVersion = null;
|
|
66
|
-
try {
|
|
67
|
-
minDeclaredStyledComponentsVersion = minVersion(declaredStyledComponentsVersion);
|
|
68
|
-
} catch {
|
|
69
|
-
// Intentional fall-through (variable will be left as null, throwing below)
|
|
70
|
-
}
|
|
71
|
-
if (!minDeclaredStyledComponentsVersion && !isStyledComponentsVersionRangeInCatalog) {
|
|
72
|
-
output.error(oneline`
|
|
73
|
-
Declared dependency \`styled-components\` has an invalid version range:
|
|
74
|
-
\`${declaredStyledComponentsVersion}\`.
|
|
75
|
-
`, {
|
|
76
|
-
exit: 1
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
installedSanityVersion
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// The declared version should be semver-compatible with the version specified as a
|
|
83
|
-
// peer dependency in `sanity`. If not, we should tell the user to change it.
|
|
84
|
-
//
|
|
85
|
-
// Exception: Ranges are hard to compare. `>=5.0.0 && <=5.3.2 || ^6`... Comparing this
|
|
86
|
-
// to anything is going to be challenging, so only compare "simple" ranges/versions
|
|
87
|
-
// (^x.x.x / ~x.x.x / x.x.x)
|
|
88
|
-
if (!isStyledComponentsVersionRangeInCatalog && isComparableRange(declaredStyledComponentsVersion) && !satisfies(minDeclaredStyledComponentsVersion, wantedStyledComponentsVersionRange)) {
|
|
89
|
-
output.warn(oneline`
|
|
90
|
-
Declared version of styled-components (${declaredStyledComponentsVersion})
|
|
91
|
-
is not compatible with the version required by sanity (${wantedStyledComponentsVersionRange}).
|
|
92
|
-
This might cause problems!
|
|
93
|
-
`);
|
|
94
|
-
}
|
|
95
|
-
// Ensure the studio has _installed_ a version of `styled-components`
|
|
96
|
-
if (!installedStyledComponentsVersion) {
|
|
97
|
-
output.error(oneline`
|
|
98
|
-
Declared dependency \`styled-components\` is not installed - run
|
|
99
|
-
\`npm install\`, \`yarn install\` or \`pnpm install\` to install it before re-running this command.
|
|
100
|
-
`, {
|
|
101
|
-
exit: 1
|
|
102
|
-
});
|
|
103
|
-
return {
|
|
104
|
-
installedSanityVersion
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
// The studio should have an _installed_ version of `styled-components`, and it should
|
|
108
|
-
// be semver compatible with the version specified in `sanity` peer dependencies.
|
|
109
|
-
if (!satisfies(installedStyledComponentsVersion, wantedStyledComponentsVersionRange)) {
|
|
110
|
-
output.warn(oneline`
|
|
111
|
-
Installed version of styled-components (${installedStyledComponentsVersion})
|
|
112
|
-
is not compatible with the version required by sanity (${wantedStyledComponentsVersionRange}).
|
|
113
|
-
This might cause problems!
|
|
114
|
-
`);
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
installedSanityVersion
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function isComparableRange(range) {
|
|
121
|
-
return /^[\^~]?\d+(\.\d+)?(\.\d+)?$/.test(range);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
//# sourceMappingURL=checkRequiredDependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/checkRequiredDependencies.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {\n getLocalPackageVersion,\n type Output,\n type PackageJson,\n readPackageJson,\n} from '@sanity/cli-core'\nimport {oneline} from 'oneline'\nimport {minVersion, satisfies, type SemVer} from 'semver'\n\nconst defaultStudioManifestProps: Partial<PackageJson> = {\n name: 'studio',\n version: '1.0.0',\n}\n\ninterface CheckResult {\n installedSanityVersion: string\n}\n\ninterface CheckRequiredDependenciesOptions {\n isApp: boolean\n output: Output\n workDir: string\n}\n\nconst styledComponentsVersionRange = '^6.1.15'\n\n/**\n * Checks that the studio has declared and installed the required dependencies\n * needed by the Sanity modules. While we generally use regular, explicit\n * dependencies in modules, there are certain dependencies that are better\n * served being peer dependencies, such as react and styled-components.\n *\n * If these dependencies are not installed/declared, we report an error\n * and instruct the user to install them manually.\n *\n * Additionally, returns the version of the 'sanity' dependency from the package.json.\n */\nexport async function checkRequiredDependencies(\n options: CheckRequiredDependenciesOptions,\n): Promise<CheckResult> {\n const {isApp, output, workDir: studioPath} = options\n // currently there's no check needed for core apps,\n // but this should be removed once they are more mature\n if (isApp) {\n return {installedSanityVersion: ''}\n }\n\n const [studioPackageManifest, installedStyledComponentsVersion, installedSanityVersion] =\n await Promise.all([\n readPackageJson(path.join(studioPath, 'package.json'), {\n defaults: defaultStudioManifestProps,\n skipSchemaValidation: true,\n }),\n getLocalPackageVersion('styled-components', studioPath),\n getLocalPackageVersion('sanity', studioPath),\n ])\n\n const wantedStyledComponentsVersionRange = styledComponentsVersionRange\n\n // Retrieve the version of the 'sanity' dependency\n if (!installedSanityVersion) {\n output.error('Failed to read the installed sanity version.', {exit: 1})\n return {installedSanityVersion: ''}\n }\n\n // The studio _must_ now declare `styled-components` as a dependency. If it's not there,\n // we'll want to automatically _add it_ to the manifest and tell the user to reinstall\n // dependencies before running whatever command was being run\n const declaredStyledComponentsVersion =\n studioPackageManifest.dependencies?.['styled-components'] ||\n studioPackageManifest?.devDependencies?.['styled-components']\n\n if (!declaredStyledComponentsVersion) {\n output.error(\n oneline`\n Declared dependency \\`styled-components\\` is not installed - run\n \\`npm install\\`, \\`yarn install\\` or \\`pnpm install\\` to install it before re-running this command.\n `,\n {exit: 1},\n )\n return {installedSanityVersion}\n }\n\n // We ignore catalog identifiers since we check the actual version anyway\n const isStyledComponentsVersionRangeInCatalog =\n declaredStyledComponentsVersion.startsWith('catalog:')\n // Theoretically the version specified in package.json could be incorrect, eg `foo`\n let minDeclaredStyledComponentsVersion: SemVer | null = null\n try {\n minDeclaredStyledComponentsVersion = minVersion(declaredStyledComponentsVersion)\n } catch {\n // Intentional fall-through (variable will be left as null, throwing below)\n }\n\n if (!minDeclaredStyledComponentsVersion && !isStyledComponentsVersionRangeInCatalog) {\n output.error(\n oneline`\n Declared dependency \\`styled-components\\` has an invalid version range:\n \\`${declaredStyledComponentsVersion}\\`.\n `,\n {exit: 1},\n )\n return {installedSanityVersion}\n }\n\n // The declared version should be semver-compatible with the version specified as a\n // peer dependency in `sanity`. If not, we should tell the user to change it.\n //\n // Exception: Ranges are hard to compare. `>=5.0.0 && <=5.3.2 || ^6`... Comparing this\n // to anything is going to be challenging, so only compare \"simple\" ranges/versions\n // (^x.x.x / ~x.x.x / x.x.x)\n if (\n !isStyledComponentsVersionRangeInCatalog &&\n isComparableRange(declaredStyledComponentsVersion) &&\n !satisfies(minDeclaredStyledComponentsVersion!, wantedStyledComponentsVersionRange)\n ) {\n output.warn(oneline`\n Declared version of styled-components (${declaredStyledComponentsVersion})\n is not compatible with the version required by sanity (${wantedStyledComponentsVersionRange}).\n This might cause problems!\n `)\n }\n\n // Ensure the studio has _installed_ a version of `styled-components`\n if (!installedStyledComponentsVersion) {\n output.error(\n oneline`\n Declared dependency \\`styled-components\\` is not installed - run\n \\`npm install\\`, \\`yarn install\\` or \\`pnpm install\\` to install it before re-running this command.\n `,\n {exit: 1},\n )\n return {installedSanityVersion}\n }\n\n // The studio should have an _installed_ version of `styled-components`, and it should\n // be semver compatible with the version specified in `sanity` peer dependencies.\n if (!satisfies(installedStyledComponentsVersion, wantedStyledComponentsVersionRange)) {\n output.warn(oneline`\n Installed version of styled-components (${installedStyledComponentsVersion})\n is not compatible with the version required by sanity (${wantedStyledComponentsVersionRange}).\n This might cause problems!\n `)\n }\n\n return {installedSanityVersion}\n}\n\nfunction isComparableRange(range: string): boolean {\n return /^[\\^~]?\\d+(\\.\\d+)?(\\.\\d+)?$/.test(range)\n}\n"],"names":["path","getLocalPackageVersion","readPackageJson","oneline","minVersion","satisfies","defaultStudioManifestProps","name","version","styledComponentsVersionRange","checkRequiredDependencies","options","isApp","output","workDir","studioPath","installedSanityVersion","studioPackageManifest","installedStyledComponentsVersion","Promise","all","join","defaults","skipSchemaValidation","wantedStyledComponentsVersionRange","error","exit","declaredStyledComponentsVersion","dependencies","devDependencies","isStyledComponentsVersionRangeInCatalog","startsWith","minDeclaredStyledComponentsVersion","isComparableRange","warn","range","test"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SACEC,sBAAsB,EAGtBC,eAAe,QACV,mBAAkB;AACzB,SAAQC,OAAO,QAAO,UAAS;AAC/B,SAAQC,UAAU,EAAEC,SAAS,QAAoB,SAAQ;AAEzD,MAAMC,6BAAmD;IACvDC,MAAM;IACNC,SAAS;AACX;AAYA,MAAMC,+BAA+B;AAErC;;;;;;;;;;CAUC,GACD,OAAO,eAAeC,0BACpBC,OAAyC;IAEzC,MAAM,EAACC,KAAK,EAAEC,MAAM,EAAEC,SAASC,UAAU,EAAC,GAAGJ;IAC7C,mDAAmD;IACnD,uDAAuD;IACvD,IAAIC,OAAO;QACT,OAAO;YAACI,wBAAwB;QAAE;IACpC;IAEA,MAAM,CAACC,uBAAuBC,kCAAkCF,uBAAuB,GACrF,MAAMG,QAAQC,GAAG,CAAC;QAChBlB,gBAAgBF,KAAKqB,IAAI,CAACN,YAAY,iBAAiB;YACrDO,UAAUhB;YACViB,sBAAsB;QACxB;QACAtB,uBAAuB,qBAAqBc;QAC5Cd,uBAAuB,UAAUc;KAClC;IAEH,MAAMS,qCAAqCf;IAE3C,kDAAkD;IAClD,IAAI,CAACO,wBAAwB;QAC3BH,OAAOY,KAAK,CAAC,gDAAgD;YAACC,MAAM;QAAC;QACrE,OAAO;YAACV,wBAAwB;QAAE;IACpC;IAEA,wFAAwF;IACxF,sFAAsF;IACtF,6DAA6D;IAC7D,MAAMW,kCACJV,sBAAsBW,YAAY,EAAE,CAAC,oBAAoB,IACzDX,uBAAuBY,iBAAiB,CAAC,oBAAoB;IAE/D,IAAI,CAACF,iCAAiC;QACpCd,OAAOY,KAAK,CACVtB,OAAO,CAAC;;;IAGV,CAAC,EACC;YAACuB,MAAM;QAAC;QAEV,OAAO;YAACV;QAAsB;IAChC;IAEA,yEAAyE;IACzE,MAAMc,0CACJH,gCAAgCI,UAAU,CAAC;IAC7C,mFAAmF;IACnF,IAAIC,qCAAoD;IACxD,IAAI;QACFA,qCAAqC5B,WAAWuB;IAClD,EAAE,OAAM;IACN,2EAA2E;IAC7E;IAEA,IAAI,CAACK,sCAAsC,CAACF,yCAAyC;QACnFjB,OAAOY,KAAK,CACVtB,OAAO,CAAC;;QAEN,EAAEwB,gCAAgC;IACtC,CAAC,EACC;YAACD,MAAM;QAAC;QAEV,OAAO;YAACV;QAAsB;IAChC;IAEA,mFAAmF;IACnF,6EAA6E;IAC7E,EAAE;IACF,sFAAsF;IACtF,mFAAmF;IACnF,4BAA4B;IAC5B,IACE,CAACc,2CACDG,kBAAkBN,oCAClB,CAACtB,UAAU2B,oCAAqCR,qCAChD;QACAX,OAAOqB,IAAI,CAAC/B,OAAO,CAAC;6CACqB,EAAEwB,gCAAgC;6DAClB,EAAEH,mCAAmC;;IAE9F,CAAC;IACH;IAEA,qEAAqE;IACrE,IAAI,CAACN,kCAAkC;QACrCL,OAAOY,KAAK,CACVtB,OAAO,CAAC;;;IAGV,CAAC,EACC;YAACuB,MAAM;QAAC;QAEV,OAAO;YAACV;QAAsB;IAChC;IAEA,sFAAsF;IACtF,iFAAiF;IACjF,IAAI,CAACX,UAAUa,kCAAkCM,qCAAqC;QACpFX,OAAOqB,IAAI,CAAC/B,OAAO,CAAC;8CACsB,EAAEe,iCAAiC;6DACpB,EAAEM,mCAAmC;;IAE9F,CAAC;IACH;IAEA,OAAO;QAACR;IAAsB;AAChC;AAEA,SAASiB,kBAAkBE,KAAa;IACtC,OAAO,8BAA8BC,IAAI,CAACD;AAC5C"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const MODULES_HOST = process.env.SANITY_MODULES_HOST || (process.env.SANITY_INTERNAL_ENV === 'staging' ? 'https://sanity-cdn.work' : 'https://sanity-cdn.com');
|
|
2
|
-
function currentUnixTime() {
|
|
3
|
-
return Math.floor(Date.now() / 1000);
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/ export function getAutoUpdatesImportMap(packages, options = {}) {
|
|
8
|
-
return Object.fromEntries(packages.flatMap((pkg)=>getAppAutoUpdateImportMapForPackage(pkg, options)));
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/ function getAppAutoUpdateImportMapForPackage(pkg, options = {}) {
|
|
13
|
-
const moduleUrl = getModuleUrl(pkg, options);
|
|
14
|
-
return [
|
|
15
|
-
[
|
|
16
|
-
pkg.name,
|
|
17
|
-
moduleUrl
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
`${pkg.name}/`,
|
|
21
|
-
`${moduleUrl}/`
|
|
22
|
-
]
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @internal
|
|
27
|
-
*/ export function getModuleUrl(pkg, options = {}) {
|
|
28
|
-
const { timestamp = currentUnixTime() } = options;
|
|
29
|
-
return options.appId ? getByAppModuleUrl(pkg, {
|
|
30
|
-
appId: options.appId,
|
|
31
|
-
baseUrl: options.baseUrl,
|
|
32
|
-
timestamp
|
|
33
|
-
}) : getLegacyModuleUrl(pkg, {
|
|
34
|
-
baseUrl: options.baseUrl,
|
|
35
|
-
timestamp
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function getLegacyModuleUrl(pkg, options) {
|
|
39
|
-
const encodedMinVer = encodeURIComponent(`^${pkg.version}`);
|
|
40
|
-
return `${options.baseUrl || MODULES_HOST}/v1/modules/${rewriteScopedPackage(pkg.name)}/default/${encodedMinVer}/t${options.timestamp}`;
|
|
41
|
-
}
|
|
42
|
-
function getByAppModuleUrl(pkg, options) {
|
|
43
|
-
const encodedMinVer = encodeURIComponent(`^${pkg.version}`);
|
|
44
|
-
return `${options.baseUrl || MODULES_HOST}/v1/modules/by-app/${options.appId}/t${options.timestamp}/${encodedMinVer}/${rewriteScopedPackage(pkg.name)}`;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* replaces '/' with '__' similar to how eg `@types/scope__pkg` are rewritten
|
|
48
|
-
* scoped packages are stored this way both in the manifest and in the cloud storage bucket
|
|
49
|
-
*/ function rewriteScopedPackage(pkgName) {
|
|
50
|
-
if (!pkgName.includes('@')) {
|
|
51
|
-
return pkgName;
|
|
52
|
-
}
|
|
53
|
-
const [scope, ...pkg] = pkgName.split('/');
|
|
54
|
-
return `${scope}__${pkg.join('')}`;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Generate CDN CSS URLs for auto-updated packages.
|
|
58
|
-
* Uses the same URL pattern as JS module URLs so the module server
|
|
59
|
-
* resolves CSS and JS to the same version.
|
|
60
|
-
*
|
|
61
|
-
* @internal
|
|
62
|
-
*/ export function getAutoUpdatesCssUrls(packages, options = {}) {
|
|
63
|
-
return packages.filter((pkg)=>Boolean(pkg.cssFile)).map((pkg)=>`${getModuleUrl(pkg, options)}/${pkg.cssFile}`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=getAutoUpdatesImportMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/getAutoUpdatesImportMap.ts"],"sourcesContent":["const MODULES_HOST =\n process.env.SANITY_MODULES_HOST ||\n (process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://sanity-cdn.work'\n : 'https://sanity-cdn.com')\n\nfunction currentUnixTime(): number {\n return Math.floor(Date.now() / 1000)\n}\n\ntype Package = {name: string; version: string}\n/**\n * @internal\n */\nexport function getAutoUpdatesImportMap<const Pkg extends Package>(\n packages: Pkg[],\n options: {appId?: string; baseUrl?: string; timestamp?: number} = {},\n) {\n return Object.fromEntries(\n packages.flatMap((pkg) => getAppAutoUpdateImportMapForPackage(pkg, options)),\n ) as {[K in `${Pkg['name']}/` | Pkg['name']]: string}\n}\n\n/**\n * @internal\n */\nfunction getAppAutoUpdateImportMapForPackage<const Pkg extends Package>(\n pkg: Pkg,\n options: {appId?: string; baseUrl?: string; timestamp?: number} = {},\n): [[Pkg['name'], string], [`${Pkg['name']}/`, string]] {\n const moduleUrl = getModuleUrl(pkg, options)\n\n return [\n [pkg.name, moduleUrl],\n [`${pkg.name}/`, `${moduleUrl}/`],\n ]\n}\n\n/**\n * @internal\n */\nexport function getModuleUrl(\n pkg: Package,\n options: {appId?: string; baseUrl?: string; timestamp?: number} = {},\n) {\n const {timestamp = currentUnixTime()} = options\n return options.appId\n ? getByAppModuleUrl(pkg, {appId: options.appId, baseUrl: options.baseUrl, timestamp})\n : getLegacyModuleUrl(pkg, {baseUrl: options.baseUrl, timestamp})\n}\n\nfunction getLegacyModuleUrl(pkg: Package, options: {baseUrl?: string; timestamp: number}) {\n const encodedMinVer = encodeURIComponent(`^${pkg.version}`)\n return `${options.baseUrl || MODULES_HOST}/v1/modules/${rewriteScopedPackage(pkg.name)}/default/${encodedMinVer}/t${options.timestamp}`\n}\n\nfunction getByAppModuleUrl(\n pkg: Package,\n options: {appId: string; baseUrl?: string; timestamp: number},\n) {\n const encodedMinVer = encodeURIComponent(`^${pkg.version}`)\n return `${options.baseUrl || MODULES_HOST}/v1/modules/by-app/${options.appId}/t${options.timestamp}/${encodedMinVer}/${rewriteScopedPackage(pkg.name)}`\n}\n\n/**\n * replaces '/' with '__' similar to how eg `@types/scope__pkg` are rewritten\n * scoped packages are stored this way both in the manifest and in the cloud storage bucket\n */\nfunction rewriteScopedPackage(pkgName: string) {\n if (!pkgName.includes('@')) {\n return pkgName\n }\n const [scope, ...pkg] = pkgName.split('/')\n return `${scope}__${pkg.join('')}`\n}\n\ntype PackageWithCss = Package & {cssFile?: string}\n\n/**\n * Generate CDN CSS URLs for auto-updated packages.\n * Uses the same URL pattern as JS module URLs so the module server\n * resolves CSS and JS to the same version.\n *\n * @internal\n */\nexport function getAutoUpdatesCssUrls<const Pkg extends PackageWithCss>(\n packages: Pkg[],\n options: {appId?: string; baseUrl?: string; timestamp?: number} = {},\n): string[] {\n return packages\n .filter((pkg) => Boolean(pkg.cssFile))\n .map((pkg) => `${getModuleUrl(pkg, options)}/${pkg.cssFile}`)\n}\n"],"names":["MODULES_HOST","process","env","SANITY_MODULES_HOST","SANITY_INTERNAL_ENV","currentUnixTime","Math","floor","Date","now","getAutoUpdatesImportMap","packages","options","Object","fromEntries","flatMap","pkg","getAppAutoUpdateImportMapForPackage","moduleUrl","getModuleUrl","name","timestamp","appId","getByAppModuleUrl","baseUrl","getLegacyModuleUrl","encodedMinVer","encodeURIComponent","version","rewriteScopedPackage","pkgName","includes","scope","split","join","getAutoUpdatesCssUrls","filter","Boolean","cssFile","map"],"mappings":"AAAA,MAAMA,eACJC,QAAQC,GAAG,CAACC,mBAAmB,IAC9BF,CAAAA,QAAQC,GAAG,CAACE,mBAAmB,KAAK,YACjC,4BACA,wBAAuB;AAE7B,SAASC;IACP,OAAOC,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK;AACjC;AAGA;;CAEC,GACD,OAAO,SAASC,wBACdC,QAAe,EACfC,UAAkE,CAAC,CAAC;IAEpE,OAAOC,OAAOC,WAAW,CACvBH,SAASI,OAAO,CAAC,CAACC,MAAQC,oCAAoCD,KAAKJ;AAEvE;AAEA;;CAEC,GACD,SAASK,oCACPD,GAAQ,EACRJ,UAAkE,CAAC,CAAC;IAEpE,MAAMM,YAAYC,aAAaH,KAAKJ;IAEpC,OAAO;QACL;YAACI,IAAII,IAAI;YAAEF;SAAU;QACrB;YAAC,GAAGF,IAAII,IAAI,CAAC,CAAC,CAAC;YAAE,GAAGF,UAAU,CAAC,CAAC;SAAC;KAClC;AACH;AAEA;;CAEC,GACD,OAAO,SAASC,aACdH,GAAY,EACZJ,UAAkE,CAAC,CAAC;IAEpE,MAAM,EAACS,YAAYhB,iBAAiB,EAAC,GAAGO;IACxC,OAAOA,QAAQU,KAAK,GAChBC,kBAAkBP,KAAK;QAACM,OAAOV,QAAQU,KAAK;QAAEE,SAASZ,QAAQY,OAAO;QAAEH;IAAS,KACjFI,mBAAmBT,KAAK;QAACQ,SAASZ,QAAQY,OAAO;QAAEH;IAAS;AAClE;AAEA,SAASI,mBAAmBT,GAAY,EAAEJ,OAA8C;IACtF,MAAMc,gBAAgBC,mBAAmB,CAAC,CAAC,EAAEX,IAAIY,OAAO,EAAE;IAC1D,OAAO,GAAGhB,QAAQY,OAAO,IAAIxB,aAAa,YAAY,EAAE6B,qBAAqBb,IAAII,IAAI,EAAE,SAAS,EAAEM,cAAc,EAAE,EAAEd,QAAQS,SAAS,EAAE;AACzI;AAEA,SAASE,kBACPP,GAAY,EACZJ,OAA6D;IAE7D,MAAMc,gBAAgBC,mBAAmB,CAAC,CAAC,EAAEX,IAAIY,OAAO,EAAE;IAC1D,OAAO,GAAGhB,QAAQY,OAAO,IAAIxB,aAAa,mBAAmB,EAAEY,QAAQU,KAAK,CAAC,EAAE,EAAEV,QAAQS,SAAS,CAAC,CAAC,EAAEK,cAAc,CAAC,EAAEG,qBAAqBb,IAAII,IAAI,GAAG;AACzJ;AAEA;;;CAGC,GACD,SAASS,qBAAqBC,OAAe;IAC3C,IAAI,CAACA,QAAQC,QAAQ,CAAC,MAAM;QAC1B,OAAOD;IACT;IACA,MAAM,CAACE,OAAO,GAAGhB,IAAI,GAAGc,QAAQG,KAAK,CAAC;IACtC,OAAO,GAAGD,MAAM,EAAE,EAAEhB,IAAIkB,IAAI,CAAC,KAAK;AACpC;AAIA;;;;;;CAMC,GACD,OAAO,SAASC,sBACdxB,QAAe,EACfC,UAAkE,CAAC,CAAC;IAEpE,OAAOD,SACJyB,MAAM,CAAC,CAACpB,MAAQqB,QAAQrB,IAAIsB,OAAO,GACnCC,GAAG,CAAC,CAACvB,MAAQ,GAAGG,aAAaH,KAAKJ,SAAS,CAAC,EAAEI,IAAIsB,OAAO,EAAE;AAChE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/dev/getDashboardAppUrl.ts"],"sourcesContent":["import {getSanityUrl, subdebug} from '@sanity/cli-core'\n\nconst debug = subdebug('dev:getDashboardAppURL')\n\nconst DEFAULT_TIMEOUT = 5000\n\nconst getDefaultDashboardURL = ({\n organizationId,\n url,\n}: {\n organizationId: string\n url: string\n}): string => {\n return getSanityUrl(\n `/@${organizationId}?${new URLSearchParams({\n dev: url,\n }).toString()}`,\n )\n}\n\n/**\n * Gets the dashboard URL from API or uses the default dashboard URL\n */\nexport const getDashboardAppURL = async ({\n httpHost = 'localhost',\n httpPort = 3333,\n organizationId,\n}: {\n httpHost?: string\n httpPort?: number\n organizationId: string\n}): Promise<string> => {\n const url = `http://${httpHost}:${httpPort}`\n\n const abortController = new AbortController()\n // Wait for 5 seconds before aborting the request\n const timer = setTimeout(() => abortController.abort(), DEFAULT_TIMEOUT)\n try {\n const queryParams = new URLSearchParams({\n organizationId,\n url,\n })\n\n const res = await globalThis.fetch(\n getSanityUrl(`/api/dashboard/mode/development/resolve-url?${queryParams.toString()}`),\n {\n signal: abortController.signal,\n },\n )\n\n if (!res.ok) {\n debug(`Failed to fetch dashboard URL: ${res.statusText}`)\n return getDefaultDashboardURL({organizationId, url})\n }\n\n const body = await res.json()\n // <dashboard-app-url>/<orgniazationId>?dev=<dev-server-url>\n return body?.url ?? getDefaultDashboardURL({organizationId, url})\n } catch (err) {\n debug(`Failed to fetch dashboard URL: ${err instanceof Error ? err.message : String(err)}`)\n return getDefaultDashboardURL({organizationId, url})\n } finally {\n clearTimeout(timer)\n }\n}\n"],"names":["getSanityUrl","subdebug","debug","DEFAULT_TIMEOUT","getDefaultDashboardURL","organizationId","url","URLSearchParams","dev","toString","getDashboardAppURL","httpHost","httpPort","abortController","AbortController","timer","setTimeout","abort","queryParams","res","globalThis","fetch","signal","ok","statusText","body","json","err","Error","message","String","clearTimeout"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,QAAQ,QAAO,mBAAkB;AAEvD,MAAMC,QAAQD,SAAS;AAEvB,MAAME,kBAAkB;AAExB,MAAMC,yBAAyB,CAAC,EAC9BC,cAAc,EACdC,GAAG,EAIJ;IACC,OAAON,aACL,CAAC,EAAE,EAAEK,eAAe,CAAC,EAAE,IAAIE,gBAAgB;QACzCC,KAAKF;IACP,GAAGG,QAAQ,IAAI;AAEnB;AAEA;;CAEC,GACD,OAAO,MAAMC,qBAAqB,OAAO,EACvCC,WAAW,WAAW,EACtBC,WAAW,IAAI,EACfP,cAAc,EAKf;IACC,MAAMC,MAAM,CAAC,OAAO,EAAEK,SAAS,CAAC,EAAEC,UAAU;IAE5C,MAAMC,kBAAkB,IAAIC;IAC5B,iDAAiD;IACjD,MAAMC,QAAQC,WAAW,IAAMH,gBAAgBI,KAAK,IAAId;IACxD,IAAI;QACF,MAAMe,cAAc,IAAIX,gBAAgB;YACtCF;YACAC;QACF;QAEA,MAAMa,MAAM,MAAMC,WAAWC,KAAK,CAChCrB,aAAa,CAAC,4CAA4C,EAAEkB,YAAYT,QAAQ,IAAI,GACpF;YACEa,QAAQT,gBAAgBS,MAAM;QAChC;QAGF,IAAI,CAACH,IAAII,EAAE,EAAE;YACXrB,MAAM,CAAC,+BAA+B,EAAEiB,IAAIK,UAAU,EAAE;YACxD,OAAOpB,uBAAuB;gBAACC;gBAAgBC;YAAG;QACpD;QAEA,MAAMmB,OAAO,MAAMN,IAAIO,IAAI;QAC3B,4DAA4D;QAC5D,OAAOD,MAAMnB,OAAOF,uBAAuB;YAACC;YAAgBC;QAAG;IACjE,EAAE,OAAOqB,KAAK;QACZzB,MAAM,CAAC,+BAA+B,EAAEyB,eAAeC,QAAQD,IAAIE,OAAO,GAAGC,OAAOH,MAAM;QAC1F,OAAOvB,uBAAuB;YAACC;YAAgBC;QAAG;IACpD,SAAU;QACRyB,aAAahB;IACf;AACF,EAAC"}
|