@powerlines/plugin-unbuild 0.5.460 → 0.5.464
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/build-CxohmJLn.d.mts +8 -0
- package/dist/build-CxohmJLn.d.mts.map +1 -0
- package/dist/build-l9DAaDS4.d.cts +8 -0
- package/dist/build-l9DAaDS4.d.cts.map +1 -0
- package/dist/helpers/index.cjs +4 -4
- package/dist/helpers/index.d.cts +1 -1
- package/dist/helpers/index.d.mts +1 -1
- package/dist/helpers/resolve-options.cjs +4 -125
- package/dist/helpers/resolve-options.d.cts +2 -17
- package/dist/helpers/resolve-options.d.mts +2 -17
- package/dist/helpers/resolve-options.mjs +3 -3
- package/dist/helpers/resolve-options.mjs.map +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.d.cts +3 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -6
- package/dist/index.mjs.map +1 -1
- package/dist/resolve-options-BYuIlqbR.d.cts +16 -0
- package/dist/resolve-options-BYuIlqbR.d.cts.map +1 -0
- package/dist/resolve-options-CVLVE3Eo.cjs +173 -0
- package/dist/resolve-options-sRH0ysUi.d.mts +16 -0
- package/dist/resolve-options-sRH0ysUi.d.mts.map +1 -0
- package/dist/types/build.d.cts +2 -8
- package/dist/types/build.d.mts +2 -8
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.mts +1 -1
- package/package.json +12 -11
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/helpers/resolve-options.d.cts.map +0 -1
- package/dist/helpers/resolve-options.d.mts.map +0 -1
- package/dist/types/build.d.cts.map +0 -1
- package/dist/types/build.d.mts.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
2
|
+
|
|
3
|
+
//#region src/types/build.d.ts
|
|
4
|
+
type UnbuildOptions$1 = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">>;
|
|
5
|
+
declare type __ΩUnbuildOptions = any[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { __ΩUnbuildOptions as n, UnbuildOptions$1 as t };
|
|
8
|
+
//# sourceMappingURL=build-CxohmJLn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-CxohmJLn.d.mts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,gBAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,cAAA;AAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
2
|
+
|
|
3
|
+
//#region src/types/build.d.ts
|
|
4
|
+
type UnbuildOptions$1 = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">>;
|
|
5
|
+
declare type __ΩUnbuildOptions = any[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { __ΩUnbuildOptions as n, UnbuildOptions$1 as t };
|
|
8
|
+
//# sourceMappingURL=build-l9DAaDS4.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-l9DAaDS4.d.cts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,gBAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,cAAA;AAAA"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_resolve_options = require('../resolve-options-CVLVE3Eo.cjs');
|
|
3
3
|
|
|
4
|
-
exports.DEFAULT_UNBUILD_CONFIG =
|
|
5
|
-
exports.resolveOptions =
|
|
6
|
-
exports.unbuildLoader =
|
|
4
|
+
exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
|
|
5
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
|
6
|
+
exports.unbuildLoader = require_resolve_options.unbuildLoader;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "../resolve-options-BYuIlqbR.cjs";
|
|
2
2
|
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "../resolve-options-sRH0ysUi.mjs";
|
|
2
2
|
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
|
@@ -1,127 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
|
|
4
|
-
let _powerlines_plugin_rollup_helpers_resolve_options = require("@powerlines/plugin-rollup/helpers/resolve-options");
|
|
5
|
-
let _stryke_path = require("@stryke/path");
|
|
6
|
-
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
7
|
-
let defu = require("defu");
|
|
8
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
9
|
-
let esbuild = require("esbuild");
|
|
2
|
+
const require_resolve_options = require('../resolve-options-CVLVE3Eo.cjs');
|
|
10
3
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
clean: false,
|
|
15
|
-
includeSrc: false,
|
|
16
|
-
treeShaking: true,
|
|
17
|
-
splitting: true,
|
|
18
|
-
stub: false,
|
|
19
|
-
watchOptions: {},
|
|
20
|
-
outputPath: "dist",
|
|
21
|
-
generatePackageJson: true,
|
|
22
|
-
banner: " ",
|
|
23
|
-
rollup: {
|
|
24
|
-
dts: {},
|
|
25
|
-
emitCJS: true,
|
|
26
|
-
replace: {},
|
|
27
|
-
resolve: {},
|
|
28
|
-
json: {},
|
|
29
|
-
esbuild: { target: "es2020" },
|
|
30
|
-
commonjs: {},
|
|
31
|
-
alias: {}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const unbuildLoader = (context) => {
|
|
35
|
-
return async (input, { options }) => {
|
|
36
|
-
if (!/\.(?:c|m)?[jt]sx?$/.test(input.path) || /\.d\.[cm]?ts$/.test(input.path)) return;
|
|
37
|
-
const output = [];
|
|
38
|
-
let contents = await input.getContents();
|
|
39
|
-
if (options.declaration && !input.srcPath?.match(/\.d\.[cm]?ts$/)) {
|
|
40
|
-
const extension = `.d.${input.srcPath?.match(/(?<=\.)(?:c|m)(?=[jt]s$)/)?.[0] || ""}ts`;
|
|
41
|
-
output.push({
|
|
42
|
-
contents,
|
|
43
|
-
srcPath: input.srcPath,
|
|
44
|
-
path: input.path,
|
|
45
|
-
extension,
|
|
46
|
-
declaration: true
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
let transformed = contents;
|
|
50
|
-
let result = await context.$$internal.callHook("transform", {
|
|
51
|
-
sequential: true,
|
|
52
|
-
order: "pre"
|
|
53
|
-
}, transformed, input.path);
|
|
54
|
-
if (result) transformed = result;
|
|
55
|
-
result = await context.$$internal.callHook("transform", {
|
|
56
|
-
sequential: true,
|
|
57
|
-
order: "normal"
|
|
58
|
-
}, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
|
|
59
|
-
if (result) transformed = result;
|
|
60
|
-
result = await context.$$internal.callHook("transform", {
|
|
61
|
-
sequential: true,
|
|
62
|
-
order: "post"
|
|
63
|
-
}, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
|
|
64
|
-
if (result) transformed = result;
|
|
65
|
-
if ([
|
|
66
|
-
".ts",
|
|
67
|
-
".mts",
|
|
68
|
-
".cts"
|
|
69
|
-
].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
|
|
70
|
-
...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths")),
|
|
71
|
-
loader: "ts"
|
|
72
|
-
}).then((r) => r.code);
|
|
73
|
-
else if ([".tsx", ".jsx"].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
|
|
74
|
-
loader: input.extension === ".tsx" ? "tsx" : "jsx",
|
|
75
|
-
...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths"))
|
|
76
|
-
}).then((r) => r.code);
|
|
77
|
-
const isCjs = options.format === "cjs";
|
|
78
|
-
if (isCjs) contents = context.resolver.transform({
|
|
79
|
-
source: contents,
|
|
80
|
-
retainLines: false
|
|
81
|
-
}).replace(/^exports.default = /gm, "module.exports = ").replace(/^var _default = exports.default = /gm, "module.exports = ").replace("module.exports = void 0;", "");
|
|
82
|
-
let extension = isCjs ? ".js" : ".mjs";
|
|
83
|
-
if (options.ext) extension = options.ext.startsWith(".") ? options.ext : `.${options.ext}`;
|
|
84
|
-
output.push({
|
|
85
|
-
contents,
|
|
86
|
-
path: input.path,
|
|
87
|
-
extension
|
|
88
|
-
});
|
|
89
|
-
return output;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Extracts the unbuild configuration from the context.
|
|
94
|
-
*
|
|
95
|
-
* @param context - The build context.
|
|
96
|
-
* @returns The resolved unbuild configuration.
|
|
97
|
-
*/
|
|
98
|
-
function resolveOptions(context) {
|
|
99
|
-
return (0, defu.default)({ alias: context.alias }, context.config.unbuild ? context.config.unbuild : {}, {
|
|
100
|
-
projectName: context.config.name,
|
|
101
|
-
name: context.config.name,
|
|
102
|
-
orgName: context.config.organization,
|
|
103
|
-
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
|
|
104
|
-
projectRoot: context.config.root,
|
|
105
|
-
outputPath: (0, _stryke_path.relativePath)((0, _stryke_path.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
|
|
106
|
-
platform: context.config.platform,
|
|
107
|
-
external: context.builtins.reduce((ret, id) => {
|
|
108
|
-
if (!ret.includes(id)) ret.push(id);
|
|
109
|
-
return ret;
|
|
110
|
-
}, context.config.resolve.external ?? []),
|
|
111
|
-
loaders: [unbuildLoader(context)],
|
|
112
|
-
jiti: {
|
|
113
|
-
interopDefault: true,
|
|
114
|
-
fsCache: (0, _stryke_path_join_paths.joinPaths)(context.envPaths.cache, "jiti"),
|
|
115
|
-
moduleCache: true
|
|
116
|
-
},
|
|
117
|
-
rollup: (0, _powerlines_plugin_rollup_helpers_resolve_options.resolveOptions)(context),
|
|
118
|
-
debug: context.config.mode === "development",
|
|
119
|
-
minify: context.config.output.minify,
|
|
120
|
-
sourcemap: context.config.output.sourceMap
|
|
121
|
-
}, DEFAULT_UNBUILD_CONFIG);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
//#endregion
|
|
125
|
-
exports.DEFAULT_UNBUILD_CONFIG = DEFAULT_UNBUILD_CONFIG;
|
|
126
|
-
exports.resolveOptions = resolveOptions;
|
|
127
|
-
exports.unbuildLoader = unbuildLoader;
|
|
4
|
+
exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
|
|
5
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
|
6
|
+
exports.unbuildLoader = require_resolve_options.unbuildLoader;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Loader, UnbuildOptions } from "@storm-software/unbuild/types";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/resolve-options.d.ts
|
|
6
|
-
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildOptions>;
|
|
7
|
-
declare const unbuildLoader: (context: Unstable_PluginContext) => Loader;
|
|
8
|
-
/**
|
|
9
|
-
* Extracts the unbuild configuration from the context.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The build context.
|
|
12
|
-
* @returns The resolved unbuild configuration.
|
|
13
|
-
*/
|
|
14
|
-
declare function resolveOptions(context: Context): UnbuildOptions;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
|
17
|
-
//# sourceMappingURL=resolve-options.d.cts.map
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "../resolve-options-BYuIlqbR.cjs";
|
|
2
|
+
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Loader, UnbuildOptions } from "@storm-software/unbuild/types";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/resolve-options.d.ts
|
|
6
|
-
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildOptions>;
|
|
7
|
-
declare const unbuildLoader: (context: Unstable_PluginContext) => Loader;
|
|
8
|
-
/**
|
|
9
|
-
* Extracts the unbuild configuration from the context.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The build context.
|
|
12
|
-
* @returns The resolved unbuild configuration.
|
|
13
|
-
*/
|
|
14
|
-
declare function resolveOptions(context: Context): UnbuildOptions;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
|
17
|
-
//# sourceMappingURL=resolve-options.d.mts.map
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "../resolve-options-sRH0ysUi.mjs";
|
|
2
|
+
export { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader };
|
|
@@ -44,17 +44,17 @@ const unbuildLoader = (context) => {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
let transformed = contents;
|
|
47
|
-
let result = await context
|
|
47
|
+
let result = await context.callHook("transform", {
|
|
48
48
|
sequential: true,
|
|
49
49
|
order: "pre"
|
|
50
50
|
}, transformed, input.path);
|
|
51
51
|
if (result) transformed = result;
|
|
52
|
-
result = await context
|
|
52
|
+
result = await context.callHook("transform", {
|
|
53
53
|
sequential: true,
|
|
54
54
|
order: "normal"
|
|
55
55
|
}, getString(transformed), input.path);
|
|
56
56
|
if (result) transformed = result;
|
|
57
|
-
result = await context
|
|
57
|
+
result = await context.callHook("transform", {
|
|
58
58
|
sequential: true,
|
|
59
59
|
order: "post"
|
|
60
60
|
}, getString(transformed), input.path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options.mjs","names":["resolveRollupOptions"],"sources":["../../src/helpers/resolve-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context } from \"@powerlines/core\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport {
|
|
1
|
+
{"version":3,"file":"resolve-options.mjs","names":["resolveRollupOptions"],"sources":["../../src/helpers/resolve-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, PluginContext } from \"@powerlines/core\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport type {\n UnbuildOptions as ExternalUnbuildOptions,\n Loader,\n LoaderResult\n} from \"@storm-software/unbuild/types\";\nimport { appendPath, relativePath } from \"@stryke/path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { transform } from \"esbuild\";\nimport { TransformResult } from \"unplugin\";\nimport { UnbuildPluginResolvedConfig } from \"../types\";\n\nexport const DEFAULT_UNBUILD_CONFIG = {\n dts: true,\n clean: false,\n includeSrc: false,\n treeShaking: true,\n splitting: true,\n stub: false,\n watchOptions: {},\n outputPath: \"dist\",\n generatePackageJson: true,\n banner: \" \",\n rollup: {\n dts: {},\n emitCJS: true,\n replace: {},\n resolve: {},\n json: {},\n esbuild: { target: \"es2020\" },\n commonjs: {},\n alias: {}\n }\n} as Partial<ExternalUnbuildOptions>;\n\nexport const unbuildLoader = (context: PluginContext): Loader => {\n return async (input, { options }) => {\n if (\n !/\\.(?:c|m)?[jt]sx?$/.test(input.path) ||\n /\\.d\\.[cm]?ts$/.test(input.path)\n ) {\n return;\n }\n\n const output: LoaderResult = [];\n\n let contents = await input.getContents();\n\n // declaration\n if (options.declaration && !input.srcPath?.match(/\\.d\\.[cm]?ts$/)) {\n const cm = input.srcPath?.match(/(?<=\\.)(?:c|m)(?=[jt]s$)/)?.[0] || \"\";\n const extension = `.d.${cm}ts`;\n output.push({\n contents,\n srcPath: input.srcPath,\n path: input.path,\n extension,\n declaration: true\n });\n }\n\n let transformed: TransformResult | string = contents;\n\n let result = await context.callHook(\n \"transform\",\n {\n sequential: true,\n order: \"pre\"\n },\n transformed,\n input.path\n );\n if (result) {\n transformed = result;\n }\n\n result = await context.callHook(\n \"transform\",\n {\n sequential: true,\n order: \"normal\"\n },\n getString(transformed),\n input.path\n );\n if (result) {\n transformed = result;\n }\n\n result = await context.callHook(\n \"transform\",\n {\n sequential: true,\n order: \"post\"\n },\n getString(transformed),\n input.path\n );\n if (result) {\n transformed = result;\n }\n\n // typescript => js\n if ([\".ts\", \".mts\", \".cts\"].includes(input.extension)) {\n contents = await transform(getString(transformed), {\n ...Object.fromEntries(\n Object.entries(options.esbuild ?? {}).filter(\n ([key]) => key !== \"absPaths\"\n )\n ),\n loader: \"ts\"\n }).then(r => r.code);\n } else if ([\".tsx\", \".jsx\"].includes(input.extension)) {\n contents = await transform(getString(transformed), {\n loader: input.extension === \".tsx\" ? \"tsx\" : \"jsx\",\n ...Object.fromEntries(\n Object.entries(options.esbuild ?? {}).filter(\n ([key]) => key !== \"absPaths\"\n )\n )\n }).then(r => r.code);\n }\n\n // esm => cjs\n const isCjs = options.format === \"cjs\";\n if (isCjs) {\n contents = context.resolver\n .transform({\n source: contents,\n retainLines: false\n })\n .replace(/^exports.default = /gm, \"module.exports = \")\n .replace(/^var _default = exports.default = /gm, \"module.exports = \")\n .replace(\"module.exports = void 0;\", \"\");\n }\n\n let extension = isCjs ? \".js\" : \".mjs\"; // TODO: Default to .cjs in next major version\n if (options.ext) {\n extension = options.ext.startsWith(\".\") ? options.ext : `.${options.ext}`;\n }\n\n output.push({\n contents,\n path: input.path,\n extension\n });\n\n return output;\n };\n};\n\n/**\n * Extracts the unbuild configuration from the context.\n *\n * @param context - The build context.\n * @returns The resolved unbuild configuration.\n */\nexport function resolveOptions(context: Context): ExternalUnbuildOptions {\n return defu(\n {\n alias: context.alias\n },\n (context.config as UnbuildPluginResolvedConfig).unbuild\n ? (context.config as UnbuildPluginResolvedConfig).unbuild\n : {},\n {\n projectName: context.config.name,\n name: context.config.name,\n orgName: context.config.organization,\n sourceRoot: joinPaths(context.config.root, \"src\"),\n projectRoot: context.config.root,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n platform: context.config.platform,\n external: context.builtins.reduce((ret, id) => {\n if (!ret.includes(id)) {\n ret.push(id);\n }\n\n return ret;\n }, context.config.resolve.external ?? []),\n loaders: [unbuildLoader(context as PluginContext)],\n jiti: {\n interopDefault: true,\n fsCache: joinPaths(context.envPaths.cache, \"jiti\"),\n moduleCache: true\n },\n rollup: resolveRollupOptions(context) as any,\n debug: context.config.mode === \"development\",\n minify: context.config.output.minify,\n sourcemap: context.config.output.sourceMap\n },\n DEFAULT_UNBUILD_CONFIG\n ) as ExternalUnbuildOptions;\n}\n"],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
3
|
-
|
|
2
|
+
const require_resolve_options = require('./resolve-options-CVLVE3Eo.cjs');
|
|
3
|
+
require('./helpers/index.cjs');
|
|
4
|
+
require('./types/index.cjs');
|
|
4
5
|
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
5
6
|
let _storm_software_unbuild = require("@storm-software/unbuild");
|
|
6
7
|
|
|
@@ -14,15 +15,12 @@ const plugin = (options = {}) => {
|
|
|
14
15
|
config() {
|
|
15
16
|
return {
|
|
16
17
|
output: { format: ["esm"] },
|
|
17
|
-
unbuild: {
|
|
18
|
-
...require_helpers_resolve_options.DEFAULT_UNBUILD_CONFIG,
|
|
19
|
-
...options
|
|
20
|
-
}
|
|
18
|
+
unbuild: { ...options }
|
|
21
19
|
};
|
|
22
20
|
},
|
|
23
21
|
async build() {
|
|
24
22
|
this.debug("Starting Unbuild build process...");
|
|
25
|
-
const options =
|
|
23
|
+
const options = require_resolve_options.resolveOptions(this);
|
|
26
24
|
this.debug({
|
|
27
25
|
meta: { category: "config" },
|
|
28
26
|
message: `Resolved Unbuild configuration: \n${(0, _powerlines_core_plugin_utils.formatConfig)(options)}`
|
|
@@ -33,5 +31,8 @@ const plugin = (options = {}) => {
|
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
//#endregion
|
|
34
|
+
exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
|
|
36
35
|
exports.default = plugin;
|
|
37
|
-
exports.plugin = plugin;
|
|
36
|
+
exports.plugin = plugin;
|
|
37
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
|
38
|
+
exports.unbuildLoader = require_resolve_options.unbuildLoader;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "./resolve-options-BYuIlqbR.cjs";
|
|
2
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "./build-l9DAaDS4.cjs";
|
|
2
3
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./types/plugin.cjs";
|
|
3
4
|
import { Plugin } from "@powerlines/core";
|
|
4
5
|
|
|
@@ -13,5 +14,5 @@ declare module "@powerlines/core" {
|
|
|
13
14
|
*/
|
|
14
15
|
declare const plugin: <TContext extends UnbuildPluginContext = UnbuildPluginContext>(options?: UnbuildPluginOptions) => Plugin<TContext>;
|
|
15
16
|
//#endregion
|
|
16
|
-
export { UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig, plugin as default, plugin };
|
|
17
|
+
export { DEFAULT_UNBUILD_CONFIG, UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig, plugin as default, plugin, resolveOptions, unbuildLoader };
|
|
17
18
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;YA4BY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;cAOD,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveOptions, r as unbuildLoader, t as DEFAULT_UNBUILD_CONFIG } from "./resolve-options-sRH0ysUi.mjs";
|
|
2
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "./build-CxohmJLn.mjs";
|
|
2
3
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./types/plugin.mjs";
|
|
3
4
|
import { Plugin } from "@powerlines/core";
|
|
4
5
|
|
|
@@ -13,5 +14,5 @@ declare module "@powerlines/core" {
|
|
|
13
14
|
*/
|
|
14
15
|
declare const plugin: <TContext extends UnbuildPluginContext = UnbuildPluginContext>(options?: UnbuildPluginOptions) => Plugin<TContext>;
|
|
15
16
|
//#endregion
|
|
16
|
-
export { UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig, plugin as default, plugin };
|
|
17
|
+
export { DEFAULT_UNBUILD_CONFIG, UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig, plugin as default, plugin, resolveOptions, unbuildLoader };
|
|
17
18
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;YA4BY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;cAOD,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_UNBUILD_CONFIG, resolveOptions } from "./helpers/resolve-options.mjs";
|
|
1
|
+
import { DEFAULT_UNBUILD_CONFIG, resolveOptions, unbuildLoader } from "./helpers/resolve-options.mjs";
|
|
2
|
+
import "./helpers/index.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
2
4
|
import { formatConfig } from "@powerlines/core/plugin-utils";
|
|
3
5
|
import { build } from "@storm-software/unbuild";
|
|
4
6
|
|
|
@@ -12,10 +14,7 @@ const plugin = (options = {}) => {
|
|
|
12
14
|
config() {
|
|
13
15
|
return {
|
|
14
16
|
output: { format: ["esm"] },
|
|
15
|
-
unbuild: {
|
|
16
|
-
...DEFAULT_UNBUILD_CONFIG,
|
|
17
|
-
...options
|
|
18
|
-
}
|
|
17
|
+
unbuild: { ...options }
|
|
19
18
|
};
|
|
20
19
|
},
|
|
21
20
|
async build() {
|
|
@@ -31,5 +30,5 @@ const plugin = (options = {}) => {
|
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
//#endregion
|
|
34
|
-
export { plugin as default, plugin };
|
|
33
|
+
export { DEFAULT_UNBUILD_CONFIG, plugin as default, plugin, resolveOptions, unbuildLoader };
|
|
35
34
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { build } from \"@storm-software/unbuild\";\nimport {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { build } from \"@storm-software/unbuild\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { UnbuildPluginContext, UnbuildPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n unbuild?: UnbuildPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to build projects using Unbuild.\n */\nexport const plugin = <\n TContext extends UnbuildPluginContext = UnbuildPluginContext\n>(\n options: UnbuildPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"unbuild\",\n config() {\n return {\n output: {\n format: [\"esm\"]\n },\n unbuild: {\n ...options\n }\n };\n },\n async build() {\n this.debug(\"Starting Unbuild build process...\");\n\n const options = resolveOptions(this);\n\n this.debug({\n meta: {\n category: \"config\"\n },\n message: `Resolved Unbuild configuration: \\n${formatConfig(options)}`\n });\n\n await build(options);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AAoCA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,SAAS,EACP,GAAG,SACJ;IACF;;EAEH,MAAM,QAAQ;AACZ,QAAK,MAAM,oCAAoC;GAE/C,MAAM,UAAU,eAAe,KAAK;AAEpC,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,qCAAqC,aAAa,QAAQ;IACpE,CAAC;AAEF,SAAM,MAAM,QAAQ;;EAEvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context, PluginContext } from "@powerlines/core";
|
|
2
|
+
import { Loader, UnbuildOptions } from "@storm-software/unbuild/types";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/resolve-options.d.ts
|
|
5
|
+
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildOptions>;
|
|
6
|
+
declare const unbuildLoader: (context: PluginContext) => Loader;
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the unbuild configuration from the context.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The build context.
|
|
11
|
+
* @returns The resolved unbuild configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function resolveOptions(context: Context): UnbuildOptions;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { resolveOptions as n, unbuildLoader as r, DEFAULT_UNBUILD_CONFIG as t };
|
|
16
|
+
//# sourceMappingURL=resolve-options-BYuIlqbR.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options-BYuIlqbR.d.cts","names":[],"sources":["../src/helpers/resolve-options.ts"],"mappings":";;;;cAiCa,sBAAA,EAqBR,OAAA,CAAQ,cAAA;AAAA,cAEA,aAAA,GAAiB,OAAA,EAAS,aAAA,KAAgB,MAAA;AAvBvD;;;;;AAuBA;AAvBA,iBAiJgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,cAAA"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
|
|
29
|
+
let _powerlines_plugin_rollup_helpers_resolve_options = require("@powerlines/plugin-rollup/helpers/resolve-options");
|
|
30
|
+
let _stryke_path = require("@stryke/path");
|
|
31
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
32
|
+
let defu = require("defu");
|
|
33
|
+
defu = __toESM(defu, 1);
|
|
34
|
+
let esbuild = require("esbuild");
|
|
35
|
+
|
|
36
|
+
//#region src/helpers/resolve-options.ts
|
|
37
|
+
const DEFAULT_UNBUILD_CONFIG = {
|
|
38
|
+
dts: true,
|
|
39
|
+
clean: false,
|
|
40
|
+
includeSrc: false,
|
|
41
|
+
treeShaking: true,
|
|
42
|
+
splitting: true,
|
|
43
|
+
stub: false,
|
|
44
|
+
watchOptions: {},
|
|
45
|
+
outputPath: "dist",
|
|
46
|
+
generatePackageJson: true,
|
|
47
|
+
banner: " ",
|
|
48
|
+
rollup: {
|
|
49
|
+
dts: {},
|
|
50
|
+
emitCJS: true,
|
|
51
|
+
replace: {},
|
|
52
|
+
resolve: {},
|
|
53
|
+
json: {},
|
|
54
|
+
esbuild: { target: "es2020" },
|
|
55
|
+
commonjs: {},
|
|
56
|
+
alias: {}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const unbuildLoader = (context) => {
|
|
60
|
+
return async (input, { options }) => {
|
|
61
|
+
if (!/\.(?:c|m)?[jt]sx?$/.test(input.path) || /\.d\.[cm]?ts$/.test(input.path)) return;
|
|
62
|
+
const output = [];
|
|
63
|
+
let contents = await input.getContents();
|
|
64
|
+
if (options.declaration && !input.srcPath?.match(/\.d\.[cm]?ts$/)) {
|
|
65
|
+
const extension = `.d.${input.srcPath?.match(/(?<=\.)(?:c|m)(?=[jt]s$)/)?.[0] || ""}ts`;
|
|
66
|
+
output.push({
|
|
67
|
+
contents,
|
|
68
|
+
srcPath: input.srcPath,
|
|
69
|
+
path: input.path,
|
|
70
|
+
extension,
|
|
71
|
+
declaration: true
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
let transformed = contents;
|
|
75
|
+
let result = await context.callHook("transform", {
|
|
76
|
+
sequential: true,
|
|
77
|
+
order: "pre"
|
|
78
|
+
}, transformed, input.path);
|
|
79
|
+
if (result) transformed = result;
|
|
80
|
+
result = await context.callHook("transform", {
|
|
81
|
+
sequential: true,
|
|
82
|
+
order: "normal"
|
|
83
|
+
}, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
|
|
84
|
+
if (result) transformed = result;
|
|
85
|
+
result = await context.callHook("transform", {
|
|
86
|
+
sequential: true,
|
|
87
|
+
order: "post"
|
|
88
|
+
}, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
|
|
89
|
+
if (result) transformed = result;
|
|
90
|
+
if ([
|
|
91
|
+
".ts",
|
|
92
|
+
".mts",
|
|
93
|
+
".cts"
|
|
94
|
+
].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
|
|
95
|
+
...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths")),
|
|
96
|
+
loader: "ts"
|
|
97
|
+
}).then((r) => r.code);
|
|
98
|
+
else if ([".tsx", ".jsx"].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
|
|
99
|
+
loader: input.extension === ".tsx" ? "tsx" : "jsx",
|
|
100
|
+
...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths"))
|
|
101
|
+
}).then((r) => r.code);
|
|
102
|
+
const isCjs = options.format === "cjs";
|
|
103
|
+
if (isCjs) contents = context.resolver.transform({
|
|
104
|
+
source: contents,
|
|
105
|
+
retainLines: false
|
|
106
|
+
}).replace(/^exports.default = /gm, "module.exports = ").replace(/^var _default = exports.default = /gm, "module.exports = ").replace("module.exports = void 0;", "");
|
|
107
|
+
let extension = isCjs ? ".js" : ".mjs";
|
|
108
|
+
if (options.ext) extension = options.ext.startsWith(".") ? options.ext : `.${options.ext}`;
|
|
109
|
+
output.push({
|
|
110
|
+
contents,
|
|
111
|
+
path: input.path,
|
|
112
|
+
extension
|
|
113
|
+
});
|
|
114
|
+
return output;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Extracts the unbuild configuration from the context.
|
|
119
|
+
*
|
|
120
|
+
* @param context - The build context.
|
|
121
|
+
* @returns The resolved unbuild configuration.
|
|
122
|
+
*/
|
|
123
|
+
function resolveOptions(context) {
|
|
124
|
+
return (0, defu.default)({ alias: context.alias }, context.config.unbuild ? context.config.unbuild : {}, {
|
|
125
|
+
projectName: context.config.name,
|
|
126
|
+
name: context.config.name,
|
|
127
|
+
orgName: context.config.organization,
|
|
128
|
+
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
|
|
129
|
+
projectRoot: context.config.root,
|
|
130
|
+
outputPath: (0, _stryke_path.relativePath)((0, _stryke_path.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
|
|
131
|
+
platform: context.config.platform,
|
|
132
|
+
external: context.builtins.reduce((ret, id) => {
|
|
133
|
+
if (!ret.includes(id)) ret.push(id);
|
|
134
|
+
return ret;
|
|
135
|
+
}, context.config.resolve.external ?? []),
|
|
136
|
+
loaders: [unbuildLoader(context)],
|
|
137
|
+
jiti: {
|
|
138
|
+
interopDefault: true,
|
|
139
|
+
fsCache: (0, _stryke_path_join_paths.joinPaths)(context.envPaths.cache, "jiti"),
|
|
140
|
+
moduleCache: true
|
|
141
|
+
},
|
|
142
|
+
rollup: (0, _powerlines_plugin_rollup_helpers_resolve_options.resolveOptions)(context),
|
|
143
|
+
debug: context.config.mode === "development",
|
|
144
|
+
minify: context.config.output.minify,
|
|
145
|
+
sourcemap: context.config.output.sourceMap
|
|
146
|
+
}, DEFAULT_UNBUILD_CONFIG);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
Object.defineProperty(exports, 'DEFAULT_UNBUILD_CONFIG', {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return DEFAULT_UNBUILD_CONFIG;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, '__toESM', {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return __toESM;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, 'resolveOptions', {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return resolveOptions;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, 'unbuildLoader', {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return unbuildLoader;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context, PluginContext } from "@powerlines/core";
|
|
2
|
+
import { Loader, UnbuildOptions } from "@storm-software/unbuild/types";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/resolve-options.d.ts
|
|
5
|
+
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildOptions>;
|
|
6
|
+
declare const unbuildLoader: (context: PluginContext) => Loader;
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the unbuild configuration from the context.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The build context.
|
|
11
|
+
* @returns The resolved unbuild configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function resolveOptions(context: Context): UnbuildOptions;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { resolveOptions as n, unbuildLoader as r, DEFAULT_UNBUILD_CONFIG as t };
|
|
16
|
+
//# sourceMappingURL=resolve-options-sRH0ysUi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options-sRH0ysUi.d.mts","names":[],"sources":["../src/helpers/resolve-options.ts"],"mappings":";;;;cAiCa,sBAAA,EAqBR,OAAA,CAAQ,cAAA;AAAA,cAEA,aAAA,GAAiB,OAAA,EAAS,aAAA,KAAgB,MAAA;AAvBvD;;;;;AAuBA;AAvBA,iBAiJgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,cAAA"}
|
package/dist/types/build.d.cts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { UnbuildOptions as UnbuildOptions
|
|
2
|
-
|
|
3
|
-
//#region src/types/build.d.ts
|
|
4
|
-
type UnbuildOptions = Partial<Omit<UnbuildOptions$1, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">>;
|
|
5
|
-
declare type __ΩUnbuildOptions = any[];
|
|
6
|
-
//#endregion
|
|
7
|
-
export { UnbuildOptions, __ΩUnbuildOptions };
|
|
8
|
-
//# sourceMappingURL=build.d.cts.map
|
|
1
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "../build-l9DAaDS4.cjs";
|
|
2
|
+
export { UnbuildOptions, __ΩUnbuildOptions };
|
package/dist/types/build.d.mts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { UnbuildOptions as UnbuildOptions
|
|
2
|
-
|
|
3
|
-
//#region src/types/build.d.ts
|
|
4
|
-
type UnbuildOptions = Partial<Omit<UnbuildOptions$1, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">>;
|
|
5
|
-
declare type __ΩUnbuildOptions = any[];
|
|
6
|
-
//#endregion
|
|
7
|
-
export { UnbuildOptions, __ΩUnbuildOptions };
|
|
8
|
-
//# sourceMappingURL=build.d.mts.map
|
|
1
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "../build-CxohmJLn.mjs";
|
|
2
|
+
export { UnbuildOptions, __ΩUnbuildOptions };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "../build-l9DAaDS4.cjs";
|
|
2
2
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./plugin.cjs";
|
|
3
3
|
export { UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __ΩUnbuildOptions, t as UnbuildOptions } from "../build-CxohmJLn.mjs";
|
|
2
2
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./plugin.mjs";
|
|
3
3
|
export { UnbuildOptions, UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildOptions, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig };
|
package/dist/types/plugin.d.cts
CHANGED
package/dist/types/plugin.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-unbuild",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.464",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to build projects using Unbuild.",
|
|
6
6
|
"keywords": ["unbuild", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "github",
|
|
14
14
|
"url": "https://github.com/storm-software/powerlines.git",
|
|
15
|
-
"directory": "packages/plugin-unbuild"
|
|
15
|
+
"directory": "packages/plugins/plugin-unbuild"
|
|
16
16
|
},
|
|
17
17
|
"funding": {
|
|
18
18
|
"type": "github",
|
|
@@ -67,23 +67,24 @@
|
|
|
67
67
|
"module": "./dist/index.mjs",
|
|
68
68
|
"types": "./dist/index.d.cts",
|
|
69
69
|
"typings": "dist/index.d.mts",
|
|
70
|
-
"files": ["dist
|
|
70
|
+
"files": ["dist"],
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@powerlines/core": "^0.
|
|
73
|
-
"@powerlines/plugin-rollup": "^0.7.
|
|
74
|
-
"@
|
|
75
|
-
"@stryke/
|
|
76
|
-
"@stryke/
|
|
72
|
+
"@powerlines/core": "^0.9.2",
|
|
73
|
+
"@powerlines/plugin-rollup": "^0.7.463",
|
|
74
|
+
"@powerlines/unplugin": "^0.0.4",
|
|
75
|
+
"@stryke/helpers": "^0.10.15",
|
|
76
|
+
"@stryke/path": "^0.29.2",
|
|
77
|
+
"@stryke/type-checks": "^0.6.8",
|
|
77
78
|
"defu": "^6.1.7",
|
|
78
79
|
"esbuild": "^0.27.7",
|
|
79
80
|
"unplugin": "^3.0.0"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@storm-software/unbuild": "^0.57.
|
|
83
|
-
"@types/node": "^25.
|
|
83
|
+
"@storm-software/unbuild": "^0.57.163",
|
|
84
|
+
"@types/node": "^25.7.0"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": { "@storm-software/unbuild": ">=0.57.0" },
|
|
86
87
|
"peerDependenciesMeta": { "@storm-software/unbuild": { "optional": false } },
|
|
87
88
|
"publishConfig": { "access": "public" },
|
|
88
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "3c5c701e16af74006dd70b965009d41eb22ace2a"
|
|
89
90
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options.d.cts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;;cAkCa,sBAAA,EAqBR,OAAA,CAAQ,cAAA;AAAA,cAEA,aAAA,GAAiB,OAAA,EAAS,sBAAA,KAAyB,MAAA;AAvBhE;;;;;AAuBA;AAvBA,iBAiJgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,cAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options.d.mts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;;cAkCa,sBAAA,EAqBR,OAAA,CAAQ,cAAA;AAAA,cAEA,aAAA,GAAiB,OAAA,EAAS,sBAAA,KAAyB,MAAA;AAvBhE;;;;;AAuBA;AAvBA,iBAiJgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,cAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,gBAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,gBAAA;AAAA"}
|