@arcgis/components-build-utils 4.32.0-next.46 → 4.32.0-next.48

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/index.cjs CHANGED
@@ -48,60 +48,12 @@ __export(src_exports, {
48
48
  });
49
49
  module.exports = __toCommonJS(src_exports);
50
50
  var import_node_fs3 = require("fs");
51
- var import_node_path = require("path");
52
-
53
- // src/file.ts
54
- var import_node_fs = require("fs");
55
- var import_promises = require("fs/promises");
56
- var import_node_child_process = require("child_process");
57
- var import_path = require("path");
58
- var import_node_url = require("url");
59
- var existsAsync = async (file) => await (0, import_promises.access)(file, import_promises.constants.F_OK).then(() => true).catch(() => false);
60
- var sh = (command, cwd) => (0, import_node_child_process.execSync)(command.trim(), { encoding: "utf8", cwd }).trim();
61
- async function createFileIfNotExists(filePath, content) {
62
- await (0, import_promises.mkdir)((0, import_path.dirname)(filePath), { recursive: true });
63
- if (!await existsAsync(filePath)) {
64
- await (0, import_promises.writeFile)(filePath, content, { encoding: "utf8" });
65
- }
66
- }
67
- function findPath(target, startDirectory = process.cwd()) {
68
- const resolvedStartDirectory = startDirectory.startsWith("file:///") ? (0, import_path.dirname)((0, import_node_url.fileURLToPath)(startDirectory)) : (0, import_path.resolve)(startDirectory);
69
- const parentPath = resolvedStartDirectory.split(import_path.sep);
70
- while (parentPath.length > 2) {
71
- const fullPath = (0, import_path.join)(
72
- ...import_path.sep === "/" ? ["/"] : [],
73
- ...parentPath,
74
- target
75
- );
76
- if ((0, import_node_fs.existsSync)(fullPath)) {
77
- return fullPath;
78
- }
79
- parentPath.pop();
80
- }
81
- return void 0;
82
- }
83
- async function asyncFindPath(target, startDirectory = process.cwd()) {
84
- const resolvedStartDirectory = startDirectory.startsWith("file:///") ? (0, import_path.dirname)((0, import_node_url.fileURLToPath)(startDirectory)) : (0, import_path.resolve)(startDirectory);
85
- const parentPath = resolvedStartDirectory.split(import_path.sep);
86
- while (parentPath.length > 2) {
87
- const fullPath = (0, import_path.join)(
88
- ...import_path.sep === "/" ? ["/"] : [],
89
- ...parentPath,
90
- target
91
- );
92
- if (await existsAsync(fullPath)) {
93
- return fullPath;
94
- }
95
- parentPath.pop();
96
- }
97
- return void 0;
98
- }
99
51
 
100
52
  // src/path.ts
101
- var import_path2 = require("path");
53
+ var import_path = require("path");
102
54
  var import_posix = __toESM(require("path/posix"), 1);
103
55
  var import_win32 = __toESM(require("path/win32"), 1);
104
- var isPosix = import_path2.sep === import_posix.default.sep;
56
+ var isPosix = import_path.sep === import_posix.default.sep;
105
57
  var toPosixPathSeparators = (relativePath) => relativePath.includes(import_win32.default.sep) ? relativePath.replaceAll(import_win32.default.sep, import_posix.default.sep) : relativePath;
106
58
  var toWin32PathSeparators = (relativePath) => relativePath.includes(import_posix.default.sep) ? relativePath.replaceAll(import_posix.default.sep, import_win32.default.sep) : relativePath;
107
59
  var toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
@@ -136,6 +88,53 @@ var path = isPosix ? import_posix.default : {
136
88
  };
137
89
  var exportsForTests = { toWin32PathSeparators };
138
90
 
