@sanity/cli-core 0.0.2-alpha.0 → 0.0.2-alpha.2

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 (71) hide show
  1. package/dist/SanityCommand.d.ts +1 -1
  2. package/dist/SanityCommand.js.map +1 -1
  3. package/dist/config/__tests__/findProjectRootSync.test.js +112 -0
  4. package/dist/config/__tests__/findProjectRootSync.test.js.map +1 -0
  5. package/dist/config/__tests__/getCliConfigSync.test.js +31 -0
  6. package/dist/config/__tests__/getCliConfigSync.test.js.map +1 -0
  7. package/dist/config/cli/getCliConfig.d.ts +1 -1
  8. package/dist/config/cli/getCliConfig.js +9 -8
  9. package/dist/config/cli/getCliConfig.js.map +1 -1
  10. package/dist/config/cli/getCliConfigSync.d.ts +12 -0
  11. package/dist/config/cli/getCliConfigSync.js +51 -0
  12. package/dist/config/cli/getCliConfigSync.js.map +1 -0
  13. package/dist/config/cli/schemas.d.ts +121 -70
  14. package/dist/config/cli/schemas.js +13 -41
  15. package/dist/config/cli/schemas.js.map +1 -1
  16. package/dist/config/cli/types/cliConfig.d.ts +74 -0
  17. package/dist/config/cli/types/cliConfig.js +5 -0
  18. package/dist/config/cli/types/cliConfig.js.map +1 -0
  19. package/dist/config/cli/types/userViteConfig.d.ts +5 -0
  20. package/dist/config/cli/types/userViteConfig.js +5 -0
  21. package/dist/config/cli/types/userViteConfig.js.map +1 -0
  22. package/dist/config/findProjectRootSync.d.ts +27 -0
  23. package/dist/config/findProjectRootSync.js +82 -0
  24. package/dist/config/findProjectRootSync.js.map +1 -0
  25. package/dist/config/studio/readStudioConfig.worker.js +2 -16
  26. package/dist/config/studio/readStudioConfig.worker.js.map +1 -1
  27. package/dist/config/util/configPathsSync.d.ts +17 -0
  28. package/dist/config/util/configPathsSync.js +85 -0
  29. package/dist/config/util/configPathsSync.js.map +1 -0
  30. package/dist/config/util/isSanityV2StudioRoot.js +3 -0
  31. package/dist/config/util/isSanityV2StudioRoot.js.map +1 -1
  32. package/dist/index.d.ts +9 -1
  33. package/dist/index.js +7 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/loaders/studio/studioWorkerLoader.worker.js +9 -27
  36. package/dist/loaders/studio/studioWorkerLoader.worker.js.map +1 -1
  37. package/dist/services/apiClient.d.ts +19 -5
  38. package/dist/services/apiClient.js +18 -14
  39. package/dist/services/apiClient.js.map +1 -1
  40. package/dist/util/__tests__/createExpiringConfig.test.js +91 -0
  41. package/dist/util/__tests__/createExpiringConfig.test.js.map +1 -1
  42. package/dist/util/createExpiringConfig.d.ts +6 -1
  43. package/dist/util/createExpiringConfig.js +28 -3
  44. package/dist/util/createExpiringConfig.js.map +1 -1
  45. package/dist/util/environment/getStudioEnvironmentVariables.d.ts +12 -0
  46. package/dist/util/environment/getStudioEnvironmentVariables.js +33 -0
  47. package/dist/util/environment/getStudioEnvironmentVariables.js.map +1 -0
  48. package/dist/util/environment/mockBrowserEnvironment.d.ts +17 -0
  49. package/dist/util/environment/mockBrowserEnvironment.js +46 -0
  50. package/dist/util/environment/mockBrowserEnvironment.js.map +1 -0
  51. package/dist/util/environment/setupBrowserStubs.d.ts +10 -0
  52. package/dist/util/environment/setupBrowserStubs.js +43 -0
  53. package/dist/util/environment/setupBrowserStubs.js.map +1 -0
  54. package/dist/{loaders/studio → util/environment}/stubs.d.ts +6 -6
  55. package/dist/util/environment/stubs.js.map +1 -0
  56. package/dist/util/getEmptyAuth.d.ts +5 -0
  57. package/dist/util/getEmptyAuth.js +16 -0
  58. package/dist/util/getEmptyAuth.js.map +1 -0
  59. package/dist/util/readJsonFile.d.ts +7 -1
  60. package/dist/util/readJsonFile.js.map +1 -1
  61. package/dist/util/safeStructuredClone.js +3 -0
  62. package/dist/util/safeStructuredClone.js.map +1 -1
  63. package/dist/util/tryGetDefaultExport.d.ts +5 -0
  64. package/dist/util/tryGetDefaultExport.js +18 -0
  65. package/dist/util/tryGetDefaultExport.js.map +1 -0
  66. package/package.json +10 -9
  67. package/dist/config/cli/types.d.ts +0 -13
  68. package/dist/config/cli/types.js +0 -3
  69. package/dist/config/cli/types.js.map +0 -1
  70. package/dist/loaders/studio/stubs.js.map +0 -1
  71. /package/dist/{loaders/studio → util/environment}/stubs.js +0 -0
@@ -1,42 +1,10 @@
1
1
  import { z } from 'zod';
