@powerlines/plugin-unbuild 0.5.242 → 0.5.244
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/index.cjs +3 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/plugin.d.cts +3 -3
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +58 -11
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
- package/dist/powerlines/src/lib/build/rollup.cjs +0 -126
- package/dist/powerlines/src/lib/build/rollup.mjs +0 -119
- package/dist/powerlines/src/lib/build/unbuild.cjs +0 -126
- package/dist/powerlines/src/lib/build/unbuild.mjs +0 -123
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
- package/dist/powerlines/src/types/api.d.cts +0 -104
- package/dist/powerlines/src/types/api.d.mts +0 -104
- package/dist/powerlines/src/types/babel.d.mts +0 -2
- package/dist/powerlines/src/types/build.d.cts +0 -185
- package/dist/powerlines/src/types/build.d.mts +0 -185
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -424
- package/dist/powerlines/src/types/config.d.mts +0 -424
- package/dist/powerlines/src/types/context.d.cts +0 -514
- package/dist/powerlines/src/types/context.d.mts +0 -514
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.cts +0 -32
- package/dist/powerlines/src/types/hooks.d.mts +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -205
- package/dist/powerlines/src/types/plugin.d.mts +0 -205
- package/dist/powerlines/src/types/resolved.d.cts +0 -93
- package/dist/powerlines/src/types/resolved.d.mts +0 -93
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
- package/dist/powerlines/src/types/unplugin.d.cts +0 -22
- package/dist/powerlines/src/types/unplugin.d.mts +0 -23
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const require_unbuild = require('./powerlines/src/lib/build/unbuild.cjs');
|
|
4
2
|
let __storm_software_unbuild = require("@storm-software/unbuild");
|
|
3
|
+
let powerlines_lib_build_unbuild = require("powerlines/lib/build/unbuild");
|
|
5
4
|
|
|
6
5
|
//#region src/index.ts
|
|
7
6
|
/**
|
|
@@ -14,14 +13,14 @@ const plugin = (options = {}) => {
|
|
|
14
13
|
return {
|
|
15
14
|
output: { format: ["esm"] },
|
|
16
15
|
build: {
|
|
17
|
-
...
|
|
16
|
+
...powerlines_lib_build_unbuild.DEFAULT_UNBUILD_CONFIG,
|
|
18
17
|
...options,
|
|
19
18
|
variant: "unbuild"
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
21
|
},
|
|
23
22
|
async build() {
|
|
24
|
-
await (0, __storm_software_unbuild.build)(
|
|
23
|
+
await (0, __storm_software_unbuild.build)((0, powerlines_lib_build_unbuild.extractUnbuildConfig)(this));
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
2
1
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig } from "./types/plugin.cjs";
|
|
2
|
+
import "./types/index.cjs";
|
|
3
|
+
import { Plugin } from "powerlines/types/plugin";
|
|
3
4
|
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
2
1
|
import { UnbuildPluginContext, UnbuildPluginOptions, UnbuildPluginResolvedConfig, __ΩUnbuildPluginContext, __ΩUnbuildPluginOptions, __ΩUnbuildPluginResolvedConfig } from "./types/plugin.mjs";
|
|
3
2
|
import "./types/index.mjs";
|
|
3
|
+
import { Plugin } from "powerlines/types/plugin";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_UNBUILD_CONFIG, extractUnbuildConfig } from "./powerlines/src/lib/build/unbuild.mjs";
|
|
2
1
|
import { build } from "@storm-software/unbuild";
|
|
2
|
+
import { DEFAULT_UNBUILD_CONFIG, extractUnbuildConfig } from "powerlines/lib/build/unbuild";
|
|
3
3
|
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
/**
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UnbuildBuildConfig } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { UnbuildBuildConfig } from "powerlines/types/build";
|
|
2
|
+
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import { UnbuildResolvedConfig } from "powerlines/types/resolved";
|
|
4
4
|
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
6
|
type UnbuildPluginOptions = Partial<UnbuildBuildConfig>;
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UnbuildBuildConfig } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { UnbuildBuildConfig } from "powerlines/types/build";
|
|
2
|
+
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import { UnbuildResolvedConfig } from "powerlines/types/resolved";
|
|
4
4
|
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
6
|
type UnbuildPluginOptions = Partial<UnbuildBuildConfig>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-unbuild",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.244",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to build projects using Unbuild.",
|
|
6
6
|
"repository": {
|
|
@@ -41,29 +41,76 @@
|
|
|
41
41
|
"main": "./dist/index.cjs",
|
|
42
42
|
"module": "./dist/index.mjs",
|
|
43
43
|
"exports": {
|
|
44
|
-
".": {
|
|
44
|
+
".": {
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/index.d.cts",
|
|
47
|
+
"default": "./dist/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/index.d.mts",
|
|
51
|
+
"default": "./dist/index.mjs"
|
|
52
|
+
},
|
|
53
|
+
"default": {
|
|
54
|
+
"types": "./dist/index.d.mts",
|
|
55
|
+
"default": "./dist/index.mjs"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"./package.json": "./package.json",
|
|
45
59
|
"./types": {
|
|
46
|
-
"require":
|
|
47
|
-
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/types/index.d.cts",
|
|
62
|
+
"default": "./dist/types/index.cjs"
|
|
63
|
+
},
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./dist/types/index.d.mts",
|
|
66
|
+
"default": "./dist/types/index.mjs"
|
|
67
|
+
},
|
|
68
|
+
"default": {
|
|
69
|
+
"types": "./dist/types/index.d.mts",
|
|
70
|
+
"default": "./dist/types/index.mjs"
|
|
71
|
+
}
|
|
48
72
|
},
|
|
49
|
-
"./types
|
|
50
|
-
"require":
|
|
51
|
-
|
|
73
|
+
"./types/*": {
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/types/*.d.cts",
|
|
76
|
+
"default": "./dist/types/*.cjs"
|
|
77
|
+
},
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./dist/types/*.d.mts",
|
|
80
|
+
"default": "./dist/types/*.mjs"
|
|
81
|
+
},
|
|
82
|
+
"default": {
|
|
83
|
+
"types": "./dist/types/*.d.mts",
|
|
84
|
+
"default": "./dist/types/*.mjs"
|
|
85
|
+
}
|
|
52
86
|
},
|
|
53
|
-
"./
|
|
87
|
+
"./types/plugin": {
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./dist/types/plugin.d.cts",
|
|
90
|
+
"default": "./dist/types/plugin.cjs"
|
|
91
|
+
},
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./dist/types/plugin.d.mts",
|
|
94
|
+
"default": "./dist/types/plugin.mjs"
|
|
95
|
+
},
|
|
96
|
+
"default": {
|
|
97
|
+
"types": "./dist/types/plugin.d.mts",
|
|
98
|
+
"default": "./dist/types/plugin.mjs"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
54
101
|
},
|
|
55
102
|
"typings": "dist/index.d.mts",
|
|
56
103
|
"files": ["dist/**/*"],
|
|
57
104
|
"keywords": ["unbuild", "powerlines", "storm-software", "powerlines-plugin"],
|
|
58
105
|
"dependencies": {
|
|
59
106
|
"@storm-software/unbuild": "^0.57.81",
|
|
60
|
-
"powerlines": "^0.38.
|
|
107
|
+
"powerlines": "^0.38.1"
|
|
61
108
|
},
|
|
62
109
|
"devDependencies": {
|
|
63
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
110
|
+
"@powerlines/plugin-plugin": "^0.12.185",
|
|
64
111
|
"@types/node": "^24.10.9"
|
|
65
112
|
},
|
|
66
113
|
"publishConfig": { "access": "public" },
|
|
67
114
|
"types": "./dist/index.d.cts",
|
|
68
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "2a4d9ef63cc29e4551fa9f680ea63874c7f48d2d"
|
|
69
116
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
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,47 +0,0 @@
|
|
|
1
|
-
import { SelectHooksOptions } from "../../types/context.cjs";
|
|
2
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
-
|
|
4
|
-
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
5
|
-
type CallHookOptions = SelectHooksOptions & (({
|
|
6
|
-
/**
|
|
7
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue true
|
|
10
|
-
*/
|
|
11
|
-
sequential?: true;
|
|
12
|
-
} & ({
|
|
13
|
-
/**
|
|
14
|
-
* How to handle multiple return values from hooks.
|
|
15
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
16
|
-
* - "first": Return the first non-undefined value.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Merging only works if the return values are objects.
|
|
20
|
-
*
|
|
21
|
-
* @defaultValue "merge"
|
|
22
|
-
*/
|
|
23
|
-
result: "first";
|
|
24
|
-
} | {
|
|
25
|
-
/**
|
|
26
|
-
* How to handle multiple return values from hooks.
|
|
27
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
28
|
-
* - "first": Return the first non-undefined value.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Merging only works if the return values are objects.
|
|
32
|
-
*
|
|
33
|
-
* @defaultValue "merge"
|
|
34
|
-
*/
|
|
35
|
-
result?: "merge" | "last";
|
|
36
|
-
/**
|
|
37
|
-
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
38
|
-
*/
|
|
39
|
-
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
40
|
-
})) | {
|
|
41
|
-
/**
|
|
42
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
43
|
-
*/
|
|
44
|
-
sequential: false;
|
|
45
|
-
});
|
|
46
|
-
//#endregion
|
|
47
|
-
export { CallHookOptions };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import "../../types/hooks.mjs";
|
|
2
|
-
import "../../types/resolved.mjs";
|
|
3
|
-
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
4
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
-
|
|
6
|
-
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
7
|
-
type CallHookOptions = SelectHooksOptions & (({
|
|
8
|
-
/**
|
|
9
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue true
|
|
12
|
-
*/
|
|
13
|
-
sequential?: true;
|
|
14
|
-
} & ({
|
|
15
|
-
/**
|
|
16
|
-
* How to handle multiple return values from hooks.
|
|
17
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
18
|
-
* - "first": Return the first non-undefined value.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Merging only works if the return values are objects.
|
|
22
|
-
*
|
|
23
|
-
* @defaultValue "merge"
|
|
24
|
-
*/
|
|
25
|
-
result: "first";
|
|
26
|
-
} | {
|
|
27
|
-
/**
|
|
28
|
-
* How to handle multiple return values from hooks.
|
|
29
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
30
|
-
* - "first": Return the first non-undefined value.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Merging only works if the return values are objects.
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue "merge"
|
|
36
|
-
*/
|
|
37
|
-
result?: "merge" | "last";
|
|
38
|
-
/**
|
|
39
|
-
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
40
|
-
*/
|
|
41
|
-
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
42
|
-
})) | {
|
|
43
|
-
/**
|
|
44
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
45
|
-
*/
|
|
46
|
-
sequential: false;
|
|
47
|
-
});
|
|
48
|
-
//#endregion
|
|
49
|
-
export { CallHookOptions };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
3
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
|
-
let defu = require("defu");
|
|
5
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
-
let __rollup_plugin_alias = require("@rollup/plugin-alias");
|
|
8
|
-
__rollup_plugin_alias = require_rolldown_runtime.__toESM(__rollup_plugin_alias);
|
|
9
|
-
let __rollup_plugin_babel = require("@rollup/plugin-babel");
|
|
10
|
-
let __rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
11
|
-
__rollup_plugin_inject = require_rolldown_runtime.__toESM(__rollup_plugin_inject);
|
|
12
|
-
let __rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
13
|
-
__rollup_plugin_node_resolve = require_rolldown_runtime.__toESM(__rollup_plugin_node_resolve);
|
|
14
|
-
let __rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
15
|
-
__rollup_plugin_replace = require_rolldown_runtime.__toESM(__rollup_plugin_replace);
|
|
16
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
17
|
-
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
18
|
-
let node_fs = require("node:fs");
|
|
19
|
-
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
20
|
-
rollup_plugin_typescript2 = require_rolldown_runtime.__toESM(rollup_plugin_typescript2);
|
|
21
|
-
|
|
22
|
-
//#region ../powerlines/src/lib/build/rollup.ts
|
|
23
|
-
/**
|
|
24
|
-
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
|
|
28
|
-
*/
|
|
29
|
-
const dtsBundlePlugin = {
|
|
30
|
-
name: "powerlines:dts-bundle",
|
|
31
|
-
async generateBundle(_opts, bundle) {
|
|
32
|
-
for (const [, file] of Object.entries(bundle)) {
|
|
33
|
-
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
|
|
34
|
-
const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
|
|
35
|
-
const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
|
|
36
|
-
this.emitFile({
|
|
37
|
-
type: "asset",
|
|
38
|
-
fileName: dtsFileName,
|
|
39
|
-
source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Resolves the options for [rollup](https://rollupjs.org).
|
|
46
|
-
*
|
|
47
|
-
* @param context - The build context.
|
|
48
|
-
* @returns The resolved options.
|
|
49
|
-
*/
|
|
50
|
-
function extractRollupConfig(context) {
|
|
51
|
-
return (0, defu.default)({
|
|
52
|
-
input: (0, node_fs.globSync)((0, __stryke_convert_to_array.toArray)(context.entry).map((entry) => (0, __stryke_type_checks_is_string.isString)(entry) ? entry : entry.file)).flat(),
|
|
53
|
-
external: (source, importer, isResolved) => {
|
|
54
|
-
const externalFn = context.config.build.variant === "rollup" && context.config.build.override.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.override.external) ? context.config.build.override.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build.override.external).includes(id) : context.config.build.variant === "vite" && context.config.build.override.build?.rollupOptions?.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.override.build?.rollupOptions?.external) ? context.config.build.override.build?.rollupOptions?.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build?.build?.rollupOptions?.external).includes(id) : context.config.build.variant === "rollup" && context.config.build.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.external) ? context.config.build.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build.external).includes(id) : context.config.build.variant === "vite" && context.config.build.build?.rollupOptions?.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.build?.rollupOptions?.external) ? context.config.build.build?.rollupOptions?.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build?.build?.rollupOptions?.external).includes(id) : void 0;
|
|
55
|
-
if ((0, __stryke_type_checks_is_function.isFunction)(externalFn) && externalFn(source, importer, isResolved)) return true;
|
|
56
|
-
if (context.config.build.external && (0, __stryke_convert_to_array.toArray)(context.config.build.external).includes(source)) return true;
|
|
57
|
-
if (context.config.build.noExternal && (0, __stryke_convert_to_array.toArray)(context.config.build.noExternal).includes(source)) return false;
|
|
58
|
-
if (context.builtins.includes(source)) return context.config.projectType !== "application";
|
|
59
|
-
return !context.config.build.skipNodeModulesBundle;
|
|
60
|
-
},
|
|
61
|
-
plugins: [
|
|
62
|
-
(0, rollup_plugin_typescript2.default)({
|
|
63
|
-
check: false,
|
|
64
|
-
tsconfig: context.tsconfig.tsconfigFilePath
|
|
65
|
-
}),
|
|
66
|
-
context.config.build.define && Object.keys(context.config.build.define).length > 0 && (0, __rollup_plugin_replace.default)({
|
|
67
|
-
sourceMap: context.config.mode === "development",
|
|
68
|
-
preventAssignment: true,
|
|
69
|
-
...context.config.build.define ?? {}
|
|
70
|
-
}),
|
|
71
|
-
context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && (0, __rollup_plugin_inject.default)({
|
|
72
|
-
sourceMap: context.config.mode === "development",
|
|
73
|
-
...context.config.build.inject
|
|
74
|
-
}),
|
|
75
|
-
(0, __rollup_plugin_alias.default)({ entries: Object.entries(context.alias).reduce((ret, [id, path]) => {
|
|
76
|
-
if (!ret.find((e) => e.find === id)) ret.push({
|
|
77
|
-
find: id,
|
|
78
|
-
replacement: path
|
|
79
|
-
});
|
|
80
|
-
else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
|
|
81
|
-
return ret;
|
|
82
|
-
}, []) }),
|
|
83
|
-
(0, __rollup_plugin_babel.getBabelInputPlugin)((0, defu.default)(context.config.transform.babel, {
|
|
84
|
-
caller: {
|
|
85
|
-
name: "powerlines",
|
|
86
|
-
supportsStaticESM: true
|
|
87
|
-
},
|
|
88
|
-
cwd: context.config.projectRoot,
|
|
89
|
-
babelrc: false,
|
|
90
|
-
extensions: [
|
|
91
|
-
".js",
|
|
92
|
-
".jsx",
|
|
93
|
-
".ts",
|
|
94
|
-
".tsx"
|
|
95
|
-
],
|
|
96
|
-
babelHelpers: "bundled",
|
|
97
|
-
skipPreflightCheck: true,
|
|
98
|
-
exclude: /node_modules/
|
|
99
|
-
})),
|
|
100
|
-
(0, __rollup_plugin_node_resolve.default)({
|
|
101
|
-
moduleDirectories: ["node_modules"],
|
|
102
|
-
preferBuiltins: true
|
|
103
|
-
}),
|
|
104
|
-
dtsBundlePlugin
|
|
105
|
-
].filter(Boolean)
|
|
106
|
-
}, context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rollup" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build?.rollupOptions : {}, {
|
|
107
|
-
cache: !context.config.skipCache ? (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "rollup") : false,
|
|
108
|
-
logLevel: context.config.logLevel,
|
|
109
|
-
output: [{
|
|
110
|
-
dir: context.config.output.buildPath,
|
|
111
|
-
format: "es",
|
|
112
|
-
entryFileNames: "[name].js",
|
|
113
|
-
preserveModules: true,
|
|
114
|
-
sourcemap: context.config.mode === "development"
|
|
115
|
-
}, {
|
|
116
|
-
dir: context.config.output.buildPath,
|
|
117
|
-
format: "cjs",
|
|
118
|
-
entryFileNames: "[name].cjs",
|
|
119
|
-
preserveModules: true,
|
|
120
|
-
sourcemap: context.config.mode === "development"
|
|
121
|
-
}]
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
//#endregion
|
|
126
|
-
exports.extractRollupConfig = extractRollupConfig;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { omit } from "@stryke/helpers/omit";
|
|
2
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
|
-
import defu from "defu";
|
|
4
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
5
|
-
import alias from "@rollup/plugin-alias";
|
|
6
|
-
import { getBabelInputPlugin } from "@rollup/plugin-babel";
|
|
7
|
-
import inject from "@rollup/plugin-inject";
|
|
8
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
9
|
-
import replace from "@rollup/plugin-replace";
|
|
10
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
11
|
-
import { isFunction } from "@stryke/type-checks/is-function";
|
|
12
|
-
import { globSync } from "node:fs";
|
|
13
|
-
import typescriptPlugin from "rollup-plugin-typescript2";
|
|
14
|
-
|
|
15
|
-
//#region ../powerlines/src/lib/build/rollup.ts
|
|
16
|
-
/**
|
|
17
|
-
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
|
|
21
|
-
*/
|
|
22
|
-
const dtsBundlePlugin = {
|
|
23
|
-
name: "powerlines:dts-bundle",
|
|
24
|
-
async generateBundle(_opts, bundle) {
|
|
25
|
-
for (const [, file] of Object.entries(bundle)) {
|
|
26
|
-
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
|
|
27
|
-
const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
|
|
28
|
-
const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
|
|
29
|
-
this.emitFile({
|
|
30
|
-
type: "asset",
|
|
31
|
-
fileName: dtsFileName,
|
|
32
|
-
source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Resolves the options for [rollup](https://rollupjs.org).
|
|
39
|
-
*
|
|
40
|
-
* @param context - The build context.
|
|
41
|
-
* @returns The resolved options.
|
|
42
|
-
*/
|
|
43
|
-
function extractRollupConfig(context) {
|
|
44
|
-
return defu({
|
|
45
|
-
input: globSync(toArray(context.entry).map((entry) => isString(entry) ? entry : entry.file)).flat(),
|
|
46
|
-
external: (source, importer, isResolved) => {
|
|
47
|
-
const externalFn = context.config.build.variant === "rollup" && context.config.build.override.external ? isFunction(context.config.build.override.external) ? context.config.build.override.external : (id) => toArray(context.config.build.override.external).includes(id) : context.config.build.variant === "vite" && context.config.build.override.build?.rollupOptions?.external ? isFunction(context.config.build.override.build?.rollupOptions?.external) ? context.config.build.override.build?.rollupOptions?.external : (id) => toArray(context.config.build?.build?.rollupOptions?.external).includes(id) : context.config.build.variant === "rollup" && context.config.build.external ? isFunction(context.config.build.external) ? context.config.build.external : (id) => toArray(context.config.build.external).includes(id) : context.config.build.variant === "vite" && context.config.build.build?.rollupOptions?.external ? isFunction(context.config.build.build?.rollupOptions?.external) ? context.config.build.build?.rollupOptions?.external : (id) => toArray(context.config.build?.build?.rollupOptions?.external).includes(id) : void 0;
|
|
48
|
-
if (isFunction(externalFn) && externalFn(source, importer, isResolved)) return true;
|
|
49
|
-
if (context.config.build.external && toArray(context.config.build.external).includes(source)) return true;
|
|
50
|
-
if (context.config.build.noExternal && toArray(context.config.build.noExternal).includes(source)) return false;
|
|
51
|
-
if (context.builtins.includes(source)) return context.config.projectType !== "application";
|
|
52
|
-
return !context.config.build.skipNodeModulesBundle;
|
|
53
|
-
},
|
|
54
|
-
plugins: [
|
|
55
|
-
typescriptPlugin({
|
|
56
|
-
check: false,
|
|
57
|
-
tsconfig: context.tsconfig.tsconfigFilePath
|
|
58
|
-
}),
|
|
59
|
-
context.config.build.define && Object.keys(context.config.build.define).length > 0 && replace({
|
|
60
|
-
sourceMap: context.config.mode === "development",
|
|
61
|
-
preventAssignment: true,
|
|
62
|
-
...context.config.build.define ?? {}
|
|
63
|
-
}),
|
|
64
|
-
context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && inject({
|
|
65
|
-
sourceMap: context.config.mode === "development",
|
|
66
|
-
...context.config.build.inject
|
|
67
|
-
}),
|
|
68
|
-
alias({ entries: Object.entries(context.alias).reduce((ret, [id, path]) => {
|
|
69
|
-
if (!ret.find((e) => e.find === id)) ret.push({
|
|
70
|
-
find: id,
|
|
71
|
-
replacement: path
|
|
72
|
-
});
|
|
73
|
-
else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
|
|
74
|
-
return ret;
|
|
75
|
-
}, []) }),
|
|
76
|
-
getBabelInputPlugin(defu(context.config.transform.babel, {
|
|
77
|
-
caller: {
|
|
78
|
-
name: "powerlines",
|
|
79
|
-
supportsStaticESM: true
|
|
80
|
-
},
|
|
81
|
-
cwd: context.config.projectRoot,
|
|
82
|
-
babelrc: false,
|
|
83
|
-
extensions: [
|
|
84
|
-
".js",
|
|
85
|
-
".jsx",
|
|
86
|
-
".ts",
|
|
87
|
-
".tsx"
|
|
88
|
-
],
|
|
89
|
-
babelHelpers: "bundled",
|
|
90
|
-
skipPreflightCheck: true,
|
|
91
|
-
exclude: /node_modules/
|
|
92
|
-
})),
|
|
93
|
-
resolve({
|
|
94
|
-
moduleDirectories: ["node_modules"],
|
|
95
|
-
preferBuiltins: true
|
|
96
|
-
}),
|
|
97
|
-
dtsBundlePlugin
|
|
98
|
-
].filter(Boolean)
|
|
99
|
-
}, context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rollup" ? omit(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build?.rollupOptions : {}, {
|
|
100
|
-
cache: !context.config.skipCache ? joinPaths(context.cachePath, "rollup") : false,
|
|
101
|
-
logLevel: context.config.logLevel,
|
|
102
|
-
output: [{
|
|
103
|
-
dir: context.config.output.buildPath,
|
|
104
|
-
format: "es",
|
|
105
|
-
entryFileNames: "[name].js",
|
|
106
|
-
preserveModules: true,
|
|
107
|
-
sourcemap: context.config.mode === "development"
|
|
108
|
-
}, {
|
|
109
|
-
dir: context.config.output.buildPath,
|
|
110
|
-
format: "cjs",
|
|
111
|
-
entryFileNames: "[name].cjs",
|
|
112
|
-
preserveModules: true,
|
|
113
|
-
sourcemap: context.config.mode === "development"
|
|
114
|
-
}]
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
//#endregion
|
|
119
|
-
export { extractRollupConfig };
|