@arcgis/components-build-utils 4.33.0-next.61 → 4.33.0-next.62

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 (51) 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/file.d.cts +14 -0
  38. package/dist/file.d.ts +14 -0
  39. package/dist/glob.d.cts +1 -0
  40. package/dist/glob.d.ts +1 -0
  41. package/dist/index.cjs +158 -105
  42. package/dist/index.d.cts +5 -71
  43. package/dist/index.d.ts +5 -71
  44. package/dist/index.js +118 -34
  45. package/dist/packageJson.d.cts +28 -0
  46. package/dist/packageJson.d.ts +28 -0
  47. package/dist/path.d.cts +22 -0
  48. package/dist/path.d.ts +22 -0
  49. package/dist/vite.d.cts +24 -0
  50. package/dist/vite.d.ts +24 -0
  51. 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,33 @@ 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 index_exports = {};
32
- __export(index_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(index_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) => await promises.access(file, promises.constants.F_OK).then(() => true).catch(() => false);
34
+ const sh = (command, cwd) => node_child_process.execSync(command.trim(), { encoding: "utf8", cwd }).trim();
61
35
  async function createFileIfNotExists(filePath, content) {
62
- await (0, import_promises.mkdir)((0, import_path.dirname)(filePath), { recursive: true });
36
+ await promises.mkdir(node_path.dirname(filePath), { recursive: true });
63
37
  if (!await existsAsync(filePath)) {
64
- await (0, import_promises.writeFile)(filePath, content, { encoding: "utf8" });
38
+ await promises.writeFile(filePath, content, { encoding: "utf8" });
65
39
  }
66
40
  }
67
41
  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);
