@powerlines/nx 0.11.249 → 0.11.251

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/src/base/base-executor.d.mts +1 -1
  2. package/dist/src/base/base-executor.d.ts +1 -1
  3. package/dist/src/base/base-executor.js +1 -1
  4. package/dist/src/base/base-executor.mjs +1 -1
  5. package/dist/src/base/index.d.mts +1 -1
  6. package/dist/src/base/index.d.ts +1 -1
  7. package/dist/src/base/index.js +1 -1
  8. package/dist/src/base/index.mjs +1 -1
  9. package/dist/src/{base-executor-CTLK6Wbz.mjs → base-executor-BKsk8XnS.mjs} +144 -84
  10. package/dist/src/base-executor-BKsk8XnS.mjs.map +1 -0
  11. package/dist/src/{base-executor-CsvdsKIS.d.mts → base-executor-CDMeDnfo.d.mts} +5 -1
  12. package/dist/src/base-executor-CDMeDnfo.d.mts.map +1 -0
  13. package/dist/src/{base-executor-DR0O1sPf.js → base-executor-CHSFUzU2.js} +143 -83
  14. package/dist/src/{base-executor-D0Q1wshU.d.ts → base-executor-CssolRCu.d.ts} +5 -1
  15. package/dist/src/base-executor-CssolRCu.d.ts.map +1 -0
  16. package/dist/src/{base-executor-DvWGUVFO.js → base-executor-Cz9W2UYJ.js} +143 -83
  17. package/dist/src/{base-executor-CHjvai1Y.mjs → base-executor-DRwCR9D_.mjs} +144 -84
  18. package/dist/src/base-executor-DRwCR9D_.mjs.map +1 -0
  19. package/dist/src/base-executor.untyped-BULLZb4S.d.ts +7 -0
  20. package/dist/src/base-executor.untyped-BULLZb4S.d.ts.map +1 -0
  21. package/dist/src/executors/build/executor.d.mts +1 -1
  22. package/dist/src/executors/build/executor.d.ts +1 -1
  23. package/dist/src/executors/build/executor.js +1 -1
  24. package/dist/src/executors/build/executor.mjs +1 -1
  25. package/dist/src/executors/build/untyped.d.ts +2 -2
  26. package/dist/src/executors/clean/executor.d.mts +1 -1
  27. package/dist/src/executors/clean/executor.d.ts +1 -1
  28. package/dist/src/executors/clean/executor.js +1 -1
  29. package/dist/src/executors/clean/executor.mjs +1 -1
  30. package/dist/src/executors/docs/executor.d.mts +1 -1
  31. package/dist/src/executors/docs/executor.d.ts +1 -1
  32. package/dist/src/executors/docs/executor.js +1 -1
  33. package/dist/src/executors/docs/executor.mjs +1 -1
  34. package/dist/src/executors/lint/executor.d.mts +1 -1
  35. package/dist/src/executors/lint/executor.d.ts +1 -1
  36. package/dist/src/executors/lint/executor.js +1 -1
  37. package/dist/src/executors/lint/executor.mjs +1 -1
  38. package/dist/src/executors/lint/untyped.d.mts +2 -2
  39. package/dist/src/executors/lint/untyped.d.ts +2 -2
  40. package/dist/src/executors/prepare/executor.d.mts +1 -1
  41. package/dist/src/executors/prepare/executor.d.ts +1 -1
  42. package/dist/src/executors/prepare/executor.js +1 -1
  43. package/dist/src/executors/prepare/executor.mjs +1 -1
  44. package/dist/src/executors/prepare/untyped.d.ts +2 -2
  45. package/dist/src/generators/sync/untyped.d.mts +2 -2
  46. package/dist/src/generators/sync/untyped.d.ts +2 -2
  47. package/dist/src/index.d.mts +1 -1
  48. package/dist/src/index.d.ts +1 -1
  49. package/dist/src/index.js +1 -1
  50. package/dist/src/index.mjs +1 -1
  51. package/package.json +16 -16
  52. package/dist/src/base-executor-CHjvai1Y.mjs.map +0 -1
  53. package/dist/src/base-executor-CTLK6Wbz.mjs.map +0 -1
  54. package/dist/src/base-executor-CsvdsKIS.d.mts.map +0 -1
  55. package/dist/src/base-executor-D0Q1wshU.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CsvdsKIS.mjs";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CDMeDnfo.mjs";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-D0Q1wshU.js";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CssolRCu.js";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,4 +1,4 @@
1
1
  require('../config-CGQhS8tm.js');
2
- const require_base_executor = require('../base-executor-DR0O1sPf.js');
2
+ const require_base_executor = require('../base-executor-Cz9W2UYJ.js');
3
3
 
