@sanity/cli-core 1.3.2 → 1.3.3

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.
@@ -593,6 +593,15 @@ export declare function getTimer(): TimeMeasurer;
593
593
  */
594
594
  export declare function getUserConfig(): ConfigStore;
595
595
 
596
+ /**
597
+ * @internal
598
+ */
599
+ export declare function getWorkspace<
600
+ T extends {
601
+ name: string;
602
+ },
603
+ >(workspaces: T[], workspaceName?: string): T;
604
+
596
605
  /**
597
606
  * @public
598
607
  */
@@ -26,6 +26,7 @@ export * from '../util/environment/mockBrowserEnvironment.js';
26
26
  export * from '../util/getLocalPackageVersion.js';
27
27
  export * from '../util/getSanityEnvVar.js';
28
28
  export * from '../util/getSanityUrl.js';
29
+ export * from '../util/getWorkspace.js';
29
30
  export * from '../util/importModule.js';
30
31
  export * from '../util/isCi.js';
31
32
  export * from '../util/isInteractive.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export * from '../config/cli/getCliConfig.js'\nexport * from '../config/cli/getCliConfigSync.js'\nexport {type CliConfig} from '../config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from '../config/cli/types/userViteConfig.js'\nexport * from '../config/findProjectRoot.js'\nexport * from '../config/findProjectRootSync.js'\nexport * from '../config/studio/getStudioConfig.js'\nexport * from '../config/studio/getStudioWorkspaces.js'\nexport * from '../config/studio/isStudioConfig.js'\nexport * from '../config/util/findConfigsPaths.js'\nexport * from '../config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from '../config/util/recursivelyResolveProjectRoot.js'\nexport * from '../debug.js'\nexport * from '../errors/NonInteractiveError.js'\nexport * from '../errors/NotFoundError.js'\nexport * from '../errors/ProjectRootNotFoundError.js'\nexport * from '../exitCodes.js'\nexport * from '../loaders/studio/studioWorkerTask.js'\nexport * from '../loaders/tsx/tsxWorkerTask.js'\nexport * from '../SanityCommand.js'\nexport * from '../services/apiClient.js'\nexport * from '../services/cliUserConfig.js'\nexport * from '../services/getCliToken.js'\nexport {\n clearCliTelemetry,\n CLI_TELEMETRY_SYMBOL,\n getCliTelemetry,\n setCliTelemetry,\n} from '../telemetry/getCliTelemetry.js'\nexport {getTelemetryBaseInfo} from '../telemetry/getTelemetryBaseInfo.js'\nexport {noopLogger} from '../telemetry/noopTelemetry.js'\nexport {\n type CLITelemetryStore,\n type ConsentInformation,\n type TelemetryUserProperties,\n} from '../telemetry/types.js'\nexport {type Output, type SanityOrgUser} from '../types.js'\nexport {doImport} from '../util/doImport.js'\nexport * from '../util/environment/mockBrowserEnvironment.js'\nexport * from '../util/getLocalPackageVersion.js'\nexport * from '../util/getSanityEnvVar.js'\nexport * from '../util/getSanityUrl.js'\nexport * from '../util/importModule.js'\nexport * from '../util/isCi.js'\nexport * from '../util/isInteractive.js'\nexport * from '../util/isStaging.js'\nexport * from '../util/normalizePath.js'\nexport * from '../util/promisifyWorker.js'\nexport * from '../util/readPackageJson.js'\nexport * from '../util/resolveLocalPackage.js'\nexport * from '../util/safeStructuredClone.js'\nexport * from '../ux/colorizeJson.js'\nexport * from '../ux/timer.js'\n"],"names":["clearCliTelemetry","CLI_TELEMETRY_SYMBOL","getCliTelemetry","setCliTelemetry","getTelemetryBaseInfo","noopLogger","doImport"],"mappings":"AAAA,cAAc,gCAA+B;AAC7C,cAAc,oCAAmC;AAGjD,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,cAAc,sCAAqC;AACnD,cAAc,0CAAyC;AACvD,cAAc,qCAAoC;AAClD,cAAc,qCAAoC;AAClD,cAAc,yCAAwC;AAEtD,cAAc,cAAa;AAC3B,cAAc,mCAAkC;AAChD,cAAc,6BAA4B;AAC1C,cAAc,wCAAuC;AACrD,cAAc,kBAAiB;AAC/B,cAAc,wCAAuC;AACrD,cAAc,kCAAiC;AAC/C,cAAc,sBAAqB;AACnC,cAAc,2BAA0B;AACxC,cAAc,+BAA8B;AAC5C,cAAc,6BAA4B;AAC1C,SACEA,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,eAAe,QACV,kCAAiC;AACxC,SAAQC,oBAAoB,QAAO,uCAAsC;AACzE,SAAQC,UAAU,QAAO,gCAA+B;AAOxD,SAAQC,QAAQ,QAAO,sBAAqB;AAC5C,cAAc,gDAA+C;AAC7D,cAAc,oCAAmC;AACjD,cAAc,6BAA4B;AAC1C,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AACvC,cAAc,kBAAiB;AAC/B,cAAc,2BAA0B;AACxC,cAAc,uBAAsB;AACpC,cAAc,2BAA0B;AACxC,cAAc,6BAA4B;AAC1C,cAAc,6BAA4B;AAC1C,cAAc,iCAAgC;AAC9C,cAAc,iCAAgC;AAC9C,cAAc,wBAAuB;AACrC,cAAc,iBAAgB"}
