@arcgis/components-build-utils 4.33.0-next.12 → 4.33.0-next.121

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.
Files changed (55) hide show
  1. package/dist/commands/copy-folder.d.cts +2 -0
  2. package/dist/commands/copy-folder.d.ts +2 -0
  3. package/dist/commands/create-mock-doc.d.cts +2 -0
  4. package/dist/commands/create-mock-doc.d.ts +2 -0
  5. package/dist/commands/detect-broken-links.d.cts +2 -0
  6. package/dist/commands/detect-broken-links.d.ts +2 -0
  7. package/dist/commands/detect-large-files.d.cts +3 -0
  8. package/dist/commands/detect-large-files.d.ts +3 -0
  9. package/dist/commands/ensure-working-tree-clean.d.cts +5 -0
  10. package/dist/commands/ensure-working-tree-clean.d.ts +5 -0
  11. package/dist/commands/generate-t9n-manifest.d.cts +2 -0
  12. package/dist/commands/generate-t9n-manifest.d.ts +2 -0
  13. package/dist/commands/git-copy/dumpSizes.d.cts +1 -0
  14. package/dist/commands/git-copy/dumpSizes.d.ts +1 -0
  15. package/dist/commands/git-copy/getFileNames.d.cts +4 -0
  16. package/dist/commands/git-copy/getFileNames.d.ts +4 -0
  17. package/dist/commands/git-copy/helpers.d.cts +4 -0
  18. package/dist/commands/git-copy/helpers.d.ts +4 -0
  19. package/dist/commands/git-copy/index.d.cts +15 -0
  20. package/dist/commands/git-copy/index.d.ts +15 -0
  21. package/dist/commands/git-copy/updateReferences.d.cts +4 -0
  22. package/dist/commands/git-copy/updateReferences.d.ts +4 -0
  23. package/dist/commands/git-copy/utils.d.cts +9 -0
  24. package/dist/commands/git-copy/utils.d.ts +9 -0
  25. package/dist/commands/git-copy.d.cts +2 -0
  26. package/dist/commands/git-copy.d.ts +2 -0
  27. package/dist/commands/migrate-repo-issues/devtopia.d.cts +44 -0
  28. package/dist/commands/migrate-repo-issues/devtopia.d.ts +44 -0
  29. package/dist/commands/migrate-repo-issues/zentopia.d.cts +89 -0
  30. package/dist/commands/migrate-repo-issues/zentopia.d.ts +89 -0
  31. package/dist/commands/migrate-repo-issues.d.cts +2 -0
  32. package/dist/commands/migrate-repo-issues.d.ts +2 -0
  33. package/dist/commands/run-lint-test.d.cts +3 -0
  34. package/dist/commands/run-lint-test.d.ts +3 -0
  35. package/dist/commands/run.d.cts +1 -0
  36. package/dist/commands/run.d.ts +1 -0
  37. package/dist/commands/scan-dist.d.cts +2 -0
  38. package/dist/commands/scan-dist.d.ts +2 -0
  39. package/dist/commands/utils.d.cts +1 -0
  40. package/dist/commands/utils.d.ts +1 -0
  41. package/dist/file.d.cts +14 -0
  42. package/dist/file.d.ts +14 -0
  43. package/dist/glob.d.cts +1 -0
  44. package/dist/glob.d.ts +1 -0
  45. package/dist/index.cjs +164 -107
  46. package/dist/index.d.cts +5 -71
  47. package/dist/index.d.ts +5 -71
  48. package/dist/index.js +124 -36
  49. package/dist/packageJson.d.cts +39 -0
  50. package/dist/packageJson.d.ts +39 -0
  51. package/dist/path.d.cts +22 -0
  52. package/dist/path.d.ts +22 -0
  53. package/dist/vite.d.cts +24 -0
  54. package/dist/vite.d.ts +24 -0
  55. package/package.json +5 -2
