@sanity/cli-build 5.2.0 → 5.3.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.
@@ -1,59 +1,69 @@
1
- import { CliConfig } from "@sanity/cli-core/types";
2
- import { ConfigEnv } from "vite";
3
- import { FSWatcher } from "chokidar";
4
- import { InlineConfig } from "vite";
5
- import { Output } from "@sanity/cli-core/types";
6
- import { Plugin } from "vite";
7
- import { PluginOptions } from "babel-plugin-react-compiler";
8
- import { UserViteConfig } from "@sanity/cli-core/types";
1
+ import { CliConfig, Output, UserViteConfig } from "@sanity/cli-core/types";
9
2
  import { WorkbenchExposes } from "@sanity/workbench-cli/build";
10
-
3
+ import { ConfigEnv, InlineConfig, Plugin } from "vite";
4
+ import { FSWatcher } from "chokidar";
5
+ interface CompareDependencyVersions {
6
+ installed: string;
7
+ pkg: string;
8
+ remote: string;
9
+ }
10
+ interface UnresolvedPrerelease {
11
+ pkg: string;
12
+ version: string;
13
+ }
14
+ interface CompareDependencyVersionsResult {
15
+ mismatched: Array<CompareDependencyVersions>;
16
+ unresolvedPrerelease: Array<UnresolvedPrerelease>;
17
+ }
18
+ interface CompareDependencyVersionsOptions {
19
+ /** When provided, uses the app-specific module endpoint instead of the default endpoint. */
20
+ appId?: string;
21
+ }
11
22
  /**
12
- * Everything the production build needs to produce an auto-updating studio/app.
23
+ * @internal
13
24
  *
14
- * Auto-updating deployments load `sanity` (and friends) from Sanity's module
15
- * CDN via an import map, and load `react`/`react-dom`/`styled-components` from
16
- * hashed vendor chunks emitted by the build itself. These concerns always come
17
- * together: when auto-updates are disabled none of this applies and everything
18
- * is bundled as usual.
25
+ * Compares the versions of dependencies in the studio or app with their remote versions.
19
26
  *
20
- * @internal
21
- */
22
- declare interface AutoUpdatesBuildConfig {
23
- /** Import map entries for the packages served from Sanity's module CDN. */
24
- imports: Record<string, string>;
25
- /** Vendor packages to emit as hashed browser-loadable ESM chunks. */
26
- vendor: VendorBuildConfig;
27
- /** Stylesheets served from the module CDN, loaded via `<link>` tags. */
28
- cssUrls?: string[];
29
- }
30
-
31
- /**
32
- * Internal build app that avoids depending on flags for CLI config.
33
- * @param options - options for the build
27
+ * This function reads the package.json file in the provided working directory, and compares the versions of the dependencies
28
+ * specified in the `autoUpdatesImports` parameter with their remote versions. If the versions do not match, the dependency is
29
+ * added to a list of failed dependencies, which is returned by the function.
30
+ *
31
+ * The failed dependencies are anything that does not strictly match the remote version.
32
+ * This means that if a version is lower or greater by even a patch it will be marked as failed.
33
+ *
34
+ * @param packages - An array of packages with their name and version to compare against remote.
35
+ * @param workDir - The path to the working directory containing the package.json file.
36
+ * @param options - Optional configuration for version comparison.
37
+ *
38
+ * @returns A promise that resolves to an object containing `mismatched` (packages whose local and remote versions differ)
39
+ * and `unresolvedPrerelease` (packages with prerelease versions that could not be resolved remotely).
40
+ *
41
+ * @throws Throws an error if the remote version of a non-prerelease package cannot be fetched, or if the local version
42
+ * of a package cannot be parsed.
34
43
  */
