@sanity/cli-core 2.1.3 → 2.2.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 (87) hide show
  1. package/README.md +224 -1
  2. package/dist/SanityCommand.d.ts +454 -0
  3. package/dist/SanityCommand.js +5 -4
  4. package/dist/SanityCommand.js.map +1 -1
  5. package/dist/_exports/browser.d.ts +21 -0
  6. package/dist/_exports/browser.js +5 -0
  7. package/dist/_exports/browser.js.map +1 -0
  8. package/dist/_exports/config.d.ts +653 -0
  9. package/dist/_exports/config.js +18 -0
  10. package/dist/_exports/config.js.map +1 -0
  11. package/dist/_exports/debug.d.ts +20 -0
  12. package/dist/_exports/debug.js.map +1 -0
  13. package/dist/_exports/errors.d.ts +67 -0
  14. package/dist/_exports/errors.js +5 -0
  15. package/dist/_exports/errors.js.map +1 -0
  16. package/dist/_exports/index.d.ts +30 -33
  17. package/dist/_exports/index.js +42 -39
  18. package/dist/_exports/index.js.map +1 -1
  19. package/dist/_exports/package-manager.d.ts +191 -0
  20. package/dist/_exports/package-manager.js +3 -0
  21. package/dist/_exports/package-manager.js.map +1 -1
  22. package/dist/_exports/schemas.d.ts +227 -0
  23. package/dist/_exports/schemas.js +4 -0
  24. package/dist/_exports/schemas.js.map +1 -0
  25. package/dist/_exports/tasks.d.ts +120 -0
  26. package/dist/_exports/tasks.js +4 -0
  27. package/dist/_exports/tasks.js.map +1 -0
  28. package/dist/_exports/telemetry.d.ts +156 -0
  29. package/dist/_exports/telemetry.js +7 -0
  30. package/dist/_exports/telemetry.js.map +1 -0
  31. package/dist/_exports/types.d.ts +444 -0
  32. package/dist/_exports/types.js +3 -0
  33. package/dist/_exports/types.js.map +1 -0
  34. package/dist/_exports/util.d.ts +132 -0
  35. package/dist/_exports/util.js +16 -0
  36. package/dist/_exports/util.js.map +1 -0
  37. package/dist/_exports/ux.d.ts +15 -0
  38. package/dist/_exports/ux.js +6 -4
  39. package/dist/_exports/ux.js.map +1 -1
  40. package/dist/apiClient.d.ts +79 -0
  41. package/dist/{services/apiClient.js → apiClient.js} +2 -2
  42. package/dist/{services/apiClient.js.map → apiClient.js.map} +1 -1
  43. package/dist/config/cli/cliTokenCache.js.map +1 -0
  44. package/dist/{services → config/cli}/cliUserConfig.js +31 -6
  45. package/dist/config/cli/cliUserConfig.js.map +1 -0
  46. package/dist/config/cli/getCliConfig.js +1 -1
  47. package/dist/config/cli/getCliConfig.js.map +1 -1
  48. package/dist/config/cli/schemas.js +1 -0
  49. package/dist/config/cli/schemas.js.map +1 -1
  50. package/dist/config/cli/types/cliConfig.js.map +1 -1
  51. package/dist/config/cli/workbenchApp.js +19 -38
  52. package/dist/config/cli/workbenchApp.js.map +1 -1
  53. package/dist/config/studio/getStudioWorkspaces.js +1 -1
  54. package/dist/config/studio/getStudioWorkspaces.js.map +1 -1
  55. package/dist/config/studio/readStudioConfig.worker.js +1 -1
  56. package/dist/config/studio/readStudioConfig.worker.js.map +1 -1
  57. package/dist/exitCodes.d.ts +23 -0
  58. package/dist/loaders/studio/studioWorkerLoader.worker.js +2 -2
  59. package/dist/loaders/studio/studioWorkerLoader.worker.js.map +1 -1
  60. package/dist/telemetry/getCliTelemetry.js +3 -2
  61. package/dist/telemetry/getCliTelemetry.js.map +1 -1
  62. package/dist/telemetry/getTelemetryBaseInfo.js +1 -1
  63. package/dist/telemetry/getTelemetryBaseInfo.js.map +1 -1
  64. package/dist/util/environment/mockBrowserEnvironment.js +3 -2
  65. package/dist/util/environment/mockBrowserEnvironment.js.map +1 -1
  66. package/dist/util/environment/setupBrowserStubs.js +1 -1
  67. package/dist/util/environment/setupBrowserStubs.js.map +1 -1
  68. package/dist/util/getSanityConfigDir.js +1 -0
  69. package/dist/util/getSanityConfigDir.js.map +1 -1
  70. package/dist/util/getSanityEnvVar.js +1 -0
  71. package/dist/util/getSanityEnvVar.js.map +1 -1
  72. package/dist/util/getSanityUrl.js +1 -0
  73. package/dist/util/getSanityUrl.js.map +1 -1
  74. package/dist/util/getWorkspace.js +1 -0
  75. package/dist/util/getWorkspace.js.map +1 -1
  76. package/dist/util/importModule.js +1 -1
  77. package/dist/util/importModule.js.map +1 -1
  78. package/dist/util/promisifyWorker.js +1 -1
  79. package/dist/util/promisifyWorker.js.map +1 -1
  80. package/package.json +56 -8
  81. package/dist/debug.js.map +0 -1
  82. package/dist/services/cliTokenCache.js.map +0 -1
  83. package/dist/services/cliUserConfig.js.map +0 -1
  84. package/dist/services/getCliToken.js +0 -26
  85. package/dist/services/getCliToken.js.map +0 -1
  86. /package/dist/{debug.js → _exports/debug.js} +0 -0
  87. /package/dist/{services → config/cli}/cliTokenCache.js +0 -0
