@powerlines/nx 0.10.46 → 0.10.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-R6ECHVU4.mjs → chunk-22IQ22WZ.mjs} +665 -229
  3. package/dist/{chunk-PE72KJBW.mjs → chunk-2Z55S53G.mjs} +1 -1
  4. package/dist/{chunk-N4LRSAGW.mjs → chunk-3K4DAFFO.mjs} +1 -1
  5. package/dist/{chunk-EUCVGGMW.js → chunk-AWWEVPW6.js} +2 -2
  6. package/dist/{chunk-FKZWCQXX.js → chunk-CSSCW7NJ.js} +2 -2
  7. package/dist/{chunk-6MIGHWXS.js → chunk-D5NQ7RJL.js} +2 -2
  8. package/dist/{chunk-QFQYFQT4.mjs → chunk-IZGOLA5N.mjs} +1 -1
  9. package/dist/{chunk-BA3VSEVV.js → chunk-J2P7ZMNQ.js} +2 -2
  10. package/dist/{chunk-3BM4F7DF.js → chunk-JLTPLOQU.js} +2 -2
  11. package/dist/{chunk-WDCMFWCL.mjs → chunk-Q3ETCCV3.mjs} +1 -1
  12. package/dist/{chunk-BTBIUGND.mjs → chunk-XRZRSXSO.mjs} +1 -1
  13. package/dist/{chunk-B73RQF3Y.js → chunk-YYQPZELV.js} +663 -227
  14. package/dist/executors.js +14 -14
  15. package/dist/executors.mjs +6 -6
  16. package/dist/index.js +14 -14
  17. package/dist/index.mjs +6 -6
  18. package/dist/src/base/base-executor.js +2 -2
  19. package/dist/src/base/base-executor.mjs +1 -1
  20. package/dist/src/executors/build/executor.js +4 -4
  21. package/dist/src/executors/build/executor.mjs +2 -2
  22. package/dist/src/executors/clean/executor.js +4 -4
  23. package/dist/src/executors/clean/executor.mjs +2 -2
  24. package/dist/src/executors/docs/executor.js +4 -4
  25. package/dist/src/executors/docs/executor.mjs +2 -2
  26. package/dist/src/executors/lint/executor.js +4 -4
  27. package/dist/src/executors/lint/executor.mjs +2 -2
  28. package/dist/src/executors/prepare/executor.js +4 -4
  29. package/dist/src/executors/prepare/executor.mjs +2 -2
  30. package/package.json +8 -8
@@ -10,7 +10,6 @@ var core = require('@babel/core');
10
10
  var console = require('@storm-software/config-tools/logger/console');
11
11
  var types = require('@storm-software/config-tools/types');
12
12
  var toArray = require('@stryke/convert/to-array');
13
- var copyFile = require('@stryke/fs/copy-file');
14
13
  var helpers = require('@stryke/fs/helpers');
15
14
  var install = require('@stryke/fs/install');
16
15
  var listFiles = require('@stryke/fs/list-files');
@@ -21,6 +20,7 @@ var joinPaths = require('@stryke/path/join-paths');
21
20
  var replace = require('@stryke/path/replace');
22
21
  var isFunction = require('@stryke/type-checks/is-function');
23
22
  var isNumber = require('@stryke/type-checks/is-number');
23
+ var isObject = require('@stryke/type-checks/is-object');
24
24
  var isPromise = require('@stryke/type-checks/is-promise');
25
25
  var isSet = require('@stryke/type-checks/is-set');
26
26
  var isSetObject = require('@stryke/type-checks/is-set-object');
@@ -30,8 +30,8 @@ var Handlebars = require('handlebars');
30
30
  var helperPluginUtils = require('@babel/helper-plugin-utils');
31
31
  var t = require('@babel/types');
32
32
  var ts = require('typescript');
33
- var join = require('@stryke/path/join');
34
33
  var tsMorph = require('ts-morph');
34
+ var isString = require('@stryke/type-checks/is-string');
35
35
  var _package = require('@stryke/string-format/package');
36
36
  var superdiff = require('@donedeal0/superdiff');
37
37
  var json = require('@stryke/fs/json');
@@ -39,38 +39,41 @@ var stormJson = require('@stryke/json/storm-json');
39
39
  var filePathFns = require('@stryke/path/file-path-fns');
40
40
  var titleCase = require('@stryke/string-format/title-case');
41
41
  var exists = require('@stryke/fs/exists');
42
- var writeFile$1 = require('@stryke/fs/write-file');
43
- var prettier = require('prettier');
44
42
  var getEnvPaths = require('@stryke/env/get-env-paths');
45
43
  var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
46
44
  var hashFiles = require('@stryke/hash/hash-files');
47
45
  var murmurhash = require('@stryke/hash/murmurhash');
48
46
  var getUnique = require('@stryke/helpers/get-unique');
49
47
  var omit = require('@stryke/helpers/omit');
48
+ var fetch = require('@stryke/http/fetch');
50
49
  var isType = require('@stryke/path/is-type');
50
+ var join = require('@stryke/path/join');
51
51
  var isNull = require('@stryke/type-checks/is-null');
52
- var isString = require('@stryke/type-checks/is-string');
53
52
  var uuid = require('@stryke/unique-id/uuid');
54
53
  var bundleRequire = require('bundle-require');
54
+ var flatCache = require('flat-cache');
55
+ var oxcParser = require('oxc-parser');
56
+ var undici = require('undici');
55
57
  var jiti = require('jiti');
56
58
  var isUndefined = require('@stryke/type-checks/is-undefined');
57
59
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
58
60
  var isFile = require('@stryke/fs/is-file');
59
61
  var $ = require('@stryke/capnp');
60
62
  var buffer = require('@stryke/fs/buffer');
61
- var correctPath = require('@stryke/path/correct-path');
62
63
  var isParentPath = require('@stryke/path/is-parent-path');
63
64
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
64
- var flatCache = require('flat-cache');
65
65
  var buffer$1 = require('buffer');
66
+ var url = require('url');
67
+ var prettier = require('prettier');
66
68
  var colors = require('@storm-software/config-tools/utilities/colors');
67
69
  var noop = require('@stryke/helpers/noop');
70
+ var correctPath = require('@stryke/path/correct-path');
68
71
  var slash = require('@stryke/path/slash');
69
72
  var readFile = require('@stryke/fs/read-file');
73
+ var writeFile = require('@stryke/fs/write-file');
70
74
  var fs = require('fs');
71
75
  var promises = require('fs/promises');
72
76
  var path = require('path');
73
- var isObject = require('@stryke/type-checks/is-object');
74
77
 
75
78
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
76
79
 
@@ -213,13 +216,16 @@ var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
213
216
  this.#context.fs.removeSync(path);
214
217
  }
215
218
  readDirSync(dirPath) {
219
+ if (!this.#context.fs.isDirectorySync(dirPath)) {
220
+ return [];
221
+ }
216
222
  return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
217
- const fullPath = this.#context.fs.resolveSync(join.joinPaths(dirPath, entry));
223
+ const fullPath = this.#context.fs.resolveSync(entry);
218
224
  if (fullPath) {
219
225
  ret.push({
220
226
  name: entry,
221
- isDirectory: this.#context.fs.existsSync(fullPath),
222
- isFile: this.#context.fs.existsSync(fullPath),
227
+ isDirectory: this.#context.fs.isDirectorySync(fullPath),
228
+ isFile: this.#context.fs.isFileSync(fullPath),
223
229
  isSymlink: false
224
230
  });
225
231
  }
@@ -227,14 +233,14 @@ var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
227
233
  }, []);
228
234
  }
