@powerlines/unplugin 0.0.4
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/LICENSE +201 -0
- package/README.md +305 -0
- package/dist/_virtual/_rolldown/runtime.cjs +45 -0
- package/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/astro.cjs +37 -0
- package/dist/astro.d.cts +27 -0
- package/dist/astro.d.cts.map +1 -0
- package/dist/astro.d.mts +27 -0
- package/dist/astro.d.mts.map +1 -0
- package/dist/astro.mjs +36 -0
- package/dist/astro.mjs.map +1 -0
- package/dist/esbuild.cjs +155 -0
- package/dist/esbuild.d.cts +69 -0
- package/dist/esbuild.d.cts.map +1 -0
- package/dist/esbuild.d.mts +69 -0
- package/dist/esbuild.d.mts.map +1 -0
- package/dist/esbuild.mjs +149 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/farm.cjs +56 -0
- package/dist/farm.d.cts +51 -0
- package/dist/farm.d.cts.map +1 -0
- package/dist/farm.d.mts +51 -0
- package/dist/farm.d.mts.map +1 -0
- package/dist/farm.mjs +54 -0
- package/dist/farm.mjs.map +1 -0
- package/dist/index.cjs +46 -0
- package/dist/index.d.cts +37 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +39 -0
- package/dist/index.mjs.map +1 -0
- package/dist/next.cjs +37 -0
- package/dist/next.d.cts +25 -0
- package/dist/next.d.cts.map +1 -0
- package/dist/next.d.mts +25 -0
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +36 -0
- package/dist/next.mjs.map +1 -0
- package/dist/nuxt.cjs +44 -0
- package/dist/nuxt.d.cts +28 -0
- package/dist/nuxt.d.cts.map +1 -0
- package/dist/nuxt.d.mts +29 -0
- package/dist/nuxt.d.mts.map +1 -0
- package/dist/nuxt.mjs +44 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/package.cjs +18 -0
- package/dist/package.mjs +7 -0
- package/dist/package.mjs.map +1 -0
- package/dist/rolldown.cjs +161 -0
- package/dist/rolldown.d.cts +65 -0
- package/dist/rolldown.d.cts.map +1 -0
- package/dist/rolldown.d.mts +65 -0
- package/dist/rolldown.d.mts.map +1 -0
- package/dist/rolldown.mjs +153 -0
- package/dist/rolldown.mjs.map +1 -0
- package/dist/rollup.cjs +159 -0
- package/dist/rollup.d.cts +64 -0
- package/dist/rollup.d.cts.map +1 -0
- package/dist/rollup.d.mts +64 -0
- package/dist/rollup.d.mts.map +1 -0
- package/dist/rollup.mjs +149 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/rspack.cjs +95 -0
- package/dist/rspack.d.cts +58 -0
- package/dist/rspack.d.cts.map +1 -0
- package/dist/rspack.d.mts +58 -0
- package/dist/rspack.d.mts.map +1 -0
- package/dist/rspack.mjs +90 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/tsdown.cjs +217 -0
- package/dist/tsdown.d.cts +63 -0
- package/dist/tsdown.d.cts.map +1 -0
- package/dist/tsdown.d.mts +63 -0
- package/dist/tsdown.d.mts.map +1 -0
- package/dist/tsdown.mjs +209 -0
- package/dist/tsdown.mjs.map +1 -0
- package/dist/tsup.cjs +116 -0
- package/dist/tsup.d.cts +49 -0
- package/dist/tsup.d.cts.map +1 -0
- package/dist/tsup.d.mts +49 -0
- package/dist/tsup.d.mts.map +1 -0
- package/dist/tsup.mjs +110 -0
- package/dist/tsup.mjs.map +1 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +12 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +12 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/dist/unloader.cjs +52 -0
- package/dist/unloader.d.cts +46 -0
- package/dist/unloader.d.cts.map +1 -0
- package/dist/unloader.d.mts +46 -0
- package/dist/unloader.d.mts.map +1 -0
- package/dist/unloader.mjs +49 -0
- package/dist/unloader.mjs.map +1 -0
- package/dist/unplugin.cjs +239 -0
- package/dist/unplugin.d.cts +60 -0
- package/dist/unplugin.d.cts.map +1 -0
- package/dist/unplugin.d.mts +60 -0
- package/dist/unplugin.d.mts.map +1 -0
- package/dist/unplugin.mjs +234 -0
- package/dist/unplugin.mjs.map +1 -0
- package/dist/vite.cjs +161 -0
- package/dist/vite.d.cts +59 -0
- package/dist/vite.d.cts.map +1 -0
- package/dist/vite.d.mts +59 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +155 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +94 -0
- package/dist/webpack.d.cts +58 -0
- package/dist/webpack.d.cts.map +1 -0
- package/dist/webpack.d.mts +58 -0
- package/dist/webpack.d.mts.map +1 -0
- package/dist/webpack.mjs +89 -0
- package/dist/webpack.mjs.map +1 -0
- package/package.json +163 -0
package/dist/tsup.cjs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_esbuild = require('./esbuild.cjs');
|
|
4
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
6
|
+
let defu = require("defu");
|
|
7
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
8
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
9
|
+
let _storm_software_tsup_constants = require("@storm-software/tsup/constants");
|
|
10
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
11
|
+
|
|
12
|
+
//#region src/tsup.ts
|
|
13
|
+
const DEFAULT_OPTIONS = {
|
|
14
|
+
..._storm_software_tsup_constants.DEFAULT_BUILD_OPTIONS,
|
|
15
|
+
target: "esnext",
|
|
16
|
+
config: false,
|
|
17
|
+
minify: true,
|
|
18
|
+
sourcemap: false,
|
|
19
|
+
cjsInterop: true,
|
|
20
|
+
bundle: true,
|
|
21
|
+
dts: true,
|
|
22
|
+
shims: true,
|
|
23
|
+
silent: true,
|
|
24
|
+
treeshake: true,
|
|
25
|
+
keepNames: true,
|
|
26
|
+
splitting: true,
|
|
27
|
+
banner: {}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
31
|
+
*
|
|
32
|
+
* @param context - The build context.
|
|
33
|
+
* @param entryPoints - The entry points to resolve.
|
|
34
|
+
* @returns The resolved entry options.
|
|
35
|
+
*/
|
|
36
|
+
function resolveEntry(context, entryPoints) {
|
|
37
|
+
return require_esbuild.resolveEntry(context, entryPoints);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
41
|
+
*
|
|
42
|
+
* @param context - The build context.
|
|
43
|
+
* @returns The resolved options.
|
|
44
|
+
*/
|
|
45
|
+
function resolveOptions(context) {
|
|
46
|
+
const result = (0, defu.default)({
|
|
47
|
+
entry: Object.fromEntries(Object.entries(resolveEntry(context, context.entry)).map(([key, value]) => [key, (0, _stryke_path_append.appendPath)(value, context.config.root)])),
|
|
48
|
+
esbuildOptions: (options) => {
|
|
49
|
+
options.alias = {
|
|
50
|
+
...context.alias,
|
|
51
|
+
...context.builtins.reduce((ret, id) => {
|
|
52
|
+
const path = context.fs.paths[id];
|
|
53
|
+
if (path) ret[id] = path;
|
|
54
|
+
return ret;
|
|
55
|
+
}, {}),
|
|
56
|
+
...options.alias
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
noExternal: context.builtins
|
|
60
|
+
}, {
|
|
61
|
+
name: context.config.name,
|
|
62
|
+
root: context.config.root,
|
|
63
|
+
projectRoot: context.config.root,
|
|
64
|
+
assets: context.config.output.copy ? context.config.output.copy.assets : void 0,
|
|
65
|
+
resolveExtensions: context.config.resolve.extensions,
|
|
66
|
+
outputPath: (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
|
|
67
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
68
|
+
dts: { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions },
|
|
69
|
+
format: context.config.output.format,
|
|
70
|
+
mode: context.config.mode,
|
|
71
|
+
minify: context.config.output.minify,
|
|
72
|
+
metafile: context.config.mode === "development",
|
|
73
|
+
sourcemap: context.config.output.sourceMap,
|
|
74
|
+
silent: context.config.logLevel.general === "silent" || context.config.mode === "production",
|
|
75
|
+
verbose: context.config.logLevel.general === "trace" || context.config.mode === "development",
|
|
76
|
+
workspaceConfig: { workspaceRoot: context.config.cwd }
|
|
77
|
+
}, DEFAULT_OPTIONS);
|
|
78
|
+
result.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(result.format));
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A Tsup configuration function that integrates Powerlines into the build process.
|
|
83
|
+
*
|
|
84
|
+
* @see https://tsup.egoist.dev/#/config
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* // tsup.config.ts
|
|
89
|
+
* import withPowerlines from "@powerlines/unplugin/tsup";
|
|
90
|
+
*
|
|
91
|
+
* export default withPowerlines({
|
|
92
|
+
* entry: ["src/index.ts"],
|
|
93
|
+
* format: ["cjs", "esm"],
|
|
94
|
+
* dts: true,
|
|
95
|
+
* sourcemap: true,
|
|
96
|
+
* clean: true,
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @param options - The Tsup options to merge with the Powerlines configuration.
|
|
102
|
+
* @returns The merged Tsup configuration options.
|
|
103
|
+
*/
|
|
104
|
+
function withPlugin(options) {
|
|
105
|
+
return {
|
|
106
|
+
...options,
|
|
107
|
+
esbuildPlugins: [...options.esbuildPlugins ?? [], require_esbuild.default()]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
|
|
113
|
+
exports.default = withPlugin;
|
|
114
|
+
exports.withPlugin = withPlugin;
|
|
115
|
+
exports.resolveEntry = resolveEntry;
|
|
116
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/tsup.d.cts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
|
|
2
|
+
import { Entry } from "@storm-software/build-tools/types";
|
|
3
|
+
import { resolveOptions as resolveOptions$1 } from "@storm-software/tsup";
|
|
4
|
+
import { Options as Options$1 } from "tsup";
|
|
5
|
+
|
|
6
|
+
//#region src/tsup.d.ts
|
|
7
|
+
declare const DEFAULT_OPTIONS: Partial<Options$1>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
10
|
+
*
|
|
11
|
+
* @param context - The build context.
|
|
12
|
+
* @param entryPoints - The entry points to resolve.
|
|
13
|
+
* @returns The resolved entry options.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveEntry(context: Context, entryPoints: ResolvedEntryTypeDefinition[] | string[]): Entry;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
18
|
+
*
|
|
19
|
+
* @param context - The build context.
|
|
20
|
+
* @returns The resolved options.
|
|
21
|
+
*/
|
|
22
|
+
declare function resolveOptions(context: Context): Parameters<typeof resolveOptions$1>[0];
|
|
23
|
+
/**
|
|
24
|
+
* A Tsup configuration function that integrates Powerlines into the build process.
|
|
25
|
+
*
|
|
26
|
+
* @see https://tsup.egoist.dev/#/config
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // tsup.config.ts
|
|
31
|
+
* import withPowerlines from "@powerlines/unplugin/tsup";
|
|
32
|
+
*
|
|
33
|
+
* export default withPowerlines({
|
|
34
|
+
* entry: ["src/index.ts"],
|
|
35
|
+
* format: ["cjs", "esm"],
|
|
36
|
+
* dts: true,
|
|
37
|
+
* sourcemap: true,
|
|
38
|
+
* clean: true,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param options - The Tsup options to merge with the Powerlines configuration.
|
|
44
|
+
* @returns The merged Tsup configuration options.
|
|
45
|
+
*/
|
|
46
|
+
declare function withPlugin(options: Options$1): Options$1;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { DEFAULT_OPTIONS, withPlugin as default, withPlugin, resolveEntry, resolveOptions };
|
|
49
|
+
//# sourceMappingURL=tsup.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.d.cts","names":[],"sources":["../src/tsup.ts"],"mappings":";;;;;;cA8Ba,eAAA,EAAiB,OAAA,CAAQ,SAAA;;AAAtC;;;;;AAwBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,EAAa,2BAAA,gBACZ,KAAA;;;;;;;iBAca,cAAA,CACd,OAAA,EAAS,OAAA,GACR,UAAA,QAAkB,gBAAA;;;;;;;AAFrB;;;;;;;;;;;;;;AAwFA;;;iBAAgB,UAAA,CAAW,OAAA,EAAS,SAAA,GAAU,SAAA"}
|
package/dist/tsup.d.mts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
|
|
2
|
+
import { Entry } from "@storm-software/build-tools/types";
|
|
3
|
+
import { resolveOptions as resolveOptions$1 } from "@storm-software/tsup";
|
|
4
|
+
import { Options as Options$1 } from "tsup";
|
|
5
|
+
|
|
6
|
+
//#region src/tsup.d.ts
|
|
7
|
+
declare const DEFAULT_OPTIONS: Partial<Options$1>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
10
|
+
*
|
|
11
|
+
* @param context - The build context.
|
|
12
|
+
* @param entryPoints - The entry points to resolve.
|
|
13
|
+
* @returns The resolved entry options.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveEntry(context: Context, entryPoints: ResolvedEntryTypeDefinition[] | string[]): Entry;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
18
|
+
*
|
|
19
|
+
* @param context - The build context.
|
|
20
|
+
* @returns The resolved options.
|
|
21
|
+
*/
|
|
22
|
+
declare function resolveOptions(context: Context): Parameters<typeof resolveOptions$1>[0];
|
|
23
|
+
/**
|
|
24
|
+
* A Tsup configuration function that integrates Powerlines into the build process.
|
|
25
|
+
*
|
|
26
|
+
* @see https://tsup.egoist.dev/#/config
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // tsup.config.ts
|
|
31
|
+
* import withPowerlines from "@powerlines/unplugin/tsup";
|
|
32
|
+
*
|
|
33
|
+
* export default withPowerlines({
|
|
34
|
+
* entry: ["src/index.ts"],
|
|
35
|
+
* format: ["cjs", "esm"],
|
|
36
|
+
* dts: true,
|
|
37
|
+
* sourcemap: true,
|
|
38
|
+
* clean: true,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param options - The Tsup options to merge with the Powerlines configuration.
|
|
44
|
+
* @returns The merged Tsup configuration options.
|
|
45
|
+
*/
|
|
46
|
+
declare function withPlugin(options: Options$1): Options$1;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { DEFAULT_OPTIONS, withPlugin as default, withPlugin, resolveEntry, resolveOptions };
|
|
49
|
+
//# sourceMappingURL=tsup.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.d.mts","names":[],"sources":["../src/tsup.ts"],"mappings":";;;;;;cA8Ba,eAAA,EAAiB,OAAA,CAAQ,SAAA;;AAAtC;;;;;AAwBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,EAAa,2BAAA,gBACZ,KAAA;;;;;;;iBAca,cAAA,CACd,OAAA,EAAS,OAAA,GACR,UAAA,QAAkB,gBAAA;;;;;;;AAFrB;;;;;;;;;;;;;;AAwFA;;;iBAAgB,UAAA,CAAW,OAAA,EAAS,SAAA,GAAU,SAAA"}
|
package/dist/tsup.mjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import plugin, { resolveEntry as resolveEntry$1 } from "./esbuild.mjs";
|
|
2
|
+
import { appendPath } from "@stryke/path/append";
|
|
3
|
+
import { relativePath } from "@stryke/path/file-path-fns";
|
|
4
|
+
import defu from "defu";
|
|
5
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
6
|
+
import { DEFAULT_BUILD_OPTIONS } from "@storm-software/tsup/constants";
|
|
7
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
8
|
+
|
|
9
|
+
//#region src/tsup.ts
|
|
10
|
+
const DEFAULT_OPTIONS = {
|
|
11
|
+
...DEFAULT_BUILD_OPTIONS,
|
|
12
|
+
target: "esnext",
|
|
13
|
+
config: false,
|
|
14
|
+
minify: true,
|
|
15
|
+
sourcemap: false,
|
|
16
|
+
cjsInterop: true,
|
|
17
|
+
bundle: true,
|
|
18
|
+
dts: true,
|
|
19
|
+
shims: true,
|
|
20
|
+
silent: true,
|
|
21
|
+
treeshake: true,
|
|
22
|
+
keepNames: true,
|
|
23
|
+
splitting: true,
|
|
24
|
+
banner: {}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
28
|
+
*
|
|
29
|
+
* @param context - The build context.
|
|
30
|
+
* @param entryPoints - The entry points to resolve.
|
|
31
|
+
* @returns The resolved entry options.
|
|
32
|
+
*/
|
|
33
|
+
function resolveEntry(context, entryPoints) {
|
|
34
|
+
return resolveEntry$1(context, entryPoints);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
38
|
+
*
|
|
39
|
+
* @param context - The build context.
|
|
40
|
+
* @returns The resolved options.
|
|
41
|
+
*/
|
|
42
|
+
function resolveOptions(context) {
|
|
43
|
+
const result = defu({
|
|
44
|
+
entry: Object.fromEntries(Object.entries(resolveEntry(context, context.entry)).map(([key, value]) => [key, appendPath(value, context.config.root)])),
|
|
45
|
+
esbuildOptions: (options) => {
|
|
46
|
+
options.alias = {
|
|
47
|
+
...context.alias,
|
|
48
|
+
...context.builtins.reduce((ret, id) => {
|
|
49
|
+
const path = context.fs.paths[id];
|
|
50
|
+
if (path) ret[id] = path;
|
|
51
|
+
return ret;
|
|
52
|
+
}, {}),
|
|
53
|
+
...options.alias
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
noExternal: context.builtins
|
|
57
|
+
}, {
|
|
58
|
+
name: context.config.name,
|
|
59
|
+
root: context.config.root,
|
|
60
|
+
projectRoot: context.config.root,
|
|
61
|
+
assets: context.config.output.copy ? context.config.output.copy.assets : void 0,
|
|
62
|
+
resolveExtensions: context.config.resolve.extensions,
|
|
63
|
+
outputPath: relativePath(appendPath(context.config.root, context.config.cwd), context.config.output.path),
|
|
64
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
65
|
+
dts: { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions },
|
|
66
|
+
format: context.config.output.format,
|
|
67
|
+
mode: context.config.mode,
|
|
68
|
+
minify: context.config.output.minify,
|
|
69
|
+
metafile: context.config.mode === "development",
|
|
70
|
+
sourcemap: context.config.output.sourceMap,
|
|
71
|
+
silent: context.config.logLevel.general === "silent" || context.config.mode === "production",
|
|
72
|
+
verbose: context.config.logLevel.general === "trace" || context.config.mode === "development",
|
|
73
|
+
workspaceConfig: { workspaceRoot: context.config.cwd }
|
|
74
|
+
}, DEFAULT_OPTIONS);
|
|
75
|
+
result.format = getUnique(toArray(result.format));
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A Tsup configuration function that integrates Powerlines into the build process.
|
|
80
|
+
*
|
|
81
|
+
* @see https://tsup.egoist.dev/#/config
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // tsup.config.ts
|
|
86
|
+
* import withPowerlines from "@powerlines/unplugin/tsup";
|
|
87
|
+
*
|
|
88
|
+
* export default withPowerlines({
|
|
89
|
+
* entry: ["src/index.ts"],
|
|
90
|
+
* format: ["cjs", "esm"],
|
|
91
|
+
* dts: true,
|
|
92
|
+
* sourcemap: true,
|
|
93
|
+
* clean: true,
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @param options - The Tsup options to merge with the Powerlines configuration.
|
|
99
|
+
* @returns The merged Tsup configuration options.
|
|
100
|
+
*/
|
|
101
|
+
function withPlugin(options) {
|
|
102
|
+
return {
|
|
103
|
+
...options,
|
|
104
|
+
esbuildPlugins: [...options.esbuildPlugins ?? [], plugin()]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { DEFAULT_OPTIONS, withPlugin as default, withPlugin, resolveEntry, resolveOptions };
|
|
110
|
+
//# sourceMappingURL=tsup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.mjs","names":["resolveEsbuildEntry","esbuild"],"sources":["../src/tsup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, ResolvedEntryTypeDefinition } from \"@powerlines/core\";\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { resolveOptions as resolveOptionsBase } from \"@storm-software/tsup\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport type { Options } from \"tsup\";\nimport esbuild, { resolveEntry as resolveEsbuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_OPTIONS: Partial<Options> = {\n ...DEFAULT_BUILD_OPTIONS,\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[]\n): Entry {\n return resolveEsbuildEntry(context, entryPoints) as Entry;\n}\n\ntype TsupEsbuildOptionsHandler = NonNullable<Options[\"esbuildOptions\"]>;\ntype TsupEsbuildOptionsArgs = Parameters<TsupEsbuildOptionsHandler>;\ntype TsupEsbuildOptions = TsupEsbuildOptionsArgs[0];\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): Parameters<typeof resolveOptionsBase>[0] {\n const result = defu(\n {\n entry: Object.fromEntries(\n Object.entries(resolveEntry(context, context.entry)).map(\n ([key, value]) => [key, appendPath(value, context.config.root)]\n )\n ),\n esbuildOptions: (options: TsupEsbuildOptions) => {\n options.alias = {\n ...context.alias,\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n {\n name: context.config.name,\n root: context.config.root,\n projectRoot: context.config.root,\n assets: context.config.output.copy\n ? (context.config.output.copy.assets as (string | AssetGlob)[])\n : undefined,\n resolveExtensions: context.config.resolve.extensions,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel.general === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.config.cwd }\n },\n DEFAULT_OPTIONS\n );\n\n result.format = getUnique(toArray(result.format));\n return result as Parameters<typeof resolveOptionsBase>[0];\n}\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function withPlugin(options: Options): Options {\n return {\n ...options,\n esbuildPlugins: [...(options.esbuildPlugins ?? []), esbuild()]\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;AA8BA,MAAa,kBAAoC;CAC/C,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,QAAQ,EAAE;CACX;;;;;;;;AASD,SAAgB,aACd,SACA,aACO;CACP,OAAOA,eAAoB,SAAS,YAAY;;;;;;;;AAalD,SAAgB,eACd,SAC0C;CAC1C,MAAM,SAAS,KACb;EACE,OAAO,OAAO,YACZ,OAAO,QAAQ,aAAa,SAAS,QAAQ,MAAM,CAAC,CAAC,KAClD,CAAC,KAAK,WAAW,CAAC,KAAK,WAAW,OAAO,QAAQ,OAAO,KAAK,CAAC,CAChE,CACF;EACD,iBAAiB,YAAgC;GAC/C,QAAQ,QAAQ;IACd,GAAG,QAAQ;IACX,GAAG,QAAQ,SAAS,QACjB,KAAK,OAAO;KACX,MAAM,OAAO,QAAQ,GAAG,MAAM;KAC9B,IAAI,MACF,IAAI,MAAM;KAGZ,OAAO;OAET,EAAE,CACH;IACD,GAAG,QAAQ;IACZ;;EAEH,YAAY,QAAQ;EACrB,EACD;EACE,MAAM,QAAQ,OAAO;EACrB,MAAM,QAAQ,OAAO;EACrB,aAAa,QAAQ,OAAO;EAC5B,QAAQ,QAAQ,OAAO,OAAO,OACzB,QAAQ,OAAO,OAAO,KAAK,SAC5B;EACJ,mBAAmB,QAAQ,OAAO,QAAQ;EAC1C,YAAY,aACV,WAAW,QAAQ,OAAO,MAAM,QAAQ,OAAO,IAAI,EACnD,QAAQ,OAAO,OAAO,KACvB;EACD,UAAU,QAAQ,SAAS;EAC3B,KAAK,EACH,iBAAiB,QAAQ,SAAS,aAAa,iBAChD;EACD,QAAQ,QAAQ,OAAO,OAAO;EAC9B,MAAM,QAAQ,OAAO;EACrB,QAAQ,QAAQ,OAAO,OAAO;EAC9B,UAAU,QAAQ,OAAO,SAAS;EAClC,WAAW,QAAQ,OAAO,OAAO;EACjC,QACE,QAAQ,OAAO,SAAS,YAAY,YACpC,QAAQ,OAAO,SAAS;EAC1B,SACE,QAAQ,OAAO,SAAS,YAAY,WACpC,QAAQ,OAAO,SAAS;EAC1B,iBAAiB,EAAE,eAAe,QAAQ,OAAO,KAAK;EACvD,EACD,gBACD;CAED,OAAO,SAAS,UAAU,QAAQ,OAAO,OAAO,CAAC;CACjD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;AA0BT,SAAgB,WAAW,SAA2B;CACpD,OAAO;EACL,GAAG;EACH,gBAAgB,CAAC,GAAI,QAAQ,kBAAkB,EAAE,EAAGC,QAAS,CAAC;EAC/D"}
|
package/dist/types.cjs
ADDED
|
File without changes
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BuildInlineConfig, ExecutionContext, ExecutionOptions, UnpluginOptions } from "@powerlines/core";
|
|
2
|
+
import { PartialKeys } from "@stryke/types/base";
|
|
3
|
+
import { UnpluginContextMeta } from "unplugin";
|
|
4
|
+
export * from "@powerlines/core/types/unplugin";
|
|
5
|
+
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
type UnpluginExecutionOptionsBase = Omit<PartialKeys<ExecutionOptions, "cwd" | "configFile" | "framework" | "orgId" | "root" | "configIndex">, "executionId">;
|
|
8
|
+
type UnpluginExecutionOptions = Omit<BuildInlineConfig, "command"> & UnpluginExecutionOptionsBase;
|
|
9
|
+
type UnpluginFactory<TContext extends ExecutionContext> = (options: UnpluginExecutionOptions | undefined, meta: UnpluginContextMeta) => UnpluginOptions<TContext>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory };
|
|
12
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;KA6BY,4BAAA,GAA+B,IAAA,CACzC,WAAA,CACE,gBAAA;AAAA,KAMQ,wBAAA,GAA2B,IAAA,CAAK,iBAAA,eAC1C,4BAAA;AAAA,KAEU,eAAA,kBAAiC,gBAAA,KAC3C,OAAA,EAAS,wBAAA,cACT,IAAA,EAAM,mBAAA,KACH,eAAA,CAAgB,QAAA"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnpluginContextMeta } from "unplugin";
|
|
2
|
+
import { BuildInlineConfig, ExecutionContext, ExecutionOptions, UnpluginOptions } from "@powerlines/core";
|
|
3
|
+
import { PartialKeys } from "@stryke/types/base";
|
|
4
|
+
export * from "@powerlines/core/types/unplugin";
|
|
5
|
+
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
type UnpluginExecutionOptionsBase = Omit<PartialKeys<ExecutionOptions, "cwd" | "configFile" | "framework" | "orgId" | "root" | "configIndex">, "executionId">;
|
|
8
|
+
type UnpluginExecutionOptions = Omit<BuildInlineConfig, "command"> & UnpluginExecutionOptionsBase;
|
|
9
|
+
type UnpluginFactory<TContext extends ExecutionContext> = (options: UnpluginExecutionOptions | undefined, meta: UnpluginContextMeta) => UnpluginOptions<TContext>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory };
|
|
12
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;KA6BY,4BAAA,GAA+B,IAAA,CACzC,WAAA,CACE,gBAAA;AAAA,KAMQ,wBAAA,GAA2B,IAAA,CAAK,iBAAA,eAC1C,4BAAA;AAAA,KAEU,eAAA,kBAAiC,gBAAA,KAC3C,OAAA,EAAS,wBAAA,cACT,IAAA,EAAM,mBAAA,KACH,eAAA,CAAgB,QAAA"}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_unplugin = require('./unplugin.cjs');
|
|
4
|
+
let unplugin = require("unplugin");
|
|
5
|
+
|
|
6
|
+
//#region src/unloader.ts
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
12
|
+
* // unloader.config.js
|
|
13
|
+
* import { createUnloaderFactory } from "@powerlines/unplugin/unloader";
|
|
14
|
+
*
|
|
15
|
+
* const powerlinesPlugin = createUnloaderFactory({ name: "example-app", ... });
|
|
16
|
+
*
|
|
17
|
+
* export default defineConfig({
|
|
18
|
+
* plugins: [powerlinesPlugin()],
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param options - The options to create the plugin factory with.
|
|
24
|
+
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
25
|
+
* @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.
|
|
26
|
+
*/
|
|
27
|
+
function createUnloaderFactory(options = {}, decorate = (options) => options) {
|
|
28
|
+
return require_unplugin.createUnpluginFactory({
|
|
29
|
+
...options,
|
|
30
|
+
variant: "unloader"
|
|
31
|
+
}, (unplugin$1) => decorate(unplugin$1));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```js
|
|
38
|
+
* // unloader.config.js
|
|
39
|
+
* import powerlines from "@powerlines/unplugin/unloader";
|
|
40
|
+
*
|
|
41
|
+
* export default defineConfig({
|
|
42
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
const plugin = (0, unplugin.createUnloaderPlugin)(createUnloaderFactory());
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.createUnloaderFactory = createUnloaderFactory;
|
|
51
|
+
exports.default = plugin;
|
|
52
|
+
exports.plugin = plugin;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
|
|
2
|
+
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
|
+
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
|
+
import { ExecutionContext } from "@powerlines/core";
|
|
5
|
+
import * as _$unloader from "unloader";
|
|
6
|
+
|
|
7
|
+
//#region src/unloader.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* // unloader.config.js
|
|
14
|
+
* import { createUnloaderFactory } from "@powerlines/unplugin/unloader";
|
|
15
|
+
*
|
|
16
|
+
* const powerlinesPlugin = createUnloaderFactory({ name: "example-app", ... });
|
|
17
|
+
*
|
|
18
|
+
* export default defineConfig({
|
|
19
|
+
* plugins: [powerlinesPlugin()],
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param options - The options to create the plugin factory with.
|
|
25
|
+
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
26
|
+
* @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.
|
|
27
|
+
*/
|
|
28
|
+
declare function createUnloaderFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<_$_powerlines_core0.ResolvedConfig, unknown>>;
|
|
29
|
+
/**
|
|
30
|
+
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```js
|
|
34
|
+
* // unloader.config.js
|
|
35
|
+
* import powerlines from "@powerlines/unplugin/unloader";
|
|
36
|
+
*
|
|
37
|
+
* export default defineConfig({
|
|
38
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => _$unloader.Plugin | _$unloader.Plugin[];
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createUnloaderFactory, plugin as default, plugin };
|
|
46
|
+
//# sourceMappingURL=unloader.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unloader.d.cts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;;;;;AA8CA;;;;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;AAqBnE;;;;cAAa,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,GAAA,UAAA,CAAA,MAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
|
+
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
|
+
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
|
+
import { ExecutionContext } from "@powerlines/core";
|
|
5
|
+
import * as _$unloader from "unloader";
|
|
6
|
+
|
|
7
|
+
//#region src/unloader.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* // unloader.config.js
|
|
14
|
+
* import { createUnloaderFactory } from "@powerlines/unplugin/unloader";
|
|
15
|
+
*
|
|
16
|
+
* const powerlinesPlugin = createUnloaderFactory({ name: "example-app", ... });
|
|
17
|
+
*
|
|
18
|
+
* export default defineConfig({
|
|
19
|
+
* plugins: [powerlinesPlugin()],
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param options - The options to create the plugin factory with.
|
|
25
|
+
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
26
|
+
* @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.
|
|
27
|
+
*/
|
|
28
|
+
declare function createUnloaderFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<_$_powerlines_core0.ResolvedConfig, unknown>>;
|
|
29
|
+
/**
|
|
30
|
+
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```js
|
|
34
|
+
* // unloader.config.js
|
|
35
|
+
* import powerlines from "@powerlines/unplugin/unloader";
|
|
36
|
+
*
|
|
37
|
+
* export default defineConfig({
|
|
38
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => _$unloader.Plugin | _$unloader.Plugin[];
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createUnloaderFactory, plugin as default, plugin };
|
|
46
|
+
//# sourceMappingURL=unloader.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;;;;;AA8CA;;;;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;AAqBnE;;;;cAAa,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,GAAA,UAAA,CAAA,MAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
2
|
+
import { createUnloaderPlugin } from "unplugin";
|
|
3
|
+
|
|
4
|
+
//#region src/unloader.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* // unloader.config.js
|
|
11
|
+
* import { createUnloaderFactory } from "@powerlines/unplugin/unloader";
|
|
12
|
+
*
|
|
13
|
+
* const powerlinesPlugin = createUnloaderFactory({ name: "example-app", ... });
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig({
|
|
16
|
+
* plugins: [powerlinesPlugin()],
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param options - The options to create the plugin factory with.
|
|
22
|
+
* @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
|
|
23
|
+
* @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.
|
|
24
|
+
*/
|
|
25
|
+
function createUnloaderFactory(options = {}, decorate = (options) => options) {
|
|
26
|
+
return createUnpluginFactory({
|
|
27
|
+
...options,
|
|
28
|
+
variant: "unloader"
|
|
29
|
+
}, (unplugin) => decorate(unplugin));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```js
|
|
36
|
+
* // unloader.config.js
|
|
37
|
+
* import powerlines from "@powerlines/unplugin/unloader";
|
|
38
|
+
*
|
|
39
|
+
* export default defineConfig({
|
|
40
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
const plugin = createUnloaderPlugin(createUnloaderFactory());
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createUnloaderFactory, plugin as default, plugin };
|
|
49
|
+
//# sourceMappingURL=unloader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,sBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAY,GAAE,aAChE,SAAS,SAAsC,CAChD;;;;;;;;;;;;;;;;AAiBH,MAAa,SAAS,qBAAqB,uBAAuB,CAAC"}
|