@@ -0,0 +1,444 @@
1
+ import { Command } from "@oclif/core";
2
+ import { ConfigEnv } from "vite";
3
+ import { InlineConfig } from "vite";
4
+ import { PluginOptions } from "babel-plugin-react-compiler";
5
+ import { z } from "zod/mini";
6
+
7
+ declare const APPLICATION_TYPES: readonly [
8
+ "coreApp",
9
+ "studio",
10
+ "canvas",
11
+ "dashboard",
12
+ "media-library",
13
+ ];
14
+
15
+ /** The resolved kind of a workbench app — `studio` or one of the SDK app types. */
16
+ export declare type ApplicationType = (typeof APPLICATION_TYPES)[number];
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ export declare interface CliConfig {
22
+ /** The project ID and dataset the Sanity CLI should use to run its commands */
23
+ api?: {
24
+ dataset?: string;
25
+ projectId?: string;
26
+ };
27
+ /** Configuration for custom Sanity apps built with the App SDK */
28
+ app?: {
29
+ /** The entrypoint for your custom app. By default, `src/App.tsx` */
30
+ entry?: string;
31
+ /** Dock group the app renders in. Defaults to `dock.applications`. */
32
+ group?: "dock.applications" | "dock.system" | "dock.user";
33
+ /**
34
+ * Path to an icon file relative to project root.
35
+ * The file must be an SVG.
36
+ */
37
+ icon?: string;
38
+ /** @deprecated Use deployment.appId */
39
+ id?: string;
40
+ /** The ID for the Sanity organization that manages this application */
41
+ organizationId?: string;
42
+ /** Sort position within the dock group, ascending. Defaults to `100`. */
43
+ priority?: number;
44
+ /** The title of the custom app, as it is seen in Dashboard UI */
45
+ title?: string;
46
+ };
47
+ /** @deprecated Use deployment.autoUpdates */
48
+ autoUpdates?: boolean;
49
+ /** Options for custom app and Studio deployments */
50
+ deployment?: {
51
+ /**
52
+ * The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.
53
+ * Get your app ID by either:
54
+ * 1. Checking the output of `sanity deploy`, or
55
+ * 2. Checking your project’s Studio tab at https://sanity.io/manage
56
+ *
57
+ * @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.
58
+ * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}
59
+ */
60
+ appId?: string;
61
+ /**
62
+ * Enable automatic updates for your Studio or custom app’s Sanity dependencies.
63
+ * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}
64
+ */
65
+ autoUpdates?: boolean;
66
+ };
67
+ /** Define the GraphQL APIs that the CLI can deploy and interact with */
68
+ graphql?: Array<{
69
+ filterSuffix?: string;
70
+ generation?: "gen1" | "gen2" | "gen3";
71
+ id?: string;
72
+ nonNullDocumentFields?: boolean;
73
+ playground?: boolean;
74
+ source?: string;
75
+ tag?: string;
76
+ workspace?: string;
77
+ }>;
78
+ /** Configuration for the Media Library */
79
+ mediaLibrary?: {
80
+ /** 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. */
81
+ aspectsPath?: string;
82
+ };
83
+ /** 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. */
84
+ project?: {
85
+ basePath?: string;
86
+ };
87
+ /** Configuration options for React Compiler */
88
+ reactCompiler?: PluginOptions;
89
+ /** 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 true. */
90
+ reactStrictMode?: boolean;
91
+ /**
92
+ * Configuration for schema extraction (`sanity schema extract`)
93
+ */
94
+ schemaExtraction?: {
95
+ /**
96
+ * Enable schema extraction as part of sanity dev and sanity build
97
+ */
98
+ enabled?: boolean;
99
+ /**
100
+ * When true, schema fields marked as required will be non-optional in the output.
101
+ * Defaults to `false`
102
+ */
103
+ enforceRequiredFields?: boolean;
104
+ /**
105
+ * Output path for the extracted schema file.
106
+ * Defaults to `schema.json` in the working directory.
107
+ */
108
+ path?: string;
109
+ /**
110
+ * Additional glob patterns to watch for schema changes in watch mode.
111
+ * These extend the default patterns:
112
+ * - `sanity.config.{js,jsx,ts,tsx,mjs}`
113
+ * - `schema*\/**\/*.{js,jsx,ts,tsx,mjs}`
114
+ */
115
+ watchPatterns?: string[];
116
+ /**
117
+ * The name of the workspace to generate a schema for. Required if your Sanity project has more than one
118
+ * workspace.
119
+ */
120
+ workspace?: string;
121
+ };
122
+ /** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */
123
+ server?: {
124
+ hostname?: string;
125
+ port?: number;
126
+ };
127
+ /** @deprecated Use deployment.appId */
128
+ studioHost?: string;
129
+ /**
130
+ * Configuration for Sanity typegen
131
+ */
132
+ typegen?: Partial<TypeGenConfig> & {
133
+ /**
134
+ * Enable typegen as part of sanity dev and sanity build.
135
+ * When enabled, types are generated on startup and when files change.
136
+ * Defaults to `false`
137
+ */
138
+ enabled?: boolean;
139
+ };
140
+ /**
141
+ * Enable Vite's experimental bundled dev mode for `sanity dev`. This serves bundled
142
+ * files during development, which can speed up startup and reloads for large projects.
143
+ * Defaults to `false`.
144
+ *
145
+ * Unstable: may change or be removed without notice while the underlying Vite
146
+ * feature (`experimental.bundledDev`) is experimental.
147
+ * {@link https://vite.dev/guide/rolldown#full-bundle-mode}
148
+ */
149
+ unstable_bundledDev?: boolean;
150
+ /** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */
151
+ vite?: UserViteConfig;
152
+ }
153
+
154
+ /**
155
+ * @public
156
+ */
157
+ export declare type CLITelemetryStore =
158
+ TelemetryLogger<TelemetryUserProperties>;
159
+
160
+ export declare type ConsentInformation =
161
+ | {
162
+ reason: "fetchError" | "unauthenticated";
163
+ status: Extract<ConsentStatus, "undetermined">;
164
+ }
165
+ | {
166
+ reason?: "localOverride";
167
+ status: Extract<ConsentStatus, "denied">;
168
+ }
169
+ | {
170
+ reason?: never;
171
+ status: Extract<ConsentStatus, "granted">;
172
+ }
173
+ | {
174
+ reason?: never;
175
+ status: Extract<ConsentStatus, "unset">;
176
+ };
177
+
178
+ /**
179
+ * 'unknown' - we don't know if the user has consented or not (e.g. something went wrong)
180
+ * 'unset' - the user has not yet been asked for consent
181
+ * 'granted' - the user has consented
182
+ * 'denied' - the user has denied consent
183
+ */
184
+ declare type ConsentStatus = "undetermined" | "unset" | "granted" | "denied";
185
+
186
+ export declare type CoreAppManifest = z.infer<typeof coreAppManifestSchema>;
187
+
188
+ /**
189
+ * Core-app application manifest. Mirrors the workbench's
190
+ * `CoreAppUserApplicationManifest` schema. Strictly validated via zod since the
191
+ * CLI produces the payload in full.
192
+ */
193
+ declare const coreAppManifestSchema: z.ZodMiniObject<
194
+ {
195
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
196
+ icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
197
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
198
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
199
+ version: z.ZodMiniString<string>;
200
+ },
201
+ z.core.$strip
202
+ >;
203
+
204
+ declare interface DeferredEvent<
205
+ Data = unknown,
206
+ Event extends DefinedTelemetryLog<Data> = DefinedTelemetryLog<Data>,
207
+ > {
208
+ createdAt: string;
209
+ event: Event;
210
+ data: Data;
211
+ }
212
+
213
+ declare interface DefinedTelemetryLog<Schema> {
214
+ type: "log";
215
+ /** Unique name of the event */
216
+ name: string;
217
+ /** Event version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
218
+ version: number;
219
+ /** Description of log event */
220
+ description?: string;
221
+ /**
222
+ * Max sample rate of this event.
223
+ * Calling telemetry.log(EventDefinition, data) repeatedly will submit at most one event every specified time interval (in milliseconds)
224
+ * */
225
+ maxSampleRate?: number;
226
+ /** Data schema. Will not be accessible at runtime */
227
+ schema: Schema;
228
+ }
229
+
230
+ declare interface DefinedTelemetryTrace<Data = void, Context = void> {
231
+ type: "trace";
232
+ /** Unique name of the trace */
233
+ name: string;
234
+ /** Trace version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
235
+ version: number;
236
+ /** Description of trace */
237
+ description?: string;
238
+ /** Data schema. Will not be accessible at runtime */
239
+ schema: Data;
240
+ /** Contextual data schema. Will not be accessible at runtime */
241
+ context: Context;
242
+ }
243
+
244
+ export declare interface Output {
245
+ error: Command["error"];
246
+ log: Command["log"];
247
+ warn: Command["warn"];
248
+ }
249
+
250
+ /**
251
+ * Comprehensive representation of a package.json file.
252
+ * Consolidates all properties from previous type definitions.
253
+ *
254
+ * @public
255
+ */
256
+ export declare type PackageJson = z.infer<typeof packageJsonSchema>;
257
+
258
+ /**
259
+ * Comprehensive package.json schema including all common properties.
260
+ * Feel free to add properties to this,
261
+ * 🟠ℹ️ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL ℹ️🟠
262
+ * 🟠ℹ️ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE ℹ️🟠
263
+ * 🟠ℹ️ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS ℹ️🟠
264
+ */
265
+ declare const packageJsonSchema: z.ZodMiniObject<
266
+ {
267
+ name: z.ZodMiniString<string>;
268
+ version: z.ZodMiniString<string>;
269
+ dependencies: z.ZodMiniOptional<
270
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
271
+ >;
272
+ devDependencies: z.ZodMiniOptional<
273
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
274
+ >;
275
+ peerDependencies: z.ZodMiniOptional<
276
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
277
+ >;
278
+ exports: z.ZodMiniOptional<
279
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniAny>
280
+ >;
281
+ main: z.ZodMiniOptional<z.ZodMiniString<string>>;
282
+ types: z.ZodMiniOptional<z.ZodMiniString<string>>;
283
+ author: z.ZodMiniOptional<z.ZodMiniString<string>>;
284
+ description: z.ZodMiniOptional<z.ZodMiniString<string>>;
285
+ engines: z.ZodMiniOptional<
286
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
287
+ >;
288
+ license: z.ZodMiniOptional<z.ZodMiniString<string>>;
289
+ private: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
290
+ repository: z.ZodMiniOptional<
291
+ z.ZodMiniObject<
292
+ {
293
+ type: z.ZodMiniString<string>;
294
+ url: z.ZodMiniString<string>;
295
+ },
296
+ z.core.$strip
297
+ >
298
+ >;
299
+ scripts: z.ZodMiniOptional<
300
+ z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
301
+ >;
302
+ type: z.ZodMiniOptional<
303
+ z.ZodMiniEnum<{
304
+ module: "module";
305
+ commonjs: "commonjs";
306
+ }>
307
+ >;
308
+ },
309
+ z.core.$loose
310
+ >;
311
+
312
+ /**
313
+ * Result of finding a project configuration
314
+ *
315
+ * @public
316
+ */
317
+ export declare interface ProjectRootResult {
318
+ directory: string;
319
+ /**
320
+ * Path to the project configuration file, if found.
321
+ */
322
+ path: string;
323
+ /**
324
+ * Type of project root.
325
+ */
326
+ type: "app" | "studio";
327
+ }
328
+
329
+ /**
330
+ * Options for reading package.json files
331
+ *
332
+ * @public
333
+ */
334
+ export declare interface ReadPackageJsonOptions {
335
+ /**
336
+ * Default values to merge with the parsed package.json.
337
+ * Parsed values take precedence over defaults.
338
+ */
339
+ defaults?: Partial<PackageJson>;
340
+ /**
341
+ * Skip Zod schema validation. When true, the file is parsed but not validated.
342
+ * Defaults to false.
343
+ */
344
+ skipSchemaValidation?: boolean;
345
+ }
346
+
347
+ export declare type RequireProps<T, K extends keyof T> = Omit<T, K> &
348
+ Required<Pick<T, K>>;
349
+
350
+ /**
351
+ * Interface for `SanityCommand`, a wrapper around OCLIF's Command class.
352
+ * Important to keep updated as `SanityCommand` evolves so that its mock implementation (enabling fast unit tests) stays up to date as well.
353
+ * @see https://oclif.io/docs/base_class/
354
+ */
355
+ export declare interface SanityCommandInterface {
356
+ getCliConfig: () => Promise<CliConfig>;
357
+ getProjectId: (options?: {
358
+ deprecatedFlagName?: string;
359
+ fallback?: () => Promise<string>;
360
+ }) => Promise<string>;
361
+ getProjectRoot: () => Promise<ProjectRootResult>;
362
+ isUnattended: () => boolean;
363
+ output: Output;
364
+ resolveIsInteractive: () => boolean;
365
+ }
366
+
367
+ export declare type SanityOrgUser = {
368
+ email: string;
369
+ id: string;
370
+ name: string;
371
+ profileImage?: string;
372
+ provider: "github" | "google" | "sanity" | `saml-${string}`;
373
+ tosAcceptedAt?: string;
374
+ };
375
+
376
+ export declare type StudioManifest = z.infer<typeof studioManifestSchema>;
377
+
378
+ /**
379
+ * Studio application manifest (serialized `create-manifest.json`). Kept loose so
380
+ * the CLI isn't coupled to the workbench's evolving client-side schema — the
381
+ * workbench consumer is authoritative on the inner shape. See its
382
+ * `ClientManifest` for the fields clients expect.
383
+ */
384
+ declare const studioManifestSchema: z.ZodMiniRecord<
385
+ z.ZodMiniString<string>,
386
+ z.ZodMiniUnknown
387
+ >;
388
+
389
+ /**
390
+ * Note that `sessionId` is removed from the signature of these functions
391
+ */
392
+ declare interface TelemetryLogger<UserProperties> {
393
+ updateUserProperties(properties: UserProperties): void;
394
+ resume(events: DeferredEvent[]): void;
395
+ log<Data>(event: DefinedTelemetryLog<Data>, data: Data): void;
396
+ log<Data extends void>(event: DefinedTelemetryLog<Data>): void;
397
+ trace<Data>(
398
+ event: DefinedTelemetryTrace<Data>,
399
+ context?: unknown,
400
+ ): TelemetryTrace<UserProperties, Data>;
401
+ }
402
+
403
+ declare interface TelemetryTrace<UserProperties, Data> {
404
+ start(): void;
405
+ log(data: Data): void;
406
+ error(error: Error): void;
407
+ complete(): void;
408
+ newContext(name: string): TelemetryLogger<UserProperties>;
409
+ await<P extends Promise<Data>>(promise: P): P;
410
+ await<P extends Promise<unknown>>(promise: P, finalData: Data): P;
411
+ }
412
+
413
+ /**
414
+ * @public
415
+ */
416
+ export declare interface TelemetryUserProperties {
417
+ cliVersion: string;
418
+ cpuArchitecture: string;
419
+ machinePlatform: string;
420
+ runtime: string;
421
+ runtimeVersion: string;
422
+ dataset?: string;
423
+ projectId?: string;
424
+ }
425
+
426
+ export declare interface TypeGenConfig {
427
+ formatGeneratedCode: boolean;
428
+ generates: string;
429
+ overloadClientMethods: boolean;
430
+ path: string | string[];
431
+ schema: string;
432
+ }
433
+
434
+ /**
435
+ * @public
436
+ */
437
+ export declare type UserViteConfig =
438
+ | ((
439
+ config: InlineConfig,
440
+ env: ConfigEnv,
441
+ ) => InlineConfig | Promise<InlineConfig>)
442
+ | InlineConfig;
443
+
444
+ export {};
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/_exports/types.ts"],"sourcesContent":["export {type CliConfig, type TypeGenConfig} from '../config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from '../config/cli/types/userViteConfig.js'\nexport {type ApplicationType} from '../config/cli/workbenchApp.js'\nexport {type ProjectRootResult} from '../config/util/recursivelyResolveProjectRoot.js'\nexport {type SanityCommandInterface} from '../SanityCommand.js'\nexport {\n type CLITelemetryStore,\n type ConsentInformation,\n type TelemetryUserProperties,\n} from '../telemetry/types.js'\nexport {type Output, type RequireProps, type SanityOrgUser} from '../types.js'\nexport {type PackageJson, type ReadPackageJsonOptions} from '../util/readPackageJson.js'\nexport {type CoreAppManifest, type StudioManifest} from './schemas.js'\n"],"names":[],"mappings":"AAYA,WAAsE"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * This function is a replacement for built in dynamic import
3
+ * This handles the case for windows file paths especially for absolute paths.
4
+ *
5
+ * @param source - File path
6
+ */
7
+ export declare function doImport(source: string): Promise<any>;
8
+
9
+ /**
10
+ * Returns the base Sanity configuration directory for the current user.
11
+ * For persistent user settings (auth tokens, preferences, etc.).
12
+ * Respects `SANITY_INTERNAL_ENV=staging` to isolate staging instances.
13
+ *
14
+ * Layout: `~/.config/sanity{-staging}/`
15
+ *
16
+ * @returns Absolute path to the config directory
17
+ * @internal
18
+ */
19
+ export declare function getSanityConfigDir(): string;
20
+
21
+ /**
22
+ * Returns the base Sanity data directory for the current user.
23
+ * For ephemeral runtime state (dev-server registries, caches, etc.).
24
+ * Respects `SANITY_INTERNAL_ENV=staging` to isolate staging instances.
25
+ *
26
+ * Layout: `~/.sanity{-staging}/`
27
+ *
28
+ * @returns Absolute path to the data directory
29
+ * @internal
30
+ */
31
+ export declare function getSanityDataDir(): string;
32
+
33
+ /**
34
+ * Gets an environment variable with the appropriate Sanity prefix based on whether it's an app or studio.
35
+ *
36
+ * @param suffix - The suffix for the environment variable (e.g., 'SERVER_HOSTNAME')
37
+ * @param isApp - Whether to use the app prefix (SANITY_APP_) or studio prefix (SANITY_STUDIO_)
38
+ * @returns The value of the environment variable, or undefined if not set
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // For studio: SANITY_STUDIO_SERVER_HOSTNAME
43
+ * const studioHostname = getSanityEnvVar('SERVER_HOSTNAME', false)
44
+ *
45
+ * // For app: SANITY_APP_SERVER_HOSTNAME
46
+ * const appHostname = getSanityEnvVar('SERVER_HOSTNAME', true)
47
+ * ```
48
+ *
49
+ * @internal
50
+ */
51
+ export declare function getSanityEnvVar(
52
+ suffix: string,
53
+ isApp: boolean,
54
+ ): string | undefined;
55
+
56
+ /**
57
+ * @internal
58
+ * @returns The Sanity URL for the given path, using the correct domain based on the environment
59
+ */
60
+ export declare function getSanityUrl(path?: string): string;
61
+
62
+ /**
63
+ * @internal
64
+ */
65
+ export declare function getWorkspace<
66
+ T extends {
67
+ name: string;
68
+ },
69
+ >(workspaces: T[], workspaceName?: string): T;
70
+
71
+ /**
72
+ * Imports a module using jiti and returns its exports.
73
+ * This is a thin wrapper around tsx to allow swapping out the underlying implementation in the future if needed.
74
+ *
75
+ * @param filePath - Path to the module to import.
76
+ * @param options - Options for the importModule function.
77
+ * @returns The exported module.
78
+ *
79
+ * @internal
80
+ */
81
+ export declare function importModule<T = unknown>(
82
+ filePath: string | URL,
83
+ options?: ImportModuleOptions,
84
+ ): Promise<T>;
85
+
86
+ declare interface ImportModuleOptions {
87
+ /**
88
+ * Whether to return the default export of the module.
89
+ * Default: true
90
+ */
91
+ default?: boolean;
92
+ /**
93
+ * Path to the tsconfig file to use for the import. If not provided, the tsconfig
94
+ * will be inferred from the nearest `tsconfig.json` file.
95
+ */
96
+ tsconfigPath?: string;
97
+ }
98
+
99
+ export declare const isCi: () => boolean;
100
+
101
+ export declare function isInteractive(): boolean;
102
+
103
+ /**
104
+ * Checks if the environment is staging.
105
+ *
106
+ * @returns True if the environment is staging, false otherwise
107
+ * @internal
108
+ */
109
+ export declare function isStaging(): boolean;
110
+
111
+ export declare function isTrueish(value: string | undefined): boolean;
112
+
113
+ /**
114
+ * Normalizes a path for cross-platform comparison by converting backslashes to forward slashes.
115
+ * Useful for converting windows paths to unix paths.
116
+ *
117
+ * @param path - Path to normalize
118
+ * @returns Normalized path with forward slashes
119
+ * @public
120
+ */
121
+ export declare function normalizePath(path: string): string;
122
+
123
+ /**
124
+ * `structuredClone()`, but doesn't throw on non-clonable values - instead it drops them.
125
+ *
126
+ * @param obj - The object to clone.
127
+ * @returns The cloned object.
128
+ * @internal
129
+ */
130
+ export declare function safeStructuredClone<T>(obj: T): T;
131
+
132
+ export {};
@@ -0,0 +1,16 @@
1
+ // Pure in-memory and zero dep utilities
2
+ //
3
+ export { doImport } from '../util/doImport.js';
4
+ export { getSanityConfigDir, getSanityDataDir } from '../util/getSanityConfigDir.js';
5
+ export { getSanityEnvVar } from '../util/getSanityEnvVar.js';
6
+ export { getSanityUrl } from '../util/getSanityUrl.js';
7
+ export { getWorkspace } from '../util/getWorkspace.js';
8
+ export { importModule } from '../util/importModule.js';
9
+ export { isCi } from '../util/isCi.js';
10
+ export { isInteractive } from '../util/isInteractive.js';
11
+ export { isStaging } from '../util/isStaging.js';
12
+ export { isTrueish } from '../util/isTrueish.js';
13
+ export { normalizePath } from '../util/normalizePath.js';
14
+ export { safeStructuredClone } from '../util/safeStructuredClone.js';
15
+
16
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/_exports/util.ts"],"sourcesContent":["// Pure in-memory and zero dep utilities\n//\nexport {doImport} from '../util/doImport.js'\nexport {getSanityConfigDir, getSanityDataDir} from '../util/getSanityConfigDir.js'\nexport {getSanityEnvVar} from '../util/getSanityEnvVar.js'\nexport {getSanityUrl} from '../util/getSanityUrl.js'\nexport {getWorkspace} from '../util/getWorkspace.js'\nexport {importModule} from '../util/importModule.js'\nexport {isCi} from '../util/isCi.js'\nexport {isInteractive} from '../util/isInteractive.js'\nexport {isStaging} from '../util/isStaging.js'\nexport {isTrueish} from '../util/isTrueish.js'\nexport {normalizePath} from '../util/normalizePath.js'\nexport {safeStructuredClone} from '../util/safeStructuredClone.js'\n"],"names":["doImport","getSanityConfigDir","getSanityDataDir","getSanityEnvVar","getSanityUrl","getWorkspace","importModule","isCi","isInteractive","isStaging","isTrueish","normalizePath","safeStructuredClone"],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,SAAQA,QAAQ,QAAO,sBAAqB;AAC5C,SAAQC,kBAAkB,EAAEC,gBAAgB,QAAO,gCAA+B;AAClF,SAAQC,eAAe,QAAO,6BAA4B;AAC1D,SAAQC,YAAY,QAAO,0BAAyB;AACpD,SAAQC,YAAY,QAAO,0BAAyB;AACpD,SAAQC,YAAY,QAAO,0BAAyB;AACpD,SAAQC,IAAI,QAAO,kBAAiB;AACpC,SAAQC,aAAa,QAAO,2BAA0B;AACtD,SAAQC,SAAS,QAAO,uBAAsB;AAC9C,SAAQC,SAAS,QAAO,uBAAsB;AAC9C,SAAQC,aAAa,QAAO,2BAA0B;AACtD,SAAQC,mBAAmB,QAAO,iCAAgC"}
@@ -22,6 +22,8 @@ export { Boxes };
22
22
 