91
+ // src/file.ts
92
+ var import_node_fs = require("fs");
93
+ var import_promises = require("fs/promises");
94
+ var import_node_child_process = require("child_process");
95
+ var import_path2 = require("path");
96
+ var import_node_url = require("url");
97
+ var existsAsync = async (file) => await (0, import_promises.access)(file, import_promises.constants.F_OK).then(() => true).catch(() => false);
98
+ var sh = (command, cwd) => (0, import_node_child_process.execSync)(command.trim(), { encoding: "utf8", cwd }).trim();
99
+ async function createFileIfNotExists(filePath, content) {
100
+ await (0, import_promises.mkdir)((0, import_path2.dirname)(filePath), { recursive: true });
101
+ if (!await existsAsync(filePath)) {
102
+ await (0, import_promises.writeFile)(filePath, content, { encoding: "utf8" });
103
+ }
104
+ }
105
+ function findPath(target, startDirectory = process.cwd()) {
106
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? (0, import_path2.dirname)((0, import_node_url.fileURLToPath)(startDirectory)) : (0, import_path2.resolve)(startDirectory);
107
+ const parentPath = resolvedStartDirectory.split(import_path2.sep);
108
+ while (parentPath.length > 2) {
109
+ const fullPath = (0, import_path2.join)(
110
+ ...import_path2.sep === "/" ? ["/"] : [],
111
+ ...parentPath,
112
+ target
113
+ );
114
+ if ((0, import_node_fs.existsSync)(fullPath)) {
115
+ return fullPath;
116
+ }
117
+ parentPath.pop();
118
+ }
119
+ return void 0;
120
+ }
121
+ async function asyncFindPath(target, startDirectory = process.cwd()) {
122
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? (0, import_path2.dirname)((0, import_node_url.fileURLToPath)(startDirectory)) : (0, import_path2.resolve)(startDirectory);
123
+ const parentPath = resolvedStartDirectory.split(import_path2.sep);
124
+ while (parentPath.length > 2) {
125
+ const fullPath = (0, import_path2.join)(
126
+ ...import_path2.sep === "/" ? ["/"] : [],
127
+ ...parentPath,
128
+ target
129
+ );
130
+ if (await existsAsync(fullPath)) {
131
+ return fullPath;
132
+ }
133
+ parentPath.pop();
134
+ }
135
+ return void 0;
136
+ }
137
+
139
138
  // src/packageJson.ts
140
139
  var import_node_fs2 = require("fs");
141
140
  var import_promises2 = require("fs/promises");
