@arcgis/components-build-utils 5.1.0-next.13 → 5.1.0-next.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/file.d.cts +3 -1
- package/dist/file.d.ts +3 -1
- package/dist/index.cjs +83 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +84 -12
- package/dist/packageJson.d.cts +2 -9
- package/dist/packageJson.d.ts +2 -9
- package/dist/vite.d.cts +30 -12
- package/dist/vite.d.ts +30 -12
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -8,5 +8,5 @@ It is not intended to be used directly, but rather used as a dependency by other
|
|
|
8
8
|
|
|
9
9
|
## License
|
|
10
10
|
|
|
11
|
-
This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.
|
|
12
|
-
For third party notices, see https://js.arcgis.com/5.
|
|
11
|
+
This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.1/LICENSE.txt.
|
|
12
|
+
For third party notices, see https://js.arcgis.com/5.1/third-party-notices.txt.
|
package/dist/file.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
1
|
+
import { ExecSyncOptionsWithStringEncoding, SpawnSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
2
|
export declare const existsAsync: (file: string) => Promise<boolean>;
|
|
3
3
|
/** Wrapper for execSync to execute shell commands */
|
|
4
4
|
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
5
|
+
/** Wrapper for spawnSync to execute commands without shell interpolation. */
|
|
6
|
+
export declare function sp(command: string, args: string[], options?: Partial<SpawnSyncOptionsWithStringEncoding>): string;
|
|
5
7
|
export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
|
|
6
8
|
export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
|
|
7
9
|
/**
|
package/dist/file.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
1
|
+
import { ExecSyncOptionsWithStringEncoding, SpawnSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
2
|
export declare const existsAsync: (file: string) => Promise<boolean>;
|
|
3
3
|
/** Wrapper for execSync to execute shell commands */
|
|
4
4
|
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
5
|
+
/** Wrapper for spawnSync to execute commands without shell interpolation. */
|
|
6
|
+
export declare function sp(command: string, args: string[], options?: Partial<SpawnSyncOptionsWithStringEncoding>): string;
|
|
5
7
|
export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
|
|
6
8
|
export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
|
|
7
9
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,22 @@ function sh(command, options = {}) {
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
function sp(command, args, options = {}) {
|
|
47
|
+
const normalizedOptions = { encoding: "utf8", ...options };
|
|
48
|
+
const result = node_child_process.spawnSync(command, args, normalizedOptions);
|
|
49
|
+
if (result.error) {
|
|
50
|
+
throw result.error;
|
|
51
|
+
}
|
|
52
|
+
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
53
|
+
const exitCode = result.status ?? 0;
|
|
54
|
+
if (exitCode !== 0) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Command failed with exit code ${String(exitCode)}: ${command} ${args.join(" ")}
|
|
57
|
+
${output}`.trim()
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return output;
|
|
61
|
+
}
|
|
46
62
|
async function asyncSh(command, options = {}) {
|
|
47
63
|
const normalizedOptions = { encoding: "utf8", ...options };
|
|
48
64
|
return await new Promise((resolve2, reject) => {
|
|
@@ -241,7 +257,8 @@ function detectPackageManager(cwd = process.cwd()) {
|
|
|
241
257
|
function vitePresetPlugin({
|
|
242
258
|
dtsOptions = {},
|
|
243
259
|
externalize,
|
|
244
|
-
bundleIn
|
|
260
|
+
bundleIn,
|
|
261
|
+
isApplication
|
|
245
262
|
} = {
|
|
246
263
|
externalize: [],
|
|
247
264
|
dtsOptions: {}
|
|
@@ -272,12 +289,13 @@ function vitePresetPlugin({
|
|
|
272
289
|
},
|
|
273
290
|
externalizeDependencies({
|
|
274
291
|
externalize,
|
|
275
|
-
bundleIn
|
|
292
|
+
bundleIn,
|
|
293
|
+
isApplication
|
|
276
294
|
}),
|
|
277
295
|
// This dependency pulls in many others. Since components-build-utils has a
|
|
278
296
|
// single entry point, we load a large module tree needlessly. To avoid,
|
|
279
297
|
// load the plugin on demand.
|
|
280
|
-
import("vite-plugin-dts").then(
|
|
298
|
+
dtsOptions === false ? void 0 : import("vite-plugin-dts").then(
|
|
281
299
|
({ default: dts }) => dts({
|
|
282
300
|
logLevel: "warn",
|
|
283
301
|
// Copies .d.ts files to d.cjs file for CommonJS.
|
|
@@ -331,24 +349,33 @@ function shouldSkip(id) {
|
|
|
331
349
|
return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
|
|
332
350
|
}
|
|
333
351
|
function externalizeDependencies(options) {
|
|
334
|
-
|
|
352
|
+
return externalizeDependenciesImplementation(options, retrievePackageJson());
|
|
353
|
+
}
|
|
354
|
+
function externalizeDependenciesImplementation(options, packageJson) {
|
|
335
355
|
const externalDependencies = Object.keys({
|
|
336
356
|
...packageJson.dependencies,
|
|
337
357
|
...packageJson.peerDependencies,
|
|
338
358
|
...packageJson.optionalDependencies
|
|
339
359
|
});
|
|
360
|
+
const isStrictBundling = toPosixPathSeparators(void 0).includes(
|
|
361
|
+
"support-packages/components-build-utils"
|
|
362
|
+
);
|
|
340
363
|
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob);
|
|
364
|
+
const explicitExternalize = options.externalize?.map(stringToStartsWithGlob) ?? [];
|
|
341
365
|
const externalize = [
|
|
342
|
-
...
|
|
366
|
+
...explicitExternalize,
|
|
367
|
+
// BUG: we shouldn't silently externalize node in browser packages.
|
|
368
|
+
// Consider erroring instead
|
|
343
369
|
/^node:/u,
|
|
344
370
|
new RegExp(
|
|
345
|
-
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${node_module.builtinModules.join("|")})(
|
|
371
|
+
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${node_module.builtinModules.join("|")})(?:/|$)`,
|
|
346
372
|
"u"
|
|
347
373
|
)
|
|
348
374
|
];
|
|
349
375
|
const plugin = {
|
|
350
|
-
name:
|
|
376
|
+
name: pluginName,
|
|
351
377
|
apply: "build",
|
|
378
|
+
// Externalize before Vite's default resolution runs
|
|
352
379
|
enforce: "pre",
|
|
353
380
|
// Rolldown also has "external" option, which can be provided regexes.
|
|
354
381
|
// Theoretically that would be more efficient due to less communication
|
|
@@ -358,18 +385,62 @@ function externalizeDependencies(options) {
|
|
|
358
385
|
resolveId: {
|
|
359
386
|
filter: {
|
|
360
387
|
id: {
|
|
361
|
-
include:
|
|
388
|
+
include: [
|
|
389
|
+
// In most cases, we want all dependencies in library packages to be
|
|
390
|
+
// externalized. Thus, this regex matches all non-relative imports.
|
|
391
|
+
nonRelativeSpecifierPattern,
|
|
392
|
+
// Also include explicitExternalize because those may target relative
|
|
393
|
+
// paths (e.g. ./draconvert.js in mock-services).
|
|
394
|
+
...explicitExternalize
|
|
395
|
+
],
|
|
362
396
|
exclude: bundleIn
|
|
363
397
|
}
|
|
364
398
|
},
|
|
365
|
-
handler() {
|
|
366
|
-
|
|
399
|
+
handler(id, importer, resolveOptions) {
|
|
400
|
+
if (matchesAny(id, externalize)) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
if (
|
|
404
|
+
// Entrypoints look like src/components/button/button.tsx, so are
|
|
405
|
+
// matched by the nonRelativeSpecifierPattern
|
|
406
|
+
resolveOptions.isEntry || // Virtual specifiers are handled by plugins
|
|
407
|
+
id.startsWith("\0") || // data: node: virtual:
|
|
408
|
+
id.includes(":") || // ?raw ?url ?worker - resolved by other plugins
|
|
409
|
+
id.includes("?") || // Applications can bundle in anything
|
|
410
|
+
options.isApplication === true
|
|
411
|
+
) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const error = `[${pluginName}] Vite tried to bundle in "${id}" (imported by ${importer}).
|
|
415
|
+
This is likely undesirable. To externalize it, declare this dependency as a "dependency", "peerDependency" or "optionalDependency" in package.json.
|
|
416
|
+
If this is intentional, add it to the build.dependencies.bundleIn option in useLumina() or bundleIn option in the vitePresetPlugin().
|
|
417
|
+
If this is an application rather than a library, pass isApplication:true in vitePresetPlugin().`;
|
|
418
|
+
if (isStrictBundling) {
|
|
419
|
+
throw Error(error);
|
|
420
|
+
} else {
|
|
421
|
+
console.error(node_util.styleText("red", `${error}
|
|
422
|
+
This will be an error in future version.`));
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
367
425
|
}
|
|
368
426
|
}
|
|
369
427
|
};
|
|
370
428
|
return plugin;
|
|
371
429
|
}
|
|
372
|
-
const
|
|
430
|
+
const pluginName = "@arcgis/components-build-utils:externalize-dependencies";
|
|
431
|
+
const stringToStartsWithGlob = (option) => typeof option === "string" ? new RegExp(
|
|
432
|
+
`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}${option.endsWith("/") ? "(?:.+)?" : "(?:/.+)?"}$`,
|
|
433
|
+
"u"
|
|
434
|
+
) : option;
|
|
435
|
+
const nonRelativeSpecifierPattern = /^[^\.\/]/u;
|
|
436
|
+
function matchesAny(id, patterns) {
|
|
437
|
+
for (let index = 0; index < patterns.length; ++index) {
|
|
438
|
+
if (patterns[index].test(id)) {
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
373
444
|
exports.asyncFindPath = asyncFindPath;
|
|
374
445
|
exports.asyncRetrievePackageJson = asyncRetrievePackageJson;
|
|
375
446
|
exports.asyncSh = asyncSh;
|
|
@@ -387,6 +458,7 @@ exports.normalizePath = normalizePath;
|
|
|
387
458
|
exports.path = path;
|
|
388
459
|
exports.retrievePackageJson = retrievePackageJson;
|
|
389
460
|
exports.sh = sh;
|
|
461
|
+
exports.sp = sp;
|
|
390
462
|
exports.toPosixPathSeparators = toPosixPathSeparators;
|
|
391
463
|
exports.toSystemPathSeparators = toSystemPathSeparators;
|
|
392
464
|
exports.vitePresetPlugin = vitePresetPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { existsAsync, sh, asyncSh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
1
|
+
export { existsAsync, sh, sp, asyncSh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
2
2
|
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
|
|
3
3
|
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
|
|
4
4
|
export { type PackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { existsAsync, sh, asyncSh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
1
|
+
export { existsAsync, sh, sp, asyncSh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
2
2
|
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
|
|
3
3
|
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
|
|
4
4
|
export { type PackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { access, existsSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { constants, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, resolve, sep, join, posix, win32 } from "path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { execSync, exec } from "node:child_process";
|
|
5
|
+
import { execSync, spawnSync, exec } from "node:child_process";
|
|
6
6
|
import { styleText } from "node:util";
|
|
7
7
|
import { builtinModules } from "node:module";
|
|
8
8
|
const existsAsync = async (file) => (
|
|
@@ -19,6 +19,22 @@ function sh(command, options = {}) {
|
|
|
19
19
|
throw error;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
function sp(command, args, options = {}) {
|
|
23
|
+
const normalizedOptions = { encoding: "utf8", ...options };
|
|
24
|
+
const result = spawnSync(command, args, normalizedOptions);
|
|
25
|
+
if (result.error) {
|
|
26
|
+
throw result.error;
|
|
27
|
+
}
|
|
28
|
+
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
29
|
+
const exitCode = result.status ?? 0;
|
|
30
|
+
if (exitCode !== 0) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Command failed with exit code ${String(exitCode)}: ${command} ${args.join(" ")}
|
|
33
|
+
${output}`.trim()
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return output;
|
|
37
|
+
}
|
|
22
38
|
async function asyncSh(command, options = {}) {
|
|
23
39
|
const normalizedOptions = { encoding: "utf8", ...options };
|
|
24
40
|
return await new Promise((resolve2, reject) => {
|
|
@@ -217,7 +233,8 @@ function detectPackageManager(cwd = process.cwd()) {
|
|
|
217
233
|
function vitePresetPlugin({
|
|
218
234
|
dtsOptions = {},
|
|
219
235
|
externalize,
|
|
220
|
-
bundleIn
|
|
236
|
+
bundleIn,
|
|
237
|
+
isApplication
|
|
221
238
|
} = {
|
|
222
239
|
externalize: [],
|
|
223
240
|
dtsOptions: {}
|
|
@@ -248,12 +265,13 @@ function vitePresetPlugin({
|
|
|
248
265
|
},
|
|
249
266
|
externalizeDependencies({
|
|
250
267
|
externalize,
|
|
251
|
-
bundleIn
|
|
268
|
+
bundleIn,
|
|
269
|
+
isApplication
|
|
252
270
|
}),
|
|
253
271
|
// This dependency pulls in many others. Since components-build-utils has a
|
|
254
272
|
// single entry point, we load a large module tree needlessly. To avoid,
|
|
255
273
|
// load the plugin on demand.
|
|
256
|
-
import("vite-plugin-dts").then(
|
|
274
|
+
dtsOptions === false ? void 0 : import("vite-plugin-dts").then(
|
|
257
275
|
({ default: dts }) => dts({
|
|
258
276
|
logLevel: "warn",
|
|
259
277
|
// Copies .d.ts files to d.cjs file for CommonJS.
|
|
@@ -307,24 +325,33 @@ function shouldSkip(id) {
|
|
|
307
325
|
return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
|
|
308
326
|
}
|
|
309
327
|
function externalizeDependencies(options) {
|
|
310
|
-
|
|
328
|
+
return externalizeDependenciesImplementation(options, retrievePackageJson());
|
|
329
|
+
}
|
|
330
|
+
function externalizeDependenciesImplementation(options, packageJson) {
|
|
311
331
|
const externalDependencies = Object.keys({
|
|
312
332
|
...packageJson.dependencies,
|
|
313
333
|
...packageJson.peerDependencies,
|
|
314
334
|
...packageJson.optionalDependencies
|
|
315
335
|
});
|
|
336
|
+
const isStrictBundling = toPosixPathSeparators(import.meta.dirname).includes(
|
|
337
|
+
"support-packages/components-build-utils"
|
|
338
|
+
);
|
|
316
339
|
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob);
|
|
340
|
+
const explicitExternalize = options.externalize?.map(stringToStartsWithGlob) ?? [];
|
|
317
341
|
const externalize = [
|
|
318
|
-
...
|
|
342
|
+
...explicitExternalize,
|
|
343
|
+
// BUG: we shouldn't silently externalize node in browser packages.
|
|
344
|
+
// Consider erroring instead
|
|
319
345
|
/^node:/u,
|
|
320
346
|
new RegExp(
|
|
321
|
-
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${builtinModules.join("|")})(
|
|
347
|
+
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${builtinModules.join("|")})(?:/|$)`,
|
|
322
348
|
"u"
|
|
323
349
|
)
|
|
324
350
|
];
|
|
325
351
|
const plugin = {
|
|
326
|
-
name:
|
|
352
|
+
name: pluginName,
|
|
327
353
|
apply: "build",
|
|
354
|
+
// Externalize before Vite's default resolution runs
|
|
328
355
|
enforce: "pre",
|
|
329
356
|
// Rolldown also has "external" option, which can be provided regexes.
|
|
330
357
|
// Theoretically that would be more efficient due to less communication
|
|
@@ -334,18 +361,62 @@ function externalizeDependencies(options) {
|
|
|
334
361
|
resolveId: {
|
|
335
362
|
filter: {
|
|
336
363
|
id: {
|
|
337
|
-
include:
|
|
364
|
+
include: [
|
|
365
|
+
// In most cases, we want all dependencies in library packages to be
|
|
366
|
+
// externalized. Thus, this regex matches all non-relative imports.
|
|
367
|
+
nonRelativeSpecifierPattern,
|
|
368
|
+
// Also include explicitExternalize because those may target relative
|
|
369
|
+
// paths (e.g. ./draconvert.js in mock-services).
|
|
370
|
+
...explicitExternalize
|
|
371
|
+
],
|
|
338
372
|
exclude: bundleIn
|
|
339
373
|
}
|
|
340
374
|
},
|
|
341
|
-
handler() {
|
|
342
|
-
|
|
375
|
+
handler(id, importer, resolveOptions) {
|
|
376
|
+
if (matchesAny(id, externalize)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
if (
|
|
380
|
+
// Entrypoints look like src/components/button/button.tsx, so are
|
|
381
|
+
// matched by the nonRelativeSpecifierPattern
|
|
382
|
+
resolveOptions.isEntry || // Virtual specifiers are handled by plugins
|
|
383
|
+
id.startsWith("\0") || // data: node: virtual:
|
|
384
|
+
id.includes(":") || // ?raw ?url ?worker - resolved by other plugins
|
|
385
|
+
id.includes("?") || // Applications can bundle in anything
|
|
386
|
+
options.isApplication === true
|
|
387
|
+
) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const error = `[${pluginName}] Vite tried to bundle in "${id}" (imported by ${importer}).
|
|
391
|
+
This is likely undesirable. To externalize it, declare this dependency as a "dependency", "peerDependency" or "optionalDependency" in package.json.
|
|
392
|
+
If this is intentional, add it to the build.dependencies.bundleIn option in useLumina() or bundleIn option in the vitePresetPlugin().
|
|
393
|
+
If this is an application rather than a library, pass isApplication:true in vitePresetPlugin().`;
|
|
394
|
+
if (isStrictBundling) {
|
|
395
|
+
throw Error(error);
|
|
396
|
+
} else {
|
|
397
|
+
console.error(styleText("red", `${error}
|
|
398
|
+
This will be an error in future version.`));
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
343
401
|
}
|
|
344
402
|
}
|
|
345
403
|
};
|
|
346
404
|
return plugin;
|
|
347
405
|
}
|
|
348
|
-
const
|
|
406
|
+
const pluginName = "@arcgis/components-build-utils:externalize-dependencies";
|
|
407
|
+
const stringToStartsWithGlob = (option) => typeof option === "string" ? new RegExp(
|
|
408
|
+
`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}${option.endsWith("/") ? "(?:.+)?" : "(?:/.+)?"}$`,
|
|
409
|
+
"u"
|
|
410
|
+
) : option;
|
|
411
|
+
const nonRelativeSpecifierPattern = /^[^\.\/]/u;
|
|
412
|
+
function matchesAny(id, patterns) {
|
|
413
|
+
for (let index = 0; index < patterns.length; ++index) {
|
|
414
|
+
if (patterns[index].test(id)) {
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
349
420
|
export {
|
|
350
421
|
asyncFindPath,
|
|
351
422
|
asyncRetrievePackageJson,
|
|
@@ -364,6 +435,7 @@ export {
|
|
|
364
435
|
path,
|
|
365
436
|
retrievePackageJson,
|
|
366
437
|
sh,
|
|
438
|
+
sp,
|
|
367
439
|
toPosixPathSeparators,
|
|
368
440
|
toSystemPathSeparators,
|
|
369
441
|
vitePresetPlugin
|
package/dist/packageJson.d.cts
CHANGED
|
@@ -12,12 +12,9 @@ export type PackageJson = {
|
|
|
12
12
|
"main"?: string;
|
|
13
13
|
"module"?: string;
|
|
14
14
|
"types"?: string;
|
|
15
|
-
"publishConfig"?: {
|
|
16
|
-
access?: string;
|
|
17
|
-
registry?: string;
|
|
18
|
-
provenance?: boolean;
|
|
19
|
-
};
|
|
20
15
|
"files"?: string[];
|
|
16
|
+
"bin"?: Record<string, string> | string;
|
|
17
|
+
"man"?: string[] | string;
|
|
21
18
|
"dependencies"?: Record<string, string>;
|
|
22
19
|
"devDependencies"?: Record<string, string>;
|
|
23
20
|
"peerDependencies"?: Record<string, string>;
|
|
@@ -32,10 +29,6 @@ export type PackageJson = {
|
|
|
32
29
|
"exports"?: Record<string, Record<string, string> | string>;
|
|
33
30
|
"scripts"?: Record<string, string>;
|
|
34
31
|
"packageManager"?: string;
|
|
35
|
-
"webGISComponents"?: {
|
|
36
|
-
deployBuilds?: Record<string, string>;
|
|
37
|
-
artifactsDeployPath?: string;
|
|
38
|
-
};
|
|
39
32
|
};
|
|
40
33
|
export declare function retrievePackageJson(location?: string, cache?: boolean): PackageJson;
|
|
41
34
|
export declare function asyncRetrievePackageJson(location?: string): Promise<PackageJson>;
|
package/dist/packageJson.d.ts
CHANGED
|
@@ -12,12 +12,9 @@ export type PackageJson = {
|
|
|
12
12
|
"main"?: string;
|
|
13
13
|
"module"?: string;
|
|
14
14
|
"types"?: string;
|
|
15
|
-
"publishConfig"?: {
|
|
16
|
-
access?: string;
|
|
17
|
-
registry?: string;
|
|
18
|
-
provenance?: boolean;
|
|
19
|
-
};
|
|
20
15
|
"files"?: string[];
|
|
16
|
+
"bin"?: Record<string, string> | string;
|
|
17
|
+
"man"?: string[] | string;
|
|
21
18
|
"dependencies"?: Record<string, string>;
|
|
22
19
|
"devDependencies"?: Record<string, string>;
|
|
23
20
|
"peerDependencies"?: Record<string, string>;
|
|
@@ -32,10 +29,6 @@ export type PackageJson = {
|
|
|
32
29
|
"exports"?: Record<string, Record<string, string> | string>;
|
|
33
30
|
"scripts"?: Record<string, string>;
|
|
34
31
|
"packageManager"?: string;
|
|
35
|
-
"webGISComponents"?: {
|
|
36
|
-
deployBuilds?: Record<string, string>;
|
|
37
|
-
artifactsDeployPath?: string;
|
|
38
|
-
};
|
|
39
32
|
};
|
|
40
33
|
export declare function retrievePackageJson(location?: string, cache?: boolean): PackageJson;
|
|
41
34
|
export declare function asyncRetrievePackageJson(location?: string): Promise<PackageJson>;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { default as dts } from 'vite-plugin-dts';
|
|
3
|
+
import { PackageJson } from './packageJson.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Vite preset for all our support packages:
|
|
5
6
|
* - externalizes all non-dev-dependencies
|
|
6
7
|
* - generates type declarations (using `vite-plugin-dts`)
|
|
7
8
|
*/
|
|
8
|
-
export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, }?: DependencyManagementOptions & {
|
|
9
|
+
export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, isApplication, }?: DependencyManagementOptions & {
|
|
9
10
|
/** Additional options for `vite-plugin-dts` */
|
|
10
|
-
dtsOptions?: Parameters<typeof dts>[0];
|
|
11
|
-
}): [Plugin, Plugin, Promise<Plugin>];
|
|
11
|
+
dtsOptions?: Parameters<typeof dts>[0] | false;
|
|
12
|
+
}): [Plugin, Plugin, Promise<Plugin> | undefined];
|
|
12
13
|
/**
|
|
13
14
|
* Options for externalizing dependencies.
|
|
14
15
|
*/
|
|
@@ -40,6 +41,14 @@ export type DependencyManagementOptions = {
|
|
|
40
41
|
* technical reasons.
|
|
41
42
|
*/
|
|
42
43
|
readonly externalize?: (RegExp | string)[];
|
|
44
|
+
/**
|
|
45
|
+
* By default, this plugin errors if any devDependency is used in runtime code
|
|
46
|
+
* to avoid bundling in dependencies in a library. In application packages,
|
|
47
|
+
* bundling in everything is desirable, so enable this option.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
readonly isApplication?: boolean;
|
|
43
52
|
};
|
|
44
53
|
/**
|
|
45
54
|
* By default, Rollup will bundle-in all dependencies.
|
|
@@ -69,15 +78,24 @@ export type DependencyManagementOptions = {
|
|
|
69
78
|
* be externalized (because all peerDependencies are externalized).
|
|
70
79
|
*/
|
|
71
80
|
export declare function externalizeDependencies(options: DependencyManagementOptions): Plugin;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
interface PluginShape extends Plugin {
|
|
82
|
+
resolveId: {
|
|
83
|
+
filter: {
|
|
84
|
+
id: {
|
|
85
|
+
include: RegExp[];
|
|
86
|
+
exclude: RegExp[] | undefined;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
handler: (id: string, importer: string | undefined, options: {
|
|
90
|
+
isEntry: boolean;
|
|
91
|
+
}) => false | undefined;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
declare function externalizeDependenciesImplementation(options: DependencyManagementOptions, packageJson: PackageJson): PluginShape;
|
|
95
|
+
declare function matchesAny(id: string, patterns: readonly RegExp[]): boolean;
|
|
81
96
|
export declare const exportsForTests: {
|
|
82
97
|
stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
98
|
+
externalizeDependenciesImplementation: typeof externalizeDependenciesImplementation;
|
|
99
|
+
matchesAny: typeof matchesAny;
|
|
83
100
|
};
|
|
101
|
+
export {};
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { default as dts } from 'vite-plugin-dts';
|
|
3
|
+
import { PackageJson } from './packageJson.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Vite preset for all our support packages:
|
|
5
6
|
* - externalizes all non-dev-dependencies
|
|
6
7
|
* - generates type declarations (using `vite-plugin-dts`)
|
|
7
8
|
*/
|
|
8
|
-
export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, }?: DependencyManagementOptions & {
|
|
9
|
+
export declare function vitePresetPlugin({ dtsOptions, externalize, bundleIn, isApplication, }?: DependencyManagementOptions & {
|
|
9
10
|
/** Additional options for `vite-plugin-dts` */
|
|
10
|
-
dtsOptions?: Parameters<typeof dts>[0];
|
|
11
|
-
}): [Plugin, Plugin, Promise<Plugin>];
|
|
11
|
+
dtsOptions?: Parameters<typeof dts>[0] | false;
|
|
12
|
+
}): [Plugin, Plugin, Promise<Plugin> | undefined];
|
|
12
13
|
/**
|
|
13
14
|
* Options for externalizing dependencies.
|
|
14
15
|
*/
|
|
@@ -40,6 +41,14 @@ export type DependencyManagementOptions = {
|
|
|
40
41
|
* technical reasons.
|
|
41
42
|
*/
|
|
42
43
|
readonly externalize?: (RegExp | string)[];
|
|
44
|
+
/**
|
|
45
|
+
* By default, this plugin errors if any devDependency is used in runtime code
|
|
46
|
+
* to avoid bundling in dependencies in a library. In application packages,
|
|
47
|
+
* bundling in everything is desirable, so enable this option.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
readonly isApplication?: boolean;
|
|
43
52
|
};
|
|
44
53
|
/**
|
|
45
54
|
* By default, Rollup will bundle-in all dependencies.
|
|
@@ -69,15 +78,24 @@ export type DependencyManagementOptions = {
|
|
|
69
78
|
* be externalized (because all peerDependencies are externalized).
|
|
70
79
|
*/
|
|
71
80
|
export declare function externalizeDependencies(options: DependencyManagementOptions): Plugin;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
interface PluginShape extends Plugin {
|
|
82
|
+
resolveId: {
|
|
83
|
+
filter: {
|
|
84
|
+
id: {
|
|
85
|
+
include: RegExp[];
|
|
86
|
+
exclude: RegExp[] | undefined;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
handler: (id: string, importer: string | undefined, options: {
|
|
90
|
+
isEntry: boolean;
|
|
91
|
+
}) => false | undefined;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
declare function externalizeDependenciesImplementation(options: DependencyManagementOptions, packageJson: PackageJson): PluginShape;
|
|
95
|
+
declare function matchesAny(id: string, patterns: readonly RegExp[]): boolean;
|
|
81
96
|
export declare const exportsForTests: {
|
|
82
97
|
stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
98
|
+
externalizeDependenciesImplementation: typeof externalizeDependenciesImplementation;
|
|
99
|
+
matchesAny: typeof matchesAny;
|
|
83
100
|
};
|
|
101
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/components-build-utils",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.131",
|
|
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",
|
|
7
|
-
"main": "dist/index.cjs",
|
|
8
|
-
"module": "dist/index.js",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
|
-
}
|
|
16
|
-
"./ts": "./src/index.ts"
|
|
15
|
+
}
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
19
18
|
"dist/"
|
|
20
19
|
],
|
|
21
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
22
21
|
"dependencies": {
|
|
22
|
+
"@types/node": "^24.10.0",
|
|
23
23
|
"tslib": "^2.8.1",
|
|
24
|
-
"vite": "^7.
|
|
24
|
+
"vite": "^7.3.2",
|
|
25
25
|
"vite-plugin-dts": "^4.5.4"
|
|
26
26
|
}
|
|
27
27
|
}
|