@arcgis/components-build-utils 4.34.0-next.5 → 4.34.0-next.51

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.
@@ -3,3 +3,4 @@ export declare const registerCommand: (command: Command) => undefined;
3
3
  export declare function ensureWorkingTreeClean({ cwd }?: {
4
4
  cwd?: string;
5
5
  }): void;
6
+ export declare const readWorkingTree: (cwd?: string) => string | undefined;
@@ -3,3 +3,4 @@ export declare const registerCommand: (command: Command) => undefined;
3
3
  export declare function ensureWorkingTreeClean({ cwd }?: {
4
4
  cwd?: string;
5
5
  }): void;
6
+ export declare const readWorkingTree: (cwd?: string) => string | undefined;
@@ -0,0 +1,12 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export type Builddate = {
4
+ "builddate": string;
5
+ "commit": string;
6
+ "branch": string;
7
+ "version": string;
8
+ "@arcgis/core": string;
9
+ "@esri/calcite-components": string;
10
+ "@esri/arcgis-html-sanitizer": string;
11
+ };
12
+ export declare function generateBuilddate(): Builddate;
@@ -0,0 +1,12 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export type Builddate = {
4
+ "builddate": string;
5
+ "commit": string;
6
+ "branch": string;
7
+ "version": string;
8
+ "@arcgis/core": string;
9
+ "@esri/calcite-components": string;
10
+ "@esri/arcgis-html-sanitizer": string;
11
+ };
12
+ export declare function generateBuilddate(): Builddate;
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -1,4 +1,4 @@
1
- export declare function getFileNames(sourceRelative: string, sourceRoot: string, endsWithIgnore: string[], ignore?: string[]): {
1
+ export declare function getFileNames(sourceRelative: string, sourceRoot: string, endsWithIgnore: string[], containsIgnore: string[], ignore?: string[]): {
2
2
  filteredFiles: string[];
3
3
  rootFiles: Set<string>;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare function getFileNames(sourceRelative: string, sourceRoot: string, endsWithIgnore: string[], ignore?: string[]): {
1
+ export declare function getFileNames(sourceRelative: string, sourceRoot: string, endsWithIgnore: string[], containsIgnore: string[], ignore?: string[]): {
2
2
  filteredFiles: string[];
3
3
  rootFiles: Set<string>;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare function copyFolderWithHistory(rawSource: string, rawDestination: string, { yes, emitPatchFiles, dryRun, dirtyCheck, addBackLinks, ignoreAlreadyExists, remote, ignore, endsWithIgnore, rename: rawRenames, dumpSizes, dumpFileSizes, updateMergeCommitTitlesFrom, }: {
1
+ export declare function copyFolderWithHistory(rawSource: string, rawDestination: string, { yes, emitPatchFiles, dryRun, dirtyCheck, addBackLinks, ignoreAlreadyExists, remote, ignore, endsWithIgnore, containsIgnore, rename: rawRenames, dumpSizes, dumpFileSizes, updateMergeCommitTitlesFrom, }: {
2
2
  readonly yes: boolean;
3
3
  readonly emitPatchFiles: boolean;
4
4
  readonly dryRun: boolean;
@@ -8,6 +8,7 @@ export declare function copyFolderWithHistory(rawSource: string, rawDestination:
8
8
  readonly remote: string;
9
9
  readonly ignore?: string[];
10
10
  readonly endsWithIgnore?: string[];
11
+ readonly containsIgnore?: string[];
11
12
  readonly rename?: string[];
12
13
  readonly dumpSizes: boolean;
13
14
  readonly dumpFileSizes: boolean;
@@ -1,4 +1,4 @@
1
- export declare function copyFolderWithHistory(rawSource: string, rawDestination: string, { yes, emitPatchFiles, dryRun, dirtyCheck, addBackLinks, ignoreAlreadyExists, remote, ignore, endsWithIgnore, rename: rawRenames, dumpSizes, dumpFileSizes, updateMergeCommitTitlesFrom, }: {
1
+ export declare function copyFolderWithHistory(rawSource: string, rawDestination: string, { yes, emitPatchFiles, dryRun, dirtyCheck, addBackLinks, ignoreAlreadyExists, remote, ignore, endsWithIgnore, containsIgnore, rename: rawRenames, dumpSizes, dumpFileSizes, updateMergeCommitTitlesFrom, }: {
2
2
  readonly yes: boolean;
3
3
  readonly emitPatchFiles: boolean;
4
4
  readonly dryRun: boolean;
@@ -8,6 +8,7 @@ export declare function copyFolderWithHistory(rawSource: string, rawDestination:
8
8
  readonly remote: string;
9
9
  readonly ignore?: string[];
10
10
  readonly endsWithIgnore?: string[];
11
+ readonly containsIgnore?: string[];
11
12
  readonly rename?: string[];
12
13
  readonly dumpSizes: boolean;
13
14
  readonly dumpFileSizes: boolean;
@@ -1 +1,2 @@
1
1
  export declare function error(...messages: unknown[]): void;
2
+ export declare function sh(command: string, cwd?: string): string;
@@ -1 +1,2 @@
1
1
  export declare function error(...messages: unknown[]): void;
2
+ export declare function sh(command: string, cwd?: string): string;
package/dist/index.cjs CHANGED
@@ -1,26 +1,4 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
3
  const node_fs = require("node:fs");
26
4
  const promises = require("node:fs/promises");
@@ -30,6 +8,7 @@ const node_url = require("node:url");
30
8
  const posix = require("node:path/posix");
31
9
  const win32 = require("node:path/win32");
32
10
  const dts = require("vite-plugin-dts");
11
+ const node_module = require("node:module");
33
12
  const existsAsync = async (file) => (
34
13
  // Using un-promisified version because promises version creates exceptions
35
14
  // which interferes with debugging when "Pause on caught exceptions" is enabled
@@ -192,8 +171,9 @@ function detectPackageManager(cwd = process.cwd()) {
192
171
  return packageManager;
193
172
  }
194
173
  function vitePresetPlugin({
195
- externalize = [],
196
- dtsOptions = {}
174
+ dtsOptions = {},
175
+ externalize,
176
+ bundleIn
197
177
  } = {
198
178
  externalize: [],
199
179
  dtsOptions: {}
@@ -222,22 +202,10 @@ function vitePresetPlugin({
222
202
  userConfig = config;
223
203
  }
224
204
  },
225
- /**
226
- * We use a dynamic import here because of how Rollup processes and transforms imports.
227
- * This dependency (rollup-plugin-node-externals) will not be bundled into the output,
228
- * as specified in vite.config.ts.
229
- *
230
- * rollup-plugin-node-externals is an ES module, and Stencil throws an error when it encounters
231
- * a require() statement for an ES module.
232
- *
233
- * If we used a static import, Rollup's cjs build would transform it into a require() statement,
234
- * causing Stencil to throw an error. Using a dynamic import prevents this issue.
235
- */
236
- import("rollup-plugin-node-externals").then(
237
- ({ nodeExternals }) => nodeExternals({
238
- include: externalize.map(stringToStartsWithGlob)
239
- })
240
- ),
205
+ externalizeDependencies({
206
+ externalize,
207
+ bundleIn
208
+ }),
241
209
  dts({
242
210
  logLevel: "warn",
243
211
  // Copies .d.ts files to d.cjs file for CommonJS.
@@ -290,13 +258,53 @@ function vitePresetPlugin({
290
258
  function shouldSkip(id) {
291
259
  return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
292
260
  }
293
- const stringToStartsWithGlob = (option) => option ? typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}`, "u") : option : void 0;
261
+ function externalizeDependencies(options) {
262
+ const packageJson = retrievePackageJson();
263
+ const externalDependencies = Object.keys({
264
+ ...packageJson.dependencies,
265
+ ...packageJson.peerDependencies,
266
+ ...packageJson.optionalDependencies
267
+ });
268
+ const bundleIn = options.bundleIn?.map(stringToStartsWithGlob) ?? [];
269
+ const externalize = [
270
+ ...options.externalize?.map(stringToStartsWithGlob) ?? [],
271
+ ...externalDependencies.length > 0 ? [new RegExp(`^(?:${externalDependencies.join("|")})(?:/.+)?$`, "u")] : []
272
+ ];
273
+ const isExternalized = (id) => externalize.some((regex) => regex.test(id));
274
+ const isBundledIn = (id) => bundleIn.some((regex) => regex.test(id));
275
+ const plugin = {
276
+ name: "@arcgis/components-build-utils:externalize-dependencies",
277
+ apply: "build",
278
+ enforce: "pre",
279
+ resolveId(specifier, _, { isEntry }) {
280
+ if (
281
+ // Ignore entry points
282
+ isEntry || // Ignore virtual modules
283
+ specifier.startsWith("\0") || // Ignore relative
284
+ specifier.startsWith(".") || path.isAbsolute(specifier)
285
+ ) {
286
+ return null;
287
+ }
288
+ if (node_module.isBuiltin(specifier)) {
289
+ return {
290
+ id: specifier.startsWith("node:") ? specifier : `node:${specifier}`,
291
+ external: true,
292
+ moduleSideEffects: false
293
+ };
294
+ }
295
+ return isExternalized(specifier) && !isBundledIn(specifier) ? false : null;
296
+ }
297
+ };
298
+ return plugin;
299
+ }
300
+ const stringToStartsWithGlob = (option) => typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?:/.+)?$`, "u") : option;
294
301
  exports.asyncFindPath = asyncFindPath;
295
302
  exports.asyncRetrievePackageJson = asyncRetrievePackageJson;
296
303
  exports.createFileIfNotExists = createFileIfNotExists;
297
304
  exports.detectPackageManager = detectPackageManager;
298
305
  exports.existsAsync = existsAsync;
299
306
  exports.exportsForTests = exportsForTests;
307
+ exports.externalizeDependencies = externalizeDependencies;
300
308
  exports.fetchPackageLocation = fetchPackageLocation;
301
309
  exports.findPath = findPath;
302
310
  exports.getCwd = getCwd;
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import posix from "node:path/posix";
7
7
  import win32 from "node:path/win32";
8
8
  import dts from "vite-plugin-dts";
9
+ import { isBuiltin } from "node:module";
9
10
  const existsAsync = async (file) => (
10
11
  // Using un-promisified version because promises version creates exceptions
11
12
  // which interferes with debugging when "Pause on caught exceptions" is enabled
@@ -168,8 +169,9 @@ function detectPackageManager(cwd = process.cwd()) {
168
169
  return packageManager;
169
170
  }
170
171
  function vitePresetPlugin({
171
- externalize = [],
172
- dtsOptions = {}
172
+ dtsOptions = {},
173
+ externalize,
174
+ bundleIn
173
175
  } = {
174
176
  externalize: [],
175
177
  dtsOptions: {}
@@ -198,22 +200,10 @@ function vitePresetPlugin({
198
200
  userConfig = config;
199
201
  }
200
202
  },
201
- /**
202
- * We use a dynamic import here because of how Rollup processes and transforms imports.
203
- * This dependency (rollup-plugin-node-externals) will not be bundled into the output,
204
- * as specified in vite.config.ts.
205
- *
206
- * rollup-plugin-node-externals is an ES module, and Stencil throws an error when it encounters
207
- * a require() statement for an ES module.
208
- *
209
- * If we used a static import, Rollup's cjs build would transform it into a require() statement,
210
- * causing Stencil to throw an error. Using a dynamic import prevents this issue.
211
- */
212
- import("rollup-plugin-node-externals").then(
213
- ({ nodeExternals }) => nodeExternals({
214
- include: externalize.map(stringToStartsWithGlob)
215
- })
216
- ),
203
+ externalizeDependencies({
204
+ externalize,
205
+ bundleIn
206
+ }),
217
207
  dts({
218
208
  logLevel: "warn",
219
209
  // Copies .d.ts files to d.cjs file for CommonJS.
@@ -266,7 +256,46 @@ function vitePresetPlugin({
266
256
  function shouldSkip(id) {
267
257
  return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
268
258
  }
269
- const stringToStartsWithGlob = (option) => option ? typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}`, "u") : option : void 0;
259
+ function externalizeDependencies(options) {
260
+ const packageJson = retrievePackageJson();
261
+ const externalDependencies = Object.keys({
262
+ ...packageJson.dependencies,
263
+ ...packageJson.peerDependencies,
264
+ ...packageJson.optionalDependencies
265
+ });
266
+ const bundleIn = options.bundleIn?.map(stringToStartsWithGlob) ?? [];
267
+ const externalize = [
268
+ ...options.externalize?.map(stringToStartsWithGlob) ?? [],
269
+ ...externalDependencies.length > 0 ? [new RegExp(`^(?:${externalDependencies.join("|")})(?:/.+)?$`, "u")] : []
270
+ ];
271
+ const isExternalized = (id) => externalize.some((regex) => regex.test(id));
272
+ const isBundledIn = (id) => bundleIn.some((regex) => regex.test(id));
273
+ const plugin = {
274
+ name: "@arcgis/components-build-utils:externalize-dependencies",
275
+ apply: "build",
276
+ enforce: "pre",
277
+ resolveId(specifier, _, { isEntry }) {
278
+ if (
279
+ // Ignore entry points
280
+ isEntry || // Ignore virtual modules
281
+ specifier.startsWith("\0") || // Ignore relative
282
+ specifier.startsWith(".") || path.isAbsolute(specifier)
283
+ ) {
284
+ return null;
285
+ }
286
+ if (isBuiltin(specifier)) {
287
+ return {
288
+ id: specifier.startsWith("node:") ? specifier : `node:${specifier}`,
289
+ external: true,
290
+ moduleSideEffects: false
291
+ };
292
+ }
293
+ return isExternalized(specifier) && !isBundledIn(specifier) ? false : null;
294
+ }
295
+ };
296
+ return plugin;
297
+ }
298
+ const stringToStartsWithGlob = (option) => typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?:/.+)?$`, "u") : option;
270
299
  export {
271
300
  asyncFindPath,
272
301
  asyncRetrievePackageJson,
@@ -274,6 +303,7 @@ export {
274
303
  detectPackageManager,
275
304
  existsAsync,
276
305
  exportsForTests,
306
+ externalizeDependencies,
277
307
  fetchPackageLocation,
278
308
  findPath,
279
309
  getCwd,
@@ -20,6 +20,7 @@ export type MiniPackageJson = {
20
20
  "peerDependenciesMeta"?: Record<string, {
21
21
  optional?: boolean;
22
22
  }>;
23
+ "optionalDependencies"?: Record<string, string | undefined>;
23
24
  "css.customData"?: string[];
24
25
  "customElements"?: string;
25
26
  "html.customData"?: string[];
@@ -20,6 +20,7 @@ export type MiniPackageJson = {
20
20
  "peerDependenciesMeta"?: Record<string, {
21
21
  optional?: boolean;
22
22
  }>;
23
+ "optionalDependencies"?: Record<string, string | undefined>;
23
24
  "css.customData"?: string[];
24
25
  "customElements"?: string;
25
26
  "html.customData"?: string[];
package/dist/vite.d.cts CHANGED
@@ -2,23 +2,79 @@ import { Plugin } from 'vite';
2
2
  import { default as dts } from 'vite-plugin-dts';
3
3
  /**
4
4
  * Vite preset for all our support packages:
5
- * - externalizes all devDependencies (using `rollup-plugin-node-externals`)
5
+ * - externalizes all non-dev-dependencies
6
6
  * - generates type declarations (using `vite-plugin-dts`)
7
7
  */
8
- export declare function vitePresetPlugin({ externalize, dtsOptions, }?: {
9
- /** The list of dependencies to externalize besides devDependencies */
10
- externalize?: string[];
8
+ export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, }?: DependencyManagementOptions & {
11
9
  /** Additional options for `vite-plugin-dts` */
12
10
  dtsOptions?: Parameters<typeof dts>[0];
13
- }): [Plugin, Promise<Plugin>, Plugin];
11
+ }): [Plugin, Plugin, Plugin];
14
12
  /**
15
- * By default this plugin converts string values to RegExp that only matches if
16
- * path is "equal" not "starts with", which is not intuitive.
13
+ * Options for externalizing dependencies.
14
+ */
15
+ export type DependencyManagementOptions = {
16
+ /**
17
+ * Force bundle in these dependencies even if they are declared as
18
+ * dependencies or peerDependencies.
19
+ *
20
+ * @example
21
+ * This is desirable if you wish to control the version of a dependency or
22
+ * need to post-process the dependency in some way. Usually, you will declare
23
+ * such as a devDependency, but there is a use case for declaring it as a
24
+ * dependency instead:
25
+ *
26
+ * - If TypeScript types from the bundled in dependencies are referenced in
27
+ * the `.d.ts` files of your library, you will need to declare the package
28
+ * as a `dependency`, so that it is still installed on the consumer's
29
+ * computer so that TypeScript can correctly resolve the types of that
30
+ * library.
31
+ */
32
+ readonly bundleIn?: (RegExp | string)[];
33
+ /**
34
+ * Force externalize these dependencies, even if they are declared as
35
+ * devDependencies.
36
+ *
37
+ * @example
38
+ * This is desirable if you are sure the end user will have these dependencies
39
+ * available, yet do not wish to declare these as devDependencies for some
40
+ * technical reasons.
41
+ */
42
+ readonly externalize?: (RegExp | string)[];
43
+ };
44
+ /**
45
+ * By default, Rollup will bundle-in all dependencies.
46
+ *
47
+ * We change it as follows:
48
+ * Externalize all packages that are defined as
49
+ * "dependency" or "peerDependency" in the package.json.
50
+ * If you wish to bundle-in some package, define it as a "devDependency".
51
+ *
52
+ * Bundling-in packages is not recommended because:
53
+ * - it makes our build take longer
54
+ * - it pushes larger packages to NPM
55
+ * - user of our library is locked into the version of the package we bundled in
56
+ * - if user has two packages using the same library, there will be two copies
57
+ * served on the page
58
+ * - It may break some libraries/prevent them from optimizing correctly
59
+ * depending on the production/development mode, or prevent them from loading
60
+ * correct code depending on browser/node.js environment.
17
61
  *
18
- * I.e, this would only exclude "monaco-editor", not any
19
- * "monaco-editor/sub-path" by default:
20
- * "bundleIn": ["monaco-editor"]
62
+ * For example, see this statement from Lit:
63
+ * https://lit.dev/docs/ssr/authoring/#:~:text=Don%27t%20bundle%20Lit,based%20on%20environment.
64
+ *
65
+ * @see {@link ./buildCdn.ts} for CDN dependency bundling details
66
+ *
67
+ * @remarks
68
+ * If a dependency is both a peerDependency and a devDependency, it will still
69
+ * be externalized (because all peerDependencies are externalized).
70
+ */
71
+ export declare function externalizeDependencies(options: DependencyManagementOptions): Plugin;
72
+ /**
73
+ * Convert a string value to a RegExp that matches any import specifier that
74
+ * starts with the given string.
21
75
  *
22
- * We fix it to match using "starts with" instead
76
+ * @example
77
+ * "monaco-editor" will create a regex that matches "monaco-editor" and
78
+ * "monaco-editor/sub-path", but not "monaco-editor-beta".
23
79
  */
24
- export declare const stringToStartsWithGlob: (option: RegExp | string | false | null | undefined) => RegExp | undefined;
80
+ export declare const stringToStartsWithGlob: (option: RegExp | string) => RegExp;
package/dist/vite.d.ts CHANGED
@@ -2,23 +2,79 @@ import { Plugin } from 'vite';
2
2
  import { default as dts } from 'vite-plugin-dts';
3
3
  /**
4
4
  * Vite preset for all our support packages:
5
- * - externalizes all devDependencies (using `rollup-plugin-node-externals`)
5
+ * - externalizes all non-dev-dependencies
6
6
  * - generates type declarations (using `vite-plugin-dts`)
7
7
  */
8
- export declare function vitePresetPlugin({ externalize, dtsOptions, }?: {
9
- /** The list of dependencies to externalize besides devDependencies */
10
- externalize?: string[];
8
+ export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, }?: DependencyManagementOptions & {
11
9
  /** Additional options for `vite-plugin-dts` */
12
10
  dtsOptions?: Parameters<typeof dts>[0];
13
- }): [Plugin, Promise<Plugin>, Plugin];
11
+ }): [Plugin, Plugin, Plugin];
14
12
  /**
15
- * By default this plugin converts string values to RegExp that only matches if
16
- * path is "equal" not "starts with", which is not intuitive.
13
+ * Options for externalizing dependencies.
14
+ */
15
+ export type DependencyManagementOptions = {
16
+ /**
17
+ * Force bundle in these dependencies even if they are declared as
18
+ * dependencies or peerDependencies.
19
+ *
20
+ * @example
21
+ * This is desirable if you wish to control the version of a dependency or
22
+ * need to post-process the dependency in some way. Usually, you will declare
23
+ * such as a devDependency, but there is a use case for declaring it as a
24
+ * dependency instead:
25
+ *
26
+ * - If TypeScript types from the bundled in dependencies are referenced in
27
+ * the `.d.ts` files of your library, you will need to declare the package
28
+ * as a `dependency`, so that it is still installed on the consumer's
29
+ * computer so that TypeScript can correctly resolve the types of that
30
+ * library.
31
+ */
32
+ readonly bundleIn?: (RegExp | string)[];
33
+ /**
34
+ * Force externalize these dependencies, even if they are declared as
35
+ * devDependencies.
36
+ *
37
+ * @example
38
+ * This is desirable if you are sure the end user will have these dependencies
39
+ * available, yet do not wish to declare these as devDependencies for some
40
+ * technical reasons.
41
+ */
42
+ readonly externalize?: (RegExp | string)[];
43
+ };
44
+ /**
45
+ * By default, Rollup will bundle-in all dependencies.
46
+ *
47
+ * We change it as follows:
48
+ * Externalize all packages that are defined as
49
+ * "dependency" or "peerDependency" in the package.json.
50
+ * If you wish to bundle-in some package, define it as a "devDependency".
51
+ *
52
+ * Bundling-in packages is not recommended because:
53
+ * - it makes our build take longer
54
+ * - it pushes larger packages to NPM
55
+ * - user of our library is locked into the version of the package we bundled in
56
+ * - if user has two packages using the same library, there will be two copies
57
+ * served on the page
58
+ * - It may break some libraries/prevent them from optimizing correctly
59
+ * depending on the production/development mode, or prevent them from loading
60
+ * correct code depending on browser/node.js environment.
17
61
  *
18
- * I.e, this would only exclude "monaco-editor", not any
19
- * "monaco-editor/sub-path" by default:
20
- * "bundleIn": ["monaco-editor"]
62
+ * For example, see this statement from Lit:
63
+ * https://lit.dev/docs/ssr/authoring/#:~:text=Don%27t%20bundle%20Lit,based%20on%20environment.
64
+ *
65
+ * @see {@link ./buildCdn.ts} for CDN dependency bundling details
66
+ *
67
+ * @remarks
68
+ * If a dependency is both a peerDependency and a devDependency, it will still
69
+ * be externalized (because all peerDependencies are externalized).
70
+ */
71
+ export declare function externalizeDependencies(options: DependencyManagementOptions): Plugin;
72
+ /**
73
+ * Convert a string value to a RegExp that matches any import specifier that
74
+ * starts with the given string.
21
75
  *
22
- * We fix it to match using "starts with" instead
76
+ * @example
77
+ * "monaco-editor" will create a regex that matches "monaco-editor" and
78
+ * "monaco-editor/sub-path", but not "monaco-editor-beta".
23
79
  */
24
- export declare const stringToStartsWithGlob: (option: RegExp | string | false | null | undefined) => RegExp | undefined;
80
+ export declare const stringToStartsWithGlob: (option: RegExp | string) => RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "4.34.0-next.5",
3
+ "version": "4.34.0-next.51",
4
4
  "description": "Collection of common internal build-time patterns and utilities for ArcGIS Maps SDK for JavaScript components.",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -22,14 +22,13 @@
22
22
  },
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
- "@commander-js/extra-typings": "^11.1.0",
26
- "chalk": "^5.3.0",
27
- "commander": "^11.1.0",
28
- "glob": "^11.0.0",
29
- "rollup-plugin-node-externals": "^8.0.0",
25
+ "@commander-js/extra-typings": "^14.0.0",
26
+ "chalk": "^5.4.1",
27
+ "commander": "^14.0.0",
28
+ "glob": "^11.0.3",
30
29
  "split2": "^4.2.0",
31
30
  "tslib": "^2.8.1",
32
- "vite": "^6.3.4",
33
- "vite-plugin-dts": "^4.5.3"
31
+ "vite": "^7.0.0",
32
+ "vite-plugin-dts": "^4.5.4"
34
33
  }
35
34
  }