@arcgis/components-build-utils 5.0.0-next.13 → 5.0.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.
@@ -1,10 +1,10 @@
1
1
  import { Command } from 'commander';
2
2
  /**
3
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
4
+ * The class makes a TLS request to webgis
5
+ * You need to make sure node trusts the certificate authority that signed the certificate used by webgis.esri.com
6
6
  *
7
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
8
+ * Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
9
9
  */
10
10
  export declare const registerCommand: (command: Command) => undefined;
@@ -1,10 +1,10 @@
1
1
  import { Command } from 'commander';
2
2
  /**
3
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
4
+ * The class makes a TLS request to webgis
5
+ * You need to make sure node trusts the certificate authority that signed the certificate used by webgis.esri.com
6
6
  *
7
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
8
+ * Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
9
9
  */
10
10
  export declare const registerCommand: (command: Command) => undefined;
@@ -7,10 +7,10 @@ export interface Issue {
7
7
  };
8
8
  }
9
9
  declare class Devtopia {
10
- readonly owner: string;
11
- readonly name: string;
12
10
  private issuesPerPage;
13
11
  constructor(owner: string, name: string);
12
+ readonly owner: string;
13
+ readonly name: string;
14
14
  /**
15
15
  * Requests to github graphql server
16
16
  */
@@ -7,10 +7,10 @@ export interface Issue {
7
7
  };
8
8
  }