package/dist/index.cjs CHANGED
@@ -5,10 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
8
  var __copyProps = (to, from, except, desc) => {
13
9
  if (from && typeof from === "object" || typeof from === "function") {
14
10
  for (let key of __getOwnPropNames(from))
@@ -25,55 +21,37 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
22
  mod
27
23
  ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- asyncFindPath: () => asyncFindPath,
34
- asyncRetrievePackageJson: () => asyncRetrievePackageJson,
35
- createFileIfNotExists: () => createFileIfNotExists,
36
- detectPackageManager: () => detectPackageManager,
37
- existsAsync: () => existsAsync,
38
- exportsForTests: () => exportsForTests,
39
- fetchPackageLocation: () => fetchPackageLocation,
40
- findPath: () => findPath,
41
- getCwd: () => getCwd,
42
- gitIgnoreToGlob: () => gitIgnoreToGlob,
43
- isPosix: () => isPosix,
44
- normalizePath: () => normalizePath,
45
- path: () => path,
46
- retrievePackageJson: () => retrievePackageJson,
47
- sh: () => sh,
48
- toPosixPathSeparators: () => toPosixPathSeparators,
49
- toSystemPathSeparators: () => toSystemPathSeparators
50
- });
51
- module.exports = __toCommonJS(src_exports);
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();
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ const node_fs = require("node:fs");
26
+ const promises = require("node:fs/promises");
27
+ const node_child_process = require("node:child_process");
28
+ const node_path = require("node:path");
29
+ const node_url = require("node:url");
30
+ const posix = require("node:path/posix");
31
+ const win32 = require("node:path/win32");
32
+ const dts = require("vite-plugin-dts");
33
+ const existsAsync = async (file) => (
34
+ // Using un-promisified version because promises version creates exceptions
35
+ // which interferes with debugging when "Pause on caught exceptions" is enabled
36
+ await new Promise((resolve2) => node_fs.access(file, promises.constants.F_OK, (error) => resolve2(!error)))
37
+ );
38
+ const sh = (command, cwd) => node_child_process.execSync(command.trim(), { encoding: "utf8", cwd }).trim();
61
39
  async function createFileIfNotExists(filePath, content) {
62
- await (0, import_promises.mkdir)((0, import_path.dirname)(filePath), { recursive: true });
40
+ await promises.mkdir(node_path.dirname(filePath), { recursive: true });
63
41
  if (!await existsAsync(filePath)) {
64
- await (0, import_promises.writeFile)(filePath, content, { encoding: "utf8" });
42
+ await promises.writeFile(filePath, content, { encoding: "utf8" });
65
43
  }
66
44
  }
67
45
  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);
