@powerlines/plugin-unbuild 0.5.350 → 0.5.352
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/helpers/index.cjs +4 -4
- package/dist/helpers/resolve-options.cjs +125 -4
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/build.d.cts +8 -2
- package/dist/types/build.d.cts.map +1 -0
- package/dist/types/build.d.mts +8 -2
- package/dist/types/build.d.mts.map +1 -0
- 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 +5 -6
- package/dist/build-BwqbRruN.d.mts +0 -8
- package/dist/build-BwqbRruN.d.mts.map +0 -1
- package/dist/build-Dwhf5qER.d.cts +0 -8
- package/dist/build-Dwhf5qER.d.cts.map +0 -1
- package/dist/resolve-options-BCjPXFKK.cjs +0 -173
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_helpers_resolve_options = require('./resolve-options.cjs');
|
|
3
3
|
|
|
4
|
-
exports.DEFAULT_UNBUILD_CONFIG =
|
|
5
|
-
exports.resolveOptions =
|
|
6
|
-
exports.unbuildLoader =
|
|
4
|
+
exports.DEFAULT_UNBUILD_CONFIG = require_helpers_resolve_options.DEFAULT_UNBUILD_CONFIG;
|
|
5
|
+
exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
|
|
6
|
+
exports.unbuildLoader = require_helpers_resolve_options.unbuildLoader;
|
|
@@ -1,6 +1,127 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
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_join_paths = require("@stryke/path/join-paths");
|
|
6
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
7
|
+
let defu = require("defu");
|
|
8
|
+
defu = require_runtime.__toESM(defu);
|
|
9
|
+
let esbuild = require("esbuild");
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
//#region src/helpers/resolve-options.ts
|
|
12
|
+
const DEFAULT_UNBUILD_CONFIG = {
|
|
13
|
+
dts: true,
|
|
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: (0, _stryke_type_checks_is_object.isObject)(context.workspaceConfig.organization) ? context.workspaceConfig.organization.name : context.workspaceConfig.organization,
|
|
103
|
+
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
|
|
104
|
+
projectRoot: context.config.root,
|
|
105
|
+
outputPath: context.config.output.buildPath || "dist",
|
|
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.mode !== "development",
|
|
120
|
+
sourcemap: context.config.mode === "development"
|
|
121
|
+
}, DEFAULT_UNBUILD_CONFIG);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
exports.DEFAULT_UNBUILD_CONFIG = DEFAULT_UNBUILD_CONFIG;
|
|
126
|
+
exports.resolveOptions = resolveOptions;
|
|
127
|
+
exports.unbuildLoader = unbuildLoader;
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
3
|
-
require('./
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
|
|
4
4
|
let _storm_software_unbuild = require("@storm-software/unbuild");
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
@@ -14,13 +14,13 @@ const plugin = (options = {}) => {
|
|
|
14
14
|
return {
|
|
15
15
|
output: { format: ["esm"] },
|
|
16
16
|
unbuild: {
|
|
17
|
-
...
|
|
17
|
+
...require_helpers_resolve_options.DEFAULT_UNBUILD_CONFIG,
|
|
18
18
|
...options
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
},
|
|
22
22
|
async build() {
|
|
23
|
-
await (0, _storm_software_unbuild.build)(
|
|
23
|
+
await (0, _storm_software_unbuild.build)(require_helpers_resolve_options.resolveOptions(this));
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UnbuildOptions, __ΩUnbuildOptions } from "./types/build.cjs";
|
|
2
2
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./types/plugin.cjs";
|
|
3
3
|
import { Plugin } from "@powerlines/core";
|
|
4
4
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UnbuildOptions, __ΩUnbuildOptions } from "./types/build.mjs";
|
|
2
2
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, UnbuildPluginUserConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig, __ΩUnbuildPluginUserConfig } from "./types/plugin.mjs";
|
|
3
3
|
import { Plugin } from "@powerlines/core";
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
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 { build } from \"@storm-software/unbuild\";\nimport {\n DEFAULT_UNBUILD_CONFIG,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport {\n UnbuildPluginContext,\n UnbuildPluginOptions,\n UnbuildPluginResolvedConfig\n} from \"./types/plugin\";\n\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 ...DEFAULT_UNBUILD_CONFIG,\n ...options\n }\n } as Partial<UnbuildPluginResolvedConfig>;\n },\n async build() {\n await build(resolveOptions(this));\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"
|
|
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 { build } from \"@storm-software/unbuild\";\nimport {\n DEFAULT_UNBUILD_CONFIG,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport {\n UnbuildPluginContext,\n UnbuildPluginOptions,\n UnbuildPluginResolvedConfig\n} from \"./types/plugin\";\n\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 ...DEFAULT_UNBUILD_CONFIG,\n ...options\n }\n } as Partial<UnbuildPluginResolvedConfig>;\n },\n async build() {\n await build(resolveOptions(this));\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;AAyCA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,SAAS;KACP,GAAG;KACH,GAAG;KACJ;IACF;;EAEH,MAAM,QAAQ;AACZ,SAAM,MAAM,eAAe,KAAK,CAAC;;EAEpC"}
|
package/dist/types/build.d.cts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { UnbuildOptions as UnbuildOptions$1 } from "@storm-software/unbuild/types";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,gBAAA;AAAA"}
|
package/dist/types/build.d.mts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { UnbuildOptions as UnbuildOptions$1 } from "@storm-software/unbuild/types";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,gBAAA;AAAA"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UnbuildOptions, __ΩUnbuildOptions } from "./build.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 { UnbuildOptions, __ΩUnbuildOptions } from "./build.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.352",
|
|
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"],
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"import": "./dist/helpers/resolve-options.mjs",
|
|
50
50
|
"require": "./dist/helpers/resolve-options.cjs"
|
|
51
51
|
},
|
|
52
|
-
"./resolve-options-BCjPXFKK": "./dist/resolve-options-BCjPXFKK.cjs",
|
|
53
52
|
"./types": {
|
|
54
53
|
"import": "./dist/types/index.mjs",
|
|
55
54
|
"require": "./dist/types/index.cjs"
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
"import": "./dist/types/plugin.mjs",
|
|
63
62
|
"require": "./dist/types/plugin.cjs"
|
|
64
63
|
},
|
|
65
|
-
"
|
|
64
|
+
"./package.json": "./package.json"
|
|
66
65
|
},
|
|
67
66
|
"main": "./dist/index.cjs",
|
|
68
67
|
"module": "./dist/index.mjs",
|
|
@@ -70,8 +69,8 @@
|
|
|
70
69
|
"typings": "dist/index.d.mts",
|
|
71
70
|
"files": ["dist/**/*"],
|
|
72
71
|
"dependencies": {
|
|
73
|
-
"@powerlines/core": "^0.3.
|
|
74
|
-
"@powerlines/plugin-rollup": "^0.7.
|
|
72
|
+
"@powerlines/core": "^0.3.5",
|
|
73
|
+
"@powerlines/plugin-rollup": "^0.7.352",
|
|
75
74
|
"@stryke/path": "^0.26.19",
|
|
76
75
|
"@stryke/type-checks": "^0.5.38",
|
|
77
76
|
"defu": "^6.1.4",
|
|
@@ -85,5 +84,5 @@
|
|
|
85
84
|
"peerDependencies": { "@storm-software/unbuild": ">=0.57.0" },
|
|
86
85
|
"peerDependenciesMeta": { "@storm-software/unbuild": { "optional": false } },
|
|
87
86
|
"publishConfig": { "access": "public" },
|
|
88
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "0fcc7a33523c8b70c1b5f65684a8b6a15ab68eba"
|
|
89
88
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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-BwqbRruN.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-BwqbRruN.d.mts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,gBAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,cAAA;AAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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-Dwhf5qER.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-Dwhf5qER.d.cts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,gBAAA,GAAiB,OAAA,CAC3B,IAAA,CACE,cAAA;AAAA"}
|
|
@@ -1,173 +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
|
-
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_join_paths = require("@stryke/path/join-paths");
|
|
31
|
-
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
32
|
-
let defu = require("defu");
|
|
33
|
-
defu = __toESM(defu);
|
|
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.$$internal.callHook("transform", {
|
|
76
|
-
sequential: true,
|
|
77
|
-
order: "pre"
|
|
78
|
-
}, transformed, input.path);
|
|
79
|
-
if (result) transformed = result;
|
|
80
|
-
result = await context.$$internal.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.$$internal.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: (0, _stryke_type_checks_is_object.isObject)(context.workspaceConfig.organization) ? context.workspaceConfig.organization.name : context.workspaceConfig.organization,
|
|
128
|
-
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
|
|
129
|
-
projectRoot: context.config.root,
|
|
130
|
-
outputPath: context.config.output.buildPath || "dist",
|
|
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.mode !== "development",
|
|
145
|
-
sourcemap: context.config.mode === "development"
|
|
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
|
-
});
|