powerlines 0.42.9 → 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.
- package/dist/{api-B7a8UhJo.mjs → api-1pXTf_83.mjs} +26 -26
- package/dist/api-1pXTf_83.mjs.map +1 -0
- package/dist/{api-BzuVSDXX.cjs → api-COmAT3Wz.cjs} +25 -25
- package/dist/astro.cjs +1 -1
- package/dist/astro.mjs +1 -1
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +1 -1
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.mjs +1 -1
- package/dist/farm.cjs +1 -1
- package/dist/farm.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/next.cjs +1 -1
- package/dist/next.mjs +1 -1
- package/dist/nuxt.cjs +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/rolldown.cjs +1 -1
- package/dist/rolldown.mjs +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/tsdown.cjs +1 -1
- package/dist/tsdown.mjs +1 -1
- package/dist/tsup.cjs +1 -1
- package/dist/tsup.mjs +1 -1
- package/dist/unloader.cjs +1 -1
- package/dist/unloader.mjs +1 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +15 -15
- package/dist/api-B7a8UhJo.mjs.map +0 -1
|
@@ -72,7 +72,7 @@ import { setParseImpl } from "unplugin";
|
|
|
72
72
|
|
|
73
73
|
//#region package.json
|
|
74
74
|
var name = "powerlines";
|
|
75
|
-
var version = "0.42.
|
|
75
|
+
var version = "0.42.9";
|
|
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.
|
|
298
|
+
return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.typesPath)), findFileName(context.typesPath));
|
|
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.
|
|
306
|
+
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath]))) {
|
|
307
307
|
tsconfigJson.include ??= [];
|
|
308
308
|
tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
|
|
309
309
|
}
|
|
@@ -1720,7 +1720,7 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
1720
1720
|
}, { output: config.framework ? {
|
|
1721
1721
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
1722
1722
|
dts: true,
|
|
1723
|
-
|
|
1723
|
+
types: joinPaths$1(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
|
|
1724
1724
|
} : {} });
|
|
1725
1725
|
}
|
|
1726
1726
|
/**
|
|
@@ -1929,8 +1929,8 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
1929
1929
|
/**
|
|
1930
1930
|
* Get the path to the generated declaration file for the project
|
|
1931
1931
|
*/
|
|
1932
|
-
get
|
|
1933
|
-
return this.config.output.
|
|
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");
|
|
1934
1934
|
}
|
|
1935
1935
|
/**
|
|
1936
1936
|
* Get the project root relative to the workspace root
|
|
@@ -2543,7 +2543,7 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
2543
2543
|
] },
|
|
2544
2544
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
2545
2545
|
dts: true,
|
|
2546
|
-
|
|
2546
|
+
types: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`)
|
|
2547
2547
|
})
|
|
2548
2548
|
}, options.isHighPriority ? {} : this.#getConfigProps(config), {
|
|
2549
2549
|
inlineConfig: {},
|
|
@@ -2566,7 +2566,7 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
2566
2566
|
if (this.config.resolve.external) this.config.resolve.external = getUnique(this.config.resolve.external);
|
|
2567
2567
|
if (this.config.resolve.noExternal) this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
|
|
2568
2568
|
this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
2569
|
-
if (this.config.output.dts !== false && !this.config.output.
|
|
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`;
|
|
2570
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");
|
|
2571
2571
|
else this.config.output.path ??= "dist";
|
|
2572
2572
|
if (this.config.root && this.config.output.copy !== false) this.config.output.copy = {
|
|
@@ -2587,8 +2587,8 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
2587
2587
|
return ret;
|
|
2588
2588
|
}, []);
|
|
2589
2589
|
if (this.config.tsconfig) this.config.tsconfig = (0, plugin_utils_exports.replacePathTokens)(this, this.config.tsconfig);
|
|
2590
|
-
if (this.config.output.
|
|
2591
|
-
else this.config.output.
|
|
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`);
|
|
2592
2592
|
if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
|
|
2593
2593
|
...asset,
|
|
2594
2594
|
glob: (0, plugin_utils_exports.replacePathTokens)(this, asset.glob),
|
|
@@ -3185,12 +3185,12 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
3185
3185
|
* @remarks
|
|
3186
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.
|
|
3187
3187
|
*
|
|
3188
|
-
* @param inlineConfig - The inline configuration for the
|
|
3188
|
+
* @param inlineConfig - The inline configuration for the types command
|
|
3189
3189
|
*/
|
|
3190
|
-
async
|
|
3190
|
+
async types(inlineConfig = { command: "types" }) {
|
|
3191
3191
|
this.context.info(" 🏗️ Generating typescript declarations for the Powerlines project");
|
|
3192
3192
|
this.context.debug(" Aggregating configuration options for the Powerlines project");
|
|
3193
|
-
inlineConfig.command ??= "
|
|
3193
|
+
inlineConfig.command ??= "types";
|
|
3194
3194
|
await this.context.withInlineConfig(inlineConfig);
|
|
3195
3195
|
await this.#executeEnvironments(async (context) => {
|
|
3196
3196
|
context.debug(`Initializing the processing options for the Powerlines project.`);
|
|
@@ -3219,13 +3219,13 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
3219
3219
|
})}`);
|
|
3220
3220
|
if (!context.fs.existsSync(context.cachePath)) await createDirectory(context.cachePath);
|
|
3221
3221
|
if (!context.fs.existsSync(context.dataPath)) await createDirectory(context.dataPath);
|
|
3222
|
-
await this.#
|
|
3223
|
-
this.context.debug("Formatting files generated during the
|
|
3224
|
-
await (0, utils_exports.format)(context, context.
|
|
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) ?? "");
|
|
3225
3225
|
await writeMetaFile(context);
|
|
3226
3226
|
context.persistedMeta = context.meta;
|
|
3227
3227
|
});
|
|
3228
|
-
this.context.debug("✔ Powerlines
|
|
3228
|
+
this.context.debug("✔ Powerlines types generation has completed successfully");
|
|
3229
3229
|
}
|
|
3230
3230
|
/**
|
|
3231
3231
|
* Prepare the Powerlines API
|
|
@@ -3279,7 +3279,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
3279
3279
|
environment: context,
|
|
3280
3280
|
order: "post"
|
|
3281
3281
|
});
|
|
3282
|
-
if (context.config.output.
|
|
3282
|
+
if (context.config.output.types !== false) await this.#types(context);
|
|
3283
3283
|
this.context.debug("Formatting files generated during the prepare step.");
|
|
3284
3284
|
await Promise.all([(0, utils_exports.formatFolder)(context, context.builtinsPath), (0, utils_exports.formatFolder)(context, context.entryPath)]);
|
|
3285
3285
|
await writeMetaFile(context);
|
|
@@ -3654,9 +3654,9 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3654
3654
|
* @param context - The environment context to use for generating the TypeScript declaration file
|
|
3655
3655
|
* @returns A promise that resolves when the TypeScript declaration file has been generated
|
|
3656
3656
|
*/
|
|
3657
|
-
async #
|
|
3657
|
+
async #types(context) {
|
|
3658
3658
|
context.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
|
|
3659
|
-
if (context.fs.existsSync(context.
|
|
3659
|
+
if (context.fs.existsSync(context.typesPath)) await context.fs.remove(context.typesPath);
|
|
3660
3660
|
if (!await resolvePackage("typescript")) throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
3661
3661
|
context.debug("Running TypeScript compiler for built-in runtime module files.");
|
|
3662
3662
|
let types = await emitBuiltinTypes(context, (await context.getBuiltins()).reduce((ret, builtin) => {
|
|
@@ -3664,10 +3664,10 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3664
3664
|
if (!ret.includes(formatted)) ret.push(formatted);
|
|
3665
3665
|
return ret;
|
|
3666
3666
|
}, []));
|
|
3667
|
-
context.debug(`Generating TypeScript declaration file ${context.
|
|
3667
|
+
context.debug(`Generating TypeScript declaration file ${context.typesPath}.`);
|
|
3668
3668
|
const directives = [];
|
|
3669
3669
|
const asNextParam = (previousResult) => isObject(previousResult) ? previousResult.code : previousResult;
|
|
3670
|
-
let result = await this.callHook("
|
|
3670
|
+
let result = await this.callHook("types", {
|
|
3671
3671
|
environment: context,
|
|
3672
3672
|
sequential: true,
|
|
3673
3673
|
order: "pre",
|
|
@@ -3680,7 +3680,7 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3680
3680
|
if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
|
|
3681
3681
|
} else if (isSetString(result)) types = result;
|
|
3682
3682
|
}
|
|
3683
|
-
result = await this.callHook("
|
|
3683
|
+
result = await this.callHook("types", {
|
|
3684
3684
|
environment: context,
|
|
3685
3685
|
sequential: true,
|
|
3686
3686
|
order: "normal",
|
|
@@ -3693,7 +3693,7 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3693
3693
|
if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
|
|
3694
3694
|
} else if (isSetString(result)) types = result;
|
|
3695
3695
|
}
|
|
3696
|
-
result = await this.callHook("
|
|
3696
|
+
result = await this.callHook("types", {
|
|
3697
3697
|
environment: context,
|
|
3698
3698
|
sequential: true,
|
|
3699
3699
|
order: "post",
|
|
@@ -3706,7 +3706,7 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3706
3706
|
if (Array.isArray(result.directives) && result.directives.length > 0) directives.push(...result.directives);
|
|
3707
3707
|
} else if (isSetString(result)) types = result;
|
|
3708
3708
|
}
|
|
3709
|
-
if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.
|
|
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")}
|
|
3710
3710
|
|
|
3711
3711
|
` : ""}${(0, utils_exports.getTypescriptFileHeader)(context, {
|
|
3712
3712
|
directive: null,
|
|
@@ -3730,4 +3730,4 @@ ${formatTypes(types)}
|
|
|
3730
3730
|
|
|
3731
3731
|
//#endregion
|
|
3732
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 };
|
|
3733
|
-
//# sourceMappingURL=api-
|
|
3733
|
+
//# sourceMappingURL=api-1pXTf_83.mjs.map
|