@powerlines/plugin-tsdown 0.1.289 → 0.1.291
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/README.md +14 -16
- package/dist/{build-BOzEPSe_.d.cts → build-0MluyGwY.d.mts} +1 -1
- package/dist/build-0MluyGwY.d.mts.map +1 -0
- package/dist/{build-CB3pTpHV.d.mts → build-DVnbPLO-.d.cts} +1 -1
- package/dist/build-DVnbPLO-.d.cts.map +1 -0
- package/dist/helpers/index.cjs +4 -4
- package/dist/helpers/index.d.cts +2 -4
- package/dist/helpers/index.d.mts +2 -5
- package/dist/helpers/index.mjs +2 -3
- package/dist/helpers/resolve-options.cjs +2 -1
- package/dist/helpers/resolve-options.d.cts +1 -1
- package/dist/helpers/resolve-options.d.mts +1 -1
- package/dist/helpers/resolve-options.mjs +121 -2
- package/dist/helpers/resolve-options.mjs.map +1 -0
- package/dist/helpers/unplugin.cjs +11 -2
- package/dist/helpers/unplugin.d.cts +1 -2
- package/dist/helpers/unplugin.d.mts +1 -3
- package/dist/helpers/unplugin.mjs +10 -2
- package/dist/helpers/unplugin.mjs.map +1 -0
- package/dist/index.cjs +11 -10
- package/dist/index.d.cts +4 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{plugin-BW9ZnEXA.d.cts → plugin-DcuYkRNk.d.cts} +2 -2
- package/dist/plugin-DcuYkRNk.d.cts.map +1 -0
- package/dist/{plugin-CVc-l4XN.d.mts → plugin-T43KOEy-.d.mts} +2 -2
- package/dist/plugin-T43KOEy-.d.mts.map +1 -0
- package/dist/{resolve-options-BPDOKwIe.d.mts → resolve-options-BS9JkZAF.d.mts} +1 -1
- package/dist/resolve-options-BS9JkZAF.d.mts.map +1 -0
- package/dist/{resolve-options-BSwcMDS2.d.cts → resolve-options-CTEkMDsP.d.cts} +1 -1
- package/dist/resolve-options-CTEkMDsP.d.cts.map +1 -0
- package/dist/{resolve-options-DTgEZjex.cjs → resolve-options-zRmpZ1kt.cjs} +36 -37
- package/dist/types/build.d.cts +1 -1
- package/dist/types/build.d.mts +1 -1
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.mts +2 -3
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.mts +1 -2
- package/dist/unplugin-B4lJrjNj.d.mts +8 -0
- package/dist/unplugin-B4lJrjNj.d.mts.map +1 -0
- package/dist/unplugin-DycqcfwF.d.cts +8 -0
- package/dist/unplugin-DycqcfwF.d.cts.map +1 -0
- package/package.json +21 -19
- package/dist/build-BOzEPSe_.d.cts.map +0 -1
- package/dist/build-CB3pTpHV.d.mts.map +0 -1
- package/dist/helpers-C9XSjwSZ.mjs +0 -1
- package/dist/helpers-yB1XkvQI.cjs +0 -0
- package/dist/index-2Ag-54t8.d.mts +0 -1
- package/dist/index-B_e8BwCm.d.cts +0 -1
- package/dist/index-CUbWeWHc.d.mts +0 -1
- package/dist/index-CiBIKhMu.d.cts +0 -1
- package/dist/plugin-BW9ZnEXA.d.cts.map +0 -1
- package/dist/plugin-CVc-l4XN.d.mts.map +0 -1
- package/dist/resolve-options-BPDOKwIe.d.mts.map +0 -1
- package/dist/resolve-options-BSwcMDS2.d.cts.map +0 -1
- package/dist/resolve-options-DDaVMiLp.mjs +0 -123
- package/dist/resolve-options-DDaVMiLp.mjs.map +0 -1
- package/dist/unplugin-BEyzw6Dm.d.mts +0 -8
- package/dist/unplugin-BEyzw6Dm.d.mts.map +0 -1
- package/dist/unplugin-SEtpQs16.d.cts +0 -8
- package/dist/unplugin-SEtpQs16.d.cts.map +0 -1
- package/dist/unplugin-eB0aEKY5.cjs +0 -16
- package/dist/unplugin-kYkLMXDM.mjs +0 -11
- package/dist/unplugin-kYkLMXDM.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/powerlines) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -58,21 +58,19 @@ A package containing a Powerlines plugin to assist in running TSDown builds on P
|
|
|
58
58
|
|
|
59
59
|
## Table of Contents
|
|
60
60
|
|
|
61
|
-
- [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- [Contributing](#contributing)
|
|
75
|
-
- [Contributors](#contributors)
|
|
61
|
+
- [Installing](#installing)
|
|
62
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
63
|
+
- [Development](#development)
|
|
64
|
+
- [Building](#building)
|
|
65
|
+
- [Running unit tests](#running-unit-tests)
|
|
66
|
+
- [Linting](#linting)
|
|
67
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
68
|
+
- [Roadmap](#roadmap)
|
|
69
|
+
- [Support](#support)
|
|
70
|
+
- [License](#license)
|
|
71
|
+
- [Changelog](#changelog)
|
|
72
|
+
- [Contributing](#contributing)
|
|
73
|
+
- [Contributors](#contributors)
|
|
76
74
|
|
|
77
75
|
<!-- END doctoc -->
|
|
78
76
|
|
|
@@ -5,4 +5,4 @@ type TsdownOptions = Partial<Omit<UserConfig, "name" | "outDir" | "clean" | "cwd
|
|
|
5
5
|
declare type __ΩTsdownOptions = any[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { __ΩTsdownOptions as n, TsdownOptions as t };
|
|
8
|
-
//# sourceMappingURL=build-
|
|
8
|
+
//# sourceMappingURL=build-0MluyGwY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-0MluyGwY.d.mts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
|
|
@@ -5,4 +5,4 @@ type TsdownOptions = Partial<Omit<UserConfig, "name" | "outDir" | "clean" | "cwd
|
|
|
5
5
|
declare type __ΩTsdownOptions = any[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { __ΩTsdownOptions as n, TsdownOptions as t };
|
|
8
|
-
//# sourceMappingURL=build-
|
|
8
|
+
//# sourceMappingURL=build-DVnbPLO-.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-DVnbPLO-.d.cts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
require('
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_resolve_options = require('../resolve-options-zRmpZ1kt.cjs');
|
|
3
|
+
const require_helpers_unplugin = require('./unplugin.cjs');
|
|
4
4
|
|
|
5
5
|
exports.DEFAULT_TSDOWN_CONFIG = require_resolve_options.DEFAULT_TSDOWN_CONFIG;
|
|
6
|
-
exports.createTsdownPlugin =
|
|
6
|
+
exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
|
|
7
7
|
exports.resolveFormat = require_resolve_options.resolveFormat;
|
|
8
8
|
exports.resolveFromFormat = require_resolve_options.resolveFromFormat;
|
|
9
9
|
exports.resolveOptions = require_resolve_options.resolveOptions;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-
|
|
2
|
-
import "../
|
|
3
|
-
import { t as createTsdownPlugin } from "../unplugin-SEtpQs16.cjs";
|
|
4
|
-
import "../index-CiBIKhMu.cjs";
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-CTEkMDsP.cjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "../unplugin-DycqcfwF.cjs";
|
|
5
3
|
export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-
|
|
2
|
-
import "../
|
|
3
|
-
import "../plugin-CVc-l4XN.mjs";
|
|
4
|
-
import { t as createTsdownPlugin } from "../unplugin-BEyzw6Dm.mjs";
|
|
5
|
-
import "../index-CUbWeWHc.mjs";
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-BS9JkZAF.mjs";
|
|
2
|
+
import { t as createTsdownPlugin } from "../unplugin-B4lJrjNj.mjs";
|
|
6
3
|
export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../helpers-C9XSjwSZ.mjs";
|
|
1
|
+
import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.mjs";
|
|
2
|
+
import { createTsdownPlugin } from "./unplugin.mjs";
|
|
4
3
|
|
|
5
4
|
export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_resolve_options = require('../resolve-options-zRmpZ1kt.cjs');
|
|
2
3
|
|
|
3
4
|
exports.DEFAULT_TSDOWN_CONFIG = require_resolve_options.DEFAULT_TSDOWN_CONFIG;
|
|
4
5
|
exports.resolveFormat = require_resolve_options.resolveFormat;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-CTEkMDsP.cjs";
|
|
2
2
|
export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "../resolve-options-BS9JkZAF.mjs";
|
|
2
2
|
export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
|
|
@@ -1,3 +1,122 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDependencyConfig } from "@powerlines/core/plugin-utils";
|
|
2
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
3
|
+
import defu from "defu";
|
|
4
|
+
import { appendPath } from "@stryke/path/append";
|
|
5
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
7
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
8
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
//#region src/helpers/resolve-options.ts
|
|
11
|
+
const DEFAULT_TSDOWN_CONFIG = {
|
|
12
|
+
platform: "neutral",
|
|
13
|
+
target: "esnext",
|
|
14
|
+
fixedExtension: true,
|
|
15
|
+
nodeProtocol: true,
|
|
16
|
+
clean: false
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
20
|
+
*
|
|
21
|
+
* @param formats - The formats to resolve.
|
|
22
|
+
* @returns The resolved entry options.
|
|
23
|
+
*/
|
|
24
|
+
function resolveFormat(formats) {
|
|
25
|
+
return toArray(formats).map((format) => {
|
|
26
|
+
switch (format) {
|
|
27
|
+
case "cjs": return "cjs";
|
|
28
|
+
case "iife": return "iife";
|
|
29
|
+
default: return "esm";
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
35
|
+
*
|
|
36
|
+
* @param formats - The formats to resolve.
|
|
37
|
+
* @returns The resolved entry options.
|
|
38
|
+
*/
|
|
39
|
+
function resolveFromFormat(formats) {
|
|
40
|
+
return toArray(formats).map((format) => {
|
|
41
|
+
switch (format) {
|
|
42
|
+
case "cjs":
|
|
43
|
+
case "commonjs": return "cjs";
|
|
44
|
+
case "iife": return "iife";
|
|
45
|
+
default: return "esm";
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "").trim();
|
|
50
|
+
/**
|
|
51
|
+
* Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
|
|
52
|
+
*
|
|
53
|
+
* @param context - The build context.
|
|
54
|
+
* @returns The resolved options.
|
|
55
|
+
*/
|
|
56
|
+
function resolveOptions(context) {
|
|
57
|
+
const { external, noExternal } = getDependencyConfig(context);
|
|
58
|
+
return defu({
|
|
59
|
+
entry: context.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(context.entry.filter((entry) => entry?.file).map((entry) => [entry.output || replaceExtension(replacePath(replacePath(entry.file, joinPaths(context.config.root, "src")), context.entryPath)), entry.file])) : [joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.ts"), joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.tsx")],
|
|
60
|
+
deps: {
|
|
61
|
+
neverBundle: external,
|
|
62
|
+
alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
|
|
63
|
+
onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
|
|
64
|
+
skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
|
|
65
|
+
},
|
|
66
|
+
alias: context.alias,
|
|
67
|
+
resolve: { alias: context.alias },
|
|
68
|
+
exports: context.config?.tsdown && context.config.tsdown?.exports ? defu(isSetObject(context.config.tsdown?.exports) ? context.config.tsdown?.exports : {}, { customExports: (exports) => {
|
|
69
|
+
const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
|
|
70
|
+
if (isSetString(value)) return [key, value];
|
|
71
|
+
const currentExport = {};
|
|
72
|
+
if (isSetString(value.require)) currentExport.require = {
|
|
73
|
+
types: replaceExtension(value.require, ".d.cts", { fullExtension: true }),
|
|
74
|
+
default: value.require
|
|
75
|
+
};
|
|
76
|
+
if (isSetString(value.import)) currentExport.import = {
|
|
77
|
+
types: replaceExtension(value.import, ".d.mts", { fullExtension: true }),
|
|
78
|
+
default: value.import
|
|
79
|
+
};
|
|
80
|
+
if (!isSetObject(value.default)) {
|
|
81
|
+
if (isSetObject(currentExport.import)) currentExport.default = currentExport.import;
|
|
82
|
+
else if (isSetObject(currentExport.require)) currentExport.default = currentExport.require;
|
|
83
|
+
}
|
|
84
|
+
return [key, currentExport];
|
|
85
|
+
}));
|
|
86
|
+
return Object.keys(result).sort().reduce((ret, key) => {
|
|
87
|
+
ret[key] = result[key];
|
|
88
|
+
return ret;
|
|
89
|
+
}, {});
|
|
90
|
+
} }) : void 0
|
|
91
|
+
}, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
|
|
92
|
+
name: context.config.name,
|
|
93
|
+
cwd: appendPath(context.config.root, context.workspaceConfig.workspaceRoot),
|
|
94
|
+
define: context.config.define,
|
|
95
|
+
inputOptions: { transform: { inject: context.config.inject } },
|
|
96
|
+
platform: context.config.platform,
|
|
97
|
+
dts: context.config.output.dts,
|
|
98
|
+
outDir: appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
99
|
+
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
100
|
+
format: resolveFormat(context.config.output.format).filter(Boolean),
|
|
101
|
+
mode: context.config.mode,
|
|
102
|
+
treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
|
|
103
|
+
minify: context.config.mode === "production",
|
|
104
|
+
metafile: context.config.mode === "development",
|
|
105
|
+
sourcemap: context.config.mode === "development",
|
|
106
|
+
debug: context.config.mode === "development",
|
|
107
|
+
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
108
|
+
logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
109
|
+
customLogger: {
|
|
110
|
+
level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
111
|
+
info: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs)),
|
|
112
|
+
warn: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
113
|
+
warnOnce: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
114
|
+
error: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
|
|
115
|
+
success: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs))
|
|
116
|
+
}
|
|
117
|
+
}, DEFAULT_TSDOWN_CONFIG);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
|
|
122
|
+
//# sourceMappingURL=resolve-options.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options.mjs","names":[],"sources":["../../src/helpers/resolve-options.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 } from \"@powerlines/core\";\nimport { getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport { RolldownPluginResolvedConfig } from \"@powerlines/plugin-rolldown/types/plugin\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport { TsdownPluginResolvedConfig } from \"../types/plugin\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n nodeProtocol: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n deps: {\n neverBundle: external,\n alwaysBundle: context.config.resolve.skipNodeModulesBundle\n ? undefined\n : noExternal,\n onlyBundle: context.config.resolve.skipNodeModulesBundle\n ? noExternal\n : undefined,\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle\n },\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n exports:\n (context.config as TsdownPluginResolvedConfig)?.tsdown &&\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n ? defu(\n isSetObject(\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n )\n ? (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n : {},\n {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n }\n )\n : undefined\n },\n (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown\n : {},\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? {\n inputOptions: (context.config as RolldownPluginResolvedConfig)\n ?.rolldown\n }\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n define: context.config.define,\n inputOptions: {\n transform: {\n inject: context.config.inject\n }\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake: (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown?.treeshake\n : undefined,\n minify: context.config.mode === \"production\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_TSDOWN_CONFIG\n ) as BuildOptions;\n}\n"],"mappings":";;;;;;;;;;AAgCA,MAAa,wBAA+C;CAC1D,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,c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,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,MAAM,cAAc,SAAS,GAAG,KAAK,CAAC;GACjD;EACF,EACD,sBACD"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_resolve_options = require('../resolve-options-zRmpZ1kt.cjs');
|
|
3
|
+
let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
4
|
+
let unplugin = require("unplugin");
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
//#region src/helpers/unplugin.ts
|
|
7
|
+
function createTsdownPlugin(context) {
|
|
8
|
+
return (0, unplugin.createRolldownPlugin)((0, _powerlines_core_lib_unplugin.createUnplugin)(context))({});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.createTsdownPlugin = createTsdownPlugin;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnplugin } from "@powerlines/core/lib/unplugin";
|
|
2
|
+
import { createRolldownPlugin } from "unplugin";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/helpers/unplugin.ts
|
|
5
|
+
function createTsdownPlugin(context) {
|
|
6
|
+
return createRolldownPlugin(createUnplugin(context))({});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createTsdownPlugin };
|
|
11
|
+
//# sourceMappingURL=unplugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unplugin.mjs","names":[],"sources":["../../src/helpers/unplugin.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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { TsdownPluginContext } from \"../types/plugin\";\n\nexport function createTsdownPlugin(context: TsdownPluginContext) {\n return createRolldownPlugin(createUnplugin(context))({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,mBAAmB,SAA8B;AAC/D,QAAO,qBAAqB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
const require_resolve_options = require('./resolve-options-
|
|
3
|
-
const
|
|
4
|
-
require('./helpers
|
|
5
|
-
let
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_resolve_options = require('./resolve-options-zRmpZ1kt.cjs');
|
|
3
|
+
const require_helpers_unplugin = require('./helpers/unplugin.cjs');
|
|
4
|
+
require('./helpers/index.cjs');
|
|
5
|
+
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
6
|
+
let _powerlines_core_plugin_utils_format_package_json = require("@powerlines/core/plugin-utils/format-package-json");
|
|
7
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
8
|
let defu = require("defu");
|
|
7
9
|
defu = require_resolve_options.__toESM(defu);
|
|
8
10
|
let tsdown = require("tsdown");
|
|
@@ -25,18 +27,17 @@ const plugin = (options = {}) => {
|
|
|
25
27
|
this.trace("Starting Tsdown build process...");
|
|
26
28
|
await (0, tsdown.build)((0, defu.default)({
|
|
27
29
|
config: false,
|
|
28
|
-
plugins:
|
|
30
|
+
plugins: await (0, _powerlines_core_plugin_utils.combinePlugins)({ plugins: (0, _stryke_convert_to_array.toArray)(require_helpers_unplugin.createTsdownPlugin(this)) }).rolldown()
|
|
29
31
|
}, require_resolve_options.resolveOptions(this)));
|
|
30
|
-
await (0,
|
|
32
|
+
await (0, _powerlines_core_plugin_utils_format_package_json.formatPackageJson)(this);
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
35
|
};
|
|
34
|
-
var src_default = plugin;
|
|
35
36
|
|
|
36
37
|
//#endregion
|
|
37
38
|
exports.DEFAULT_TSDOWN_CONFIG = require_resolve_options.DEFAULT_TSDOWN_CONFIG;
|
|
38
|
-
exports.createTsdownPlugin =
|
|
39
|
-
exports.default =
|
|
39
|
+
exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
|
|
40
|
+
exports.default = plugin;
|
|
40
41
|
exports.plugin = plugin;
|
|
41
42
|
exports.resolveFormat = require_resolve_options.resolveFormat;
|
|
42
43
|
exports.resolveFromFormat = require_resolve_options.resolveFromFormat;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "./resolve-options-
|
|
2
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-
|
|
3
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-
|
|
4
|
-
import { t as createTsdownPlugin } from "./unplugin-
|
|
5
|
-
import "./index-CiBIKhMu.cjs";
|
|
6
|
-
import "./index-B_e8BwCm.cjs";
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "./resolve-options-CTEkMDsP.cjs";
|
|
2
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-DVnbPLO-.cjs";
|
|
3
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-DcuYkRNk.cjs";
|
|
4
|
+
import { t as createTsdownPlugin } from "./unplugin-DycqcfwF.cjs";
|
|
7
5
|
import { Plugin } from "@powerlines/core";
|
|
8
6
|
|
|
9
7
|
//#region src/index.d.ts
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YAoCY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;AAJgB;;;AAAA,cAWhB,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "./resolve-options-
|
|
2
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-
|
|
3
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-
|
|
4
|
-
import { t as createTsdownPlugin } from "./unplugin-
|
|
5
|
-
import "./index-CUbWeWHc.mjs";
|
|
6
|
-
import "./index-2Ag-54t8.mjs";
|
|
1
|
+
import { i as resolveOptions, n as resolveFormat, r as resolveFromFormat, t as DEFAULT_TSDOWN_CONFIG } from "./resolve-options-BS9JkZAF.mjs";
|
|
2
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-0MluyGwY.mjs";
|
|
3
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "./plugin-T43KOEy-.mjs";
|
|
4
|
+
import { t as createTsdownPlugin } from "./unplugin-B4lJrjNj.mjs";
|
|
7
5
|
import { Plugin } from "@powerlines/core";
|
|
8
6
|
|
|
9
7
|
//#region src/index.d.ts
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YAoCY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;AAJgB;;;AAAA,cAWhB,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./helpers
|
|
1
|
+
import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.mjs";
|
|
2
|
+
import { createTsdownPlugin } from "./helpers/unplugin.mjs";
|
|
3
|
+
import "./helpers/index.mjs";
|
|
4
|
+
import { combinePlugins } from "@powerlines/core/plugin-utils";
|
|
4
5
|
import { formatPackageJson } from "@powerlines/core/plugin-utils/format-package-json";
|
|
6
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
5
7
|
import defu from "defu";
|
|
6
8
|
import { build } from "tsdown";
|
|
7
9
|
|
|
@@ -23,14 +25,13 @@ const plugin = (options = {}) => {
|
|
|
23
25
|
this.trace("Starting Tsdown build process...");
|
|
24
26
|
await build(defu({
|
|
25
27
|
config: false,
|
|
26
|
-
plugins:
|
|
28
|
+
plugins: await combinePlugins({ plugins: toArray(createTsdownPlugin(this)) }).rolldown()
|
|
27
29
|
}, resolveOptions(this)));
|
|
28
30
|
await formatPackageJson(this);
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
|
-
var src_default = plugin;
|
|
33
34
|
|
|
34
35
|
//#endregion
|
|
35
|
-
export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin,
|
|
36
|
+
export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, plugin as default, plugin, resolveFormat, resolveFromFormat, resolveOptions };
|
|
36
37
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { Plugin } from \"@powerlines/core\";\nimport { formatPackageJson } from \"@powerlines/core/plugin-utils/format-package-json\";\nimport defu from \"defu\";\nimport { build } from \"tsdown\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createTsdownPlugin } from \"./helpers/unplugin\";\nimport {\n TsdownPluginContext,\n TsdownPluginOptions,\n TsdownPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport type * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n tsdown?: TsdownPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Tsdown to build the project.\n */\nexport const plugin = <\n TContext extends TsdownPluginContext = TsdownPluginContext\n>(\n options: TsdownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsdown\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `tsdown` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n tsdown: {\n ...options\n }\n } as Partial<TsdownPluginResolvedConfig>;\n },\n async build() {\n this.trace(\"Starting Tsdown build process...\");\n\n await build(\n defu(\n {\n config: false,\n plugins:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { Plugin } from \"@powerlines/core\";\nimport { combinePlugins } from \"@powerlines/core/plugin-utils\";\nimport { formatPackageJson } from \"@powerlines/core/plugin-utils/format-package-json\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport defu from \"defu\";\nimport { build } from \"tsdown\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createTsdownPlugin } from \"./helpers/unplugin\";\nimport {\n TsdownPluginContext,\n TsdownPluginOptions,\n TsdownPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport type * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n tsdown?: TsdownPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Tsdown to build the project.\n */\nexport const plugin = <\n TContext extends TsdownPluginContext = TsdownPluginContext\n>(\n options: TsdownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsdown\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `tsdown` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n tsdown: {\n ...options\n }\n } as Partial<TsdownPluginResolvedConfig>;\n },\n async build() {\n this.trace(\"Starting Tsdown build process...\");\n\n await build(\n defu(\n {\n config: false,\n plugins: await combinePlugins({\n plugins: toArray(createTsdownPlugin(this))\n }).rolldown()\n },\n resolveOptions(this)\n )\n );\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AA4CA,MAAa,UAGX,UAA+B,EAAE,KACZ;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MACH,4EACD;AAED,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,OAAO,MAAM,EACvB;IACD,QAAQ,EACN,GAAG,SACJ;IACF;;EAEH,MAAM,QAAQ;AACZ,QAAK,MAAM,mCAAmC;AAE9C,SAAM,MACJ,KACE;IACE,QAAQ;IACR,SAAS,MAAM,eAAe,EAC5B,SAAS,QAAQ,mBAAmB,KAAK,CAAC,EAC3C,CAAC,CAAC,UAAU;IACd,EACD,eAAe,KAAK,CACrB,CACF;AAED,SAAM,kBAAkB,KAAK;;EAEhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as TsdownOptions } from "./build-
|
|
1
|
+
import { t as TsdownOptions } from "./build-DVnbPLO-.cjs";
|
|
2
2
|
import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/plugin.d.ts
|
|
@@ -16,4 +16,4 @@ declare type __ΩTsdownPluginResolvedConfig = any[];
|
|
|
16
16
|
declare type __ΩTsdownPluginContext = any[];
|
|
17
17
|
//#endregion
|
|
18
18
|
export { __ΩTsdownPluginContext as a, __ΩTsdownPluginUserConfig as c, TsdownPluginUserConfig as i, TsdownPluginOptions as n, __ΩTsdownPluginOptions as o, TsdownPluginResolvedConfig as r, __ΩTsdownPluginResolvedConfig as s, TsdownPluginContext as t };
|
|
19
|
-
//# sourceMappingURL=plugin-
|
|
19
|
+
//# sourceMappingURL=plugin-DcuYkRNk.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-DcuYkRNk.d.cts","names":[],"sources":["../src/types/plugin.ts"],"mappings":";;;;KAqBY,mBAAA,GAAsB,OAAA,CAAQ,aAAA;AAAA,UAEzB,sBAAA,SAA+B,UAAA;EAC9C,MAAA,GAAS,mBAAA;AAAA;AAAA,UAGM,0BAAA,SAAmC,cAAA;EAClD,MAAA,EAAQ,aAAA;AAAA;AAAA,KAGE,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as TsdownOptions } from "./build-
|
|
1
|
+
import { t as TsdownOptions } from "./build-0MluyGwY.mjs";
|
|
2
2
|
import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/plugin.d.ts
|
|
@@ -16,4 +16,4 @@ declare type __ΩTsdownPluginResolvedConfig = any[];
|
|
|
16
16
|
declare type __ΩTsdownPluginContext = any[];
|
|
17
17
|
//#endregion
|
|
18
18
|
export { __ΩTsdownPluginContext as a, __ΩTsdownPluginUserConfig as c, TsdownPluginUserConfig as i, TsdownPluginOptions as n, __ΩTsdownPluginOptions as o, TsdownPluginResolvedConfig as r, __ΩTsdownPluginResolvedConfig as s, TsdownPluginContext as t };
|
|
19
|
-
//# sourceMappingURL=plugin-
|
|
19
|
+
//# sourceMappingURL=plugin-T43KOEy-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-T43KOEy-.d.mts","names":[],"sources":["../src/types/plugin.ts"],"mappings":";;;;KAqBY,mBAAA,GAAsB,OAAA,CAAQ,aAAA;AAAA,UAEzB,sBAAA,SAA+B,UAAA;EAC9C,MAAA,GAAS,mBAAA;AAAA;AAAA,UAGM,0BAAA,SAAmC,cAAA;EAClD,MAAA,EAAQ,aAAA;AAAA;AAAA,KAGE,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
|
|
@@ -27,4 +27,4 @@ declare function resolveFromFormat(formats?: Format | Format[]): Format$1[];
|
|
|
27
27
|
declare function resolveOptions(context: Context): UserConfig;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { resolveOptions as i, resolveFormat as n, resolveFromFormat as r, DEFAULT_TSDOWN_CONFIG as t };
|
|
30
|
-
//# sourceMappingURL=resolve-options-
|
|
30
|
+
//# sourceMappingURL=resolve-options-BS9JkZAF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options-BS9JkZAF.d.mts","names":[],"sources":["../src/helpers/resolve-options.ts"],"mappings":";;;;;cAgCa,qBAAA,EAAuB,OAAA,CAAQ,UAAA;;AAA5C;;;;;iBAcgB,aAAA,CAAc,OAAA,GAAU,QAAA,GAAS,QAAA,KAAW,MAAA;;;;;;;iBAoB5C,iBAAA,CACd,OAAA,GAAU,MAAA,GAAe,MAAA,KACxB,QAAA;;;;;;;iBAiCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,UAAA"}
|
|
@@ -27,4 +27,4 @@ declare function resolveFromFormat(formats?: Format$1 | Format$1[]): Format[];
|
|
|
27
27
|
declare function resolveOptions(context: Context): UserConfig$1;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { resolveOptions as i, resolveFormat as n, resolveFromFormat as r, DEFAULT_TSDOWN_CONFIG as t };
|
|
30
|
-
//# sourceMappingURL=resolve-options-
|
|
30
|
+
//# sourceMappingURL=resolve-options-CTEkMDsP.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-options-CTEkMDsP.d.cts","names":[],"sources":["../src/helpers/resolve-options.ts"],"mappings":";;;;;cAgCa,qBAAA,EAAuB,OAAA,CAAQ,YAAA;;AAA5C;;;;;iBAcgB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;;;;;;iBAoB5C,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;;;;;;;iBAiCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -25,15 +25,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
+
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
29
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
28
30
|
let defu = require("defu");
|
|
29
31
|
defu = __toESM(defu);
|
|
30
|
-
let
|
|
31
|
-
let
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
let
|
|
35
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
36
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
32
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
33
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
34
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
35
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
36
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
37
37
|
|
|
38
38
|
//#region src/helpers/resolve-options.ts
|
|
39
39
|
const DEFAULT_TSDOWN_CONFIG = {
|
|
@@ -50,11 +50,10 @@ const DEFAULT_TSDOWN_CONFIG = {
|
|
|
50
50
|
* @returns The resolved entry options.
|
|
51
51
|
*/
|
|
52
52
|
function resolveFormat(formats) {
|
|
53
|
-
return (0,
|
|
53
|
+
return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
|
|
54
54
|
switch (format) {
|
|
55
55
|
case "cjs": return "cjs";
|
|
56
56
|
case "iife": return "iife";
|
|
57
|
-
case "esm":
|
|
58
57
|
default: return "esm";
|
|
59
58
|
}
|
|
60
59
|
});
|
|
@@ -66,15 +65,11 @@ function resolveFormat(formats) {
|
|
|
66
65
|
* @returns The resolved entry options.
|
|
67
66
|
*/
|
|
68
67
|
function resolveFromFormat(formats) {
|
|
69
|
-
return (0,
|
|
68
|
+
return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
|
|
70
69
|
switch (format) {
|
|
71
70
|
case "cjs":
|
|
72
71
|
case "commonjs": return "cjs";
|
|
73
72
|
case "iife": return "iife";
|
|
74
|
-
case "esm":
|
|
75
|
-
case "es":
|
|
76
|
-
case "module":
|
|
77
|
-
case "umd":
|
|
78
73
|
default: return "esm";
|
|
79
74
|
}
|
|
80
75
|
});
|
|
@@ -87,28 +82,32 @@ const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").repla
|
|
|
87
82
|
* @returns The resolved options.
|
|
88
83
|
*/
|
|
89
84
|
function resolveOptions(context) {
|
|
90
|
-
const { external, noExternal } = (0,
|
|
85
|
+
const { external, noExternal } = (0, _powerlines_core_plugin_utils.getDependencyConfig)(context);
|
|
91
86
|
return (0, defu.default)({
|
|
92
|
-
entry: context.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(context.entry.filter((entry) => entry?.file).map((entry) => [entry.output || (0,
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
entry: context.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(context.entry.filter((entry) => entry?.file).map((entry) => [entry.output || (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(entry.file, (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src")), context.entryPath)), entry.file])) : [(0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.ts"), (0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.tsx")],
|
|
88
|
+
deps: {
|
|
89
|
+
neverBundle: external,
|
|
90
|
+
alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
|
|
91
|
+
onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
|
|
92
|
+
skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
|
|
93
|
+
},
|
|
95
94
|
alias: context.alias,
|
|
96
95
|
resolve: { alias: context.alias },
|
|
97
|
-
exports: context.config?.tsdown && context.config.tsdown?.exports ? (0, defu.default)((0,
|
|
98
|
-
const result = Object.fromEntries(Object.entries(exports
|
|
99
|
-
if ((0,
|
|
96
|
+
exports: context.config?.tsdown && context.config.tsdown?.exports ? (0, defu.default)((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.tsdown?.exports) ? context.config.tsdown?.exports : {}, { customExports: (exports) => {
|
|
97
|
+
const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
|
|
98
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(value)) return [key, value];
|
|
100
99
|
const currentExport = {};
|
|
101
|
-
if ((0,
|
|
102
|
-
types: (0,
|
|
100
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(value.require)) currentExport.require = {
|
|
101
|
+
types: (0, _stryke_path_replace.replaceExtension)(value.require, ".d.cts", { fullExtension: true }),
|
|
103
102
|
default: value.require
|
|
104
103
|
};
|
|
105
|
-
if ((0,
|
|
106
|
-
types: (0,
|
|
104
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(value.import)) currentExport.import = {
|
|
105
|
+
types: (0, _stryke_path_replace.replaceExtension)(value.import, ".d.mts", { fullExtension: true }),
|
|
107
106
|
default: value.import
|
|
108
107
|
};
|
|
109
|
-
if (!(0,
|
|
110
|
-
if ((0,
|
|
111
|
-
else if ((0,
|
|
108
|
+
if (!(0, _stryke_type_checks_is_set_object.isSetObject)(value.default)) {
|
|
109
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.import)) currentExport.default = currentExport.import;
|
|
110
|
+
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.require)) currentExport.default = currentExport.require;
|
|
112
111
|
}
|
|
113
112
|
return [key, currentExport];
|
|
114
113
|
}));
|
|
@@ -119,13 +118,13 @@ function resolveOptions(context) {
|
|
|
119
118
|
} }) : void 0
|
|
120
119
|
}, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
|
|
121
120
|
name: context.config.name,
|
|
122
|
-
cwd: (0,
|
|
121
|
+
cwd: (0, _stryke_path_append.appendPath)(context.config.root, context.workspaceConfig.workspaceRoot),
|
|
123
122
|
define: context.config.define,
|
|
124
123
|
inputOptions: { transform: { inject: context.config.inject } },
|
|
125
124
|
platform: context.config.platform,
|
|
126
125
|
dts: context.config.output.dts,
|
|
127
|
-
outDir: (0,
|
|
128
|
-
tsconfig: (0,
|
|
126
|
+
outDir: (0, _stryke_path_append.appendPath)(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
127
|
+
tsconfig: (0, _stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
129
128
|
format: resolveFormat(context.config.output.format).filter(Boolean),
|
|
130
129
|
mode: context.config.mode,
|
|
131
130
|
treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
|
|
@@ -137,11 +136,11 @@ function resolveOptions(context) {
|
|
|
137
136
|
logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
138
137
|
customLogger: {
|
|
139
138
|
level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
140
|
-
info: (...msgs) => (0,
|
|
141
|
-
warn: (...msgs) => (0,
|
|
142
|
-
warnOnce: (...msgs) => (0,
|
|
143
|
-
error: (...msgs) => (0,
|
|
144
|
-
success: (...msgs) => (0,
|
|
139
|
+
info: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs)),
|
|
140
|
+
warn: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
141
|
+
warnOnce: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
142
|
+
error: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
|
|
143
|
+
success: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs))
|
|
145
144
|
}
|
|
146
145
|
}, DEFAULT_TSDOWN_CONFIG);
|
|
147
146
|
}
|
package/dist/types/build.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-
|
|
1
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-DVnbPLO-.cjs";
|
|
2
2
|
export { TsdownOptions, __ΩTsdownOptions };
|
package/dist/types/build.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-
|
|
1
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-0MluyGwY.mjs";
|
|
2
2
|
export { TsdownOptions, __ΩTsdownOptions };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-
|
|
2
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-
|
|
3
|
-
import "../index-B_e8BwCm.cjs";
|
|
1
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-DVnbPLO-.cjs";
|
|
2
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-DcuYkRNk.cjs";
|
|
4
3
|
export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-
|
|
2
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-
|
|
3
|
-
import "../index-2Ag-54t8.mjs";
|
|
1
|
+
import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-0MluyGwY.mjs";
|
|
2
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-T43KOEy-.mjs";
|
|
4
3
|
export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-
|
|
1
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-DcuYkRNk.cjs";
|
|
2
2
|
export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-CVc-l4XN.mjs";
|
|
1
|
+
import { a as __ΩTsdownPluginContext, c as __ΩTsdownPluginUserConfig, i as TsdownPluginUserConfig, n as TsdownPluginOptions, o as __ΩTsdownPluginOptions, r as TsdownPluginResolvedConfig, s as __ΩTsdownPluginResolvedConfig, t as TsdownPluginContext } from "../plugin-T43KOEy-.mjs";
|
|
3
2
|
export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as TsdownPluginContext } from "./plugin-T43KOEy-.mjs";
|
|
2
|
+
import * as rolldown from "rolldown";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown.Plugin<any> | rolldown.Plugin<any>[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createTsdownPlugin as t };
|
|
8
|
+
//# sourceMappingURL=unplugin-B4lJrjNj.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unplugin-B4lJrjNj.d.mts","names":[],"sources":["../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,kBAAA,CAAmB,OAAA,EAAS,mBAAA,GAAmB,QAAA,CAAA,MAAA,QAAA,QAAA,CAAA,MAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as TsdownPluginContext } from "./plugin-DcuYkRNk.cjs";
|
|
2
|
+
import * as rolldown from "rolldown";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown.Plugin<any> | rolldown.Plugin<any>[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createTsdownPlugin as t };
|
|
8
|
+
//# sourceMappingURL=unplugin-DycqcfwF.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unplugin-DycqcfwF.d.cts","names":[],"sources":["../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,kBAAA,CAAmB,OAAA,EAAS,mBAAA,GAAmB,QAAA,CAAA,MAAA,QAAA,QAAA,CAAA,MAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-tsdown",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.291",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": ["tsdown", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -40,30 +40,31 @@
|
|
|
40
40
|
],
|
|
41
41
|
"type": "module",
|
|
42
42
|
"exports": {
|
|
43
|
-
".": { "
|
|
43
|
+
".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
|
|
44
44
|
"./helpers": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"import": "./dist/helpers/index.mjs",
|
|
46
|
+
"require": "./dist/helpers/index.cjs"
|
|
47
47
|
},
|
|
48
48
|
"./helpers/resolve-options": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
49
|
+
"import": "./dist/helpers/resolve-options.mjs",
|
|
50
|
+
"require": "./dist/helpers/resolve-options.cjs"
|
|
51
51
|
},
|
|
52
52
|
"./helpers/unplugin": {
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"import": "./dist/helpers/unplugin.mjs",
|
|
54
|
+
"require": "./dist/helpers/unplugin.cjs"
|
|
55
55
|
},
|
|
56
|
+
"./resolve-options-zRmpZ1kt": "./dist/resolve-options-zRmpZ1kt.cjs",
|
|
56
57
|
"./types": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
58
|
+
"import": "./dist/types/index.mjs",
|
|
59
|
+
"require": "./dist/types/index.cjs"
|
|
59
60
|
},
|
|
60
61
|
"./types/build": {
|
|
61
|
-
"
|
|
62
|
-
"
|
|
62
|
+
"import": "./dist/types/build.mjs",
|
|
63
|
+
"require": "./dist/types/build.cjs"
|
|
63
64
|
},
|
|
64
65
|
"./types/plugin": {
|
|
65
|
-
"
|
|
66
|
-
"
|
|
66
|
+
"import": "./dist/types/plugin.mjs",
|
|
67
|
+
"require": "./dist/types/plugin.cjs"
|
|
67
68
|
},
|
|
68
69
|
"./*": "./*"
|
|
69
70
|
},
|
|
@@ -73,14 +74,15 @@
|
|
|
73
74
|
"typings": "dist/index.d.mts",
|
|
74
75
|
"files": ["dist/**/*"],
|
|
75
76
|
"dependencies": {
|
|
76
|
-
"@powerlines/core": "^0.
|
|
77
|
-
"@powerlines/plugin-rolldown": "^0.7.
|
|
77
|
+
"@powerlines/core": "^0.3.0",
|
|
78
|
+
"@powerlines/plugin-rolldown": "^0.7.348",
|
|
79
|
+
"@stryke/convert": "^0.6.53",
|
|
78
80
|
"defu": "^6.1.4",
|
|
79
81
|
"unplugin": "^3.0.0"
|
|
80
82
|
},
|
|
81
|
-
"devDependencies": { "@types/node": "^25.4.0", "tsdown": "^0.
|
|
82
|
-
"peerDependencies": { "tsdown": ">=0.
|
|
83
|
+
"devDependencies": { "@types/node": "^25.4.0", "tsdown": "^0.21.2" },
|
|
84
|
+
"peerDependencies": { "tsdown": ">=0.21.2" },
|
|
83
85
|
"peerDependenciesMeta": { "tsdown": { "optional": false } },
|
|
84
86
|
"publishConfig": { "access": "public" },
|
|
85
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "40d1f94407720be23c3801f9145fdad1fe27dfb2"
|
|
86
88
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-BOzEPSe_.d.cts","names":[],"sources":["../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,aAAA,GAAgB,QAC1B,KACE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-CB3pTpHV.d.mts","names":[],"sources":["../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,aAAA,GAAgB,QAC1B,KACE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-BW9ZnEXA.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAqBY,mBAAA,GAAsB,QAAQ;UAEzB,sBAAA,SAA+B;EAFpC,MAAA,CAAA,EAGD,mBAHoB;AAE/B;AAIiB,UAAA,0BAAA,SAAmC,cAAA,CAAA;EAIxC,MAAA,EAHF,aAGE;;AAER,KAFQ,mBAER,CAAA,wBADsB,0BACtB,GAAA,0BAAA,CAAA,GACA,aADA,CACc,eADd,CAAA;AACc,sCAAA,GAAA,EAAA;AAAd,yCAAA,GAAA,EAAA;AAAa,6CAAA,GAAA,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-CVc-l4XN.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAqBY,mBAAA,GAAsB,QAAQ;UAEzB,sBAAA,SAA+B;EAFpC,MAAA,CAAA,EAGD,mBAHoB;AAE/B;AAIiB,UAAA,0BAAA,SAAmC,cAAA,CAAA;EAIxC,MAAA,EAHF,aAGE;;AAER,KAFQ,mBAER,CAAA,wBADsB,0BACtB,GAAA,0BAAA,CAAA,GACA,aADA,CACc,eADd,CAAA;AACc,sCAAA,GAAA,EAAA;AAAd,yCAAA,GAAA,EAAA;AAAa,6CAAA,GAAA,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options-BPDOKwIe.d.mts","names":[],"sources":["../src/helpers/resolve-options.ts"],"sourcesContent":[],"mappings":";;;;;cAgCa,uBAAuB,QAAQ;;AAA5C;AAcA;;;;AAAwE,iBAAxD,aAAA,CAAwD,OAAA,CAAA,EAAhC,QAAgC,GAAvB,QAAuB,EAAA,CAAA,EAAZ,MAAY,EAAA;AAoBxE;;;;;AAmCA;iBAnCgB,iBAAA,WACJ,SAAe,WACxB;;;;;;;iBAiCa,cAAA,UAAwB,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options-BSwcMDS2.d.cts","names":[],"sources":["../src/helpers/resolve-options.ts"],"sourcesContent":[],"mappings":";;;;;cAgCa,uBAAuB,QAAQ;;AAA5C;AAcA;;;;AAAwE,iBAAxD,aAAA,CAAwD,OAAA,CAAA,EAAhC,MAAgC,GAAvB,MAAuB,EAAA,CAAA,EAAZ,QAAY,EAAA;AAoBxE;;;;;AAmCA;iBAnCgB,iBAAA,WACJ,WAAe,aACxB;;;;;;;iBAiCa,cAAA,UAAwB,UAAU"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
|
-
import { getDependencyConfig } from "@powerlines/core/plugin-utils";
|
|
3
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
4
|
-
import { appendPath } from "@stryke/path/append";
|
|
5
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
-
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
7
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
8
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
9
|
-
|
|
10
|
-
//#region src/helpers/resolve-options.ts
|
|
11
|
-
const DEFAULT_TSDOWN_CONFIG = {
|
|
12
|
-
platform: "neutral",
|
|
13
|
-
target: "esnext",
|
|
14
|
-
fixedExtension: true,
|
|
15
|
-
nodeProtocol: true,
|
|
16
|
-
clean: false
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
20
|
-
*
|
|
21
|
-
* @param formats - The formats to resolve.
|
|
22
|
-
* @returns The resolved entry options.
|
|
23
|
-
*/
|
|
24
|
-
function resolveFormat(formats) {
|
|
25
|
-
return toArray(formats).map((format) => {
|
|
26
|
-
switch (format) {
|
|
27
|
-
case "cjs": return "cjs";
|
|
28
|
-
case "iife": return "iife";
|
|
29
|
-
case "esm":
|
|
30
|
-
default: return "esm";
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
|
|
36
|
-
*
|
|
37
|
-
* @param formats - The formats to resolve.
|
|
38
|
-
* @returns The resolved entry options.
|
|
39
|
-
*/
|
|
40
|
-
function resolveFromFormat(formats) {
|
|
41
|
-
return toArray(formats).map((format) => {
|
|
42
|
-
switch (format) {
|
|
43
|
-
case "cjs":
|
|
44
|
-
case "commonjs": return "cjs";
|
|
45
|
-
case "iife": return "iife";
|
|
46
|
-
case "esm":
|
|
47
|
-
case "es":
|
|
48
|
-
case "module":
|
|
49
|
-
case "umd":
|
|
50
|
-
default: return "esm";
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "").trim();
|
|
55
|
-
/**
|
|
56
|
-
* Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
|
|
57
|
-
*
|
|
58
|
-
* @param context - The build context.
|
|
59
|
-
* @returns The resolved options.
|
|
60
|
-
*/
|
|
61
|
-
function resolveOptions(context) {
|
|
62
|
-
const { external, noExternal } = getDependencyConfig(context);
|
|
63
|
-
return defu({
|
|
64
|
-
entry: context.entry.filter((entry) => entry?.file).length > 0 ? Object.fromEntries(context.entry.filter((entry) => entry?.file).map((entry) => [entry.output || replaceExtension(replacePath(replacePath(entry.file, joinPaths(context.config.root, "src")), context.entryPath)), entry.file])) : [joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.ts"), joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, "src", "**/*.tsx")],
|
|
65
|
-
external,
|
|
66
|
-
noExternal,
|
|
67
|
-
alias: context.alias,
|
|
68
|
-
resolve: { alias: context.alias },
|
|
69
|
-
exports: context.config?.tsdown && context.config.tsdown?.exports ? defu(isSetObject(context.config.tsdown?.exports) ? context.config.tsdown?.exports : {}, { customExports: (exports) => {
|
|
70
|
-
const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
|
|
71
|
-
if (isSetString(value)) return [key, value];
|
|
72
|
-
const currentExport = {};
|
|
73
|
-
if (isSetString(value.require)) currentExport.require = {
|
|
74
|
-
types: replaceExtension(value.require, ".d.cts", { fullExtension: true }),
|
|
75
|
-
default: value.require
|
|
76
|
-
};
|
|
77
|
-
if (isSetString(value.import)) currentExport.import = {
|
|
78
|
-
types: replaceExtension(value.import, ".d.mts", { fullExtension: true }),
|
|
79
|
-
default: value.import
|
|
80
|
-
};
|
|
81
|
-
if (!isSetObject(value.default)) {
|
|
82
|
-
if (isSetObject(currentExport.import)) currentExport.default = currentExport.import;
|
|
83
|
-
else if (isSetObject(currentExport.require)) currentExport.default = currentExport.require;
|
|
84
|
-
}
|
|
85
|
-
return [key, currentExport];
|
|
86
|
-
}));
|
|
87
|
-
return Object.keys(result).sort().reduce((ret, key) => {
|
|
88
|
-
ret[key] = result[key];
|
|
89
|
-
return ret;
|
|
90
|
-
}, {});
|
|
91
|
-
} }) : void 0
|
|
92
|
-
}, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
|
|
93
|
-
name: context.config.name,
|
|
94
|
-
cwd: appendPath(context.config.root, context.workspaceConfig.workspaceRoot),
|
|
95
|
-
define: context.config.define,
|
|
96
|
-
inputOptions: { transform: { inject: context.config.inject } },
|
|
97
|
-
platform: context.config.platform,
|
|
98
|
-
dts: context.config.output.dts,
|
|
99
|
-
outDir: appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
100
|
-
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
101
|
-
format: resolveFormat(context.config.output.format).filter(Boolean),
|
|
102
|
-
mode: context.config.mode,
|
|
103
|
-
treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
|
|
104
|
-
minify: context.config.mode === "production",
|
|
105
|
-
metafile: context.config.mode === "development",
|
|
106
|
-
sourcemap: context.config.mode === "development",
|
|
107
|
-
debug: context.config.mode === "development",
|
|
108
|
-
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
109
|
-
logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
110
|
-
customLogger: {
|
|
111
|
-
level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
|
|
112
|
-
info: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs)),
|
|
113
|
-
warn: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
114
|
-
warnOnce: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
|
|
115
|
-
error: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
|
|
116
|
-
success: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs))
|
|
117
|
-
}
|
|
118
|
-
}, DEFAULT_TSDOWN_CONFIG);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
//#endregion
|
|
122
|
-
export { resolveOptions as i, resolveFormat as n, resolveFromFormat as r, DEFAULT_TSDOWN_CONFIG as t };
|
|
123
|
-
//# sourceMappingURL=resolve-options-DDaVMiLp.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options-DDaVMiLp.mjs","names":["DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions>"],"sources":["../src/helpers/resolve-options.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 } from \"@powerlines/core\";\nimport { getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport { RolldownPluginResolvedConfig } from \"@powerlines/plugin-rolldown/types/plugin\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport { TsdownPluginResolvedConfig } from \"../types/plugin\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n nodeProtocol: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n external,\n noExternal,\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n exports:\n (context.config as TsdownPluginResolvedConfig)?.tsdown &&\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n ? defu(\n isSetObject(\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n )\n ? (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n : {},\n {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n }\n )\n : undefined\n },\n (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown\n : {},\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? {\n inputOptions: (context.config as RolldownPluginResolvedConfig)\n ?.rolldown\n }\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n define: context.config.define,\n inputOptions: {\n transform: {\n inject: context.config.inject\n }\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake: (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown?.treeshake\n : undefined,\n minify: context.config.mode === \"production\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_TSDOWN_CONFIG\n ) as BuildOptions;\n}\n"],"mappings":";;;;;;;;;;AAgCA,MAAaA,wBAA+C;CAC1D,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,cAAc;CACd,OAAO;CACR;;;;;;;AAQD,SAAgB,cAAc,SAA6C;AACzE,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AACpC,UAAQ,QAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,OACH,QAAO;GACT,KAAK;GACL,QACE,QAAO;;GAEX;;;;;;;;AASJ,SAAgB,kBACd,SACU;AACV,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AACpC,UAAQ,QAAR;GACE,KAAK;GACL,KAAK,WACH,QAAO;GACT,KAAK,OACH,QAAO;GACT,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,QACE,QAAO;;GAEX;;AAGJ,MAAM,iBAAiB,SAAkB,GAAG,SAC1C,KACG,OAAO,QAAQ,CACf,KAAK,IAAI,CACT,QA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,cAAc;GACZ,OACE,QAAQ,OAAO,aAAa,UACxB,UACA,QAAQ,OAAO;GACrB,OAAO,GAAG,SACR,YAAY,cAAc,SAAS,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,MAAM,cAAc,SAAS,GAAG,KAAK,CAAC;GAChD,OAAO,GAAG,SACR,YAAY,cAAc,SAAS,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,KAAK,cAAc,SAAS,GAAG,KAAK,CAAC;GAC/C,WAAW,GAAG,SACZ,YAAY,cAAc,SAAS,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,KAAK,cAAc,SAAS,GAAG,KAAK,CAAC;GAC/C,QAAQ,GAAG,SACT,YAAY,cAAc,SAAS,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,MAAM,cAAc,SAAS,GAAG,KAAK,CAAC;GAChD,UAAU,GAAG,SACX,YAAY,cAAc,SAAS,GAAG,KAAK,CAAC,QAAQ,QAAQ,GAAG,CAAC,IAChE,QAAQ,MAAM,cAAc,SAAS,GAAG,KAAK,CAAC;GACjD;EACF,EACD,sBACD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { t as TsdownPluginContext } from "./plugin-CVc-l4XN.mjs";
|
|
2
|
-
import * as rolldown0 from "rolldown";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown0.Plugin<any> | rolldown0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createTsdownPlugin as t };
|
|
8
|
-
//# sourceMappingURL=unplugin-BEyzw6Dm.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin-BEyzw6Dm.d.mts","names":[],"sources":["../src/helpers/unplugin.ts"],"sourcesContent":[],"mappings":";;;;iBAsBgB,kBAAA,UAA4B,sBAAmB,SAAA,CAAA,cAAA,SAAA,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { t as TsdownPluginContext } from "./plugin-BW9ZnEXA.cjs";
|
|
2
|
-
import * as rolldown0 from "rolldown";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createTsdownPlugin(context: TsdownPluginContext): rolldown0.Plugin<any> | rolldown0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createTsdownPlugin as t };
|
|
8
|
-
//# sourceMappingURL=unplugin-SEtpQs16.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin-SEtpQs16.d.cts","names":[],"sources":["../src/helpers/unplugin.ts"],"sourcesContent":[],"mappings":";;;;iBAsBgB,kBAAA,UAA4B,sBAAmB,SAAA,CAAA,cAAA,SAAA,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const require_resolve_options = require('./resolve-options-DTgEZjex.cjs');
|
|
2
|
-
let __powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
3
|
-
let unplugin = require("unplugin");
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/unplugin.ts
|
|
6
|
-
function createTsdownPlugin(context) {
|
|
7
|
-
return (0, unplugin.createRolldownPlugin)((0, __powerlines_core_lib_unplugin.createUnplugin)(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
Object.defineProperty(exports, 'createTsdownPlugin', {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () {
|
|
14
|
-
return createTsdownPlugin;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createUnplugin } from "@powerlines/core/lib/unplugin";
|
|
2
|
-
import { createRolldownPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.ts
|
|
5
|
-
function createTsdownPlugin(context) {
|
|
6
|
-
return createRolldownPlugin(createUnplugin(context))({});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { createTsdownPlugin as t };
|
|
11
|
-
//# sourceMappingURL=unplugin-kYkLMXDM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin-kYkLMXDM.mjs","names":[],"sources":["../src/helpers/unplugin.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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { TsdownPluginContext } from \"../types/plugin\";\n\nexport function createTsdownPlugin(context: TsdownPluginContext) {\n return createRolldownPlugin(createUnplugin(context))({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,mBAAmB,SAA8B;AAC/D,QAAO,qBAAqB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC"}
|