powerlines 0.40.21 → 0.41.2

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/README.md +1 -1
  2. package/dist/{api-BtT0v28K.mjs → api-D5vRsf8r.mjs} +76 -23
  3. package/dist/api-D5vRsf8r.mjs.map +1 -0
  4. package/dist/{api-D-4_dQRX.cjs → api-uQhWlth_.cjs} +75 -22
  5. package/dist/astro.cjs +2 -2
  6. package/dist/astro.mjs +2 -2
  7. package/dist/context/index.cjs +1 -1
  8. package/dist/context/index.mjs +1 -1
  9. package/dist/{esbuild-bRKMe1JD.mjs → esbuild-BfCpnSO-.mjs} +2 -2
  10. package/dist/{esbuild-bRKMe1JD.mjs.map → esbuild-BfCpnSO-.mjs.map} +1 -1
  11. package/dist/{esbuild-BhLG9GPh.cjs → esbuild-DvRmtvnR.cjs} +1 -1
  12. package/dist/esbuild.cjs +2 -2
  13. package/dist/esbuild.mjs +2 -2
  14. package/dist/farm.cjs +1 -1
  15. package/dist/farm.mjs +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.mjs +1 -1
  18. package/dist/next.cjs +2 -2
  19. package/dist/next.mjs +2 -2
  20. package/dist/nuxt.cjs +3 -3
  21. package/dist/nuxt.mjs +3 -3
  22. package/dist/plugin-utils.d.cts +9 -9
  23. package/dist/plugin-utils.d.cts.map +1 -1
  24. package/dist/plugin-utils.d.mts +2 -2
  25. package/dist/plugin-utils.d.mts.map +1 -1
  26. package/dist/{rolldown-C4QhBFIU.mjs → rolldown-B3cFjwXl.mjs} +2 -2
  27. package/dist/{rolldown-C4QhBFIU.mjs.map → rolldown-B3cFjwXl.mjs.map} +1 -1
  28. package/dist/{rolldown-Dgcu2_Qi.cjs → rolldown-CFar-4ye.cjs} +1 -1
  29. package/dist/rolldown.cjs +2 -2
  30. package/dist/rolldown.mjs +2 -2
  31. package/dist/rollup.cjs +1 -1
  32. package/dist/rollup.mjs +1 -1
  33. package/dist/rspack.cjs +1 -1
  34. package/dist/rspack.mjs +1 -1
  35. package/dist/storage/index.d.cts.map +1 -1
  36. package/dist/tsdown.cjs +2 -2
  37. package/dist/tsdown.mjs +2 -2
  38. package/dist/tsup.cjs +2 -2
  39. package/dist/tsup.mjs +2 -2
  40. package/dist/unloader.cjs +1 -1
  41. package/dist/unloader.mjs +1 -1
  42. package/dist/unplugin.cjs +1 -1
  43. package/dist/unplugin.mjs +1 -1
  44. package/dist/{vite-uXQWIWdY.mjs → vite-DQZ929w1.mjs} +2 -2
  45. package/dist/{vite-uXQWIWdY.mjs.map → vite-DQZ929w1.mjs.map} +1 -1
  46. package/dist/{vite-DmBSriVs.cjs → vite-PiiCpqZ4.cjs} +1 -1
  47. package/dist/vite.cjs +2 -2
  48. package/dist/vite.mjs +2 -2
  49. package/dist/{webpack-N9RxJ_s0.mjs → webpack-Dpnlx4Z6.mjs} +2 -2
  50. package/dist/{webpack-N9RxJ_s0.mjs.map → webpack-Dpnlx4Z6.mjs.map} +1 -1
  51. package/dist/{webpack-Dn1pjhRP.cjs → webpack-UEi2fVN4.cjs} +1 -1
  52. package/dist/webpack.cjs +2 -2
  53. package/dist/webpack.mjs +2 -2
  54. package/package.json +16 -15
  55. package/dist/api-BtT0v28K.mjs.map +0 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.40.19-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.40.21-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -66,11 +66,12 @@ import { isAbsolutePath } from "@stryke/path/is-type";
66
66
  import { slash } from "@stryke/path/slash";
67
67
  import { Blob as Blob$1 } from "node:buffer";
68
68
  import { fileURLToPath } from "node:url";
