@sanity/cli-core 0.1.0-alpha.8 → 1.0.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.
Files changed (165) hide show
  1. package/dist/SanityCommand.js +88 -5
  2. package/dist/SanityCommand.js.map +1 -1
  3. package/dist/_exports/request.d.ts +77 -0
  4. package/dist/_exports/request.js +7 -0
  5. package/dist/_exports/request.js.map +1 -0
  6. package/dist/_exports/ux.d.ts +75 -4
  7. package/dist/_exports/ux.js +2 -1
  8. package/dist/_exports/ux.js.map +1 -1
  9. package/dist/config/cli/getCliConfig.js +33 -33
  10. package/dist/config/cli/getCliConfig.js.map +1 -1
  11. package/dist/config/cli/getCliConfigSync.js +1 -1
  12. package/dist/config/cli/getCliConfigSync.js.map +1 -1
  13. package/dist/config/cli/schemas.js +7 -0
  14. package/dist/config/cli/schemas.js.map +1 -1
  15. package/dist/config/cli/types/cliConfig.js.map +1 -1
  16. package/dist/config/findProjectRoot.js +8 -4
  17. package/dist/config/findProjectRoot.js.map +1 -1
  18. package/dist/config/findProjectRootSync.js +7 -3
  19. package/dist/config/findProjectRootSync.js.map +1 -1
  20. package/dist/config/studio/getStudioConfig.js +0 -3
  21. package/dist/config/studio/getStudioConfig.js.map +1 -1
  22. package/dist/config/studio/getStudioWorkspaces.js +63 -0
  23. package/dist/config/studio/getStudioWorkspaces.js.map +1 -0
  24. package/dist/config/studio/isStudioConfig.js +19 -0
  25. package/dist/config/studio/isStudioConfig.js.map +1 -0
  26. package/dist/config/studio/readStudioConfig.worker.js +8 -34
  27. package/dist/config/studio/readStudioConfig.worker.js.map +1 -1
  28. package/dist/config/util/findStudioConfigPath.js +24 -3
  29. package/dist/config/util/findStudioConfigPath.js.map +1 -1
  30. package/dist/config/util/recursivelyResolveProjectRoot.js.map +1 -1
  31. package/dist/errors/NonInteractiveError.js +18 -0
  32. package/dist/errors/NonInteractiveError.js.map +1 -0
  33. package/dist/{util → errors}/NotFoundError.js +1 -1
  34. package/dist/errors/NotFoundError.js.map +1 -0
  35. package/dist/errors/ProjectRootNotFoundError.js +35 -0
  36. package/dist/errors/ProjectRootNotFoundError.js.map +1 -0
  37. package/dist/index.d.ts +1247 -36
  38. package/dist/index.js +14 -9
  39. package/dist/index.js.map +1 -1
  40. package/dist/loaders/studio/studioWorkerLoader.worker.js +102 -23
  41. package/dist/loaders/studio/studioWorkerLoader.worker.js.map +1 -1
  42. package/dist/loaders/studio/studioWorkerTask.js +55 -34
  43. package/dist/loaders/studio/studioWorkerTask.js.map +1 -1
  44. package/dist/loaders/tsx/tsxWorkerLoader.worker.js +3 -4
  45. package/dist/loaders/tsx/tsxWorkerLoader.worker.js.map +1 -1
  46. package/dist/loaders/tsx/tsxWorkerTask.js +4 -31
  47. package/dist/loaders/tsx/tsxWorkerTask.js.map +1 -1
  48. package/dist/request/createRequester.js +83 -0
  49. package/dist/request/createRequester.js.map +1 -0
  50. package/dist/services/apiClient.js +8 -4
  51. package/dist/services/apiClient.js.map +1 -1
  52. package/dist/services/cliUserConfig.js +5 -5
  53. package/dist/services/cliUserConfig.js.map +1 -1
  54. package/dist/services/getCliToken.js +2 -2
  55. package/dist/services/getCliToken.js.map +1 -1
  56. package/dist/telemetry/getTelemetryBaseInfo.js +33 -0
  57. package/dist/telemetry/getTelemetryBaseInfo.js.map +1 -0
  58. package/dist/telemetry/types.js +5 -0
  59. package/dist/telemetry/types.js.map +1 -0
  60. package/dist/util/doImport.js +2 -1
  61. package/dist/util/doImport.js.map +1 -1
  62. package/dist/util/environment/mockBrowserEnvironment.js +1 -0
  63. package/dist/util/environment/mockBrowserEnvironment.js.map +1 -1
  64. package/dist/util/getCliTelemetry.js +34 -0
  65. package/dist/util/getCliTelemetry.js.map +1 -0
  66. package/dist/util/getSanityUrl.js +4 -3
  67. package/dist/util/getSanityUrl.js.map +1 -1
  68. package/dist/util/importModule.js +32 -0
  69. package/dist/util/importModule.js.map +1 -0
  70. package/dist/util/isInteractive.js +1 -1
  71. package/dist/util/isInteractive.js.map +1 -1
  72. package/dist/util/isStaging.js +10 -0
  73. package/dist/util/isStaging.js.map +1 -0
  74. package/dist/util/normalizePath.js +12 -0
  75. package/dist/util/normalizePath.js.map +1 -0
  76. package/dist/util/promisifyWorker.js +72 -0
  77. package/dist/util/promisifyWorker.js.map +1 -0
  78. package/dist/util/readNDJSON.js +18 -0
  79. package/dist/util/readNDJSON.js.map +1 -0
  80. package/dist/util/readPackageJson.js +74 -0
  81. package/dist/util/readPackageJson.js.map +1 -0
  82. package/dist/ux/boxen.js +3 -0
  83. package/dist/ux/boxen.js.map +1 -0
  84. package/dist/ux/colorizeJson.js +6 -6
  85. package/dist/ux/colorizeJson.js.map +1 -1
  86. package/dist/ux/prompts.js +49 -1
  87. package/dist/ux/prompts.js.map +1 -1
  88. package/package.json +39 -31
  89. package/dist/SanityCommand.d.ts +0 -78
  90. package/dist/_exports/tree.d.ts +0 -1
  91. package/dist/_exports/tree.js +0 -3
  92. package/dist/_exports/tree.js.map +0 -1
  93. package/dist/config/cli/getCliConfig.d.ts +0 -16
  94. package/dist/config/cli/getCliConfig.worker.d.ts +0 -1
  95. package/dist/config/cli/getCliConfig.worker.js +0 -15
  96. package/dist/config/cli/getCliConfig.worker.js.map +0 -1
  97. package/dist/config/cli/getCliConfigSync.d.ts +0 -12
  98. package/dist/config/cli/schemas.d.ts +0 -104
  99. package/dist/config/cli/types/cliConfig.d.ts +0 -83
  100. package/dist/config/cli/types/userViteConfig.d.ts +0 -5
  101. package/dist/config/findProjectRoot.d.ts +0 -14
  102. package/dist/config/findProjectRootSync.d.ts +0 -27
  103. package/dist/config/studio/getStudioConfig.d.ts +0 -14
  104. package/dist/config/studio/readStudioConfig.d.ts +0 -96
  105. package/dist/config/studio/readStudioConfig.worker.d.ts +0 -1
  106. package/dist/config/util/configPathsSync.d.ts +0 -17
  107. package/dist/config/util/findAppConfigPath.d.ts +0 -8
  108. package/dist/config/util/findConfigsPaths.d.ts +0 -16
  109. package/dist/config/util/findStudioConfigPath.d.ts +0 -9
  110. package/dist/config/util/isSanityV2StudioRoot.d.ts +0 -8
  111. package/dist/config/util/recursivelyResolveProjectRoot.d.ts +0 -27
  112. package/dist/debug.d.ts +0 -15
  113. package/dist/loaders/studio/studioWorkerLoader.worker.d.ts +0 -1
  114. package/dist/loaders/studio/studioWorkerTask.d.ts +0 -40
  115. package/dist/loaders/tsx/tsxWorkerLoader.worker.d.ts +0 -1
  116. package/dist/loaders/tsx/tsxWorkerTask.d.ts +0 -28
  117. package/dist/services/apiClient.d.ts +0 -53
  118. package/dist/services/cliUserConfig.d.ts +0 -40
  119. package/dist/services/getCliToken.d.ts +0 -7
  120. package/dist/types.d.ts +0 -15
  121. package/dist/util/NotFoundError.d.ts +0 -20
  122. package/dist/util/NotFoundError.js.map +0 -1
  123. package/dist/util/createExpiringConfig.d.ts +0 -37
  124. package/dist/util/createExpiringConfig.js +0 -60
  125. package/dist/util/createExpiringConfig.js.map +0 -1
  126. package/dist/util/doImport.d.ts +0 -7
  127. package/dist/util/environment/getStudioEnvironmentVariables.d.ts +0 -12
  128. package/dist/util/environment/mockBrowserEnvironment.d.ts +0 -17
  129. package/dist/util/environment/setupBrowserStubs.d.ts +0 -10
  130. package/dist/util/environment/stubs.d.ts +0 -254
  131. package/dist/util/fileExists.d.ts +0 -9
  132. package/dist/util/generateHelpUrl.d.ts +0 -8
  133. package/dist/util/getEmptyAuth.d.ts +0 -5
  134. package/dist/util/getSanityEnvVar.d.ts +0 -19
  135. package/dist/util/getSanityUrl.d.ts +0 -5
  136. package/dist/util/getUserConfig.d.ts +0 -2
  137. package/dist/util/isCi.d.ts +0 -1
  138. package/dist/util/isInteractive.d.ts +0 -1
  139. package/dist/util/isRecord.d.ts +0 -8
  140. package/dist/util/isTrueish.d.ts +0 -1
  141. package/dist/util/parseStringFlag.d.ts +0 -10
  142. package/dist/util/parseStringFlag.js +0 -19
  143. package/dist/util/parseStringFlag.js.map +0 -1
  144. package/dist/util/readJsonFile.d.ts +0 -14
  145. package/dist/util/resolveLocalPackage.d.ts +0 -18
  146. package/dist/util/safeStructuredClone.d.ts +0 -8
  147. package/dist/util/tree.d.ts +0 -31
  148. package/dist/util/tree.js +0 -108
  149. package/dist/util/tree.js.map +0 -1
  150. package/dist/util/tryGetDefaultExport.d.ts +0 -5
  151. package/dist/util/writeJsonFile.d.ts +0 -9
  152. package/dist/ux/chalk.d.ts +0 -2
  153. package/dist/ux/chalk.js +0 -4
  154. package/dist/ux/chalk.js.map +0 -1
  155. package/dist/ux/colorizeJson.d.ts +0 -1
  156. package/dist/ux/formatObject.d.ts +0 -1
  157. package/dist/ux/formatObject.js +0 -9
  158. package/dist/ux/formatObject.js.map +0 -1
  159. package/dist/ux/logSymbols.d.ts +0 -1
  160. package/dist/ux/printKeyValue.d.ts +0 -1
  161. package/dist/ux/printKeyValue.js +0 -16
  162. package/dist/ux/printKeyValue.js.map +0 -1
  163. package/dist/ux/prompts.d.ts +0 -1
  164. package/dist/ux/spinner.d.ts +0 -1
  165. package/dist/ux/timer.d.ts +0 -12
