@sanity/cli-core 0.1.0-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SanityCommand.js +88 -5
- package/dist/SanityCommand.js.map +1 -1
- package/dist/_exports/request.d.ts +77 -0
- package/dist/_exports/request.js +7 -0
- package/dist/_exports/request.js.map +1 -0
- package/dist/_exports/ux.d.ts +75 -4
- package/dist/_exports/ux.js +2 -1
- package/dist/_exports/ux.js.map +1 -1
- package/dist/config/cli/getCliConfig.js +33 -33
- package/dist/config/cli/getCliConfig.js.map +1 -1
- package/dist/config/cli/getCliConfigSync.js +1 -1
- package/dist/config/cli/getCliConfigSync.js.map +1 -1
- package/dist/config/cli/schemas.js +7 -0
- package/dist/config/cli/schemas.js.map +1 -1
- package/dist/config/cli/types/cliConfig.js.map +1 -1
- package/dist/config/findProjectRoot.js +8 -4
- package/dist/config/findProjectRoot.js.map +1 -1
- package/dist/config/findProjectRootSync.js +7 -3
- package/dist/config/findProjectRootSync.js.map +1 -1
- package/dist/config/studio/getStudioConfig.js +0 -3
- package/dist/config/studio/getStudioConfig.js.map +1 -1
- package/dist/config/studio/getStudioWorkspaces.js +63 -0
- package/dist/config/studio/getStudioWorkspaces.js.map +1 -0
- package/dist/config/studio/isStudioConfig.js +19 -0
- package/dist/config/studio/isStudioConfig.js.map +1 -0
- package/dist/config/studio/readStudioConfig.worker.js +8 -34
- package/dist/config/studio/readStudioConfig.worker.js.map +1 -1
- package/dist/config/util/findStudioConfigPath.js +24 -3
- package/dist/config/util/findStudioConfigPath.js.map +1 -1
- package/dist/config/util/recursivelyResolveProjectRoot.js.map +1 -1
- package/dist/errors/NonInteractiveError.js +18 -0
- package/dist/errors/NonInteractiveError.js.map +1 -0
- package/dist/{util → errors}/NotFoundError.js +1 -1
- package/dist/errors/NotFoundError.js.map +1 -0
- package/dist/errors/ProjectRootNotFoundError.js +35 -0
- package/dist/errors/ProjectRootNotFoundError.js.map +1 -0
- package/dist/index.d.ts +1247 -36
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/loaders/studio/studioWorkerLoader.worker.js +102 -23
- package/dist/loaders/studio/studioWorkerLoader.worker.js.map +1 -1
- package/dist/loaders/studio/studioWorkerTask.js +55 -34
- package/dist/loaders/studio/studioWorkerTask.js.map +1 -1
- package/dist/loaders/tsx/tsxWorkerLoader.worker.js +3 -4
- package/dist/loaders/tsx/tsxWorkerLoader.worker.js.map +1 -1
- package/dist/loaders/tsx/tsxWorkerTask.js +4 -31
- package/dist/loaders/tsx/tsxWorkerTask.js.map +1 -1
- package/dist/request/createRequester.js +83 -0
- package/dist/request/createRequester.js.map +1 -0
- package/dist/services/apiClient.js +8 -4
- package/dist/services/apiClient.js.map +1 -1
- package/dist/services/cliUserConfig.js +5 -5
- package/dist/services/cliUserConfig.js.map +1 -1
- package/dist/services/getCliToken.js +2 -2
- package/dist/services/getCliToken.js.map +1 -1
- package/dist/telemetry/getTelemetryBaseInfo.js +33 -0
- package/dist/telemetry/getTelemetryBaseInfo.js.map +1 -0
- package/dist/telemetry/types.js +5 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/util/doImport.js +2 -1
- package/dist/util/doImport.js.map +1 -1
- package/dist/util/environment/mockBrowserEnvironment.js +1 -0
- package/dist/util/environment/mockBrowserEnvironment.js.map +1 -1
- package/dist/util/getCliTelemetry.js +34 -0
- package/dist/util/getCliTelemetry.js.map +1 -0
- package/dist/util/getSanityUrl.js +4 -3
- package/dist/util/getSanityUrl.js.map +1 -1
- package/dist/util/importModule.js +32 -0
- package/dist/util/importModule.js.map +1 -0
- package/dist/util/isInteractive.js +1 -1
- package/dist/util/isInteractive.js.map +1 -1
- package/dist/util/isStaging.js +10 -0
- package/dist/util/isStaging.js.map +1 -0
- package/dist/util/normalizePath.js +12 -0
- package/dist/util/normalizePath.js.map +1 -0
- package/dist/util/promisifyWorker.js +72 -0
- package/dist/util/promisifyWorker.js.map +1 -0
- package/dist/util/readNDJSON.js +18 -0
- package/dist/util/readNDJSON.js.map +1 -0
- package/dist/util/readPackageJson.js +74 -0
- package/dist/util/readPackageJson.js.map +1 -0
- package/dist/ux/boxen.js +3 -0
- package/dist/ux/boxen.js.map +1 -0
- package/dist/ux/colorizeJson.js +6 -6
- package/dist/ux/colorizeJson.js.map +1 -1
- package/dist/ux/prompts.js +49 -1
- package/dist/ux/prompts.js.map +1 -1
- package/package.json +39 -31
- package/dist/SanityCommand.d.ts +0 -78
- package/dist/_exports/tree.d.ts +0 -1
- package/dist/_exports/tree.js +0 -3
- package/dist/_exports/tree.js.map +0 -1
- package/dist/config/cli/getCliConfig.d.ts +0 -16
- package/dist/config/cli/getCliConfig.worker.d.ts +0 -1
- package/dist/config/cli/getCliConfig.worker.js +0 -15
- package/dist/config/cli/getCliConfig.worker.js.map +0 -1
- package/dist/config/cli/getCliConfigSync.d.ts +0 -12
- package/dist/config/cli/schemas.d.ts +0 -104
- package/dist/config/cli/types/cliConfig.d.ts +0 -83
- package/dist/config/cli/types/userViteConfig.d.ts +0 -5
- package/dist/config/findProjectRoot.d.ts +0 -14
- package/dist/config/findProjectRootSync.d.ts +0 -27
- package/dist/config/studio/getStudioConfig.d.ts +0 -14
- package/dist/config/studio/readStudioConfig.d.ts +0 -96
- package/dist/config/studio/readStudioConfig.worker.d.ts +0 -1
- package/dist/config/util/configPathsSync.d.ts +0 -17
- package/dist/config/util/findAppConfigPath.d.ts +0 -8
- package/dist/config/util/findConfigsPaths.d.ts +0 -16
- package/dist/config/util/findStudioConfigPath.d.ts +0 -9
- package/dist/config/util/isSanityV2StudioRoot.d.ts +0 -8
- package/dist/config/util/recursivelyResolveProjectRoot.d.ts +0 -27
- package/dist/debug.d.ts +0 -15
- package/dist/loaders/studio/studioWorkerLoader.worker.d.ts +0 -1
- package/dist/loaders/studio/studioWorkerTask.d.ts +0 -40
- package/dist/loaders/tsx/tsxWorkerLoader.worker.d.ts +0 -1
- package/dist/loaders/tsx/tsxWorkerTask.d.ts +0 -28
- package/dist/services/apiClient.d.ts +0 -53
- package/dist/services/cliUserConfig.d.ts +0 -40
- package/dist/services/getCliToken.d.ts +0 -7
- package/dist/types.d.ts +0 -15
- package/dist/util/NotFoundError.d.ts +0 -20
- package/dist/util/NotFoundError.js.map +0 -1
- package/dist/util/createExpiringConfig.d.ts +0 -37
- package/dist/util/createExpiringConfig.js +0 -60
- package/dist/util/createExpiringConfig.js.map +0 -1
- package/dist/util/doImport.d.ts +0 -7
- package/dist/util/environment/getStudioEnvironmentVariables.d.ts +0 -12
- package/dist/util/environment/mockBrowserEnvironment.d.ts +0 -17
- package/dist/util/environment/setupBrowserStubs.d.ts +0 -10
- package/dist/util/environment/stubs.d.ts +0 -254
- package/dist/util/fileExists.d.ts +0 -9
- package/dist/util/generateHelpUrl.d.ts +0 -8
- package/dist/util/getEmptyAuth.d.ts +0 -5
- package/dist/util/getSanityEnvVar.d.ts +0 -19
- package/dist/util/getSanityUrl.d.ts +0 -5
- package/dist/util/getUserConfig.d.ts +0 -2
- package/dist/util/isCi.d.ts +0 -1
- package/dist/util/isInteractive.d.ts +0 -1
- package/dist/util/isRecord.d.ts +0 -8
- package/dist/util/isTrueish.d.ts +0 -1
- package/dist/util/parseStringFlag.d.ts +0 -10
- package/dist/util/parseStringFlag.js +0 -19
- package/dist/util/parseStringFlag.js.map +0 -1
- package/dist/util/readJsonFile.d.ts +0 -14
- package/dist/util/resolveLocalPackage.d.ts +0 -18
- package/dist/util/safeStructuredClone.d.ts +0 -8
- package/dist/util/tree.d.ts +0 -31
- package/dist/util/tree.js +0 -108
- package/dist/util/tree.js.map +0 -1
- package/dist/util/tryGetDefaultExport.d.ts +0 -5
- package/dist/util/writeJsonFile.d.ts +0 -9
- package/dist/ux/chalk.d.ts +0 -2
- package/dist/ux/chalk.js +0 -4
- package/dist/ux/chalk.js.map +0 -1
- package/dist/ux/colorizeJson.d.ts +0 -1
- package/dist/ux/formatObject.d.ts +0 -1
- package/dist/ux/formatObject.js +0 -9
- package/dist/ux/formatObject.js.map +0 -1
- package/dist/ux/logSymbols.d.ts +0 -1
- package/dist/ux/printKeyValue.d.ts +0 -1
- package/dist/ux/printKeyValue.js +0 -16
- package/dist/ux/printKeyValue.js.map +0 -1
- package/dist/ux/prompts.d.ts +0 -1
- package/dist/ux/spinner.d.ts +0 -1
- package/dist/ux/timer.d.ts +0 -12
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ProjectRootResult } from './util/recursivelyResolveProjectRoot.js';
|
|
2
|
-
/**
|
|
3
|
-
* Resolve project root directory and type.
|
|
4
|
-
*
|
|
5
|
-
* Project root is:
|
|
6
|
-
* - `studio` - A pre-blueprints Sanity studio root (containing `sanity.config.(ts|js)`)
|
|
7
|
-
* - `app` - A Sanity app root (containing `sanity.cli.(ts|js)`)
|
|
8
|
-
*
|
|
9
|
-
* If a Sanity Studio v2/v1 root is found (containing `sanity.json` with `root: true`),
|
|
10
|
-
* an error is thrown, as v2/v1 is no longer supported.
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function findProjectRoot(cwd: string): Promise<ProjectRootResult>;
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type RawStudioConfig, type ResolvedStudioConfig } from './readStudioConfig.js';
|
|
2
|
-
/**
|
|
3
|
-
* Get the studio config for a project, given the root path.
|
|
4
|
-
*
|
|
5
|
-
* @param rootPath - The root path for the project
|
|
6
|
-
* @returns The studio config (some properties may be missing)
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare function getStudioConfig(rootPath: string, options: {
|
|
10
|
-
resolvePlugins: true;
|
|
11
|
-
}): Promise<ResolvedStudioConfig>;
|
|
12
|
-
export declare function getStudioConfig(rootPath: string, options: {
|
|
13
|
-
resolvePlugins: false;
|
|
14
|
-
}): Promise<RawStudioConfig>;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const rawConfigSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
3
|
-
basePath: z.ZodString;
|
|
4
|
-
name: z.ZodString;
|
|
5
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
6
|
-
title: z.ZodString;
|
|
7
|
-
unstable_sources: z.ZodArray<z.ZodObject<{
|
|
8
|
-
dataset: z.ZodString;
|
|
9
|
-
projectId: z.ZodString;
|
|
10
|
-
schema: z.ZodObject<{
|
|
11
|
-
_original: z.ZodObject<{
|
|
12
|
-
name: z.ZodOptional<z.ZodString>;
|
|
13
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
}, z.core.$strip>>;
|
|
17
|
-
dataset: z.ZodString;
|
|
18
|
-
projectId: z.ZodString;
|
|
19
|
-
schema: z.ZodObject<{
|
|
20
|
-
_original: z.ZodObject<{
|
|
21
|
-
name: z.ZodOptional<z.ZodString>;
|
|
22
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
}, z.core.$strip>>, z.ZodObject<{
|
|
26
|
-
basePath: z.ZodOptional<z.ZodString>;
|
|
27
|
-
name: z.ZodOptional<z.ZodString>;
|
|
28
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
29
|
-
schema: z.ZodOptional<z.ZodObject<{
|
|
30
|
-
name: z.ZodOptional<z.ZodString>;
|
|
31
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
32
|
-
}, z.core.$strip>>;
|
|
33
|
-
title: z.ZodOptional<z.ZodString>;
|
|
34
|
-
unstable_sources: z.ZodArray<z.ZodObject<{
|
|
35
|
-
dataset: z.ZodString;
|
|
36
|
-
projectId: z.ZodString;
|
|
37
|
-
schema: z.ZodObject<{
|
|
38
|
-
_original: z.ZodObject<{
|
|
39
|
-
name: z.ZodOptional<z.ZodString>;
|
|
40
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
}, z.core.$strip>>;
|
|
44
|
-
dataset: z.ZodString;
|
|
45
|
-
projectId: z.ZodString;
|
|
46
|
-
}, z.core.$loose>]>;
|
|
47
|
-
declare const resolvedConfigSchema: z.ZodArray<z.ZodObject<{
|
|
48
|
-
basePath: z.ZodString;
|
|
49
|
-
name: z.ZodString;
|
|
50
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
51
|
-
title: z.ZodString;
|
|
52
|
-
unstable_sources: z.ZodArray<z.ZodObject<{
|
|
53
|
-
dataset: z.ZodString;
|
|
54
|
-
projectId: z.ZodString;
|
|
55
|
-
schema: z.ZodObject<{
|
|
56
|
-
_original: z.ZodObject<{
|
|
57
|
-
name: z.ZodOptional<z.ZodString>;
|
|
58
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
}, z.core.$strip>;
|
|
61
|
-
}, z.core.$strip>>;
|
|
62
|
-
dataset: z.ZodString;
|
|
63
|
-
projectId: z.ZodString;
|
|
64
|
-
schema: z.ZodObject<{
|
|
65
|
-
_original: z.ZodObject<{
|
|
66
|
-
name: z.ZodOptional<z.ZodString>;
|
|
67
|
-
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
68
|
-
}, z.core.$strip>;
|
|
69
|
-
}, z.core.$strip>;
|
|
70
|
-
}, z.core.$strip>>;
|
|
71
|
-
export type RawStudioConfig = z.infer<typeof rawConfigSchema>;
|
|
72
|
-
export type ResolvedStudioConfig = z.infer<typeof resolvedConfigSchema>;
|
|
73
|
-
export interface ReadStudioConfigOptions {
|
|
74
|
-
/**
|
|
75
|
-
* Whether or not to resolve the plugins defined in the config.
|
|
76
|
-
*
|
|
77
|
-
* In some cases, you need this in order to have the full picture of what the studio
|
|
78
|
-
* would "see". As an example, plugins can define schema types that are not explicitly
|
|
79
|
-
* defined in the users' schema types. In order to get the full picture, you need to
|
|
80
|
-
* resolve the plugins, which is an asyncronous operation.
|
|
81
|
-
*
|
|
82
|
-
* In other cases, it might be enough to only do a shallow pass. As an example, if you
|
|
83
|
-
* only need to know about the defined workspace, or the user-defined schema types,
|
|
84
|
-
* this can be set to `false` - which should resolve faster (and potentially "safer")
|
|
85
|
-
* in terms of not triggering all kinds of browser behavior that may or may not be
|
|
86
|
-
* loaded as the plugins are resolved.
|
|
87
|
-
*/
|
|
88
|
-
resolvePlugins: boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare function readStudioConfig(configPath: string, options: {
|
|
91
|
-
resolvePlugins: true;
|
|
92
|
-
}): Promise<ResolvedStudioConfig>;
|
|
93
|
-
export declare function readStudioConfig(configPath: string, options: {
|
|
94
|
-
resolvePlugins: false;
|
|
95
|
-
}): Promise<RawStudioConfig>;
|
|
96
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves to a string containing the found config path, or `undefined` if not found.
|
|
3
|
-
*
|
|
4
|
-
* @param basePath - The base path to start searching from
|
|
5
|
-
* @returns A promise that resolves to a string containing the found config path, or `undefined` if not found
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare function findAppConfigPath(basePath: string): Promise<string | undefined>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
interface PathResult {
|
|
5
|
-
exists: boolean;
|
|
6
|
-
path: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Finds the path for a given set of files.
|
|
10
|
-
*
|
|
11
|
-
* @param basePath - The base path to search for files.
|
|
12
|
-
* @param files - The files to search for.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare function findPathForFiles(basePath: string, files: string[]): Promise<PathResult[]>;
|
|
16
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves to a string containing the found config path, or `false` 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 promise that resolves to a string containing the found config path, or `undefined` if not found
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare function findStudioConfigPath(basePath: string): Promise<string | undefined>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks for a `sanity.json` file with `"root": true` in the given directory.
|
|
3
|
-
*
|
|
4
|
-
* @param basePath - The base path to look for a `sanity.json` in
|
|
5
|
-
* @returns Resolves to true if a `sanity.json` with `"root": true` is found, false otherwise
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare function isSanityV2StudioRoot(basePath: string): Promise<boolean>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Result of finding a project configuration
|
|
3
|
-
*
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export interface ProjectRootResult {
|
|
7
|
-
directory: string;
|
|
8
|
-
/**
|
|
9
|
-
* Path to the project configuration file, if found.
|
|
10
|
-
*/
|
|
11
|
-
path: string;
|
|
12
|
-
/**
|
|
13
|
-
* Type of project root.
|
|
14
|
-
*/
|
|
15
|
-
type: 'app' | 'studio';
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Generic recursive search function for project configuration files.
|
|
19
|
-
*
|
|
20
|
-
* @param basePath - The base path to start searching from
|
|
21
|
-
* @param findConfigFn - Function that looks for config files in a given directory
|
|
22
|
-
* @param projectType - The type of project ('app' | 'studio')
|
|
23
|
-
* @param iterations - Current iteration count, passed internally to prevent infinite recursion
|
|
24
|
-
* @returns A promise that resolves to an object if config is found, false otherwise
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export declare function recursivelyResolveProjectRoot(basePath: string, findConfigFn: (path: string) => Promise<string | undefined>, projectType: 'app' | 'studio', iterations?: number): Promise<false | ProjectRootResult>;
|
package/dist/debug.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import debugIt from 'debug';
|
|
2
|
-
/**
|
|
3
|
-
* `debug` instance for the CLI
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare const debug: debugIt.Debugger;
|
|
8
|
-
/**
|
|
9
|
-
* Get a `debug` instance which extends the CLI debug instance with the given namespace,
|
|
10
|
-
* eg namespace would be `sanity:cli:<providedNamespace>`
|
|
11
|
-
*
|
|
12
|
-
* @param namespace - The namespace to extend the CLI debug instance with
|
|
13
|
-
* @returns The extended `debug` instance
|
|
14
|
-
*/
|
|
15
|
-
export declare const subdebug: (namespace: string) => debugIt.Debugger;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type WorkerOptions } from 'node:worker_threads';
|
|
2
|
-
import { type RequireProps } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Options for the studio worker task
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
interface StudioWorkerTaskOptions extends RequireProps<WorkerOptions, 'name'> {
|
|
9
|
-
studioRootPath: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Executes a worker file in a Sanity Studio browser context.
|
|
13
|
-
*
|
|
14
|
-
* This uses a combination of vite for "bundling" + jsdom for emulating a browser
|
|
15
|
-
* environment under the hood, which means that the same thing that will work in vite
|
|
16
|
-
* _should_ work in the worker - to a degree. If the user has defined any typescript
|
|
17
|
-
* path aliases, these will have to be added as aliases to the vite config - the same
|
|
18
|
-
* behavior as you would see with regular vite. Other things that are accounted for:
|
|
19
|
-
*
|
|
20
|
-
* - TypeScript support (+JSX, enums and other "compilation needed" features)
|
|
21
|
-
* - CSS, font and other file imports will resolve to a file path
|
|
22
|
-
* - CSS module imports will resolve to a javascript object of class names
|
|
23
|
-
* - Environment variables are available both as `import.meta.env` and `process.env`,
|
|
24
|
-
* and `.env` files are loaded in the same way that they would in a Sanity studio.
|
|
25
|
-
* - Browser globals not available in a Node.js environment but _are_ provided by JSDOM
|
|
26
|
-
* are defined directly to the Node environment as globals. While this polutes the
|
|
27
|
-
* global namespace, it is done only in the worker thread.
|
|
28
|
-
* - Certain browser globals that are _not_ available in JSDOM are also provided to the
|
|
29
|
-
* global namespace - things like `requestIdleCallback`, `IntersectionObserver` etc.
|
|
30
|
-
* These are provided with a minimal stub implementation to make them not crash.
|
|
31
|
-
*
|
|
32
|
-
* @param filePath - Path to the worker file (`.ts` works and is encouraged)
|
|
33
|
-
* @param options - Options to pass to the worker
|
|
34
|
-
* @returns A promise that resolves with the message from the worker
|
|
35
|
-
* @throws If the file does not exist
|
|
36
|
-
* @throws If the worker exits with a non-zero code
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export declare function studioWorkerTask(filePath: URL, options: StudioWorkerTaskOptions): Promise<unknown>;
|
|
40
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { URL } from 'node:url';
|
|
2
|
-
import { type WorkerOptions } from 'node:worker_threads';
|
|
3
|
-
import { type RequireProps } from '../../types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Options for the tsx worker task
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
interface TsxWorkerTaskOptions extends RequireProps<WorkerOptions, 'name'> {
|
|
10
|
-
rootPath: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Executes a worker file with tsx registered. This means you can import other
|
|
14
|
-
* typescript with fairly rich syntax, and still have that only apply to the worker
|
|
15
|
-
* thread instead of the full parent process. The worker should emit a message when
|
|
16
|
-
* complete using `parentPort`. Once it has received a single message will resolve the
|
|
17
|
-
* returned promise with that message. If you are expecting multiple messages, you will
|
|
18
|
-
* have to implement another method ;)
|
|
19
|
-
*
|
|
20
|
-
* @param filePath - Path to the worker file
|
|
21
|
-
* @param options - Options to pass to the worker
|
|
22
|
-
* @returns A promise that resolves with the message from the worker
|
|
23
|
-
* @throws If the file does not exist
|
|
24
|
-
* @throws If the worker exits with a non-zero code
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export declare function tsxWorkerTask<T = unknown>(filePath: URL, options: TsxWorkerTaskOptions): Promise<T>;
|
|
28
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type ClientConfig, type SanityClient } from '@sanity/client';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export interface GlobalCliClientOptions extends ClientConfig {
|
|
6
|
-
/**
|
|
7
|
-
* The API version to use for this client.
|
|
8
|
-
*/
|
|
9
|
-
apiVersion: string;
|
|
10
|
-
/**
|
|
11
|
-
* Whether to require a user to be authenticated to use this client.
|
|
12
|
-
* Default: `false`.
|
|
13
|
-
* Throws an error if `true` and user is not authenticated.
|
|
14
|
-
*/
|
|
15
|
-
requireUser?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Create a "global" (unscoped) Sanity API client.
|
|
19
|
-
*
|
|
20
|
-
* @param options - The options to use for the client.
|
|
21
|
-
* @returns Promise that resolves to a configured Sanity API client.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getGlobalCliClient({ requireUser, token: providedToken, ...config }: GlobalCliClientOptions): Promise<SanityClient>;
|
|
24
|
-
/**
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export interface ProjectCliClientOptions extends ClientConfig {
|
|
28
|
-
/**
|
|
29
|
-
* The API version to use for this client.
|
|
30
|
-
*/
|
|
31
|
-
apiVersion: string;
|
|
32
|
-
/**
|
|
33
|
-
* The project ID to use for this client.
|
|
34
|
-
*/
|
|
35
|
-
projectId: string;
|
|
36
|
-
/**
|
|
37
|
-
* The dataset to use for this client.
|
|
38
|
-
*/
|
|
39
|
-
dataset?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Whether to require a user to be authenticated to use this client.
|
|
42
|
-
* Default: `false`.
|
|
43
|
-
* Throws an error if `true` and user is not authenticated.
|
|
44
|
-
*/
|
|
45
|
-
requireUser?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Create a "global" (unscoped) Sanity API client.
|
|
49
|
-
*
|
|
50
|
-
* @param options - The options to use for the client.
|
|
51
|
-
* @returns Promise that resolves to a configured Sanity API client.
|
|
52
|
-
*/
|
|
53
|
-
export declare function getProjectCliClient({ requireUser, token: providedToken, ...config }: ProjectCliClientOptions): Promise<SanityClient>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const cliUserConfigSchema: {
|
|
3
|
-
authToken: z.ZodOptional<z.ZodString>;
|
|
4
|
-
telemetryConsent: z.ZodOptional<z.ZodObject<{
|
|
5
|
-
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
value: z.ZodObject<{
|
|
7
|
-
status: z.ZodEnum<{
|
|
8
|
-
undetermined: "undetermined";
|
|
9
|
-
unset: "unset";
|
|
10
|
-
granted: "granted";
|
|
11
|
-
denied: "denied";
|
|
12
|
-
}>;
|
|
13
|
-
type: z.ZodString;
|
|
14
|
-
}, z.core.$loose>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The CLI user configuration schema.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
type CliUserConfig = z.infer<z.ZodObject<typeof cliUserConfigSchema>>;
|
|
23
|
-
/**
|
|
24
|
-
* Set the config value for the given property.
|
|
25
|
-
* Validates that the passed value adheres to the defined CLI config schema.
|
|
26
|
-
*
|
|
27
|
-
* @param prop - The property to set the value for
|
|
28
|
-
* @param value - The value to set
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare function setConfig<P extends keyof CliUserConfig>(prop: P, value: CliUserConfig[P]): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Get the config value for the given property
|
|
34
|
-
*
|
|
35
|
-
* @param prop - The property to get the value for
|
|
36
|
-
* @returns The value of the given property
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export declare function getConfig<P extends keyof CliUserConfig>(prop: P): Promise<CliUserConfig[P]>;
|
|
40
|
-
export {};
|
package/dist/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type Command } from '@oclif/core';
|
|
2
|
-
export interface Output {
|
|
3
|
-
error: Command['error'];
|
|
4
|
-
log: Command['log'];
|
|
5
|
-
warn: Command['warn'];
|
|
6
|
-
}
|
|
7
|
-
export type RequireProps<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
8
|
-
export type SanityOrgUser = {
|
|
9
|
-
email: string;
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
profileImage?: string;
|
|
13
|
-
provider: 'github' | 'google' | 'sanity' | `saml-${string}`;
|
|
14
|
-
tosAcceptedAt?: string;
|
|
15
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error thrown when a file or directory is not found
|
|
3
|
-
*
|
|
4
|
-
* `code` is always `ENOENT` to mirror Node.js behavior when a file is not found
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare class NotFoundError extends Error {
|
|
9
|
-
code: string;
|
|
10
|
-
path?: string;
|
|
11
|
-
constructor(message: string, path?: string);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Returns whether or not the given error is a `NotFoundError`
|
|
15
|
-
*
|
|
16
|
-
* @param err - The error to check
|
|
17
|
-
* @returns `true` if the error is a `NotFoundError`, `false` otherwise
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare function isNotFoundError(err: unknown): err is NotFoundError;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/NotFoundError.ts"],"sourcesContent":["import {isRecord} from './isRecord.js'\n\n/**\n * Error thrown when a file or directory is not found\n *\n * `code` is always `ENOENT` to mirror Node.js behavior when a file is not found\n *\n * @internal\n */\nexport class NotFoundError extends Error {\n code = 'ENOENT'\n path?: string\n\n constructor(message: string, path?: string) {\n super(message)\n this.path = path\n this.name = 'NotFoundError'\n }\n}\n\n/**\n * Returns whether or not the given error is a `NotFoundError`\n *\n * @param err - The error to check\n * @returns `true` if the error is a `NotFoundError`, `false` otherwise\n * @internal\n */\nexport function isNotFoundError(err: unknown): err is NotFoundError {\n return (\n isRecord(err) &&\n 'name' in err &&\n err.name === 'NotFoundError' &&\n 'code' in err &&\n err.code === 'ENOENT' &&\n 'message' in err &&\n typeof err.message === 'string'\n )\n}\n"],"names":["isRecord","NotFoundError","Error","code","path","message","name","isNotFoundError","err"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,gBAAe;AAEtC;;;;;;CAMC,GACD,OAAO,MAAMC,sBAAsBC;IACjCC,OAAO,SAAQ;IACfC,KAAa;IAEb,YAAYC,OAAe,EAAED,IAAa,CAAE;QAC1C,KAAK,CAACC;QACN,IAAI,CAACD,IAAI,GAAGA;QACZ,IAAI,CAACE,IAAI,GAAG;IACd;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,gBAAgBC,GAAY;IAC1C,OACER,SAASQ,QACT,UAAUA,OACVA,IAAIF,IAAI,KAAK,mBACb,UAAUE,OACVA,IAAIL,IAAI,KAAK,YACb,aAAaK,OACb,OAAOA,IAAIH,OAAO,KAAK;AAE3B"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type ConfigStore from 'configstore';
|
|
2
|
-
export interface ExpiringConfigOptions<Type> {
|
|
3
|
-
/** Fetch value */
|
|
4
|
-
fetchValue: () => Promise<Type> | Type;
|
|
5
|
-
/** Config key */
|
|
6
|
-
key: string;
|
|
7
|
-
/** Config store */
|
|
8
|
-
store: ConfigStore;
|
|
9
|
-
/** TTL (milliseconds) */
|
|
10
|
-
ttl: number;
|
|
11
|
-
/** Subscribe to cache hit event */
|
|
12
|
-
onCacheHit?: () => void;
|
|
13
|
-
/** Subscribe to fetch event */
|
|
14
|
-
onFetch?: () => void;
|
|
15
|
-
/** Subscribe to revalidate event */
|
|
16
|
-
onRevalidate?: () => void;
|
|
17
|
-
/**
|
|
18
|
-
* Assert the fetched value is valid, or throw if invalid.
|
|
19
|
-
* If none is provided, it will always accept the fetched value.
|
|
20
|
-
*/
|
|
21
|
-
validateValue?: (value: unknown) => value is Type;
|
|
22
|
-
}
|
|
23
|
-
export interface ExpiringConfigApi<Type> {
|
|
24
|
-
/**
|
|
25
|
-
* Delete the cached value.
|
|
26
|
-
*/
|
|
27
|
-
delete: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Attempt to get the cached value. If there is no cached value, or the cached value has expired,
|
|
30
|
-
* fetch, cache, and return the value.
|
|
31
|
-
*/
|
|
32
|
-
get: () => Promise<Type>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create a config in the provided config store that expires after the provided TTL.
|
|
36
|
-
*/
|
|
37
|
-
export declare function createExpiringConfig<Type>({ fetchValue, key, onCacheHit, onFetch, onRevalidate, store, ttl, validateValue, }: ExpiringConfigOptions<Type>): ExpiringConfigApi<Type>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a config in the provided config store that expires after the provided TTL.
|
|
3
|
-
*/ export function createExpiringConfig({ fetchValue, key, onCacheHit = ()=>null, onFetch = ()=>null, onRevalidate = ()=>null, store, ttl, validateValue = (value)=>true }) {
|
|
4
|
-
let currentFetch = null;
|
|
5
|
-
return {
|
|
6
|
-
delete () {
|
|
7
|
-
store.delete(key);
|
|
8
|
-
},
|
|
9
|
-
async get () {
|
|
10
|
-
const stored = store.get(key);
|
|
11
|
-
if (isExpiringValue(stored)) {
|
|
12
|
-
const { updatedAt, value } = stored;
|
|
13
|
-
if (!validateValue(value)) {
|
|
14
|
-
throw new Error('Stored value is invalid');
|
|
15
|
-
}
|
|
16
|
-
const hasExpired = Date.now() - updatedAt > ttl;
|
|
17
|
-
if (!hasExpired) {
|
|
18
|
-
onCacheHit();
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
onRevalidate();
|
|
22
|
-
}
|
|
23
|
-
if (currentFetch) {
|
|
24
|
-
return currentFetch;
|
|
25
|
-
}
|
|
26
|
-
onFetch();
|
|
27
|
-
currentFetch = Promise.resolve(fetchValue());
|
|
28
|
-
const nextValue = await currentFetch;
|
|
29
|
-
if (!validateValue(nextValue)) {
|
|
30
|
-
throw new Error('Fetched value is invalid');
|
|
31
|
-
}
|
|
32
|
-
currentFetch = null;
|
|
33
|
-
store.set(key, {
|
|
34
|
-
updatedAt: Date.now(),
|
|
35
|
-
value: nextValue
|
|
36
|
-
});
|
|
37
|
-
return nextValue;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Checks if the given stored value is valid (does not check if expired, only verified shape)
|
|
43
|
-
*
|
|
44
|
-
* @param stored - The stored value to check
|
|
45
|
-
* @returns True if the stored value is valid
|
|
46
|
-
* @internal
|
|
47
|
-
*/ function isExpiringValue(stored) {
|
|
48
|
-
if (typeof stored !== 'object' || stored === null || Array.isArray(stored)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
if (!('updatedAt' in stored) || typeof stored.updatedAt !== 'number') {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
if (!('value' in stored)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=createExpiringConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/createExpiringConfig.ts"],"sourcesContent":["import type ConfigStore from 'configstore'\n\ninterface ExpiringConfigValue {\n updatedAt: number\n value: unknown\n}\n\nexport interface ExpiringConfigOptions<Type> {\n /** Fetch value */\n fetchValue: () => Promise<Type> | Type\n /** Config key */\n key: string\n /** Config store */\n store: ConfigStore\n /** TTL (milliseconds) */\n ttl: number\n\n /** Subscribe to cache hit event */\n onCacheHit?: () => void\n /** Subscribe to fetch event */\n onFetch?: () => void\n /** Subscribe to revalidate event */\n onRevalidate?: () => void\n\n /**\n * Assert the fetched value is valid, or throw if invalid.\n * If none is provided, it will always accept the fetched value.\n */\n validateValue?: (value: unknown) => value is Type\n}\n\nexport interface ExpiringConfigApi<Type> {\n /**\n * Delete the cached value.\n */\n delete: () => void\n /**\n * Attempt to get the cached value. If there is no cached value, or the cached value has expired,\n * fetch, cache, and return the value.\n */\n get: () => Promise<Type>\n}\n\n/**\n * Create a config in the provided config store that expires after the provided TTL.\n */\nexport function createExpiringConfig<Type>({\n fetchValue,\n key,\n onCacheHit = () => null,\n onFetch = () => null,\n onRevalidate = () => null,\n store,\n ttl,\n validateValue = (value: unknown): value is Type => true,\n}: ExpiringConfigOptions<Type>): ExpiringConfigApi<Type> {\n let currentFetch: Promise<Type> | null = null\n return {\n delete() {\n store.delete(key)\n },\n async get(): Promise<Type> {\n const stored = store.get(key)\n\n if (isExpiringValue(stored)) {\n const {updatedAt, value} = stored\n if (!validateValue(value)) {\n throw new Error('Stored value is invalid')\n }\n\n const hasExpired = Date.now() - updatedAt > ttl\n\n if (!hasExpired) {\n onCacheHit()\n return value\n }\n\n onRevalidate()\n }\n\n if (currentFetch) {\n return currentFetch\n }\n onFetch()\n\n currentFetch = Promise.resolve(fetchValue())\n const nextValue = await currentFetch\n if (!validateValue(nextValue)) {\n throw new Error('Fetched value is invalid')\n }\n\n currentFetch = null\n\n store.set(key, {\n updatedAt: Date.now(),\n value: nextValue,\n })\n\n return nextValue\n },\n }\n}\n\n/**\n * Checks if the given stored value is valid (does not check if expired, only verified shape)\n *\n * @param stored - The stored value to check\n * @returns True if the stored value is valid\n * @internal\n */\nfunction isExpiringValue(stored: unknown): stored is ExpiringConfigValue {\n if (typeof stored !== 'object' || stored === null || Array.isArray(stored)) {\n return false\n }\n\n if (!('updatedAt' in stored) || typeof stored.updatedAt !== 'number') {\n return false\n }\n\n if (!('value' in stored)) {\n return false\n }\n\n return true\n}\n"],"names":["createExpiringConfig","fetchValue","key","onCacheHit","onFetch","onRevalidate","store","ttl","validateValue","value","currentFetch","delete","get","stored","isExpiringValue","updatedAt","Error","hasExpired","Date","now","Promise","resolve","nextValue","set","Array","isArray"],"mappings":"AA2CA;;CAEC,GACD,OAAO,SAASA,qBAA2B,EACzCC,UAAU,EACVC,GAAG,EACHC,aAAa,IAAM,IAAI,EACvBC,UAAU,IAAM,IAAI,EACpBC,eAAe,IAAM,IAAI,EACzBC,KAAK,EACLC,GAAG,EACHC,gBAAgB,CAACC,QAAkC,IAAI,EAC3B;IAC5B,IAAIC,eAAqC;IACzC,OAAO;QACLC;YACEL,MAAMK,MAAM,CAACT;QACf;QACA,MAAMU;YACJ,MAAMC,SAASP,MAAMM,GAAG,CAACV;YAEzB,IAAIY,gBAAgBD,SAAS;gBAC3B,MAAM,EAACE,SAAS,EAAEN,KAAK,EAAC,GAAGI;gBAC3B,IAAI,CAACL,cAAcC,QAAQ;oBACzB,MAAM,IAAIO,MAAM;gBAClB;gBAEA,MAAMC,aAAaC,KAAKC,GAAG,KAAKJ,YAAYR;gBAE5C,IAAI,CAACU,YAAY;oBACfd;oBACA,OAAOM;gBACT;gBAEAJ;YACF;YAEA,IAAIK,cAAc;gBAChB,OAAOA;YACT;YACAN;YAEAM,eAAeU,QAAQC,OAAO,CAACpB;YAC/B,MAAMqB,YAAY,MAAMZ;YACxB,IAAI,CAACF,cAAcc,YAAY;gBAC7B,MAAM,IAAIN,MAAM;YAClB;YAEAN,eAAe;YAEfJ,MAAMiB,GAAG,CAACrB,KAAK;gBACba,WAAWG,KAAKC,GAAG;gBACnBV,OAAOa;YACT;YAEA,OAAOA;QACT;IACF;AACF;AAEA;;;;;;CAMC,GACD,SAASR,gBAAgBD,MAAe;IACtC,IAAI,OAAOA,WAAW,YAAYA,WAAW,QAAQW,MAAMC,OAAO,CAACZ,SAAS;QAC1E,OAAO;IACT;IAEA,IAAI,CAAE,CAAA,eAAeA,MAAK,KAAM,OAAOA,OAAOE,SAAS,KAAK,UAAU;QACpE,OAAO;IACT;IAEA,IAAI,CAAE,CAAA,WAAWF,MAAK,GAAI;QACxB,OAAO;IACT;IAEA,OAAO;AACT"}
|
package/dist/util/doImport.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loads the `getStudioEnvironmentVariables` function from the studio's
|
|
3
|
-
* installed `sanity` package and returns the environment variables.
|
|
4
|
-
*
|
|
5
|
-
* This is used to ensure we're using the same version of environment variable
|
|
6
|
-
* logic as the studio itself.
|
|
7
|
-
*
|
|
8
|
-
* @param rootPath - The root path of the Sanity Studio project
|
|
9
|
-
* @returns Object containing studio environment variables
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare function getStudioEnvironmentVariables(rootPath: string): Promise<Record<string, string>>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mocks a browser-like environment for processes in the main thread by:
|
|
3
|
-
* - Injecting browser globals (window, document, ResizeObserver, etc.)
|
|
4
|
-
* - Loading studio environment variables from the project's sanity installation into process.env
|
|
5
|
-
*
|
|
6
|
-
* This is useful for commands like `sanity exec` that have to run user scripts
|
|
7
|
-
* in the main thread of the process (but in a child process).
|
|
8
|
-
*
|
|
9
|
-
* Be cautious when using this, since it will pollute the global namespace with browser globals.
|
|
10
|
-
*
|
|
11
|
-
* If your code can run in a worker thread, you should use the `studioWorkerTask` function instead.
|
|
12
|
-
*
|
|
13
|
-
* @param basePath - The root path of the Sanity Studio project
|
|
14
|
-
* @returns A cleanup function that removes the injected globals and environment variables
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare function mockBrowserEnvironment(basePath: string): Promise<() => void>;
|