@powerlines/plugin-tsup 0.12.131 → 0.12.133
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 +107 -8
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +103 -3
- package/dist/plugin-1MQ96Bk2.d.mts +1773 -0
- package/dist/plugin-DSOxaxtV.d.cts +1771 -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 -15
- package/dist/types/plugin.d.mts +1 -15
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-U3zd8PTP.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-BQnRwuqv.d.cts +7 -0
- package/dist/unplugin-CKp_xp7Q.cjs +4673 -0
- package/dist/unplugin-DlRwznsD.mjs +4617 -0
- package/dist/unplugin-OyZB70Up.d.mts +7 -0
- package/package.json +5 -5
- 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/esbuild.cjs +0 -28
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -26
- package/dist/powerlines/src/lib/build/tsup.cjs +0 -85
- package/dist/powerlines/src/lib/build/tsup.mjs +0 -82
- 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 -71
- 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 -82
- 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-CKp_xp7Q.cjs');
|
|
2
|
+
require('../helpers-LF26RHol.cjs');
|
|
2
3
|
|
|
3
|
-
exports.createTsupPlugin =
|
|
4
|
+
exports.createTsupPlugin = require_unplugin.createTsupPlugin;
|
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-CKp_xp7Q.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
function createTsupPlugin(context) {
|
|
8
|
-
return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
exports.createTsupPlugin = createTsupPlugin;
|
|
3
|
+
exports.createTsupPlugin = require_unplugin.createTsupPlugin;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-DSOxaxtV.cjs";
|
|
2
|
+
import { t as createTsupPlugin } from "../unplugin-BQnRwuqv.cjs";
|
|
7
3
|
export { createTsupPlugin };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-1MQ96Bk2.mjs";
|
|
2
|
+
import { t as createTsupPlugin } from "../unplugin-OyZB70Up.mjs";
|
|
7
3
|
export { createTsupPlugin };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
-
import { createEsbuildPlugin } from "unplugin";
|
|
1
|
+
import { t as createTsupPlugin } from "../unplugin-DlRwznsD.mjs";
|
|
4
2
|
|
|
5
|
-
//#region src/helpers/unplugin.ts
|
|
6
|
-
function createTsupPlugin(context) {
|
|
7
|
-
return createEsbuildPlugin(createUnplugin(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
3
|
export { createTsupPlugin };
|
|
@@ -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,14 +1,113 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require('./
|
|
2
|
+
const require_unplugin = require('./unplugin-CKp_xp7Q.cjs');
|
|
3
|
+
require('./helpers-LF26RHol.cjs');
|
|
4
|
+
require('./plugin-pBKbb5K9.cjs');
|
|
5
|
+
require('./types-o3zWarRp.cjs');
|
|
6
6
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
7
|
let __storm_software_tsup = require("@storm-software/tsup");
|
|
8
8
|
let __stryke_path_append = require("@stryke/path/append");
|
|
9
9
|
let defu = require("defu");
|
|
10
|
-
defu =
|
|
10
|
+
defu = require_unplugin.__toESM(defu);
|
|
11
|
+
let __storm_software_tsup_constants = require("@storm-software/tsup/constants");
|
|
12
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
13
|
+
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
14
|
+
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
15
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
16
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
17
|
+
require("@stryke/string-format/camel-case");
|
|
18
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
11
19
|
|
|
20
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the entry options for esbuild.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The build context.
|
|
25
|
+
* @param entryPoints - The entry points to resolve.
|
|
26
|
+
* @returns The resolved entry options.
|
|
27
|
+
*/
|
|
28
|
+
function resolveESBuildEntry(context, entryPoints = []) {
|
|
29
|
+
return entryPoints.reduce((ret, entry) => {
|
|
30
|
+
if ((0, __stryke_type_checks_is_string.isString)(entry)) ret[(0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot))] = (0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot);
|
|
31
|
+
else ret[entry.output || require_unplugin.resolveEntryOutput(context, entry.input || entry)] = require_unplugin.resolveEntryInputFile(context, entry.input || entry);
|
|
32
|
+
return ret;
|
|
33
|
+
}, {});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../powerlines/src/lib/build/tsup.ts
|
|
38
|
+
const DEFAULT_TSUP_CONFIG = {
|
|
39
|
+
...__storm_software_tsup_constants.DEFAULT_BUILD_OPTIONS,
|
|
40
|
+
platform: "neutral",
|
|
41
|
+
target: "esnext",
|
|
42
|
+
config: false,
|
|
43
|
+
minify: true,
|
|
44
|
+
sourcemap: false,
|
|
45
|
+
cjsInterop: true,
|
|
46
|
+
bundle: true,
|
|
47
|
+
dts: true,
|
|
48
|
+
shims: true,
|
|
49
|
+
silent: true,
|
|
50
|
+
treeshake: true,
|
|
51
|
+
keepNames: true,
|
|
52
|
+
splitting: true,
|
|
53
|
+
banner: {}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
57
|
+
*
|
|
58
|
+
* @param context - The build context.
|
|
59
|
+
* @param entryPoints - The entry points to resolve.
|
|
60
|
+
* @returns The resolved entry options.
|
|
61
|
+
*/
|
|
62
|
+
function resolveTsupEntry(context, entryPoints) {
|
|
63
|
+
return resolveESBuildEntry(context, entryPoints);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
67
|
+
*
|
|
68
|
+
* @param context - The build context.
|
|
69
|
+
* @returns The resolved options.
|
|
70
|
+
*/
|
|
71
|
+
function extractTsupConfig(context) {
|
|
72
|
+
const result = (0, defu.default)({
|
|
73
|
+
esbuildOptions: ((options, ctx) => {
|
|
74
|
+
if (context.config.build.variant === "tsup") {
|
|
75
|
+
if (context.config.build.esbuildOptions) context.config.build.esbuildOptions?.(options, ctx);
|
|
76
|
+
else if (context.config.build.override.esbuildOptions) context.config.build.override.esbuildOptions?.(options, ctx);
|
|
77
|
+
}
|
|
78
|
+
options.alias = {
|
|
79
|
+
...context.builtins.reduce((ret, id) => {
|
|
80
|
+
const path = context.fs.ids[id];
|
|
81
|
+
if (path) ret[id] = path;
|
|
82
|
+
return ret;
|
|
83
|
+
}, {}),
|
|
84
|
+
...options.alias
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
noExternal: context.builtins
|
|
88
|
+
}, context.config.build.variant === "tsup" ? context.config.build.override : {}, context.config.build.variant === "tsup" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, {
|
|
89
|
+
name: context.config.name,
|
|
90
|
+
assets: context.config.output.assets,
|
|
91
|
+
resolveExtensions: context.config.build.extensions,
|
|
92
|
+
outputPath: context.config.output.buildPath,
|
|
93
|
+
projectRoot: context.config.projectRoot,
|
|
94
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
95
|
+
dts: context.config.build.variant !== "tsup" || !context.config.build?.experimentalDts && !context.config.build.override?.experimentalDts ? { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions } : void 0,
|
|
96
|
+
format: context.config.output.format,
|
|
97
|
+
mode: context.config.mode,
|
|
98
|
+
treeshake: context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeShaking : void 0,
|
|
99
|
+
minify: context.config.mode !== "development",
|
|
100
|
+
metafile: context.config.mode === "development",
|
|
101
|
+
sourcemap: context.config.mode === "development",
|
|
102
|
+
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
103
|
+
verbose: context.config.logLevel === null || context.config.logLevel === "trace" || context.config.mode === "development",
|
|
104
|
+
workspaceConfig: { workspaceRoot: context.workspaceConfig.workspaceRoot }
|
|
105
|
+
}, DEFAULT_TSUP_CONFIG);
|
|
106
|
+
result.format = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(result.format));
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
12
111
|
//#region src/index.ts
|
|
13
112
|
/**
|
|
14
113
|
* A Powerlines plugin to use Tsup to build the project.
|
|
@@ -29,7 +128,7 @@ const plugin = (options = {}) => {
|
|
|
29
128
|
async build() {
|
|
30
129
|
return (0, __storm_software_tsup.build)(await (0, __storm_software_tsup.resolveOptions)((0, defu.default)({
|
|
31
130
|
config: false,
|
|
32
|
-
entry: Object.fromEntries(Object.entries(
|
|
131
|
+
entry: Object.fromEntries(Object.entries(resolveTsupEntry(this, this.entry)).map(([key, value]) => [key, (0, __stryke_path_append.appendPath)(value, this.config.projectRoot)])),
|
|
33
132
|
esbuildOptions: (options$1, ctx) => {
|
|
34
133
|
if (this.config.build.variant === "tsup") {
|
|
35
134
|
if (this.config.build.esbuildOptions) this.config.build.esbuildOptions?.(options$1, ctx);
|
|
@@ -45,13 +144,13 @@ const plugin = (options = {}) => {
|
|
|
45
144
|
},
|
|
46
145
|
silent: false,
|
|
47
146
|
verbose: true
|
|
48
|
-
},
|
|
147
|
+
}, extractTsupConfig(this), { esbuildPlugins: [require_unplugin.createTsupPlugin(this)] })));
|
|
49
148
|
}
|
|
50
149
|
};
|
|
51
150
|
};
|
|
52
151
|
var src_default = plugin;
|
|
53
152
|
|
|
54
153
|
//#endregion
|
|
55
|
-
exports.createTsupPlugin =
|
|
154
|
+
exports.createTsupPlugin = require_unplugin.createTsupPlugin;
|
|
56
155
|
exports.default = src_default;
|
|
57
156
|
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 __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, l as Plugin, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "./plugin-DSOxaxtV.cjs";
|
|
2
|
+
import { t as createTsupPlugin } from "./unplugin-BQnRwuqv.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 __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, l as Plugin, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "./plugin-1MQ96Bk2.mjs";
|
|
2
|
+
import { t as createTsupPlugin } from "./unplugin-OyZB70Up.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 use Tsup to build the project.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
1
|
+
import { n as resolveEntryInputFile, r as resolveEntryOutput, t as createTsupPlugin } from "./unplugin-DlRwznsD.mjs";
|
|
2
|
+
import "./helpers-B15z10jN.mjs";
|
|
3
|
+
import "./plugin-ifZVa20V.mjs";
|
|
4
|
+
import "./types-U3zd8PTP.mjs";
|
|
4
5
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
6
|
import { build, resolveOptions } from "@storm-software/tsup";
|
|
6
7
|
import { appendPath } from "@stryke/path/append";
|
|
7
8
|
import defu$1 from "defu";
|
|
9
|
+
import { DEFAULT_BUILD_OPTIONS } from "@storm-software/tsup/constants";
|
|
10
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
11
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
12
|
+
import { omit } from "@stryke/helpers/omit";
|
|
13
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
14
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
15
|
+
import "@stryke/string-format/camel-case";
|
|
16
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
8
17
|
|
|
18
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the entry options for esbuild.
|
|
21
|
+
*
|
|
22
|
+
* @param context - The build context.
|
|
23
|
+
* @param entryPoints - The entry points to resolve.
|
|
24
|
+
* @returns The resolved entry options.
|
|
25
|
+
*/
|
|
26
|
+
function resolveESBuildEntry(context, entryPoints = []) {
|
|
27
|
+
return entryPoints.reduce((ret, entry) => {
|
|
28
|
+
if (isString(entry)) ret[replaceExtension(replacePath(entry, context.config.sourceRoot || context.config.projectRoot))] = replacePath(entry, context.config.sourceRoot || context.config.projectRoot);
|
|
29
|
+
else ret[entry.output || resolveEntryOutput(context, entry.input || entry)] = resolveEntryInputFile(context, entry.input || entry);
|
|
30
|
+
return ret;
|
|
31
|
+
}, {});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../powerlines/src/lib/build/tsup.ts
|
|
36
|
+
const DEFAULT_TSUP_CONFIG = {
|
|
37
|
+
...DEFAULT_BUILD_OPTIONS,
|
|
38
|
+
platform: "neutral",
|
|
39
|
+
target: "esnext",
|
|
40
|
+
config: false,
|
|
41
|
+
minify: true,
|
|
42
|
+
sourcemap: false,
|
|
43
|
+
cjsInterop: true,
|
|
44
|
+
bundle: true,
|
|
45
|
+
dts: true,
|
|
46
|
+
shims: true,
|
|
47
|
+
silent: true,
|
|
48
|
+
treeshake: true,
|
|
49
|
+
keepNames: true,
|
|
50
|
+
splitting: true,
|
|
51
|
+
banner: {}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
55
|
+
*
|
|
56
|
+
* @param context - The build context.
|
|
57
|
+
* @param entryPoints - The entry points to resolve.
|
|
58
|
+
* @returns The resolved entry options.
|
|
59
|
+
*/
|
|
60
|
+
function resolveTsupEntry(context, entryPoints) {
|
|
61
|
+
return resolveESBuildEntry(context, entryPoints);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
65
|
+
*
|
|
66
|
+
* @param context - The build context.
|
|
67
|
+
* @returns The resolved options.
|
|
68
|
+
*/
|
|
69
|
+
function extractTsupConfig(context) {
|
|
70
|
+
const result = defu$1({
|
|
71
|
+
esbuildOptions: ((options, ctx) => {
|
|
72
|
+
if (context.config.build.variant === "tsup") {
|
|
73
|
+
if (context.config.build.esbuildOptions) context.config.build.esbuildOptions?.(options, ctx);
|
|
74
|
+
else if (context.config.build.override.esbuildOptions) context.config.build.override.esbuildOptions?.(options, ctx);
|
|
75
|
+
}
|
|
76
|
+
options.alias = {
|
|
77
|
+
...context.builtins.reduce((ret, id) => {
|
|
78
|
+
const path = context.fs.ids[id];
|
|
79
|
+
if (path) ret[id] = path;
|
|
80
|
+
return ret;
|
|
81
|
+
}, {}),
|
|
82
|
+
...options.alias
|
|
83
|
+
};
|
|
84
|
+
}),
|
|
85
|
+
noExternal: context.builtins
|
|
86
|
+
}, context.config.build.variant === "tsup" ? context.config.build.override : {}, context.config.build.variant === "tsup" ? omit(context.config.build, ["override", "variant"]) : {}, {
|
|
87
|
+
name: context.config.name,
|
|
88
|
+
assets: context.config.output.assets,
|
|
89
|
+
resolveExtensions: context.config.build.extensions,
|
|
90
|
+
outputPath: context.config.output.buildPath,
|
|
91
|
+
projectRoot: context.config.projectRoot,
|
|
92
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
93
|
+
dts: context.config.build.variant !== "tsup" || !context.config.build?.experimentalDts && !context.config.build.override?.experimentalDts ? { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions } : void 0,
|
|
94
|
+
format: context.config.output.format,
|
|
95
|
+
mode: context.config.mode,
|
|
96
|
+
treeshake: context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeShaking : void 0,
|
|
97
|
+
minify: context.config.mode !== "development",
|
|
98
|
+
metafile: context.config.mode === "development",
|
|
99
|
+
sourcemap: context.config.mode === "development",
|
|
100
|
+
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
101
|
+
verbose: context.config.logLevel === null || context.config.logLevel === "trace" || context.config.mode === "development",
|
|
102
|
+
workspaceConfig: { workspaceRoot: context.workspaceConfig.workspaceRoot }
|
|
103
|
+
}, DEFAULT_TSUP_CONFIG);
|
|
104
|
+
result.format = getUnique(toArray(result.format));
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
9
109
|
//#region src/index.ts
|
|
10
110
|
/**
|
|
11
111
|
* A Powerlines plugin to use Tsup to build the project.
|