@arcgis/components-build-utils 5.0.0-next.120 → 5.0.0-next.122

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.
@@ -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.ts';
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.ts';
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,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,6 @@ 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;
24
22
  message: string;
25
23
  verbose: boolean;
26
24
  }): Promise<{
@@ -28,7 +26,6 @@ export declare function deprecate(pkgSpec: string, options: {
28
26
  error?: unknown;
29
27
  }>;
30
28
  export declare function undeprecate(pkgSpec: string, options: {
31
- authToken?: string;
32
29
  message: string;
33
30
  verbose: boolean;
34
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,6 @@ 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;
24
22
  message: string;
25
23
  verbose: boolean;
26
24
  }): Promise<{
@@ -28,7 +26,6 @@ export declare function deprecate(pkgSpec: string, options: {
28
26
  error?: unknown;
29
27
  }>;
30
28
  export declare function undeprecate(pkgSpec: string, options: {
31
- authToken?: string;
32
29
  message: string;
33
30
  verbose: boolean;
34
31
  }): Promise<{
@@ -1,5 +1,5 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
- import { MiniPackageJson } from '../packageJson.ts';
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>, quiet?: boolean): string;
14
13
  export declare function findRepositoryRoot(): string;
15
14
  export declare function isURL(source: string): boolean;
16
15
  /**
@@ -1,5 +1,5 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
- import { MiniPackageJson } from '../packageJson.ts';
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>, quiet?: boolean): string;
14
13
  export declare function findRepositoryRoot(): string;
15
14
  export declare function isURL(source: string): boolean;
16
15
  /**
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)) {
@@ -344,7 +374,7 @@ exports.isPosix = isPosix;
344
374
  exports.normalizePath = normalizePath;
345
375
  exports.path = path;
346
376
  exports.retrievePackageJson = retrievePackageJson;
347
- exports.sh = sh;
377
+ exports.sh = shSync;
348
378
  exports.toPosixPathSeparators = toPosixPathSeparators;
349
379
  exports.toSystemPathSeparators = toSystemPathSeparators;
350
380
  exports.vitePresetPlugin = vitePresetPlugin;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
1
+ export { existsAsync, shSync as sh, 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 MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
1
+ export { existsAsync, shSync as sh, 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 MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.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)) {
@@ -321,7 +351,7 @@ export {
321
351
  normalizePath,
322
352
  path,
323
353
  retrievePackageJson,
324
- sh,
354
+ shSync as sh,
325
355
  toPosixPathSeparators,
326
356
  toSystemPathSeparators,
327
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>;
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "5.0.0-next.120",
3
+ "version": "5.0.0-next.122",
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",