@powerlines/plugin-rolldown 0.7.132 → 0.7.134
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 +2 -3
- package/dist/helpers/index.d.cts +1 -3
- package/dist/helpers/index.d.mts +1 -3
- package/dist/helpers/index.mjs +1 -2
- package/dist/helpers/unplugin.cjs +11 -2
- package/dist/helpers/unplugin.d.cts +6 -2
- package/dist/helpers/unplugin.d.mts +6 -2
- package/dist/helpers/unplugin.mjs +9 -1
- package/dist/index.cjs +7 -150
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -143
- package/dist/powerlines/schemas/fs.cjs +226 -0
- package/dist/powerlines/schemas/fs.mjs +224 -0
- package/dist/powerlines/src/api.cjs +580 -0
- package/dist/powerlines/src/api.mjs +578 -0
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -0
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -0
- package/dist/powerlines/src/internal/helpers/environment.cjs +52 -0
- package/dist/powerlines/src/internal/helpers/environment.mjs +48 -0
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +51 -0
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +49 -0
- package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -0
- package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -0
- package/dist/powerlines/src/internal/helpers/install.cjs +37 -0
- package/dist/powerlines/src/internal/helpers/install.mjs +36 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +98 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +94 -0
- package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
- package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
- package/dist/powerlines/src/lib/build/rolldown.cjs +125 -0
- package/dist/powerlines/src/lib/build/rolldown.mjs +119 -0
- package/dist/powerlines/src/lib/build/rollup.cjs +45 -0
- package/dist/powerlines/src/lib/build/rollup.mjs +39 -0
- package/dist/powerlines/src/lib/config-file.cjs +79 -0
- package/dist/powerlines/src/lib/config-file.mjs +76 -0
- package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
- package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
- package/dist/powerlines/src/lib/contexts/context.cjs +933 -0
- package/dist/powerlines/src/lib/contexts/context.mjs +931 -0
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -0
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -0
- package/dist/powerlines/src/lib/entry.cjs +69 -0
- package/dist/powerlines/src/lib/entry.mjs +67 -0
- package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
- package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
- package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
- package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
- package/dist/powerlines/src/lib/fs/vfs.cjs +830 -0
- package/dist/powerlines/src/lib/fs/vfs.mjs +828 -0
- package/dist/powerlines/src/lib/logger.cjs +58 -0
- package/dist/powerlines/src/lib/logger.mjs +55 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
- package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
- package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -0
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -0
- package/dist/powerlines/src/lib/unplugin/index.cjs +3 -0
- package/dist/powerlines/src/lib/unplugin/index.mjs +5 -0
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +128 -0
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +127 -0
- package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
- package/dist/powerlines/src/lib/utilities/meta.cjs +45 -0
- package/dist/powerlines/src/lib/utilities/meta.mjs +41 -0
- package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
- package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -0
- package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
- package/dist/powerlines/src/types/babel.d.mts +4 -0
- package/dist/powerlines/src/types/build.cjs +15 -0
- package/dist/powerlines/src/types/build.d.cts +149 -0
- package/dist/powerlines/src/types/build.d.mts +149 -0
- package/dist/powerlines/src/types/build.mjs +14 -0
- package/dist/powerlines/src/types/commands.cjs +16 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/commands.mjs +15 -0
- package/dist/powerlines/src/types/config.d.cts +377 -0
- package/dist/powerlines/src/types/config.d.mts +379 -0
- package/dist/powerlines/src/types/context.d.cts +403 -0
- package/dist/powerlines/src/types/context.d.mts +405 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.cjs +32 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/plugin.mjs +31 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +83 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +12 -1
- package/dist/types/plugin.d.mts +12 -1
- package/dist/types/plugin.mjs +0 -2
- package/package.json +5 -5
- package/dist/helpers-B15z10jN.mjs +0 -1
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-9iG2qHLe.d.mts +0 -1
- package/dist/index-D4ELpJXS.d.cts +0 -1
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-DL0uimUT.d.mts +0 -1
- package/dist/plugin-CSxfX_NG.d.cts +0 -1762
- package/dist/plugin-Uw6R0wJs.d.mts +0 -1765
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-CGHiXm-d.cjs +0 -4659
- package/dist/unplugin-DJFit78t.d.cts +0 -7
- package/dist/unplugin-DKYx7eGc.d.mts +0 -7
- package/dist/unplugin-oxUpd2fe.mjs +0 -4615
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('../helpers-LF26RHol.cjs');
|
|
1
|
+
const require_helpers_unplugin = require('./unplugin.cjs');
|
|
3
2
|
|
|
4
|
-
exports.createRolldownPlugin =
|
|
3
|
+
exports.createRolldownPlugin = require_helpers_unplugin.createRolldownPlugin;
|
package/dist/helpers/index.d.cts
CHANGED
package/dist/helpers/index.d.mts
CHANGED
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_plugin = require('../powerlines/src/lib/unplugin/plugin.cjs');
|
|
3
|
+
require('../powerlines/src/lib/unplugin/index.cjs');
|
|
4
|
+
let unplugin = require("unplugin");
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
//#region src/helpers/unplugin.ts
|
|
7
|
+
function createRolldownPlugin(context) {
|
|
8
|
+
return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.createRolldownPlugin = createRolldownPlugin;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import
|
|
1
|
+
import { RolldownPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
import * as esbuild0 from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createRolldownPlugin(context: RolldownPluginContext): esbuild0.Plugin;
|
|
6
|
+
//#endregion
|
|
3
7
|
export { createRolldownPlugin };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import
|
|
1
|
+
import { RolldownPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
import * as esbuild0 from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createRolldownPlugin(context: RolldownPluginContext): esbuild0.Plugin;
|
|
6
|
+
//#endregion
|
|
3
7
|
export { createRolldownPlugin };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnplugin } from "../powerlines/src/lib/unplugin/plugin.mjs";
|
|
2
|
+
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
2
4
|
|
|
5
|
+
//#region src/helpers/unplugin.ts
|
|
6
|
+
function createRolldownPlugin(context) {
|
|
7
|
+
return createEsbuildPlugin(createUnplugin(context))({});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
3
11
|
export { createRolldownPlugin };
|
package/dist/index.cjs
CHANGED
|
@@ -1,156 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
require('./
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_rolldown = require('./powerlines/src/lib/build/rolldown.cjs');
|
|
4
|
+
const require_helpers_unplugin = require('./helpers/unplugin.cjs');
|
|
5
|
+
require('./helpers/index.cjs');
|
|
6
6
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
7
7
|
let defu = require("defu");
|
|
8
|
-
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");
|
|
8
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
25
9
|
let rolldown = require("rolldown");
|
|
26
10
|
|
|
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
|
|
154
11
|
//#region src/index.ts
|
|
155
12
|
/**
|
|
156
13
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
@@ -168,7 +25,7 @@ const plugin = (options = {}) => {
|
|
|
168
25
|
};
|
|
169
26
|
},
|
|
170
27
|
async build() {
|
|
171
|
-
const result = await (0, rolldown.rolldown)((0, defu.default)({ plugins: [
|
|
28
|
+
const result = await (0, rolldown.rolldown)((0, defu.default)({ plugins: [require_helpers_unplugin.createRolldownPlugin(this)] }, require_rolldown.extractRolldownConfig(this)));
|
|
172
29
|
await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.output.format).map(async (format) => result.write({ format })));
|
|
173
30
|
}
|
|
174
31
|
};
|
|
@@ -176,6 +33,6 @@ const plugin = (options = {}) => {
|
|
|
176
33
|
var src_default = plugin;
|
|
177
34
|
|
|
178
35
|
//#endregion
|
|
179
|
-
exports.createRolldownPlugin =
|
|
36
|
+
exports.createRolldownPlugin = require_helpers_unplugin.createRolldownPlugin;
|
|
180
37
|
exports.default = src_default;
|
|
181
38
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index-D4ELpJXS.cjs";
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
2
|
+
import { RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig } from "./types/plugin.cjs";
|
|
3
|
+
import { createRolldownPlugin } from "./helpers/unplugin.cjs";
|
|
5
4
|
|
|
6
5
|
//#region src/index.d.ts
|
|
7
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
2
|
+
import { RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig } from "./types/plugin.mjs";
|
|
3
|
+
import { createRolldownPlugin } from "./helpers/unplugin.mjs";
|
|
4
|
+
import "./helpers/index.mjs";
|
|
5
|
+
import "./types/index.mjs";
|
|
5
6
|
|
|
6
7
|
//#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,150 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./helpers
|
|
3
|
-
import "./
|
|
4
|
-
import "./types-U3zd8PTP.mjs";
|
|
1
|
+
import { extractRolldownConfig } from "./powerlines/src/lib/build/rolldown.mjs";
|
|
2
|
+
import { createRolldownPlugin } from "./helpers/unplugin.mjs";
|
|
3
|
+
import "./helpers/index.mjs";
|
|
5
4
|
import { toArray } from "@stryke/convert/to-array";
|
|
6
5
|
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";
|
|
19
6
|
import { rolldown } from "rolldown";
|
|
20
7
|
|
|
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
|
|
148
8
|
//#region src/index.ts
|
|
149
9
|
/**
|
|
150
10
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|