@@ -184,9 +183,9 @@ async function fetchPackageLocation(packageName, cwd) {
184
183
  function detectPackageManager(cwd = process.cwd()) {
185
184
  let packageManager = void 0;
186
185
  {
187
- const pathParts = cwd.split(import_node_path.sep);
186
+ const pathParts = path.resolve(cwd).split(path.sep);
188
187
  while (pathParts.length > 1) {
189
- const packageJson = (0, import_node_path.join)(pathParts.join(import_node_path.sep), "package.json");
188
+ const packageJson = path.join(pathParts.join(path.sep), "package.json");
190
189
  pathParts.pop();
191
190
  if (!(0, import_node_fs3.existsSync)(packageJson)) {
192
191
  continue;
package/dist/index.js CHANGED
@@ -1,12 +1,50 @@
1
1
  // src/index.ts
2
2
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
3
- import { join as join2, sep as sep3 } from "node:path";
3
+
4
+ // src/path.ts
5
+ import { sep } from "path";
6
+ import posix from "path/posix";
7
+ import win32 from "path/win32";
8
+ var isPosix = sep === posix.sep;
9
+ var toPosixPathSeparators = (relativePath) => relativePath.includes(win32.sep) ? relativePath.replaceAll(win32.sep, posix.sep) : relativePath;
10
+ var toWin32PathSeparators = (relativePath) => relativePath.includes(posix.sep) ? relativePath.replaceAll(posix.sep, win32.sep) : relativePath;
11
+ var toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
12
+ var getCwd = isPosix ? process.cwd : () => toPosixPathSeparators(process.cwd());
13
+ var path = isPosix ? posix : {
14
+ ...win32,
15
+ sep: posix.sep,
16
+ join(...paths) {
17
+ const result = win32.join(...paths);
18
+ return toPosixPathSeparators(result);
19
+ },
20
+ normalize(path2) {
21
+ const result = win32.normalize(path2);
22
+ return toPosixPathSeparators(result);
23
+ },
24
+ relative(from, to) {
25
+ const result = win32.relative(from, to);
26
+ return toPosixPathSeparators(result);
27
+ },
28
+ dirname(path2) {
29
+ const result = win32.dirname(path2);
30
+ return toPosixPathSeparators(result);
31
+ },
32
+ resolve(...paths) {
33
+ const result = win32.resolve(...paths);
34
+ return toPosixPathSeparators(result);
35
+ },
36
+ toNamespacedPath(path2) {
37
+ const result = win32.toNamespacedPath(path2);
38
+ return toPosixPathSeparators(result);
39
+ }
40
+ };
41
+ var exportsForTests = { toWin32PathSeparators };
4
42
 
5
43
  // src/file.ts
6
44
  import { existsSync } from "node:fs";
7
45
  import { access, constants, mkdir, writeFile } from "node:fs/promises";
8
46
  import { execSync } from "node:child_process";
9
- import { dirname, join, resolve, sep } from "path";
47
+ import { dirname, join, resolve, sep as sep2 } from "path";
10
48
  import { fileURLToPath } from "node:url";
11
49
  var existsAsync = async (file) => await access(file, constants.F_OK).then(() => true).catch(() => false);
12
50
  var sh = (command, cwd) => execSync(command.trim(), { encoding: "utf8", cwd }).trim();
@@ -18,10 +56,10 @@ async function createFileIfNotExists(filePath, content) {
18
56
  }
19
57
  function findPath(target, startDirectory = process.cwd()) {
20
58
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
21
- const parentPath = resolvedStartDirectory.split(sep);
59
+ const parentPath = resolvedStartDirectory.split(sep2);
22
60
  while (parentPath.length > 2) {
23
61
  const fullPath = join(
24
- ...sep === "/" ? ["/"] : [],
62
+ ...sep2 === "/" ? ["/"] : [],
25
63
  ...parentPath,
26
64
  target
27
65
  );
@@ -34,10 +72,10 @@ function findPath(target, startDirectory = process.cwd()) {
34
72
  }
35
73
  async function asyncFindPath(target, startDirectory = process.cwd()) {
36
74
  const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
37
- const parentPath = resolvedStartDirectory.split(sep);
75
+ const parentPath = resolvedStartDirectory.split(sep2);
38
76
  while (parentPath.length > 2) {
39
77
  const fullPath = join(
40
- ...sep === "/" ? ["/"] : [],
78
+ ...sep2 === "/" ? ["/"] : [],
41
79
  ...parentPath,
42
80
  target
43
81
  );
@@ -49,45 +87,6 @@ async function asyncFindPath(target, startDirectory = process.cwd()) {
49
87
  return void 0;
50
88
  }
51
89
 
52
- // src/path.ts
53
- import { sep as sep2 } from "path";
54
- import posix from "path/posix";
55
- import win32 from "path/win32";
56
- var isPosix = sep2 === posix.sep;
57
- var toPosixPathSeparators = (relativePath) => relativePath.includes(win32.sep) ? relativePath.replaceAll(win32.sep, posix.sep) : relativePath;
58
- var toWin32PathSeparators = (relativePath) => relativePath.includes(posix.sep) ? relativePath.replaceAll(posix.sep, win32.sep) : relativePath;
59
- var toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
60
- var getCwd = isPosix ? process.cwd : () => toPosixPathSeparators(process.cwd());
61
- var path = isPosix ? posix : {
62
- ...win32,
63
- sep: posix.sep,
64
- join(...paths) {
65
- const result = win32.join(...paths);
66
- return toPosixPathSeparators(result);
67
- },
68
- normalize(path2) {
69
- const result = win32.normalize(path2);
70
- return toPosixPathSeparators(result);
71
- },
72
- relative(from, to) {
73
- const result = win32.relative(from, to);
74
- return toPosixPathSeparators(result);
75
- },
76
- dirname(path2) {
77
- const result = win32.dirname(path2);
78
- return toPosixPathSeparators(result);
79
- },
80
- resolve(...paths) {
81
- const result = win32.resolve(...paths);
82
- return toPosixPathSeparators(result);
83
- },
84
- toNamespacedPath(path2) {
85
- const result = win32.toNamespacedPath(path2);
86
- return toPosixPathSeparators(result);
87
- }
88
- };
89
- var exportsForTests = { toWin32PathSeparators };
90
-
91
90
  // src/packageJson.ts
92
91
  import { readFileSync } from "node:fs";
93
92
  import { readFile } from "node:fs/promises";
@@ -136,9 +135,9 @@ async function fetchPackageLocation(packageName, cwd) {
136
135
  function detectPackageManager(cwd = process.cwd()) {
137
136
  let packageManager = void 0;
138
137
  {
139
- const pathParts = cwd.split(sep3);
138
+ const pathParts = path.resolve(cwd).split(path.sep);
140
139
  while (pathParts.length > 1) {
141
- const packageJson = join2(pathParts.join(sep3), "package.json");
140
+ const packageJson = path.join(pathParts.join(path.sep), "package.json");
142
141
  pathParts.pop();
143
142
  if (!existsSync2(packageJson)) {
144
143
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "4.32.0-next.46",
3
+ "version": "4.32.0-next.48",
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",
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
3
  import { join } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
4
 
6
- const scriptPath = join(fileURLToPath(import.meta.url), "..", "run.ts");
5
+ const scriptPath = join(import.meta.dirname, "run.ts");
7
6
  const commandArguments = process.argv.slice(2);
8
7
 
9
8
  const child = spawn("npx", ["tsx", scriptPath, ...commandArguments], {