powerlines 0.42.8 → 0.42.10

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 (45) hide show
  1. package/dist/{api-D0jVyqAA.mjs → api-1pXTf_83.mjs} +38 -89
  2. package/dist/api-1pXTf_83.mjs.map +1 -0
  3. package/dist/{api-BvBO12z0.cjs → api-COmAT3Wz.cjs} +37 -88
  4. package/dist/astro.cjs +1 -1
  5. package/dist/astro.mjs +1 -1
  6. package/dist/context/index.cjs +1 -1
  7. package/dist/context/index.d.cts +1 -1
  8. package/dist/context/index.d.cts.map +1 -1
  9. package/dist/context/index.d.mts +1 -1
  10. package/dist/context/index.d.mts.map +1 -1
  11. package/dist/context/index.mjs +1 -1
  12. package/dist/esbuild.cjs +1 -1
  13. package/dist/esbuild.mjs +1 -1
  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.d.cts +2 -2
  18. package/dist/index.d.cts.map +1 -1
  19. package/dist/index.d.mts +2 -2
  20. package/dist/index.d.mts.map +1 -1
  21. package/dist/index.mjs +1 -1
  22. package/dist/next.cjs +1 -1
  23. package/dist/next.mjs +1 -1
  24. package/dist/nuxt.cjs +1 -1
  25. package/dist/nuxt.mjs +1 -1
  26. package/dist/rolldown.cjs +1 -1
  27. package/dist/rolldown.mjs +1 -1
  28. package/dist/rollup.cjs +1 -1
  29. package/dist/rollup.mjs +1 -1
  30. package/dist/rspack.cjs +1 -1
  31. package/dist/rspack.mjs +1 -1
  32. package/dist/tsdown.cjs +1 -1
  33. package/dist/tsdown.mjs +1 -1
  34. package/dist/tsup.cjs +1 -1
  35. package/dist/tsup.mjs +1 -1
  36. package/dist/unloader.cjs +1 -1
  37. package/dist/unloader.mjs +1 -1
  38. package/dist/unplugin.cjs +1 -1
  39. package/dist/unplugin.mjs +1 -1
  40. package/dist/vite.cjs +1 -1
  41. package/dist/vite.mjs +1 -1
  42. package/dist/webpack.cjs +1 -1
  43. package/dist/webpack.mjs +1 -1
  44. package/package.json +17 -17
  45. package/dist/api-D0jVyqAA.mjs.map +0 -1
@@ -66,14 +66,13 @@ 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";
70
69
  import { createLog } from "@powerlines/core/lib/logger";
71
70
  import { getString } from "@powerlines/core/lib/utilities/source-file";
72
71
  import { setParseImpl } from "unplugin";
73
72
 
74
73
  //#region package.json
75
74
  var name = "powerlines";
76
- var version = "0.42.8";
75
+ var version = "0.42.9";
77
76
 
78
77
  //#endregion
79
78
  //#region src/_internal/helpers/generate-types.ts
@@ -296,7 +295,7 @@ async function writeMetaFile(context) {
296
295
  //#endregion
297
296
  //#region src/_internal/helpers/resolve-tsconfig.ts
298
297
  function getTsconfigDtsPath(context) {
299
- return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.typegenPath)), findFileName(context.typegenPath));
298
+ return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.typesPath)), findFileName(context.typesPath));
300
299
  }
301
300
  async function resolveTsconfigChanges(context) {
302
301
  const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
@@ -304,7 +303,7 @@ async function resolveTsconfigChanges(context) {
304
303
  tsconfigJson.compilerOptions ??= {};
305
304
  if (context.config.output.dts !== false) {
306
305
  const dtsRelativePath = getTsconfigDtsPath(context);
307
- if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typegenPath, dtsRelativePath]))) {
306
+ if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath]))) {
308
307
  tsconfigJson.include ??= [];
309
308
  tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
310
309
  }
@@ -761,12 +760,6 @@ var VirtualFileSystem = class VirtualFileSystem {
761
760
  */
762
761
  #storage;
763
762
  /**
764
- * The resolver factory used during module resolution within the virtual file system.
765
- *
766
- * @see https://github.com/oxc-project/oxc-resolver
767
- */
768
- #resolver;
769
- /**
770
763
  * A cache for module resolution results.
771
764
  */
772
765
  #resolverCache;
@@ -893,22 +886,12 @@ var VirtualFileSystem = class VirtualFileSystem {
893
886
  break;
894
887
  }
895
888
  }