23
23
  export declare const checkbox: typeof inquirer.checkbox;
24
24
 
25
+ export declare function colorizeJson(input: unknown): string;
26
+
25
27
  declare const confirm_2: typeof inquirer.confirm;
26
28
  export { confirm_2 as confirm };
27
29
 
@@ -31,6 +33,13 @@ export declare const editor: typeof inquirer.editor;
31
33
 
32
34
  export declare const expand: typeof inquirer.expand;
33
35
 
36
+ /**
37
+ * Starts a terminal timer
38
+ *
39
+ * @internal
40
+ */
41
+ export declare function getTimer(): TimeMeasurer;
42
+
34
43
  export declare const input: typeof inquirer.input;
35
44
 
36
45
  export { logSymbols };
@@ -72,4 +81,10 @@ export { spinnerPromise };
72
81
 
73
82
  export { SpinnerPromiseOptions };
74
83
 
84
+ declare interface TimeMeasurer {
85
+ end: (name: string) => number;
86
+ getTimings: () => Record<string, number>;
87
+ start: (name: string) => void;
88
+ }
89
+
75
90
  export {};
@@ -1,7 +1,9 @@
1
1
  export { NonInteractiveError } from '../errors/NonInteractiveError.js';
2
- export * from '../ux/boxen.js';
3
- export * from '../ux/logSymbols.js';
4
- export * from '../ux/prompts.js';
5
- export * from '../ux/spinner.js';
2
+ export { boxen } from '../ux/boxen.js';
3
+ export { colorizeJson } from '../ux/colorizeJson.js';
4
+ export { logSymbols } from '../ux/logSymbols.js';
5
+ export { checkbox, confirm, editor, expand, input, number, password, rawlist, search, select, Separator } from '../ux/prompts.js';
6
+ export { spinner, spinnerPromise } from '../ux/spinner.js';
7
+ export { getTimer } from '../ux/timer.js';
6
8
 