46
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? node_path.dirname(node_url.fileURLToPath(startDirectory)) : node_path.resolve(startDirectory);
47
+ const parentPath = resolvedStartDirectory.split(node_path.sep);
70
48
  while (parentPath.length > 2) {
71
- const fullPath = (0, import_path.join)(
72
- ...import_path.sep === "/" ? ["/"] : [],
49
+ const fullPath = node_path.join(
50
+ ...node_path.sep === "/" ? ["/"] : [],
73
51
  ...parentPath,
74
52
  target
75
53
  );
76
- if ((0, import_node_fs.existsSync)(fullPath)) {
54
+ if (node_fs.existsSync(fullPath)) {
77
55
  return fullPath;
78
56
  }
79
57
  parentPath.pop();
@@ -81,11 +59,11 @@ function findPath(target, startDirectory = process.cwd()) {
81
59
  return void 0;
82
60
  }
83
61
  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);
62
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? node_path.dirname(node_url.fileURLToPath(startDirectory)) : node_path.resolve(startDirectory);
63
+ const parentPath = resolvedStartDirectory.split(node_path.sep);
86
64
  while (parentPath.length > 2) {
87
- const fullPath = (0, import_path.join)(
88
- ...import_path.sep === "/" ? ["/"] : [],
65
+ const fullPath = node_path.join(
66
+ ...node_path.sep === "/" ? ["/"] : [],
89
67
  ...parentPath,
90
68
  target
91
69
  );
@@ -96,9 +74,7 @@ async function asyncFindPath(target, startDirectory = process.cwd()) {
96
74
  }
97
75
  return void 0;
98
76
  }
99
-
100
- // src/glob.ts
101
- var gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
77
+ const gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
102
78
  function fixAbsoluteSyntax(pattern) {
103
79
  if (pattern.startsWith("/")) {
104
80
  return pattern.slice(1);
@@ -118,56 +94,47 @@ function fixMatchFilesSyntax(pattern) {
118
94
  }
119
95
  return pattern.endsWith("/*") ? `${pattern}*` : pattern.endsWith("/") ? `${pattern}**` : `${pattern}/**`;
120
96
  }
121
-
122
- // src/path.ts
123
- var import_path2 = require("path");
124
- var import_posix = __toESM(require("path/posix"), 1);
125
- var import_win32 = __toESM(require("path/win32"), 1);
126
- var isPosix = import_path2.sep === import_posix.default.sep;
127
- var toPosixPathSeparators = (relativePath) => relativePath.includes(import_win32.default.sep) ? relativePath.replaceAll(import_win32.default.sep, import_posix.default.sep) : relativePath;
128
- var normalizePath = isPosix ? (path2) => path2 : toPosixPathSeparators;
129
- var toWin32PathSeparators = (relativePath) => relativePath.includes(import_posix.default.sep) ? relativePath.replaceAll(import_posix.default.sep, import_win32.default.sep) : relativePath;
130
- var toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
131
- var getCwd = isPosix ? process.cwd : () => toPosixPathSeparators(process.cwd());
132
- var path = isPosix ? import_posix.default : {
133
- ...import_win32.default,
134
- sep: import_posix.default.sep,
97
+ const isPosix = node_path.sep === posix.sep;
98
+ const toPosixPathSeparators = (relativePath) => relativePath.includes(win32.sep) ? relativePath.replaceAll(win32.sep, posix.sep) : relativePath;
99
+ const normalizePath = isPosix ? (path2) => path2 : toPosixPathSeparators;
100
+ const toWin32PathSeparators = (relativePath) => relativePath.includes(posix.sep) ? relativePath.replaceAll(posix.sep, win32.sep) : relativePath;
101
+ const toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
102
+ const getCwd = isPosix ? process.cwd : () => toPosixPathSeparators(process.cwd());
103
+ const path = isPosix ? posix : {
104
+ ...win32,
105
+ sep: posix.sep,
135
106
  join(...paths) {
136
- const result = import_win32.default.join(...paths);
107
+ const result = win32.join(...paths);
137
108
  return toPosixPathSeparators(result);
138
109
  },
139
110
  normalize(path2) {
140
- const result = import_win32.default.normalize(path2);
111
+ const result = win32.normalize(path2);
141
112
  return toPosixPathSeparators(result);
142
113
  },
143
114
  relative(from, to) {
144
- const result = import_win32.default.relative(from, to);
115
+ const result = win32.relative(from, to);
145
116
  return toPosixPathSeparators(result);
146
117
  },
147
118
  dirname(path2) {
148
- const result = import_win32.default.dirname(path2);
119
+ const result = win32.dirname(path2);
149
120
  return toPosixPathSeparators(result);
150
121
  },
151
122
  resolve(...paths) {
152
- const result = import_win32.default.resolve(...paths);
123
+ const result = win32.resolve(...paths);
153
124
  return toPosixPathSeparators(result);
154
125
  },
155
126
  toNamespacedPath(path2) {
156
- const result = import_win32.default.toNamespacedPath(path2);
127
+ const result = win32.toNamespacedPath(path2);
157
128
  return toPosixPathSeparators(result);
158
129
  }
159
130
  };
160
- var exportsForTests = { toWin32PathSeparators };
161
-
162
- // src/packageJson.ts
163
- var import_promises2 = require("fs/promises");
164
- var import_node_fs2 = require("fs");
165
- var cachedPackageJson = {};
166
- var cachedPackageJsonPromises = {};
167
- var rootPackageJsonLocation;
131
+ const exportsForTests = { toWin32PathSeparators };
132
+ const cachedPackageJson = {};
133
+ const cachedPackageJsonPromises = {};
134
+ let rootPackageJsonLocation;
168
135
  function retrievePackageJson(location) {
169
136
  const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
170
- cachedPackageJson[packageJsonPath] ??= JSON.parse((0, import_node_fs2.readFileSync)(packageJsonPath, "utf-8"));
137
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
171
138
  return cachedPackageJson[packageJsonPath];
172
139
  }
173
140
  async function asyncRetrievePackageJson(location = getCwd()) {
@@ -180,9 +147,9 @@ async function asyncRetrievePackageJson(location = getCwd()) {
180
147
  cachedPackageJson[packageJsonPath] ??= result;
181
148
  return result;
182
149
  }
183
- var asyncReadPackageJson = async (location) => JSON.parse(await (0, import_promises2.readFile)(location, "utf-8"));
184
- var cachedPackageLocation = {};
185
- var cachedPackageLocationPromises = {};
150
+ const asyncReadPackageJson = async (location) => JSON.parse(await promises.readFile(location, "utf-8"));
151
+ const cachedPackageLocation = {};
152
+ const cachedPackageLocationPromises = {};
186
153
  async function fetchPackageLocation(packageName, cwd) {
187
154
  if (packageName in cachedPackageLocation) {
188
155
  return cachedPackageLocation[packageName];
@@ -192,8 +159,8 @@ async function fetchPackageLocation(packageName, cwd) {
192
159
  cwd
193
160
  ).then((packageJsonLocation) => {
194
161
  if (packageJsonLocation === void 0) {
195
- throw new Error(
196
- `@arcgis/lumina-compiler: Unable to resolve package.json location for "${packageName}" package. Current working directory: ${process.cwd()}`
162
+ throw Error(
163
+ `@arcgis/components-build-utils: Unable to resolve package.json location for "${packageName}" package. Current working directory: ${process.cwd()}`
197
164
  );
198
165
  }
199
166
  return path.dirname(packageJsonLocation);
@@ -209,10 +176,10 @@ function detectPackageManager(cwd = process.cwd()) {
209
176
  while (pathParts.length > 1) {
210
177
  const packageJson = path.join(pathParts.join(path.sep), "package.json");
211
178
  pathParts.pop();
212
- if (!(0, import_node_fs2.existsSync)(packageJson)) {
179
+ if (!node_fs.existsSync(packageJson)) {
213
180
  continue;
214
181
  }
215
- const contents = JSON.parse((0, import_node_fs2.readFileSync)(packageJson, "utf8"));
182
+ const contents = JSON.parse(node_fs.readFileSync(packageJson, "utf8"));
216
183
  if (typeof contents !== "object" || Array.isArray(contents)) {
217
184
  continue;
218
185
  }
@@ -224,23 +191,113 @@ function detectPackageManager(cwd = process.cwd()) {
224
191
  packageManager ??= "npm";
225
192
  return packageManager;
226
193
  }
227
- // Annotate the CommonJS export names for ESM import in node:
228
- 0 && (module.exports = {
229
- asyncFindPath,
230
- asyncRetrievePackageJson,
231
- createFileIfNotExists,
232
- detectPackageManager,
233
- existsAsync,
234
- exportsForTests,
235
- fetchPackageLocation,
236
- findPath,
237
- getCwd,
238
- gitIgnoreToGlob,
239
- isPosix,
240
- normalizePath,
241
- path,
242
- retrievePackageJson,
243
- sh,
244
- toPosixPathSeparators,
245
- toSystemPathSeparators
246
- });
194
+ function vitePresetPlugin({
195
+ externalize = [],
196
+ dtsOptions = {}
197
+ } = {
198
+ externalize: [],
199
+ dtsOptions: {}
200
+ }) {
201
+ const rootDir = path.resolve("src");
202
+ const outputDir = path.resolve("dist");
203
+ let userConfig = void 0;
204
+ let command = void 0;
205
+ return [
206
+ {
207
+ name: "vite-preset-config",
208
+ config({ build: { target } = {} }, env) {
209
+ command = env.command;
210
+ return {
211
+ build: {
212
+ // REFACTOR: get this from tsconfig
213
+ // It's a best practice to let the final bundler down-level as needed.
214
+ target: target ?? "es2022"
215
+ },
216
+ define: env.mode === "test" ? {
217
+ "process.env.ESRI_INTERNAL": true
218
+ } : void 0
219
+ };
220
+ },
221
+ configResolved(config) {
222
+ userConfig = config;
223
+ }
224
+ },
225
+ /**
226
+ * We use a dynamic import here because of how Rollup processes and transforms imports.
227
+ * This dependency (rollup-plugin-node-externals) will not be bundled into the output,
228
+ * as specified in vite.config.ts.
229
+ *
230
+ * rollup-plugin-node-externals is an ES module, and Stencil throws an error when it encounters
231
+ * a require() statement for an ES module.
232
+ *
233
+ * If we used a static import, Rollup's cjs build would transform it into a require() statement,
234
+ * causing Stencil to throw an error. Using a dynamic import prevents this issue.
235
+ */
236
+ import("rollup-plugin-node-externals").then(
237
+ ({ nodeExternals }) => nodeExternals({
238
+ include: externalize.map(stringToStartsWithGlob)
239
+ })
240
+ ),
241
+ dts({
242
+ logLevel: "warn",
243
+ /**
244
+ * Do not emit any .d.ts files for files outside the dist directory
245
+ * (i.e vite.config.ts, storybook stories and etc)
246
+ * This also applies for references to node_modules/.../components.d.ts files in
247
+ * tsconfig.json - these must be included in TypeScript program to provide
248
+ * types, but should not be re-emitted during build.
249
+ */
250
+ beforeWriteFile: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
251
+ // Copies .d.ts files to d.cjs file for CommonJS.
252
+ // Adds a performance hit as it occurs after the build
253
+ async afterBuild(emitted) {
254
+ if (userConfig?.build?.lib && userConfig.build.lib.formats?.includes("cjs")) {
255
+ await Promise.all(
256
+ emitted.entries().map(async ([filePath, content]) => {
257
+ if (filePath.endsWith(".d.ts")) {
258
+ await promises.writeFile(filePath.replace(".d.ts", ".d.cts"), content);
259
+ }
260
+ })
261
+ );
262
+ }
263
+ },
264
+ ...dtsOptions,
265
+ compilerOptions: {
266
+ rootDir,
267
+ ...dtsOptions.compilerOptions
268
+ },
269
+ afterDiagnostic(diagnostics) {
270
+ const hasErrors = diagnostics.length > 0;
271
+ const isBuilding = command === "build";
272
+ const stopBuild = hasErrors && isBuilding;
273
+ if (stopBuild) {
274
+ throw new Error("TypeScript errors reported. See error messages above");
275
+ }
276
+ return dtsOptions?.afterDiagnostic?.(diagnostics);
277
+ }
278
+ })
279
+ ];
280
+ }
281
+ function shouldSkip(id) {
282
+ return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
283
+ }
284
+ const stringToStartsWithGlob = (option) => option ? typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}`, "u") : option : void 0;
285
+ exports.asyncFindPath = asyncFindPath;
286
+ exports.asyncRetrievePackageJson = asyncRetrievePackageJson;
287
+ exports.createFileIfNotExists = createFileIfNotExists;
288
+ exports.detectPackageManager = detectPackageManager;
289
+ exports.existsAsync = existsAsync;
290
+ exports.exportsForTests = exportsForTests;
291
+ exports.fetchPackageLocation = fetchPackageLocation;
292
+ exports.findPath = findPath;
293
+ exports.getCwd = getCwd;
294
+ exports.gitIgnoreToGlob = gitIgnoreToGlob;
295
+ exports.isPosix = isPosix;
296
+ exports.normalizePath = normalizePath;
297
+ exports.path = path;
298
+ exports.retrievePackageJson = retrievePackageJson;
299
+ exports.sh = sh;
300
+ exports.stringToStartsWithGlob = stringToStartsWithGlob;
301
+ exports.toPosixPathSeparators = toPosixPathSeparators;
302
+ exports.toSystemPathSeparators = toSystemPathSeparators;
303
+ exports.vitePresetPlugin = vitePresetPlugin;
package/dist/index.d.cts CHANGED
@@ -1,71 +1,5 @@
1
- import posix from 'path/posix';
2
-
3
- declare const existsAsync: (file: string) => Promise<boolean>;
4
- /** Wrapper for execSync to execute shell commands */
5
- declare const sh: (command: string, cwd?: string) => string;
6
- declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
7
- /**
8
- * Climb the directory tree upward, until found a directory that contains the
9
- * target file, and return resulting full path
10
- */
11
- declare function findPath(target: string, startDirectory?: string): string | undefined;
12
- /**
13
- * Climb the directory tree upward, until found a directory that contains the
14
- * target file, and return resulting full path
15
- */
16
- declare function asyncFindPath(target: string, startDirectory?: string): Promise<string | undefined>;
17
-
18
- declare const gitIgnoreToGlob: (pattern: string) => string;
19
-
20
- /**
21
- * This is called "isPosix" rather than "isNotWindows" because even if we are
22
- * on Windows, we could be running in a POSIX environment (e.g. WSL2)
23
- */
24
- declare const isPosix: boolean;
25
- declare const toPosixPathSeparators: (relativePath: string) => string;
26
- declare const normalizePath: (relativePath: string) => string;
27
- /**
28
- * On Windows, replace all `/` in the path back with `\\`. Do this only if you
29
- * wish to output the path in the console or error message.
30
- * On POSIX system (macOS, Linux, ...), this does not change the path (because
31
- * inside the compiler we use `/` everywhere).
32
- */
33
- declare const toSystemPathSeparators: (relativePath: string) => string;
34
- declare const getCwd: () => string;
35
- declare const path: typeof posix & {
36
- sep: "/";
37
- };
38
- declare const exportsForTests: {
39
- toWin32PathSeparators: (relativePath: string) => string;
40
- };
41
-
42
- /**
43
- * A subset of the package.json typing that is interesting to Lumina.
44
- *
45
- * The full package.json type is insanely large (20k lines):
46
- * https://github.com/ffflorian/schemastore-updater/blob/main/schemas/package/index.d.ts#L20067
47
- */
48
- type MiniPackageJson = {
49
- "name": string;
50
- "version": string;
51
- "dependencies"?: Record<string, string | undefined>;
52
- "devDependencies"?: Record<string, string | undefined>;
53
- "peerDependencies"?: Record<string, string | undefined>;
54
- "css.customData"?: string[];
55
- "customElements"?: string;
56
- "html.customData"?: string[];
57
- "web-types"?: string;
58
- };
59
- declare function retrievePackageJson(location?: string): MiniPackageJson;
60
- declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
61
- /**
62
- * Returns an absolute path to the root of a package in node_modules, without
63
- * trailing slash.
64
- */
65
- declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
66
- /**
67
- * Detect if current repository/monorepo uses npm, yarn or pnpm
68
- */
69
- declare function detectPackageManager(cwd?: string): string;
70
-
71
- export { type MiniPackageJson, asyncFindPath, asyncRetrievePackageJson, createFileIfNotExists, detectPackageManager, existsAsync, exportsForTests, fetchPackageLocation, findPath, getCwd, gitIgnoreToGlob, isPosix, normalizePath, path, retrievePackageJson, sh, toPosixPathSeparators, toSystemPathSeparators };
1
+ export * from './file';
2
+ export * from './glob';
3
+ export * from './path';
4
+ export * from './packageJson';
5
+ export * from './vite';
package/dist/index.d.ts CHANGED
@@ -1,71 +1,5 @@
1
- import posix from 'path/posix';
2
-
3
- declare const existsAsync: (file: string) => Promise<boolean>;
4
- /** Wrapper for execSync to execute shell commands */
5
- declare const sh: (command: string, cwd?: string) => string;
6
- declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
7
- /**
8
- * Climb the directory tree upward, until found a directory that contains the
9
- * target file, and return resulting full path
10
- */
11
- declare function findPath(target: string, startDirectory?: string): string | undefined;
12
- /**
13
- * Climb the directory tree upward, until found a directory that contains the
14
- * target file, and return resulting full path
15
- */
16
- declare function asyncFindPath(target: string, startDirectory?: string): Promise<string | undefined>;
17
-
18
- declare const gitIgnoreToGlob: (pattern: string) => string;
19
-
20
- /**
21
- * This is called "isPosix" rather than "isNotWindows" because even if we are
22
- * on Windows, we could be running in a POSIX environment (e.g. WSL2)
23
- */
24
- declare const isPosix: boolean;
25
- declare const toPosixPathSeparators: (relativePath: string) => string;
26
- declare const normalizePath: (relativePath: string) => string;
27
- /**
28
- * On Windows, replace all `/` in the path back with `\\`. Do this only if you
29
- * wish to output the path in the console or error message.
30
- * On POSIX system (macOS, Linux, ...), this does not change the path (because
31
- * inside the compiler we use `/` everywhere).
32
- */
33
- declare const toSystemPathSeparators: (relativePath: string) => string;
34
- declare const getCwd: () => string;
35
- declare const path: typeof posix & {
36
- sep: "/";
37
- };
38
- declare const exportsForTests: {
39
- toWin32PathSeparators: (relativePath: string) => string;
40
- };
41
-
42
- /**
43
- * A subset of the package.json typing that is interesting to Lumina.
44
- *
45
- * The full package.json type is insanely large (20k lines):
46
- * https://github.com/ffflorian/schemastore-updater/blob/main/schemas/package/index.d.ts#L20067
47
- */
48
- type MiniPackageJson = {
49
- "name": string;
50
- "version": string;
51
- "dependencies"?: Record<string, string | undefined>;
52
- "devDependencies"?: Record<string, string | undefined>;
53
- "peerDependencies"?: Record<string, string | undefined>;
54
- "css.customData"?: string[];
55
- "customElements"?: string;
56
- "html.customData"?: string[];
57
- "web-types"?: string;
58
- };
59
- declare function retrievePackageJson(location?: string): MiniPackageJson;
60
- declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
61
- /**
62
- * Returns an absolute path to the root of a package in node_modules, without
63
- * trailing slash.
64
- */
65
- declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
66
- /**
67
- * Detect if current repository/monorepo uses npm, yarn or pnpm
68
- */
69
- declare function detectPackageManager(cwd?: string): string;
70
-
71
- export { type MiniPackageJson, asyncFindPath, asyncRetrievePackageJson, createFileIfNotExists, detectPackageManager, existsAsync, exportsForTests, fetchPackageLocation, findPath, getCwd, gitIgnoreToGlob, isPosix, normalizePath, path, retrievePackageJson, sh, toPosixPathSeparators, toSystemPathSeparators };
1
+ export * from './file';
2
+ export * from './glob';
3
+ export * from './path';
4
+ export * from './packageJson';
5
+ export * from './vite';