9
9
  declare class Devtopia {
10
- readonly owner: string;
11
- readonly name: string;
12
10
  private issuesPerPage;
13
11
  constructor(owner: string, name: string);
12
+ readonly owner: string;
13
+ readonly name: string;
14
14
  /**
15
15
  * Requests to github graphql server
16
16
  */
@@ -1,4 +1,4 @@
1
- import { Issue } from './devtopia';
1
+ import { Issue } from './devtopia.ts';
2
2
  export type IssueWithZenhub = {
3
3
  gitHubId: string;
4
4
  zenhubId: string;
@@ -30,17 +30,17 @@ export type IssueWithZenhub = {
30
30
  * You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
31
31
  *
32
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
33
+ * Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
34
34
  */
35
35
  declare class Zentopia {
36
- readonly repoId: number;
37
- readonly workspaceId: string;
38
- readonly token?: string | undefined;
39
36
  private _issueIdCache;
40
37
  private _pipelinesCache?;
41
38
  private _sprintsCache?;
42
39
  private _releasesCache?;
43
- constructor(repoId: number, workspaceId: string, token?: string | undefined);
40
+ constructor(repoId: number, workspaceId: string, token?: string);
41
+ readonly repoId: number;
42
+ readonly workspaceId: string;
43
+ readonly token?: string;
44
44
  /**
45
45
  * Requests to graphql server
46
46
  */
@@ -1,4 +1,4 @@
1
- import { Issue } from './devtopia';
1
+ import { Issue } from './devtopia.ts';
2
2
  export type IssueWithZenhub = {
3
3
  gitHubId: string;
4
4
  zenhubId: string;
@@ -30,17 +30,17 @@ export type IssueWithZenhub = {
30
30
  * You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
31
31
  *
32
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
33
+ * Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
34
34
  */
35
35
  declare class Zentopia {
36
- readonly repoId: number;
37
- readonly workspaceId: string;
38
- readonly token?: string | undefined;
39
36
  private _issueIdCache;
40
37
  private _pipelinesCache?;
41
38
  private _sprintsCache?;
42
39
  private _releasesCache?;
43
- constructor(repoId: number, workspaceId: string, token?: string | undefined);
40
+ constructor(repoId: number, workspaceId: string, token?: string);
41
+ readonly repoId: number;
42
+ readonly workspaceId: string;
43
+ readonly token?: string;
44
44
  /**
45
45
  * Requests to graphql server
46
46
  */
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@commander-js/extra-typings';
2
- import { PackageWalkerItem } from './utils';
2
+ import { PackageWalkerItem } from './utils/utils.ts';
3
3
  export declare const registerCommand: (command: Command) => undefined;
4
4
  export declare function scanDist({ blocklistedNames }: {
5
5
  blocklistedNames?: string[];
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@commander-js/extra-typings';
2
- import { PackageWalkerItem } from './utils';
2
+ import { PackageWalkerItem } from './utils/utils.ts';
3
3
  export declare const registerCommand: (command: Command) => undefined;
4
4
  export declare function scanDist({ blocklistedNames }: {
5
5
  blocklistedNames?: string[];
@@ -0,0 +1,8 @@
1
+ export declare const markdownLog: string[];
2
+ export declare function addKeyValueToOutput(key: string, value: string[] | string): void;
3
+ export declare function addMarkdownToOutput(key?: string): void;
4
+ export declare function addHeadingToSummary(text: string, level?: 1 | 2 | 3): void;
5
+ export declare function addLineToSummary(text: string): void;
6
+ export declare function addListToSummary(items: string[], ordered?: boolean): void;
7
+ export declare function addNewlineToSummary(): void;
8
+ export declare function writeSummary(): void;
@@ -0,0 +1,8 @@
1
+ export declare const markdownLog: string[];
2
+ export declare function addKeyValueToOutput(key: string, value: string[] | string): void;
3
+ export declare function addMarkdownToOutput(key?: string): void;
4
+ export declare function addHeadingToSummary(text: string, level?: 1 | 2 | 3): void;
5
+ export declare function addLineToSummary(text: string): void;
6
+ export declare function addListToSummary(items: string[], ordered?: boolean): void;
7
+ export declare function addNewlineToSummary(): void;
8
+ export declare function writeSummary(): void;
@@ -1,4 +1,3 @@
1
- export declare const npmRegistry = "https://registry.npmjs.org/";
2
1
  /**
3
2
  * Fetch all published versions for a package.
4
3
  */
@@ -20,7 +19,13 @@ export declare function isVersionDeprecated(pkgName: string, version: string, op
20
19
  * Request npm deprecation for the `package@range` specification
21
20
  */
22
21
  export declare function deprecate(pkgSpec: string, options: {
23
- authToken?: string;
22
+ message: string;
23
+ verbose: boolean;
24
+ }): Promise<{
25
+ stdout?: string;
26
+ error?: unknown;
27
+ }>;
28
+ export declare function undeprecate(pkgSpec: string, options: {
24
29
  message: string;
25
30
  verbose: boolean;
26
31
  }): Promise<{
@@ -1,4 +1,3 @@
1
- export declare const npmRegistry = "https://registry.npmjs.org/";
2
1
  /**
3
2
  * Fetch all published versions for a package.
4
3
  */
@@ -20,7 +19,13 @@ export declare function isVersionDeprecated(pkgName: string, version: string, op
20
19
  * Request npm deprecation for the `package@range` specification
21
20
  */
22
21
  export declare function deprecate(pkgSpec: string, options: {
23
- authToken?: string;
22
+ message: string;
23
+ verbose: boolean;
24
+ }): Promise<{
25
+ stdout?: string;
26
+ error?: unknown;
27
+ }>;
28
+ export declare function undeprecate(pkgSpec: string, options: {
24
29
  message: string;
25
30
  verbose: boolean;
26
31
  }): Promise<{
@@ -1,5 +1,5 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
- import { MiniPackageJson } from '../packageJson';
2
+ import { MiniPackageJson } from '../../packageJson.ts';
3
3
  /**
4
4
  * Sets the exit code to 1 and prints the error message to stderr.
5
5
  * This is used to indicate an error condition in the script.
@@ -10,7 +10,6 @@ export declare function error(...messages: unknown[]): void;
10
10
  * This is used to indicate a fatal error that cannot be recovered from.
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
14
13
  export declare function findRepositoryRoot(): string;
15
14
  export declare function isURL(source: string): boolean;
16
15
  /**
@@ -63,4 +62,9 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
62
  * Helper to check if an error is a SIGINT (interrupt) error.
64
63
  */
65
64
  export declare function isSigint(err: unknown): boolean;
65
+ export declare function getBranchName(): string;
66
+ export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
67
+ export declare function getModifiedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
+ export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
+ export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
66
70
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
- import { MiniPackageJson } from '../packageJson';
2
+ import { MiniPackageJson } from '../../packageJson.ts';
3
3
  /**
4
4
  * Sets the exit code to 1 and prints the error message to stderr.
5
5
  * This is used to indicate an error condition in the script.
@@ -10,7 +10,6 @@ export declare function error(...messages: unknown[]): void;
10
10
  * This is used to indicate a fatal error that cannot be recovered from.
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
14
13
  export declare function findRepositoryRoot(): string;
15
14
  export declare function isURL(source: string): boolean;
16
15
  /**
@@ -63,4 +62,9 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
62
  * Helper to check if an error is a SIGINT (interrupt) error.
64
63
  */
65
64
  export declare function isSigint(err: unknown): boolean;
65
+ export declare function getBranchName(): string;
66
+ export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
67
+ export declare function getModifiedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
+ export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
+ export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
66
70
  export {};
package/dist/file.d.cts CHANGED
@@ -1,6 +1,8 @@
1
+ import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
1
2
  export declare const existsAsync: (file: string) => Promise<boolean>;
2
3
  /** Wrapper for execSync to execute shell commands */
3
- export declare const sh: (command: string, cwd?: string) => string;
4
+ export declare function shSync(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
4
6
  export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
5
7
  /**
6
8
  * Climb the directory tree upward, until found a directory that contains the
package/dist/file.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
1
2
  export declare const existsAsync: (file: string) => Promise<boolean>;
2
3
  /** Wrapper for execSync to execute shell commands */
3
- export declare const sh: (command: string, cwd?: string) => string;
4
+ export declare function shSync(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
4
6
  export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
5
7
  /**
6
8
  * Climb the directory tree upward, until found a directory that contains the
package/dist/index.cjs CHANGED
@@ -24,16 +24,46 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
25
  const node_fs = require("node:fs");
26
26
  const promises = require("node:fs/promises");
27
- const node_child_process = require("node:child_process");
28
27
  const path$1 = require("path");
29
28
  const node_url = require("node:url");
29
+ const node_child_process = require("node:child_process");
30
+ const node_util = require("node:util");
30
31
  const node_module = require("node:module");
31
32
  const existsAsync = async (file) => (
32
33
  // Using un-promisified version because promises version creates exceptions
33
34
  // which interferes with debugging when "Pause on caught exceptions" is enabled
34
35
  await new Promise((resolve2) => node_fs.access(file, promises.constants.F_OK, (error) => resolve2(!error)))
35
36
  );
36
- const sh = (command, cwd) => node_child_process.execSync(command.trim(), { encoding: "utf8", cwd }).trim();
37
+ function shSync(command, options = {}) {
38
+ try {
39
+ const normalizedOptions = { encoding: "utf8", ...options };
40
+ return node_child_process.execSync(command.trim(), normalizedOptions).trim();
41
+ } catch (error) {
42
+ makeExecErrorReadable(error);
43
+ throw error;
44
+ }
45
+ }
46
+ function makeExecErrorReadable(error) {
47
+ if (error instanceof Error && error.stack && "output" in error && Array.isArray(error.output) && "status" in error) {
48
+ const stackIndex = error.stack.indexOf("\n at ");
49
+ if (stackIndex !== -1) {
50
+ const output = error.output.filter(Boolean).join("\n").trim();
51
+ const newHeader = `${node_util.styleText("red", error.message)} (exit code: ${String(error.status)})
52
+ ${output}`;
53
+ const oldStackFrames = error.stack.substring(stackIndex);
54
+ error.stack = `Error: ${newHeader}${oldStackFrames}`;
55
+ }
56
+ Object.defineProperties(error, {
57
+ output: { enumerable: false },
58
+ stdout: { enumerable: false },
59
+ stderr: { enumerable: false },
60
+ signal: { enumerable: false },
61
+ status: { enumerable: false },
62
+ pid: { enumerable: false },
63
+ stdio: { enumerable: false }
64
+ });
65
+ }
66
+ }
37
67
  async function createFileIfNotExists(filePath, content) {
38
68
  await promises.mkdir(path$1.dirname(filePath), { recursive: true });
39
69
  if (!await existsAsync(filePath)) {
@@ -43,7 +73,7 @@ async function createFileIfNotExists(filePath, content) {
43
73
  function findPath(target, startDirectory = process.cwd()) {
44
74
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
45
75
  const parentPath = resolvedStartDirectory.split(path$1.sep);
46
- while (parentPath.length > 2) {
76
+ while (parentPath.length > searchStopIndex) {
47
77
  const fullPath = path$1.join(
48
78
  ...path$1.sep === "/" ? ["/"] : [],
49
79
  ...parentPath,
@@ -56,10 +86,11 @@ function findPath(target, startDirectory = process.cwd()) {
56
86
  }
57
87
  return void 0;
58
88
  }
89
+ const searchStopIndex = 0;
59
90
  async function asyncFindPath(target, startDirectory = process.cwd()) {
60
91
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
61
92
  const parentPath = resolvedStartDirectory.split(path$1.sep);
62
- while (parentPath.length > 2) {
93
+ while (parentPath.length > searchStopIndex) {
63
94
  const fullPath = path$1.join(
64
95
  ...path$1.sep === "/" ? ["/"] : [],
65
96
  ...parentPath,
@@ -132,13 +163,16 @@ const path = isPosix ? path$1.posix : {
132
163
  const cachedPackageJson = {};
133
164
  const cachedPackageJsonPromises = {};
134
165
  let rootPackageJsonLocation;
135
- function retrievePackageJson(location) {
166
+ function retrievePackageJson(location, cache = true) {
136
167
  const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
137
- cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
138
- return cachedPackageJson[packageJsonPath];
168
+ if (cache) {
169
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
170
+ return cachedPackageJson[packageJsonPath];
171
+ }
172
+ return JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
139
173
  }
140
- async function asyncRetrievePackageJson(location = getCwd()) {
141
- const packageJsonPath = path.resolve(location, "package.json");
174
+ async function asyncRetrievePackageJson(location) {
175
+ const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
142
176
  if (packageJsonPath in cachedPackageJson) {
143
177
  return cachedPackageJson[packageJsonPath];
144
178
  }
@@ -212,7 +246,7 @@ function vitePresetPlugin({
212
246
  build: {
213
247
  // REFACTOR: get this from tsconfig
214
248
  // It's a best practice to let the final bundler down-level as needed.
215
- target: target ?? "es2022"
249
+ target: target ?? "es2024"
216
250
  },
217
251
  define: env.mode === "test" ? {
218
252
  "process.env.ESRI_INTERNAL": true
@@ -340,7 +374,7 @@ exports.isPosix = isPosix;
340
374
  exports.normalizePath = normalizePath;
341
375
  exports.path = path;
342
376
  exports.retrievePackageJson = retrievePackageJson;
343
- exports.sh = sh;
377
+ exports.sh = shSync;
344
378
  exports.toPosixPathSeparators = toPosixPathSeparators;
345
379
  exports.toSystemPathSeparators = toSystemPathSeparators;
346
380
  exports.vitePresetPlugin = vitePresetPlugin;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ export { existsAsync, shSync as sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
2
+ export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
3
+ export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
4
+ export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
5
+ export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite.ts';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ export { existsAsync, shSync as sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
2
+ export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
3
+ export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
4
+ export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
5
+ export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite.ts';
package/dist/index.js CHANGED
@@ -1,15 +1,45 @@
1
1
  import { access, existsSync, readFileSync } from "node:fs";
2
2
  import { constants, mkdir, writeFile, readFile } from "node:fs/promises";
3
- import { execSync } from "node:child_process";
4
3
  import { dirname, resolve, sep, join, posix, win32 } from "path";
5
4
  import { fileURLToPath } from "node:url";
5
+ import { execSync } from "node:child_process";
6
+ import { styleText } from "node:util";
6
7
  import { builtinModules } from "node:module";
7
8
  const existsAsync = async (file) => (
8
9
  // Using un-promisified version because promises version creates exceptions
9
10
  // which interferes with debugging when "Pause on caught exceptions" is enabled
10
11
  await new Promise((resolve2) => access(file, constants.F_OK, (error) => resolve2(!error)))
11
12
  );
12
- const sh = (command, cwd) => execSync(command.trim(), { encoding: "utf8", cwd }).trim();
13
+ function shSync(command, options = {}) {
14
+ try {
15
+ const normalizedOptions = { encoding: "utf8", ...options };
16
+ return execSync(command.trim(), normalizedOptions).trim();
17
+ } catch (error) {
18
+ makeExecErrorReadable(error);
19
+ throw error;
20
+ }
21
+ }
22
+ function makeExecErrorReadable(error) {
23
+ if (error instanceof Error && error.stack && "output" in error && Array.isArray(error.output) && "status" in error) {
24
+ const stackIndex = error.stack.indexOf("\n at ");
25
+ if (stackIndex !== -1) {
26
+ const output = error.output.filter(Boolean).join("\n").trim();
27
+ const newHeader = `${styleText("red", error.message)} (exit code: ${String(error.status)})
28
+ ${output}`;
29
+ const oldStackFrames = error.stack.substring(stackIndex);
30
+ error.stack = `Error: ${newHeader}${oldStackFrames}`;
31
+ }
32
+ Object.defineProperties(error, {
33
+ output: { enumerable: false },
34
+ stdout: { enumerable: false },
35
+ stderr: { enumerable: false },
36
+ signal: { enumerable: false },
37
+ status: { enumerable: false },
38
+ pid: { enumerable: false },
39
+ stdio: { enumerable: false }
40
+ });
41
+ }
42
+ }
13
43
  async function createFileIfNotExists(filePath, content) {
14
44
  await mkdir(dirname(filePath), { recursive: true });
15
45
  if (!await existsAsync(filePath)) {
@@ -19,7 +49,7 @@ async function createFileIfNotExists(filePath, content) {
19
49
  function findPath(target, startDirectory = process.cwd()) {
20
50
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
21
51
  const parentPath = resolvedStartDirectory.split(sep);
22
- while (parentPath.length > 2) {
52
+ while (parentPath.length > searchStopIndex) {
23
53
  const fullPath = join(
24
54
  ...sep === "/" ? ["/"] : [],
25
55
  ...parentPath,
@@ -32,10 +62,11 @@ function findPath(target, startDirectory = process.cwd()) {
32
62
  }
33
63
  return void 0;
34
64
  }
65
+ const searchStopIndex = 0;
35
66
  async function asyncFindPath(target, startDirectory = process.cwd()) {
36
67
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
37
68
  const parentPath = resolvedStartDirectory.split(sep);
38
- while (parentPath.length > 2) {
69
+ while (parentPath.length > searchStopIndex) {
39
70
  const fullPath = join(
40
71
  ...sep === "/" ? ["/"] : [],
41
72
  ...parentPath,
@@ -108,13 +139,16 @@ const path = isPosix ? posix : {
108
139
  const cachedPackageJson = {};
109
140
  const cachedPackageJsonPromises = {};
110
141
  let rootPackageJsonLocation;
111
- function retrievePackageJson(location) {
142
+ function retrievePackageJson(location, cache = true) {
112
143
  const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
113
- cachedPackageJson[packageJsonPath] ??= JSON.parse(readFileSync(packageJsonPath, "utf-8"));
114
- return cachedPackageJson[packageJsonPath];
144
+ if (cache) {
145
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(readFileSync(packageJsonPath, "utf-8"));
146
+ return cachedPackageJson[packageJsonPath];
147
+ }
148
+ return JSON.parse(readFileSync(packageJsonPath, "utf-8"));
115
149
  }
116
- async function asyncRetrievePackageJson(location = getCwd()) {
117
- const packageJsonPath = path.resolve(location, "package.json");
150
+ async function asyncRetrievePackageJson(location) {
151
+ const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
118
152
  if (packageJsonPath in cachedPackageJson) {
119
153
  return cachedPackageJson[packageJsonPath];
120
154
  }
@@ -188,7 +222,7 @@ function vitePresetPlugin({
188
222
  build: {
189
223
  // REFACTOR: get this from tsconfig
190
224
  // It's a best practice to let the final bundler down-level as needed.
191
- target: target ?? "es2022"
225
+ target: target ?? "es2024"
192
226
  },
193
227
  define: env.mode === "test" ? {
194
228
  "process.env.ESRI_INTERNAL": true
@@ -317,7 +351,7 @@ export {
317
351
  normalizePath,
318
352
  path,
319
353
  retrievePackageJson,
320
- sh,
354
+ shSync as sh,
321
355
  toPosixPathSeparators,
322
356
  toSystemPathSeparators,
323
357
  vitePresetPlugin
@@ -0,0 +1 @@
1
+ export * from '../../../../monorepo.config.ts';
@@ -0,0 +1 @@
1
+ export * from '../../../../monorepo.config.ts';
@@ -13,6 +13,7 @@ export type MiniPackageJson = {
13
13
  "publishConfig"?: {
14
14
  access?: string;
15
15
  registry?: string;
16
+ provenance?: boolean;
16
17
  };
17
18
  "files"?: string[];
18
19
  "dependencies"?: Record<string, string | undefined>;
@@ -32,8 +33,9 @@ export type MiniPackageJson = {
32
33
  deployBuilds?: Record<string, unknown>;
33
34
  };
34
35
  };
35
- export declare function retrievePackageJson(location?: string): MiniPackageJson;
36
+ export declare function retrievePackageJson(location?: string, cache?: boolean): MiniPackageJson;
36
37
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
38
+ export declare function asyncWritePackageJson(location: string, content: MiniPackageJson): Promise<string>;
37
39
  /**
38
40
  * Returns an absolute path to the root of a package in node_modules, without
39
41
  * trailing slash.
@@ -13,6 +13,7 @@ export type MiniPackageJson = {
13
13
  "publishConfig"?: {
14
14
  access?: string;
15
15
  registry?: string;
16
+ provenance?: boolean;
16
17
  };
17
18
  "files"?: string[];
18
19
  "dependencies"?: Record<string, string | undefined>;
@@ -32,8 +33,9 @@ export type MiniPackageJson = {
32
33
  deployBuilds?: Record<string, unknown>;
33
34
  };
34
35
  };
35
- export declare function retrievePackageJson(location?: string): MiniPackageJson;
36
+ export declare function retrievePackageJson(location?: string, cache?: boolean): MiniPackageJson;
36
37
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
38
+ export declare function asyncWritePackageJson(location: string, content: MiniPackageJson): Promise<string>;
37
39
  /**
38
40
  * Returns an absolute path to the root of a package in node_modules, without
39
41
  * trailing slash.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "5.0.0-next.13",
3
+ "version": "5.0.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",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
+ "@actions/core": "^1.11.0",
25
26
  "@commander-js/extra-typings": "^14.0.0",
26
27
  "chalk": "^5.4.1",
27
28
  "commander": "^14.0.0",
@@ -33,7 +34,7 @@
33
34
  "semver": "^7.7.2",
34
35
  "split2": "^4.2.0",
35
36
  "tslib": "^2.8.1",
36
- "vite": "^7.0.0",
37
+ "vite": "^7.2.2",
37
38
  "vite-plugin-dts": "^4.5.4"
38
39
  }
39
40
  }