@powerlines/plugin-rolldown 0.7.131 → 0.7.132
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/helpers/index.cjs +3 -2
- package/dist/helpers/index.d.cts +3 -1
- package/dist/helpers/index.d.mts +3 -1
- package/dist/helpers/index.mjs +2 -1
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +2 -6
- package/dist/helpers/unplugin.d.mts +2 -6
- package/dist/helpers/unplugin.mjs +1 -9
- package/dist/helpers-B15z10jN.mjs +1 -0
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DL0uimUT.d.mts +1 -0
- package/dist/index.cjs +150 -7
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +143 -3
- package/dist/plugin-CSxfX_NG.d.cts +1762 -0
- package/dist/plugin-Uw6R0wJs.d.mts +1765 -0
- package/dist/plugin-ifZVa20V.mjs +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -12
- package/dist/types/plugin.d.mts +1 -12
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-U3zd8PTP.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-CGHiXm-d.cjs +4659 -0
- package/dist/unplugin-DJFit78t.d.cts +7 -0
- package/dist/unplugin-DKYx7eGc.d.mts +7 -0
- package/dist/unplugin-oxUpd2fe.mjs +4615 -0
- package/package.json +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/schemas/fs.cjs +0 -226
- package/dist/powerlines/schemas/fs.mjs +0 -224
- package/dist/powerlines/src/api.cjs +0 -580
- package/dist/powerlines/src/api.mjs +0 -578
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
- package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
- package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
- package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
- package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
- package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
- package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
- package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
- package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
- package/dist/powerlines/src/lib/build/rolldown.cjs +0 -125
- package/dist/powerlines/src/lib/build/rolldown.mjs +0 -119
- package/dist/powerlines/src/lib/build/rollup.cjs +0 -45
- package/dist/powerlines/src/lib/build/rollup.mjs +0 -39
- package/dist/powerlines/src/lib/config-file.cjs +0 -79
- package/dist/powerlines/src/lib/config-file.mjs +0 -76
- package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
- package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
- package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
- package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
- package/dist/powerlines/src/lib/entry.cjs +0 -69
- package/dist/powerlines/src/lib/entry.mjs +0 -67
- package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
- package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
- package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
- package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
- package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
- package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
- package/dist/powerlines/src/lib/logger.cjs +0 -58
- package/dist/powerlines/src/lib/logger.mjs +0 -55
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
- package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
- package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
- package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
- package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
- 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/plugin-utils/helpers.cjs +0 -148
- package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/babel.d.mts +0 -4
- package/dist/powerlines/src/types/build.cjs +0 -15
- package/dist/powerlines/src/types/build.d.cts +0 -149
- package/dist/powerlines/src/types/build.d.mts +0 -149
- package/dist/powerlines/src/types/build.mjs +0 -14
- package/dist/powerlines/src/types/commands.cjs +0 -16
- 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/commands.mjs +0 -15
- package/dist/powerlines/src/types/config.d.cts +0 -370
- package/dist/powerlines/src/types/config.d.mts +0 -371
- package/dist/powerlines/src/types/context.d.cts +0 -403
- package/dist/powerlines/src/types/context.d.mts +0 -405
- 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.mts +0 -2
- package/dist/powerlines/src/types/plugin.cjs +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/plugin.mjs +0 -31
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_unplugin = require('../unplugin-CGHiXm-d.cjs');
|
|
2
|
+
require('../helpers-LF26RHol.cjs');
|
|
2
3
|
|
|
3
|
-
exports.createRolldownPlugin =
|
|
4
|
+
exports.createRolldownPlugin = require_unplugin.createRolldownPlugin;
|
package/dist/helpers/index.d.cts
CHANGED
package/dist/helpers/index.d.mts
CHANGED
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_plugin = require('../powerlines/src/lib/unplugin/plugin.cjs');
|
|
3
|
-
require('../powerlines/src/lib/unplugin/index.cjs');
|
|
4
|
-
let unplugin = require("unplugin");
|
|
1
|
+
const require_unplugin = require('../unplugin-CGHiXm-d.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
function createRolldownPlugin(context) {
|
|
8
|
-
return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
exports.createRolldownPlugin = createRolldownPlugin;
|
|
3
|
+
exports.createRolldownPlugin = require_unplugin.createRolldownPlugin;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createRolldownPlugin(context: RolldownPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-CSxfX_NG.cjs";
|
|
2
|
+
import { t as createRolldownPlugin } from "../unplugin-DJFit78t.cjs";
|
|
7
3
|
export { createRolldownPlugin };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createRolldownPlugin(context: RolldownPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-Uw6R0wJs.mjs";
|
|
2
|
+
import { t as createRolldownPlugin } from "../unplugin-DKYx7eGc.mjs";
|
|
7
3
|
export { createRolldownPlugin };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
-
import { createEsbuildPlugin } from "unplugin";
|
|
1
|
+
import { t as createRolldownPlugin } from "../unplugin-oxUpd2fe.mjs";
|
|
4
2
|
|
|
5
|
-
//#region src/helpers/unplugin.ts
|
|
6
|
-
function createRolldownPlugin(context) {
|
|
7
|
-
return createEsbuildPlugin(createUnplugin(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
3
|
export { createRolldownPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,156 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require('./
|
|
2
|
+
const require_unplugin = require('./unplugin-CGHiXm-d.cjs');
|
|
3
|
+
require('./helpers-LF26RHol.cjs');
|
|
4
|
+
require('./plugin-pBKbb5K9.cjs');
|
|
5
|
+
require('./types-o3zWarRp.cjs');
|
|
6
6
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
7
7
|
let defu = require("defu");
|
|
8
|
-
defu =
|
|
8
|
+
defu = require_unplugin.__toESM(defu);
|
|
9
|
+
let __rollup_plugin_babel = require("@rollup/plugin-babel");
|
|
10
|
+
let __rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
11
|
+
__rollup_plugin_inject = require_unplugin.__toESM(__rollup_plugin_inject);
|
|
12
|
+
let __rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
13
|
+
__rollup_plugin_node_resolve = require_unplugin.__toESM(__rollup_plugin_node_resolve);
|
|
14
|
+
let __rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
15
|
+
__rollup_plugin_replace = require_unplugin.__toESM(__rollup_plugin_replace);
|
|
16
|
+
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
17
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
18
|
+
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
19
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
20
|
+
let node_fs = require("node:fs");
|
|
21
|
+
let rolldown_experimental = require("rolldown/experimental");
|
|
22
|
+
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
23
|
+
rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2);
|
|
24
|
+
require("@rollup/plugin-alias");
|
|
9
25
|
let rolldown = require("rolldown");
|
|
10
26
|
|
|
27
|
+
//#region ../powerlines/src/lib/build/rollup.ts
|
|
28
|
+
/**
|
|
29
|
+
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
|
|
33
|
+
*/
|
|
34
|
+
const dtsBundlePlugin = {
|
|
35
|
+
name: "powerlines:dts-bundle",
|
|
36
|
+
async generateBundle(_opts, bundle) {
|
|
37
|
+
for (const [, file] of Object.entries(bundle)) {
|
|
38
|
+
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
|
|
39
|
+
const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
|
|
40
|
+
const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
|
|
41
|
+
this.emitFile({
|
|
42
|
+
type: "asset",
|
|
43
|
+
fileName: dtsFileName,
|
|
44
|
+
source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region ../powerlines/src/lib/build/rolldown.ts
|
|
52
|
+
/**
|
|
53
|
+
* Resolves the options for [rolldown](https://rolldown.rs).
|
|
54
|
+
*
|
|
55
|
+
* @param context - The build context.
|
|
56
|
+
* @returns The resolved options.
|
|
57
|
+
*/
|
|
58
|
+
function extractRolldownConfig(context) {
|
|
59
|
+
return (0, defu.default)({
|
|
60
|
+
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(),
|
|
61
|
+
external: (source, importer, isResolved) => {
|
|
62
|
+
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;
|
|
63
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(externalFn) && externalFn(source, importer, isResolved)) return true;
|
|
64
|
+
if (context.config.build.external && (0, __stryke_convert_to_array.toArray)(context.config.build.external).includes(source)) return true;
|
|
65
|
+
if (context.config.build.noExternal && (0, __stryke_convert_to_array.toArray)(context.config.build.noExternal).includes(source)) return false;
|
|
66
|
+
if (context.builtins.includes(source)) return context.config.projectType !== "application";
|
|
67
|
+
return !context.config.build.skipNodeModulesBundle;
|
|
68
|
+
},
|
|
69
|
+
plugins: [
|
|
70
|
+
(0, rollup_plugin_typescript2.default)({
|
|
71
|
+
check: false,
|
|
72
|
+
tsconfig: context.tsconfig.tsconfigFilePath
|
|
73
|
+
}),
|
|
74
|
+
context.config.build.define && Object.keys(context.config.build.define).length > 0 && (0, __rollup_plugin_replace.default)({
|
|
75
|
+
sourceMap: context.config.mode === "development",
|
|
76
|
+
preventAssignment: true,
|
|
77
|
+
...context.config.build.define ?? {}
|
|
78
|
+
}),
|
|
79
|
+
context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && (0, __rollup_plugin_inject.default)({
|
|
80
|
+
sourceMap: context.config.mode === "development",
|
|
81
|
+
...context.config.build.inject
|
|
82
|
+
}),
|
|
83
|
+
(0, rolldown_experimental.viteAliasPlugin)({ entries: context.builtins.reduce((ret, id) => {
|
|
84
|
+
if (!ret.find((e) => e.find === id)) {
|
|
85
|
+
const path = context.fs.ids[id];
|
|
86
|
+
if (path) ret.push({
|
|
87
|
+
find: id,
|
|
88
|
+
replacement: path
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return ret;
|
|
92
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
93
|
+
if (!ret.find((e) => e.find === id)) ret.push({
|
|
94
|
+
find: id,
|
|
95
|
+
replacement: path
|
|
96
|
+
});
|
|
97
|
+
return ret;
|
|
98
|
+
}, []) : []) }),
|
|
99
|
+
(0, __rollup_plugin_babel.getBabelInputPlugin)((0, defu.default)(context.config.transform.babel, {
|
|
100
|
+
caller: {
|
|
101
|
+
name: "powerlines",
|
|
102
|
+
supportsStaticESM: true
|
|
103
|
+
},
|
|
104
|
+
cwd: context.config.projectRoot,
|
|
105
|
+
babelrc: false,
|
|
106
|
+
extensions: [
|
|
107
|
+
".js",
|
|
108
|
+
".jsx",
|
|
109
|
+
".ts",
|
|
110
|
+
".tsx"
|
|
111
|
+
],
|
|
112
|
+
babelHelpers: "bundled",
|
|
113
|
+
skipPreflightCheck: true,
|
|
114
|
+
exclude: /node_modules/
|
|
115
|
+
})),
|
|
116
|
+
(0, __rollup_plugin_node_resolve.default)({
|
|
117
|
+
moduleDirectories: ["node_modules"],
|
|
118
|
+
preferBuiltins: true
|
|
119
|
+
}),
|
|
120
|
+
dtsBundlePlugin
|
|
121
|
+
]
|
|
122
|
+
}, context.config.build.variant === "rolldown" || context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rolldown" || context.config.build.variant === "rollup" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build : {}, {
|
|
123
|
+
experimental: { viteMode: context.config.build.variant === "vite" },
|
|
124
|
+
resolve: {
|
|
125
|
+
mainFields: context.config.build.mainFields,
|
|
126
|
+
conditions: context.config.build.conditions,
|
|
127
|
+
define: context.config.build.define,
|
|
128
|
+
extensions: context.config.build.extensions
|
|
129
|
+
},
|
|
130
|
+
platform: context.config.build.platform,
|
|
131
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
132
|
+
cache: !context.config.skipCache ? (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "rolldown") : false,
|
|
133
|
+
logLevel: context.config.logLevel,
|
|
134
|
+
onLog: context.log,
|
|
135
|
+
jsx: "automatic",
|
|
136
|
+
keepNames: true,
|
|
137
|
+
treeshake: true,
|
|
138
|
+
minify: context.config.mode === "production",
|
|
139
|
+
output: [{
|
|
140
|
+
dir: context.config.output.buildPath,
|
|
141
|
+
format: "es",
|
|
142
|
+
preserveModules: true,
|
|
143
|
+
sourcemap: context.config.mode === "development"
|
|
144
|
+
}, {
|
|
145
|
+
dir: context.config.output.buildPath,
|
|
146
|
+
format: "cjs",
|
|
147
|
+
preserveModules: true,
|
|
148
|
+
sourcemap: context.config.mode === "development"
|
|
149
|
+
}]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
11
154
|
//#region src/index.ts
|
|
12
155
|
/**
|
|
13
156
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
@@ -25,7 +168,7 @@ const plugin = (options = {}) => {
|
|
|
25
168
|
};
|
|
26
169
|
},
|
|
27
170
|
async build() {
|
|
28
|
-
const result = await (0, rolldown.rolldown)((0, defu.default)({ plugins: [
|
|
171
|
+
const result = await (0, rolldown.rolldown)((0, defu.default)({ plugins: [require_unplugin.createRolldownPlugin(this)] }, extractRolldownConfig(this)));
|
|
29
172
|
await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.output.format).map(async (format) => result.write({ format })));
|
|
30
173
|
}
|
|
31
174
|
};
|
|
@@ -33,6 +176,6 @@ const plugin = (options = {}) => {
|
|
|
33
176
|
var src_default = plugin;
|
|
34
177
|
|
|
35
178
|
//#endregion
|
|
36
|
-
exports.createRolldownPlugin =
|
|
179
|
+
exports.createRolldownPlugin = require_unplugin.createRolldownPlugin;
|
|
37
180
|
exports.default = src_default;
|
|
38
181
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { a as __ΩRolldownPluginOptions, i as __ΩRolldownPluginContext, n as RolldownPluginOptions, o as __ΩRolldownPluginResolvedConfig, r as RolldownPluginResolvedConfig, s as Plugin, t as RolldownPluginContext } from "./plugin-CSxfX_NG.cjs";
|
|
2
|
+
import { t as createRolldownPlugin } from "./unplugin-DJFit78t.cjs";
|
|
3
|
+
import "./index-D6CnpA_r.cjs";
|
|
4
|
+
import "./index-D4ELpJXS.cjs";
|
|
4
5
|
|
|
5
6
|
//#region src/index.d.ts
|
|
6
7
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import "./types/index.mjs";
|
|
1
|
+
import { a as __ΩRolldownPluginOptions, i as __ΩRolldownPluginContext, n as RolldownPluginOptions, o as __ΩRolldownPluginResolvedConfig, r as RolldownPluginResolvedConfig, s as Plugin, t as RolldownPluginContext } from "./plugin-Uw6R0wJs.mjs";
|
|
2
|
+
import { t as createRolldownPlugin } from "./unplugin-DKYx7eGc.mjs";
|
|
3
|
+
import "./index-DL0uimUT.mjs";
|
|
4
|
+
import "./index-9iG2qHLe.mjs";
|
|
6
5
|
|
|
7
6
|
//#region src/index.d.ts
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,150 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
1
|
+
import { t as createRolldownPlugin } from "./unplugin-oxUpd2fe.mjs";
|
|
2
|
+
import "./helpers-B15z10jN.mjs";
|
|
3
|
+
import "./plugin-ifZVa20V.mjs";
|
|
4
|
+
import "./types-U3zd8PTP.mjs";
|
|
4
5
|
import { toArray } from "@stryke/convert/to-array";
|
|
5
6
|
import defu$1 from "defu";
|
|
7
|
+
import { getBabelInputPlugin } from "@rollup/plugin-babel";
|
|
8
|
+
import inject from "@rollup/plugin-inject";
|
|
9
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
10
|
+
import replace from "@rollup/plugin-replace";
|
|
11
|
+
import { omit } from "@stryke/helpers/omit";
|
|
12
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
13
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
14
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
15
|
+
import { globSync } from "node:fs";
|
|
16
|
+
import { viteAliasPlugin } from "rolldown/experimental";
|
|
17
|
+
import typescriptPlugin from "rollup-plugin-typescript2";
|
|
18
|
+
import "@rollup/plugin-alias";
|
|
6
19
|
import { rolldown } from "rolldown";
|
|
7
20
|
|
|
21
|
+
//#region ../powerlines/src/lib/build/rollup.ts
|
|
22
|
+
/**
|
|
23
|
+
* A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
|
|
27
|
+
*/
|
|
28
|
+
const dtsBundlePlugin = {
|
|
29
|
+
name: "powerlines:dts-bundle",
|
|
30
|
+
async generateBundle(_opts, bundle) {
|
|
31
|
+
for (const [, file] of Object.entries(bundle)) {
|
|
32
|
+
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
|
|
33
|
+
const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
|
|
34
|
+
const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
|
|
35
|
+
this.emitFile({
|
|
36
|
+
type: "asset",
|
|
37
|
+
fileName: dtsFileName,
|
|
38
|
+
source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region ../powerlines/src/lib/build/rolldown.ts
|
|
46
|
+
/**
|
|
47
|
+
* Resolves the options for [rolldown](https://rolldown.rs).
|
|
48
|
+
*
|
|
49
|
+
* @param context - The build context.
|
|
50
|
+
* @returns The resolved options.
|
|
51
|
+
*/
|
|
52
|
+
function extractRolldownConfig(context) {
|
|
53
|
+
return defu$1({
|
|
54
|
+
input: globSync(toArray(context.entry).map((entry) => isString(entry) ? entry : entry.file)).flat(),
|
|
55
|
+
external: (source, importer, isResolved) => {
|
|
56
|
+
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;
|
|
57
|
+
if (isFunction(externalFn) && externalFn(source, importer, isResolved)) return true;
|
|
58
|
+
if (context.config.build.external && toArray(context.config.build.external).includes(source)) return true;
|
|
59
|
+
if (context.config.build.noExternal && toArray(context.config.build.noExternal).includes(source)) return false;
|
|
60
|
+
if (context.builtins.includes(source)) return context.config.projectType !== "application";
|
|
61
|
+
return !context.config.build.skipNodeModulesBundle;
|
|
62
|
+
},
|
|
63
|
+
plugins: [
|
|
64
|
+
typescriptPlugin({
|
|
65
|
+
check: false,
|
|
66
|
+
tsconfig: context.tsconfig.tsconfigFilePath
|
|
67
|
+
}),
|
|
68
|
+
context.config.build.define && Object.keys(context.config.build.define).length > 0 && replace({
|
|
69
|
+
sourceMap: context.config.mode === "development",
|
|
70
|
+
preventAssignment: true,
|
|
71
|
+
...context.config.build.define ?? {}
|
|
72
|
+
}),
|
|
73
|
+
context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && inject({
|
|
74
|
+
sourceMap: context.config.mode === "development",
|
|
75
|
+
...context.config.build.inject
|
|
76
|
+
}),
|
|
77
|
+
viteAliasPlugin({ entries: context.builtins.reduce((ret, id) => {
|
|
78
|
+
if (!ret.find((e) => e.find === id)) {
|
|
79
|
+
const path = context.fs.ids[id];
|
|
80
|
+
if (path) ret.push({
|
|
81
|
+
find: id,
|
|
82
|
+
replacement: path
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return ret;
|
|
86
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
87
|
+
if (!ret.find((e) => e.find === id)) ret.push({
|
|
88
|
+
find: id,
|
|
89
|
+
replacement: path
|
|
90
|
+
});
|
|
91
|
+
return ret;
|
|
92
|
+
}, []) : []) }),
|
|
93
|
+
getBabelInputPlugin(defu$1(context.config.transform.babel, {
|
|
94
|
+
caller: {
|
|
95
|
+
name: "powerlines",
|
|
96
|
+
supportsStaticESM: true
|
|
97
|
+
},
|
|
98
|
+
cwd: context.config.projectRoot,
|
|
99
|
+
babelrc: false,
|
|
100
|
+
extensions: [
|
|
101
|
+
".js",
|
|
102
|
+
".jsx",
|
|
103
|
+
".ts",
|
|
104
|
+
".tsx"
|
|
105
|
+
],
|
|
106
|
+
babelHelpers: "bundled",
|
|
107
|
+
skipPreflightCheck: true,
|
|
108
|
+
exclude: /node_modules/
|
|
109
|
+
})),
|
|
110
|
+
resolve({
|
|
111
|
+
moduleDirectories: ["node_modules"],
|
|
112
|
+
preferBuiltins: true
|
|
113
|
+
}),
|
|
114
|
+
dtsBundlePlugin
|
|
115
|
+
]
|
|
116
|
+
}, context.config.build.variant === "rolldown" || context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rolldown" || context.config.build.variant === "rollup" ? omit(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build : {}, {
|
|
117
|
+
experimental: { viteMode: context.config.build.variant === "vite" },
|
|
118
|
+
resolve: {
|
|
119
|
+
mainFields: context.config.build.mainFields,
|
|
120
|
+
conditions: context.config.build.conditions,
|
|
121
|
+
define: context.config.build.define,
|
|
122
|
+
extensions: context.config.build.extensions
|
|
123
|
+
},
|
|
124
|
+
platform: context.config.build.platform,
|
|
125
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
126
|
+
cache: !context.config.skipCache ? joinPaths(context.cachePath, "rolldown") : false,
|
|
127
|
+
logLevel: context.config.logLevel,
|
|
128
|
+
onLog: context.log,
|
|
129
|
+
jsx: "automatic",
|
|
130
|
+
keepNames: true,
|
|
131
|
+
treeshake: true,
|
|
132
|
+
minify: context.config.mode === "production",
|
|
133
|
+
output: [{
|
|
134
|
+
dir: context.config.output.buildPath,
|
|
135
|
+
format: "es",
|
|
136
|
+
preserveModules: true,
|
|
137
|
+
sourcemap: context.config.mode === "development"
|
|
138
|
+
}, {
|
|
139
|
+
dir: context.config.output.buildPath,
|
|
140
|
+
format: "cjs",
|
|
141
|
+
preserveModules: true,
|
|
142
|
+
sourcemap: context.config.mode === "development"
|
|
143
|
+
}]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//#endregion
|
|
8
148
|
//#region src/index.ts
|
|
9
149
|
/**
|
|
10
150
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|