35
- export declare function buildApp(options: BuildOptions): Promise<void>;
36
-
37
- export declare type BuildAppEventListener = BuildEventListener;
38
-
39
- declare interface BuildEventListener {
44
+ declare function compareDependencyVersions(packages: {
45
+ name: string;
46
+ version: string;
47
+ }[], workDir: string, { appId }?: CompareDependencyVersionsOptions): Promise<CompareDependencyVersionsResult>;
48
+ type MessageFunc = ({ message }: {
49
+ message: string;
50
+ }) => void;
51
+ interface BuildEventListener {
40
52
  onPreReleaseInInteractiveAutoUpdate(params: {
41
53
  prereleaseMessage: string;
42
54
  }): Promise<void>;
43
55
  onPreReleaseInNonInteractiveAutoUpdate: MessageFunc;
44
56
  }
45
-
46
- declare interface BuildOptions {
57
+ type BuildAppEventListener = BuildEventListener;
58
+ interface BuildOptions$1 {
47
59
  appId: string | undefined;
48
60
  appTitle: string | undefined;
49
61
  autoUpdatesEnabled: boolean;
50
62
  checkAppId: () => void;
51
- compareDependencyVersions: (
52
- packages: {
53
- name: string;
54
- version: string;
55
- }[],
56
- ) => Promise<CompareDependencyVersionsResult>;
63
+ compareDependencyVersions: (packages: {
64
+ name: string;
65
+ version: string;
66
+ }[]) => Promise<CompareDependencyVersionsResult>;
57
67
  determineBasePath: () => string;
58
68
  entry: string | undefined;
59
69
  eventListener: Partial<BuildAppEventListener>;
@@ -61,8 +71,8 @@ declare interface BuildOptions {
61
71
  minify: boolean;
62
72
  outDir: string | undefined;
63
73
  output: Output;
64
- reactCompiler: CliConfig["reactCompiler"];
65
- schemaExtraction: CliConfig["schemaExtraction"];
74
+ reactCompiler: CliConfig['reactCompiler'];
75
+ schemaExtraction: CliConfig['schemaExtraction'];
66
76
  sourceMap: boolean;
67
77
  stats: boolean;
68
78
  unattendedMode: boolean;
@@ -72,52 +82,87 @@ declare interface BuildOptions {
72
82
  /** The workbench app's bus identity (`__SANITY_APP_ID__`). */
73
83
  workbenchAppId?: string;
74
84
  }
75
-
76
- declare interface BuildOptions_2 {
77
- appId: string | undefined;
78
- autoUpdatesEnabled: boolean;
79
- checkAppId: () => void;
80
- compareDependencyVersions: (
81
- packages: {
82
- name: string;
83
- version: string;
84
- }[],
85
- ) => Promise<CompareDependencyVersionsResult>;
86
- determineBasePath: () => string;
87
- eventListener: Partial<BuildStudioEventListener>;
85
+ /**
86
+ * Internal build app that avoids depending on flags for CLI config.
87
+ * @param options - options for the build
88
+ */
89
+ declare function buildApp(options: BuildOptions$1): Promise<void>;
90
+ interface VendorBuildConfig {
91
+ /** Rolldown entry name -\> absolute path to the package entry file. */
92
+ entries: Record<string, string>;
93
+ /** Named exports each CommonJS entry must re-expose as ESM, keyed by chunk name. */
94
+ namesByChunkName: Record<string, readonly string[]>;
95
+ /** Rolldown entry chunk name -\> bare import specifier (e.g. `react`, `react-dom/client`). */
96
+ specifiersByChunkName: Record<string, string>;
97
+ }
98
+ interface ResolveVendorBuildConfigOptions {
99
+ cwd: string;
88
100
  isApp: boolean;
89
- isWorkbenchApp: boolean;
90
- minify: boolean;
91
- outDir: string | undefined;
92
- output: Output;
93
- reactCompiler: boolean | CliConfig["reactCompiler"] | undefined;
94
- schemaExtraction: CliConfig["schemaExtraction"];
95
- sourceMap: boolean;
96
- stats: boolean;
97
- unattendedMode: boolean;
98
- vite: UserViteConfig | undefined;
99
- workDir: string;
101
+ }
102
+ /**
103
+ * Resolves vendor package entry points and metadata for a combined studio/app build.
104
+ * Does not run a build — callers add `entries` to the main Vite/Rolldown input and
105
+ * derive the import map from emitted vendor chunks after the single `vite.build`.
106
+ *
107
+ * @internal
108
+ */
109
+ declare function resolveVendorBuildConfig({ cwd, isApp }: ResolveVendorBuildConfigOptions): Promise<VendorBuildConfig>;
110
+ /**
111
+ * Everything the production build needs to produce an auto-updating studio/app.
112
+ *
113
+ * Auto-updating deployments load `sanity` (and friends) from Sanity's module
114
+ * CDN via an import map, and load `react`/`react-dom`/`styled-components` from
115
+ * hashed vendor chunks emitted by the build itself. These concerns always come
116
+ * together: when auto-updates are disabled none of this applies and everything
117
+ * is bundled as usual.
118
+ *
119
+ * @internal
120
+ */
121
+ interface AutoUpdatesBuildConfig {
122
+ /** Import map entries for the packages served from Sanity's module CDN. */
123
+ imports: Record<string, string>;
124
+ /** Vendor packages to emit as hashed browser-loadable ESM chunks. */
125
+ vendor: VendorBuildConfig;
126
+ /** Stylesheets served from the module CDN, loaded via `<link>` tags. */
127
+ cssUrls?: string[];
128
+ }
129
+ interface ChunkModule {
130
+ name: string;
131
+ renderedLength: number;
132
+ }
133
+ interface ChunkStats {
134
+ modules: ChunkModule[];
135
+ name: string;
136
+ }
137
+ interface StaticBuildOptions {
138
+ basePath: string;
139
+ cwd: string;
140
+ outputDir: string;
141
+ appTitle?: string;
142
+ autoUpdates?: AutoUpdatesBuildConfig;
143
+ entry?: string;
100
144
  exposes?: WorkbenchExposes;
145
+ isApp?: boolean;
146
+ /** Workbench app (opted in via `unstable_defineApp`) — drives the federation build. */
147
+ isWorkbenchApp?: boolean;
148
+ minify?: boolean;
149
+ profile?: boolean;
150
+ reactCompiler?: CliConfig['reactCompiler'];
151
+ schemaExtraction?: CliConfig['schemaExtraction'];
152
+ sourceMap?: boolean;
153
+ vite?: UserViteConfig;
101
154
  /** The workbench app's bus identity (`__SANITY_APP_ID__`). */
102
155
  workbenchAppId?: string;
103
156
  }
104
-
105
157
  /**
106
158
  * Builds static files
107
159
  *
108
160
  * @internal
109
161
  */
110
- export declare function buildStaticFiles(options: StaticBuildOptions): Promise<{
162
+ declare function buildStaticFiles(options: StaticBuildOptions): Promise<{
111
163
  chunks: ChunkStats[];
112
164
  }>;
113
-
114
- /**
115
- * Internal build studio that avoids depending on flags for CLI config.
116
- * @param options - options for the build
117
- */
118
- export declare function buildStudio(options: BuildOptions_2): Promise<void>;
119
-
120
- export declare interface BuildStudioEventListener extends BuildEventListener {
165
+ interface BuildStudioEventListener extends BuildEventListener {
121
166
  onBuildEnd: MessageFunc;
122
167
  onBuildFail: MessageFunc;
123
168
  onBuildStart: MessageFunc;
@@ -125,7 +170,9 @@ export declare interface BuildStudioEventListener extends BuildEventListener {
125
170
  onCleanOutputDirStart: MessageFunc;
126
171
  onIncompatibleDeclaredStyledComponentsVersionRange: MessageFunc;
127
172
  onIncompatibleInstalledStyledComponentsVersionRange: MessageFunc;
128
- onInteractiveNonDefaultOutputDir({ message }: { message: string }): Promise<{
173
+ onInteractiveNonDefaultOutputDir({ message }: {
174
+ message: string;
175
+ }): Promise<{
129
176
  shouldClean: boolean;
130
177
  }>;
131
178
  onInvalidStyledComponentsVersionRange: MessageFunc;
@@ -142,207 +189,71 @@ export declare interface BuildStudioEventListener extends BuildEventListener {
142
189
  versionMismatchWarning: string;
143
190
  }): void;
144
191
  }
145
-
146
- /**
147
- * Checks that the studio has declared and installed the required dependencies
148
- * needed by the Sanity modules. While we generally use regular, explicit
149
- * dependencies in modules, there are certain dependencies that are better
150
- * served being peer dependencies, such as react and styled-components.
151
- *
152
- * If these dependencies are not installed/declared, we report an error
153
- * and instruct the user to install them manually.
154
- *
155
- * Additionally, returns the version of the 'sanity' dependency from the package.json.
156
- */
157
- export declare function checkRequiredDependencies(
158
- options: CheckRequiredDependenciesOptions,
159
- ): Promise<CheckResult>;
160
-
161
- declare interface CheckRequiredDependenciesOptions {
192
+ interface BuildOptions {
193
+ appId: string | undefined;
194
+ autoUpdatesEnabled: boolean;
195
+ checkAppId: () => void;
196
+ compareDependencyVersions: (packages: {
197
+ name: string;
198
+ version: string;
199
+ }[]) => Promise<CompareDependencyVersionsResult>;
200
+ determineBasePath: () => string;
201
+ eventListener: Partial<BuildStudioEventListener>;
162
202
  isApp: boolean;
203
+ isWorkbenchApp: boolean;
204
+ minify: boolean;
205
+ outDir: string | undefined;
206
+ output: Output;
207
+ reactCompiler: boolean | CliConfig['reactCompiler'] | undefined;
208
+ schemaExtraction: CliConfig['schemaExtraction'];
209
+ sourceMap: boolean;
210
+ stats: boolean;
211
+ unattendedMode: boolean;
212
+ vite: UserViteConfig | undefined;
163
213
  workDir: string;
164
- onIncompatibleDeclaredStyledComponentsVersionRange?: BuildStudioEventListener["onIncompatibleDeclaredStyledComponentsVersionRange"];
165
- onIncompatibleInstalledStyledComponentsVersionRange?: BuildStudioEventListener["onIncompatibleInstalledStyledComponentsVersionRange"];
166
- onInvalidStyledComponentsVersionRange?: BuildStudioEventListener["onInvalidStyledComponentsVersionRange"];
167
- onNoDeclaredStyledComponentsVersion?: BuildStudioEventListener["onNoDeclaredStyledComponentsVersion"];
168
- onNoInstalledSanityVersion?: BuildStudioEventListener["onNoInstalledSanityVersion"];
169
- onNoInstalledStyledComponentsVersion?: BuildStudioEventListener["onNoInstalledStyledComponentsVersion"];
170
- }
171
-
172
- declare interface CheckResult {
173
- installedSanityVersion: string;
174
- }
175
-
176
- export declare function checkStudioDependencyVersions(
177
- workDir: string,
178
- output: Output,
179
- {
180
- packages,
181
- }?: {
182
- packages?: TrackedPackage[];
183
- },
184
- ): Promise<void>;
185
-
186
- declare interface ChunkModule {
187
- name: string;
188
- renderedLength: number;
189
- }
190
-
191
- declare interface ChunkStats {
192
- modules: ChunkModule[];
193
- name: string;
194
- }
195
-
196
- export declare interface CompareDependencyVersions {
197
- installed: string;
198
- pkg: string;
199
- remote: string;
214
+ exposes?: WorkbenchExposes;
215
+ /** The workbench app's bus identity (`__SANITY_APP_ID__`). */
216
+ workbenchAppId?: string;
200
217
  }
201
-
202
218
  /**
203
- * @internal
204
- *
205
- * Compares the versions of dependencies in the studio or app with their remote versions.
206
- *
207
- * This function reads the package.json file in the provided working directory, and compares the versions of the dependencies
208
- * specified in the `autoUpdatesImports` parameter with their remote versions. If the versions do not match, the dependency is
209
- * added to a list of failed dependencies, which is returned by the function.
210
- *
211
- * The failed dependencies are anything that does not strictly match the remote version.
212
- * This means that if a version is lower or greater by even a patch it will be marked as failed.
213
- *
214
- * @param packages - An array of packages with their name and version to compare against remote.
215
- * @param workDir - The path to the working directory containing the package.json file.
216
- * @param options - Optional configuration for version comparison.
217
- *
218
- * @returns A promise that resolves to an object containing `mismatched` (packages whose local and remote versions differ)
219
- * and `unresolvedPrerelease` (packages with prerelease versions that could not be resolved remotely).
220
- *
221
- * @throws Throws an error if the remote version of a non-prerelease package cannot be fetched, or if the local version
222
- * of a package cannot be parsed.
219
+ * Internal build studio that avoids depending on flags for CLI config.
220
+ * @param options - options for the build
223
221
  */
224
- export declare function compareDependencyVersions(
225
- packages: {
226
- name: string;
227
- version: string;
228
- }[],
229
- workDir: string,
230
- { appId }?: CompareDependencyVersionsOptions,
231
- ): Promise<CompareDependencyVersionsResult>;
232
-
233
- declare interface CompareDependencyVersionsOptions {
234
- /** When provided, uses the app-specific module endpoint instead of the default endpoint. */
235
- appId?: string;
222
+ declare function buildStudio(options: BuildOptions): Promise<void>;
223
+ interface CheckResult {
224
+ installedSanityVersion: string;
236
225
  }
237
-
238
- export declare interface CompareDependencyVersionsResult {
239
- mismatched: Array<CompareDependencyVersions>;
240
- unresolvedPrerelease: Array<UnresolvedPrerelease>;
226
+ interface CheckRequiredDependenciesOptions {
227
+ isApp: boolean;
228
+ workDir: string;
229
+ onIncompatibleDeclaredStyledComponentsVersionRange?: BuildStudioEventListener['onIncompatibleDeclaredStyledComponentsVersionRange'];
230
+ onIncompatibleInstalledStyledComponentsVersionRange?: BuildStudioEventListener['onIncompatibleInstalledStyledComponentsVersionRange'];
231
+ onInvalidStyledComponentsVersionRange?: BuildStudioEventListener['onInvalidStyledComponentsVersionRange'];
232
+ onNoDeclaredStyledComponentsVersion?: BuildStudioEventListener['onNoDeclaredStyledComponentsVersion'];
233
+ onNoInstalledSanityVersion?: BuildStudioEventListener['onNoInstalledSanityVersion'];
234
+ onNoInstalledStyledComponentsVersion?: BuildStudioEventListener['onNoInstalledStyledComponentsVersion'];
241
235
  }
242
-
243
236
  /**
244
- * Merge user-provided Vite configuration object or function
245
- *
246
- * @param defaultConfig - Default configuration object
247
- * @param userConfig - User-provided configuration object or function
248
- * @returns Merged configuration
249
- * @internal
250
- */
251
- export declare function extendViteConfigWithUserConfig(
252
- env: ConfigEnv,
253
- defaultConfig: InlineConfig,
254
- userConfig: UserViteConfig,
255
- ): Promise<InlineConfig>;
256
-
257
- /**
258
- * Get a configuration object for Vite based on the passed options
237
+ * Checks that the studio has declared and installed the required dependencies
238
+ * needed by the Sanity modules. While we generally use regular, explicit
239
+ * dependencies in modules, there are certain dependencies that are better
240
+ * served being peer dependencies, such as react and styled-components.
259
241
  *
260
- * @internal Only meant for consumption inside of Sanity modules, do not depend on this externally
261
- */
262
- export declare function getViteConfig(
263
- options: ViteOptions,
264
- ): Promise<InlineConfig>;
265
-
266
- declare type MessageFunc = ({ message }: { message: string }) => void;
267
-
268
- /**
269
- * Resolves vendor package entry points and metadata for a combined studio/app build.
270
- * Does not run a build — callers add `entries` to the main Vite/Rolldown input and
271
- * derive the import map from emitted vendor chunks after the single `vite.build`.
242
+ * If these dependencies are not installed/declared, we report an error
243
+ * and instruct the user to install them manually.
272
244
  *
273
- * @internal
274
- */
275
- export declare function resolveVendorBuildConfig({
276
- cwd,
277
- isApp,
278
- }: ResolveVendorBuildConfigOptions): Promise<VendorBuildConfig>;
279
-
280
- declare interface ResolveVendorBuildConfigOptions {
281
- cwd: string;
282
- isApp: boolean;
283
- }
284
-
285
- declare interface RuntimeOptions {
286
- cwd: string;
287
- reactStrictMode: boolean | undefined;
288
- watch: boolean;
289
- appTitle?: string;
290
- basePath?: string;
291
- entry?: string;
292
- isApp?: boolean;
293
- isWorkbenchApp?: boolean;
294
- }
295
-
296
- /**
297
- * Root directory (relative to the project) used by Sanity tooling for
298
- * build-time artifacts and caches — Vite's `cacheDir` and the dev-time
299
- * manifest output. Lives under `node_modules/` so it's out of `dist` and
300
- * ignored by default in typical `.gitignore` files.
245
+ * Additionally, returns the version of the 'sanity' dependency from the package.json.
301
246
  */
302
- export declare const SANITY_CACHE_DIR = "node_modules/.sanity";
303
-
304
- declare interface StaticBuildOptions {
305
- basePath: string;
306
- cwd: string;
307
- outputDir: string;
308
- appTitle?: string;
309
- autoUpdates?: AutoUpdatesBuildConfig;
310
- entry?: string;
311
- exposes?: WorkbenchExposes;
312
- isApp?: boolean;
313
- /** Workbench app (opted in via `unstable_defineApp`) — drives the federation build. */
314
- isWorkbenchApp?: boolean;
315
- minify?: boolean;
316
- profile?: boolean;
317
- reactCompiler?: boolean | PluginOptions;
318
- schemaExtraction?: CliConfig["schemaExtraction"];
319
- sourceMap?: boolean;
320
- vite?: UserViteConfig;
321
- /** The workbench app's bus identity (`__SANITY_APP_ID__`). */
322
- workbenchAppId?: string;
323
- }
324
-
325
- declare interface TrackedPackage {
247
+ declare function checkRequiredDependencies(options: CheckRequiredDependenciesOptions): Promise<CheckResult>;
248
+ interface TrackedPackage {
326
249
  deprecatedBelow: string | null;
327
250
  name: string;
328
251
  supported: string[];
329
252
  }
330
-
331
- export declare interface UnresolvedPrerelease {
332
- pkg: string;
333
- version: string;
334
- }
335
-
336
- declare interface VendorBuildConfig {
337
- /** Rolldown entry name -\> absolute path to the package entry file. */
338
- entries: Record<string, string>;
339
- /** Named exports each CommonJS entry must re-expose as ESM, keyed by chunk name. */
340
- namesByChunkName: Record<string, readonly string[]>;
341
- /** Rolldown entry chunk name -\> bare import specifier (e.g. `react`, `react-dom/client`). */
342
- specifiersByChunkName: Record<string, string>;
343
- }
344
-
345
- declare interface ViteOptions {
253
+ declare function checkStudioDependencyVersions(workDir: string, output: Output, { packages }?: {
254
+ packages?: TrackedPackage[];
255
+ }): Promise<void>;
256
+ interface ViteOptions {
346
257
  /**
347
258
  * Root path of the studio/sanity app
348
259
  */
@@ -358,8 +269,8 @@ declare interface ViteOptions {
358
269
  /**
359
270
  * Mode to run vite in - eg development or production
360
271
  */
361
- mode: "development" | "production";
362
- reactCompiler: boolean | PluginOptions | undefined;
272
+ mode: 'development' | 'production';
273
+ reactCompiler: CliConfig['reactCompiler'];
363
274
  /**
364
275
  * Additional plugins when configured, eg. typegen
365
276
  */
@@ -393,7 +304,7 @@ declare interface ViteOptions {
393
304
  /**
394
305
  * Schema extraction configuration
395
306
  */
396
- schemaExtraction?: CliConfig["schemaExtraction"];
307
+ schemaExtraction?: CliConfig['schemaExtraction'];
397
308
  /**
398
309
  * HTTP development server configuration
399
310
  */
@@ -411,7 +322,31 @@ declare interface ViteOptions {
411
322
  */
412
323
  workbenchAppId?: string;
413
324
  }
414
-
325
+ /**
326
+ * Get a configuration object for Vite based on the passed options
327
+ *
328
+ * @internal Only meant for consumption inside of Sanity modules, do not depend on this externally
329
+ */
330
+ declare function getViteConfig(options: ViteOptions): Promise<InlineConfig>;
331
+ /**
332
+ * Merge user-provided Vite configuration object or function
333
+ *
334
+ * @param defaultConfig - Default configuration object
335
+ * @param userConfig - User-provided configuration object or function
336
+ * @returns Merged configuration
337
+ * @internal
338
+ */
339
+ declare function extendViteConfigWithUserConfig(env: ConfigEnv, defaultConfig: InlineConfig, userConfig: UserViteConfig): Promise<InlineConfig>;
340
+ interface RuntimeOptions {
341
+ cwd: string;
342
+ reactStrictMode: boolean | undefined;
343
+ watch: boolean;
344
+ appTitle?: string;
345
+ basePath?: string;
346
+ entry?: string;
347
+ isApp?: boolean;
348
+ isWorkbenchApp?: boolean;
349
+ }
415
350
  /**
416
351
  * Generates the `.sanity/runtime` directory, and optionally watches for custom
417
352
  * document files, rebuilding when they change
@@ -420,12 +355,19 @@ declare interface ViteOptions {
420
355
  * @returns A watcher instance if watch is enabled, undefined otherwise
421
356
  * @internal
422
357
  */
423
- export declare function writeSanityRuntime(options: RuntimeOptions): Promise<{
358
+ declare function writeSanityRuntime(options: RuntimeOptions): Promise<{
424
359
  entries: {
425
360
  relativeConfigLocation: string | null;
426
361
  relativeEntry: string | null;
427
362
  };
428
363
  watcher: FSWatcher | undefined;
429
364
  }>;
430
-
431
- export {};
365
+ /**
366
+ * Root directory (relative to the project) used by Sanity tooling for
367
+ * build-time artifacts and caches — Vite's `cacheDir` and the dev-time
368
+ * manifest output. Lives under `node_modules/` so it's out of `dist` and
369
+ * ignored by default in typical `.gitignore` files.
370
+ */
371
+ declare const SANITY_CACHE_DIR = "node_modules/.sanity";
372
+ export { type BuildAppEventListener, type BuildStudioEventListener, type CompareDependencyVersions, type CompareDependencyVersionsResult, SANITY_CACHE_DIR, type UnresolvedPrerelease, buildApp, buildStaticFiles, buildStudio, checkRequiredDependencies, checkStudioDependencyVersions, compareDependencyVersions, extendViteConfigWithUserConfig, getViteConfig, resolveVendorBuildConfig, writeSanityRuntime };
373
+ //# sourceMappingURL=build.d.ts.map
@@ -1,53 +1,20 @@
1
- /**
2
- * Get environment variables prefixed with SANITY_APP_, as an object.
3
- *
4
- * @param options - Options for the environment variable loading
5
- * {@link StudioEnvVariablesOptions}
6
- * @returns Object of app environment variables
7
- *
8
- * @internal
9
- */
10
- export declare function getAppEnvironmentVariables(
11
- options?: StudioEnvVariablesOptions,
12
- ): Record<string, string>;
13
-
14
- /**
15
- * Get environment variables prefixed with SANITY_STUDIO_, as an object.
16
- *
17
- * @param options - Options for the environment variable loading
18
- * {@link StudioEnvVariablesOptions}
19
- * @returns Object of studio environment variables
20
- *
21
- * @example
22
- * ```tsx
23
- * getStudioEnvironmentVariables({prefix: 'process.env.', jsonEncode: true})
24
- * ```
25
- *
26
- * @public
27
- */
28
- export declare function getStudioEnvironmentVariables(
29
- options?: StudioEnvVariablesOptions,
30
- ): Record<string, string>;
31
-
32
1
  /**
33
2
  * The params for the `getStudioEnvironmentVariables` and `getAppEnvironmentVariables` function
34
3
  * that gets Studio/App-focused environment variables.
35
4
  *
36
5
  * @public
37
6
  */
38
- export declare interface StudioEnvVariablesOptions {
7
+ interface StudioEnvVariablesOptions {
39
8
  /**
40
9
  * When specified includes environment variables from dotenv files (`.env`), in the same way the studio does.
41
10
  * A `mode` must be specified, usually `development`
42
11
  * or `production`, which will load the corresponding `.env.development` or `.env.production`.
43
12
  * To specify where to look for the dotenv files, specify `options.envFile.envDir`.
44
13
  */
45
- envFile?:
46
- | false
47
- | {
48
- envDir?: string;
49
- mode: string;
50
- };
14
+ envFile?: false | {
15
+ envDir?: string;
16
+ mode: string;
17
+ };
51
18
  /**
52
19
  * When specified, JSON-encodes the values, which is handy if you want to pass
53
20
  * this to a bundlers hardcoded defines, such as Vite's `define` or Webpack's `DefinePlugin`.
@@ -59,5 +26,30 @@ export declare interface StudioEnvVariablesOptions {
59
26
  */
60
27
  prefix?: string;
61
28
  }
62
-
63
- export {};
29
+ /**
30
+ * Get environment variables prefixed with SANITY_STUDIO_, as an object.
31
+ *
32
+ * @param options - Options for the environment variable loading
33
+ * {@link StudioEnvVariablesOptions}
34
+ * @returns Object of studio environment variables
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * getStudioEnvironmentVariables({prefix: 'process.env.', jsonEncode: true})
39
+ * ```
40
+ *
41
+ * @public
42
+ */
43
+ declare function getStudioEnvironmentVariables(options?: StudioEnvVariablesOptions): Record<string, string>;
44
+ /**
45
+ * Get environment variables prefixed with SANITY_APP_, as an object.
46
+ *
47
+ * @param options - Options for the environment variable loading
48
+ * {@link StudioEnvVariablesOptions}
49
+ * @returns Object of app environment variables
50
+ *
51
+ * @internal
52
+ */
53
+ declare function getAppEnvironmentVariables(options?: StudioEnvVariablesOptions): Record<string, string>;
54
+ export { type StudioEnvVariablesOptions, getAppEnvironmentVariables, getStudioEnvironmentVariables };
55
+ //# sourceMappingURL=env.d.ts.map