42
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? node_path.dirname(node_url.fileURLToPath(startDirectory)) : node_path.resolve(startDirectory);
43
+ const parentPath = resolvedStartDirectory.split(node_path.sep);
70
44
  while (parentPath.length > 2) {
71
- const fullPath = (0, import_path.join)(
72
- ...import_path.sep === "/" ? ["/"] : [],
45
+ const fullPath = node_path.join(
46
+ ...node_path.sep === "/" ? ["/"] : [],
73
47
  ...parentPath,
74
48
  target
75
49
  );
76
- if ((0, import_node_fs.existsSync)(fullPath)) {
50
+ if (node_fs.existsSync(fullPath)) {
77
51
  return fullPath;
78
52
  }
79
53
  parentPath.pop();
@@ -81,11 +55,11 @@ function findPath(target, startDirectory = process.cwd()) {
81
55
  return void 0;
82
56
  }
83
57
  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);
58
+ const resolvedStartDirectory = startDirectory.startsWith("file:///") ? node_path.dirname(node_url.fileURLToPath(startDirectory)) : node_path.resolve(startDirectory);
59
+ const parentPath = resolvedStartDirectory.split(node_path.sep);
86
60
  while (parentPath.length > 2) {
87
- const fullPath = (0, import_path.join)(
88
- ...import_path.sep === "/" ? ["/"] : [],
61
+ const fullPath = node_path.join(
62
+ ...node_path.sep === "/" ? ["/"] : [],
89
63
  ...parentPath,
90
64
  target
91
65
  );
@@ -96,9 +70,7 @@ async function asyncFindPath(target, startDirectory = process.cwd()) {
96
70
  }
97
71
  return void 0;
98
72
  }
99
-
100
- // src/glob.ts
101
- var gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
73
+ const gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern));
102
74
  function fixAbsoluteSyntax(pattern) {
103
75
  if (pattern.startsWith("/")) {
104
76
  return pattern.slice(1);
@@ -118,56 +90,47 @@ function fixMatchFilesSyntax(pattern) {
118
90
  }
119
91
  return pattern.endsWith("/*") ? `${pattern}*` : pattern.endsWith("/") ? `${pattern}**` : `${pattern}/**`;
120
92
  }
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,
93
+ const isPosix = node_path.sep === posix.sep;
94
+ const toPosixPathSeparators = (relativePath) => relativePath.includes(win32.sep) ? relativePath.replaceAll(win32.sep, posix.sep) : relativePath;
95
+ const normalizePath = isPosix ? (path2) => path2 : toPosixPathSeparators;
96
+ const toWin32PathSeparators = (relativePath) => relativePath.includes(posix.sep) ? relativePath.replaceAll(posix.sep, win32.sep) : relativePath;
97
+ const toSystemPathSeparators = isPosix ? (path2) => path2 : toWin32PathSeparators;
98
+ const getCwd = isPosix ? process.cwd : () => toPosixPathSeparators(process.cwd());
99
+ const path = isPosix ? posix : {
100
+ ...win32,
101
+ sep: posix.sep,
135
102
  join(...paths) {
136
- const result = import_win32.default.join(...paths);
103
+ const result = win32.join(...paths);
137
104
  return toPosixPathSeparators(result);
138
105
  },
139
106
  normalize(path2) {
140
- const result = import_win32.default.normalize(path2);
107
+ const result = win32.normalize(path2);
141
108
  return toPosixPathSeparators(result);
142
109
  },
143
110
  relative(from, to) {
144
- const result = import_win32.default.relative(from, to);
111
+ const result = win32.relative(from, to);
145
112
  return toPosixPathSeparators(result);
146
113
  },
147
114
  dirname(path2) {
148
- const result = import_win32.default.dirname(path2);
115
+ const result = win32.dirname(path2);
149
116
  return toPosixPathSeparators(result);
150
117
  },
151
118
  resolve(...paths) {
152
- const result = import_win32.default.resolve(...paths);
119
+ const result = win32.resolve(...paths);
153
120
  return toPosixPathSeparators(result);
154
121
  },
155
122
  toNamespacedPath(path2) {
156
- const result = import_win32.default.toNamespacedPath(path2);
123
+ const result = win32.toNamespacedPath(path2);
157
124
  return toPosixPathSeparators(result);
158
125
  }
159
126
  };
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;
127
+ const exportsForTests = { toWin32PathSeparators };
128
+ const cachedPackageJson = {};
129
+ const cachedPackageJsonPromises = {};
130
+ let rootPackageJsonLocation;
168
131
  function retrievePackageJson(location) {
169
132
  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"));
133
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
171
134
  return cachedPackageJson[packageJsonPath];
172
135
  }
173
136
  async function asyncRetrievePackageJson(location = getCwd()) {
@@ -180,9 +143,9 @@ async function asyncRetrievePackageJson(location = getCwd()) {
180
143
  cachedPackageJson[packageJsonPath] ??= result;
181
144
  return result;
182
145
  }
183
- var asyncReadPackageJson = async (location) => JSON.parse(await (0, import_promises2.readFile)(location, "utf-8"));
184
- var cachedPackageLocation = {};
185
- var cachedPackageLocationPromises = {};
146
+ const asyncReadPackageJson = async (location) => JSON.parse(await promises.readFile(location, "utf-8"));
147
+ const cachedPackageLocation = {};
148
+ const cachedPackageLocationPromises = {};
186
149
  async function fetchPackageLocation(packageName, cwd) {
187
150
  if (packageName in cachedPackageLocation) {
188
151
  return cachedPackageLocation[packageName];
@@ -209,10 +172,10 @@ function detectPackageManager(cwd = process.cwd()) {
209
172
  while (pathParts.length > 1) {
210
173
  const packageJson = path.join(pathParts.join(path.sep), "package.json");
211
174
  pathParts.pop();
212
- if (!(0, import_node_fs2.existsSync)(packageJson)) {
175
+ if (!node_fs.existsSync(packageJson)) {
213
176
  continue;
214
177
  }
215
- const contents = JSON.parse((0, import_node_fs2.readFileSync)(packageJson, "utf8"));
178
+ const contents = JSON.parse(node_fs.readFileSync(packageJson, "utf8"));
216
179
  if (typeof contents !== "object" || Array.isArray(contents)) {
217
180
  continue;
218
181
  }
@@ -224,23 +187,113 @@ function detectPackageManager(cwd = process.cwd()) {
224
187
  packageManager ??= "npm";
225
188
  return packageManager;
226
189
  }
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
- });
190
+ function vitePresetPlugin({
191
+ externalize = [],
192
+ dtsOptions = {}
193
+ } = {
194
+ externalize: [],
195
+ dtsOptions: {}
196
+ }) {
197
+ const rootDir = path.resolve("src");
198
+ const outputDir = path.resolve("dist");
199
+ let userConfig = void 0;
200
+ let command = void 0;
201
+ return [
202
+ {
203
+ name: "vite-preset-config",
204
+ config({ build: { target } = {} }, env) {
205
+ command = env.command;
206
+ return {
207
+ build: {
208
+ // REFACTOR: get this from tsconfig
209
+ // It's a best practice to let the final bundler down-level as needed.
210
+ target: target ?? "es2022"
211
+ },
212
+ define: env.mode === "test" ? {
213
+ "process.env.ESRI_INTERNAL": true
214
+ } : void 0
215
+ };
216
+ },
217
+ configResolved(config) {
218
+ userConfig = config;
219
+ }
220
+ },
221
+ /**
222
+ * We use a dynamic import here because of how Rollup processes and transforms imports.
223
+ * This dependency (rollup-plugin-node-externals) will not be bundled into the output,
224
+ * as specified in vite.config.ts.
225
+ *
226
+ * rollup-plugin-node-externals is an ES module, and Stencil throws an error when it encounters
227
+ * a require() statement for an ES module.
228
+ *
229
+ * If we used a static import, Rollup's cjs build would transform it into a require() statement,
230
+ * causing Stencil to throw an error. Using a dynamic import prevents this issue.
231
+ */
232
+ import("rollup-plugin-node-externals").then(
233
+ ({ nodeExternals }) => nodeExternals({
234
+ include: externalize.map(stringToStartsWithGlob)
235
+ })
236
+ ),
237
+ dts({
238
+ logLevel: "warn",
239
+ /**
240
+ * Do not emit any .d.ts files for files outside the dist directory
241
+ * (i.e vite.config.ts, storybook stories and etc)
242
+ * This also applies for references to node_modules/.../components.d.ts files in
243
+ * tsconfig.json - these must be included in TypeScript program to provide
244
+ * types, but should not be re-emitted during build.
245
+ */
246
+ beforeWriteFile: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
247
+ // Copies .d.ts files to d.cjs file for CommonJS.
248
+ // Adds a performance hit as it occurs after the build
249
+ async afterBuild(emitted) {
250
+ if (userConfig?.build?.lib && userConfig.build.lib.formats?.includes("cjs")) {
251
+ await Promise.all(
252
+ emitted.entries().map(async ([filePath, content]) => {
253
+ if (filePath.endsWith(".d.ts")) {
254
+ await promises.writeFile(filePath.replace(".d.ts", ".d.cts"), content);
255
+ }
256
+ })
257
+ );
258
+ }
259
+ },
260
+ ...dtsOptions,
261
+ compilerOptions: {
262
+ rootDir,
263
+ ...dtsOptions.compilerOptions
264
+ },
265
+ afterDiagnostic(diagnostics) {
266
+ const hasErrors = diagnostics.length > 0;
267
+ const isBuilding = command === "build";
268
+ const stopBuild = hasErrors && isBuilding;
269
+ if (stopBuild) {
270
+ throw new Error("TypeScript errors reported. See error messages above");
271
+ }
272
+ return dtsOptions?.afterDiagnostic?.(diagnostics);
273
+ }
274
+ })
275
+ ];
276
+ }
277
+ function shouldSkip(id) {
278
+ return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
279
+ }
280
+ const stringToStartsWithGlob = (option) => option ? typeof option === "string" ? new RegExp(`^${option.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}`, "u") : option : void 0;
281
+ exports.asyncFindPath = asyncFindPath;
282
+ exports.asyncRetrievePackageJson = asyncRetrievePackageJson;
283
+ exports.createFileIfNotExists = createFileIfNotExists;
284
+ exports.detectPackageManager = detectPackageManager;
285
+ exports.existsAsync = existsAsync;
286
+ exports.exportsForTests = exportsForTests;
287
+ exports.fetchPackageLocation = fetchPackageLocation;
288
+ exports.findPath = findPath;
289
+ exports.getCwd = getCwd;
290
+ exports.gitIgnoreToGlob = gitIgnoreToGlob;
291
+ exports.isPosix = isPosix;
292
+ exports.normalizePath = normalizePath;
293
+ exports.path = path;
294
+ exports.retrievePackageJson = retrievePackageJson;
295
+ exports.sh = sh;
296
+ exports.stringToStartsWithGlob = stringToStartsWithGlob;
297
+ exports.toPosixPathSeparators = toPosixPathSeparators;
298
+ exports.toSystemPathSeparators = toSystemPathSeparators;
299
+ 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';