7
9
  //# sourceMappingURL=ux.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/ux.ts"],"sourcesContent":["export {NonInteractiveError} from '../errors/NonInteractiveError.js'\nexport * from '../ux/boxen.js'\nexport * from '../ux/logSymbols.js'\nexport * from '../ux/prompts.js'\nexport * from '../ux/spinner.js'\n"],"names":["NonInteractiveError"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,mCAAkC;AACpE,cAAc,iBAAgB;AAC9B,cAAc,sBAAqB;AACnC,cAAc,mBAAkB;AAChC,cAAc,mBAAkB"}
1
+ {"version":3,"sources":["../../src/_exports/ux.ts"],"sourcesContent":["export {NonInteractiveError} from '../errors/NonInteractiveError.js'\nexport {\n boxen,\n type BoxenOptions,\n type Boxes,\n type CustomBorderStyle,\n type Spacing,\n} from '../ux/boxen.js'\nexport {colorizeJson} from '../ux/colorizeJson.js'\nexport {logSymbols} from '../ux/logSymbols.js'\nexport {\n checkbox,\n confirm,\n editor,\n expand,\n input,\n number,\n password,\n rawlist,\n search,\n select,\n Separator,\n} from '../ux/prompts.js'\nexport {\n spinner,\n type Spinner,\n type SpinnerInstance,\n type SpinnerOptions,\n spinnerPromise,\n type SpinnerPromiseOptions,\n} from '../ux/spinner.js'\nexport {getTimer} from '../ux/timer.js'\n"],"names":["NonInteractiveError","boxen","colorizeJson","logSymbols","checkbox","confirm","editor","expand","input","number","password","rawlist","search","select","Separator","spinner","spinnerPromise","getTimer"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,mCAAkC;AACpE,SACEC,KAAK,QAKA,iBAAgB;AACvB,SAAQC,YAAY,QAAO,wBAAuB;AAClD,SAAQC,UAAU,QAAO,sBAAqB;AAC9C,SACEC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,MAAM,EACNC,KAAK,EACLC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,MAAM,EACNC,SAAS,QACJ,mBAAkB;AACzB,SACEC,OAAO,EAIPC,cAAc,QAET,mBAAkB;AACzB,SAAQC,QAAQ,QAAO,iBAAgB"}