@sanity/cli-core 2.8.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/NonInteractiveError-CSLT5y93.d.ts +13 -0
- package/dist/ProjectRootNotFoundError-RgthN9uy.d.ts +47 -0
- package/dist/SanityCommand.d.ts +26 -355
- package/dist/SanityCommand.js +5 -0
- package/dist/SanityCommand.js.map +1 -1
- package/dist/_exports/browser.d.ts +2 -21
- package/dist/_exports/config.d.ts +5 -661
- package/dist/_exports/debug.d.ts +4 -8
- package/dist/_exports/debug.js +3 -3
- package/dist/_exports/debug.js.map +1 -1
- package/dist/_exports/errors.d.ts +12 -77
- package/dist/_exports/index.d.ts +34 -1674
- package/dist/_exports/package-manager.d.ts +14 -207
- package/dist/_exports/request.d.ts +52 -69
- package/dist/_exports/request.js +5 -4
- package/dist/_exports/request.js.map +1 -1
- package/dist/_exports/schemas.d.ts +2 -235
- package/dist/_exports/tasks.d.ts +2 -120
- package/dist/_exports/telemetry.d.ts +2 -156
- package/dist/_exports/types.d.ts +9 -475
- package/dist/_exports/undeploy.d.ts +45 -62
- package/dist/_exports/undeploy.js +1 -3
- package/dist/_exports/undeploy.js.map +1 -1
- package/dist/_exports/util.d.ts +6 -137
- package/dist/_exports/ux.d.ts +31 -102
- package/dist/apiClient-DXlF5ZV3.d.ts +65 -0
- package/dist/apiClient.d.ts +2 -79
- package/dist/apiClient.js +69 -47
- package/dist/apiClient.js.map +1 -1
- package/dist/cliConfig-CbW8neMv.d.ts +171 -0
- package/dist/errors/enrichAuthError.js +48 -0
- package/dist/errors/enrichAuthError.js.map +1 -0
- package/dist/errors/getErrorMessage.js +3 -1
- package/dist/errors/getErrorMessage.js.map +1 -1
- package/dist/executionContext.d.ts +21 -20
- package/dist/executionContext.js.map +1 -1
- package/dist/exitCodes.d.ts +3 -3
- package/dist/findStudioConfigPath-DcKlHhyW.d.ts +265 -0
- package/dist/getWorkspace-CU32E6Uo.d.ts +54 -0
- package/dist/mockBrowserEnvironment-BjFQPb2W.d.ts +19 -0
- package/dist/noopTelemetry-BJRIvASI.d.ts +64 -0
- package/dist/readPackageJson-Cr_lbjVR.d.ts +67 -0
- package/dist/recursivelyResolveProjectRoot-BE54uEP6.d.ts +18 -0
- package/dist/request/createRequester.js +39 -50
- package/dist/request/createRequester.js.map +1 -1
- package/dist/request/nodeReadableFromWeb.js +64 -0
- package/dist/request/nodeReadableFromWeb.js.map +1 -0
- package/dist/resolveLocalPackage-Dr-TNTyk.d.ts +78 -0
- package/dist/safeStructuredClone-CWB0MXmH.d.ts +58 -0
- package/dist/schemas-DRCVXpyW.d.ts +140 -0
- package/dist/timer-Dwu2TIgB.d.ts +14 -0
- package/dist/tsxWorkerTask-CxG3fWbU.d.ts +97 -0
- package/dist/types-CwJLTYDj.d.ts +23 -0
- package/dist/types-ZNH3prAd.d.ts +91 -0
- package/dist/ux/spinner.js +70 -9
- package/dist/ux/spinner.js.map +1 -1
- package/dist/workbenchApp-Dhtbsuhn.d.ts +22 -0
- package/package.json +7 -8
- package/dist/request/createIsolatedRequester.js +0 -75
- package/dist/request/createIsolatedRequester.js.map +0 -1
|
@@ -1,661 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Dashboard visibility an application can declare. Mirrors Brett's canonical
|
|
9
|
-
* `VISIBILITIES` — the source of truth lives in the application service.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
declare const APP_VISIBILITIES: readonly ["default", "unlisted", "disabled"];
|
|
13
|
-
|
|
14
|
-
/** @public */
|
|
15
|
-
declare type AppVisibility = (typeof APP_VISIBILITIES)[number];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Clear the in-process token cache so the next `getCliToken()` call
|
|
19
|
-
* re-reads from disk or the environment.
|
|
20
|
-
*
|
|
21
|
-
* Called automatically by `setCliUserConfig('authToken', ...)`.
|
|
22
|
-
*
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare function clearCliTokenCache(): void;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
export declare interface CliConfig {
|
|
31
|
-
/** The project ID and dataset the Sanity CLI should use to run its commands */
|
|
32
|
-
api?: {
|
|
33
|
-
dataset?: string;
|
|
34
|
-
projectId?: string;
|
|
35
|
-
};
|
|
36
|
-
/** Configuration for custom Sanity apps built with the App SDK */
|
|
37
|
-
app?: {
|
|
38
|
-
/** The entrypoint for your custom app. By default, `src/App.tsx` */
|
|
39
|
-
entry?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Path to an icon file relative to project root.
|
|
42
|
-
* The file must be an SVG.
|
|
43
|
-
*/
|
|
44
|
-
icon?: string;
|
|
45
|
-
/** @deprecated Use deployment.appId */
|
|
46
|
-
id?: string;
|
|
47
|
-
/** The ID for the Sanity organization that manages this application */
|
|
48
|
-
organizationId?: string;
|
|
49
|
-
/** The title of the custom app, as it is seen in Dashboard UI */
|
|
50
|
-
title?: string;
|
|
51
|
-
/** Dashboard visibility of the application. Defaults to `default`. */
|
|
52
|
-
visibility?: AppVisibility;
|
|
53
|
-
};
|
|
54
|
-
/** @deprecated Use deployment.autoUpdates */
|
|
55
|
-
autoUpdates?: boolean;
|
|
56
|
-
/** Options for custom app and Studio deployments */
|
|
57
|
-
deployment?: {
|
|
58
|
-
/**
|
|
59
|
-
* The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.
|
|
60
|
-
* Get your app ID by either:
|
|
61
|
-
* 1. Checking the output of `sanity deploy`, or
|
|
62
|
-
* 2. Checking your project’s Studio tab at https://sanity.io/manage
|
|
63
|
-
*
|
|
64
|
-
* @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.
|
|
65
|
-
* {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}
|
|
66
|
-
*/
|
|
67
|
-
appId?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Enable automatic updates for your Studio or custom app’s Sanity dependencies.
|
|
70
|
-
* {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}
|
|
71
|
-
*/
|
|
72
|
-
autoUpdates?: boolean;
|
|
73
|
-
};
|
|
74
|
-
/** Define the GraphQL APIs that the CLI can deploy and interact with */
|
|
75
|
-
graphql?: Array<{
|
|
76
|
-
filterSuffix?: string;
|
|
77
|
-
generation?: "gen1" | "gen2" | "gen3";
|
|
78
|
-
id?: string;
|
|
79
|
-
nonNullDocumentFields?: boolean;
|
|
80
|
-
playground?: boolean;
|
|
81
|
-
source?: string;
|
|
82
|
-
tag?: string;
|
|
83
|
-
workspace?: string;
|
|
84
|
-
}>;
|
|
85
|
-
/** Configuration for the Media Library */
|
|
86
|
-
mediaLibrary?: {
|
|
87
|
-
/** 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. */
|
|
88
|
-
aspectsPath?: string;
|
|
89
|
-
};
|
|
90
|
-
/** 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. */
|
|
91
|
-
project?: {
|
|
92
|
-
basePath?: string;
|
|
93
|
-
};
|
|
94
|
-
/** Configuration options for React Compiler */
|
|
95
|
-
reactCompiler?: boolean | PluginOptions;
|
|
96
|
-
/** 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. */
|
|
97
|
-
reactStrictMode?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Configuration for schema extraction (`sanity schema extract`)
|
|
100
|
-
*/
|
|
101
|
-
schemaExtraction?: {
|
|
102
|
-
/**
|
|
103
|
-
* Enable schema extraction as part of sanity dev and sanity build
|
|
104
|
-
*/
|
|
105
|
-
enabled?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* When true, schema fields marked as required will be non-optional in the output.
|
|
108
|
-
* Defaults to `false`
|
|
109
|
-
*/
|
|
110
|
-
enforceRequiredFields?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Output path for the extracted schema file.
|
|
113
|
-
* Defaults to `schema.json` in the working directory.
|
|
114
|
-
*/
|
|
115
|
-
path?: string;
|
|
116
|
-
/**
|
|
117
|
-
* Additional glob patterns to watch for schema changes in watch mode.
|
|
118
|
-
* These extend the default patterns:
|
|
119
|
-
* - `sanity.config.{js,jsx,ts,tsx,mjs}`
|
|
120
|
-
* - `schema*\/**\/*.{js,jsx,ts,tsx,mjs}`
|
|
121
|
-
*/
|
|
122
|
-
watchPatterns?: string[];
|
|
123
|
-
/**
|
|
124
|
-
* The name of the workspace to generate a schema for. Required if your Sanity project has more than one
|
|
125
|
-
* workspace.
|
|
126
|
-
*/
|
|
127
|
-
workspace?: string;
|
|
128
|
-
};
|
|
129
|
-
/** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */
|
|
130
|
-
server?: {
|
|
131
|
-
hostname?: string;
|
|
132
|
-
port?: number;
|
|
133
|
-
};
|
|
134
|
-
/** @deprecated Use deployment.appId */
|
|
135
|
-
studioHost?: string;
|
|
136
|
-
/**
|
|
137
|
-
* Configuration for Sanity typegen
|
|
138
|
-
*/
|
|
139
|
-
typegen?: Partial<TypeGenConfig> & {
|
|
140
|
-
/**
|
|
141
|
-
* Enable typegen as part of sanity dev and sanity build.
|
|
142
|
-
* When enabled, types are generated on startup and when files change.
|
|
143
|
-
* Defaults to `false`
|
|
144
|
-
*/
|
|
145
|
-
enabled?: boolean;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Enable Vite's experimental bundled dev mode for `sanity dev`. This serves bundled
|
|
149
|
-
* files during development, which can speed up startup and reloads for large projects.
|
|
150
|
-
* Defaults to `false`.
|
|
151
|
-
*
|
|
152
|
-
* Unstable: may change or be removed without notice while the underlying Vite
|
|
153
|
-
* feature (`experimental.bundledDev`) is experimental.
|
|
154
|
-
* {@link https://vite.dev/guide/rolldown#full-bundle-mode}
|
|
155
|
-
*/
|
|
156
|
-
unstable_bundledDev?: boolean;
|
|
157
|
-
/** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */
|
|
158
|
-
vite?: UserViteConfig;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* A raw key-value store for CLI user configuration.
|
|
163
|
-
* Unlike the typed `getCliUserConfig`/`setCliUserConfig`, this operates on
|
|
164
|
-
* arbitrary keys without schema validation.
|
|
165
|
-
*
|
|
166
|
-
* @public
|
|
167
|
-
*/
|
|
168
|
-
export declare interface ConfigStore {
|
|
169
|
-
/** Remove a key from the config file. */
|
|
170
|
-
delete: (key: string) => void;
|
|
171
|
-
/** Read a value by key. Returns `undefined` if the key does not exist. */
|
|
172
|
-
get: (key: string) => unknown;
|
|
173
|
-
/** Write a value by key, merging it into the existing config. */
|
|
174
|
-
set: (key: string, value: unknown) => void;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Finds the path for a given set of files.
|
|
179
|
-
*
|
|
180
|
-
* @param basePath - The base path to search for files.
|
|
181
|
-
* @param files - The files to search for.
|
|
182
|
-
* @internal
|
|
183
|
-
*/
|
|
184
|
-
export declare function findPathForFiles(
|
|
185
|
-
basePath: string,
|
|
186
|
-
files: string[],
|
|
187
|
-
): Promise<PathResult[]>;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Resolve project root directory and type.
|
|
191
|
-
*
|
|
192
|
-
* Project root is:
|
|
193
|
-
* - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)
|
|
194
|
-
* - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)
|
|
195
|
-
*
|
|
196
|
-
* If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),
|
|
197
|
-
* an error is thrown, as v2/v1 is no longer supported.
|
|
198
|
-
*
|
|
199
|
-
* @internal
|
|
200
|
-
*/
|
|
201
|
-
export declare function findProjectRoot(
|
|
202
|
-
cwd: string,
|
|
203
|
-
): Promise<ProjectRootResult>;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Resolve project root directory and type synchronously.
|
|
207
|
-
*
|
|
208
|
-
* Project root is:
|
|
209
|
-
* - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)
|
|
210
|
-
* - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)
|
|
211
|
-
*
|
|
212
|
-
* If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),
|
|
213
|
-
* an error is thrown, as v2/v1 is no longer supported.
|
|
214
|
-
*
|
|
215
|
-
* @param cwd - Current working directory to start searching from
|
|
216
|
-
* @returns Project root result
|
|
217
|
-
* @internal
|
|
218
|
-
*/
|
|
219
|
-
export declare function findProjectRootSync(cwd: string): ProjectRootResult;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Resolves to a string containing the found config path, otherwise throws an error.
|
|
223
|
-
* Also throws if Sanity v2 studio root is found.
|
|
224
|
-
*
|
|
225
|
-
* @param basePath - The base path to start searching from
|
|
226
|
-
* @returns A promise that resolves to a string containing the found config path
|
|
227
|
-
* @throws On multiple config files found, if v2 studio root found, or no config found
|
|
228
|
-
* @internal
|
|
229
|
-
*/
|
|
230
|
-
export declare function findStudioConfigPath(basePath: string): Promise<string>;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Get the CLI config for a project, given the root path.
|
|
234
|
-
*
|
|
235
|
-
* Results are cached in-memory keyed by rootPath for the lifetime of the
|
|
236
|
-
* process. Since the CLI always runs from a single project root, the config
|
|
237
|
-
* won't change during a command's execution, so caching avoids redundant
|
|
238
|
-
* filesystem reads and jiti imports from the prerun hook, SanityCommand
|
|
239
|
-
* helpers, and action files.
|
|
240
|
-
*
|
|
241
|
-
* If loading fails the cached promise is evicted so the next call retries.
|
|
242
|
-
*
|
|
243
|
-
* Long-lived processes that need to observe edits to `sanity.cli.(ts|js)`
|
|
244
|
-
* (e.g. a dev-server watcher) should use {@link getCliConfigUncached}
|
|
245
|
-
* instead — it bypasses both this in-memory cache and Node's module cache.
|
|
246
|
-
*
|
|
247
|
-
* @param rootPath - Root path for the project, eg where `sanity.cli.(ts|js)` is located.
|
|
248
|
-
* @returns The CLI config
|
|
249
|
-
* @internal
|
|
250
|
-
*/
|
|
251
|
-
export declare function getCliConfig(rootPath: string): Promise<CliConfig>;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Get the CLI config for a project synchronously, given the root path.
|
|
255
|
-
*
|
|
256
|
-
* This loads the CLI config in the main thread using tsx/register for TypeScript support.
|
|
257
|
-
* Note: This is a synchronous operation and does not use worker threads like the async version.
|
|
258
|
-
*
|
|
259
|
-
* @param rootPath - Root path for the project, eg where `sanity.cli.(ts|js)` is located.
|
|
260
|
-
* @returns The CLI config
|
|
261
|
-
* @internal
|
|
262
|
-
*/
|
|
263
|
-
export declare function getCliConfigSync(rootPath: string): CliConfig;
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Read the CLI config for a project from disk, bypassing both the
|
|
267
|
-
* `getCliConfig` in-memory cache and Node's module cache. Each call locates
|
|
268
|
-
* `sanity.cli.(ts|js)`, drops any prior jiti compilation from `require.cache`,
|
|
269
|
-
* re-imports, and re-validates.
|
|
270
|
-
*
|
|
271
|
-
* Use this when the config file is expected to change during the process's
|
|
272
|
-
* lifetime — typically a dev-server watcher that needs the new values picked
|
|
273
|
-
* up after each save. One-shot CLI invocations should prefer
|
|
274
|
-
* {@link getCliConfig} so the prerun hook, SanityCommand helpers, and action
|
|
275
|
-
* files share a single load.
|
|
276
|
-
*
|
|
277
|
-
* @param rootPath - Root path for the project, eg where `sanity.cli.(ts|js)` is located.
|
|
278
|
-
* @returns The freshly loaded CLI config
|
|
279
|
-
* @internal
|
|
280
|
-
*/
|
|
281
|
-
export declare function getCliConfigUncached(
|
|
282
|
-
rootPath: string,
|
|
283
|
-
): Promise<CliConfig>;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Get the CLI authentication token from the environment or the config file
|
|
287
|
-
*
|
|
288
|
-
* @returns A promise that resolves to a CLI token, or undefined if no token is found
|
|
289
|
-
* @internal
|
|
290
|
-
*/
|
|
291
|
-
export declare function getCliToken(): Promise<string | undefined>;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Get the config value for the given property
|
|
295
|
-
*
|
|
296
|
-
* @param prop - The property to get the value for
|
|
297
|
-
* @returns The value of the given property
|
|
298
|
-
*/
|
|
299
|
-
export declare function getCliUserConfig(prop: "authToken"): string | undefined;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Returns the base Sanity configuration directory for the current user.
|
|
303
|
-
* For persistent user settings (auth tokens, preferences, etc.).
|
|
304
|
-
* Respects `SANITY_INTERNAL_ENV=staging` to isolate staging instances.
|
|
305
|
-
*
|
|
306
|
-
* Layout: `~/.config/sanity{-staging}/`
|
|
307
|
-
*
|
|
308
|
-
* @returns Absolute path to the config directory
|
|
309
|
-
* @internal
|
|
310
|
-
*/
|
|
311
|
-
export declare function getSanityConfigDir(): string;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Returns the base Sanity data directory for the current user.
|
|
315
|
-
* For ephemeral runtime state (dev-server registries, caches, etc.).
|
|
316
|
-
* Respects `SANITY_INTERNAL_ENV=staging` to isolate staging instances.
|
|
317
|
-
*
|
|
318
|
-
* Layout: `~/.sanity{-staging}/`
|
|
319
|
-
*
|
|
320
|
-
* @returns Absolute path to the data directory
|
|
321
|
-
* @internal
|
|
322
|
-
*/
|
|
323
|
-
export declare function getSanityDataDir(): string;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Gets an environment variable with the appropriate Sanity prefix based on whether it's an app or studio.
|
|
327
|
-
*
|
|
328
|
-
* @param suffix - The suffix for the environment variable (e.g., 'SERVER_HOSTNAME')
|
|
329
|
-
* @param isApp - Whether to use the app prefix (SANITY_APP_) or studio prefix (SANITY_STUDIO_)
|
|
330
|
-
* @returns The value of the environment variable, or undefined if not set
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```ts
|
|
334
|
-
* // For studio: SANITY_STUDIO_SERVER_HOSTNAME
|
|
335
|
-
* const studioHostname = getSanityEnvVar('SERVER_HOSTNAME', false)
|
|
336
|
-
*
|
|
337
|
-
* // For app: SANITY_APP_SERVER_HOSTNAME
|
|
338
|
-
* const appHostname = getSanityEnvVar('SERVER_HOSTNAME', true)
|
|
339
|
-
* ```
|
|
340
|
-
*
|
|
341
|
-
* @internal
|
|
342
|
-
*/
|
|
343
|
-
export declare function getSanityEnvVar(
|
|
344
|
-
suffix: string,
|
|
345
|
-
isApp: boolean,
|
|
346
|
-
): string | undefined;
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* @internal
|
|
350
|
-
* @returns The Sanity URL for the given path, using the correct domain based on the environment
|
|
351
|
-
*/
|
|
352
|
-
export declare function getSanityUrl(path?: string): string;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Get the studio config for a project, given the root path.
|
|
356
|
-
*
|
|
357
|
-
* @param rootPath - The root path for the project
|
|
358
|
-
* @returns The studio config (some properties may be missing)
|
|
359
|
-
* @public
|
|
360
|
-
*/
|
|
361
|
-
export declare function getStudioConfig(
|
|
362
|
-
rootPath: string,
|
|
363
|
-
options: {
|
|
364
|
-
resolvePlugins: true;
|
|
365
|
-
},
|
|
366
|
-
): Promise<ResolvedStudioConfig>;
|
|
367
|
-
|
|
368
|
-
export declare function getStudioConfig(
|
|
369
|
-
rootPath: string,
|
|
370
|
-
options: {
|
|
371
|
-
resolvePlugins: false;
|
|
372
|
-
},
|
|
373
|
-
): Promise<RawStudioConfig>;
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Resolves the workspaces from the studio config.
|
|
377
|
-
*
|
|
378
|
-
* NOTE: This function should only be called from a worker thread.
|
|
379
|
-
*
|
|
380
|
-
* @param configPath - The path to the studio config
|
|
381
|
-
* @returns The workspaces
|
|
382
|
-
* @internal
|
|
383
|
-
*/
|
|
384
|
-
export declare function getStudioWorkspaces(
|
|
385
|
-
configPath: string,
|
|
386
|
-
): Promise<Workspace[]>;
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Get a key-value store backed by the CLI user configuration file
|
|
390
|
-
* (`~/.config/sanity/config.json`).
|
|
391
|
-
*
|
|
392
|
-
* Each call to `get`, `set`, or `delete` performs a full synchronous
|
|
393
|
-
* read-modify-write cycle. This is intentional: sync I/O prevents
|
|
394
|
-
* intra-process race conditions that occurred with the previous async
|
|
395
|
-
* (configstore-backed) implementation.
|
|
396
|
-
*
|
|
397
|
-
* Note: there is no file-level locking, so concurrent writes from
|
|
398
|
-
* separate CLI processes could still conflict. In practice this is
|
|
399
|
-
* unlikely since CLI config writes are rare and user-initiated.
|
|
400
|
-
*
|
|
401
|
-
* @returns A {@link ConfigStore} for the CLI config file
|
|
402
|
-
* @public
|
|
403
|
-
*/
|
|
404
|
-
export declare function getUserConfig(): ConfigStore;
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* @internal
|
|
408
|
-
*/
|
|
409
|
-
export declare function getWorkspace<
|
|
410
|
-
T extends {
|
|
411
|
-
name: string;
|
|
412
|
-
},
|
|
413
|
-
>(workspaces: T[], workspaceName?: string): T;
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Checks if the given value conforms to a minimum studio config shape.
|
|
417
|
-
*
|
|
418
|
-
* @param value - The value to check
|
|
419
|
-
* @returns Whether the value is a studio config
|
|
420
|
-
* @internal
|
|
421
|
-
*/
|
|
422
|
-
export declare function isStudioConfig(value: unknown): boolean;
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Boolean brand check — used for config-load routing, kept exported for
|
|
426
|
-
* backward compatibility. For the typed narrowing (the app's declared fields),
|
|
427
|
-
* use `isWorkbenchApp` from `@sanity/workbench-cli`, derived from the schema.
|
|
428
|
-
*/
|
|
429
|
-
export declare function isWorkbenchApp(app: CliConfig["app"]): boolean;
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Parse a config whose `app` is a branded `unstable_defineApp(...)` result. The
|
|
433
|
-
* branded `app` bypasses the legacy `app` schema (which would strip its identity
|
|
434
|
-
* fields and the brand); every other field is still validated.
|
|
435
|
-
*
|
|
436
|
-
* Resolves `applicationType` once, here, so studio-vs-app is settled everywhere
|
|
437
|
-
* downstream. The value lands on a clone, never the caller's object, so
|
|
438
|
-
* re-parsing the same `app` for another directory can't inherit a stale guess.
|
|
439
|
-
*/
|
|
440
|
-
export declare function parseWorkbenchCliConfig(
|
|
441
|
-
cliConfig: unknown,
|
|
442
|
-
projectDir: string,
|
|
443
|
-
): CliConfig;
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* @internal
|
|
447
|
-
*/
|
|
448
|
-
declare interface PathResult {
|
|
449
|
-
exists: boolean;
|
|
450
|
-
path: string;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Result of finding a project configuration
|
|
455
|
-
*
|
|
456
|
-
* @public
|
|
457
|
-
*/
|
|
458
|
-
declare interface ProjectRootResult {
|
|
459
|
-
directory: string;
|
|
460
|
-
/**
|
|
461
|
-
* Path to the project configuration file, if found.
|
|
462
|
-
*/
|
|
463
|
-
path: string;
|
|
464
|
-
/**
|
|
465
|
-
* Type of project root.
|
|
466
|
-
*/
|
|
467
|
-
type: "app" | "studio";
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
declare const rawConfigSchema: z.ZodMiniUnion<
|
|
471
|
-
readonly [
|
|
472
|
-
z.ZodMiniArray<
|
|
473
|
-
z.ZodMiniObject<
|
|
474
|
-
{
|
|
475
|
-
basePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
476
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
477
|
-
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
478
|
-
schema: z.ZodMiniOptional<
|
|
479
|
-
z.ZodMiniObject<
|
|
480
|
-
{
|
|
481
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
482
|
-
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
483
|
-
},
|
|
484
|
-
z.core.$loose
|
|
485
|
-
>
|
|
486
|
-
>;
|
|
487
|
-
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
488
|
-
unstable_sources: z.ZodMiniOptional<
|
|
489
|
-
z.ZodMiniArray<
|
|
490
|
-
z.ZodMiniObject<
|
|
491
|
-
{
|
|
492
|
-
dataset: z.ZodMiniString<string>;
|
|
493
|
-
projectId: z.ZodMiniString<string>;
|
|
494
|
-
schema: z.ZodMiniObject<
|
|
495
|
-
{
|
|
496
|
-
_original: z.ZodMiniObject<
|
|
497
|
-
{
|
|
498
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
499
|
-
types: z.ZodMiniArray<
|
|
500
|
-
z.ZodMiniObject<{}, z.core.$loose>
|
|
501
|
-
>;
|
|
502
|
-
},
|
|
503
|
-
z.core.$loose
|
|
504
|
-
>;
|
|
505
|
-
},
|
|
506
|
-
z.core.$loose
|
|
507
|
-
>;
|
|
508
|
-
},
|
|
509
|
-
z.core.$loose
|
|
510
|
-
>
|
|
511
|
-
>
|
|
512
|
-
>;
|
|
513
|
-
dataset: z.ZodMiniString<string>;
|
|
514
|
-
projectId: z.ZodMiniString<string>;
|
|
515
|
-
},
|
|
516
|
-
z.core.$loose
|
|
517
|
-
>
|
|
518
|
-
>,
|
|
519
|
-
z.ZodMiniObject<
|
|
520
|
-
{
|
|
521
|
-
basePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
522
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
523
|
-
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
524
|
-
schema: z.ZodMiniOptional<
|
|
525
|
-
z.ZodMiniObject<
|
|
526
|
-
{
|
|
527
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
528
|
-
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
529
|
-
},
|
|
530
|
-
z.core.$loose
|
|
531
|
-
>
|
|
532
|
-
>;
|
|
533
|
-
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
534
|
-
unstable_sources: z.ZodMiniOptional<
|
|
535
|
-
z.ZodMiniArray<
|
|
536
|
-
z.ZodMiniObject<
|
|
537
|
-
{
|
|
538
|
-
dataset: z.ZodMiniString<string>;
|
|
539
|
-
projectId: z.ZodMiniString<string>;
|
|
540
|
-
schema: z.ZodMiniObject<
|
|
541
|
-
{
|
|
542
|
-
_original: z.ZodMiniObject<
|
|
543
|
-
{
|
|
544
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
545
|
-
types: z.ZodMiniArray<
|
|
546
|
-
z.ZodMiniObject<{}, z.core.$loose>
|
|
547
|
-
>;
|
|
548
|
-
},
|
|
549
|
-
z.core.$loose
|
|
550
|
-
>;
|
|
551
|
-
},
|
|
552
|
-
z.core.$loose
|
|
553
|
-
>;
|
|
554
|
-
},
|
|
555
|
-
z.core.$loose
|
|
556
|
-
>
|
|
557
|
-
>
|
|
558
|
-
>;
|
|
559
|
-
dataset: z.ZodMiniString<string>;
|
|
560
|
-
projectId: z.ZodMiniString<string>;
|
|
561
|
-
},
|
|
562
|
-
z.core.$loose
|
|
563
|
-
>,
|
|
564
|
-
]
|
|
565
|
-
>;
|
|
566
|
-
|
|
567
|
-
declare type RawStudioConfig = z.infer<typeof rawConfigSchema>;
|
|
568
|
-
|
|
569
|
-
declare const resolvedConfigSchema: z.ZodMiniArray<
|
|
570
|
-
z.ZodMiniObject<
|
|
571
|
-
{
|
|
572
|
-
basePath: z.ZodMiniString<string>;
|
|
573
|
-
name: z.ZodMiniString<string>;
|
|
574
|
-
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
575
|
-
title: z.ZodMiniString<string>;
|
|
576
|
-
unstable_sources: z.ZodMiniArray<
|
|
577
|
-
z.ZodMiniObject<
|
|
578
|
-
{
|
|
579
|
-
dataset: z.ZodMiniString<string>;
|
|
580
|
-
projectId: z.ZodMiniString<string>;
|
|
581
|
-
schema: z.ZodMiniObject<
|
|
582
|
-
{
|
|
583
|
-
_original: z.ZodMiniObject<
|
|
584
|
-
{
|
|
585
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
586
|
-
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
587
|
-
},
|
|
588
|
-
z.core.$loose
|
|
589
|
-
>;
|
|
590
|
-
},
|
|
591
|
-
z.core.$loose
|
|
592
|
-
>;
|
|
593
|
-
},
|
|
594
|
-
z.core.$loose
|
|
595
|
-
>
|
|
596
|
-
>;
|
|
597
|
-
dataset: z.ZodMiniString<string>;
|
|
598
|
-
projectId: z.ZodMiniString<string>;
|
|
599
|
-
schema: z.ZodMiniObject<
|
|
600
|
-
{
|
|
601
|
-
_original: z.ZodMiniObject<
|
|
602
|
-
{
|
|
603
|
-
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
604
|
-
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
605
|
-
},
|
|
606
|
-
z.core.$loose
|
|
607
|
-
>;
|
|
608
|
-
},
|
|
609
|
-
z.core.$loose
|
|
610
|
-
>;
|
|
611
|
-
},
|
|
612
|
-
z.core.$loose
|
|
613
|
-
>
|
|
614
|
-
>;
|
|
615
|
-
|
|
616
|
-
declare type ResolvedStudioConfig = z.infer<typeof resolvedConfigSchema>;
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Set the config value for the given property.
|
|
620
|
-
* Validates that the passed value adheres to the defined CLI config schema.
|
|
621
|
-
*
|
|
622
|
-
* @param prop - The property to set the value for
|
|
623
|
-
* @param value - The value to set
|
|
624
|
-
* @internal
|
|
625
|
-
*/
|
|
626
|
-
export declare function setCliUserConfig(
|
|
627
|
-
prop: "authToken",
|
|
628
|
-
value: string | undefined,
|
|
629
|
-
): void;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Tries to find the studio config path, returning `undefined` if not found.
|
|
633
|
-
*
|
|
634
|
-
* @param basePath - The base path to start searching from
|
|
635
|
-
* @returns A promise that resolves to a string containing the found config path, or `undefined` if not found
|
|
636
|
-
* @throws On errors other than config not found
|
|
637
|
-
* @internal
|
|
638
|
-
*/
|
|
639
|
-
export declare function tryFindStudioConfigPath(
|
|
640
|
-
basePath: string,
|
|
641
|
-
): Promise<string | undefined>;
|
|
642
|
-
|
|
643
|
-
export declare interface TypeGenConfig {
|
|
644
|
-
formatGeneratedCode: boolean;
|
|
645
|
-
generates: string;
|
|
646
|
-
overloadClientMethods: boolean;
|
|
647
|
-
path: string | string[];
|
|
648
|
-
schema: string;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* @public
|
|
653
|
-
*/
|
|
654
|
-
declare type UserViteConfig =
|
|
655
|
-
| ((
|
|
656
|
-
config: InlineConfig,
|
|
657
|
-
env: ConfigEnv,
|
|
658
|
-
) => InlineConfig | Promise<InlineConfig>)
|
|
659
|
-
| InlineConfig;
|
|
660
|
-
|
|
661
|
-
export {};
|
|
1
|
+
import { a as TypeGenConfig, i as ConfigStore, r as CliConfig } from "../cliConfig-CbW8neMv.js";
|
|
2
|
+
import { a as getStudioWorkspaces, c as findProjectRoot, d as getCliConfigUncached, f as getCliToken, g as clearCliTokenCache, h as setCliUserConfig, i as isStudioConfig, l as getCliConfigSync, m as getUserConfig, n as tryFindStudioConfigPath, o as getStudioConfig, p as getCliUserConfig, r as findPathForFiles, s as findProjectRootSync, t as findStudioConfigPath, u as getCliConfig } from "../findStudioConfigPath-DcKlHhyW.js";
|
|
3
|
+
import { n as isWorkbenchApp, r as parseWorkbenchCliConfig } from "../workbenchApp-Dhtbsuhn.js";
|
|
4
|
+
import { a as getSanityDataDir, i as getSanityConfigDir, n as getSanityUrl, r as getSanityEnvVar, t as getWorkspace } from "../getWorkspace-CU32E6Uo.js";
|
|
5
|
+
export { type CliConfig, type ConfigStore, type TypeGenConfig, clearCliTokenCache, findPathForFiles, findProjectRoot, findProjectRootSync, findStudioConfigPath, getCliConfig, getCliConfigSync, getCliConfigUncached, getCliToken, getCliUserConfig, getSanityConfigDir, getSanityDataDir, getSanityEnvVar, getSanityUrl, getStudioConfig, getStudioWorkspaces, getUserConfig, getWorkspace, isStudioConfig, isWorkbenchApp, parseWorkbenchCliConfig, setCliUserConfig, tryFindStudioConfigPath };
|
package/dist/_exports/debug.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import debugIt from "debug";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* `debug` instance for the CLI
|
|
5
3
|
*
|
|
6
4
|
* @internal
|
|
7
5
|
*/
|
|
8
|
-
declare const
|
|
9
|
-
export { debug_2 as debug };
|
|
10
|
-
|
|
6
|
+
declare const debug: import("obug").Debugger;
|
|
11
7
|
/**
|
|
12
8
|
* Get a `debug` instance which extends the CLI debug instance with the given namespace,
|
|
13
9
|
* eg namespace would be `sanity:cli:<providedNamespace>`
|
|
@@ -15,6 +11,6 @@ export { debug_2 as debug };
|
|
|
15
11
|
* @param namespace - The namespace to extend the CLI debug instance with
|
|
16
12
|
* @returns The extended `debug` instance
|
|
17
13
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
declare const subdebug: (namespace: string) => import("obug").Debugger;
|
|
15
|
+
export { debug, subdebug };
|
|
16
|
+
//# sourceMappingURL=debug.d.ts.map
|
package/dist/_exports/debug.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createDebug } from 'obug';
|
|
2
2
|
import { getCliExecutionContext } from '../executionContext.js';
|
|
3
3
|
/**
|
|
4
4
|
* `debug` instance for the CLI
|
|
5
5
|
*
|
|
6
6
|
* @internal
|
|
7
|
-
*/ export const debug =
|
|
8
|
-
const defaultLog =
|
|
7
|
+
*/ export const debug = createDebug('sanity:cli');
|
|
8
|
+
const defaultLog = debug.log.bind(debug);
|
|
9
9
|
debug.log = (...args)=>{
|
|
10
10
|
// DEBUG belongs to the embedding process, not to an individual invocation.
|
|
11
11
|
// Suppress it inside the execution context so it cannot bypass output sinks or expose request details to unrelated host logs.
|