@arcgis/components-build-utils 5.1.0-next.89 → 5.1.0-next.90

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/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,15 @@ function sh(command, options = {}) {
43
43
  throw error;
44
44
  }
45
45
  }
46
+ function sp(command, args, options = {}) {
47
+ try {
48
+ const normalizedOptions = { encoding: "utf8", ...options };
49
+ const result = node_child_process.spawnSync(command, args, normalizedOptions);
50
+ return `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
51
+ } catch (error) {
52
+ throw error;
53
+ }
54
+ }
46
55
  async function asyncSh(command, options = {}) {
47
56
  const normalizedOptions = { encoding: "utf8", ...options };
48
57
  return await new Promise((resolve2, reject) => {
@@ -387,6 +396,7 @@ exports.normalizePath = normalizePath;
387
396
  exports.path = path;
388
397
  exports.retrievePackageJson = retrievePackageJson;
389
398
  exports.sh = sh;
399
+ exports.sp = sp;
390
400
  exports.toPosixPathSeparators = toPosixPathSeparators;
391
401
  exports.toSystemPathSeparators = toSystemPathSeparators;
392
402
  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,15 @@ function sh(command, options = {}) {
19
19
  throw error;
20
20
  }
21
21
  }
22
+ function sp(command, args, options = {}) {
23
+ try {
24
+ const normalizedOptions = { encoding: "utf8", ...options };
25
+ const result = spawnSync(command, args, normalizedOptions);
26
+ return `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
27
+ } catch (error) {
28
+ throw error;
29
+ }
30
+ }
22
31
  async function asyncSh(command, options = {}) {
23
32
  const normalizedOptions = { encoding: "utf8", ...options };
24
33
  return await new Promise((resolve2, reject) => {
@@ -364,6 +373,7 @@ export {
364
373
  path,
365
374
  retrievePackageJson,
366
375
  sh,
376
+ sp,
367
377
  toPosixPathSeparators,
368
378
  toSystemPathSeparators,
369
379
  vitePresetPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "5.1.0-next.89",
3
+ "version": "5.1.0-next.90",
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",