4
4
  exports.withExecutor = require_base_executor.withExecutor;
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../base-executor-CTLK6Wbz.mjs";
1
+ import { t as withExecutor } from "../base-executor-BKsk8XnS.mjs";
2
2
  import "../config-LoR-NIJg.mjs";
3
3
 
4
4
  export { withExecutor };
@@ -1,4 +1,4 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CsvdsKIS.mjs";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CDMeDnfo.mjs";
2
2
  import "../base-executor.untyped-imww7Gm9.mjs";
3
3
  import "../index-LhFpnU-f.mjs";
4
4
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-D0Q1wshU.js";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CssolRCu.js";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,5 +1,5 @@
1
1
  require('../config-CGQhS8tm.js');
2
- const require_base_executor = require('../base-executor-DR0O1sPf.js');
2
+ const require_base_executor = require('../base-executor-Cz9W2UYJ.js');
3
3
  require('../base-executor.untyped-Cz1Zw_02.js');
4
4
  require('../base-B7jekb-W.js');
5
5
 
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../base-executor-CTLK6Wbz.mjs";
1
+ import { t as withExecutor } from "../base-executor-BKsk8XnS.mjs";
2
2
  import "../config-LoR-NIJg.mjs";
3
3
  import "../base-executor.untyped-C1pQETnQ.mjs";
4
4
  import "../base-BRSa-clf.mjs";
@@ -78,7 +78,7 @@ import { resolve as resolve$1 } from "node:path";
78
78
  import "unplugin";
79
79
 
80
80
  //#region ../powerlines/package.json
81
- var version = "0.40.8";
81
+ var version = "0.40.10";
82
82
 
83
83
  //#endregion
84
84
  //#region ../powerlines/src/typescript/ts-morph.ts
@@ -1820,6 +1820,24 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1820
1820
  }
1821
1821
  };
1822
1822
 
1823
+ //#endregion
1824
+ //#region ../powerlines/src/_internal/helpers/constants.ts
1825
+ const DEFAULT_EXTENSIONS = [
1826
+ "js",
1827
+ "ts",
1828
+ "cjs",
1829
+ "cts",
1830
+ "mjs",
1831
+ "mts",
1832
+ "tsx",
1833
+ "jsx",
1834
+ "json",
1835
+ "json5",
1836
+ "jsonc",
1837
+ "md",
1838
+ "mdx"
1839
+ ];
1840
+
1823
1841
  //#endregion
1824
1842
  //#region ../powerlines/src/_internal/vfs.ts
1825
1843
  function toFilePath(path) {
@@ -1976,6 +1994,113 @@ var VirtualFileSystem = class VirtualFileSystem {
1976
1994
  }));
1977
1995
  }