2
- export const reactCompilerSchema = z.object({
3
- compilationMode: z.enum([
4
- 'all',
5
- 'annotation',
6
- 'infer',
7
- 'syntax'
8
- ]).optional(),
9
- panicThreshold: z.enum([
10
- 'ALL_ERRORS',
11
- 'CRITICAL_ERRORS',
12
- 'NONE'
13
- ]).optional(),
14
- /**
15
- * @see https://react.dev/learn/react-compiler#existing-projects
16
- */ sources: z.union([
17
- z.function().args(z.string()).returns(z.boolean()),
18
- z.array(z.string()),
19
- z.null()
20
- ]).optional(),
21
- /**
22
- * The minimum major version of React that the compiler should emit code for. If the target is 19
23
- * or higher, the compiler emits direct imports of React runtime APIs needed by the compiler. On
24
- * versions prior to 19, an extra runtime package react-compiler-runtime is necessary to provide
25
- * a userspace approximation of runtime APIs.
26
- * @see https://react.dev/learn/react-compiler#using-react-compiler-with-react-17-or-18
27
- */ target: z.enum([
28
- '18',
29
- '19'
30
- ])
31
- }).optional();
32
- export const cliConfigSchema = z.object({
33
- /**
34
- * API configuration
35
- */ api: z.object({
2
+ /**
3
+ * @public
4
+ */ export const cliConfigSchema = z.object({
5
+ api: z.object({
36
6
  dataset: z.string().optional(),
37
7
  projectId: z.string().optional()
38
- }, {
39
- description: 'API configuration'
40
8
  }).optional(),
41
9
  app: z.object({
42
10
  entry: z.string().optional(),
@@ -44,6 +12,10 @@ export const cliConfigSchema = z.object({
44
12
  organizationId: z.string().optional()
45
13
  }).optional(),
46
14
  autoUpdates: z.boolean().optional(),
15
+ deployment: z.object({
16
+ appId: z.string().optional(),
17
+ autoUpdates: z.boolean().optional()
18
+ }).optional(),
47
19
  graphql: z.array(z.object({
48
20
  filterSuffix: z.string().optional(),
49
21
  generation: z.enum([
@@ -58,20 +30,20 @@ export const cliConfigSchema = z.object({
58
30
  tag: z.string().optional(),
59
31
  workspace: z.string().optional()
60
32
  })).optional(),
33
+ mediaLibrary: z.object({
34
+ aspectsPath: z.string().optional()
35
+ }).optional(),
61
36
  project: z.object({
62
37
  basePath: z.string().optional()
63
38
  }).optional(),
64
- reactCompiler: reactCompilerSchema,
39
+ reactCompiler: z.custom().optional(),
65
40
  reactStrictMode: z.boolean().optional(),
66
41
  server: z.object({
67
42
  hostname: z.string().optional(),
68
43
  port: z.number().optional()
69
44
  }).optional(),
70
45
  studioHost: z.string().optional(),
71
- vite: z.union([
72
- z.function(),
73
- z.object({}).passthrough()
74
- ]).optional()
46
+ vite: z.custom().optional()
75
47
  });
76
48
 
77
49
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {z} from 'zod'\n\nexport const reactCompilerSchema = z\n .object({\n compilationMode: z.enum(['all', 'annotation', 'infer', 'syntax']).optional(),\n panicThreshold: z.enum(['ALL_ERRORS', 'CRITICAL_ERRORS', 'NONE']).optional(),\n /**\n * @see https://react.dev/learn/react-compiler#existing-projects\n */\n sources: z\n .union([z.function().args(z.string()).returns(z.boolean()), z.array(z.string()), z.null()])\n .optional(),\n /**\n * The minimum major version of React that the compiler should emit code for. If the target is 19\n * or higher, the compiler emits direct imports of React runtime APIs needed by the compiler. On\n * versions prior to 19, an extra runtime package react-compiler-runtime is necessary to provide\n * a userspace approximation of runtime APIs.\n * @see https://react.dev/learn/react-compiler#using-react-compiler-with-react-17-or-18\n */\n target: z.enum(['18', '19']),\n })\n .optional()\n\nexport const cliConfigSchema = z.object({\n /**\n * API configuration\n */\n api: z\n .object(\n {\n dataset: z.string().optional(),\n projectId: z.string().optional(),\n },\n {description: 'API configuration'},\n )\n .optional(),\n\n app: z\n .object({\n entry: z.string().optional(),\n id: z.string().optional(),\n organizationId: z.string().optional(),\n })\n .optional(),\n\n autoUpdates: z.boolean().optional(),\n\n graphql: z\n .array(\n z.object({\n filterSuffix: z.string().optional(),\n generation: z.enum(['gen1', 'gen2', 'gen3']).optional(),\n id: z.string().optional(),\n nonNullDocumentFields: z.boolean().optional(),\n playground: z.boolean().optional(),\n source: z.string().optional(),\n tag: z.string().optional(),\n workspace: z.string().optional(),\n }),\n )\n .optional(),\n\n project: z\n .object({\n basePath: z.string().optional(),\n })\n .optional(),\n\n reactCompiler: reactCompilerSchema,\n\n reactStrictMode: z.boolean().optional(),\n\n server: z\n .object({\n hostname: z.string().optional(),\n port: z.number().optional(),\n })\n .optional(),\n\n studioHost: z.string().optional(),\n\n vite: z.union([z.function(), z.object({}).passthrough()]).optional(),\n})\n"],"names":["z","reactCompilerSchema","object","compilationMode","enum","optional","panicThreshold","sources","union","function","args","string","returns","boolean","array","null","target","cliConfigSchema","api","dataset","projectId","description","app","entry","id","organizationId","autoUpdates","graphql","filterSuffix","generation","nonNullDocumentFields","playground","source","tag","workspace","project","basePath","reactCompiler","reactStrictMode","server","hostname","port","number","studioHost","vite","passthrough"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAK;AAErB,OAAO,MAAMC,sBAAsBD,EAChCE,MAAM,CAAC;IACNC,iBAAiBH,EAAEI,IAAI,CAAC;QAAC;QAAO;QAAc;QAAS;KAAS,EAAEC,QAAQ;IAC1EC,gBAAgBN,EAAEI,IAAI,CAAC;QAAC;QAAc;QAAmB;KAAO,EAAEC,QAAQ;IAC1E;;KAEC,GACDE,SAASP,EACNQ,KAAK,CAAC;QAACR,EAAES,QAAQ,GAAGC,IAAI,CAACV,EAAEW,MAAM,IAAIC,OAAO,CAACZ,EAAEa,OAAO;QAAKb,EAAEc,KAAK,CAACd,EAAEW,MAAM;QAAKX,EAAEe,IAAI;KAAG,EACzFV,QAAQ;IACX;;;;;;KAMC,GACDW,QAAQhB,EAAEI,IAAI,CAAC;QAAC;QAAM;KAAK;AAC7B,GACCC,QAAQ,GAAE;AAEb,OAAO,MAAMY,kBAAkBjB,EAAEE,MAAM,CAAC;IACtC;;GAEC,GACDgB,KAAKlB,EACFE,MAAM,CACL;QACEiB,SAASnB,EAAEW,MAAM,GAAGN,QAAQ;QAC5Be,WAAWpB,EAAEW,MAAM,GAAGN,QAAQ;IAChC,GACA;QAACgB,aAAa;IAAmB,GAElChB,QAAQ;IAEXiB,KAAKtB,EACFE,MAAM,CAAC;QACNqB,OAAOvB,EAAEW,MAAM,GAAGN,QAAQ;QAC1BmB,IAAIxB,EAAEW,MAAM,GAAGN,QAAQ;QACvBoB,gBAAgBzB,EAAEW,MAAM,GAAGN,QAAQ;IACrC,GACCA,QAAQ;IAEXqB,aAAa1B,EAAEa,OAAO,GAAGR,QAAQ;IAEjCsB,SAAS3B,EACNc,KAAK,CACJd,EAAEE,MAAM,CAAC;QACP0B,cAAc5B,EAAEW,MAAM,GAAGN,QAAQ;QACjCwB,YAAY7B,EAAEI,IAAI,CAAC;YAAC;YAAQ;YAAQ;SAAO,EAAEC,QAAQ;QACrDmB,IAAIxB,EAAEW,MAAM,GAAGN,QAAQ;QACvByB,uBAAuB9B,EAAEa,OAAO,GAAGR,QAAQ;QAC3C0B,YAAY/B,EAAEa,OAAO,GAAGR,QAAQ;QAChC2B,QAAQhC,EAAEW,MAAM,GAAGN,QAAQ;QAC3B4B,KAAKjC,EAAEW,MAAM,GAAGN,QAAQ;QACxB6B,WAAWlC,EAAEW,MAAM,GAAGN,QAAQ;IAChC,IAEDA,QAAQ;IAEX8B,SAASnC,EACNE,MAAM,CAAC;QACNkC,UAAUpC,EAAEW,MAAM,GAAGN,QAAQ;IAC/B,GACCA,QAAQ;IAEXgC,eAAepC;IAEfqC,iBAAiBtC,EAAEa,OAAO,GAAGR,QAAQ;IAErCkC,QAAQvC,EACLE,MAAM,CAAC;QACNsC,UAAUxC,EAAEW,MAAM,GAAGN,QAAQ;QAC7BoC,MAAMzC,EAAE0C,MAAM,GAAGrC,QAAQ;IAC3B,GACCA,QAAQ;IAEXsC,YAAY3C,EAAEW,MAAM,GAAGN,QAAQ;IAE/BuC,MAAM5C,EAAEQ,KAAK,CAAC;QAACR,EAAES,QAAQ;QAAIT,EAAEE,MAAM,CAAC,CAAC,GAAG2C,WAAW;KAAG,EAAExC,QAAQ;AACpE,GAAE"}
1
+ {"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\nimport {z} from 'zod'\n\nimport {type CliConfig} from './types/cliConfig'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z\n .object({\n dataset: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n\n app: z\n .object({\n entry: z.string().optional(),\n id: z.string().optional(),\n organizationId: z.string().optional(),\n })\n .optional(),\n\n autoUpdates: z.boolean().optional(),\n\n deployment: z\n .object({\n appId: z.string().optional(),\n autoUpdates: z.boolean().optional(),\n })\n .optional(),\n\n graphql: z\n .array(\n z.object({\n filterSuffix: z.string().optional(),\n generation: z.enum(['gen1', 'gen2', 'gen3']).optional(),\n id: z.string().optional(),\n nonNullDocumentFields: z.boolean().optional(),\n playground: z.boolean().optional(),\n source: z.string().optional(),\n tag: z.string().optional(),\n workspace: z.string().optional(),\n }),\n )\n .optional(),\n\n mediaLibrary: z\n .object({\n aspectsPath: z.string().optional(),\n })\n .optional(),\n\n project: z\n .object({\n basePath: z.string().optional(),\n })\n .optional(),\n\n reactCompiler: z.custom<ReactCompilerConfig>().optional(),\n\n reactStrictMode: z.boolean().optional(),\n\n server: z\n .object({\n hostname: z.string().optional(),\n port: z.number().optional(),\n })\n .optional(),\n\n studioHost: z.string().optional(),\n\n vite: z.custom<UserViteConfig>().optional(),\n}) satisfies z.ZodType<CliConfig>\n"],"names":["z","cliConfigSchema","object","api","dataset","string","optional","projectId","app","entry","id","organizationId","autoUpdates","boolean","deployment","appId","graphql","array","filterSuffix","generation","enum","nonNullDocumentFields","playground","source","tag","workspace","mediaLibrary","aspectsPath","project","basePath","reactCompiler","custom","reactStrictMode","server","hostname","port","number","studioHost","vite"],"mappings":"AACA,SAAQA,CAAC,QAAO,MAAK;AAKrB;;CAEC,GACD,OAAO,MAAMC,kBAAkBD,EAAEE,MAAM,CAAC;IACtCC,KAAKH,EACFE,MAAM,CAAC;QACNE,SAASJ,EAAEK,MAAM,GAAGC,QAAQ;QAC5BC,WAAWP,EAAEK,MAAM,GAAGC,QAAQ;IAChC,GACCA,QAAQ;IAEXE,KAAKR,EACFE,MAAM,CAAC;QACNO,OAAOT,EAAEK,MAAM,GAAGC,QAAQ;QAC1BI,IAAIV,EAAEK,MAAM,GAAGC,QAAQ;QACvBK,gBAAgBX,EAAEK,MAAM,GAAGC,QAAQ;IACrC,GACCA,QAAQ;IAEXM,aAAaZ,EAAEa,OAAO,GAAGP,QAAQ;IAEjCQ,YAAYd,EACTE,MAAM,CAAC;QACNa,OAAOf,EAAEK,MAAM,GAAGC,QAAQ;QAC1BM,aAAaZ,EAAEa,OAAO,GAAGP,QAAQ;IACnC,GACCA,QAAQ;IAEXU,SAAShB,EACNiB,KAAK,CACJjB,EAAEE,MAAM,CAAC;QACPgB,cAAclB,EAAEK,MAAM,GAAGC,QAAQ;QACjCa,YAAYnB,EAAEoB,IAAI,CAAC;YAAC;YAAQ;YAAQ;SAAO,EAAEd,QAAQ;QACrDI,IAAIV,EAAEK,MAAM,GAAGC,QAAQ;QACvBe,uBAAuBrB,EAAEa,OAAO,GAAGP,QAAQ;QAC3CgB,YAAYtB,EAAEa,OAAO,GAAGP,QAAQ;QAChCiB,QAAQvB,EAAEK,MAAM,GAAGC,QAAQ;QAC3BkB,KAAKxB,EAAEK,MAAM,GAAGC,QAAQ;QACxBmB,WAAWzB,EAAEK,MAAM,GAAGC,QAAQ;IAChC,IAEDA,QAAQ;IAEXoB,cAAc1B,EACXE,MAAM,CAAC;QACNyB,aAAa3B,EAAEK,MAAM,GAAGC,QAAQ;IAClC,GACCA,QAAQ;IAEXsB,SAAS5B,EACNE,MAAM,CAAC;QACN2B,UAAU7B,EAAEK,MAAM,GAAGC,QAAQ;IAC/B,GACCA,QAAQ;IAEXwB,eAAe9B,EAAE+B,MAAM,GAAwBzB,QAAQ;IAEvD0B,iBAAiBhC,EAAEa,OAAO,GAAGP,QAAQ;IAErC2B,QAAQjC,EACLE,MAAM,CAAC;QACNgC,UAAUlC,EAAEK,MAAM,GAAGC,QAAQ;QAC7B6B,MAAMnC,EAAEoC,MAAM,GAAG9B,QAAQ;IAC3B,GACCA,QAAQ;IAEX+B,YAAYrC,EAAEK,MAAM,GAAGC,QAAQ;IAE/BgC,MAAMtC,EAAE+B,MAAM,GAAmBzB,QAAQ;AAC3C,GAAiC"}
@@ -0,0 +1,74 @@
1
+ import { type PluginOptions as ReactCompilerConfig } from 'babel-plugin-react-compiler';
2
+ import { type UserViteConfig } from './userViteConfig';
3
+ /**
4
+ * @public
5
+ */
6
+ export interface CliConfig {
7
+ /** The project ID and dataset the Sanity CLI should use to run its commands */
8
+ api?: {
9
+ dataset?: string;
10
+ projectId?: string;
11
+ };
12
+ /** Configuration for custom Sanity apps built with the App SDK */
13
+ app?: {
14
+ /** The entrypoint for your custom app. By default, `src/App.tsx` */
15
+ entry?: string;
16
+ /** @deprecated Use deployment.appId */
17
+ id?: string;
18
+ /** The ID for the Sanity organization that manages this application */
19
+ organizationId?: string;
20
+ };
21
+ /** @deprecated Use deployment.autoUpdates */
22
+ autoUpdates?: boolean;
23
+ /** Options for custom app and Studio deployments */
24
+ deployment?: {
25
+ /**
26
+ * The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.
27
+ * Get your app ID by either:
28
+ * 1. Checking the output of `sanity deploy`, or
29
+ * 2. Checking your project’s Studio tab at https://sanity.io/manage
30
+ *
31
+ * @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.
32
+ * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}
33
+ */
34
+ appId?: string;
35
+ /**
36
+ * Enable automatic updates for your Studio or custom app’s Sanity dependencies.
37
+ * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}
38
+ */
39
+ autoUpdates?: boolean;
40
+ };
41
+ /** Define the GraphQL APIs that the CLI can deploy and interact with */
42
+ graphql?: Array<{
43
+ filterSuffix?: string;
44
+ generation?: 'gen1' | 'gen2' | 'gen3';
45
+ id?: string;
46
+ nonNullDocumentFields?: boolean;
47
+ playground?: boolean;
48
+ source?: string;
49
+ tag?: string;
50
+ workspace?: string;
51
+ }>;
52
+ /** Configuration for the Media Library */
53
+ mediaLibrary?: {
54
+ /** 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. */
55
+ aspectsPath?: string;
56
+ };
57
+ /** 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. */
58
+ project?: {
59
+ basePath?: string;
60
+ };
61
+ /** Configuration options for React Compiler */
62
+ reactCompiler?: ReactCompilerConfig;
63
+ /** 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. */
64
+ reactStrictMode?: boolean;
65
+ /** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */
66
+ server?: {
67
+ hostname?: string;
68
+ port?: number;
69
+ };
70
+ /** @deprecated Use deployment.appId */
71
+ studioHost?: string;
72
+ /** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */
73
+ vite?: UserViteConfig;
74
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @public
3
+ */ export { };
4
+
5
+ //# sourceMappingURL=cliConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/config/cli/types/cliConfig.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\n\nimport {type UserViteConfig} from './userViteConfig'\n\n/**\n * @public\n */\nexport interface CliConfig {\n /** The project ID and dataset the Sanity CLI should use to run its commands */\n api?: {\n dataset?: string\n projectId?: string\n }\n\n /** Configuration for custom Sanity apps built with the App SDK */\n app?: {\n /** The entrypoint for your custom app. By default, `src/App.tsx` */\n entry?: string\n /** @deprecated Use deployment.appId */\n id?: string\n /** The ID for the Sanity organization that manages this application */\n organizationId?: string\n }\n\n /** @deprecated Use deployment.autoUpdates */\n autoUpdates?: boolean\n\n /** Options for custom app and Studio deployments */\n deployment?: {\n /**\n * The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.\n * Get your app ID by either:\n * 1. Checking the output of `sanity deploy`, or\n * 2. Checking your project’s Studio tab at https://sanity.io/manage\n *\n * @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.\n * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}\n */\n appId?: string\n /**\n * Enable automatic updates for your Studio or custom app’s Sanity dependencies.\n * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}\n */\n autoUpdates?: boolean\n }\n\n /** Define the GraphQL APIs that the CLI can deploy and interact with */\n graphql?: Array<{\n filterSuffix?: string\n generation?: 'gen1' | 'gen2' | 'gen3'\n id?: string\n nonNullDocumentFields?: boolean\n playground?: boolean\n source?: string\n tag?: string\n workspace?: string\n }>\n\n /** Configuration for the Media Library */\n mediaLibrary?: {\n /** 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. */\n aspectsPath?: string\n }\n\n /** 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. */\n project?: {\n basePath?: string\n }\n\n /** Configuration options for React Compiler */\n reactCompiler?: ReactCompilerConfig\n\n /** 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. */\n reactStrictMode?: boolean\n\n /** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */\n server?: {\n hostname?: string\n port?: number\n }\n\n /** @deprecated Use deployment.appId */\n studioHost?: string\n\n /** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */\n vite?: UserViteConfig\n}\n"],"names":[],"mappings":"AAIA;;CAEC,GACD,WA+EC"}
@@ -0,0 +1,5 @@
1
+ import { type ConfigEnv, type InlineConfig } from 'vite';
2
+ /**
3
+ * @public
4
+ */
5
+ export type UserViteConfig = ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>) | InlineConfig;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @public
3
+ */ export { };
4
+
5
+ //# sourceMappingURL=userViteConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/config/cli/types/userViteConfig.ts"],"sourcesContent":["import {type ConfigEnv, type InlineConfig} from 'vite'\n\n/**\n * @public\n */\nexport type UserViteConfig =\n | ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>)\n | InlineConfig\n"],"names":[],"mappings":"AAEA;;CAEC,GACD,WAEgB"}
@@ -0,0 +1,27 @@
1
+ import { ProjectRootResult } from './util/recursivelyResolveProjectRoot.js';
2
+ /**
3
+ * Generic recursive search function for project configuration files (synchronous version).
4
+ *
5
+ * @param basePath - The base path to start searching from
6
+ * @param findConfigFn - Function that looks for config files in a given directory
7
+ * @param projectType - The type of project ('app' | 'studio')
8
+ * @param iterations - Current iteration count, passed internally to prevent infinite recursion
9
+ * @returns An object if config is found, false otherwise
10
+ * @internal
11
+ */
12
+ export declare function recursivelyResolveProjectRootSync(basePath: string, findConfigFn: (path: string) => string | undefined, projectType: 'app' | 'studio', iterations?: number): false | ProjectRootResult;
13
+ /**
14
+ * Resolve project root directory and type synchronously.
15
+ *
16
+ * Project root is:
17
+ * - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)
18
+ * - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)
19
+ *
20
+ * If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),
21
+ * an error is thrown, as v2/v1 is no longer supported.
22
+ *
23
+ * @param cwd - Current working directory to start searching from
24
+ * @returns Project root result
25
+ * @internal
26
+ */
27
+ export declare function findProjectRootSync(cwd: string): ProjectRootResult;
@@ -0,0 +1,82 @@
1
+ import { dirname, resolve } from 'node:path';
2
+ import { findAppConfigPathSync, findStudioConfigPathSync } from './util/configPathsSync.js';
3
+ /**
4
+ * Generic recursive search function for project configuration files (synchronous version).
5
+ *
6
+ * @param basePath - The base path to start searching from
7
+ * @param findConfigFn - Function that looks for config files in a given directory
8
+ * @param projectType - The type of project ('app' | 'studio')
9
+ * @param iterations - Current iteration count, passed internally to prevent infinite recursion
10
+ * @returns An object if config is found, false otherwise
11
+ * @internal
12
+ */ export function recursivelyResolveProjectRootSync(basePath, findConfigFn, projectType, iterations = 0) {
13
+ const configPath = findConfigFn(basePath);
14
+ if (configPath) {
15
+ return {
16
+ directory: dirname(configPath),
17
+ path: configPath,
18
+ type: projectType
19
+ };
20
+ }
21
+ const parentDir = resolve(basePath, '..');
22
+ if (parentDir === basePath || iterations > 50) {
23
+ // Reached root (or max depth), give up
24
+ return false;
25
+ }
26
+ return recursivelyResolveProjectRootSync(parentDir, findConfigFn, projectType, iterations + 1);
27
+ }
28
+ /**
29
+ * Resolve project root directory and type synchronously.
30
+ *
31
+ * Project root is:
32
+ * - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)
33
+ * - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)
34
+ *
35
+ * If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),
36
+ * an error is thrown, as v2/v1 is no longer supported.
37
+ *
38
+ * @param cwd - Current working directory to start searching from
39
+ * @returns Project root result
40
+ * @internal
41
+ */ export function findProjectRootSync(cwd) {
42
+ try {
43
+ // First try to find a studio project root, looks for `sanity.config.(ts|js)`
44
+ const studioProjectRoot = resolveProjectRootForStudioSync(cwd);
45
+ if (studioProjectRoot) {
46
+ return studioProjectRoot;
47
+ }
48
+ // Second try to find a app project root, looks for `sanity.cli.(ts|js)`
49
+ const appProjectRoot = resolveProjectRootForAppSync(cwd);
50
+ if (appProjectRoot) {
51
+ return appProjectRoot;
52
+ }
53
+ // If nothing is found throw an error
54
+ throw new Error(`No project root found in ${cwd}`);
55
+ } catch (err) {
56
+ const message = err instanceof Error ? err.message : `${err}`;
57
+ throw new Error(`Error occurred trying to resolve project root:\n${message}`);
58
+ }
59
+ }
60
+ /**
61
+ * Recursively searches for a project configuration file in the given directory and its parents.
62
+ * Throws if Sanity v2 studio root is found.
63
+ *
64
+ * @param basePath - The base path to start searching from
65
+ * @param iterations - Current iteration count, passed internally to prevent infinite recursion.
66
+ * @returns An object if config is found, false otherwise
67
+ * @internal
68
+ */ function resolveProjectRootForStudioSync(basePath, iterations = 0) {
69
+ return recursivelyResolveProjectRootSync(basePath, findStudioConfigPathSync, 'studio', iterations);
70
+ }
71
+ /**
72
+ * Recursively searches for a app project configuration file in the given directory and its parents.
73
+ *
74
+ * @param basePath - The base path to start searching from
75
+ * @param iterations - Current iteration count, passed internally to prevent infinite recursion.
76
+ * @returns An object if config is found, false otherwise
77
+ * @internal
78
+ */ function resolveProjectRootForAppSync(basePath, iterations = 0) {
79
+ return recursivelyResolveProjectRootSync(basePath, findAppConfigPathSync, 'app', iterations);
80
+ }
81
+
82
+ //# sourceMappingURL=findProjectRootSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/findProjectRootSync.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path'\n\nimport {findAppConfigPathSync, findStudioConfigPathSync} from './util/configPathsSync.js'\nimport {ProjectRootResult} from './util/recursivelyResolveProjectRoot.js'\n\n/**\n * Generic recursive search function for project configuration files (synchronous version).\n *\n * @param basePath - The base path to start searching from\n * @param findConfigFn - Function that looks for config files in a given directory\n * @param projectType - The type of project ('app' | 'studio')\n * @param iterations - Current iteration count, passed internally to prevent infinite recursion\n * @returns An object if config is found, false otherwise\n * @internal\n */\nexport function recursivelyResolveProjectRootSync(\n basePath: string,\n findConfigFn: (path: string) => string | undefined,\n projectType: 'app' | 'studio',\n iterations = 0,\n): false | ProjectRootResult {\n const configPath = findConfigFn(basePath)\n\n if (configPath) {\n return {\n directory: dirname(configPath),\n path: configPath,\n type: projectType,\n }\n }\n\n const parentDir = resolve(basePath, '..')\n if (parentDir === basePath || iterations > 50) {\n // Reached root (or max depth), give up\n return false\n }\n\n return recursivelyResolveProjectRootSync(parentDir, findConfigFn, projectType, iterations + 1)\n}\n\n/**\n * Resolve project root directory and type synchronously.\n *\n * Project root is:\n * - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)\n * - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)\n *\n * If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),\n * an error is thrown, as v2/v1 is no longer supported.\n *\n * @param cwd - Current working directory to start searching from\n * @returns Project root result\n * @internal\n */\nexport function findProjectRootSync(cwd: string): ProjectRootResult {\n try {\n // First try to find a studio project root, looks for `sanity.config.(ts|js)`\n const studioProjectRoot = resolveProjectRootForStudioSync(cwd)\n if (studioProjectRoot) {\n return studioProjectRoot\n }\n\n // Second try to find a app project root, looks for `sanity.cli.(ts|js)`\n const appProjectRoot = resolveProjectRootForAppSync(cwd)\n if (appProjectRoot) {\n return appProjectRoot\n }\n\n // If nothing is found throw an error\n throw new Error(`No project root found in ${cwd}`)\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : `${err}`\n throw new Error(`Error occurred trying to resolve project root:\\n${message}`)\n }\n}\n\n/**\n * Recursively searches for a project configuration file in the given directory and its parents.\n * Throws if Sanity v2 studio root is found.\n *\n * @param basePath - The base path to start searching from\n * @param iterations - Current iteration count, passed internally to prevent infinite recursion.\n * @returns An object if config is found, false otherwise\n * @internal\n */\nfunction resolveProjectRootForStudioSync(\n basePath: string,\n iterations = 0,\n): false | ProjectRootResult {\n return recursivelyResolveProjectRootSync(basePath, findStudioConfigPathSync, 'studio', iterations)\n}\n\n/**\n * Recursively searches for a app project configuration file in the given directory and its parents.\n *\n * @param basePath - The base path to start searching from\n * @param iterations - Current iteration count, passed internally to prevent infinite recursion.\n * @returns An object if config is found, false otherwise\n * @internal\n */\nfunction resolveProjectRootForAppSync(basePath: string, iterations = 0): false | ProjectRootResult {\n return recursivelyResolveProjectRootSync(basePath, findAppConfigPathSync, 'app', iterations)\n}\n"],"names":["dirname","resolve","findAppConfigPathSync","findStudioConfigPathSync","recursivelyResolveProjectRootSync","basePath","findConfigFn","projectType","iterations","configPath","directory","path","type","parentDir","findProjectRootSync","cwd","studioProjectRoot","resolveProjectRootForStudioSync","appProjectRoot","resolveProjectRootForAppSync","Error","err","message"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAW;AAE1C,SAAQC,qBAAqB,EAAEC,wBAAwB,QAAO,4BAA2B;AAGzF;;;;;;;;;CASC,GACD,OAAO,SAASC,kCACdC,QAAgB,EAChBC,YAAkD,EAClDC,WAA6B,EAC7BC,aAAa,CAAC;IAEd,MAAMC,aAAaH,aAAaD;IAEhC,IAAII,YAAY;QACd,OAAO;YACLC,WAAWV,QAAQS;YACnBE,MAAMF;YACNG,MAAML;QACR;IACF;IAEA,MAAMM,YAAYZ,QAAQI,UAAU;IACpC,IAAIQ,cAAcR,YAAYG,aAAa,IAAI;QAC7C,uCAAuC;QACvC,OAAO;IACT;IAEA,OAAOJ,kCAAkCS,WAAWP,cAAcC,aAAaC,aAAa;AAC9F;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASM,oBAAoBC,GAAW;IAC7C,IAAI;QACF,6EAA6E;QAC7E,MAAMC,oBAAoBC,gCAAgCF;QAC1D,IAAIC,mBAAmB;YACrB,OAAOA;QACT;QAEA,wEAAwE;QACxE,MAAME,iBAAiBC,6BAA6BJ;QACpD,IAAIG,gBAAgB;YAClB,OAAOA;QACT;QAEA,qCAAqC;QACrC,MAAM,IAAIE,MAAM,CAAC,yBAAyB,EAAEL,KAAK;IACnD,EAAE,OAAOM,KAAc;QACrB,MAAMC,UAAUD,eAAeD,QAAQC,IAAIC,OAAO,GAAG,GAAGD,KAAK;QAC7D,MAAM,IAAID,MAAM,CAAC,gDAAgD,EAAEE,SAAS;IAC9E;AACF;AAEA;;;;;;;;CAQC,GACD,SAASL,gCACPZ,QAAgB,EAChBG,aAAa,CAAC;IAEd,OAAOJ,kCAAkCC,UAAUF,0BAA0B,UAAUK;AACzF;AAEA;;;;;;;CAOC,GACD,SAASW,6BAA6Bd,QAAgB,EAAEG,aAAa,CAAC;IACpE,OAAOJ,kCAAkCC,UAAUH,uBAAuB,OAAOM;AACnF"}
@@ -1,17 +1,12 @@
1
1
  import { pathToFileURL } from 'node:url';
2
2
  import { isMainThread, parentPort, workerData } from 'node:worker_threads';
3
- import { createClient } from '@sanity/client';
4
3
  import { moduleResolve } from 'import-meta-resolve';
5
4
  import { z } from 'zod';
5
+ import { getEmptyAuth } from '../../util/getEmptyAuth.js';
6
6
  import { safeStructuredClone } from '../../util/safeStructuredClone.js';
7
7
  if (isMainThread || !parentPort) {
8
8
  throw new Error('Should only be run in a worker!');
9
9
  }
10
- const EMPTY_AUTH_STATE = {
11
- authenticated: false,
12
- client: getDummyClient(),
13
- currentUser: null
14
- };
15
10
  const { configPath, resolvePlugins } = z.object({
16
11
  configPath: z.string(),
17
12
  resolvePlugins: z.boolean()
@@ -40,7 +35,7 @@ if (resolvePlugins) {
40
35
  ];
41
36
  workspaces.map((workspace)=>{
42
37
  workspace.auth = {
43
- state: of(EMPTY_AUTH_STATE)
38
+ state: of(getEmptyAuth())
44
39
  };
45
40
  });
46
41
  config = await firstValueFrom(resolveConfig(config));
@@ -51,14 +46,5 @@ parentPort.postMessage(safeStructuredClone(config));
51
46
  setImmediate(()=>{
52
47
  process.exit(1);
53
48
  });
54
- function getDummyClient() {
55
- return createClient({
56
- apiHost: 'http://localhost',
57
- apiVersion: '2025-02-01',
58
- projectId: 'unused',
59
- requestTagPrefix: 'sanity.cli',
60
- useCdn: false
61
- });
62
- }
63
49
 
64
50
  //# sourceMappingURL=readStudioConfig.worker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/studio/readStudioConfig.worker.ts"],"sourcesContent":["import {pathToFileURL} from 'node:url'\nimport {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {createClient} from '@sanity/client'\nimport {moduleResolve} from 'import-meta-resolve'\nimport {z} from 'zod'\n\nimport {safeStructuredClone} from '../../util/safeStructuredClone.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst EMPTY_AUTH_STATE = {\n authenticated: false,\n client: getDummyClient(),\n currentUser: null,\n}\n\nconst {configPath, resolvePlugins} = z\n .object({configPath: z.string(), resolvePlugins: z.boolean()})\n .parse(workerData)\n\nlet {default: config} = await import(configPath)\n\nif (resolvePlugins) {\n // If we need to resolve plugins, we need to import and use the `resolveConfig`\n // function from the `sanity` package. This package should be installed in the users'\n // studio project, not as part of the CLI - so we need to resolve the full path of the\n // Sanity package relative to the studio.\n const configUrl = pathToFileURL(configPath)\n\n const sanityUrl = await moduleResolve('sanity', configUrl)\n const {resolveConfig} = await import(sanityUrl.href)\n if (typeof resolveConfig !== 'function') {\n throw new TypeError('Expected `resolveConfig` from `sanity` to be a function')\n }\n\n // We'll want to use some observable tooling, but we'd prefer to use something\n // compatible with what the studio uses internally, thus try to load RxJS from the\n // sanity module path instead of installing it as a dependency locally.\n const rxjsPath = (await moduleResolve('rxjs', sanityUrl)).href\n const {firstValueFrom, of} = await import(rxjsPath)\n\n // We will also want to stub out some configuration - we don't need to resolve the\n // users' logged in state, for instance - so let's disable the auth implementation.\n const workspaces = Array.isArray(config) ? config : [config]\n workspaces.map((workspace) => {\n workspace.auth = {state: of(EMPTY_AUTH_STATE)}\n })\n\n config = await firstValueFrom(resolveConfig(config))\n}\n\nparentPort.postMessage(safeStructuredClone(config))\n\n// Explicitly exit the process to avoid any dangling references from keeping\n// the process alive after resolving it's main task\nsetImmediate(() => {\n process.exit(1)\n})\n\nfunction getDummyClient() {\n return createClient({\n apiHost: 'http://localhost',\n apiVersion: '2025-02-01',\n projectId: 'unused',\n requestTagPrefix: 'sanity.cli',\n useCdn: false,\n })\n}\n"],"names":["pathToFileURL","isMainThread","parentPort","workerData","createClient","moduleResolve","z","safeStructuredClone","Error","EMPTY_AUTH_STATE","authenticated","client","getDummyClient","currentUser","configPath","resolvePlugins","object","string","boolean","parse","default","config","configUrl","sanityUrl","resolveConfig","href","TypeError","rxjsPath","firstValueFrom","of","workspaces","Array","isArray","map","workspace","auth","state","postMessage","setImmediate","process","exit","apiHost","apiVersion","projectId","requestTagPrefix","useCdn"],"mappings":"AAAA,SAAQA,aAAa,QAAO,WAAU;AACtC,SAAQC,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,YAAY,QAAO,iBAAgB;AAC3C,SAAQC,aAAa,QAAO,sBAAqB;AACjD,SAAQC,CAAC,QAAO,MAAK;AAErB,SAAQC,mBAAmB,QAAO,oCAAmC;AAErE,IAAIN,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAIM,MAAM;AAClB;AAEA,MAAMC,mBAAmB;IACvBC,eAAe;IACfC,QAAQC;IACRC,aAAa;AACf;AAEA,MAAM,EAACC,UAAU,EAAEC,cAAc,EAAC,GAAGT,EAClCU,MAAM,CAAC;IAACF,YAAYR,EAAEW,MAAM;IAAIF,gBAAgBT,EAAEY,OAAO;AAAE,GAC3DC,KAAK,CAAChB;AAET,IAAI,EAACiB,SAASC,MAAM,EAAC,GAAG,MAAM,MAAM,CAACP;AAErC,IAAIC,gBAAgB;IAClB,+EAA+E;IAC/E,qFAAqF;IACrF,sFAAsF;IACtF,yCAAyC;IACzC,MAAMO,YAAYtB,cAAcc;IAEhC,MAAMS,YAAY,MAAMlB,cAAc,UAAUiB;IAChD,MAAM,EAACE,aAAa,EAAC,GAAG,MAAM,MAAM,CAACD,UAAUE,IAAI;IACnD,IAAI,OAAOD,kBAAkB,YAAY;QACvC,MAAM,IAAIE,UAAU;IACtB;IAEA,8EAA8E;IAC9E,kFAAkF;IAClF,uEAAuE;IACvE,MAAMC,WAAW,AAAC,CAAA,MAAMtB,cAAc,QAAQkB,UAAS,EAAGE,IAAI;IAC9D,MAAM,EAACG,cAAc,EAAEC,EAAE,EAAC,GAAG,MAAM,MAAM,CAACF;IAE1C,kFAAkF;IAClF,mFAAmF;IACnF,MAAMG,aAAaC,MAAMC,OAAO,CAACX,UAAUA,SAAS;QAACA;KAAO;IAC5DS,WAAWG,GAAG,CAAC,CAACC;QACdA,UAAUC,IAAI,GAAG;YAACC,OAAOP,GAAGpB;QAAiB;IAC/C;IAEAY,SAAS,MAAMO,eAAeJ,cAAcH;AAC9C;AAEAnB,WAAWmC,WAAW,CAAC9B,oBAAoBc;AAE3C,4EAA4E;AAC5E,mDAAmD;AACnDiB,aAAa;IACXC,QAAQC,IAAI,CAAC;AACf;AAEA,SAAS5B;IACP,OAAOR,aAAa;QAClBqC,SAAS;QACTC,YAAY;QACZC,WAAW;QACXC,kBAAkB;QAClBC,QAAQ;IACV;AACF"}
1
+ {"version":3,"sources":["../../../src/config/studio/readStudioConfig.worker.ts"],"sourcesContent":["import {pathToFileURL} from 'node:url'\nimport {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {moduleResolve} from 'import-meta-resolve'\nimport {z} from 'zod'\n\nimport {getEmptyAuth} from '../../util/getEmptyAuth.js'\nimport {safeStructuredClone} from '../../util/safeStructuredClone.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst {configPath, resolvePlugins} = z\n .object({configPath: z.string(), resolvePlugins: z.boolean()})\n .parse(workerData)\n\nlet {default: config} = await import(configPath)\n\nif (resolvePlugins) {\n // If we need to resolve plugins, we need to import and use the `resolveConfig`\n // function from the `sanity` package. This package should be installed in the users'\n // studio project, not as part of the CLI - so we need to resolve the full path of the\n // Sanity package relative to the studio.\n const configUrl = pathToFileURL(configPath)\n\n const sanityUrl = await moduleResolve('sanity', configUrl)\n const {resolveConfig} = await import(sanityUrl.href)\n if (typeof resolveConfig !== 'function') {\n throw new TypeError('Expected `resolveConfig` from `sanity` to be a function')\n }\n\n // We'll want to use some observable tooling, but we'd prefer to use something\n // compatible with what the studio uses internally, thus try to load RxJS from the\n // sanity module path instead of installing it as a dependency locally.\n const rxjsPath = (await moduleResolve('rxjs', sanityUrl)).href\n const {firstValueFrom, of} = await import(rxjsPath)\n\n // We will also want to stub out some configuration - we don't need to resolve the\n // users' logged in state, for instance - so let's disable the auth implementation.\n const workspaces = Array.isArray(config) ? config : [config]\n workspaces.map((workspace) => {\n workspace.auth = {state: of(getEmptyAuth())}\n })\n\n config = await firstValueFrom(resolveConfig(config))\n}\n\nparentPort.postMessage(safeStructuredClone(config))\n\n// Explicitly exit the process to avoid any dangling references from keeping\n// the process alive after resolving it's main task\nsetImmediate(() => {\n process.exit(1)\n})\n"],"names":["pathToFileURL","isMainThread","parentPort","workerData","moduleResolve","z","getEmptyAuth","safeStructuredClone","Error","configPath","resolvePlugins","object","string","boolean","parse","default","config","configUrl","sanityUrl","resolveConfig","href","TypeError","rxjsPath","firstValueFrom","of","workspaces","Array","isArray","map","workspace","auth","state","postMessage","setImmediate","process","exit"],"mappings":"AAAA,SAAQA,aAAa,QAAO,WAAU;AACtC,SAAQC,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,aAAa,QAAO,sBAAqB;AACjD,SAAQC,CAAC,QAAO,MAAK;AAErB,SAAQC,YAAY,QAAO,6BAA4B;AACvD,SAAQC,mBAAmB,QAAO,oCAAmC;AAErE,IAAIN,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAIM,MAAM;AAClB;AAEA,MAAM,EAACC,UAAU,EAAEC,cAAc,EAAC,GAAGL,EAClCM,MAAM,CAAC;IAACF,YAAYJ,EAAEO,MAAM;IAAIF,gBAAgBL,EAAEQ,OAAO;AAAE,GAC3DC,KAAK,CAACX;AAET,IAAI,EAACY,SAASC,MAAM,EAAC,GAAG,MAAM,MAAM,CAACP;AAErC,IAAIC,gBAAgB;IAClB,+EAA+E;IAC/E,qFAAqF;IACrF,sFAAsF;IACtF,yCAAyC;IACzC,MAAMO,YAAYjB,cAAcS;IAEhC,MAAMS,YAAY,MAAMd,cAAc,UAAUa;IAChD,MAAM,EAACE,aAAa,EAAC,GAAG,MAAM,MAAM,CAACD,UAAUE,IAAI;IACnD,IAAI,OAAOD,kBAAkB,YAAY;QACvC,MAAM,IAAIE,UAAU;IACtB;IAEA,8EAA8E;IAC9E,kFAAkF;IAClF,uEAAuE;IACvE,MAAMC,WAAW,AAAC,CAAA,MAAMlB,cAAc,QAAQc,UAAS,EAAGE,IAAI;IAC9D,MAAM,EAACG,cAAc,EAAEC,EAAE,EAAC,GAAG,MAAM,MAAM,CAACF;IAE1C,kFAAkF;IAClF,mFAAmF;IACnF,MAAMG,aAAaC,MAAMC,OAAO,CAACX,UAAUA,SAAS;QAACA;KAAO;IAC5DS,WAAWG,GAAG,CAAC,CAACC;QACdA,UAAUC,IAAI,GAAG;YAACC,OAAOP,GAAGlB;QAAe;IAC7C;IAEAU,SAAS,MAAMO,eAAeJ,cAAcH;AAC9C;AAEAd,WAAW8B,WAAW,CAACzB,oBAAoBS;AAE3C,4EAA4E;AAC5E,mDAAmD;AACnDiB,aAAa;IACXC,QAAQC,IAAI,CAAC;AACf"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Resolves to a string containing the found config path, or `undefined` if not found.
3
+ * Throws if Sanity v2 studio root is found.
4
+ *
5
+ * @param basePath - The base path to start searching from
6
+ * @returns A string containing the found config path, or `undefined` if not found
7
+ * @internal
8
+ */
9
+ export declare function findStudioConfigPathSync(basePath: string): string | undefined;
10
+ /**
11
+ * Resolves to a string containing the found config path, or `undefined` if not found.
12
+ *
13
+ * @param basePath - The base path to start searching from
14
+ * @returns A string containing the found config path, or `undefined` if not found
15
+ * @internal
16
+ */
17
+ export declare function findAppConfigPathSync(basePath: string): string | undefined;
@@ -0,0 +1,85 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { basename, join } from 'node:path';
3
+ /**
4
+ * Checks for a `sanity.json` file with `"root": true` in the given directory synchronously.
5
+ *
6
+ * @param basePath - The base path to look for a `sanity.json` in
7
+ * @returns true if a `sanity.json` with `"root": true` is found, false otherwise
8
+ * @internal
9
+ */ function isSanityV2StudioRootSync(basePath) {
10
+ try {
11
+ const content = readFileSync(join(basePath, 'sanity.json'), 'utf8');
12
+ const sanityJson = JSON.parse(content);
13
+ if (!sanityJson || typeof sanityJson !== 'object' || Array.isArray(sanityJson)) {
14
+ throw new Error('Invalid sanity.json, expected an object');
15
+ }
16
+ const isRoot = Boolean(sanityJson?.root);
17
+ return isRoot;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+ /**
23
+ * Finds the path for a given set of files synchronously.
24
+ *
25
+ * @param basePath - The base path to search for files.
26
+ * @param files - The files to search for.
27
+ * @returns Array of path results
28
+ * @internal
29
+ */ function findPathForFilesSync(basePath, files) {
30
+ return files.map((file)=>{
31
+ const path = join(basePath, file);
32
+ const exists = existsSync(path);
33
+ return {
34
+ exists,
35
+ path
36
+ };
37
+ });
38
+ }
39
+ /**
40
+ * Resolves to a string containing the found config path, or `undefined` if not found.
41
+ * Throws if Sanity v2 studio root is found.
42
+ *
43
+ * @param basePath - The base path to start searching from
44
+ * @returns A string containing the found config path, or `undefined` if not found
45
+ * @internal
46
+ */ export function findStudioConfigPathSync(basePath) {
47
+ if (isSanityV2StudioRootSync(basePath)) {
48
+ throw new Error(`Found 'sanity.json' at ${basePath} - Sanity Studio < v3 is no longer supported`);
49
+ }
50
+ const paths = findPathForFilesSync(basePath, [
51
+ 'sanity.config.ts',
52
+ 'sanity.config.tsx',
53
+ 'sanity.config.js',
54
+ 'sanity.config.jsx'
55
+ ]);
56
+ const configPaths = paths.filter((path)=>path.exists);
57
+ if (configPaths.length > 1) {
58
+ const baseNames = configPaths.map((config)=>config.path).map((path)=>basename(path));
59
+ throw new Error(`Multiple studio config files found (${baseNames.join(', ')})`);
60
+ }
61
+ if (configPaths.length === 1) {
62
+ return configPaths[0].path;
63
+ }
64
+ }
65
+ /**
66
+ * Resolves to a string containing the found config path, or `undefined` if not found.
67
+ *
68
+ * @param basePath - The base path to start searching from
69
+ * @returns A string containing the found config path, or `undefined` if not found
70
+ * @internal
71
+ */ export function findAppConfigPathSync(basePath) {
72
+ const paths = findPathForFilesSync(basePath, [
73
+ 'sanity.cli.ts',
74
+ 'sanity.cli.js'
75
+ ]);
76
+ const configPaths = paths.filter((path)=>path.exists);
77
+ if (configPaths.length > 1) {
78
+ throw new Error(`Multiple app config files found (${configPaths.map((path)=>path.path).join(', ')})`);
79
+ }
80
+ if (configPaths.length === 1) {
81
+ return configPaths[0].path;
82
+ }
83
+ }
84
+
85
+ //# sourceMappingURL=configPathsSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/config/util/configPathsSync.ts"],"sourcesContent":["import {existsSync, readFileSync} from 'node:fs'\nimport {basename, join} from 'node:path'\n\n/**\n * @internal\n */\ninterface PathResult {\n exists: boolean\n path: string\n}\n\n/**\n * Checks for a `sanity.json` file with `\"root\": true` in the given directory synchronously.\n *\n * @param basePath - The base path to look for a `sanity.json` in\n * @returns true if a `sanity.json` with `\"root\": true` is found, false otherwise\n * @internal\n */\nfunction isSanityV2StudioRootSync(basePath: string): boolean {\n try {\n const content = readFileSync(join(basePath, 'sanity.json'), 'utf8')\n const sanityJson = JSON.parse(content)\n if (!sanityJson || typeof sanityJson !== 'object' || Array.isArray(sanityJson)) {\n throw new Error('Invalid sanity.json, expected an object')\n }\n const isRoot = Boolean(sanityJson?.root)\n return isRoot\n } catch {\n return false\n }\n}\n\n/**\n * Finds the path for a given set of files synchronously.\n *\n * @param basePath - The base path to search for files.\n * @param files - The files to search for.\n * @returns Array of path results\n * @internal\n */\nfunction findPathForFilesSync(basePath: string, files: string[]): PathResult[] {\n return files.map((file) => {\n const path = join(basePath, file)\n const exists = existsSync(path)\n return {exists, path}\n })\n}\n\n/**\n * Resolves to a string containing the found config path, or `undefined` if not found.\n * Throws if Sanity v2 studio root is found.\n *\n * @param basePath - The base path to start searching from\n * @returns A string containing the found config path, or `undefined` if not found\n * @internal\n */\nexport function findStudioConfigPathSync(basePath: string): string | undefined {\n if (isSanityV2StudioRootSync(basePath)) {\n throw new Error(\n `Found 'sanity.json' at ${basePath} - Sanity Studio < v3 is no longer supported`,\n )\n }\n\n const paths = findPathForFilesSync(basePath, [\n 'sanity.config.ts',\n 'sanity.config.tsx',\n 'sanity.config.js',\n 'sanity.config.jsx',\n ])\n\n const configPaths = paths.filter((path) => path.exists)\n if (configPaths.length > 1) {\n const baseNames = configPaths.map((config) => config.path).map((path) => basename(path))\n throw new Error(`Multiple studio config files found (${baseNames.join(', ')})`)\n }\n\n if (configPaths.length === 1) {\n return configPaths[0].path\n }\n}\n\n/**\n * Resolves to a string containing the found config path, or `undefined` if not found.\n *\n * @param basePath - The base path to start searching from\n * @returns A string containing the found config path, or `undefined` if not found\n * @internal\n */\nexport function findAppConfigPathSync(basePath: string): string | undefined {\n const paths = findPathForFilesSync(basePath, ['sanity.cli.ts', 'sanity.cli.js'])\n const configPaths = paths.filter((path) => path.exists)\n if (configPaths.length > 1) {\n throw new Error(\n `Multiple app config files found (${configPaths.map((path) => path.path).join(', ')})`,\n )\n }\n\n if (configPaths.length === 1) {\n return configPaths[0].path\n }\n}\n"],"names":["existsSync","readFileSync","basename","join","isSanityV2StudioRootSync","basePath","content","sanityJson","JSON","parse","Array","isArray","Error","isRoot","Boolean","root","findPathForFilesSync","files","map","file","path","exists","findStudioConfigPathSync","paths","configPaths","filter","length","baseNames","config","findAppConfigPathSync"],"mappings":"AAAA,SAAQA,UAAU,EAAEC,YAAY,QAAO,UAAS;AAChD,SAAQC,QAAQ,EAAEC,IAAI,QAAO,YAAW;AAUxC;;;;;;CAMC,GACD,SAASC,yBAAyBC,QAAgB;IAChD,IAAI;QACF,MAAMC,UAAUL,aAAaE,KAAKE,UAAU,gBAAgB;QAC5D,MAAME,aAAaC,KAAKC,KAAK,CAACH;QAC9B,IAAI,CAACC,cAAc,OAAOA,eAAe,YAAYG,MAAMC,OAAO,CAACJ,aAAa;YAC9E,MAAM,IAAIK,MAAM;QAClB;QACA,MAAMC,SAASC,QAAQP,YAAYQ;QACnC,OAAOF;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;;;CAOC,GACD,SAASG,qBAAqBX,QAAgB,EAAEY,KAAe;IAC7D,OAAOA,MAAMC,GAAG,CAAC,CAACC;QAChB,MAAMC,OAAOjB,KAAKE,UAAUc;QAC5B,MAAME,SAASrB,WAAWoB;QAC1B,OAAO;YAACC;YAAQD;QAAI;IACtB;AACF;AAEA;;;;;;;CAOC,GACD,OAAO,SAASE,yBAAyBjB,QAAgB;IACvD,IAAID,yBAAyBC,WAAW;QACtC,MAAM,IAAIO,MACR,CAAC,uBAAuB,EAAEP,SAAS,4CAA4C,CAAC;IAEpF;IAEA,MAAMkB,QAAQP,qBAAqBX,UAAU;QAC3C;QACA;QACA;QACA;KACD;IAED,MAAMmB,cAAcD,MAAME,MAAM,CAAC,CAACL,OAASA,KAAKC,MAAM;IACtD,IAAIG,YAAYE,MAAM,GAAG,GAAG;QAC1B,MAAMC,YAAYH,YAAYN,GAAG,CAAC,CAACU,SAAWA,OAAOR,IAAI,EAAEF,GAAG,CAAC,CAACE,OAASlB,SAASkB;QAClF,MAAM,IAAIR,MAAM,CAAC,oCAAoC,EAAEe,UAAUxB,IAAI,CAAC,MAAM,CAAC,CAAC;IAChF;IAEA,IAAIqB,YAAYE,MAAM,KAAK,GAAG;QAC5B,OAAOF,WAAW,CAAC,EAAE,CAACJ,IAAI;IAC5B;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASS,sBAAsBxB,QAAgB;IACpD,MAAMkB,QAAQP,qBAAqBX,UAAU;QAAC;QAAiB;KAAgB;IAC/E,MAAMmB,cAAcD,MAAME,MAAM,CAAC,CAACL,OAASA,KAAKC,MAAM;IACtD,IAAIG,YAAYE,MAAM,GAAG,GAAG;QAC1B,MAAM,IAAId,MACR,CAAC,iCAAiC,EAAEY,YAAYN,GAAG,CAAC,CAACE,OAASA,KAAKA,IAAI,EAAEjB,IAAI,CAAC,MAAM,CAAC,CAAC;IAE1F;IAEA,IAAIqB,YAAYE,MAAM,KAAK,GAAG;QAC5B,OAAOF,WAAW,CAAC,EAAE,CAACJ,IAAI;IAC5B;AACF"}
@@ -9,6 +9,9 @@ import { readJsonFile } from '../../util/readJsonFile.js';
9
9
  */ export async function isSanityV2StudioRoot(basePath) {
10
10
  try {
11
11
  const sanityJson = await readJsonFile(join(basePath, 'sanity.json'));
12
+ if (!sanityJson || typeof sanityJson !== 'object' || Array.isArray(sanityJson)) {
13
+ throw new Error('Invalid sanity.json, expected an object');
14
+ }
12
15
  const isRoot = Boolean(sanityJson?.root);
13
16
  return isRoot;
14
17
  } catch {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/util/isSanityV2StudioRoot.ts"],"sourcesContent":["import {join} from 'node:path'\n\nimport {readJsonFile} from '../../util/readJsonFile.js'\n\n/**\n * Checks for a `sanity.json` file with `\"root\": true` in the given directory.\n *\n * @param basePath - The base path to look for a `sanity.json` in\n * @returns Resolves to true if a `sanity.json` with `\"root\": true` is found, false otherwise\n * @internal\n */\nexport async function isSanityV2StudioRoot(basePath: string): Promise<boolean> {\n try {\n const sanityJson = await readJsonFile(join(basePath, 'sanity.json'))\n const isRoot = Boolean(sanityJson?.root)\n return isRoot\n } catch {\n return false\n }\n}\n"],"names":["join","readJsonFile","isSanityV2StudioRoot","basePath","sanityJson","isRoot","Boolean","root"],"mappings":"AAAA,SAAQA,IAAI,QAAO,YAAW;AAE9B,SAAQC,YAAY,QAAO,6BAA4B;AAEvD;;;;;;CAMC,GACD,OAAO,eAAeC,qBAAqBC,QAAgB;IACzD,IAAI;QACF,MAAMC,aAAa,MAAMH,aAAaD,KAAKG,UAAU;QACrD,MAAME,SAASC,QAAQF,YAAYG;QACnC,OAAOF;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../src/config/util/isSanityV2StudioRoot.ts"],"sourcesContent":["import {join} from 'node:path'\n\nimport {readJsonFile} from '../../util/readJsonFile.js'\n\n/**\n * Checks for a `sanity.json` file with `\"root\": true` in the given directory.\n *\n * @param basePath - The base path to look for a `sanity.json` in\n * @returns Resolves to true if a `sanity.json` with `\"root\": true` is found, false otherwise\n * @internal\n */\nexport async function isSanityV2StudioRoot(basePath: string): Promise<boolean> {\n try {\n const sanityJson = await readJsonFile(join(basePath, 'sanity.json'))\n if (!sanityJson || typeof sanityJson !== 'object' || Array.isArray(sanityJson)) {\n throw new Error('Invalid sanity.json, expected an object')\n }\n const isRoot = Boolean(sanityJson?.root)\n return isRoot\n } catch {\n return false\n }\n}\n"],"names":["join","readJsonFile","isSanityV2StudioRoot","basePath","sanityJson","Array","isArray","Error","isRoot","Boolean","root"],"mappings":"AAAA,SAAQA,IAAI,QAAO,YAAW;AAE9B,SAAQC,YAAY,QAAO,6BAA4B;AAEvD;;;;;;CAMC,GACD,OAAO,eAAeC,qBAAqBC,QAAgB;IACzD,IAAI;QACF,MAAMC,aAAa,MAAMH,aAAaD,KAAKG,UAAU;QACrD,IAAI,CAACC,cAAc,OAAOA,eAAe,YAAYC,MAAMC,OAAO,CAACF,aAAa;YAC9E,MAAM,IAAIG,MAAM;QAClB;QACA,MAAMC,SAASC,QAAQL,YAAYM;QACnC,OAAOF;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from './config/cli/getCliConfig.js';
2
- export { type CliConfig, type ReactCompilerConfig, type UserViteConfig } from './config/cli/types.js';
2
+ export * from './config/cli/getCliConfigSync.js';
3
+ export { cliConfigSchema } from './config/cli/schemas.js';
4
+ export { type CliConfig } from './config/cli/types/cliConfig.js';
5
+ export { type UserViteConfig } from './config/cli/types/userViteConfig.js';
3
6
  export * from './config/findProjectRoot.js';
7
+ export * from './config/findProjectRootSync.js';
4
8
  export * from './config/studio/getStudioConfig.js';
5
9
  export * from './config/util/findConfigsPaths.js';
6
10
  export * from './config/util/findStudioConfigPath.js';
@@ -13,6 +17,9 @@ export * from './services/cliUserConfig.js';
13
17
  export * from './services/getCliToken.js';
14
18
  export { type Output } from './types.js';
15
19
  export * from './util/createExpiringConfig.js';
20
+ export * from './util/environment/mockBrowserEnvironment.js';
21
+ export * from './util/fileExists.js';
22
+ export * from './util/getEmptyAuth.js';
16
23
  export * from './util/getSanityEnvVar.js';
17
24
  export * from './util/getSanityUrl.js';
18
25
  export * from './util/getUserConfig.js';
@@ -20,6 +27,7 @@ export * from './util/isCi.js';
20
27
  export * from './util/isHttpError.js';
21
28
  export * from './util/isInteractive.js';
22
29
  export * from './util/isTrueish.js';
30
+ export * from './util/tryGetDefaultExport.js';
23
31
  export * from './ux/colorizeJson.js';
24
32
  export * from './ux/formatObject.js';
25
33
  export * from './ux/logSymbols.js';
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export * from './config/cli/getCliConfig.js';
2
+ export * from './config/cli/getCliConfigSync.js';
3
+ export { cliConfigSchema } from './config/cli/schemas.js';
2
4
  export * from './config/findProjectRoot.js';
5
+ export * from './config/findProjectRootSync.js';
3
6
  export * from './config/studio/getStudioConfig.js';
4
7
  export * from './config/util/findConfigsPaths.js';
5
8
  export * from './config/util/findStudioConfigPath.js';
@@ -10,6 +13,9 @@ export * from './services/apiClient.js';
10
13
  export * from './services/cliUserConfig.js';
11
14
  export * from './services/getCliToken.js';
12
15
  export * from './util/createExpiringConfig.js';
16
+ export * from './util/environment/mockBrowserEnvironment.js';
17
+ export * from './util/fileExists.js';
18
+ export * from './util/getEmptyAuth.js';
13
19
  export * from './util/getSanityEnvVar.js';
14
20
  export * from './util/getSanityUrl.js';
15
21
  export * from './util/getUserConfig.js';
@@ -17,6 +23,7 @@ export * from './util/isCi.js';
17
23
  export * from './util/isHttpError.js';
18
24
  export * from './util/isInteractive.js';
19
25
  export * from './util/isTrueish.js';
26
+ export * from './util/tryGetDefaultExport.js';
20
27
  export * from './ux/colorizeJson.js';
21
28
  export * from './ux/formatObject.js';
22
29
  export * from './ux/logSymbols.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './config/cli/getCliConfig.js'\nexport {type CliConfig, type ReactCompilerConfig, type UserViteConfig} from './config/cli/types.js'\nexport * from './config/findProjectRoot.js'\nexport * from './config/studio/getStudioConfig.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 './loaders/tsx/tsxWorkerTask.js'\nexport * from './SanityCommand.js'\nexport * from './services/apiClient.js'\nexport * from './services/cliUserConfig.js'\nexport * from './services/getCliToken.js'\nexport {type Output} from './types.js'\nexport * from './util/createExpiringConfig.js'\nexport * from './util/getSanityEnvVar.js'\nexport * from './util/getSanityUrl.js'\nexport * from './util/getUserConfig.js'\nexport * from './util/isCi.js'\nexport * from './util/isHttpError.js'\nexport * from './util/isInteractive.js'\nexport * from './util/isTrueish.js'\nexport * from './ux/colorizeJson.js'\nexport * from './ux/formatObject.js'\nexport * from './ux/logSymbols.js'\nexport * from './ux/printKeyValue.js'\nexport * from './ux/spinner.js'\nexport * from './ux/timer.js'\n"],"names":[],"mappings":"AAAA,cAAc,+BAA8B;AAE5C,cAAc,8BAA6B;AAC3C,cAAc,qCAAoC;AAClD,cAAc,oCAAmC;AACjD,cAAc,wCAAuC;AAErD,cAAc,aAAY;AAC1B,cAAc,iCAAgC;AAC9C,cAAc,qBAAoB;AAClC,cAAc,0BAAyB;AACvC,cAAc,8BAA6B;AAC3C,cAAc,4BAA2B;AAEzC,cAAc,iCAAgC;AAC9C,cAAc,4BAA2B;AACzC,cAAc,yBAAwB;AACtC,cAAc,0BAAyB;AACvC,cAAc,iBAAgB;AAC9B,cAAc,wBAAuB;AACrC,cAAc,0BAAyB;AACvC,cAAc,sBAAqB;AACnC,cAAc,uBAAsB;AACpC,cAAc,uBAAsB;AACpC,cAAc,qBAAoB;AAClC,cAAc,wBAAuB;AACrC,cAAc,kBAAiB;AAC/B,cAAc,gBAAe"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './config/cli/getCliConfig.js'\nexport * from './config/cli/getCliConfigSync.js'\nexport {cliConfigSchema} from './config/cli/schemas.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/util/findConfigsPaths.js'\nexport * from './config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nexport * from './debug.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 {type Output} from './types.js'\nexport * from './util/createExpiringConfig.js'\nexport * from './util/environment/mockBrowserEnvironment.js'\nexport * from './util/fileExists.js'\nexport * from './util/getEmptyAuth.js'\nexport * from './util/getSanityEnvVar.js'\nexport * from './util/getSanityUrl.js'\nexport * from './util/getUserConfig.js'\nexport * from './util/isCi.js'\nexport * from './util/isHttpError.js'\nexport * from './util/isInteractive.js'\nexport * from './util/isTrueish.js'\nexport * from './util/tryGetDefaultExport.js'\nexport * from './ux/colorizeJson.js'\nexport * from './ux/formatObject.js'\nexport * from './ux/logSymbols.js'\nexport * from './ux/printKeyValue.js'\nexport * from './ux/spinner.js'\nexport * from './ux/timer.js'\n"],"names":["cliConfigSchema"],"mappings":"AAAA,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,SAAQA,eAAe,QAAO,0BAAyB;AAGvD,cAAc,8BAA6B;AAC3C,cAAc,kCAAiC;AAC/C,cAAc,qCAAoC;AAClD,cAAc,oCAAmC;AACjD,cAAc,wCAAuC;AAErD,cAAc,aAAY;AAC1B,cAAc,iCAAgC;AAC9C,cAAc,qBAAoB;AAClC,cAAc,0BAAyB;AACvC,cAAc,8BAA6B;AAC3C,cAAc,4BAA2B;AAEzC,cAAc,iCAAgC;AAC9C,cAAc,+CAA8C;AAC5D,cAAc,uBAAsB;AACpC,cAAc,yBAAwB;AACtC,cAAc,4BAA2B;AACzC,cAAc,yBAAwB;AACtC,cAAc,0BAAyB;AACvC,cAAc,iBAAgB;AAC9B,cAAc,wBAAuB;AACrC,cAAc,0BAAyB;AACvC,cAAc,sBAAqB;AACnC,cAAc,gCAA+B;AAC7C,cAAc,uBAAsB;AACpC,cAAc,uBAAsB;AACpC,cAAc,qBAAoB;AAClC,cAAc,wBAAuB;AACrC,cAAc,kBAAiB;AAC/B,cAAc,gBAAe"}