@@ -0,0 +1,74 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { z } from 'zod';
3
+ /**
4
+ * Comprehensive package.json schema including all common properties.
5
+ * Feel free to add properties to this,
6
+ * 🟠ℹ️ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL ℹ️🟠
7
+ * 🟠ℹ️ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE ℹ️🟠
8
+ * 🟠ℹ️ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS ℹ️🟠
9
+ */ const packageJsonSchema = z.looseObject({
10
+ // Required fields
11
+ name: z.string(),
12
+ version: z.string(),
13
+ // Dependencies (optional)
14
+ dependencies: z.record(z.string(), z.string()).optional(),
15
+ devDependencies: z.record(z.string(), z.string()).optional(),
16
+ peerDependencies: z.record(z.string(), z.string()).optional(),
17
+ // Module structure (optional)
18
+ exports: z.record(z.string(), z.any()).optional(),
19
+ main: z.string().optional(),
20
+ types: z.string().optional(),
21
+ // Metadata (optional)
22
+ author: z.string().optional(),
23
+ description: z.string().optional(),
24
+ engines: z.record(z.string(), z.string()).optional(),
25
+ license: z.string().optional(),
26
+ private: z.boolean().optional(),
27
+ repository: z.object({
28
+ type: z.string(),
29
+ url: z.string()
30
+ }).optional(),
31
+ scripts: z.record(z.string(), z.string()).optional(),
32
+ type: z.enum([
33
+ 'module',
34
+ 'commonjs'
35
+ ]).optional()
36
+ });
37
+ /**
38
+ * Read the `package.json` file at the given path
39
+ *
40
+ * @param filePath - Path to package.json to read
41
+ * @param options - Options object for controlling read behavior
42
+ * @returns The parsed package.json
43
+ * @public
44
+ */ export async function readPackageJson(filePath, options = {}) {
45
+ const { defaults = {}, skipSchemaValidation = false } = options;
46
+ // Read and parse the file
47
+ let pkg;
48
+ try {
49
+ pkg = JSON.parse(await readFile(filePath, 'utf8'));
50
+ } catch (err) {
51
+ throw new Error(`Failed to read "${filePath}"`, {
52
+ cause: err
53
+ });
54
+ }
55
+ // Merge with defaults (parsed values take precedence)
56
+ const merged = {
57
+ ...defaults,
58
+ ...pkg
59
+ };
60
+ // Validate with schema unless skipped
61
+ let validated;
62
+ if (skipSchemaValidation) {
63
+ validated = merged;
64
+ } else {
65
+ const { data, error, success } = packageJsonSchema.safeParse(merged);
66
+ if (!success) {
67
+ throw new Error(`Invalid package.json at "${filePath}": ${error.issues.map((err)=>err.message).join('\n')}`);
68
+ }
69
+ validated = data;
70
+ }
71
+ return validated;
72
+ }
73
+
74
+ //# sourceMappingURL=readPackageJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/readPackageJson.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\n\nimport {z} from 'zod'\n\n/**\n * Comprehensive package.json schema including all common properties.\n * Feel free to add properties to this,\n * 🟠ℹ️ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL ℹ️🟠\n * 🟠ℹ️ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE ℹ️🟠\n * 🟠ℹ️ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS ℹ️🟠\n */\nconst packageJsonSchema = z.looseObject({\n // Required fields\n name: z.string(),\n version: z.string(),\n\n // Dependencies (optional)\n dependencies: z.record(z.string(), z.string()).optional(),\n devDependencies: z.record(z.string(), z.string()).optional(),\n peerDependencies: z.record(z.string(), z.string()).optional(),\n\n // Module structure (optional)\n exports: z.record(z.string(), z.any()).optional(),\n main: z.string().optional(),\n types: z.string().optional(),\n\n // Metadata (optional)\n author: z.string().optional(),\n description: z.string().optional(),\n engines: z.record(z.string(), z.string()).optional(),\n license: z.string().optional(),\n private: z.boolean().optional(),\n repository: z\n .object({\n type: z.string(),\n url: z.string(),\n })\n .optional(),\n scripts: z.record(z.string(), z.string()).optional(),\n type: z.enum(['module', 'commonjs']).optional(),\n})\n\n/**\n * Comprehensive representation of a package.json file.\n * Consolidates all properties from previous type definitions.\n *\n * @public\n */\nexport type PackageJson = z.infer<typeof packageJsonSchema>\n\n/**\n * Options for reading package.json files\n *\n * @public\n */\nexport interface ReadPackageJsonOptions {\n /**\n * Default values to merge with the parsed package.json.\n * Parsed values take precedence over defaults.\n */\n defaults?: Partial<PackageJson>\n\n /**\n * Skip Zod schema validation. When true, the file is parsed but not validated.\n * Defaults to false.\n */\n skipSchemaValidation?: boolean\n}\n\n/**\n * Read the `package.json` file at the given path\n *\n * @param filePath - Path to package.json to read\n * @param options - Options object for controlling read behavior\n * @returns The parsed package.json\n * @public\n */\nexport async function readPackageJson(\n filePath: string | URL,\n options: ReadPackageJsonOptions = {},\n): Promise<PackageJson> {\n const {defaults = {}, skipSchemaValidation = false} = options\n\n // Read and parse the file\n let pkg: Record<string, unknown>\n try {\n pkg = JSON.parse(await readFile(filePath, 'utf8'))\n } catch (err: unknown) {\n throw new Error(`Failed to read \"${filePath}\"`, {cause: err})\n }\n\n // Merge with defaults (parsed values take precedence)\n const merged = {...defaults, ...pkg}\n\n // Validate with schema unless skipped\n let validated: PackageJson\n if (skipSchemaValidation) {\n validated = merged as PackageJson\n } else {\n const {data, error, success} = packageJsonSchema.safeParse(merged)\n if (!success) {\n throw new Error(\n `Invalid package.json at \"${filePath}\": ${error.issues.map((err) => err.message).join('\\n')}`,\n )\n }\n validated = data\n }\n\n return validated\n}\n"],"names":["readFile","z","packageJsonSchema","looseObject","name","string","version","dependencies","record","optional","devDependencies","peerDependencies","exports","any","main","types","author","description","engines","license","private","boolean","repository","object","type","url","scripts","enum","readPackageJson","filePath","options","defaults","skipSchemaValidation","pkg","JSON","parse","err","Error","cause","merged","validated","data","error","success","safeParse","issues","map","message","join"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,SAAQC,CAAC,QAAO,MAAK;AAErB;;;;;;CAMC,GACD,MAAMC,oBAAoBD,EAAEE,WAAW,CAAC;IACtC,kBAAkB;IAClBC,MAAMH,EAAEI,MAAM;IACdC,SAASL,EAAEI,MAAM;IAEjB,0BAA0B;IAC1BE,cAAcN,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEI,MAAM,IAAII,QAAQ;IACvDC,iBAAiBT,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEI,MAAM,IAAII,QAAQ;IAC1DE,kBAAkBV,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEI,MAAM,IAAII,QAAQ;IAE3D,8BAA8B;IAC9BG,SAASX,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEY,GAAG,IAAIJ,QAAQ;IAC/CK,MAAMb,EAAEI,MAAM,GAAGI,QAAQ;IACzBM,OAAOd,EAAEI,MAAM,GAAGI,QAAQ;IAE1B,sBAAsB;IACtBO,QAAQf,EAAEI,MAAM,GAAGI,QAAQ;IAC3BQ,aAAahB,EAAEI,MAAM,GAAGI,QAAQ;IAChCS,SAASjB,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEI,MAAM,IAAII,QAAQ;IAClDU,SAASlB,EAAEI,MAAM,GAAGI,QAAQ;IAC5BW,SAASnB,EAAEoB,OAAO,GAAGZ,QAAQ;IAC7Ba,YAAYrB,EACTsB,MAAM,CAAC;QACNC,MAAMvB,EAAEI,MAAM;QACdoB,KAAKxB,EAAEI,MAAM;IACf,GACCI,QAAQ;IACXiB,SAASzB,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEI,MAAM,IAAII,QAAQ;IAClDe,MAAMvB,EAAE0B,IAAI,CAAC;QAAC;QAAU;KAAW,EAAElB,QAAQ;AAC/C;AA6BA;;;;;;;CAOC,GACD,OAAO,eAAemB,gBACpBC,QAAsB,EACtBC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EAACC,WAAW,CAAC,CAAC,EAAEC,uBAAuB,KAAK,EAAC,GAAGF;IAEtD,0BAA0B;IAC1B,IAAIG;IACJ,IAAI;QACFA,MAAMC,KAAKC,KAAK,CAAC,MAAMnC,SAAS6B,UAAU;IAC5C,EAAE,OAAOO,KAAc;QACrB,MAAM,IAAIC,MAAM,CAAC,gBAAgB,EAAER,SAAS,CAAC,CAAC,EAAE;YAACS,OAAOF;QAAG;IAC7D;IAEA,sDAAsD;IACtD,MAAMG,SAAS;QAAC,GAAGR,QAAQ;QAAE,GAAGE,GAAG;IAAA;IAEnC,sCAAsC;IACtC,IAAIO;IACJ,IAAIR,sBAAsB;QACxBQ,YAAYD;IACd,OAAO;QACL,MAAM,EAACE,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAC,GAAGzC,kBAAkB0C,SAAS,CAACL;QAC3D,IAAI,CAACI,SAAS;YACZ,MAAM,IAAIN,MACR,CAAC,yBAAyB,EAAER,SAAS,GAAG,EAAEa,MAAMG,MAAM,CAACC,GAAG,CAAC,CAACV,MAAQA,IAAIW,OAAO,EAAEC,IAAI,CAAC,OAAO;QAEjG;QACAR,YAAYC;IACd;IAEA,OAAOD;AACT"}
@@ -0,0 +1,3 @@
1
+ export { default as boxen } from 'boxen';
2
+
3
+ //# sourceMappingURL=boxen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ux/boxen.ts"],"sourcesContent":["export {\n default as boxen,\n type Options as BoxenOptions,\n type Boxes,\n type CustomBorderStyle,\n type Spacing,\n} from 'boxen'\n"],"names":["default","boxen"],"mappings":"AAAA,SACEA,WAAWC,KAAK,QAKX,QAAO"}
@@ -1,15 +1,15 @@
1
- import chalk from 'chalk';
1
+ import { styleText } from 'node:util';
2
2
  import tokenize from 'json-lexer';
