powerlines 0.41.17 → 0.41.18

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.
@@ -72,7 +72,7 @@ import { setParseImpl } from "unplugin";
72
72
 
73
73
  //#region package.json
74
74
  var name = "powerlines";
75
- var version = "0.41.17";
75
+ var version = "0.41.18";
76
76
 
77
77
  //#endregion
78
78
  //#region src/_internal/helpers/generate-types.ts
@@ -295,7 +295,7 @@ async function writeMetaFile(context) {
295
295
  //#endregion
296
296
  //#region src/_internal/helpers/resolve-tsconfig.ts
297
297
  function getTsconfigDtsPath(context) {
298
- return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
298
+ return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.typegenPath)), findFileName(context.typegenPath));
299
299
  }
300
300
  async function resolveTsconfigChanges(context) {
301
301
  const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
@@ -303,7 +303,7 @@ async function resolveTsconfigChanges(context) {
303
303
  tsconfigJson.compilerOptions ??= {};
304
304
  if (context.config.output.dts !== false) {
305
305
  const dtsRelativePath = getTsconfigDtsPath(context);
306
- if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.dtsPath, dtsRelativePath]))) {
306
+ if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typegenPath, dtsRelativePath]))) {
307
307
  tsconfigJson.include ??= [];
308
308
  tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
309
309
  }
@@ -885,7 +885,7 @@ var VirtualFileSystem = class VirtualFileSystem {
885
885
  paths.push(appendPath(joinPaths$1(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
886
886
  }
887
887
  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)));
