@arcgis/components-build-utils 4.34.0-next.99 → 5.0.0-next.1
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/LICENSE.md +1 -1
- package/README.md +2 -14
- package/dist/commands/affected-packages.d.cts +2 -0
- package/dist/commands/affected-packages.d.ts +2 -0
- package/dist/commands/assign-zehub-release.d.cts +2 -0
- package/dist/commands/assign-zehub-release.d.ts +2 -0
- package/dist/commands/compare-rss.d.cts +8 -0
- package/dist/commands/compare-rss.d.ts +8 -0
- package/dist/commands/generate-builddate.d.cts +1 -1
- package/dist/commands/generate-builddate.d.ts +1 -1
- package/dist/commands/migrate-repo-issues/zentopia.d.cts +10 -1
- package/dist/commands/migrate-repo-issues/zentopia.d.ts +10 -1
- package/dist/commands/npm-utils.d.cts +29 -0
- package/dist/commands/npm-utils.d.ts +29 -0
- package/dist/commands/utils.d.cts +32 -1
- package/dist/commands/utils.d.ts +32 -1
- package/dist/glob.d.cts +23 -0
- package/dist/glob.d.ts +23 -0
- package/dist/index.cjs +37 -36
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +28 -27
- package/dist/packageJson.d.cts +1 -0
- package/dist/packageJson.d.ts +1 -0
- package/dist/path.d.cts +8 -0
- package/dist/path.d.ts +8 -0
- package/dist/vite.d.cts +3 -0
- package/dist/vite.d.ts +3 -0
- package/package.json +4 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -8,18 +8,6 @@ It is not intended to be used directly, but rather used as a dependency by other
|
|
|
8
8
|
|
|
9
9
|
## License
|
|
10
10
|
|
|
11
|
-
COPYRIGHT ©
|
|
11
|
+
COPYRIGHT © Esri
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
This material is licensed for use under the [Esri Master License Agreement (MLA)](https://www.esri.com/content/dam/esrisites/en-us/media/legal/ma-full/ma-full.pdf), and is bound by the terms of that agreement.
|
|
16
|
-
You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
|
|
17
|
-
|
|
18
|
-
For additional information, contact:
|
|
19
|
-
Environmental Systems Research Institute, Inc.
|
|
20
|
-
Attn: Contracts and Legal Services Department
|
|
21
|
-
380 New York Street
|
|
22
|
-
Redlands, California, USA 92373
|
|
23
|
-
USA
|
|
24
|
-
|
|
25
|
-
email: legal@esri.com
|
|
13
|
+
This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package.
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* !important
|
|
4
|
+
* The class makes a TLS request to qawebgis
|
|
5
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by qawebgis.esri.com
|
|
6
|
+
*
|
|
7
|
+
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
8
|
+
* Reference: https://qawebgis.esri.com/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
9
|
+
*/
|
|
2
10
|
export declare const registerCommand: (command: Command) => undefined;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* !important
|
|
4
|
+
* The class makes a TLS request to qawebgis
|
|
5
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by qawebgis.esri.com
|
|
6
|
+
*
|
|
7
|
+
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
8
|
+
* Reference: https://qawebgis.esri.com/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
9
|
+
*/
|
|
2
10
|
export declare const registerCommand: (command: Command) => undefined;
|
|
@@ -24,14 +24,23 @@ export type IssueWithZenhub = {
|
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* !important
|
|
29
|
+
* The class makes a TLS request to Zenhub's GraphQL endpoint, 'https://zentopia.esri.com/public/graphql'
|
|
30
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
|
|
31
|
+
*
|
|
32
|
+
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
33
|
+
* Reference: https://qawebgis.esri.com/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
34
|
+
*/
|
|
27
35
|
declare class Zentopia {
|
|
28
36
|
readonly repoId: number;
|
|
29
37
|
readonly workspaceId: string;
|
|
38
|
+
readonly token?: string | undefined;
|
|
30
39
|
private _issueIdCache;
|
|
31
40
|
private _pipelinesCache?;
|
|
32
41
|
private _sprintsCache?;
|
|
33
42
|
private _releasesCache?;
|
|
34
|
-
constructor(repoId: number, workspaceId: string);
|
|
43
|
+
constructor(repoId: number, workspaceId: string, token?: string | undefined);
|
|
35
44
|
/**
|
|
36
45
|
* Requests to graphql server
|
|
37
46
|
*/
|
|
@@ -24,14 +24,23 @@ export type IssueWithZenhub = {
|
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* !important
|
|
29
|
+
* The class makes a TLS request to Zenhub's GraphQL endpoint, 'https://zentopia.esri.com/public/graphql'
|
|
30
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
|
|
31
|
+
*
|
|
32
|
+
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
33
|
+
* Reference: https://qawebgis.esri.com/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
34
|
+
*/
|
|
27
35
|
declare class Zentopia {
|
|
28
36
|
readonly repoId: number;
|
|
29
37
|
readonly workspaceId: string;
|
|
38
|
+
readonly token?: string | undefined;
|
|
30
39
|
private _issueIdCache;
|
|
31
40
|
private _pipelinesCache?;
|
|
32
41
|
private _sprintsCache?;
|
|
33
42
|
private _releasesCache?;
|
|
34
|
-
constructor(repoId: number, workspaceId: string);
|
|
43
|
+
constructor(repoId: number, workspaceId: string, token?: string | undefined);
|
|
35
44
|
/**
|
|
36
45
|
* Requests to graphql server
|
|
37
46
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const npmRegistry = "https://registry.npmjs.org/";
|
|
2
|
+
/**
|
|
3
|
+
* Fetch all published versions for a package.
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetchVersions(pkgName: string, options: {
|
|
6
|
+
verbose: boolean;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
versions: string[];
|
|
9
|
+
error?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Check if a given version for a package is already deprecated.
|
|
13
|
+
* npm view is not able to provide the deprecated version information directly.
|
|
14
|
+
* We have to first fetch all the versions and then one by one check if they are deprecated.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isVersionDeprecated(pkgName: string, version: string, options: {
|
|
17
|
+
verbose: boolean;
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Request npm deprecation for the `package@range` specification
|
|
21
|
+
*/
|
|
22
|
+
export declare function deprecate(pkgSpec: string, options: {
|
|
23
|
+
authToken?: string;
|
|
24
|
+
message: string;
|
|
25
|
+
verbose: boolean;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
stdout?: string;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const npmRegistry = "https://registry.npmjs.org/";
|
|
2
|
+
/**
|
|
3
|
+
* Fetch all published versions for a package.
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetchVersions(pkgName: string, options: {
|
|
6
|
+
verbose: boolean;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
versions: string[];
|
|
9
|
+
error?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Check if a given version for a package is already deprecated.
|
|
13
|
+
* npm view is not able to provide the deprecated version information directly.
|
|
14
|
+
* We have to first fetch all the versions and then one by one check if they are deprecated.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isVersionDeprecated(pkgName: string, version: string, options: {
|
|
17
|
+
verbose: boolean;
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Request npm deprecation for the `package@range` specification
|
|
21
|
+
*/
|
|
22
|
+
export declare function deprecate(pkgSpec: string, options: {
|
|
23
|
+
authToken?: string;
|
|
24
|
+
message: string;
|
|
25
|
+
verbose: boolean;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
stdout?: string;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
}>;
|
|
@@ -9,7 +9,7 @@ export declare function error(...messages: unknown[]): void;
|
|
|
9
9
|
* Console error the messages and exits the process with code 1.
|
|
10
10
|
* This is used to indicate a fatal error that cannot be recovered from.
|
|
11
11
|
*/
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function errorAndExit(...messages: unknown[]): never;
|
|
13
13
|
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
14
14
|
export declare function findRepositoryRoot(): string;
|
|
15
15
|
export declare function isURL(source: string): boolean;
|
|
@@ -32,4 +32,35 @@ type PackageWalkerResult<T> = {
|
|
|
32
32
|
* If the callback returns null or undefined, that package is not included in the results.
|
|
33
33
|
*/
|
|
34
34
|
export declare function workspacesPackageWalker<T = void>(callback: (item: PackageWalkerItem) => Promise<T | undefined> | T | undefined, includeRootPackage?: boolean): Promise<PackageWalkerResult<T>[]>;
|
|
35
|
+
interface AffectedPackage {
|
|
36
|
+
path: string;
|
|
37
|
+
packageJson: MiniPackageJson;
|
|
38
|
+
files: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Computes the list of workspace packages affected by a given set of changed files.
|
|
42
|
+
*
|
|
43
|
+
* This function must always be run from the repository root so that workspace
|
|
44
|
+
* discovery and relative path matching behave correctly.
|
|
45
|
+
*
|
|
46
|
+
* The function first collects all workspace packages (with their paths and package.json).
|
|
47
|
+
* It then checks which of the changed files fall under each package's path and marks
|
|
48
|
+
* those packages as initially affected.
|
|
49
|
+
*
|
|
50
|
+
* Note: Only internal workspace packages are considered in the dependency graph;
|
|
51
|
+
* external dependencies are ignored.
|
|
52
|
+
*
|
|
53
|
+
* @param changed - Iterable list of file paths that were modified.
|
|
54
|
+
* @param options - Additional options:
|
|
55
|
+
* - dfs: Whether to include transitive dependents by traversing the dependency graph.
|
|
56
|
+
*
|
|
57
|
+
* @returns Promise resolving to an array of affected workspace `Package` objects.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getAffectedPackages(changed: Iterable<string>, options?: {
|
|
60
|
+
dfs?: boolean;
|
|
61
|
+
}): Promise<AffectedPackage[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Helper to check if an error is a SIGINT (interrupt) error.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isSigint(err: unknown): boolean;
|
|
35
66
|
export {};
|
package/dist/commands/utils.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function error(...messages: unknown[]): void;
|
|
|
9
9
|
* Console error the messages and exits the process with code 1.
|
|
10
10
|
* This is used to indicate a fatal error that cannot be recovered from.
|
|
11
11
|
*/
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function errorAndExit(...messages: unknown[]): never;
|
|
13
13
|
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
14
14
|
export declare function findRepositoryRoot(): string;
|
|
15
15
|
export declare function isURL(source: string): boolean;
|
|
@@ -32,4 +32,35 @@ type PackageWalkerResult<T> = {
|
|
|
32
32
|
* If the callback returns null or undefined, that package is not included in the results.
|
|
33
33
|
*/
|
|
34
34
|
export declare function workspacesPackageWalker<T = void>(callback: (item: PackageWalkerItem) => Promise<T | undefined> | T | undefined, includeRootPackage?: boolean): Promise<PackageWalkerResult<T>[]>;
|
|
35
|
+
interface AffectedPackage {
|
|
36
|
+
path: string;
|
|
37
|
+
packageJson: MiniPackageJson;
|
|
38
|
+
files: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Computes the list of workspace packages affected by a given set of changed files.
|
|
42
|
+
*
|
|
43
|
+
* This function must always be run from the repository root so that workspace
|
|
44
|
+
* discovery and relative path matching behave correctly.
|
|
45
|
+
*
|
|
46
|
+
* The function first collects all workspace packages (with their paths and package.json).
|
|
47
|
+
* It then checks which of the changed files fall under each package's path and marks
|
|
48
|
+
* those packages as initially affected.
|
|
49
|
+
*
|
|
50
|
+
* Note: Only internal workspace packages are considered in the dependency graph;
|
|
51
|
+
* external dependencies are ignored.
|
|
52
|
+
*
|
|
53
|
+
* @param changed - Iterable list of file paths that were modified.
|
|
54
|
+
* @param options - Additional options:
|
|
55
|
+
* - dfs: Whether to include transitive dependents by traversing the dependency graph.
|
|
56
|
+
*
|
|
57
|
+
* @returns Promise resolving to an array of affected workspace `Package` objects.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getAffectedPackages(changed: Iterable<string>, options?: {
|
|
60
|
+
dfs?: boolean;
|
|
61
|
+
}): Promise<AffectedPackage[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Helper to check if an error is a SIGINT (interrupt) error.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isSigint(err: unknown): boolean;
|
|
35
66
|
export {};
|
package/dist/glob.d.cts
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `.gitignore` files and convert it to globs that are accepted by ESLint
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // eslint.config.js
|
|
7
|
+
* import { gitIgnoreFileToGlobs } from "@arcgis/components-build-utils";
|
|
8
|
+
* import { globalIgnores } from "eslint/config";
|
|
9
|
+
*
|
|
10
|
+
* export default [
|
|
11
|
+
* globalIgnores([
|
|
12
|
+
* ...gitIgnoreFileToGlobs(import.meta.dirname + "/.gitignore"),
|
|
13
|
+
* ...gitIgnoreFileToGlobs(import.meta.dirname + "/.prettierignore"),
|
|
14
|
+
* ]),
|
|
15
|
+
* // ...
|
|
16
|
+
* ];
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function gitIgnoreFileToGlobs(filePath: string): string[];
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use gitIgnoreFileToGlobs from "@arcgis/components-build-utils"
|
|
22
|
+
* instead
|
|
23
|
+
*/
|
|
1
24
|
export declare const gitIgnoreToGlob: (pattern: string) => string;
|
package/dist/glob.d.ts
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `.gitignore` files and convert it to globs that are accepted by ESLint
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // eslint.config.js
|
|
7
|
+
* import { gitIgnoreFileToGlobs } from "@arcgis/components-build-utils";
|
|
8
|
+
* import { globalIgnores } from "eslint/config";
|
|
9
|
+
*
|
|
10
|
+
* export default [
|
|
11
|
+
* globalIgnores([
|
|
12
|
+
* ...gitIgnoreFileToGlobs(import.meta.dirname + "/.gitignore"),
|
|
13
|
+
* ...gitIgnoreFileToGlobs(import.meta.dirname + "/.prettierignore"),
|
|
14
|
+
* ]),
|
|
15
|
+
* // ...
|
|
16
|
+
* ];
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function gitIgnoreFileToGlobs(filePath: string): string[];
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use gitIgnoreFileToGlobs from "@arcgis/components-build-utils"
|
|
22
|
+
* instead
|
|
23
|
+
*/
|
|
1
24
|
export declare const gitIgnoreToGlob: (pattern: string) => string;
|
package/dist/index.cjs
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const node_fs = require("node:fs");
|
|
4
4
|
const promises = require("node:fs/promises");
|
|
5
5
|
const node_child_process = require("node:child_process");
|
|
6
|
-
const
|
|
6
|
+
const path$1 = require("path");
|
|
7
7
|
const node_url = require("node:url");
|
|
8
|
-
const posix = require("
|
|
9
|
-
const win32 = require("
|
|
8
|
+
const posix = require("path/posix");
|
|
9
|
+
const win32 = require("path/win32");
|
|
10
10
|
const dts = require("vite-plugin-dts");
|
|
11
11
|
const node_module = require("node:module");
|
|
12
12
|
const existsAsync = async (file) => (
|
|
@@ -16,17 +16,17 @@ const existsAsync = async (file) => (
|
|
|
16
16
|
);
|
|
17
17
|
const sh = (command, cwd) => node_child_process.execSync(command.trim(), { encoding: "utf8", cwd }).trim();
|
|
18
18
|
async function createFileIfNotExists(filePath, content) {
|
|
19
|
-
await promises.mkdir(
|
|
19
|
+
await promises.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
20
20
|
if (!await existsAsync(filePath)) {
|
|
21
21
|
await promises.writeFile(filePath, content, { encoding: "utf8" });
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function findPath(target, startDirectory = process.cwd()) {
|
|
25
|
-
const resolvedStartDirectory = startDirectory.startsWith("file:///") ?
|
|
26
|
-
const parentPath = resolvedStartDirectory.split(
|
|
25
|
+
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
|
|
26
|
+
const parentPath = resolvedStartDirectory.split(path$1.sep);
|
|
27
27
|
while (parentPath.length > 2) {
|
|
28
|
-
const fullPath =
|
|
29
|
-
...
|
|
28
|
+
const fullPath = path$1.join(
|
|
29
|
+
...path$1.sep === "/" ? ["/"] : [],
|
|
30
30
|
...parentPath,
|
|
31
31
|
target
|
|
32
32
|
);
|
|
@@ -38,11 +38,11 @@ function findPath(target, startDirectory = process.cwd()) {
|
|
|
38
38
|
return void 0;
|
|
39
39
|
}
|
|
40
40
|
async function asyncFindPath(target, startDirectory = process.cwd()) {
|
|
41
|
-
const resolvedStartDirectory = startDirectory.startsWith("file:///") ?
|
|
42
|
-
const parentPath = resolvedStartDirectory.split(
|
|
41
|
+
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
|
|
42
|
+
const parentPath = resolvedStartDirectory.split(path$1.sep);
|
|
43
43
|
while (parentPath.length > 2) {
|
|
44
|
-
const fullPath =
|
|
45
|
-
...
|
|
44
|
+
const fullPath = path$1.join(
|
|
45
|
+
...path$1.sep === "/" ? ["/"] : [],
|
|
46
46
|
...parentPath,
|
|
47
47
|
target
|
|
48
48
|
);
|
|
@@ -53,6 +53,9 @@ async function asyncFindPath(target, startDirectory = process.cwd()) {
|
|
|
53
53
|
}
|
|
54
54
|
return void 0;
|
|
55
55
|
}
|
|
56
|
+
function gitIgnoreFileToGlobs(filePath) {
|
|
57
|
+
return node_fs.readFileSync(filePath, "utf8").split("\n").filter((line) => line.trim().length > 0 && !line.trim().startsWith("#")).map(gitIgnoreToGlob);
|
|
58
|
+
}
|
|
56
59
|
const gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
|
|
57
60
|
function fixAbsoluteSyntax(pattern) {
|
|
58
61
|
if (pattern.startsWith("/")) {
|
|
@@ -73,7 +76,7 @@ function fixMatchFilesSyntax(pattern) {
|
|
|
73
76
|
}
|
|
74
77
|
return pattern.endsWith("/*") ? `${pattern}*` : pattern.endsWith("/") ? `${pattern}**` : `${pattern}/**`;
|
|
75
78
|
}
|
|
76
|
-
const isPosix =
|
|
79
|
+
const isPosix = path$1.sep === posix.sep;
|
|
77
80
|
const toPosixPathSeparators = (relativePath) => relativePath.includes(win32.sep) ? relativePath.replaceAll(win32.sep, posix.sep) : relativePath;
|
|
78
81
|
const normalizePath = isPosix ? (path2) => path2 : toPosixPathSeparators;
|
|
79
82
|
const toWin32PathSeparators = (relativePath) => relativePath.includes(posix.sep) ? relativePath.replaceAll(posix.sep, win32.sep) : relativePath;
|
|
@@ -107,7 +110,6 @@ const path = isPosix ? posix : {
|
|
|
107
110
|
return toPosixPathSeparators(result);
|
|
108
111
|
}
|
|
109
112
|
};
|
|
110
|
-
const exportsForTests = { toWin32PathSeparators };
|
|
111
113
|
const cachedPackageJson = {};
|
|
112
114
|
const cachedPackageJsonPromises = {};
|
|
113
115
|
let rootPackageJsonLocation;
|
|
@@ -266,34 +268,34 @@ function externalizeDependencies(options) {
|
|
|
266
268
|
...packageJson.peerDependencies,
|
|
267
269
|
...packageJson.optionalDependencies
|
|
268
270
|
});
|
|
269
|
-
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob)
|
|
271
|
+
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob);
|
|
270
272
|
const externalize = [
|
|
271
273
|
...options.externalize?.map(stringToStartsWithGlob) ?? [],
|
|
272
|
-
|
|
274
|
+
/^node:/u,
|
|
275
|
+
new RegExp(
|
|
276
|
+
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${node_module.builtinModules.join("|")})(?:/.+)?$`,
|
|
277
|
+
"u"
|
|
278
|
+
)
|
|
273
279
|
];
|
|
274
|
-
const isExternalized = (id) => externalize.some((regex) => regex.test(id));
|
|
275
|
-
const isBundledIn = (id) => bundleIn.some((regex) => regex.test(id));
|
|
276
280
|
const plugin = {
|
|
277
281
|
name: "@arcgis/components-build-utils:externalize-dependencies",
|
|
278
282
|
apply: "build",
|
|
279
283
|
enforce: "pre",
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
};
|
|
284
|
+
// Rolldown also has "external" option, which can be provided regexes.
|
|
285
|
+
// Theoretically that would be more efficient due to less communication
|
|
286
|
+
// overhead, but in practice they always evaluate it on the JS side:
|
|
287
|
+
// https://github.com/rolldown/rolldown/blob/4f996e637732a26ca04972975884abad5183292b/packages/rolldown/src/utils/bindingify-input-options.ts#L167
|
|
288
|
+
// https://github.com/rolldown/rolldown/blob/4f996e637732a26ca04972975884abad5183292b/crates/rolldown_binding/src/utils/normalize_binding_options.rs#L130
|
|
289
|
+
resolveId: {
|
|
290
|
+
filter: {
|
|
291
|
+
id: {
|
|
292
|
+
include: externalize,
|
|
293
|
+
exclude: bundleIn
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
handler() {
|
|
297
|
+
return false;
|
|
295
298
|
}
|
|
296
|
-
return isExternalized(specifier) && !isBundledIn(specifier) ? false : null;
|
|
297
299
|
}
|
|
298
300
|
};
|
|
299
301
|
return plugin;
|
|
@@ -304,18 +306,17 @@ exports.asyncRetrievePackageJson = asyncRetrievePackageJson;
|
|
|
304
306
|
exports.createFileIfNotExists = createFileIfNotExists;
|
|
305
307
|
exports.detectPackageManager = detectPackageManager;
|
|
306
308
|
exports.existsAsync = existsAsync;
|
|
307
|
-
exports.exportsForTests = exportsForTests;
|
|
308
309
|
exports.externalizeDependencies = externalizeDependencies;
|
|
309
310
|
exports.fetchPackageLocation = fetchPackageLocation;
|
|
310
311
|
exports.findPath = findPath;
|
|
311
312
|
exports.getCwd = getCwd;
|
|
313
|
+
exports.gitIgnoreFileToGlobs = gitIgnoreFileToGlobs;
|
|
312
314
|
exports.gitIgnoreToGlob = gitIgnoreToGlob;
|
|
313
315
|
exports.isPosix = isPosix;
|
|
314
316
|
exports.normalizePath = normalizePath;
|
|
315
317
|
exports.path = path;
|
|
316
318
|
exports.retrievePackageJson = retrievePackageJson;
|
|
317
319
|
exports.sh = sh;
|
|
318
|
-
exports.stringToStartsWithGlob = stringToStartsWithGlob;
|
|
319
320
|
exports.toPosixPathSeparators = toPosixPathSeparators;
|
|
320
321
|
exports.toSystemPathSeparators = toSystemPathSeparators;
|
|
321
322
|
exports.vitePresetPlugin = vitePresetPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file';
|
|
2
|
+
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob';
|
|
3
|
+
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path';
|
|
4
|
+
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson';
|
|
5
|
+
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file';
|
|
2
|
+
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob';
|
|
3
|
+
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path';
|
|
4
|
+
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson';
|
|
5
|
+
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { access, existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { constants, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
3
3
|
import { execSync } from "node:child_process";
|
|
4
|
-
import { dirname, resolve, sep, join } from "
|
|
4
|
+
import { dirname, resolve, sep, join } from "path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import posix from "
|
|
7
|
-
import win32 from "
|
|
6
|
+
import posix from "path/posix";
|
|
7
|
+
import win32 from "path/win32";
|
|
8
8
|
import dts from "vite-plugin-dts";
|
|
9
|
-
import {
|
|
9
|
+
import { builtinModules } from "node:module";
|
|
10
10
|
const existsAsync = async (file) => (
|
|
11
11
|
// Using un-promisified version because promises version creates exceptions
|
|
12
12
|
// which interferes with debugging when "Pause on caught exceptions" is enabled
|
|
@@ -51,6 +51,9 @@ async function asyncFindPath(target, startDirectory = process.cwd()) {
|
|
|
51
51
|
}
|
|
52
52
|
return void 0;
|
|
53
53
|
}
|
|
54
|
+
function gitIgnoreFileToGlobs(filePath) {
|
|
55
|
+
return readFileSync(filePath, "utf8").split("\n").filter((line) => line.trim().length > 0 && !line.trim().startsWith("#")).map(gitIgnoreToGlob);
|
|
56
|
+
}
|
|
54
57
|
const gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
|
|
55
58
|
function fixAbsoluteSyntax(pattern) {
|
|
56
59
|
if (pattern.startsWith("/")) {
|
|
@@ -105,7 +108,6 @@ const path = isPosix ? posix : {
|
|
|
105
108
|
return toPosixPathSeparators(result);
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
|
-
const exportsForTests = { toWin32PathSeparators };
|
|
109
111
|
const cachedPackageJson = {};
|
|
110
112
|
const cachedPackageJsonPromises = {};
|
|
111
113
|
let rootPackageJsonLocation;
|
|
@@ -264,34 +266,34 @@ function externalizeDependencies(options) {
|
|
|
264
266
|
...packageJson.peerDependencies,
|
|
265
267
|
...packageJson.optionalDependencies
|
|
266
268
|
});
|
|
267
|
-
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob)
|
|
269
|
+
const bundleIn = options.bundleIn?.map(stringToStartsWithGlob);
|
|
268
270
|
const externalize = [
|
|
269
271
|
...options.externalize?.map(stringToStartsWithGlob) ?? [],
|
|
270
|
-
|
|
272
|
+
/^node:/u,
|
|
273
|
+
new RegExp(
|
|
274
|
+
`^(?:${externalDependencies.join("|")}${externalDependencies.length === 0 ? "" : "|"}${builtinModules.join("|")})(?:/.+)?$`,
|
|
275
|
+
"u"
|
|
276
|
+
)
|
|
271
277
|
];
|
|
272
|
-
const isExternalized = (id) => externalize.some((regex) => regex.test(id));
|
|
273
|
-
const isBundledIn = (id) => bundleIn.some((regex) => regex.test(id));
|
|
274
278
|
const plugin = {
|
|
275
279
|
name: "@arcgis/components-build-utils:externalize-dependencies",
|
|
276
280
|
apply: "build",
|
|
277
281
|
enforce: "pre",
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
};
|
|
282
|
+
// Rolldown also has "external" option, which can be provided regexes.
|
|
283
|
+
// Theoretically that would be more efficient due to less communication
|
|
284
|
+
// overhead, but in practice they always evaluate it on the JS side:
|
|
285
|
+
// https://github.com/rolldown/rolldown/blob/4f996e637732a26ca04972975884abad5183292b/packages/rolldown/src/utils/bindingify-input-options.ts#L167
|
|
286
|
+
// https://github.com/rolldown/rolldown/blob/4f996e637732a26ca04972975884abad5183292b/crates/rolldown_binding/src/utils/normalize_binding_options.rs#L130
|
|
287
|
+
resolveId: {
|
|
288
|
+
filter: {
|
|
289
|
+
id: {
|
|
290
|
+
include: externalize,
|
|
291
|
+
exclude: bundleIn
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
handler() {
|
|
295
|
+
return false;
|
|
293
296
|
}
|
|
294
|
-
return isExternalized(specifier) && !isBundledIn(specifier) ? false : null;
|
|
295
297
|
}
|
|
296
298
|
};
|
|
297
299
|
return plugin;
|
|
@@ -303,18 +305,17 @@ export {
|
|
|
303
305
|
createFileIfNotExists,
|
|
304
306
|
detectPackageManager,
|
|
305
307
|
existsAsync,
|
|
306
|
-
exportsForTests,
|
|
307
308
|
externalizeDependencies,
|
|
308
309
|
fetchPackageLocation,
|
|
309
310
|
findPath,
|
|
310
311
|
getCwd,
|
|
312
|
+
gitIgnoreFileToGlobs,
|
|
311
313
|
gitIgnoreToGlob,
|
|
312
314
|
isPosix,
|
|
313
315
|
normalizePath,
|
|
314
316
|
path,
|
|
315
317
|
retrievePackageJson,
|
|
316
318
|
sh,
|
|
317
|
-
stringToStartsWithGlob,
|
|
318
319
|
toPosixPathSeparators,
|
|
319
320
|
toSystemPathSeparators,
|
|
320
321
|
vitePresetPlugin
|
package/dist/packageJson.d.cts
CHANGED
|
@@ -27,6 +27,7 @@ export type MiniPackageJson = {
|
|
|
27
27
|
"html.customData"?: string[];
|
|
28
28
|
"web-types"?: string;
|
|
29
29
|
"exports"?: Record<string, Record<string, string> | string>;
|
|
30
|
+
"scripts"?: Record<string, string>;
|
|
30
31
|
};
|
|
31
32
|
export declare function retrievePackageJson(location?: string): MiniPackageJson;
|
|
32
33
|
export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
|
package/dist/packageJson.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export type MiniPackageJson = {
|
|
|
27
27
|
"html.customData"?: string[];
|
|
28
28
|
"web-types"?: string;
|
|
29
29
|
"exports"?: Record<string, Record<string, string> | string>;
|
|
30
|
+
"scripts"?: Record<string, string>;
|
|
30
31
|
};
|
|
31
32
|
export declare function retrievePackageJson(location?: string): MiniPackageJson;
|
|
32
33
|
export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
|
package/dist/path.d.cts
CHANGED
|
@@ -13,7 +13,15 @@ export declare const normalizePath: (relativePath: string) => string;
|
|
|
13
13
|
* inside the compiler we use `/` everywhere).
|
|
14
14
|
*/
|
|
15
15
|
export declare const toSystemPathSeparators: (relativePath: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Like `process.cwd()`, but always returns a POSIX-style path
|
|
18
|
+
* (with `/` as separator).
|
|
19
|
+
*/
|
|
16
20
|
export declare const getCwd: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* A wrapper for Node.js's `path` module that always uses POSIX-style paths
|
|
23
|
+
* (with `/` as separator).
|
|
24
|
+
*/
|
|
17
25
|
export declare const path: typeof posix & {
|
|
18
26
|
sep: "/";
|
|
19
27
|
};
|
package/dist/path.d.ts
CHANGED
|
@@ -13,7 +13,15 @@ export declare const normalizePath: (relativePath: string) => string;
|
|
|
13
13
|
* inside the compiler we use `/` everywhere).
|
|
14
14
|
*/
|
|
15
15
|
export declare const toSystemPathSeparators: (relativePath: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Like `process.cwd()`, but always returns a POSIX-style path
|
|
18
|
+
* (with `/` as separator).
|
|
19
|
+
*/
|
|
16
20
|
export declare const getCwd: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* A wrapper for Node.js's `path` module that always uses POSIX-style paths
|
|
23
|
+
* (with `/` as separator).
|
|
24
|
+
*/
|
|
17
25
|
export declare const path: typeof posix & {
|
|
18
26
|
sep: "/";
|
|
19
27
|
};
|
package/dist/vite.d.cts
CHANGED
|
@@ -78,3 +78,6 @@ export declare function externalizeDependencies(options: DependencyManagementOpt
|
|
|
78
78
|
* "monaco-editor/sub-path", but not "monaco-editor-beta".
|
|
79
79
|
*/
|
|
80
80
|
export declare const stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
81
|
+
export declare const exportsForTests: {
|
|
82
|
+
stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
83
|
+
};
|
package/dist/vite.d.ts
CHANGED
|
@@ -78,3 +78,6 @@ export declare function externalizeDependencies(options: DependencyManagementOpt
|
|
|
78
78
|
* "monaco-editor/sub-path", but not "monaco-editor-beta".
|
|
79
79
|
*/
|
|
80
80
|
export declare const stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
81
|
+
export declare const exportsForTests: {
|
|
82
|
+
stringToStartsWithGlob: (option: RegExp | string) => RegExp;
|
|
83
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/components-build-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-next.1",
|
|
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",
|
|
@@ -25,8 +25,11 @@
|
|
|
25
25
|
"@commander-js/extra-typings": "^14.0.0",
|
|
26
26
|
"chalk": "^5.4.1",
|
|
27
27
|
"commander": "^14.0.0",
|
|
28
|
+
"fast-glob": "^3.3.3",
|
|
28
29
|
"fast-xml-parser": "^5.2.5",
|
|
29
30
|
"glob": "^11.0.3",
|
|
31
|
+
"ora": "^8.2.0",
|
|
32
|
+
"p-limit": "^7.1.1",
|
|
30
33
|
"semver": "^7.7.2",
|
|
31
34
|
"split2": "^4.2.0",
|
|
32
35
|
"tslib": "^2.8.1",
|