@powerlines/nx 0.11.250 → 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 (60) 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-Cng3H0co.mjs → base-executor-BKsk8XnS.mjs} +142 -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-C8b3Jrmp.js → base-executor-CHSFUzU2.js} +140 -82
  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-C_eSw2CH.js → base-executor-Cz9W2UYJ.js} +141 -83
  17. package/dist/src/{base-executor-BX0xduN1.mjs → base-executor-DRwCR9D_.mjs} +141 -83
  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.mts +2 -2
  26. package/dist/src/executors/build/untyped.d.ts +2 -2
  27. package/dist/src/executors/clean/executor.d.mts +1 -1
  28. package/dist/src/executors/clean/executor.d.ts +1 -1
  29. package/dist/src/executors/clean/executor.js +1 -1
  30. package/dist/src/executors/clean/executor.mjs +1 -1
  31. package/dist/src/executors/clean/untyped.d.mts +2 -2
  32. package/dist/src/executors/clean/untyped.d.ts +2 -2
  33. package/dist/src/executors/docs/executor.d.mts +1 -1
  34. package/dist/src/executors/docs/executor.d.ts +1 -1
  35. package/dist/src/executors/docs/executor.js +1 -1
  36. package/dist/src/executors/docs/executor.mjs +1 -1
  37. package/dist/src/executors/docs/untyped.d.mts +2 -2
  38. package/dist/src/executors/docs/untyped.d.ts +2 -2
  39. package/dist/src/executors/lint/executor.d.mts +1 -1
  40. package/dist/src/executors/lint/executor.d.ts +1 -1
  41. package/dist/src/executors/lint/executor.js +1 -1
  42. package/dist/src/executors/lint/executor.mjs +1 -1
  43. package/dist/src/executors/lint/untyped.d.mts +2 -2
  44. package/dist/src/executors/lint/untyped.d.ts +2 -2
  45. package/dist/src/executors/prepare/executor.d.mts +1 -1
  46. package/dist/src/executors/prepare/executor.d.ts +1 -1
  47. package/dist/src/executors/prepare/executor.js +1 -1
  48. package/dist/src/executors/prepare/executor.mjs +1 -1
  49. package/dist/src/executors/prepare/untyped.d.mts +2 -2
  50. package/dist/src/generators/sync/untyped.d.mts +2 -2
  51. package/dist/src/generators/sync/untyped.d.ts +2 -2
  52. package/dist/src/index.d.mts +1 -1
  53. package/dist/src/index.d.ts +1 -1
  54. package/dist/src/index.js +1 -1
  55. package/dist/src/index.mjs +1 -1
  56. package/package.json +16 -16
  57. package/dist/src/base-executor-BX0xduN1.mjs.map +0 -1
  58. package/dist/src/base-executor-Cng3H0co.mjs.map +0 -1
  59. package/dist/src/base-executor-CsvdsKIS.d.mts.map +0 -1
  60. 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-C8b3Jrmp.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-BX0xduN1.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-C8b3Jrmp.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-BX0xduN1.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.
@@ -2447,7 +2572,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2447
2572
  * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
2448
2573
  */