896
- if (!result) {
897
- try {
898
- result = await resolve(path, {
899
- ...options,
900
- paths
901
- });
902
- } catch {}
903
- if (!result) {
904
- let index = 0;
905
- do {
906
- const resolveResult = await this.resolver.async((paths.length > index ? paths[index] : void 0) || this.#context.config.root, path);
907
- if (resolveResult.path) result = resolveResult.path;
908
- index++;
909
- } while (!result && index < paths.length);
910
- }
911
- }
889
+ if (!result) try {
890
+ result = await resolve(path, {
891
+ ...options,
892
+ paths
893
+ });
894
+ } catch {}
912
895
  }
913
896
  if (result && !this.#context.config.skipCache) this.resolverCache.set(resolverCacheKey, result);
914
897
  return result;
@@ -956,22 +939,12 @@ var VirtualFileSystem = class VirtualFileSystem {
956
939
  break;
957
940
  }
958
941
  }
959
- if (!result) {
960
- try {
961
- result = resolveSync(path, {
962
- ...options,
963
- paths
964
- });
965
- } catch {}
966
- if (!result) {
967
- let index = 0;
968
- do {
969
- const resolveResult = this.resolver.sync((paths.length > index ? paths[index] : void 0) || this.#context.config.root, path);
970
- if (resolveResult.path) result = resolveResult.path;
971
- index++;
972
- } while (!result && index < paths.length);
973
- }
974
- }
942
+ if (!result) try {
943
+ result = resolveSync(path, {
944
+ ...options,
945
+ paths
946
+ });
947
+ } catch {}
975
948
  }