69
+ import { ResolverFactory } from "oxc-resolver";
69
70
  import { setParseImpl } from "unplugin";
70
71
 
71
72
  //#region package.json
72
73
  var name = "powerlines";
73
- var version = "0.40.21";
74
+ var version = "0.41.2";
74
75
 
75
76
  //#endregion
76
77
  //#region src/_internal/helpers/generate-types.ts
@@ -758,6 +759,12 @@ var VirtualFileSystem = class VirtualFileSystem {
758
759
  */
759
760
  #storage;
760
761
  /**
762
+ * The resolver factory used during module resolution within the virtual file system.
763
+ *
764
+ * @see https://github.com/oxc-project/oxc-resolver
765
+ */
766
+ #resolver;
767
+ /**
761
768
  * A cache for module resolution results.
762
769
  */
763
770
  #resolverCache;
@@ -884,12 +891,22 @@ var VirtualFileSystem = class VirtualFileSystem {
884
891
  break;
885
892
  }
886
893
  }
887
- if (!result) try {
888
- result = await resolve(path, {
889
- ...options,
890
- paths
891
- });
892
- } catch {}
894
+ if (!result) {
895
+ try {
896
+ result = await resolve(path, {
897
+ ...options,
898
+ paths
899
+ });
900
+ } catch {}
901
+ if (!result) {
902
+ let index = 0;
903
+ do {
904
+ const resolveResult = await this.resolver.async((paths.length > index ? paths[index] : void 0) || this.#context.config.root, path);
905
+ if (resolveResult.path) result = resolveResult.path;
906
+ index++;
907
+ } while (!result && index < paths.length);
908
+ }
909
+ }
893
910
  }
894
911
  if (result && !this.#context.config.skipCache) this.resolverCache.set(resolverCacheKey, result);
895
912
  return result;
@@ -937,12 +954,22 @@ var VirtualFileSystem = class VirtualFileSystem {
937
954
  break;
938
955
  }
939
956
  }
940
- if (!result) try {
941
- result = resolveSync(path, {
942
- ...options,
943
- paths
944
- });
945
- } catch {}
957
+ if (!result) {
958
+ try {
959
+ result = resolveSync(path, {
960
+ ...options,
961
+ paths
962
+ });
963
+ } catch {}
964
+ if (!result) {
965
+ let index = 0;
966
+ do {
967
+ const resolveResult = this.resolver.sync((paths.length > index ? paths[index] : void 0) || this.#context.config.root, path);
968
+ if (resolveResult.path) result = resolveResult.path;
969
+ index++;
970
+ } while (!result && index < paths.length);
971
+ }
972
+ }
946
973
  }