2449
2574
  async read(path) {
2450
- const filePath = await this.resolve(path);
2575
+ const filePath = await this.resolve(path, void 0, { isFile: true });
2451
2576
  if (!filePath || !this.existsSync(filePath)) return;
2452
2577
  const { adapter } = this.#getStorage(filePath);
2453
2578
  this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
@@ -2460,7 +2585,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2460
2585
  * @returns The contents of the file as a string, or undefined if the file does not exist.
2461
2586
  */
2462
2587
  readSync(path) {
2463
- const filePath = this.resolveSync(path);
2588
+ const filePath = this.resolveSync(path, void 0, { isFile: true });
2464
2589
  if (!filePath || !this.existsSync(filePath)) return;
2465
2590
  const { adapter } = this.#getStorage(filePath);
2466
2591
  this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
@@ -2483,21 +2608,7 @@ var VirtualFileSystem = class VirtualFileSystem {
2483
2608
  try {
2484
2609
  if (!options.skipFormat) code = await format$1(this.#context, resolvedPath, data);
2485
2610
  } catch (err) {
2486
- if ([
2487
- "js",
2488
- "ts",
2489
- "cjs",
2490
- "cts",
2491
- "mjs",
2492
- "mts",
2493
- "tsx",
2494
- "jsx",
2495
- "json",
2496
- "json5",
2497
- "jsonc",
2498
- "md",
2499
- "mdx"
2500
- ].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}`);
2501
2612
  code = data;
2502
2613
  }
2503
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)})`);
@@ -2611,43 +2722,14 @@ var VirtualFileSystem = class VirtualFileSystem {
2611
2722
  * @returns A promise that resolves to the resolved module path.
2612
2723
  */
2613
2724
  async resolve(id, importer, options = {}) {
2614
- let path = id;
2615
- if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2616
- if (options.skipAlias !== true) path = this.resolveAlias(path);
2617
- if (isAbsolutePath(path)) return path;
2618
- const resolverCacheKey = murmurhash({
2619
- path: this.#normalizeId(path),
2620
- importer,
2621
- options
2622
- });
2623
- let result;
2624
- if (!this.#context.config.skipCache) {
2625
- result = this.resolverCache.get(resolverCacheKey);
2626
- if (result) return result;
2627
- }
2628
- result = this.paths[this.#normalizeId(path)];
2629
- if (!result) {
2630
- const paths = options.paths ?? [];
2631
- if (importer && !paths.includes(importer)) paths.push(importer);
2632
- paths.push(this.#context.workspaceConfig.workspaceRoot);
2633
- paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2634
- paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2635
- 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)));
2636
- for (const combination of getResolutionCombinations(path, { paths })) {
2637
- const { relativeKey, adapter } = this.#getStorage(combination);
2638
- if (await adapter.exists(relativeKey)) {
2639
- result = combination;
2640
- break;
2641
- }
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;
2642
2730
  }
2643
- if (!result) try {
2644
- result = await resolve(path, {
2645
- ...options,
2646
- paths
2647
- });
2648
- } catch {}
2731
+ return;
2649
2732
  }
2650
- if (result && !this.#context.config.skipCache) this.resolverCache.set(resolverCacheKey, result);
2651
2733
  return result;
2652
2734
  }
2653
2735
  /**
@@ -2667,38 +2749,14 @@ var VirtualFileSystem = class VirtualFileSystem {
2667
2749
  * @returns The resolved module path.
2668
2750
  */
2669
2751
  resolveSync(id, importer, options = {}) {
2670
- let path = id;
2671
- if (path.includes("{") || path.includes("}")) path = replacePathTokens(this.#context, path);
2672
- if (options.skipAlias !== true) path = this.resolveAlias(path);
2673
- if (isAbsolutePath(path)) return path;
2674
- let result;
2675
- if (!this.#context.config.skipCache) {
2676
- result = this.resolverCache.get(this.#normalizeId(path));
2677
- if (result) return result;
2678
- }
2679
- result = this.paths[this.#normalizeId(path)];
2680
- if (!result) {
2681
- const paths = options.paths ?? [];
2682
- if (importer && !paths.includes(importer)) paths.push(importer);
2683
- paths.push(this.#context.workspaceConfig.workspaceRoot);
2684
- paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
2685
- paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
2686
- 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)));
2687
- for (const combination of getResolutionCombinations(path, { paths })) {
2688
- const { relativeKey, adapter } = this.#getStorage(combination);
2689
- if (adapter.existsSync(relativeKey)) {
2690
- result = combination;
2691
- break;
2692
- }
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;
2693
2757
  }
2694
- if (!result) try {
2695
- result = resolveSync(path, {
2696
- ...options,
2697
- paths
2698
- });
2699
- } catch {}
2758
+ return;
2700
2759
  }
2701
- if (result && !this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
2702
2760
  return result;
2703
2761
  }
2704
2762
  /**
@@ -4738,4 +4796,4 @@ ${error.stack}` : "Unknown error"}`);
4738
4796
 
4739
4797
  //#endregion
4740
4798
  export { withExecutor as t };
4741
- //# sourceMappingURL=base-executor-Cng3H0co.mjs.map
4799
+ //# sourceMappingURL=base-executor-BKsk8XnS.mjs.map