3
3
  /**
4
4
  * Colorize JSON output for better readability using simple regex patterns
5
5
  */ const identity = (inp)=>inp;
6
6
  export function colorizeJson(input) {
7
7
  const formatters = {
8
- key: chalk.white,
9
- literal: chalk.bold,
10
- number: chalk.yellow,
11
- punctuator: chalk.white,
12
- string: chalk.green,
8
+ key: (s)=>styleText('white', s),
9
+ literal: (s)=>styleText('bold', s),
10
+ number: (s)=>styleText('yellow', s),
11
+ punctuator: (s)=>styleText('white', s),
12
+ string: (s)=>styleText('green', s),
13
13
  whitespace: identity
14
14
  };
15
15
  const json = JSON.stringify(input, null, 2);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ux/colorizeJson.ts"],"sourcesContent":["import chalk from 'chalk'\nimport tokenize, {type LexerToken} from 'json-lexer'\n\ninterface KeyToken {\n raw: string\n type: 'key'\n value: string\n}\n\ntype ExtendedLexerToken = KeyToken | LexerToken\n\n/**\n * Colorize JSON output for better readability using simple regex patterns\n */\nconst identity = (inp: string): string => inp\n\nexport function colorizeJson(input: unknown): string {\n const formatters: Record<ExtendedLexerToken['type'], (str: string) => string> = {\n key: chalk.white,\n literal: chalk.bold,\n number: chalk.yellow,\n punctuator: chalk.white,\n string: chalk.green,\n whitespace: identity,\n }\n\n const json = JSON.stringify(input, null, 2)\n\n return tokenize(json)\n .map((token, i, arr): ExtendedLexerToken => {\n // Note how the following only works because we pretty-print the JSON\n const prevToken = i === 0 ? token : arr[i - 1]\n if (\n token.type === 'string' &&\n prevToken.type === 'whitespace' &&\n /^\\n\\s+$/.test(prevToken.value)\n ) {\n return {...token, type: 'key'}\n }\n\n return token\n })\n .map((token) => {\n const formatter = formatters[token.type] || identity\n return formatter(token.raw)\n })\n .join('')\n}\n"],"names":["chalk","tokenize","identity","inp","colorizeJson","input","formatters","key","white","literal","bold","number","yellow","punctuator","string","green","whitespace","json","JSON","stringify","map","token","i","arr","prevToken","type","test","value","formatter","raw","join"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AACzB,OAAOC,cAAiC,aAAY;AAUpD;;CAEC,GACD,MAAMC,WAAW,CAACC,MAAwBA;AAE1C,OAAO,SAASC,aAAaC,KAAc;IACzC,MAAMC,aAA0E;QAC9EC,KAAKP,MAAMQ,KAAK;QAChBC,SAAST,MAAMU,IAAI;QACnBC,QAAQX,MAAMY,MAAM;QACpBC,YAAYb,MAAMQ,KAAK;QACvBM,QAAQd,MAAMe,KAAK;QACnBC,YAAYd;IACd;IAEA,MAAMe,OAAOC,KAAKC,SAAS,CAACd,OAAO,MAAM;IAEzC,OAAOJ,SAASgB,MACbG,GAAG,CAAC,CAACC,OAAOC,GAAGC;QACd,qEAAqE;QACrE,MAAMC,YAAYF,MAAM,IAAID,QAAQE,GAAG,CAACD,IAAI,EAAE;QAC9C,IACED,MAAMI,IAAI,KAAK,YACfD,UAAUC,IAAI,KAAK,gBACnB,UAAUC,IAAI,CAACF,UAAUG,KAAK,GAC9B;YACA,OAAO;gBAAC,GAAGN,KAAK;gBAAEI,MAAM;YAAK;QAC/B;QAEA,OAAOJ;IACT,GACCD,GAAG,CAAC,CAACC;QACJ,MAAMO,YAAYtB,UAAU,CAACe,MAAMI,IAAI,CAAC,IAAIvB;QAC5C,OAAO0B,UAAUP,MAAMQ,GAAG;IAC5B,GACCC,IAAI,CAAC;AACV"}
1
+ {"version":3,"sources":["../../src/ux/colorizeJson.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport tokenize, {type LexerToken} from 'json-lexer'\n\ninterface KeyToken {\n raw: string\n type: 'key'\n value: string\n}\n\ntype ExtendedLexerToken = KeyToken | LexerToken\n\n/**\n * Colorize JSON output for better readability using simple regex patterns\n */\nconst identity = (inp: string): string => inp\n\nexport function colorizeJson(input: unknown): string {\n const formatters: Record<ExtendedLexerToken['type'], (str: string) => string> = {\n key: (s) => styleText('white', s),\n literal: (s) => styleText('bold', s),\n number: (s) => styleText('yellow', s),\n punctuator: (s) => styleText('white', s),\n string: (s) => styleText('green', s),\n whitespace: identity,\n }\n\n const json = JSON.stringify(input, null, 2)\n\n return tokenize(json)\n .map((token, i, arr): ExtendedLexerToken => {\n // Note how the following only works because we pretty-print the JSON\n const prevToken = i === 0 ? token : arr[i - 1]\n if (\n token.type === 'string' &&\n prevToken.type === 'whitespace' &&\n /^\\n\\s+$/.test(prevToken.value)\n ) {\n return {...token, type: 'key'}\n }\n\n return token\n })\n .map((token) => {\n const formatter = formatters[token.type] || identity\n return formatter(token.raw)\n })\n .join('')\n}\n"],"names":["styleText","tokenize","identity","inp","colorizeJson","input","formatters","key","s","literal","number","punctuator","string","whitespace","json","JSON","stringify","map","token","i","arr","prevToken","type","test","value","formatter","raw","join"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,OAAOC,cAAiC,aAAY;AAUpD;;CAEC,GACD,MAAMC,WAAW,CAACC,MAAwBA;AAE1C,OAAO,SAASC,aAAaC,KAAc;IACzC,MAAMC,aAA0E;QAC9EC,KAAK,CAACC,IAAMR,UAAU,SAASQ;QAC/BC,SAAS,CAACD,IAAMR,UAAU,QAAQQ;QAClCE,QAAQ,CAACF,IAAMR,UAAU,UAAUQ;QACnCG,YAAY,CAACH,IAAMR,UAAU,SAASQ;QACtCI,QAAQ,CAACJ,IAAMR,UAAU,SAASQ;QAClCK,YAAYX;IACd;IAEA,MAAMY,OAAOC,KAAKC,SAAS,CAACX,OAAO,MAAM;IAEzC,OAAOJ,SAASa,MACbG,GAAG,CAAC,CAACC,OAAOC,GAAGC;QACd,qEAAqE;QACrE,MAAMC,YAAYF,MAAM,IAAID,QAAQE,GAAG,CAACD,IAAI,EAAE;QAC9C,IACED,MAAMI,IAAI,KAAK,YACfD,UAAUC,IAAI,KAAK,gBACnB,UAAUC,IAAI,CAACF,UAAUG,KAAK,GAC9B;YACA,OAAO;gBAAC,GAAGN,KAAK;gBAAEI,MAAM;YAAK;QAC/B;QAEA,OAAOJ;IACT,GACCD,GAAG,CAAC,CAACC;QACJ,MAAMO,YAAYnB,UAAU,CAACY,MAAMI,IAAI,CAAC,IAAIpB;QAC5C,OAAOuB,UAAUP,MAAMQ,GAAG;IAC5B,GACCC,IAAI,CAAC;AACV"}
@@ -1,3 +1,51 @@
1
- export * from '@inquirer/prompts';
1
+ import * as inquirer from '@inquirer/prompts';
2
+ import { NonInteractiveError } from '../errors/NonInteractiveError.js';
3
+ import { isInteractive } from '../util/isInteractive.js';
4
+ export { Separator } from '@inquirer/prompts';
5
+ function assertInteractive(promptName) {
6
+ if (!isInteractive()) {
7
+ throw new NonInteractiveError(promptName);
8
+ }
9
+ }
10
+ export const checkbox = (...args)=>{
11
+ assertInteractive('checkbox');
12
+ return inquirer.checkbox(...args);
13
+ };
14
+ export const confirm = (...args)=>{
15
+ assertInteractive('confirm');
16
+ return inquirer.confirm(...args);
17
+ };
18
+ export const editor = (...args)=>{
19
+ assertInteractive('editor');
20
+ return inquirer.editor(...args);
21
+ };
22
+ export const expand = (...args)=>{
23
+ assertInteractive('expand');
24
+ return inquirer.expand(...args);
25
+ };
26
+ export const input = (...args)=>{
27
+ assertInteractive('input');
28
+ return inquirer.input(...args);
29
+ };
30
+ export const number = (...args)=>{
31
+ assertInteractive('number');
32
+ return inquirer.number(...args);
33
+ };
34
+ export const password = (...args)=>{
35
+ assertInteractive('password');
36
+ return inquirer.password(...args);
37
+ };
38
+ export const rawlist = (...args)=>{
39
+ assertInteractive('rawlist');
40
+ return inquirer.rawlist(...args);
41
+ };
42
+ export const search = (...args)=>{
43
+ assertInteractive('search');
44
+ return inquirer.search(...args);
45
+ };
46
+ export const select = (...args)=>{
47
+ assertInteractive('select');
48
+ return inquirer.select(...args);
49
+ };
2
50
 
3
51
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ux/prompts.ts"],"sourcesContent":["export * from '@inquirer/prompts'\n"],"names":[],"mappings":"AAAA,cAAc,oBAAmB"}
1
+ {"version":3,"sources":["../../src/ux/prompts.ts"],"sourcesContent":["import * as inquirer from '@inquirer/prompts'\n\nimport {NonInteractiveError} from '../errors/NonInteractiveError.js'\nimport {isInteractive} from '../util/isInteractive.js'\n\nexport {Separator} from '@inquirer/prompts'\n\nfunction assertInteractive(promptName: string): void {\n if (!isInteractive()) {\n throw new NonInteractiveError(promptName)\n }\n}\n\nexport const checkbox: typeof inquirer.checkbox = (...args) => {\n assertInteractive('checkbox')\n return inquirer.checkbox(...args)\n}\n\nexport const confirm: typeof inquirer.confirm = (...args) => {\n assertInteractive('confirm')\n return inquirer.confirm(...args)\n}\n\nexport const editor: typeof inquirer.editor = (...args) => {\n assertInteractive('editor')\n return inquirer.editor(...args)\n}\n\nexport const expand: typeof inquirer.expand = (...args) => {\n assertInteractive('expand')\n return inquirer.expand(...args)\n}\n\nexport const input: typeof inquirer.input = (...args) => {\n assertInteractive('input')\n return inquirer.input(...args)\n}\n\nexport const number: typeof inquirer.number = (...args) => {\n assertInteractive('number')\n return inquirer.number(...args)\n}\n\nexport const password: typeof inquirer.password = (...args) => {\n assertInteractive('password')\n return inquirer.password(...args)\n}\n\nexport const rawlist: typeof inquirer.rawlist = (...args) => {\n assertInteractive('rawlist')\n return inquirer.rawlist(...args)\n}\n\nexport const search: typeof inquirer.search = (...args) => {\n assertInteractive('search')\n return inquirer.search(...args)\n}\n\nexport const select: typeof inquirer.select = (...args) => {\n assertInteractive('select')\n return inquirer.select(...args)\n}\n"],"names":["inquirer","NonInteractiveError","isInteractive","Separator","assertInteractive","promptName","checkbox","args","confirm","editor","expand","input","number","password","rawlist","search","select"],"mappings":"AAAA,YAAYA,cAAc,oBAAmB;AAE7C,SAAQC,mBAAmB,QAAO,mCAAkC;AACpE,SAAQC,aAAa,QAAO,2BAA0B;AAEtD,SAAQC,SAAS,QAAO,oBAAmB;AAE3C,SAASC,kBAAkBC,UAAkB;IAC3C,IAAI,CAACH,iBAAiB;QACpB,MAAM,IAAID,oBAAoBI;IAChC;AACF;AAEA,OAAO,MAAMC,WAAqC,CAAC,GAAGC;IACpDH,kBAAkB;IAClB,OAAOJ,SAASM,QAAQ,IAAIC;AAC9B,EAAC;AAED,OAAO,MAAMC,UAAmC,CAAC,GAAGD;IAClDH,kBAAkB;IAClB,OAAOJ,SAASQ,OAAO,IAAID;AAC7B,EAAC;AAED,OAAO,MAAME,SAAiC,CAAC,GAAGF;IAChDH,kBAAkB;IAClB,OAAOJ,SAASS,MAAM,IAAIF;AAC5B,EAAC;AAED,OAAO,MAAMG,SAAiC,CAAC,GAAGH;IAChDH,kBAAkB;IAClB,OAAOJ,SAASU,MAAM,IAAIH;AAC5B,EAAC;AAED,OAAO,MAAMI,QAA+B,CAAC,GAAGJ;IAC9CH,kBAAkB;IAClB,OAAOJ,SAASW,KAAK,IAAIJ;AAC3B,EAAC;AAED,OAAO,MAAMK,SAAiC,CAAC,GAAGL;IAChDH,kBAAkB;IAClB,OAAOJ,SAASY,MAAM,IAAIL;AAC5B,EAAC;AAED,OAAO,MAAMM,WAAqC,CAAC,GAAGN;IACpDH,kBAAkB;IAClB,OAAOJ,SAASa,QAAQ,IAAIN;AAC9B,EAAC;AAED,OAAO,MAAMO,UAAmC,CAAC,GAAGP;IAClDH,kBAAkB;IAClB,OAAOJ,SAASc,OAAO,IAAIP;AAC7B,EAAC;AAED,OAAO,MAAMQ,SAAiC,CAAC,GAAGR;IAChDH,kBAAkB;IAClB,OAAOJ,SAASe,MAAM,IAAIR;AAC5B,EAAC;AAED,OAAO,MAAMS,SAAiC,CAAC,GAAGT;IAChDH,kBAAkB;IAClB,OAAOJ,SAASgB,MAAM,IAAIT;AAC5B,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-core",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "1.0.0",
4
4
  "description": "Sanity CLI core package",
5
5
  "keywords": [
6
6
  "sanity",
@@ -25,59 +25,67 @@
25
25
  "exports": {
26
26
  ".": {
27
27
  "source": "./src/index.ts",
28
- "require": "./dist/index.js",
29
- "import": "./dist/index.js"
30
- },
31
- "./tree": {
32
- "source": "./src/_exports/tree.ts",
33
- "require": "./dist/_exports/tree.js",
34
- "import": "./dist/_exports/tree.js"
28
+ "default": "./dist/index.js"
35
29
  },
36
30
  "./ux": {
37
31
  "source": "./src/_exports/ux.ts",
38
- "require": "./dist/_exports/ux.js",
39
- "import": "./dist/_exports/ux.js"
32
+ "default": "./dist/_exports/ux.js"
33
+ },
34
+ "./request": {
35
+ "source": "./src/_exports/request.ts",
36
+ "default": "./dist/_exports/request.js"
40
37
  },
41
38
  "./package.json": "./package.json"
42
39
  },
43
- "main": "dist/index.js",
40
+ "main": "./dist/index.js",
44
41
  "types": "dist/index.d.ts",
45
42
  "files": [
46
43
  "./dist"
47
44
  ],
48
45
  "dependencies": {
49
- "@inquirer/prompts": "^8.1.0",
50
- "@oclif/core": "^4.8.0",
51
- "@sanity/client": "^7.14.0",
52
- "@sanity/types": "^5.6.0",
46
+ "@inquirer/prompts": "^8.3.0",
47
+ "@oclif/core": "^4.8.3",
48
+ "@rexxars/jiti": "^2.6.2",
49
+ "@sanity/client": "^7.17.0",
53
50
  "babel-plugin-react-compiler": "^1.0.0",
54
- "chalk": "^5.6.2",
51
+ "boxen": "^8.0.1",
55
52
  "configstore": "^7.0.0",
56
53
  "debug": "^4.4.3",
57
- "get-tsconfig": "^4.13.0",
58
- "import-meta-resolve": "^4.1.0",
59
- "jsdom": "^27.4.0",
54
+ "get-it": "^8.7.0",
55
+ "get-tsconfig": "^4.13.6",
56
+ "import-meta-resolve": "^4.2.0",
57
+ "jsdom": "^28.1.0",
60
58
  "json-lexer": "^1.2.0",
61
59
  "log-symbols": "^7.0.1",
62
60
  "ora": "^9.0.0",
61
+ "read-package-up": "^12.0.0",
62
+ "rxjs": "^7.8.2",
63
63
  "tsx": "^4.21.0",
64
64
  "vite": "^7.3.1",
65
- "zod": "^4.3.5"
65
+ "vite-node": "^5.3.0",
66
+ "zod": "^4.3.6"
66
67
  },
67
68
  "devDependencies": {
68
- "@eslint/compat": "^2.0.1",
69
- "@sanity/codegen": "^5.6.0",
70
- "@swc/cli": "^0.7.10",
71
- "@swc/core": "^1.15.10",
69
+ "@eslint/compat": "^2.0.3",
70
+ "@sanity/codegen": "^5.10.1",
71
+ "@sanity/pkg-utils": "^10.4.8",
72
+ "@sanity/telemetry": "^0.8.1",
73
+ "@swc/cli": "^0.8.0",
74
+ "@swc/core": "^1.15.18",
72
75
  "@types/debug": "^4.1.12",
73
- "@types/jsdom": "^27.0.0",
74
- "@types/node": "^20.19.30",
75
- "eslint": "^9.39.2",
76
- "publint": "^0.3.16",
76
+ "@types/jsdom": "^28.0.0",
77
+ "@types/node": "^20.19.37",
78
+ "eslint": "^9.39.4",
79
+ "publint": "^0.3.18",
80
+ "sanity": "^5.13.0",
77
81
  "typescript": "^5.9.3",
78
- "vitest": "^4.0.17",
82
+ "vitest": "^4.0.18",
83
+ "@repo/package.config": "0.0.1",
79
84
  "@repo/tsconfig": "3.70.0",
80
- "@sanity/eslint-config-cli": "0.0.0-alpha.1"
85
+ "@sanity/eslint-config-cli": "1.0.0"
86
+ },
87
+ "peerDependencies": {
88
+ "@sanity/telemetry": ">=0.8.1 <0.9.0"
81
89
  },
82
90
  "engines": {
83
91
  "node": ">=20.19.1 <22 || >=22.12"
@@ -87,7 +95,7 @@
87
95
  },
88
96
  "scripts": {
89
97
  "build": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ src --ignore '**/*.test.ts'",
90
- "build:types": "tsc --project tsconfig.lib.json",
98
+ "build:types": "pkg-utils build --emitDeclarationOnly",
91
99
  "check:types": "tsc --noEmit",
92
100
  "lint": "eslint .",
93
101
  "publint": "publint",
@@ -1,78 +0,0 @@
1
- import { Command, Interfaces } from '@oclif/core';
2
- import { type CliConfig } from './config/cli/types/cliConfig.js';
3
- import { type ProjectRootResult } from './config/util/recursivelyResolveProjectRoot.js';
4
- import { type GlobalCliClientOptions, type ProjectCliClientOptions } from './services/apiClient.js';
5
- import { type Output } from './types.js';
6
- type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof SanityCommand)['baseFlags'] & T['flags']>;
7
- type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
8
- export declare abstract class SanityCommand<T extends typeof Command> extends Command {
9
- protected args: Args<T>;
10
- protected flags: Flags<T>;
11
- /**
12
- * Get the global API client.
13
- *
14
- * @param args - The global API client options.
15
- * @returns The global API client.
16
- *
17
- * @deprecated use `getGlobalCliClient` function directly instead.
18
- */
19
- protected getGlobalApiClient: (args: GlobalCliClientOptions) => Promise<import("@sanity/client").SanityClient>;
20
- /**
21
- * Get the project API client.
22
- *
23
- * @param args - The project API client options.
24
- * @returns The project API client.
25
- *
26
- * @deprecated use `getProjectCliClient` function directly instead.
27
- */
28
- protected getProjectApiClient: (args: ProjectCliClientOptions) => Promise<import("@sanity/client").SanityClient>;
29
- /**
30
- * Helper for outputting to the console.
31
- *
32
- * @example
33
- * ```ts
34
- * this.output.log('Hello')
35
- * this.output.warn('Warning')
36
- * this.output.error('Error')
37
- * ```
38
- */
39
- protected output: Output;
40
- /**
41
- * Get the CLI config.
42
- *
43
- * @returns The CLI config.
44
- */
45
- protected getCliConfig(): Promise<CliConfig>;
46
- /**
47
- * Get the project ID from the CLI config.
48
- *
49
- * @returns The project ID or `undefined` if it's not set.
50
- */
51
- protected getProjectId(): Promise<string | undefined>;
52
- /**
53
- * Get the project's root directory by resolving the config
54
- *
55
- * @returns The project root result.
56
- */
57
- protected getProjectRoot(): Promise<ProjectRootResult>;
58
- init(): Promise<void>;
59
- /**
60
- * Check if the command is running in unattended mode.
61
- *
62
- * This means the command should not ask for user input, instead using defaults where
63
- * possible, and if that does not make sense (eg there's missing information), then we
64
- * should error out (remember to exit with a non-zero code).
65
- *
66
- * Most commands should take an explicit `--yes` flag to enable unattended mode, but
67
- * some commands may also be run in unattended mode if `process.stdin` is not a TTY
68
- * (eg when running in a CI environment).
69
- */
70
- protected isUnattended(): boolean;
71
- /**
72
- * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.
73
- *
74
- * @returns Whether the terminal is interactive.
75
- */
76
- protected resolveIsInteractive(): boolean;
77
- }
78
- export {};
@@ -1 +0,0 @@
1
- export * from '../util/tree.js';
@@ -1,3 +0,0 @@
1
- export * from '../util/tree.js';
2
-
3
- //# sourceMappingURL=tree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/_exports/tree.ts"],"sourcesContent":["export * from '../util/tree.js'\n"],"names":[],"mappings":"AAAA,cAAc,kBAAiB"}
@@ -1,16 +0,0 @@
1
- import { type CliConfig } from './types/cliConfig.js';
2
- /**
3
- * Get the CLI config for a project, given the root path.
4
- *
5
- * We really want to avoid loading the CLI config in the main thread, as we'll need
6
- * TypeScript loading logic, potentially with ts path aliases, syntax extensions and all
7
- * sorts of nonsense. Thus, we _attempt_ to use a worker thread - but have to fall back
8
- * to using the main thread if not possible. This can be the case if the configuration
9
- * contains non-serializable properties, such as functions. This is unfortunately used
10
- * by the vite config, for example.
11
- *
12
- * @param rootPath - Root path for the project, eg where `sanity.cli.(ts|js)` is located.
13
- * @returns The CLI config
14
- * @internal
15
- */
16
- export declare function getCliConfig(rootPath: string): Promise<CliConfig>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { isMainThread, parentPort, workerData } from 'node:worker_threads';
2
- import { z } from 'zod';
3
- import { doImport } from '../../util/doImport.js';
4
- if (isMainThread || !parentPort) {
5
- throw new Error('Should only be run in a worker!');
6
- }
7
- const { configPath } = z.object({
8
- configPath: z.string()
9
- }).parse(workerData);
10
- const { default: loadedConfig } = await doImport(configPath);
11
- // This might throw on unserializable properties, but that's actually wanted in this
12
- // case, since we _need_ any unserializable props (such as vite config functions)
13
- parentPort.postMessage(loadedConfig);
14
-
15
- //# sourceMappingURL=getCliConfig.worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/config/cli/getCliConfig.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {z} from 'zod'\n\nimport {doImport} from '../../util/doImport.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst {configPath} = z.object({configPath: z.string()}).parse(workerData)\n\nconst {default: loadedConfig} = await doImport(configPath)\n\n// This might throw on unserializable properties, but that's actually wanted in this\n// case, since we _need_ any unserializable props (such as vite config functions)\nparentPort.postMessage(loadedConfig)\n"],"names":["isMainThread","parentPort","workerData","z","doImport","Error","configPath","object","string","parse","default","loadedConfig","postMessage"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,CAAC,QAAO,MAAK;AAErB,SAAQC,QAAQ,QAAO,yBAAwB;AAE/C,IAAIJ,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAII,MAAM;AAClB;AAEA,MAAM,EAACC,UAAU,EAAC,GAAGH,EAAEI,MAAM,CAAC;IAACD,YAAYH,EAAEK,MAAM;AAAE,GAAGC,KAAK,CAACP;AAE9D,MAAM,EAACQ,SAASC,YAAY,EAAC,GAAG,MAAMP,SAASE;AAE/C,oFAAoF;AACpF,iFAAiF;AACjFL,WAAWW,WAAW,CAACD"}
@@ -1,12 +0,0 @@
1
- import { type CliConfig } from './types/cliConfig.js';
2
- /**
3
- * Get the CLI config for a project synchronously, given the root path.
4
- *
5
- * This loads the CLI config in the main thread using tsx/register for TypeScript support.
6
- * Note: This is a synchronous operation and does not use worker threads like the async version.
7
- *
8
- * @param rootPath - Root path for the project, eg where `sanity.cli.(ts|js)` is located.
9
- * @returns The CLI config
10
- * @internal
11
- */
12
- export declare function getCliConfigSync(rootPath: string): CliConfig;
@@ -1,104 +0,0 @@
1
- import { z } from 'zod';
2
- import { type UserViteConfig } from './types/userViteConfig';
3
- /**
4
- * @public
5
- */
6
- export declare const cliConfigSchema: z.ZodObject<{
7
- api: z.ZodOptional<z.ZodObject<{
8
- dataset: z.ZodOptional<z.ZodString>;
9
- projectId: z.ZodOptional<z.ZodString>;
10
- }, z.core.$strip>>;
11
- app: z.ZodOptional<z.ZodObject<{
12
- entry: z.ZodOptional<z.ZodString>;
13
- icon: z.ZodOptional<z.ZodString>;
14
- id: z.ZodOptional<z.ZodString>;
15
- organizationId: z.ZodOptional<z.ZodString>;
16
- title: z.ZodOptional<z.ZodString>;
17
- }, z.core.$strip>>;
18
- autoUpdates: z.ZodOptional<z.ZodBoolean>;
19
- deployment: z.ZodOptional<z.ZodObject<{
20
- appId: z.ZodOptional<z.ZodString>;
21
- autoUpdates: z.ZodOptional<z.ZodBoolean>;
22
- }, z.core.$strip>>;
23
- graphql: z.ZodOptional<z.ZodArray<z.ZodObject<{
24
- filterSuffix: z.ZodOptional<z.ZodString>;
25
- generation: z.ZodOptional<z.ZodEnum<{
26
- gen1: "gen1";
27
- gen2: "gen2";
28
- gen3: "gen3";
29
- }>>;
30
- id: z.ZodOptional<z.ZodString>;
31
- nonNullDocumentFields: z.ZodOptional<z.ZodBoolean>;
32
- playground: z.ZodOptional<z.ZodBoolean>;
33
- source: z.ZodOptional<z.ZodString>;
34
- tag: z.ZodOptional<z.ZodString>;
35
- workspace: z.ZodOptional<z.ZodString>;
36
- }, z.core.$strip>>>;
37
- mediaLibrary: z.ZodOptional<z.ZodObject<{
38
- aspectsPath: z.ZodOptional<z.ZodString>;
39
- }, z.core.$strip>>;
40
- project: z.ZodOptional<z.ZodObject<{
41
- basePath: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>>;
43
- reactCompiler: z.ZodOptional<z.ZodCustom<Partial<{
44
- environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
45
- logger: import("babel-plugin-react-compiler").Logger | null;
46
- gating: import("babel-plugin-react-compiler").ExternalFunction | null;
47
- dynamicGating: {
48
- source: string;
49
- } | null;
50
- panicThreshold: "none" | "all_errors" | "critical_errors";
51
- noEmit: boolean;
52
- compilationMode: "syntax" | "infer" | "annotation" | "all";
53
- eslintSuppressionRules: Array<string> | null | undefined;
54
- flowSuppressions: boolean;
55
- ignoreUseNoForget: boolean;
56
- customOptOutDirectives: string[] | null;
57
- sources: Array<string> | ((filename: string) => boolean) | null;
58
- enableReanimatedCheck: boolean;
59
- target: "17" | "18" | "19" | {
60
- kind: "donotuse_meta_internal";
61
- runtimeModule: string;
62
- };
63
- }>, Partial<{
64
- environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
65
- logger: import("babel-plugin-react-compiler").Logger | null;
66
- gating: import("babel-plugin-react-compiler").ExternalFunction | null;
67
- dynamicGating: {
68
- source: string;
69
- } | null;
70
- panicThreshold: "none" | "all_errors" | "critical_errors";
71
- noEmit: boolean;
72
- compilationMode: "syntax" | "infer" | "annotation" | "all";
73
- eslintSuppressionRules: Array<string> | null | undefined;
74
- flowSuppressions: boolean;
75
- ignoreUseNoForget: boolean;
76
- customOptOutDirectives: string[] | null;
77
- sources: Array<string> | ((filename: string) => boolean) | null;
78
- enableReanimatedCheck: boolean;
79
- target: "17" | "18" | "19" | {
80
- kind: "donotuse_meta_internal";
81
- runtimeModule: string;
82
- };
83
- }>>>;
84
- reactStrictMode: z.ZodOptional<z.ZodBoolean>;
85
- server: z.ZodOptional<z.ZodObject<{
86
- hostname: z.ZodOptional<z.ZodString>;
87
- port: z.ZodOptional<z.ZodNumber>;
88
- }, z.core.$strip>>;
89
- studioHost: z.ZodOptional<z.ZodString>;
90
- vite: z.ZodOptional<z.ZodCustom<UserViteConfig, UserViteConfig>>;
91
- typegen: z.ZodOptional<z.ZodCustom<{
92
- path: string | string[];
93
- schema: string;
94
- generates: string;
95
- formatGeneratedCode: boolean;
96
- overloadClientMethods: boolean;
97
- }, {
98
- path: string | string[];
99
- schema: string;
100
- generates: string;
101
- formatGeneratedCode: boolean;
102
- overloadClientMethods: boolean;
103
- }>>;
104
- }, z.core.$strip>;
@@ -1,83 +0,0 @@
1
- import { type TypeGenConfig } from '@sanity/codegen';
2
- import { type PluginOptions as ReactCompilerConfig } from 'babel-plugin-react-compiler';
3
- import { type UserViteConfig } from './userViteConfig';
4
- /**
5
- * @public
6
- */
7
- export interface CliConfig {
8
- /** The project ID and dataset the Sanity CLI should use to run its commands */
9
- api?: {
10
- dataset?: string;
11
- projectId?: string;
12
- };
13
- /** Configuration for custom Sanity apps built with the App SDK */
14
- app?: {
15
- /** The entrypoint for your custom app. By default, `src/App.tsx` */
16
- entry?: string;
17
- /** String encoding of an icon (typically an SVG) */
18
- icon?: string;
19
- /** @deprecated Use deployment.appId */
20
- id?: string;
21
- /** The ID for the Sanity organization that manages this application */
22
- organizationId?: string;
23
- /** The title of the custom app. Used in Dashboard and in the browser tab */
24
- title?: string;
25
- };
26
- /** @deprecated Use deployment.autoUpdates */
27
- autoUpdates?: boolean;
28
- /** Options for custom app and Studio deployments */
29
- deployment?: {
30
- /**
31
- * The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.
32
- * Get your app ID by either:
33
- * 1. Checking the output of `sanity deploy`, or
34
- * 2. Checking your project’s Studio tab at https://sanity.io/manage
35
- *
36
- * @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.
37
- * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}
38
- */
39
- appId?: string;
40
- /**
41
- * Enable automatic updates for your Studio or custom app’s Sanity dependencies.
42
- * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}
43
- */
44
- autoUpdates?: boolean;
45
- };
46
- /** Define the GraphQL APIs that the CLI can deploy and interact with */
47
- graphql?: Array<{
48
- filterSuffix?: string;
49
- generation?: 'gen1' | 'gen2' | 'gen3';
50
- id?: string;
51
- nonNullDocumentFields?: boolean;
52
- playground?: boolean;
53
- source?: string;
54
- tag?: string;
55
- workspace?: string;
56
- }>;
57
- /** Configuration for the Media Library */
58
- mediaLibrary?: {
59
- /** The path to the Media Library aspects directory. When using the CLI to manage aspects, this is the directory they will be read from and written to. */
60
- aspectsPath?: string;
61
- };
62
- /** Contains the property `basePath` which lets you change the top-level slug for the Studio. You typically need to set this if you embed the Studio in another application where it is one of many routes. Defaults to an empty string. */
63
- project?: {
64
- basePath?: string;
65
- };
66
- /** Configuration options for React Compiler */
67
- reactCompiler?: ReactCompilerConfig;
68
- /** Wraps the Studio in \<React.StrictMode\> root to aid in flagging potential problems related to concurrent features (startTransition, useTransition, useDeferredValue, Suspense). Can also be enabled by setting SANITY_STUDIO_REACT_STRICT_MODE="true"|"false". It only applies to sanity dev in development mode and is ignored in sanity build and in production. Defaults to false. */
69
- reactStrictMode?: boolean;
70
- /** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */
71
- server?: {
72
- hostname?: string;
73
- port?: number;
74
- };
75
- /** @deprecated Use deployment.appId */
76
- studioHost?: string;
77
- /**
78
- * Configuration for Sanity typegen
79
- */
80
- typegen?: Partial<TypeGenConfig>;
81
- /** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */
82
- vite?: UserViteConfig;
83
- }