1978
1996
  /**
1997
+ * A helper function to resolve modules in the virtual file system (VFS).
1998
+ *
1999
+ * @remarks
2000
+ * This function can be used to resolve modules relative to the project root directory.
2001
+ *
2002
+ * @example
2003
+ * ```ts
2004
+ * const resolved = await context.resolvePath("some-module", "/path/to/importer");
2005
+ * ```
2006
+ *
2007
+ * @param id - The module to resolve.
2008
+ * @param importer - An optional path to the importer module.
2009
+ * @param options - Additional resolution options.
2010
+ * @returns A promise that resolves to the resolved module path.
2011
+ */
2012
+ #innerResolve = async (id, importer, options = {}) => {
2013
+ let path = id;
2014
+ if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2015
+ if (options.skipAlias !== true) path = this.resolveAlias(path);
2016
+ if (isAbsolutePath(path)) return path;
2017
+ const resolverCacheKey = murmurhash({
2018
+ path: this.#normalizeId(path),
2019
+ importer,
2020
+ options
2021
+ });
2022
+ let result;
2023
+ if (!this.#context.config.skipCache) {
2024
+ result = this.resolverCache.get(resolverCacheKey);
2025
+ if (result) return result;
2026
+ }
2027
+ result = this.paths[this.#normalizeId(path)];
2028
+ if (!result) {
2029
+ const paths = options.paths ?? [];
2030
+ if (importer && !paths.includes(importer)) paths.push(importer);
2031
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
2032
+ paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2033
+ paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2034
+ 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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2035
+ for (const combination of getResolutionCombinations(path, { paths })) {
2036
+ const { relativeKey, adapter } = this.#getStorage(combination);
2037
+ if (await adapter.exists(relativeKey)) {
2038
+ result = combination;
2039
+ break;
2040
+ }
2041
+ }
2042
+ if (!result) try {
2043
+ result = await resolve(path, {
2044
+ ...options,
2045
+ paths
2046
+ });
2047
+ } catch {}
2048
+ }
2049
+ if (result && !this.#context.config.skipCache) this.resolverCache.set(resolverCacheKey, result);
2050
+ return result;
2051
+ };
2052
+ /**
2053
+ * A synchronous helper function to resolve modules using the Jiti resolver
2054
+ *
2055
+ * @remarks
2056
+ * This function can be used to resolve modules relative to the project root directory.
2057
+ *
2058
+ * @example
2059
+ * ```ts
2060
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
2061
+ * ```
2062
+ *
2063
+ * @param id - The module to resolve.
2064
+ * @param importer - An optional path to the importer module.
2065
+ * @param options - Additional resolution options.
2066
+ * @returns The resolved module path.
2067
+ */
2068
+ #innerResolveSync = (id, importer, options = {}) => {
2069
+ let path = id;
2070
+ if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2071
+ if (options.skipAlias !== true) path = this.resolveAlias(path);
2072
+ if (isAbsolutePath(path)) return path;
2073
+ let result;
2074
+ if (!this.#context.config.skipCache) {
2075
+ result = this.resolverCache.get(this.#normalizeId(path));
2076
+ if (result) return result;
2077
+ }
2078
+ result = this.paths[this.#normalizeId(path)];
2079
+ if (!result) {
2080
+ const paths = options.paths ?? [];
2081
+ if (importer && !paths.includes(importer)) paths.push(importer);
2082
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
2083
+ paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2084
+ paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2085
+ 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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2086
+ for (const combination of getResolutionCombinations(path, { paths })) {
2087
+ const { relativeKey, adapter } = this.#getStorage(combination);
2088
+ if (adapter.existsSync(relativeKey)) {
2089
+ result = combination;
2090
+ break;
2091
+ }
2092
+ }
2093
+ if (!result) try {
2094
+ result = resolveSync(path, {
2095
+ ...options,
2096
+ paths
2097
+ });
2098
+ } catch {}
2099
+ }
2100
+ if (result && !this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
2101
+ return result;
2102
+ };
2103
+ /**
1979
2104
  * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1980
2105
  *
1981
2106
  * @param context - The context of the virtual file system, typically containing options and logging functions.
@@ -2142,6 +2267,8 @@ var VirtualFileSystem = class VirtualFileSystem {
2142
2267
  ...this.#context.config.output.storage
2143
2268
  };
2144
2269
  this.#storage.virtual ??= new VirtualStorageAdapter(context, { base: "/_virtual" });
2270
+ this.#storage[this.#context.config.output.outputPath] ??= new FileSystemStorageAdapter(context, { base: this.#context.config.output.outputPath });
2271
+ this.#storage[this.#context.config.output.buildPath] ??= new FileSystemStorageAdapter(context, { base: this.#context.config.output.buildPath });
2145
2272
  if (this.#context.config.output.storage !== "fs") {
2146
2273
  this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.artifactsPath });
2147
2274
  this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.builtinsPath });
@@ -2445,7 +2572,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2445
2572
  * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
2446
2573
  */
2447
2574
  async read(path) {
2448
- const filePath = await this.resolve(path);
2575
+ const filePath = await this.resolve(path, void 0, { isFile: true });
2449
2576
  if (!filePath || !this.existsSync(filePath)) return;
2450
2577
  const { adapter } = this.#getStorage(filePath);
2451
2578
  this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
@@ -2458,7 +2585,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2458
2585
  * @returns The contents of the file as a string, or undefined if the file does not exist.
2459
2586
  */
2460
2587
  readSync(path) {
2461
- const filePath = this.resolveSync(path);
2588
+ const filePath = this.resolveSync(path, void 0, { isFile: true });
2462
2589
  if (!filePath || !this.existsSync(filePath)) return;
2463
2590
  const { adapter } = this.#getStorage(filePath);
2464
2591
  this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
@@ -2481,21 +2608,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2481
2608
  try {
2482
2609
  if (!options.skipFormat) code = await format$1(this.#context, resolvedPath, data);
2483
2610
  } catch (err) {
2484
- if ([
2485
- "js",
2486
- "ts",
2487
- "cjs",
2488
- "cts",
2489
- "mjs",
2490
- "mts",
2491
- "tsx",
2492
- "jsx",
2493
- "json",
2494
- "json5",
2495
- "jsonc",
2496
- "md",
2497
- "mdx"
2498
- ].includes(findFileExtensionSafe(resolvedPath, { fullExtension: true }))) this.#log(LogLevelLabel.WARN, `Failed to format file ${resolvedPath} before writing: ${err.message}`);
2611
+ if (DEFAULT_EXTENSIONS.includes(findFileExtensionSafe(resolvedPath, { fullExtension: true }))) this.#log(LogLevelLabel.WARN, `Failed to format file ${resolvedPath} before writing: ${err.message}`);
2499
2612
  code = data;
2500
2613
  }
2501
2614
  this.#log(LogLevelLabel.TRACE, `Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob$1(toArray(code)).size)})`);
@@ -2609,43 +2722,14 @@ var VirtualFileSystem = class VirtualFileSystem {
2609
2722
  * @returns A promise that resolves to the resolved module path.
2610
2723
  */
2611
2724
  async resolve(id, importer, options = {}) {
2612
- let path = id;
2613
- if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2614
- if (options.skipAlias !== true) path = this.resolveAlias(path);
2615
- if (isAbsolutePath(path)) return path;
2616
- const resolverCacheKey = murmurhash({
2617
- path: this.#normalizeId(path),
2618
- importer,
2619
- options
2620
- });
2621
- let result;
2622
- if (!this.#context.config.skipCache) {
2623
- result = this.resolverCache.get(resolverCacheKey);
2624
- if (result) return result;
2625
- }
2626
- result = this.paths[this.#normalizeId(path)];
2627
- if (!result) {
2628
- const paths = options.paths ?? [];
2629
- if (importer && !paths.includes(importer)) paths.push(importer);
2630
- paths.push(this.#context.workspaceConfig.workspaceRoot);
2631
- paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2632
- paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2633
- 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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2634
- for (const combination of getResolutionCombinations(path, { paths })) {
2635
- const { relativeKey, adapter } = this.#getStorage(combination);
2636
- if (await adapter.exists(relativeKey)) {
2637
- result = combination;
2638
- break;
2639
- }
2725
+ let result = await this.#innerResolve(id, importer, options);
2726
+ if (result && options.isFile && await this.isDirectory(result) && !hasFileExtension(result)) {
2727
+ for (const ext of DEFAULT_EXTENSIONS) {
2728
+ result = await this.resolve(`${result}.${ext}`, importer, options);
2729
+ if (result) return result;
2640
2730
  }
2641
- if (!result) try {
2642
- result = await resolve(path, {
2643
- ...options,
2644
- paths
2645
- });
2646
- } catch {}
2731
+ return;
2647
2732
  }
2648
- if (result && !this.#context.config.skipCache) this.resolverCache.set(resolverCacheKey, result);
2649
2733
  return result;
2650
2734
  }
2651
2735
  /**
@@ -2665,38 +2749,14 @@ var VirtualFileSystem = class VirtualFileSystem {
2665
2749
  * @returns The resolved module path.
2666
2750
  */
2667
2751
  resolveSync(id, importer, options = {}) {
2668
- let path = id;
2669
- if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2670
- if (options.skipAlias !== true) path = this.resolveAlias(path);
2671
- if (isAbsolutePath(path)) return path;
2672
- let result;
2673
- if (!this.#context.config.skipCache) {
2674
- result = this.resolverCache.get(this.#normalizeId(path));
2675
- if (result) return result;
2676
- }
2677
- result = this.paths[this.#normalizeId(path)];
2678
- if (!result) {
2679
- const paths = options.paths ?? [];
2680
- if (importer && !paths.includes(importer)) paths.push(importer);
2681
- paths.push(this.#context.workspaceConfig.workspaceRoot);
2682
- paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2683
- paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2684
- 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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2685
- for (const combination of getResolutionCombinations(path, { paths })) {
2686
- const { relativeKey, adapter } = this.#getStorage(combination);
2687
- if (adapter.existsSync(relativeKey)) {
2688
- result = combination;
2689
- break;
2690
- }
2752
+ let result = this.#innerResolveSync(id, importer, options);
2753
+ if (result && options.isFile && this.isDirectorySync(result) && !hasFileExtension(result)) {
2754
+ for (const ext of DEFAULT_EXTENSIONS) {
2755
+ result = this.resolveSync(`${result}.${ext}`, importer, options);
2756
+ if (result) return result;
2691
2757
  }
2692
- if (!result) try {
2693
- result = resolveSync(path, {
2694
- ...options,
2695
- paths
2696
- });
2697
- } catch {}
2758
+ return;
2698
2759
  }
2699
- if (result && !this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
2700
2760
  return result;
2701
2761
  }
2702
2762
  /**
@@ -4736,4 +4796,4 @@ ${error.stack}` : "Unknown error"}`);
4736
4796
 
4737
4797
  //#endregion
4738
4798
  export { withExecutor as t };
4739
- //# sourceMappingURL=base-executor-CTLK6Wbz.mjs.map
4799
+ //# sourceMappingURL=base-executor-BKsk8XnS.mjs.map