947
974
  if (result && !this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
948
975
  return result;
@@ -1101,6 +1128,30 @@ var VirtualFileSystem = class VirtualFileSystem {
1101
1128
  return this.#resolverCache;
1102
1129
  }
1103
1130
  /**
1131
+ * The resolver factory used during module resolution within the virtual file system.
1132
+ *
1133
+ * @remarks
1134
+ * This resolver is configured with the workspace root, project root, TypeScript configuration, alias mappings, and other resolution options specified in the context. It is lazily initialized on first access to optimize performance.
1135
+ *
1136
+ * @see https://github.com/oxc-project/oxc-resolver
1137
+ */
1138
+ get resolver() {
1139
+ if (!this.#resolver) this.#resolver = new ResolverFactory({
1140
+ roots: [this.#context.workspaceConfig.workspaceRoot, appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot)],
1141
+ tsconfig: {
1142
+ configFile: this.#context.tsconfig.tsconfigFilePath,
1143
+ references: this.#context.tsconfig.projectReferences && this.#context.tsconfig.projectReferences.length > 0 ? "auto" : void 0
1144
+ },
1145
+ alias: Object.fromEntries(Object.entries(this.#context.alias).map(([key, value]) => [key, [value]])),
1146
+ extensions: this.#context.config.resolve.extensions,
1147
+ mainFields: this.#context.config.resolve.mainFields,
1148
+ conditionNames: this.#context.config.resolve.conditions,
1149
+ symlinks: this.#context.config.resolve.preserveSymlinks,
1150
+ allowPackageExportsInDirectoryResolve: true
1151
+ });
1152
+ return this.#resolver;
1153
+ }
1154
+ /**
1104
1155
  * Creates a new instance of the {@link VirtualFileSystem}.
1105
1156
  *
1106
1157
  * @param context - The context of the virtual file system, typically containing options and logging functions.
@@ -2643,11 +2694,13 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
2643
2694
  const ctx = context;
2644
2695
  return {
2645
2696
  async resolveId(id, importer, opts = { isEntry: false }) {
2697
+ const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
2698
+ const normalizedImporter = importer ? importer.replace(VIRTUAL_MODULE_PREFIX_REGEX, "") : void 0;
2646
2699
  let result = await ctx.$$internal.callHook("resolveId", {
2647
2700
  sequential: true,
2648
2701
  result: "first",
2649
2702
  order: "pre"
2650
- }, id, importer, opts);
2703
+ }, normalizedId, normalizedImporter, opts);
2651
2704
  if (isSetString(result)) return result;
2652
2705
  else if (isSetObject(result)) return {
2653
2706
  ...result,
@@ -2657,13 +2710,13 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
2657
2710
  sequential: true,
2658
2711
  result: "first",
2659
2712
  order: "normal"
2660
- }, id, importer, opts);
2713
+ }, normalizedId, normalizedImporter, opts);
2661
2714
  if (isSetString(result)) return result;
2662
2715
  else if (isSetObject(result)) return {
2663
2716
  ...result,
2664
2717
  id: result.virtual && options.prefix !== false ? `${VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
2665
2718
  };
2666
- result = await ctx.resolve(id, importer, {
2719
+ result = await ctx.resolve(normalizedId, normalizedImporter, {
2667
2720
  isFile: true,
2668
2721
  ...opts
2669
2722
  });
@@ -2675,7 +2728,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
2675
2728
  sequential: true,
2676
2729
  result: "first",
2677
2730
  order: "post"
2678
- }, id, importer, opts);
2731
+ }, normalizedId, normalizedImporter, opts);
2679
2732
  if (isSetString(result)) return result;
2680
2733
  else if (isSetObject(result)) return {
2681
2734
  ...result,
@@ -2686,26 +2739,26 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
2686
2739
  load: {
2687
2740
  filter: options.prefix !== false ? { id: { include: [VIRTUAL_MODULE_PREFIX_REGEX] } } : void 0,
2688
2741
  async handler(id) {
2689
- const moduleId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
2742
+ const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
2690
2743
  let result = await ctx.$$internal.callHook("load", {
2691
2744
  sequential: true,
2692
2745
  result: "first",
2693
2746
  order: "pre"
2694
- }, moduleId);
2747
+ }, normalizedId);
2695
2748
  if (result) return result;
2696
2749
  result = await ctx.$$internal.callHook("load", {
2697
2750
  sequential: true,
2698
2751
  result: "first",
2699
2752
  order: "normal"
2700
- }, moduleId);
2753
+ }, normalizedId);
2701
2754
  if (result) return result;
2702
- result = await ctx.load(moduleId);
2755
+ result = await ctx.load(normalizedId);
2703
2756
  if (result) return result;
2704
2757
  return ctx.$$internal.callHook("load", {
2705
2758
  sequential: true,
2706
2759
  result: "first",
2707
2760
  order: "post"
2708
- }, moduleId);
2761
+ }, normalizedId);
2709
2762
  }
2710
2763
  }
2711
2764
  };
@@ -3848,4 +3901,4 @@ Note: Please ensure the plugin package's default export is a class that extends
3848
3901
 
3849
3902
  //#endregion
3850
3903
  export { _capnpFileId as _, createUnpluginFactory as a, createUnpluginModuleResolutionFunctions as c, PowerlinesContext as d, FileId as f, FileSystem as g, FileStorage as h, createPluginContext as i, combineContexts as l, FileMetadata_KeyValuePair as m, PowerlinesAPIContext as n, createUnplugin as o, FileMetadata as p, PowerlinesEnvironmentContext as r, createUnpluginResolver as s, PowerlinesAPI as t, isUnpluginBuilderVariant as u, name as v, version as y };
3851
- //# sourceMappingURL=api-BtT0v28K.mjs.map
3904
+ //# sourceMappingURL=api-D5vRsf8r.mjs.map