888
- for (const combination of getResolutionCombinations(path, { paths })) {
888
+ for (const combination of getResolutionCombinations(path, { paths: getUnique(paths) })) {
889
889
  const { relativeKey, adapter } = this.#getStorage(combination);
890
890
  if (await adapter.exists(relativeKey)) {
891
891
  result = combination;
@@ -1701,7 +1701,7 @@ var VirtualFileSystem = class VirtualFileSystem {
1701
1701
  }
1702
1702
  });
1703
1703
  await writeFileBuffer(joinPaths$1(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
1704
- if (!this.#context.config.skipCache) this.#resolverCache.save(true);
1704
+ if (!this.#context.config.skipCache) this.resolverCache.save(true);
1705
1705
  await Promise.all(this.#getStorages().map(async (storage) => storage.adapter.dispose()));
1706
1706
  this.#log(LogLevelLabel.TRACE, "Virtual file system has been disposed.");
1707
1707
  }
@@ -1766,7 +1766,8 @@ var PowerlinesContext = class PowerlinesContext {
1766
1766
  ...config
1767
1767
  }, { output: config.framework ? {
1768
1768
  artifactsPath: `.${config.framework ?? "powerlines"}`,
1769
- dts: joinPaths$1(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
1769
+ dts: true,
1770
+ typegen: joinPaths$1(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
1770
1771
  } : {} });
1771
1772
  }
1772
1773
  /**
@@ -1971,8 +1972,8 @@ var PowerlinesContext = class PowerlinesContext {
1971
1972
  /**
1972
1973
  * Get the path to the generated declaration file for the project
1973
1974
  */
1974
- get dtsPath() {
1975
- return this.config.output.dts ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
1975
+ get typegenPath() {
1976
+ return this.config.output.typegen ? appendPath(this.config.output.typegen, this.workspaceConfig.workspaceRoot) : joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
1976
1977
  }
1977
1978
  /**
1978
1979
  * Get the project root relative to the workspace root
@@ -2171,7 +2172,7 @@ var PowerlinesContext = class PowerlinesContext {
2171
2172
  extensions: this.config.resolve.extensions
2172
2173
  }, options));
2173
2174
  if (!result) return;
2174
- const external = !match(moduleId, this.config.resolve.noExternal) && (match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:") || this.fs.isVirtual(moduleId) && this.config.projectType !== "application" || this.config.resolve.skipNodeModulesBundle && !/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId));
2175
+ const external = Boolean(!match(moduleId, this.config.resolve.noExternal) && (match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:") || this.fs.isVirtual(moduleId) && this.config.projectType !== "application" || this.config.resolve.skipNodeModulesBundle && !/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId)));
2175
2176
  return {
2176
2177
  id: result,
2177
2178
  external,
@@ -2573,7 +2574,8 @@ var PowerlinesContext = class PowerlinesContext {
2573
2574
  output: (0, plugin_utils_exports.mergeConfig)(config.output ?? {}, {
2574
2575
  outputPath: cacheKey.root ? joinPaths$1(this.workspaceConfig?.directories?.build || "dist", cacheKey.root) : this.workspaceConfig?.directories?.build || "dist",
2575
2576
  artifactsPath: `.${config.framework ?? "powerlines"}`,
2576
- dts: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
2577
+ dts: true,
2578
+ typegen: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
2577
2579
  assets: [
2578
2580
  { glob: "LICENSE" },
2579
2581
  {
@@ -2607,6 +2609,7 @@ var PowerlinesContext = class PowerlinesContext {
2607
2609
  if (this.config.resolve.external) this.config.resolve.external = getUnique(this.config.resolve.external);
2608
2610
  if (this.config.resolve.noExternal) this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
2609
2611
  this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
2612
+ 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`;
2610
2613
  if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) {
2611
2614
  this.config.output.outputPath ??= joinPaths$1("dist", this.config.root);
2612
2615
  this.config.output.buildPath ??= joinPaths$1(this.config.root, "dist");
@@ -2628,8 +2631,8 @@ var PowerlinesContext = class PowerlinesContext {
2628
2631
  return ret;
2629
2632
  }, []);
2630
2633
  if (this.config.tsconfig) this.config.tsconfig = (0, plugin_utils_exports.replacePathTokens)(this, this.config.tsconfig);
2631
- if (this.config.output.dts) if (isSetString(this.config.output.dts)) this.config.output.dts = (0, plugin_utils_exports.replacePathTokens)(this, this.config.output.dts);
2632
- else this.config.output.dts = joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2634
+ 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);
2635
+ else this.config.output.typegen = joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2633
2636
  if (this.config.output.assets) this.config.output.assets = this.config.output.assets.map((asset) => ({
2634
2637
  ...asset,
2635
2638
  glob: (0, plugin_utils_exports.replacePathTokens)(this, asset.glob),
@@ -3276,9 +3279,9 @@ var PowerlinesAPI = class PowerlinesAPI {
3276
3279
  environment: context,
3277
3280
  order: "post"
3278
3281
  });
3279
- if (context.config.output.dts !== false) {
3282
+ if (context.config.output.typegen !== false) {
3280
3283
  context.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
3281
- if (context.fs.existsSync(context.dtsPath)) await context.fs.remove(context.dtsPath);
3284
+ if (context.fs.existsSync(context.typegenPath)) await context.fs.remove(context.typegenPath);
3282
3285
  if (!await resolvePackage("typescript")) throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
3283
3286
  context.debug("Running TypeScript compiler for built-in runtime module files.");
3284
3287
  let types = await emitBuiltinTypes(context, (await context.getBuiltins()).reduce((ret, builtin) => {
@@ -3286,7 +3289,7 @@ var PowerlinesAPI = class PowerlinesAPI {
3286
3289
  if (!ret.includes(formatted)) ret.push(formatted);
3287
3290
  return ret;
3288
3291
  }, []));
3289
- context.debug(`Generating TypeScript declaration file ${context.dtsPath}.`);
3292
+ context.debug(`Generating TypeScript declaration file ${context.typegenPath}.`);
3290
3293
  const directives = [];
3291
3294
  const asNextParam = (previousResult) => isObject(previousResult) ? previousResult.code : previousResult;
3292
3295
  let result = await this.callHook("types", {
@@ -3328,7 +3331,7 @@ var PowerlinesAPI = class PowerlinesAPI {
3328
3331
  if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
3329
3332
  } else if (isSetString(result)) types = result;
3330
3333
  }
3331
- if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.dtsPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3334
+ if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.typegenPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3332
3335
 
3333
3336
  ` : ""}${(0, utils_exports.getTypescriptFileHeader)(context, {
3334
3337
  directive: null,
@@ -3709,4 +3712,4 @@ Note: Please ensure the plugin package's default export is a class that extends
3709
3712
 
3710
3713
  //#endregion
3711
3714
  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 };
3712
- //# sourceMappingURL=api-XU29DzLJ.mjs.map
3715
+ //# sourceMappingURL=api-BJGcHEDR.mjs.map