@powerlines/plugin-tsdown 0.1.73 → 0.1.75
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 +96 -8
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +92 -3
- package/dist/plugin-Bh65OO11.d.cts +1764 -0
- package/dist/plugin-DnzEhAC7.d.mts +1766 -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-1lE_z2lE.mjs +4615 -0
- package/dist/unplugin-BxNntd0I.d.mts +7 -0
- package/dist/unplugin-CkInBCQX.cjs +4659 -0
- package/dist/unplugin-DyxNwfan.d.cts +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/tsdown.cjs +0 -93
- package/dist/powerlines/src/lib/build/tsdown.mjs +0 -91
- package/dist/powerlines/src/lib/config-file.cjs +0 -79
- package/dist/powerlines/src/lib/config-file.mjs +0 -76
- package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
- package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
- package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
- package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
- package/dist/powerlines/src/lib/entry.cjs +0 -69
- package/dist/powerlines/src/lib/entry.mjs +0 -67
- package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
- package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
- package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
- package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
- package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
- package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
- package/dist/powerlines/src/lib/logger.cjs +0 -58
- package/dist/powerlines/src/lib/logger.mjs +0 -55
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
- package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
- package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
- package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
- package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
- package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
- package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/babel.d.mts +0 -4
- package/dist/powerlines/src/types/build.cjs +0 -15
- package/dist/powerlines/src/types/build.d.cts +0 -149
- package/dist/powerlines/src/types/build.d.mts +0 -149
- package/dist/powerlines/src/types/build.mjs +0 -14
- package/dist/powerlines/src/types/commands.cjs +0 -16
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/commands.mjs +0 -15
- package/dist/powerlines/src/types/config.d.cts +0 -370
- package/dist/powerlines/src/types/config.d.mts +0 -371
- package/dist/powerlines/src/types/context.d.cts +0 -403
- package/dist/powerlines/src/types/context.d.mts +0 -405
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/plugin.cjs +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/plugin.mjs +0 -31
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_unplugin = require('../unplugin-CkInBCQX.cjs');
|
|
2
|
+
require('../helpers-LF26RHol.cjs');
|
|
2
3
|
|
|
3
|
-
exports.createTsdownPlugin =
|
|
4
|
+
exports.createTsdownPlugin = require_unplugin.createTsdownPlugin;
|
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-CkInBCQX.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
function createTsdownPlugin(context) {
|
|
8
|
-
return (0, unplugin.createRolldownPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
exports.createTsdownPlugin = createTsdownPlugin;
|
|
3
|
+
exports.createTsdownPlugin = require_unplugin.createTsdownPlugin;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown0.Plugin<any> | rolldown0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-Bh65OO11.cjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "../unplugin-DyxNwfan.cjs";
|
|
7
3
|
export { createTsdownPlugin };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown0.Plugin<any> | rolldown0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-DnzEhAC7.mjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "../unplugin-BxNntd0I.mjs";
|
|
7
3
|
export { createTsdownPlugin };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
-
import { createRolldownPlugin } from "unplugin";
|
|
1
|
+
import { t as createTsdownPlugin } from "../unplugin-1lE_z2lE.mjs";
|
|
4
2
|
|
|
5
|
-
//#region src/helpers/unplugin.ts
|
|
6
|
-
function createTsdownPlugin(context) {
|
|
7
|
-
return createRolldownPlugin(createUnplugin(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
3
|
export { createTsdownPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,101 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require('./
|
|
2
|
+
const require_unplugin = require('./unplugin-CkInBCQX.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 defu = require("defu");
|
|
8
|
-
defu =
|
|
8
|
+
defu = require_unplugin.__toESM(defu);
|
|
9
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
10
|
+
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
11
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
12
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
13
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
9
14
|
let tsdown = require("tsdown");
|
|
10
15
|
|
|
16
|
+
//#region ../powerlines/src/lib/build/tsdown.ts
|
|
17
|
+
const DEFAULT_TSDOWN_CONFIG = {
|
|
18
|
+
platform: "neutral",
|
|
19
|
+
target: "esnext",
|
|
20
|
+
cjsDefault: true,
|
|
21
|
+
unbundle: true,
|
|
22
|
+
shims: true,
|
|
23
|
+
fixedExtension: true,
|
|
24
|
+
nodeProtocol: true,
|
|
25
|
+
clean: false
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
29
|
+
*
|
|
30
|
+
* @param formats - The formats to resolve.
|
|
31
|
+
* @returns The resolved entry options.
|
|
32
|
+
*/
|
|
33
|
+
function resolveTsdownFormat(formats) {
|
|
34
|
+
return (0, __stryke_convert_to_array.toArray)(formats).map((format) => {
|
|
35
|
+
switch (format) {
|
|
36
|
+
case "cjs": return "cjs";
|
|
37
|
+
case "iife": return "iife";
|
|
38
|
+
case "esm":
|
|
39
|
+
default: return "esm";
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim();
|
|
44
|
+
/**
|
|
45
|
+
* Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
|
|
46
|
+
*
|
|
47
|
+
* @param context - The build context.
|
|
48
|
+
* @returns The resolved options.
|
|
49
|
+
*/
|
|
50
|
+
function extractTsdownConfig(context) {
|
|
51
|
+
return (0, defu.default)({
|
|
52
|
+
entry: context.entry.length > 0 ? context.entry.filter(Boolean).map((entry) => {
|
|
53
|
+
return (0, __stryke_path_append.appendPath)((0, __stryke_path_append.appendPath)(entry.file, context.config.projectRoot), context.workspaceConfig.workspaceRoot);
|
|
54
|
+
}) : [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.sourceRoot, "**/*.ts"), (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.sourceRoot, "**/*.tsx")],
|
|
55
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
56
|
+
const path = context.fs.ids[id];
|
|
57
|
+
if (path) ret[id] = path;
|
|
58
|
+
return ret;
|
|
59
|
+
}, context.config.build.alias ?? {}),
|
|
60
|
+
noExternal: context.builtins
|
|
61
|
+
}, context.config.build.variant === "tsdown" ? context.config.build.override : {}, context.config.build.variant === "tsdown" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, {
|
|
62
|
+
name: context.config.name,
|
|
63
|
+
cwd: (0, __stryke_path_append.appendPath)(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
|
|
64
|
+
dts: {
|
|
65
|
+
parallel: true,
|
|
66
|
+
newContext: true,
|
|
67
|
+
cwd: (0, __stryke_path_append.appendPath)(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
|
|
68
|
+
tsconfig: (0, __stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
69
|
+
sourcemap: context.config.mode === "development"
|
|
70
|
+
},
|
|
71
|
+
resolve: { alias: context.builtins.reduce((ret, id) => {
|
|
72
|
+
const path = context.fs.ids[id];
|
|
73
|
+
if (path) ret[id] = path;
|
|
74
|
+
return ret;
|
|
75
|
+
}, context.config.build.alias ?? {}) },
|
|
76
|
+
outDir: (0, __stryke_path_append.appendPath)(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
77
|
+
tsconfig: (0, __stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
78
|
+
format: resolveTsdownFormat(context.config.output.format).filter(Boolean),
|
|
79
|
+
mode: context.config.mode,
|
|
80
|
+
treeshake: context.config.build.variant === "tsdown" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "esbuild" ? context.config.build?.treeShaking : void 0,
|
|
81
|
+
minify: context.config.mode === "production",
|
|
82
|
+
metafile: context.config.mode === "development",
|
|
83
|
+
sourcemap: context.config.mode === "development",
|
|
84
|
+
debug: context.config.mode === "development",
|
|
85
|
+
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
86
|
+
logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
87
|
+
customLogger: {
|
|
88
|
+
level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
89
|
+
info: (...msgs) => (0, __stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)),
|
|
90
|
+
warn: (...msgs) => (0, __stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
91
|
+
warnOnce: (...msgs) => (0, __stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
92
|
+
error: (...msgs) => (0, __stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
|
|
93
|
+
success: (...msgs) => (0, __stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs))
|
|
94
|
+
}
|
|
95
|
+
}, DEFAULT_TSDOWN_CONFIG);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
11
99
|
//#region src/index.ts
|
|
12
100
|
/**
|
|
13
101
|
* A Powerlines plugin to use Tsdown to build the project.
|
|
@@ -28,14 +116,14 @@ const plugin = (options = {}) => {
|
|
|
28
116
|
async build() {
|
|
29
117
|
await (0, tsdown.build)((0, defu.default)({
|
|
30
118
|
config: false,
|
|
31
|
-
plugins: [
|
|
32
|
-
},
|
|
119
|
+
plugins: [require_unplugin.createTsdownPlugin(this)]
|
|
120
|
+
}, extractTsdownConfig(this)));
|
|
33
121
|
}
|
|
34
122
|
};
|
|
35
123
|
};
|
|
36
124
|
var src_default = plugin;
|
|
37
125
|
|
|
38
126
|
//#endregion
|
|
39
|
-
exports.createTsdownPlugin =
|
|
127
|
+
exports.createTsdownPlugin = require_unplugin.createTsdownPlugin;
|
|
40
128
|
exports.default = src_default;
|
|
41
129
|
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 __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, l as Plugin, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-Bh65OO11.cjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "./unplugin-DyxNwfan.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 __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, l as Plugin, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-DnzEhAC7.mjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "./unplugin-BxNntd0I.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 Tsdown to build the project.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
1
|
+
import { t as createTsdownPlugin } from "./unplugin-1lE_z2lE.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 defu$1 from "defu";
|
|
7
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
8
|
+
import { omit } from "@stryke/helpers/omit";
|
|
9
|
+
import { appendPath } from "@stryke/path/append";
|
|
10
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
6
12
|
import { build } from "tsdown";
|
|
7
13
|
|
|
14
|
+
//#region ../powerlines/src/lib/build/tsdown.ts
|
|
15
|
+
const DEFAULT_TSDOWN_CONFIG = {
|
|
16
|
+
platform: "neutral",
|
|
17
|
+
target: "esnext",
|
|
18
|
+
cjsDefault: true,
|
|
19
|
+
unbundle: true,
|
|
20
|
+
shims: true,
|
|
21
|
+
fixedExtension: true,
|
|
22
|
+
nodeProtocol: true,
|
|
23
|
+
clean: false
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
27
|
+
*
|
|
28
|
+
* @param formats - The formats to resolve.
|
|
29
|
+
* @returns The resolved entry options.
|
|
30
|
+
*/
|
|
31
|
+
function resolveTsdownFormat(formats) {
|
|
32
|
+
return toArray(formats).map((format) => {
|
|
33
|
+
switch (format) {
|
|
34
|
+
case "cjs": return "cjs";
|
|
35
|
+
case "iife": return "iife";
|
|
36
|
+
case "esm":
|
|
37
|
+
default: return "esm";
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim();
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
|
|
44
|
+
*
|
|
45
|
+
* @param context - The build context.
|
|
46
|
+
* @returns The resolved options.
|
|
47
|
+
*/
|
|
48
|
+
function extractTsdownConfig(context) {
|
|
49
|
+
return defu$1({
|
|
50
|
+
entry: context.entry.length > 0 ? context.entry.filter(Boolean).map((entry) => {
|
|
51
|
+
return appendPath(appendPath(entry.file, context.config.projectRoot), context.workspaceConfig.workspaceRoot);
|
|
52
|
+
}) : [joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot, "**/*.ts"), joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot, "**/*.tsx")],
|
|
53
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
54
|
+
const path = context.fs.ids[id];
|
|
55
|
+
if (path) ret[id] = path;
|
|
56
|
+
return ret;
|
|
57
|
+
}, context.config.build.alias ?? {}),
|
|
58
|
+
noExternal: context.builtins
|
|
59
|
+
}, context.config.build.variant === "tsdown" ? context.config.build.override : {}, context.config.build.variant === "tsdown" ? omit(context.config.build, ["override", "variant"]) : {}, {
|
|
60
|
+
name: context.config.name,
|
|
61
|
+
cwd: appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
|
|
62
|
+
dts: {
|
|
63
|
+
parallel: true,
|
|
64
|
+
newContext: true,
|
|
65
|
+
cwd: appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
|
|
66
|
+
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
67
|
+
sourcemap: context.config.mode === "development"
|
|
68
|
+
},
|
|
69
|
+
resolve: { alias: context.builtins.reduce((ret, id) => {
|
|
70
|
+
const path = context.fs.ids[id];
|
|
71
|
+
if (path) ret[id] = path;
|
|
72
|
+
return ret;
|
|
73
|
+
}, context.config.build.alias ?? {}) },
|
|
74
|
+
outDir: appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
75
|
+
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
76
|
+
format: resolveTsdownFormat(context.config.output.format).filter(Boolean),
|
|
77
|
+
mode: context.config.mode,
|
|
78
|
+
treeshake: context.config.build.variant === "tsdown" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "esbuild" ? context.config.build?.treeShaking : void 0,
|
|
79
|
+
minify: context.config.mode === "production",
|
|
80
|
+
metafile: context.config.mode === "development",
|
|
81
|
+
sourcemap: context.config.mode === "development",
|
|
82
|
+
debug: context.config.mode === "development",
|
|
83
|
+
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
84
|
+
logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
85
|
+
customLogger: {
|
|
86
|
+
level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
87
|
+
info: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)),
|
|
88
|
+
warn: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
89
|
+
warnOnce: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
90
|
+
error: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
|
|
91
|
+
success: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs))
|
|
92
|
+
}
|
|
93
|
+
}, DEFAULT_TSDOWN_CONFIG);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
8
97
|
//#region src/index.ts
|
|
9
98
|
/**
|
|
10
99
|
* A Powerlines plugin to use Tsdown to build the project.
|