1
+ {"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export * from '../config/cli/getCliConfig.js'\nexport * from '../config/cli/getCliConfigSync.js'\nexport {type CliConfig} from '../config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from '../config/cli/types/userViteConfig.js'\nexport * from '../config/findProjectRoot.js'\nexport * from '../config/findProjectRootSync.js'\nexport * from '../config/studio/getStudioConfig.js'\nexport * from '../config/studio/getStudioWorkspaces.js'\nexport * from '../config/studio/isStudioConfig.js'\nexport * from '../config/util/findConfigsPaths.js'\nexport * from '../config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from '../config/util/recursivelyResolveProjectRoot.js'\nexport * from '../debug.js'\nexport * from '../errors/NonInteractiveError.js'\nexport * from '../errors/NotFoundError.js'\nexport * from '../errors/ProjectRootNotFoundError.js'\nexport * from '../exitCodes.js'\nexport * from '../loaders/studio/studioWorkerTask.js'\nexport * from '../loaders/tsx/tsxWorkerTask.js'\nexport * from '../SanityCommand.js'\nexport * from '../services/apiClient.js'\nexport * from '../services/cliUserConfig.js'\nexport * from '../services/getCliToken.js'\nexport {\n clearCliTelemetry,\n CLI_TELEMETRY_SYMBOL,\n getCliTelemetry,\n setCliTelemetry,\n} from '../telemetry/getCliTelemetry.js'\nexport {getTelemetryBaseInfo} from '../telemetry/getTelemetryBaseInfo.js'\nexport {noopLogger} from '../telemetry/noopTelemetry.js'\nexport {\n type CLITelemetryStore,\n type ConsentInformation,\n type TelemetryUserProperties,\n} from '../telemetry/types.js'\nexport {type Output, type SanityOrgUser} from '../types.js'\nexport {doImport} from '../util/doImport.js'\nexport * from '../util/environment/mockBrowserEnvironment.js'\nexport * from '../util/getLocalPackageVersion.js'\nexport * from '../util/getSanityEnvVar.js'\nexport * from '../util/getSanityUrl.js'\nexport * from '../util/getWorkspace.js'\nexport * from '../util/importModule.js'\nexport * from '../util/isCi.js'\nexport * from '../util/isInteractive.js'\nexport * from '../util/isStaging.js'\nexport * from '../util/normalizePath.js'\nexport * from '../util/promisifyWorker.js'\nexport * from '../util/readPackageJson.js'\nexport * from '../util/resolveLocalPackage.js'\nexport * from '../util/safeStructuredClone.js'\nexport * from '../ux/colorizeJson.js'\nexport * from '../ux/timer.js'\n"],"names":["clearCliTelemetry","CLI_TELEMETRY_SYMBOL","getCliTelemetry","setCliTelemetry","getTelemetryBaseInfo","noopLogger","doImport"],"mappings":"AAAA,cAAc,gCAA+B;AAC7C,cAAc,oCAAmC;AAGjD,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,cAAc,sCAAqC;AACnD,cAAc,0CAAyC;AACvD,cAAc,qCAAoC;AAClD,cAAc,qCAAoC;AAClD,cAAc,yCAAwC;AAEtD,cAAc,cAAa;AAC3B,cAAc,mCAAkC;AAChD,cAAc,6BAA4B;AAC1C,cAAc,wCAAuC;AACrD,cAAc,kBAAiB;AAC/B,cAAc,wCAAuC;AACrD,cAAc,kCAAiC;AAC/C,cAAc,sBAAqB;AACnC,cAAc,2BAA0B;AACxC,cAAc,+BAA8B;AAC5C,cAAc,6BAA4B;AAC1C,SACEA,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,eAAe,QACV,kCAAiC;AACxC,SAAQC,oBAAoB,QAAO,uCAAsC;AACzE,SAAQC,UAAU,QAAO,gCAA+B;AAOxD,SAAQC,QAAQ,QAAO,sBAAqB;AAC5C,cAAc,gDAA+C;AAC7D,cAAc,oCAAmC;AACjD,cAAc,6BAA4B;AAC1C,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AACvC,cAAc,kBAAiB;AAC/B,cAAc,2BAA0B;AACxC,cAAc,uBAAsB;AACpC,cAAc,2BAA0B;AACxC,cAAc,6BAA4B;AAC1C,cAAc,6BAA4B;AAC1C,cAAc,iCAAgC;AAC9C,cAAc,iCAAgC;AAC9C,cAAc,wBAAuB;AACrC,cAAc,iBAAgB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @internal
3
+ */ export function getWorkspace(workspaces, workspaceName) {
4
+ if (workspaces.length === 0) {
5
+ throw new Error('No workspaces found');
6
+ }
7
+ if (workspaces.length === 1) {
8
+ return workspaces[0];
9
+ }
10
+ if (!workspaceName) {
11
+ throw new Error(`Multiple workspaces found. Please specify which workspace to use with '--workspace' or with the schemaExtraction.workspace config prop. Available workspaces: ${workspaces.map((w)=>w.name).join(', ')}`);
12
+ }
13
+ const workspace = workspaces.find((w)=>w.name === workspaceName);
14
+ if (!workspace) {
15
+ throw new Error(`Could not find "${workspaceName}" workspace. Available workspaces: ${workspaces.map((w)=>w.name).join(', ')}`);
16
+ }
17
+ return workspace;
18
+ }
19
+
20
+ //# sourceMappingURL=getWorkspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/getWorkspace.ts"],"sourcesContent":["/**\n * @internal\n */\nexport function getWorkspace<T extends {name: string}>(workspaces: T[], workspaceName?: string) {\n if (workspaces.length === 0) {\n throw new Error('No workspaces found')\n }\n\n if (workspaces.length === 1) {\n return workspaces[0]\n }\n\n if (!workspaceName) {\n throw new Error(\n `Multiple workspaces found. Please specify which workspace to use with '--workspace' or with the schemaExtraction.workspace config prop. Available workspaces: ${workspaces.map((w) => w.name).join(', ')}`,\n )\n }\n\n const workspace = workspaces.find((w) => w.name === workspaceName)\n\n if (!workspace) {\n throw new Error(\n `Could not find \"${workspaceName}\" workspace. Available workspaces: ${workspaces.map((w) => w.name).join(', ')}`,\n )\n }\n\n return workspace\n}\n"],"names":["getWorkspace","workspaces","workspaceName","length","Error","map","w","name","join","workspace","find"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,aAAuCC,UAAe,EAAEC,aAAsB;IAC5F,IAAID,WAAWE,MAAM,KAAK,GAAG;QAC3B,MAAM,IAAIC,MAAM;IAClB;IAEA,IAAIH,WAAWE,MAAM,KAAK,GAAG;QAC3B,OAAOF,UAAU,CAAC,EAAE;IACtB;IAEA,IAAI,CAACC,eAAe;QAClB,MAAM,IAAIE,MACR,CAAC,8JAA8J,EAAEH,WAAWI,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,EAAEC,IAAI,CAAC,OAAO;IAE/M;IAEA,MAAMC,YAAYR,WAAWS,IAAI,CAAC,CAACJ,IAAMA,EAAEC,IAAI,KAAKL;IAEpD,IAAI,CAACO,WAAW;QACd,MAAM,IAAIL,MACR,CAAC,gBAAgB,EAAEF,cAAc,mCAAmC,EAAED,WAAWI,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,EAAEC,IAAI,CAAC,OAAO;IAEpH;IAEA,OAAOC;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-core",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Sanity CLI core package",
5
5
  "keywords": [
6
6
  "cli",
@@ -52,23 +52,23 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@inquirer/prompts": "^8.3.0",
55
- "@oclif/core": "^4.10.6",
55
+ "@oclif/core": "^4.11.0",
56
56
  "@sanity/client": "^7.22.0",
57
57
  "babel-plugin-react-compiler": "^1.0.0",
58
58
  "boxen": "^8.0.1",
59
59
  "debug": "^4.4.3",
60
60
  "get-it": "^8.7.0",
61
- "get-tsconfig": "^4.13.7",
61
+ "get-tsconfig": "^4.14.0",
62
62
  "import-meta-resolve": "^4.2.0",
63
63
  "jiti": "^2.7.0",
64
- "jsdom": "^29.0.2",
64
+ "jsdom": "^29.1.1",
65
65
  "json-lexer": "^1.2.0",
66
66
  "log-symbols": "^7.0.1",
67
67
  "ora": "^9.0.0",
68
68
  "read-package-up": "^12.0.0",
69
69
  "rxjs": "^7.8.2",
70
70
  "tsx": "^4.21.0",
71
- "vite": "^7.3.2",
71
+ "vite": "^7.3.3",
72
72
  "vite-node": "^5.3.0",
73
73
  "zod": "^4.3.6"
74
74
  },
@@ -79,11 +79,11 @@
79
79
  "@swc/cli": "^0.8.1",
80
80
  "@swc/core": "^1.15.33",
81
81
  "@types/debug": "^4.1.13",
82
- "@types/jsdom": "^28.0.1",
83
- "@types/node": "^20.19.39",
82
+ "@types/jsdom": "^28.0.3",
83
+ "@types/node": "^20.19.41",
84
84
  "eslint": "^10.2.1",
85
85
  "publint": "^0.3.18",
86
- "sanity": "^5.23.0",
86
+ "sanity": "^5.26.0",
87
87
  "typescript": "^5.9.3",
88
88
  "vitest": "^4.1.5",
89
89
  "@repo/tsconfig": "3.70.0",