229
235
  async readFile(filePath) {
230
- if (!this.#context.fs.existsSync(filePath)) {
231
- throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
236
+ if (!this.#context.fs.isFileSync(filePath)) {
237
+ return "";
232
238
  }
233
239
  return await this.#context.fs.read(filePath);
234
240
  }
235
241
  readFileSync(filePath) {
236
- if (!this.#context.fs.existsSync(filePath)) {
237
- throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
242
+ if (!this.#context.fs.isFileSync(filePath)) {
243
+ return "";
238
244
  }
239
245
  return this.#context.fs.readSync(filePath);
240
246
  }
@@ -244,9 +250,11 @@ var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
244
250
  writeFileSync(filePath, fileText) {
245
251
  this.#context.fs.writeSync(filePath, fileText);
246
252
  }
247
- async mkdir(_dirPath) {
253
+ async mkdir(dirPath) {
254
+ await this.#context.fs.mkdir(dirPath);
248
255
  }
249
- mkdirSync(_dirPath) {
256
+ mkdirSync(dirPath) {
257
+ this.#context.fs.mkdirSync(dirPath);
250
258
  }
251
259
  async move(srcPath, destPath) {
252
260
  await this.#context.fs.move(srcPath, destPath);
@@ -261,16 +269,16 @@ var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
261
269
  this.#context.fs.copySync(srcPath, destPath);
262
270
  }
263
271
  async fileExists(filePath) {
264
- return this.#context.fs.exists(filePath);
272
+ return this.#context.fs.isFile(filePath);
265
273
  }
266
274
  fileExistsSync(filePath) {
267
- return this.#context.fs.existsSync(filePath);
275
+ return this.#context.fs.isFileSync(filePath);
268
276
  }
269
277
  async directoryExists(dirPath) {
270
- return this.#context.fs.exists(dirPath);
278
+ return this.#context.fs.isDirectory(dirPath);
271
279
  }
272
280
  directoryExistsSync(dirPath) {
273
- return this.#context.fs.existsSync(dirPath);
281
+ return this.#context.fs.isDirectorySync(dirPath);
274
282
  }
275
283
  realpathSync(path) {
276
284
  return this.#context.fs.resolveSync(path) || path;
@@ -349,6 +357,14 @@ ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : dia
349
357
  return formatTypes(builtinModules);
350
358
  }
351
359
  chunkSHUYVCID_js.__name(emitTypes, "emitTypes");
360
+ var mergeResults = defu6.createDefu((obj, key, value) => {
361
+ if (isString.isString(obj[key]) && isString.isString(value)) {
362
+ obj[key] = `${obj[key] || ""}
363
+ ${value || ""}`.trim();
364
+ return true;
365
+ }
366
+ return false;
367
+ });
352
368
  async function callHook(context, hook, options, ...args) {
353
369
  const handlers = context.selectHooks(hook, options);
354
370
  if (handlers.length > 0) {
@@ -356,18 +372,28 @@ async function callHook(context, hook, options, ...args) {
356
372
  let results = [];
357
373
  if (options?.sequential === false) {
358
374
  results = await Promise.all(handlers.map(async (handler) => {
359
- if (!isFunction.isFunction(handler)) {
375
+ if (!isFunction.isFunction(handler.handle)) {
360
376
  throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
361
377
  }
362
- return Promise.resolve(handler.apply(null, ...args));
378
+ return Promise.resolve(
379
+ // eslint-disable-next-line ts/no-unsafe-call
380
+ handler.handle.apply(handler.context, [
381
+ ...args
382
+ ])
383
+ );
363
384
  }));
364
385
  } else {
365
386
  for (const handler of handlers) {
366
- if (!isFunction.isFunction(handler)) {
387
+ if (!isFunction.isFunction(handler.handle)) {
367
388
  throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
368
389
  }
369
390
  if (options?.result === "first" || options?.asNextParam === false) {
370
- results.push(await Promise.resolve(handler.apply(null, ...args)));
391
+ results.push(await Promise.resolve(
392
+ // eslint-disable-next-line ts/no-unsafe-call
393
+ handler.handle.apply(handler.context, [
394
+ ...args
395
+ ])
396
+ ));
371
397
  if (options?.result === "first" && isSet.isSet(results[results.length - 1])) {
372
398
  break;
373
399
  }
@@ -380,11 +406,26 @@ async function callHook(context, hook, options, ...args) {
380
406
  }
381
407
  const result = await Promise.resolve(
382
408
  // eslint-disable-next-line ts/no-unsafe-call
383
- handler.apply(null, ...sequenceArgs)
409
+ handler.handle.apply(handler.context, [
410
+ ...sequenceArgs
411
+ ])
384
412
  );
385
- results = [
386
- result
387
- ];
413
+ if (result) {
414
+ if (options?.result === "last") {
415
+ results = [
416
+ result
417
+ ];
418
+ } else if (isString.isString(result)) {
419
+ results = [
420
+ `${isString.isString(results[0]) ? results[0] || "" : ""}
421
+ ${result || ""}`.trim()
422
+ ];
423
+ } else if (isObject.isObject(result)) {
424
+ results = [
425
+ mergeResults(result, results[0] ?? {})
426
+ ];
427
+ }
428
+ }
388
429
  }
389
430
  }
390
431
  }
@@ -550,33 +591,20 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
550
591
  };
551
592
  }
552
593
  chunkSHUYVCID_js.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
553
- async function writeFile(log, filepath, content, skipFormat = false) {
554
- try {
555
- if (skipFormat) {
556
- await writeFile$1.writeFile(filepath, content);
557
- } else {
558
- const config = await prettier.resolveConfig(filepath);
559
- const formatted = await prettier.format(content, {
560
- ...config ?? {},
561
- filepath
562
- });
563
- await writeFile$1.writeFile(filepath, formatted || "");
564
- }
565
- } catch (error) {
566
- log(types.LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
567
- ${error?.message ? error.message : ""}`);
568
- }
569
- }
570
- chunkSHUYVCID_js.__name(writeFile, "writeFile");
571
594
 
572
595
  // ../powerlines/src/internal/helpers/resolve-tsconfig.ts
596
+ function getTsconfigDtsPath(context) {
597
+ const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
598
+ return dtsRelativePath;
599
+ }
600
+ chunkSHUYVCID_js.__name(getTsconfigDtsPath, "getTsconfigDtsPath");
573
601
  async function resolveTsconfigChanges(context) {
574
602
  const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
575
603
  const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
576
604
  const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
577
605
  tsconfigJson.compilerOptions ??= {};
578
606
  if (context.config.output.dts !== false) {
579
- const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
607
+ const dtsRelativePath = getTsconfigDtsPath(context);
580
608
  if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
581
609
  context.dtsPath,
582
610
  dtsRelativePath
@@ -618,7 +646,7 @@ async function initializeTsconfig(context) {
618
646
  context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
619
647
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
620
648
  context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
621
- await writeFile(context.log, tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
649
+ await context.fs.write(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
622
650
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
623
651
  }
624
652
  chunkSHUYVCID_js.__name(initializeTsconfig, "initializeTsconfig");
@@ -667,13 +695,11 @@ async function resolveTsconfig(context) {
667
695
  `).join("\n")}
668
696
  `);
669
697
  }
670
- await writeFile(context.log, context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
698
+ await context.fs.write(context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
671
699
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
672
700
  if (!context.tsconfig) {
673
701
  throw new Error("Failed to parse the TypeScript configuration file.");
674
702
  }
675
- context.tsconfig.tsconfigJson.compilerOptions ??= {};
676
- context.tsconfig.tsconfigJson.compilerOptions.strict = false;
677
703
  }
678
704
  chunkSHUYVCID_js.__name(resolveTsconfig, "resolveTsconfig");
679
705
  var DEFAULT_ENVIRONMENT = "default";
@@ -813,7 +839,7 @@ function replacePathTokens(context, path) {
813
839
  if (!path) {
814
840
  return path;
815
841
  }
816
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
842
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
817
843
  }
818
844
  chunkSHUYVCID_js.__name(replacePathTokens, "replacePathTokens");
819
845
  function resolveEntryInputFile(context, typeDefinition) {
@@ -1154,20 +1180,17 @@ function normalizePath(path, builtinsPath, prefix = "powerlines") {
1154
1180
  return isType.isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
1155
1181
  }
1156
1182
  chunkSHUYVCID_js.__name(normalizePath, "normalizePath");
1157
- function normalizeKey(key, sep = ":") {
1158
- if (!key) {
1159
- return "";
1160
- }
1161
- return key.replace(/[:/\\]/g, sep).replace(/^[:/\\]|[:/\\]$/g, "");
1162
- }
1163
- chunkSHUYVCID_js.__name(normalizeKey, "normalizeKey");
1164
- function filterKeyByBase(key, base) {
1165
- if (base) {
1166
- return key.startsWith(base) && key[key.length - 1] !== "$";
1167
- }
1168
- return key[key.length - 1] !== "$";
1183
+ function normalizeGlobPatterns(workspaceRoot, patterns) {
1184
+ return getUnique.getUnique(toArray.toArray(patterns).map((pattern) => {
1185
+ if (isSetObject.isSetObject(pattern) && (isSetString.isSetString(pattern.input) || isSetString.isSetString(pattern.glob))) {
1186
+ return join.joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
1187
+ } else if (!isSetString.isSetString(pattern)) {
1188
+ return void 0;
1189
+ }
1190
+ return pattern;
1191
+ }).filter(isSetString.isSetString));
1169
1192
  }
1170
- chunkSHUYVCID_js.__name(filterKeyByBase, "filterKeyByBase");
1193
+ chunkSHUYVCID_js.__name(normalizeGlobPatterns, "normalizeGlobPatterns");
1171
1194
  var BaseStorageAdapter = class {
1172
1195
  static {
1173
1196
  chunkSHUYVCID_js.__name(this, "BaseStorageAdapter");
@@ -1222,6 +1245,21 @@ var BaseStorageAdapter = class {
1222
1245
  }
1223
1246
  }
1224
1247
  /**
1248
+ * Synchronously creates a directory at the specified path.
1249
+ *
1250
+ * @param _ - The path of the directory to create.
1251
+ */
1252
+ mkdirSync(_) {
1253
+ }
1254
+ /**
1255
+ * Creates a directory at the specified path.
1256
+ *
1257
+ * @param dirPath - The path of the directory to create.
1258
+ */
1259
+ async mkdir(dirPath) {
1260
+ return Promise.resolve(this.mkdirSync(dirPath));
1261
+ }
1262
+ /**
1225
1263
  * Asynchronously removes a key from the storage.
1226
1264
  *
1227
1265
  * @param key - The key to remove.
@@ -1270,6 +1308,42 @@ var BaseStorageAdapter = class {
1270
1308
  return this.listSync(base);
1271
1309
  }
1272
1310
  /**
1311
+ * Synchronously checks if the given key is a directory.
1312
+ *
1313
+ * @param _ - The key to check.
1314
+ * @returns `true` if the key is a directory, otherwise `false`.
1315
+ */
1316
+ isDirectorySync(_) {
1317
+ return false;
1318
+ }
1319
+ /**
1320
+ * Checks if the given key is a directory.
1321
+ *
1322
+ * @param key - The key to check.
1323
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
1324
+ */
1325
+ async isDirectory(key) {
1326
+ return Promise.resolve(this.isDirectorySync(key));
1327
+ }
1328
+ /**
1329
+ * Synchronously checks if the given key is a file.
1330
+ *
1331
+ * @param key - The key to check.
1332
+ * @returns `true` if the key is a file, otherwise `false`.
1333
+ */
1334
+ isFileSync(key) {
1335
+ return this.existsSync(key) && !this.isDirectorySync(key);
1336
+ }
1337
+ /**
1338
+ * Checks if the given key is a file.
1339
+ *
1340
+ * @param key - The key to check.
1341
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
1342
+ */
1343
+ async isFile(key) {
1344
+ return Promise.resolve(this.isFileSync(key));
1345
+ }
1346
+ /**
1273
1347
  * Disposes of the storage adapter, releasing any held resources.
1274
1348
  *
1275
1349
  * @returns A promise that resolves when the disposal is complete.
@@ -1371,7 +1445,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1371
1445
  */
1372
1446
  setSync(key, value) {
1373
1447
  if (!this.options.isReadOnly) {
1374
- return writeFile$1.writeFileSync(this.resolve(key), value);
1448
+ return writeFile.writeFileSync(this.resolve(key), value);
1375
1449
  }
1376
1450
  }
1377
1451
  /**
@@ -1382,7 +1456,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1382
1456
  */
1383
1457
  async set(key, value) {
1384
1458
  if (!this.options.isReadOnly) {
1385
- return writeFile$1.writeFile(this.resolve(key), value);
1459
+ return writeFile.writeFile(this.resolve(key), value);
1386
1460
  }
1387
1461
  }
1388
1462
  /**
@@ -1410,6 +1484,22 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1410
1484
  }
1411
1485
  }
1412
1486
  /**
1487
+ * Synchronously creates a directory at the specified path.
1488
+ *
1489
+ * @param dirPath - The path of the directory to create.
1490
+ */
1491
+ mkdirSync(dirPath) {
1492
+ helpers.createDirectorySync(this.resolve(dirPath));
1493
+ }
1494
+ /**
1495
+ * Creates a directory at the specified path.
1496
+ *
1497
+ * @param dirPath - The path of the directory to create.
1498
+ */
1499
+ async mkdir(dirPath) {
1500
+ await helpers.createDirectory(this.resolve(dirPath));
1501
+ }
1502
+ /**
1413
1503
  * Lists all keys under a given base path synchronously.
1414
1504
  *
1415
1505
  * @param base - The base path to list keys from.
@@ -1435,6 +1525,24 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1435
1525
  ignore: this.options.ignore
1436
1526
  }).catch(ignoreNotfound).then((r) => r || []);
1437
1527
  }
1528
+ /**
1529
+ * Synchronously checks if the given key is a directory.
1530
+ *
1531
+ * @param key - The key to check.
1532
+ * @returns `true` if the key is a directory, otherwise `false`.
1533
+ */
1534
+ isDirectorySync(key) {
1535
+ return isFile.isDirectory(this.resolve(key));
1536
+ }
1537
+ /**
1538
+ * Synchronously checks if the given key is a file.
1539
+ *
1540
+ * @param key - The key to check.
1541
+ * @returns `true` if the key is a file, otherwise `false`.
1542
+ */
1543
+ isFileSync(key) {
1544
+ return !isFile.isFile(this.resolve(key));
1545
+ }
1438
1546
  };
1439
1547
  var VirtualStorageAdapter = class extends BaseStorageAdapter {
1440
1548
  static {
@@ -1565,7 +1673,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
1565
1673
  * @returns The normalized module id.
1566
1674
  */
1567
1675
  #normalizeId(id) {
1568
- return normalizeId(id, this.#context.config.output.builtinPrefix);
1676
+ let normalized = id;
1677
+ if (isParentPath.isParentPath(normalized, this.#context.builtinsPath)) {
1678
+ normalized = replace.replacePath(normalized, this.#context.builtinsPath);
1679
+ }
1680
+ return normalizeId(normalized, this.#context.config.output.builtinPrefix);
1569
1681
  }
1570
1682
  /**
1571
1683
  * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
@@ -1574,7 +1686,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1574
1686
  * @returns The normalized path.
1575
1687
  */
1576
1688
  #normalizePath(path) {
1577
- return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
1689
+ return normalizePath(path.includes("{") || path.includes("}") ? replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
1578
1690
  }
1579
1691
  /**
1580
1692
  * Builds a regular expression from a string pattern for path matching.
@@ -1801,26 +1913,65 @@ var VirtualFileSystem = class _VirtualFileSystem {
1801
1913
  return this.#getStorage(resolved)?.adapter?.name === "virtual";
1802
1914
  }
1803
1915
  /**
1916
+ * Checks if a path is a directory in the virtual file system (VFS).
1917
+ *
1918
+ * @param path - The path to check.
1919
+ * @returns `true` if the path is a directory, otherwise `false`.
1920
+ */
1921
+ isDirectorySync(path) {
1922
+ const resolved = this.resolveSync(path);
1923
+ if (!resolved) {
1924
+ return false;
1925
+ }
1926
+ return !!(this.existsSync(resolved) && this.#getStorage(resolved)?.adapter?.isDirectorySync(resolved));
1927
+ }
1928
+ /**
1929
+ * Checks if a path is a directory in the virtual file system (VFS).
1930
+ *
1931
+ * @param path - The path to check.
1932
+ * @returns `true` if the path is a directory, otherwise `false`.
1933
+ */
1934
+ async isDirectory(path) {
1935
+ const resolved = await this.resolve(path);
1936
+ if (!resolved) {
1937
+ return false;
1938
+ }
1939
+ return !!(await this.exists(resolved) && await this.#getStorage(resolved)?.adapter?.isDirectory(resolved));
1940
+ }
1941
+ /**
1942
+ * Checks if a path is a file in the virtual file system (VFS).
1943
+ *
1944
+ * @param path - The path to check.
1945
+ * @returns `true` if the path is a file, otherwise `false`.
1946
+ */
1947
+ isFileSync(path) {
1948
+ const resolved = this.resolveSync(path);
1949
+ if (!resolved) {
1950
+ return false;
1951
+ }
1952
+ return this.#getStorage(resolved)?.adapter?.isFileSync(resolved) ?? false;
1953
+ }
1954
+ /**
1955
+ * Checks if a path is a file in the virtual file system (VFS).
1956
+ *
1957
+ * @param path - The path to check.
1958
+ * @returns `true` if the path is a file, otherwise `false`.
1959
+ */
1960
+ async isFile(path) {
1961
+ const resolved = await this.resolve(path);
1962
+ if (!resolved) {
1963
+ return false;
1964
+ }
1965
+ return await this.#getStorage(resolved)?.adapter?.isFile(resolved) ?? false;
1966
+ }
1967
+ /**
1804
1968
  * Lists files in a given path.
1805
1969
  *
1806
1970
  * @param path - The path to list files from.
1807
1971
  * @returns An array of file names in the specified path.
1808
1972
  */
1809
1973
  listSync(path) {
1810
- let maskedMounts = [];
1811
- const allKeys = [];
1812
- for (const storage of this.#getStorages(path, true)) {
1813
- for (const key of storage.adapter.listSync(storage.relativeBase)) {
1814
- if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
1815
- allKeys.push(`${storage.base}${normalizeKey(key)}`);
1816
- }
1817
- }
1818
- maskedMounts = [
1819
- storage.base,
1820
- ...maskedMounts.filter((p) => !p.startsWith(storage.base))
1821
- ];
1822
- }
1823
- return allKeys.filter((key) => filterKeyByBase(key, path));
1974
+ return getUnique.getUnique(this.#getStorages(path, true).map((storage) => storage.adapter.listSync(storage.relativeBase ? storage.base ? append.appendPath(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)).flat());
1824
1975
  }
1825
1976
  /**
1826
1977
  * Lists files in a given path.
@@ -1829,20 +1980,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1829
1980
  * @returns An array of file names in the specified path.
1830
1981
  */
1831
1982
  async list(path) {
1832
- let maskedMounts = [];
1833
- const allKeys = [];
1834
- for (const storage of this.#getStorages(path, true)) {
1835
- for (const key of await storage.adapter.list(storage.relativeBase)) {
1836
- if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
1837
- allKeys.push(`${storage.base}${normalizeKey(key)}`);
1838
- }
1839
- }
1840
- maskedMounts = [
1841
- storage.base,
1842
- ...maskedMounts.filter((p) => !p.startsWith(storage.base))
1843
- ];
1844
- }
1845
- return allKeys.filter((key) => filterKeyByBase(key, path));
1983
+ return getUnique.getUnique((await Promise.all(this.#getStorages(path, true).map(async (storage) => storage.adapter.list(storage.relativeBase ? storage.base ? append.appendPath(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)))).flat());
1846
1984
  }
1847
1985
  /**
1848
1986
  * Removes a file in the virtual file system (VFS).
@@ -1894,12 +2032,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
1894
2032
  */
1895
2033
  async glob(patterns) {
1896
2034
  const results = [];
1897
- for (const pattern of toArray.toArray(patterns)) {
2035
+ for (const pattern of normalizeGlobPatterns(this.#context.workspaceConfig.workspaceRoot, patterns)) {
1898
2036
  const normalized = this.#normalizePath(pattern);
1899
2037
  if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
1900
- const resolved = this.resolveSync(normalized);
1901
- if (resolved && !results.includes(resolved)) {
1902
- results.push(resolved);
2038
+ if (this.isDirectorySync(normalized)) {
2039
+ results.push(...await this.list(normalized));
2040
+ } else {
2041
+ const resolved = await this.resolve(normalized);
2042
+ if (resolved && !results.includes(resolved)) {
2043
+ results.push(resolved);
2044
+ }
1903
2045
  }
1904
2046
  continue;
1905
2047
  }
@@ -1925,12 +2067,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
1925
2067
  */
1926
2068
  globSync(patterns) {
1927
2069
  const results = [];
1928
- for (const pattern of toArray.toArray(patterns)) {
2070
+ for (const pattern of normalizeGlobPatterns(this.#context.workspaceConfig.workspaceRoot, patterns)) {
1929
2071
  const normalized = this.#normalizePath(pattern);
1930
2072
  if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
1931
- const resolved = this.resolveSync(normalized);
1932
- if (resolved && !results.includes(resolved)) {
1933
- results.push(resolved);
2073
+ if (this.isDirectorySync(normalized)) {
2074
+ results.push(...this.listSync(normalized));
2075
+ } else {
2076
+ const resolved = this.resolveSync(normalized);
2077
+ if (resolved && !results.includes(resolved)) {
2078
+ results.push(resolved);
2079
+ }
1934
2080
  }
1935
2081
  continue;
1936
2082
  }
@@ -1956,20 +2102,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
1956
2102
  * @param destPath - The destination path to copy to
1957
2103
  */
1958
2104
  async copy(srcPath, destPath) {
1959
- if (filePathFns.hasFileExtension(srcPath)) {
1960
- const content = await this.read(srcPath);
2105
+ const src = srcPath instanceof URL ? url.fileURLToPath(srcPath) : srcPath;
2106
+ const dest = destPath instanceof URL ? url.fileURLToPath(destPath) : destPath;
2107
+ if (!isSetString.isSetString(src) && (!isSetObject.isSetObject(src) || !isSetString.isSetString(src.input)) || !isSetString.isSetString(dest)) {
2108
+ return;
2109
+ }
2110
+ const sourceStr = isString.isString(src) ? src : src.input ? src.input : this.#context.workspaceConfig.workspaceRoot;
2111
+ const source = await this.resolve(sourceStr);
2112
+ if (!source) {
2113
+ return;
2114
+ }
2115
+ if (this.isDirectorySync(source) || isSetString.isSetString(src) && src.includes("*") || isSetObject.isSetObject(src) && isSetString.isSetString(src.glob)) {
2116
+ await Promise.all((await this.glob(src)).map(async (file) => {
2117
+ return this.copy(file, append.appendPath(replace.replacePath(file, sourceStr), dest));
2118
+ }));
2119
+ } else {
2120
+ const content = await this.read(source);
1961
2121
  if (content !== void 0) {
1962
- await this.write(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
2122
+ await this.write(this.#normalizePath(dest), content, {
2123
+ skipFormat: true
2124
+ });
1963
2125
  }
1964
- } else {
1965
- await Promise.all((await this.list(srcPath)).map(async (file) => {
1966
- const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
1967
- const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
1968
- const content = await this.read(file);
1969
- if (content !== void 0) {
1970
- await this.write(destinationPath, content);
1971
- }
1972
- }));
1973
2126
  }
1974
2127
  }
1975
2128
  /**
@@ -1979,20 +2132,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
1979
2132
  * @param destPath - The destination path to copy to
1980
2133
  */
1981
2134
  copySync(srcPath, destPath) {
1982
- if (filePathFns.hasFileExtension(srcPath)) {
1983
- const content = this.readSync(srcPath);
2135
+ const src = srcPath instanceof URL ? url.fileURLToPath(srcPath) : srcPath;
2136
+ const dest = destPath instanceof URL ? url.fileURLToPath(destPath) : destPath;
2137
+ if (!isSetString.isSetString(src) && (!isSetObject.isSetObject(src) || !isSetString.isSetString(src.input)) || !isSetString.isSetString(dest)) {
2138
+ return;
2139
+ }
2140
+ const sourceStr = isString.isString(src) ? src : src.input ? src.input : this.#context.workspaceConfig.workspaceRoot;
2141
+ const source = this.resolveSync(sourceStr);
2142
+ if (!source) {
2143
+ return;
2144
+ }
2145
+ if (this.isDirectorySync(source) || isSetString.isSetString(src) && src.includes("*") || isSetObject.isSetObject(src) && isSetString.isSetString(src.glob)) {
2146
+ this.globSync(src).map((file) => {
2147
+ return this.copySync(file, append.appendPath(filePathFns.findFilePath(replace.replacePath(file, sourceStr)), dest));
2148
+ });
2149
+ } else {
2150
+ const content = this.readSync(source);
1984
2151
  if (content !== void 0) {
1985
- this.writeSync(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
2152
+ this.writeSync(this.#normalizePath(filePathFns.hasFileExtension(dest) ? dest : append.appendPath(filePathFns.findFileName(source), dest)), content, {
2153
+ skipFormat: true
2154
+ });
1986
2155
  }
1987
- } else {
1988
- this.listSync(srcPath).forEach((file) => {
1989
- const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
1990
- const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
1991
- const content = this.readSync(file);
1992
- if (content !== void 0) {
1993
- this.writeSync(destinationPath, content);
1994
- }
1995
- });
1996
2156
  }
1997
2157
  }
1998
2158
  /**
@@ -2079,15 +2239,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2079
2239
  }
2080
2240
  }
2081
2241
  const { relativeKey, adapter } = this.#getStorage(path);
2082
- this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2083
- const id = options?.meta?.id || this.#normalizeId(path);
2242
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2243
+ const id = options?.meta?.id || this.#normalizeId(relativeKey);
2084
2244
  this.#metadata[id] = {
2085
2245
  variant: "normal",
2086
2246
  timestamp: Date.now(),
2087
2247
  ...options.meta ?? {}
2088
2248
  };
2089
- this.#paths[id] = this.#normalizePath(path);
2090
- this.#ids[this.#normalizePath(path)] = id;
2249
+ this.#paths[id] = this.#normalizePath(relativeKey);
2250
+ this.#ids[this.#normalizePath(relativeKey)] = id;
2091
2251
  return adapter.set(relativeKey, code);
2092
2252
  }
2093
2253
  /**
@@ -2099,18 +2259,34 @@ var VirtualFileSystem = class _VirtualFileSystem {
2099
2259
  */
2100
2260
  writeSync(path, data = "", options = {}) {
2101
2261
  const { relativeKey, adapter } = this.#getStorage(path);
2102
- this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
2103
- const id = options?.meta?.id || this.#normalizeId(path);
2262
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
2263
+ const id = options?.meta?.id || this.#normalizeId(relativeKey);
2104
2264
  this.#metadata[id] = {
2105
2265
  variant: "normal",
2106
2266
  timestamp: Date.now(),
2107
2267
  ...options.meta ?? {}
2108
2268
  };
2109
- this.#paths[id] = this.#normalizePath(path);
2110
- this.#ids[this.#normalizePath(path)] = id;
2269
+ this.#paths[id] = this.#normalizePath(relativeKey);
2270
+ this.#ids[this.#normalizePath(relativeKey)] = id;
2111
2271
  return adapter.setSync(relativeKey, data);
2112
2272
  }
2113
2273
  /**
2274
+ * Synchronously creates a directory at the specified path.
2275
+ *
2276
+ * @param dirPath - The path of the directory to create.
2277
+ */
2278
+ mkdirSync(dirPath) {
2279
+ return this.#getStorage(dirPath)?.adapter?.mkdirSync(dirPath);
2280
+ }
2281
+ /**
2282
+ * Creates a directory at the specified path.
2283
+ *
2284
+ * @param path - The path of the directory to create.
2285
+ */
2286
+ async mkdir(path) {
2287
+ return this.#getStorage(path)?.adapter?.mkdir(path);
2288
+ }
2289
+ /**
2114
2290
  * Retrieves the metadata of a file in the virtual file system (VFS).
2115
2291
  *
2116
2292
  * @param pathOrId - The path or ID of the file to retrieve metadata for.
@@ -2140,11 +2316,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2140
2316
  * @returns A promise that resolves to the resolved module path.
2141
2317
  */
2142
2318
  async resolve(id, importer, options = {}) {
2143
- if (isType.isAbsolutePath(id)) {
2144
- return id;
2319
+ let path = id;
2320
+ if (path.includes("{") || path.includes("}")) {
2321
+ path = replacePathTokens(this.#context, path);
2322
+ }
2323
+ if (isType.isAbsolutePath(path)) {
2324
+ return path;
2145
2325
  }
2146
2326
  const resolverCacheKey = murmurhash.murmurhash({
2147
- id: this.#normalizeId(id),
2327
+ path: this.#normalizeId(path),
2148
2328
  importer,
2149
2329
  options
2150
2330
  });
@@ -2155,7 +2335,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2155
2335
  return result;
2156
2336
  }
2157
2337
  }
2158
- result = this.paths[this.#normalizeId(id)];
2338
+ result = this.paths[this.#normalizeId(path)];
2159
2339
  if (!result) {
2160
2340
  const paths = options.paths ?? [];
2161
2341
  if (importer && !paths.includes(importer)) {
@@ -2164,8 +2344,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
2164
2344
  paths.push(this.#context.workspaceConfig.workspaceRoot);
2165
2345
  paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
2166
2346
  paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
2167
- paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2168
- for (const combination of resolve.getResolutionCombinations(id, {
2347
+ paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2348
+ for (const combination of resolve.getResolutionCombinations(path, {
2169
2349
  paths
2170
2350
  })) {
2171
2351
  const { relativeKey, adapter } = this.#getStorage(combination);
@@ -2174,19 +2354,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
2174
2354
  break;
2175
2355
  }
2176
2356
  }
2177
- try {
2178
- result = await resolve.resolve(id, {
2179
- ...options,
2180
- paths
2181
- });
2182
- } catch {
2357
+ if (!result) {
2358
+ try {
2359
+ result = await resolve.resolve(path, {
2360
+ ...options,
2361
+ paths
2362
+ });
2363
+ } catch {
2364
+ }
2183
2365
  }
2184
2366
  }
2185
- if (result) {
2186
- result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2187
- if (!this.#context.config.skipCache) {
2188
- this.resolverCache.set(resolverCacheKey, result);
2189
- }
2367
+ if (result && !this.#context.config.skipCache) {
2368
+ this.resolverCache.set(resolverCacheKey, result);
2190
2369
  }
2191
2370
  return result;
2192
2371
  }
@@ -2207,17 +2386,21 @@ var VirtualFileSystem = class _VirtualFileSystem {
2207
2386
  * @returns The resolved module path.
2208
2387
  */
2209
2388
  resolveSync(id, importer, options = {}) {
2210
- if (isType.isAbsolutePath(id)) {
2211
- return id;
2389
+ let path = id;
2390
+ if (path.includes("{") || path.includes("}")) {
2391
+ path = replacePathTokens(this.#context, path);
2392
+ }
2393
+ if (isType.isAbsolutePath(path)) {
2394
+ return path;
2212
2395
  }
2213
2396
  let result;
2214
2397
  if (!this.#context.config.skipCache) {
2215
- result = this.resolverCache.get(this.#normalizeId(id));
2398
+ result = this.resolverCache.get(this.#normalizeId(path));
2216
2399
  if (result) {
2217
2400
  return result;
2218
2401
  }
2219
2402
  }
2220
- result = this.paths[this.#normalizeId(id)];
2403
+ result = this.paths[this.#normalizeId(path)];
2221
2404
  if (!result) {
2222
2405
  const paths = options.paths ?? [];
2223
2406
  if (importer && !paths.includes(importer)) {
@@ -2226,8 +2409,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
2226
2409
  paths.push(this.#context.workspaceConfig.workspaceRoot);
2227
2410
  paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
2228
2411
  paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
2229
- paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2230
- for (const combination of resolve.getResolutionCombinations(id, {
2412
+ paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2413
+ for (const combination of resolve.getResolutionCombinations(path, {
2231
2414
  paths
2232
2415
  })) {
2233
2416
  const { relativeKey, adapter } = this.#getStorage(combination);
@@ -2236,18 +2419,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
2236
2419
  break;
2237
2420
  }
2238
2421
  }
2239
- try {
2240
- result = resolve.resolveSync(id, {
2241
- paths
2242
- });
2243
- } catch {
2422
+ if (!result) {
2423
+ try {
2424
+ result = resolve.resolveSync(path, {
2425
+ ...options,
2426
+ paths
2427
+ });
2428
+ } catch {
2429
+ }
2244
2430
  }
2245
2431
  }
2246
- if (result) {
2247
- result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2248
- if (!this.#context.config.skipCache) {
2249
- this.resolverCache.set(this.#normalizeId(id), result);
2250
- }
2432
+ if (result && !this.#context.config.skipCache) {
2433
+ this.resolverCache.set(this.#normalizeId(path), result);
2251
2434
  }
2252
2435
  return result;
2253
2436
  }
@@ -2328,16 +2511,29 @@ var VirtualFileSystem = class _VirtualFileSystem {
2328
2511
 
2329
2512
  // ../powerlines/src/lib/contexts/context.ts
2330
2513
  var configCache = /* @__PURE__ */ new WeakMap();
2514
+ var agent = new undici.Agent({
2515
+ keepAliveTimeout: 1e4
2516
+ });
2517
+ undici.setGlobalDispatcher(agent.compose(undici.interceptors.retry({
2518
+ maxRetries: 3,
2519
+ minTimeout: 1e3,
2520
+ maxTimeout: 1e4,
2521
+ timeoutFactor: 2,
2522
+ retryAfter: true
2523
+ })));
2331
2524
  var PowerlinesContext = class _PowerlinesContext {
2332
2525
  static {
2333
2526
  chunkSHUYVCID_js.__name(this, "PowerlinesContext");
2334
2527
  }
2335
2528
  /**
2336
- * Internal reference to the API instance
2529
+ * Internal references storage
2530
+ *
2531
+ * @danger
2532
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
2337
2533
  *
2338
2534
  * @internal
2339
2535
  */
2340
- #api;
2536
+ #internal = {};
2341
2537
  #workspaceConfig;
2342
2538
  #checksum = null;
2343
2539
  #buildId = uuid.uuid();
@@ -2347,7 +2543,8 @@ var PowerlinesContext = class _PowerlinesContext {
2347
2543
  #fs;
2348
2544
  #tsconfig;
2349
2545
  #program;
2350
- #resolvePatterns = [];
2546
+ #parserCache;
2547
+ #requestCache;
2351
2548
  #getConfigProps(config = {}) {
2352
2549
  return {
2353
2550
  variant: config.build?.variant,
@@ -2371,7 +2568,8 @@ var PowerlinesContext = class _PowerlinesContext {
2371
2568
  lint: config.lint,
2372
2569
  transform: config.transform,
2373
2570
  build: config.build,
2374
- framework: config.framework
2571
+ framework: config.framework,
2572
+ ...config
2375
2573
  };
2376
2574
  }
2377
2575
  /**
@@ -2419,14 +2617,30 @@ var PowerlinesContext = class _PowerlinesContext {
2419
2617
  */
2420
2618
  resolver;
2421
2619
  /**
2620
+ * The resolved configuration options
2621
+ */
2622
+ resolvePatterns = [];
2623
+ /**
2422
2624
  * Internal context fields and methods
2423
2625
  *
2626
+ * @danger
2627
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
2628
+ *
2424
2629
  * @internal
2425
2630
  */
2426
2631
  get $$internal() {
2427
- return {
2428
- api: this.#api
2429
- };
2632
+ return this.#internal;
2633
+ }
2634
+ /**
2635
+ * Internal context fields and methods
2636
+ *
2637
+ * @danger
2638
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
2639
+ *
2640
+ * @internal
2641
+ */
2642
+ set $$internal(value) {
2643
+ this.#internal = value;
2430
2644
  }
2431
2645
  /**
2432
2646
  * The resolved entry type definitions for the project
@@ -2450,7 +2664,7 @@ var PowerlinesContext = class _PowerlinesContext {
2450
2664
  */
2451
2665
  set tsconfig(value) {
2452
2666
  this.#tsconfig = value;
2453
- this.#resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
2667
+ this.resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
2454
2668
  }
2455
2669
  /**
2456
2670
  * The virtual file system interface for the project
@@ -2591,6 +2805,131 @@ var PowerlinesContext = class _PowerlinesContext {
2591
2805
  return this.#program;
2592
2806
  }
2593
2807
  /**
2808
+ * Gets the parser cache.
2809
+ */
2810
+ get parserCache() {
2811
+ if (!this.#parserCache) {
2812
+ this.#parserCache = flatCache.create({
2813
+ cacheId: "parser",
2814
+ cacheDir: this.cachePath,
2815
+ ttl: 2 * 60 * 60 * 1e3,
2816
+ lruSize: 5e3,
2817
+ persistInterval: 250
2818
+ });
2819
+ }
2820
+ return this.#parserCache;
2821
+ }
2822
+ /**
2823
+ * Gets the request cache.
2824
+ */
2825
+ get requestCache() {
2826
+ if (!this.#requestCache) {
2827
+ this.#requestCache = flatCache.create({
2828
+ cacheId: "http",
2829
+ cacheDir: this.cachePath,
2830
+ ttl: 5 * 60 * 1e3,
2831
+ lruSize: 5e3,
2832
+ persistInterval: 250
2833
+ });
2834
+ }
2835
+ return this.#requestCache;
2836
+ }
2837
+ /**
2838
+ * A function to perform HTTP fetch requests
2839
+ *
2840
+ * @remarks
2841
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
2842
+ *
2843
+ * @example
2844
+ * ```ts
2845
+ * const response = await context.fetch("https://api.example.com/data");
2846
+ * const data = await response.json();
2847
+ * ```
2848
+ *
2849
+ * @see https://github.com/nodejs/undici
2850
+ *
2851
+ * @param input - The URL to fetch.
2852
+ * @param options - The fetch request options.
2853
+ * @returns A promise that resolves to a response returned by the fetch.
2854
+ */
2855
+ async fetch(input, options = {}) {
2856
+ const cacheKey = murmurhash.murmurhash({
2857
+ input: input.toString(),
2858
+ options: JSON.stringify(options)
2859
+ });
2860
+ if (!this.config.skipCache && !options.skipCache) {
2861
+ const cached = this.requestCache.get(cacheKey);
2862
+ if (cached) {
2863
+ return new undici.Response(cached.body, {
2864
+ status: cached.status,
2865
+ statusText: cached.statusText,
2866
+ headers: cached.headers
2867
+ });
2868
+ }
2869
+ }
2870
+ const response = await fetch.fetchRequest(input, {
2871
+ timeout: 12e3,
2872
+ ...options
2873
+ });
2874
+ const result = {
2875
+ body: await response.text(),
2876
+ status: response.status,
2877
+ statusText: response.statusText,
2878
+ headers: Object.fromEntries(response.headers.entries())
2879
+ };
2880
+ if (!this.config.skipCache && !options.skipCache) {
2881
+ try {
2882
+ this.requestCache.set(cacheKey, result);
2883
+ } catch {
2884
+ }
2885
+ }
2886
+ return new undici.Response(result.body, {
2887
+ status: result.status,
2888
+ statusText: result.statusText,
2889
+ headers: result.headers
2890
+ });
2891
+ }
2892
+ /**
2893
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
2894
+ *
2895
+ * @remarks
2896
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
2897
+ *
2898
+ * @example
2899
+ * ```ts
2900
+ * const ast = context.parse("const x: number = 42;");
2901
+ * ```
2902
+ *
2903
+ * @see https://rollupjs.org/plugin-development/#this-parse
2904
+ * @see https://github.com/oxc/oxc
2905
+ *
2906
+ * @param code - The source code to parse.
2907
+ * @param options - The options to pass to the parser.
2908
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
2909
+ */
2910
+ async parse(code, options = {}) {
2911
+ const cacheKey = murmurhash.murmurhash({
2912
+ code,
2913
+ options
2914
+ });
2915
+ let result;
2916
+ if (!this.config.skipCache) {
2917
+ result = this.parserCache.get(cacheKey);
2918
+ if (result) {
2919
+ return result;
2920
+ }
2921
+ }
2922
+ result = await oxcParser.parse(`source.${options.lang || "ts"}`, code, {
2923
+ ...options,
2924
+ sourceType: "module",
2925
+ showSemanticErrors: this.config.mode === "development"
2926
+ });
2927
+ if (!this.config.skipCache) {
2928
+ this.parserCache.set(cacheKey, result);
2929
+ }
2930
+ return result;
2931
+ }
2932
+ /**
2594
2933
  * A helper function to resolve modules in the Virtual File System
2595
2934
  *
2596
2935
  * @remarks
@@ -2635,7 +2974,7 @@ var PowerlinesContext = class _PowerlinesContext {
2635
2974
  };
2636
2975
  }
2637
2976
  if (this.config.build.skipNodeModulesBundle) {
2638
- if (bundleRequire.match(moduleId, this.#resolvePatterns) || bundleRequire.match(moduleId, this.config.build.noExternal)) {
2977
+ if (bundleRequire.match(moduleId, this.resolvePatterns) || bundleRequire.match(moduleId, this.config.build.noExternal)) {
2639
2978
  return void 0;
2640
2979
  }
2641
2980
  if (bundleRequire.match(moduleId, this.config.build.external) || moduleId.startsWith("node:")) {
@@ -2829,6 +3168,26 @@ var PowerlinesContext = class _PowerlinesContext {
2829
3168
  return extendLog(this.log, name);
2830
3169
  }
2831
3170
  /**
3171
+ * Generates a checksum representing the current context state
3172
+ *
3173
+ * @param root - The root directory of the project to generate the checksum for
3174
+ * @returns A promise that resolves to a string representing the checksum
3175
+ */
3176
+ async generateChecksum(root = this.config.projectRoot) {
3177
+ this.#checksum = await hashFiles.hashDirectory(root, {
3178
+ ignore: [
3179
+ "node_modules",
3180
+ ".git",
3181
+ ".nx",
3182
+ ".cache",
3183
+ ".storm",
3184
+ "tmp",
3185
+ "dist"
3186
+ ]
3187
+ });
3188
+ return this.#checksum;
3189
+ }
3190
+ /**
2832
3191
  * Creates a new StormContext instance.
2833
3192
  *
2834
3193
  * @param workspaceConfig - The workspace configuration.
@@ -2850,26 +3209,6 @@ var PowerlinesContext = class _PowerlinesContext {
2850
3209
  */
2851
3210
  logFn;
2852
3211
  /**
2853
- * Generates a checksum representing the current context state
2854
- *
2855
- * @param root - The root directory of the project to generate the checksum for
2856
- * @returns A promise that resolves to a string representing the checksum
2857
- */
2858
- async generateChecksum(root = this.config.projectRoot) {
2859
- this.#checksum = await hashFiles.hashDirectory(root, {
2860
- ignore: [
2861
- "node_modules",
2862
- ".git",
2863
- ".nx",
2864
- ".cache",
2865
- ".storm",
2866
- "tmp",
2867
- "dist"
2868
- ]
2869
- });
2870
- return this.#checksum;
2871
- }
2872
- /**
2873
3212
  * Initialize the context with the provided configuration options
2874
3213
  *
2875
3214
  * @param config - The partial user configuration to use for initialization.
@@ -3242,36 +3581,90 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
3242
3581
  * Retrieves the hook handlers for a specific hook name
3243
3582
  */
3244
3583
  selectHooks(hook, options) {
3245
- const handlers = [];
3584
+ const result = [];
3246
3585
  if (this.hooks[hook]) {
3247
3586
  if (!isHookExternal(hook)) {
3248
3587
  const hooks = this.hooks[hook];
3249
3588
  if (options?.order) {
3250
3589
  if (options?.order === "pre") {
3251
- handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
3252
- handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
3590
+ result.push(...(hooks.preOrdered ?? []).map((h) => {
3591
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3592
+ if (!plugin) {
3593
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3594
+ }
3595
+ return {
3596
+ handle: h.handler,
3597
+ context: plugin.context
3598
+ };
3599
+ }));
3600
+ result.push(...(hooks.preEnforced ?? []).map((h) => {
3601
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3602
+ if (!plugin) {
3603
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3604
+ }
3605
+ return {
3606
+ handle: h.handler,
3607
+ context: plugin.context
3608
+ };
3609
+ }));
3253
3610
  } else if (options?.order === "post") {
3254
- handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
3255
- handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
3611
+ result.push(...(hooks.postOrdered ?? []).map((h) => {
3612
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3613
+ if (!plugin) {
3614
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3615
+ }
3616
+ return {
3617
+ handle: h.handler,
3618
+ context: plugin.context
3619
+ };
3620
+ }));
3621
+ result.push(...(hooks.postEnforced ?? []).map((h) => {
3622
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3623
+ if (!plugin) {
3624
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3625
+ }
3626
+ return {
3627
+ handle: h.handler,
3628
+ context: plugin.context
3629
+ };
3630
+ }));
3256
3631
  } else {
3257
- handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
3632
+ result.push(...(hooks.normal ?? []).map((h) => {
3633
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3634
+ if (!plugin) {
3635
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3636
+ }
3637
+ return {
3638
+ handle: h.handler,
3639
+ context: plugin.context
3640
+ };
3641
+ }));
3258
3642
  }
3259
3643
  } else {
3260
- handlers.push(...this.selectHooks(hook, {
3644
+ result.push(...this.selectHooks(hook, {
3261
3645
  order: "pre"
3262
3646
  }));
3263
- handlers.push(...this.selectHooks(hook, {
3647
+ result.push(...this.selectHooks(hook, {
3264
3648
  order: "normal"
3265
3649
  }));
3266
- handlers.push(...this.selectHooks(hook, {
3650
+ result.push(...this.selectHooks(hook, {
3267
3651
  order: "post"
3268
3652
  }));
3269
3653
  }
3270
3654
  } else {
3271
- handlers.push(...this.hooks[hook].map((h) => h.handler));
3655
+ result.push(...this.hooks[hook].map((h) => {
3656
+ const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
3657
+ if (!plugin) {
3658
+ throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
3659
+ }
3660
+ return {
3661
+ handle: h.handler,
3662
+ context: plugin.context
3663
+ };
3664
+ }));
3272
3665
  }
3273
3666
  }
3274
- return handlers;
3667
+ return result;
3275
3668
  }
3276
3669
  constructor(config, workspaceConfig) {
3277
3670
  super(workspaceConfig);
@@ -3304,6 +3697,31 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
3304
3697
  return context;
3305
3698
  }
3306
3699
  /**
3700
+ * Internal context fields and methods
3701
+ *
3702
+ * @danger
3703
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
3704
+ *
3705
+ * @internal
3706
+ */
3707
+ get $$internal() {
3708
+ return super.$$internal;
3709
+ }
3710
+ /**
3711
+ * Internal context fields and methods
3712
+ *
3713
+ * @danger
3714
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
3715
+ *
3716
+ * @internal
3717
+ */
3718
+ set $$internal(value) {
3719
+ super.$$internal = value;
3720
+ for (const environment of Object.values(this.environments)) {
3721
+ environment.$$internal = super.$$internal;
3722
+ }
3723
+ }
3724
+ /**
3307
3725
  * A record of all environments by name
3308
3726
  */
3309
3727
  get environments() {
@@ -3477,7 +3895,9 @@ var PowerlinesAPI = class _PowerlinesAPI {
3477
3895
  */
3478
3896
  static async from(workspaceRoot, config) {
3479
3897
  const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
3480
- api.#context.$$internal.api = api;
3898
+ api.#context.$$internal = {
3899
+ api
3900
+ };
3481
3901
  for (const plugin of api.context.config.plugins ?? []) {
3482
3902
  await api.#addPlugin(plugin);
3483
3903
  }
@@ -3601,9 +4021,13 @@ ${console.formatLogMessage(context.config)}`);
3601
4021
  let generatedTypes = await emitTypes(context, files);
3602
4022
  context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file ${context.dtsPath}.`);
3603
4023
  const directives = [];
4024
+ const asNextParam = /* @__PURE__ */ chunkSHUYVCID_js.__name((previousResult) => isObject.isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
3604
4025
  let result = await this.callHook("generateTypes", {
3605
4026
  environment: context,
3606
- order: "pre"
4027
+ sequential: true,
4028
+ order: "pre",
4029
+ result: "merge",
4030
+ asNextParam
3607
4031
  }, generatedTypes);
3608
4032
  if (result) {
3609
4033
  if (isSetObject.isSetObject(result)) {
@@ -3617,7 +4041,10 @@ ${console.formatLogMessage(context.config)}`);
3617
4041
  }
3618
4042
  result = await this.callHook("generateTypes", {
3619
4043
  environment: context,
3620
- order: "normal"
4044
+ sequential: true,
4045
+ order: "normal",
4046
+ result: "merge",
4047
+ asNextParam
3621
4048
  }, generatedTypes);
3622
4049
  if (result) {
3623
4050
  if (isSetObject.isSetObject(result)) {
@@ -3631,7 +4058,10 @@ ${console.formatLogMessage(context.config)}`);
3631
4058
  }
3632
4059
  result = await this.callHook("generateTypes", {
3633
4060
  environment: context,
3634
- order: "post"
4061
+ sequential: true,
4062
+ order: "post",
4063
+ result: "merge",
4064
+ asNextParam
3635
4065
  }, generatedTypes);
3636
4066
  if (result) {
3637
4067
  if (isSetObject.isSetObject(result)) {
@@ -3643,15 +4073,24 @@ ${console.formatLogMessage(context.config)}`);
3643
4073
  generatedTypes = result;
3644
4074
  }
3645
4075
  }
3646
- await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
4076
+ if (generatedTypes?.trim() || directives.length > 0) {
4077
+ await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3647
4078
 
3648
4079
  ` : ""}${getFileHeader(context, {
3649
- directive: null,
3650
- prettierIgnore: false
3651
- })}
4080
+ directive: null,
4081
+ prettierIgnore: false
4082
+ })}
3652
4083
 
3653
4084
  ${formatTypes(generatedTypes)}
3654
4085
  `);
4086
+ } else {
4087
+ const dtsRelativePath = getTsconfigDtsPath(context);
4088
+ if (context.tsconfig.tsconfigJson.include && isIncludeMatchFound(dtsRelativePath, context.tsconfig.tsconfigJson.include)) {
4089
+ const normalizedDtsRelativePath = dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath;
4090
+ context.tsconfig.tsconfigJson.include = context.tsconfig.tsconfigJson.include.filter((includeValue) => includeValue?.toString() !== normalizedDtsRelativePath);
4091
+ await context.fs.write(context.tsconfig.tsconfigFilePath, JSON.stringify(context.tsconfig.tsconfigJson, null, 2));
4092
+ }
4093
+ }
3655
4094
  }
3656
4095
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
3657
4096
  if (!context.tsconfig) {
@@ -3688,7 +4127,7 @@ ${formatTypes(generatedTypes)}
3688
4127
  for (const file of files) {
3689
4128
  context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
3690
4129
  const template = Handlebars__default.default.compile(file);
3691
- await writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
4130
+ await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3692
4131
  }
3693
4132
  await this.callHook("new", {
3694
4133
  environment: context,
@@ -3699,14 +4138,14 @@ ${formatTypes(generatedTypes)}
3699
4138
  for (const file of files2) {
3700
4139
  context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
3701
4140
  const template = Handlebars__default.default.compile(file);
3702
- await writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
4141
+ await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3703
4142
  }
3704
4143
  } else {
3705
4144
  const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
3706
4145
  for (const file of files2) {
3707
4146
  context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
3708
4147
  const template = Handlebars__default.default.compile(file);
3709
- await writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
4148
+ await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3710
4149
  }
3711
4150
  }
3712
4151
  await this.callHook("new", {
@@ -3790,15 +4229,12 @@ ${formatTypes(generatedTypes)}
3790
4229
  const destinationPath = joinPaths.joinPaths(append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
3791
4230
  if (sourcePath !== destinationPath) {
3792
4231
  context.log(types.LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.buildPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
3793
- await copyFile.copyFiles({
3794
- input: sourcePath,
3795
- glob: "**/*"
3796
- }, destinationPath);
4232
+ await context.fs.copy(sourcePath, destinationPath);
3797
4233
  }
3798
4234
  }
3799
4235
  await Promise.all(context.config.output.assets.map(async (asset) => {
3800
4236
  context.log(types.LogLevelLabel.DEBUG, `Copying asset(s): ${chalk5__default.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths.joinPaths(replace.replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5__default.default.greenBright(joinPaths.joinPaths(replace.replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5__default.default.yellowBright(i)).join(", ")})` : ""}`);
3801
- await copyFile.copyFiles(asset, asset.output);
4237
+ await context.fs.copy(asset, asset.output);
3802
4238
  }));
3803
4239
  await this.callHook("build", {
3804
4240
  environment: context,