powerlines 0.42.24 → 0.42.25
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/README.md +1 -1
- package/dist/{api-Dpz6n-IJ.mjs → api-CpVy0jQR.mjs} +27 -14
- package/dist/api-CpVy0jQR.mjs.map +1 -0
- package/dist/{api-DECsh_tb.cjs → api-D71tN_80.cjs} +26 -13
- package/dist/api-D71tN_80.cjs.map +1 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.d.cts +2 -2
- package/dist/esbuild.d.mts +2 -2
- package/dist/esbuild.mjs +1 -1
- package/dist/farm.cjs +1 -1
- package/dist/farm.d.cts +3 -3
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +3 -3
- package/dist/farm.d.mts.map +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/nuxt.cjs +1 -1
- package/dist/nuxt.d.cts +2 -2
- package/dist/nuxt.d.cts.map +1 -1
- package/dist/nuxt.d.mts +2 -2
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/rolldown.cjs +1 -1
- package/dist/rolldown.d.cts +2 -2
- package/dist/rolldown.d.mts +2 -2
- package/dist/rolldown.mjs +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.d.cts +2 -2
- package/dist/rollup.d.mts +2 -2
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.cts +2 -1
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +2 -1
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/unloader.cjs +1 -1
- package/dist/unloader.d.cts +3 -2
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +3 -2
- package/dist/unloader.d.mts.map +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.d.cts +2 -2
- package/dist/vite.d.mts +2 -2
- package/dist/vite.mjs +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.mts +2 -2
- package/dist/webpack.mjs +1 -1
- package/package.json +13 -13
- package/dist/api-DECsh_tb.cjs.map +0 -1
- package/dist/api-Dpz6n-IJ.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
|
-
[](https://stormsoftware.com/projects/powerlines) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -10,11 +10,12 @@ import { formatLogMessage } from "@storm-software/config-tools/logger/console";
|
|
|
10
10
|
import { toArray } from "@stryke/convert/to-array";
|
|
11
11
|
import { copyFiles } from "@stryke/fs/copy-file";
|
|
12
12
|
import { existsSync } from "@stryke/fs/exists";
|
|
13
|
-
import { createDirectory } from "@stryke/fs/helpers";
|
|
13
|
+
import { createDirectory, removeDirectory } from "@stryke/fs/helpers";
|
|
14
14
|
import { install } from "@stryke/fs/install";
|
|
15
15
|
import { listFiles } from "@stryke/fs/list-files";
|
|
16
16
|
import { doesPackageMatch, getPackageListing, isPackageExists, isPackageListed } from "@stryke/fs/package-fns";
|
|
17
17
|
import { getResolutionCombinations, resolve, resolvePackage, resolveSync } from "@stryke/fs/resolve";
|
|
18
|
+
import { getUnique, getUniqueBy } from "@stryke/helpers/get-unique";
|
|
18
19
|
import { omit } from "@stryke/helpers/omit";
|
|
19
20
|
import { appendPath } from "@stryke/path/append";
|
|
20
21
|
import { findFileDotExtensionSafe, findFileExtensionSafe, findFileName, findFilePath, hasFileExtension, relativePath } from "@stryke/path/file-path-fns";
|
|
@@ -47,7 +48,6 @@ import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
|
47
48
|
import { murmurhash } from "@stryke/hash";
|
|
48
49
|
import { hashDirectory } from "@stryke/hash/node";
|
|
49
50
|
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
50
|
-
import { getUnique, getUniqueBy } from "@stryke/helpers/get-unique";
|
|
51
51
|
import { fetchRequest } from "@stryke/http/fetch";
|
|
52
52
|
import { joinPaths as joinPaths$1 } from "@stryke/path/join";
|
|
53
53
|
import { isNull } from "@stryke/type-checks/is-null";
|
|
@@ -73,7 +73,7 @@ import { setParseImpl } from "unplugin";
|
|
|
73
73
|
|
|
74
74
|
//#region package.json
|
|
75
75
|
var name = "powerlines";
|
|
76
|
-
var version = "0.42.
|
|
76
|
+
var version = "0.42.25";
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/_internal/helpers/generate-types.ts
|
|
@@ -157,7 +157,8 @@ const mergeResultObjects = createDefu((obj, key, value) => {
|
|
|
157
157
|
* @returns The merged result.
|
|
158
158
|
*/
|
|
159
159
|
function mergeResults(currentResult, previousResults) {
|
|
160
|
-
if (
|
|
160
|
+
if (!previousResults || previousResults.length === 0) return [currentResult];
|
|
161
|
+
if (isSetString(currentResult)) previousResults = [`${isSetString(previousResults[0]) ? previousResults[0] || "" : ""}\n${isSetString(previousResults[0]) ? currentResult.replace(previousResults[0], "") : currentResult}`.trim()];
|
|
161
162
|
else if (isObject(currentResult)) previousResults = [mergeResultObjects(currentResult, previousResults[0] ?? {})];
|
|
162
163
|
return previousResults;
|
|
163
164
|
}
|
|
@@ -169,8 +170,8 @@ function mergeResults(currentResult, previousResults) {
|
|
|
169
170
|
* @returns The merged result.
|
|
170
171
|
*/
|
|
171
172
|
function mergeConfigs(currentResult, previousResults) {
|
|
172
|
-
if (isString(currentResult)) previousResults =
|
|
173
|
-
else if (isObject(currentResult)) previousResults =
|
|
173
|
+
if (isString(currentResult)) previousResults = `${isString(previousResults) ? previousResults || "" : ""}\n${currentResult || ""}`.trim();
|
|
174
|
+
else if (isObject(currentResult)) previousResults = (0, plugin_utils_exports.mergeConfig)(currentResult, previousResults ?? {});
|
|
174
175
|
return previousResults;
|
|
175
176
|
}
|
|
176
177
|
/**
|
|
@@ -204,7 +205,7 @@ async function callHook(context, key, options, ...args) {
|
|
|
204
205
|
if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
205
206
|
const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
|
|
206
207
|
if (result) if (options.result === "last") results = [result];
|
|
207
|
-
else if (options.result === "merge" && options.merge) results = options.merge(result, results);
|
|
208
|
+
else if (options.result === "merge" && options.merge) results = [results.length > 0 && results[0] ? options.merge(result, results[0]) : result];
|
|
208
209
|
else results = mergeResults(result, results);
|
|
209
210
|
}
|
|
210
211
|
}
|
|
@@ -3576,6 +3577,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
3576
3577
|
await this.#executeEnvironments(async (context) => {
|
|
3577
3578
|
await this.callHook("finalize", { environment: context });
|
|
3578
3579
|
await context.fs.dispose();
|
|
3580
|
+
if (existsSync(context.cachePath) && !(await listFiles(joinPaths(context.cachePath, "**/*")))?.length) await removeDirectory(context.cachePath);
|
|
3579
3581
|
});
|
|
3580
3582
|
this.context.debug("✔ Powerlines finalization completed successfully");
|
|
3581
3583
|
}
|
|
@@ -3782,25 +3784,34 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3782
3784
|
if (context.fs.existsSync(context.typesPath)) await context.fs.remove(context.typesPath);
|
|
3783
3785
|
if (!await resolvePackage("typescript")) throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
3784
3786
|
context.debug("Running TypeScript compiler for built-in runtime module files.");
|
|
3785
|
-
let types = await emitBuiltinTypes(context, (await context.getBuiltins()).reduce((ret, builtin) => {
|
|
3787
|
+
let types = (await emitBuiltinTypes(context, (await context.getBuiltins()).reduce((ret, builtin) => {
|
|
3786
3788
|
const formatted = replacePath(builtin.path, context.workspaceConfig.workspaceRoot);
|
|
3787
3789
|
if (!ret.includes(formatted)) ret.push(formatted);
|
|
3788
3790
|
return ret;
|
|
3789
|
-
}, []));
|
|
3791
|
+
}, []))).trim();
|
|
3790
3792
|
context.debug(`Generating TypeScript declaration file ${context.typesPath}.`);
|
|
3791
|
-
|
|
3793
|
+
let directives = [];
|
|
3794
|
+
const merge = (currentResult, previousResult) => {
|
|
3795
|
+
if (!isSetString(currentResult) && !isSetObject(currentResult) && !isSetString(previousResult) && !isSetObject(previousResult)) return types;
|
|
3796
|
+
const previous = (isSetString(previousResult) ? previousResult : isSetObject(previousResult) ? previousResult.code : "").trim().replace(types, "").trim();
|
|
3797
|
+
return {
|
|
3798
|
+
directives: [...isSetObject(currentResult) && currentResult.directives ? currentResult.directives : [], ...isSetObject(previousResult) && previousResult.directives ? previousResult.directives : []],
|
|
3799
|
+
code: `${types}\n${previous}\n${(isSetString(currentResult) ? currentResult : isSetObject(currentResult) ? currentResult.code : "").trim().replace(previous, "").trim().replace(types, "").trim()}`
|
|
3800
|
+
};
|
|
3801
|
+
};
|
|
3792
3802
|
const asNextParam = (previousResult) => isObject(previousResult) ? previousResult.code : previousResult;
|
|
3793
3803
|
let result = await this.callHook("types", {
|
|
3794
3804
|
environment: context,
|
|
3795
3805
|
sequential: true,
|
|
3796
3806
|
order: "pre",
|
|
3797
3807
|
result: "merge",
|
|
3808
|
+
merge,
|
|
3798
3809
|
asNextParam
|
|
3799
3810
|
}, types);
|
|
3800
3811
|
if (result) {
|
|
3801
3812
|
if (isSetObject(result)) {
|
|
3802
3813
|
types = result.code;
|
|
3803
|
-
if (Array.isArray(result.directives) && result.directives.length > 0) directives
|
|
3814
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = getUnique([...directives, ...result.directives]).filter(Boolean);
|
|
3804
3815
|
} else if (isSetString(result)) types = result;
|
|
3805
3816
|
}
|
|
3806
3817
|
result = await this.callHook("types", {
|
|
@@ -3808,12 +3819,13 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3808
3819
|
sequential: true,
|
|
3809
3820
|
order: "normal",
|
|
3810
3821
|
result: "merge",
|
|
3822
|
+
merge,
|
|
3811
3823
|
asNextParam
|
|
3812
3824
|
}, types);
|
|
3813
3825
|
if (result) {
|
|
3814
3826
|
if (isSetObject(result)) {
|
|
3815
3827
|
types = result.code;
|
|
3816
|
-
if (Array.isArray(result.directives) && result.directives.length > 0) directives
|
|
3828
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = getUnique([...directives, ...result.directives]).filter(Boolean);
|
|
3817
3829
|
} else if (isSetString(result)) types = result;
|
|
3818
3830
|
}
|
|
3819
3831
|
result = await this.callHook("types", {
|
|
@@ -3821,12 +3833,13 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3821
3833
|
sequential: true,
|
|
3822
3834
|
order: "post",
|
|
3823
3835
|
result: "merge",
|
|
3836
|
+
merge,
|
|
3824
3837
|
asNextParam
|
|
3825
3838
|
}, types);
|
|
3826
3839
|
if (result) {
|
|
3827
3840
|
if (isSetObject(result)) {
|
|
3828
3841
|
types = result.code;
|
|
3829
|
-
if (Array.isArray(result.directives) && result.directives.length > 0) directives
|
|
3842
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = getUnique([...directives, ...result.directives]).filter(Boolean);
|
|
3830
3843
|
} else if (isSetString(result)) types = result;
|
|
3831
3844
|
}
|
|
3832
3845
|
if (isSetString(types?.trim()) || directives.length > 0) await context.fs.write(context.typesPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
@@ -3853,4 +3866,4 @@ ${formatTypes(types)}
|
|
|
3853
3866
|
|
|
3854
3867
|
//#endregion
|
|
3855
3868
|
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 };
|
|
3856
|
-
//# sourceMappingURL=api-
|
|
3869
|
+
//# sourceMappingURL=api-CpVy0jQR.mjs.map
|