976
949
  if (result && !this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
977
950
  return result;
@@ -1130,30 +1103,6 @@ var VirtualFileSystem = class VirtualFileSystem {
1130
1103
  return this.#resolverCache;
1131
1104
  }
1132
1105
  /**
1133
- * The resolver factory used during module resolution within the virtual file system.
1134
- *
1135
- * @remarks
1136
- * 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.
1137
- *
1138
- * @see https://github.com/oxc-project/oxc-resolver
1139
- */
1140
- get resolver() {
1141
- if (!this.#resolver) this.#resolver = new ResolverFactory({
1142
- roots: [this.#context.workspaceConfig.workspaceRoot, appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot)],
1143
- tsconfig: {
1144
- configFile: this.#context.tsconfig.tsconfigFilePath,
1145
- references: this.#context.tsconfig.projectReferences && this.#context.tsconfig.projectReferences.length > 0 ? "auto" : void 0
1146
- },
1147
- alias: Object.fromEntries(Object.entries(this.#context.alias).map(([key, value]) => [key, [value]])),
1148
- extensions: this.#context.config.resolve.extensions,
1149
- mainFields: this.#context.config.resolve.mainFields,
1150
- conditionNames: this.#context.config.resolve.conditions,
1151
- symlinks: this.#context.config.resolve.preserveSymlinks,
1152
- allowPackageExportsInDirectoryResolve: true
1153
- });
1154
- return this.#resolver;
1155
- }
1156
- /**
1157
1106
  * Creates a new instance of the {@link VirtualFileSystem}.
1158
1107
  *
1159
1108
  * @param context - The context of the virtual file system, typically containing options and logging functions.
@@ -1771,7 +1720,7 @@ var PowerlinesContext = class PowerlinesContext {
1771
1720
  }, { output: config.framework ? {
1772
1721
  artifactsPath: `.${config.framework ?? "powerlines"}`,
1773
1722
  dts: true,
1774
- typegen: joinPaths$1(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
1723
+ types: joinPaths$1(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
1775
1724
  } : {} });
1776
1725
  }
1777
1726
  /**
@@ -1980,8 +1929,8 @@ var PowerlinesContext = class PowerlinesContext {
1980
1929
  /**
1981
1930
  * Get the path to the generated declaration file for the project
1982
1931
  */
1983
- get typegenPath() {
1984
- return this.config.output.typegen ? appendPath(this.config.output.typegen, this.workspaceConfig.workspaceRoot) : joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
1932
+ get typesPath() {
1933
+ return this.config.output.types ? appendPath(this.config.output.types, this.workspaceConfig.workspaceRoot) : joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
1985
1934
  }
1986
1935
  /**
1987
1936
  * Get the project root relative to the workspace root
@@ -2594,7 +2543,7 @@ var PowerlinesContext = class PowerlinesContext {
2594
2543
  ] },
2595
2544
  artifactsPath: `.${config.framework ?? "powerlines"}`,
2596
2545
  dts: true,
2597
- typegen: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`)
2546
+ types: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`)
2598
2547
  })
2599
2548
  }, options.isHighPriority ? {} : this.#getConfigProps(config), {
2600
2549
  inlineConfig: {},
@@ -2617,7 +2566,7 @@ var PowerlinesContext = class PowerlinesContext {
2617
2566
  if (this.config.resolve.external) this.config.resolve.external = getUnique(this.config.resolve.external);
2618
2567
  if (this.config.resolve.noExternal) this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
2619
2568
  this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
2620
- if (this.config.output.dts !== false && !this.config.output.typegen) this.config.output.typegen = `${this.config.root ? `${this.config.root}/` : ""}${this.config.framework ?? "powerlines"}.d.ts`;
2569
+ if (this.config.output.dts !== false && !this.config.output.types) this.config.output.types = `${this.config.root ? `${this.config.root}/` : ""}${this.config.framework ?? "powerlines"}.d.ts`;
2621
2570
  if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) this.config.output.path ??= joinPaths$1(this.config.root, "dist");
2622
2571
  else this.config.output.path ??= "dist";
2623
2572
  if (this.config.root && this.config.output.copy !== false) this.config.output.copy = {
@@ -2638,8 +2587,8 @@ var PowerlinesContext = class PowerlinesContext {
2638
2587
  return ret;
2639
2588
  }, []);
2640
2589
  if (this.config.tsconfig) this.config.tsconfig = (0, plugin_utils_exports.replacePathTokens)(this, this.config.tsconfig);
2641
- if (this.config.output.typegen) if (isSetString(this.config.output.typegen)) this.config.output.typegen = (0, plugin_utils_exports.replacePathTokens)(this, this.config.output.typegen);
2642
- else this.config.output.typegen = joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2590
+ if (this.config.output.types) if (isSetString(this.config.output.types)) this.config.output.types = (0, plugin_utils_exports.replacePathTokens)(this, this.config.output.types);
2591
+ else this.config.output.types = joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2643
2592
  if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
2644
2593
  ...asset,
2645
2594
  glob: (0, plugin_utils_exports.replacePathTokens)(this, asset.glob),
@@ -3236,12 +3185,12 @@ var PowerlinesAPI = class PowerlinesAPI {
3236
3185
  * @remarks
3237
3186
  * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.
3238
3187
  *
3239
- * @param inlineConfig - The inline configuration for the typegen command
3188
+ * @param inlineConfig - The inline configuration for the types command
3240
3189
  */
3241
- async typegen(inlineConfig = { command: "typegen" }) {
3190
+ async types(inlineConfig = { command: "types" }) {
3242
3191
  this.context.info(" 🏗️ Generating typescript declarations for the Powerlines project");
3243
3192
  this.context.debug(" Aggregating configuration options for the Powerlines project");
3244
- inlineConfig.command ??= "typegen";
3193
+ inlineConfig.command ??= "types";
3245
3194
  await this.context.withInlineConfig(inlineConfig);
3246
3195
  await this.#executeEnvironments(async (context) => {
3247
3196
  context.debug(`Initializing the processing options for the Powerlines project.`);
@@ -3270,13 +3219,13 @@ var PowerlinesAPI = class PowerlinesAPI {
3270
3219
  })}`);
3271
3220
  if (!context.fs.existsSync(context.cachePath)) await createDirectory(context.cachePath);
3272
3221
  if (!context.fs.existsSync(context.dataPath)) await createDirectory(context.dataPath);
3273
- await this.#typegen(context);
3274
- this.context.debug("Formatting files generated during the typegen step.");
3275
- await (0, utils_exports.format)(context, context.typegenPath, await context.fs.read(context.typegenPath) ?? "");
3222
+ await this.#types(context);
3223
+ this.context.debug("Formatting files generated during the types step.");
3224
+ await (0, utils_exports.format)(context, context.typesPath, await context.fs.read(context.typesPath) ?? "");
3276
3225
  await writeMetaFile(context);
3277
3226
  context.persistedMeta = context.meta;
3278
3227
  });
3279
- this.context.debug("✔ Powerlines typegen has completed successfully");
3228
+ this.context.debug("✔ Powerlines types generation has completed successfully");
3280
3229
  }
3281
3230
  /**
3282
3231
  * Prepare the Powerlines API
@@ -3330,7 +3279,7 @@ var PowerlinesAPI = class PowerlinesAPI {
3330
3279
  environment: context,
3331
3280
  order: "post"
3332
3281
  });
3333
- if (context.config.output.typegen !== false) await this.#typegen(context);
3282
+ if (context.config.output.types !== false) await this.#types(context);
3334
3283
  this.context.debug("Formatting files generated during the prepare step.");
3335
3284
  await Promise.all([(0, utils_exports.formatFolder)(context, context.builtinsPath), (0, utils_exports.formatFolder)(context, context.entryPath)]);
3336
3285
  await writeMetaFile(context);
@@ -3705,9 +3654,9 @@ Note: Please ensure the plugin package's default export is a class that extends
3705
3654
  * @param context - The environment context to use for generating the TypeScript declaration file
3706
3655
  * @returns A promise that resolves when the TypeScript declaration file has been generated
3707
3656
  */
3708
- async #typegen(context) {
3657
+ async #types(context) {
3709
3658
  context.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
3710
- if (context.fs.existsSync(context.typegenPath)) await context.fs.remove(context.typegenPath);
3659
+ if (context.fs.existsSync(context.typesPath)) await context.fs.remove(context.typesPath);
3711
3660
  if (!await resolvePackage("typescript")) throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
3712
3661
  context.debug("Running TypeScript compiler for built-in runtime module files.");
3713
3662
  let types = await emitBuiltinTypes(context, (await context.getBuiltins()).reduce((ret, builtin) => {
@@ -3715,10 +3664,10 @@ Note: Please ensure the plugin package's default export is a class that extends
3715
3664
  if (!ret.includes(formatted)) ret.push(formatted);
3716
3665
  return ret;
3717
3666
  }, []));
3718
- context.debug(`Generating TypeScript declaration file ${context.typegenPath}.`);
3667
+ context.debug(`Generating TypeScript declaration file ${context.typesPath}.`);
3719
3668
  const directives = [];
3720
3669
  const asNextParam = (previousResult) => isObject(previousResult) ? previousResult.code : previousResult;
3721
- let result = await this.callHook("typegen", {
3670
+ let result = await this.callHook("types", {
3722
3671
  environment: context,
3723
3672
  sequential: true,
3724
3673
  order: "pre",
@@ -3731,7 +3680,7 @@ Note: Please ensure the plugin package's default export is a class that extends
3731
3680
  if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
3732
3681
  } else if (isSetString(result)) types = result;
3733
3682
  }
3734
- result = await this.callHook("typegen", {
3683
+ result = await this.callHook("types", {
3735
3684
  environment: context,
3736
3685
  sequential: true,
3737
3686
  order: "normal",
@@ -3744,7 +3693,7 @@ Note: Please ensure the plugin package's default export is a class that extends
3744
3693
  if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
3745
3694
  } else if (isSetString(result)) types = result;
3746
3695
  }
3747
- result = await this.callHook("typegen", {
3696
+ result = await this.callHook("types", {
3748
3697
  environment: context,
3749
3698
  sequential: true,
3750
3699
  order: "post",
@@ -3757,7 +3706,7 @@ Note: Please ensure the plugin package's default export is a class that extends
3757
3706
  if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
3758
3707
  } else if (isSetString(result)) types = result;
3759
3708
  }
3760
- if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.typegenPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3709
+ if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.typesPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3761
3710
 
3762
3711
  ` : ""}${(0, utils_exports.getTypescriptFileHeader)(context, {
3763
3712
  directive: null,
@@ -3781,4 +3730,4 @@ ${formatTypes(types)}
3781
3730
 
3782
3731
  //#endregion
3783
3732
  export { createUnpluginFactory as a, FileMetadata as c, FileSystem as d, _capnpFileId as f, createPluginContext as i, FileMetadata_KeyValuePair as l, version as m, PowerlinesAPIContext as n, PowerlinesContext as o, name as p, PowerlinesEnvironmentContext as r, FileId as s, PowerlinesAPI as t, FileStorage as u };
3784
- //# sourceMappingURL=api-D0jVyqAA.mjs.map
3733
+ //# sourceMappingURL=api-1pXTf_83.mjs.map