@powerlines/plugin-tsdown 0.1.311 → 0.1.313

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.
Files changed (43) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/helpers/index.cjs +9 -0
  3. package/dist/helpers/index.d.cts +3 -0
  4. package/dist/helpers/index.d.mts +3 -0
  5. package/dist/helpers/index.mjs +4 -0
  6. package/dist/helpers/resolve-options.cjs +134 -0
  7. package/dist/helpers/resolve-options.d.cts +30 -0
  8. package/dist/helpers/resolve-options.d.cts.map +1 -0
  9. package/dist/helpers/resolve-options.d.mts +30 -0
  10. package/dist/helpers/resolve-options.d.mts.map +1 -0
  11. package/dist/helpers/resolve-options.mjs +129 -0
  12. package/dist/helpers/resolve-options.mjs.map +1 -0
  13. package/dist/helpers/unplugin.cjs +12 -0
  14. package/dist/helpers/unplugin.d.cts +8 -0
  15. package/dist/helpers/unplugin.d.cts.map +1 -0
  16. package/dist/helpers/unplugin.d.mts +8 -0
  17. package/dist/helpers/unplugin.d.mts.map +1 -0
  18. package/dist/helpers/unplugin.mjs +11 -0
  19. package/dist/helpers/unplugin.mjs.map +1 -0
  20. package/dist/index.cjs +43 -0
  21. package/dist/index.d.cts +19 -0
  22. package/dist/index.d.cts.map +1 -0
  23. package/dist/index.d.mts +19 -0
  24. package/dist/index.d.mts.map +1 -0
  25. package/dist/index.mjs +35 -0
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/types/build.cjs +0 -0
  28. package/dist/types/build.d.cts +8 -0
  29. package/dist/types/build.d.cts.map +1 -0
  30. package/dist/types/build.d.mts +8 -0
  31. package/dist/types/build.d.mts.map +1 -0
  32. package/dist/types/build.mjs +1 -0
  33. package/dist/types/index.cjs +0 -0
  34. package/dist/types/index.d.cts +3 -0
  35. package/dist/types/index.d.mts +3 -0
  36. package/dist/types/index.mjs +1 -0
  37. package/dist/types/plugin.cjs +0 -0
  38. package/dist/types/plugin.d.cts +19 -0
  39. package/dist/types/plugin.d.cts.map +1 -0
  40. package/dist/types/plugin.d.mts +19 -0
  41. package/dist/types/plugin.d.mts.map +1 -0
  42. package/dist/types/plugin.mjs +1 -0
  43. package/package.json +4 -4
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_helpers_resolve_options = require('./resolve-options.cjs');
3
+ const require_helpers_unplugin = require('./unplugin.cjs');
4
+
5
+ exports.DEFAULT_TSDOWN_CONFIG = require_helpers_resolve_options.DEFAULT_TSDOWN_CONFIG;
6
+ exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
7
+ exports.resolveFormat = require_helpers_resolve_options.resolveFormat;
8
+ exports.resolveFromFormat = require_helpers_resolve_options.resolveFromFormat;
9
+ exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
@@ -0,0 +1,3 @@
1
+ import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.cjs";
2
+ import { createTsdownPlugin } from "./unplugin.cjs";
3
+ export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
@@ -0,0 +1,3 @@
1
+ import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.mjs";
2
+ import { createTsdownPlugin } from "./unplugin.mjs";
3
+ export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
@@ -0,0 +1,4 @@
1
+ import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.mjs";
2
+ import { createTsdownPlugin } from "./unplugin.mjs";
3
+
4
+ export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, resolveFormat, resolveFromFormat, resolveOptions };
@@ -0,0 +1,134 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let defu = require("defu");
4
+ defu = require_runtime.__toESM(defu);
5
+ let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
6
+ let _stryke_convert_to_array = require("@stryke/convert/to-array");
7
+ let _stryke_path_append = require("@stryke/path/append");
8
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
9
+ let _stryke_path_replace = require("@stryke/path/replace");
10
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
11
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
12
+
13
+ //#region src/helpers/resolve-options.ts
14
+ const DEFAULT_TSDOWN_CONFIG = {
15
+ platform: "neutral",
16
+ target: "esnext",
17
+ fixedExtension: true,
18
+ nodeProtocol: true,
19
+ clean: false
20
+ };
21
+ /**
22
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
23
+ *
24
+ * @param formats - The formats to resolve.
25
+ * @returns The resolved entry options.
26
+ */
27
+ function resolveFormat(formats) {
28
+ return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
29
+ switch (format) {
30
+ case "cjs": return "cjs";
31
+ case "iife": return "iife";
32
+ default: return "esm";
33
+ }
34
+ });
35
+ }
36
+ /**
37
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
38
+ *
39
+ * @param formats - The formats to resolve.
40
+ * @returns The resolved entry options.
41
+ */
42
+ function resolveFromFormat(formats) {
43
+ return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
44
+ switch (format) {
45
+ case "cjs":
46
+ case "commonjs": return "cjs";
47
+ case "iife": return "iife";
48
+ default: return "esm";
49
+ }
50
+ });
51
+ }
52
+ const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "").trim();
53
+ /**
54
+ * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
55
+ *
56
+ * @param context - The build context.
57
+ * @returns The resolved options.
58
+ */
59
+ function resolveOptions(context) {
60
+ const { external, noExternal } = (0, _powerlines_core_plugin_utils.getDependencyConfig)(context);
61
+ return (0, defu.default)({
62
+ 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")],
63
+ 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) => {
64
+ const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
65
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(value)) return [key, value];
66
+ const currentExport = {};
67
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(value.require)) currentExport.require = {
68
+ types: (0, _stryke_path_replace.replaceExtension)(value.require, ".d.cts", { fullExtension: true }),
69
+ default: value.require
70
+ };
71
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(value.import)) currentExport.import = {
72
+ types: (0, _stryke_path_replace.replaceExtension)(value.import, ".d.mts", { fullExtension: true }),
73
+ default: value.import
74
+ };
75
+ if (!(0, _stryke_type_checks_is_set_object.isSetObject)(value.default)) {
76
+ if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.import)) currentExport.default = currentExport.import;
77
+ else if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.require)) currentExport.default = currentExport.require;
78
+ }
79
+ return [key, currentExport];
80
+ }));
81
+ return Object.keys(result).sort().reduce((ret, key) => {
82
+ ret[key] = result[key];
83
+ return ret;
84
+ }, {});
85
+ } }) : void 0
86
+ }, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
87
+ name: context.config.name,
88
+ cwd: (0, _stryke_path_append.appendPath)(context.config.root, context.workspaceConfig.workspaceRoot),
89
+ define: context.config.define,
90
+ inputOptions: { transform: {
91
+ define: context.config.define,
92
+ inject: context.config.inject,
93
+ typescript: {
94
+ onlyRemoveTypeImports: context.tsconfig.options.verbatimModuleSyntax ? true : void 0,
95
+ target: context.tsconfig.options.target
96
+ }
97
+ } },
98
+ deps: {
99
+ neverBundle: external,
100
+ alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
101
+ onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
102
+ skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
103
+ },
104
+ alias: context.alias,
105
+ resolve: { alias: context.alias },
106
+ platform: context.config.platform,
107
+ dts: context.config.output.dts,
108
+ outDir: (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot),
109
+ tsconfig: (0, _stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
110
+ format: resolveFormat(context.config.output.format).filter(Boolean),
111
+ mode: context.config.mode,
112
+ treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
113
+ minify: context.config.mode === "production",
114
+ metafile: context.config.mode === "development",
115
+ sourcemap: context.config.mode === "development",
116
+ debug: context.config.mode === "development",
117
+ silent: context.config.logLevel === null || context.config.mode === "production",
118
+ logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
119
+ customLogger: {
120
+ level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
121
+ info: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs)),
122
+ warn: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
123
+ warnOnce: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
124
+ error: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
125
+ success: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs))
126
+ }
127
+ }, DEFAULT_TSDOWN_CONFIG);
128
+ }
129
+
130
+ //#endregion
131
+ exports.DEFAULT_TSDOWN_CONFIG = DEFAULT_TSDOWN_CONFIG;
132
+ exports.resolveFormat = resolveFormat;
133
+ exports.resolveFromFormat = resolveFromFormat;
134
+ exports.resolveOptions = resolveOptions;
@@ -0,0 +1,30 @@
1
+ import { Context } from "@powerlines/core";
2
+ import { Format } from "@storm-software/build-tools/types";
3
+ import { Format as Format$1, UserConfig as UserConfig$1 } from "tsdown";
4
+
5
+ //#region src/helpers/resolve-options.d.ts
6
+ declare const DEFAULT_TSDOWN_CONFIG: Partial<UserConfig$1>;
7
+ /**
8
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
9
+ *
10
+ * @param formats - The formats to resolve.
11
+ * @returns The resolved entry options.
12
+ */
13
+ declare function resolveFormat(formats?: Format | Format[]): Format$1[];
14
+ /**
15
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
16
+ *
17
+ * @param formats - The formats to resolve.
18
+ * @returns The resolved entry options.
19
+ */
20
+ declare function resolveFromFormat(formats?: Format$1 | Format$1[]): Format[];
21
+ /**
22
+ * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
23
+ *
24
+ * @param context - The build context.
25
+ * @returns The resolved options.
26
+ */
27
+ declare function resolveOptions(context: Context): UserConfig$1;
28
+ //#endregion
29
+ export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
30
+ //# sourceMappingURL=resolve-options.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.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"}
@@ -0,0 +1,30 @@
1
+ import { Format, UserConfig } from "tsdown";
2
+ import { Context } from "@powerlines/core";
3
+ import { Format as Format$1 } from "@storm-software/build-tools/types";
4
+
5
+ //#region src/helpers/resolve-options.d.ts
6
+ declare const DEFAULT_TSDOWN_CONFIG: Partial<UserConfig>;
7
+ /**
8
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
9
+ *
10
+ * @param formats - The formats to resolve.
11
+ * @returns The resolved entry options.
12
+ */
13
+ declare function resolveFormat(formats?: Format$1 | Format$1[]): Format[];
14
+ /**
15
+ * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
16
+ *
17
+ * @param formats - The formats to resolve.
18
+ * @returns The resolved entry options.
19
+ */
20
+ declare function resolveFromFormat(formats?: Format | Format[]): Format$1[];
21
+ /**
22
+ * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
23
+ *
24
+ * @param context - The build context.
25
+ * @returns The resolved options.
26
+ */
27
+ declare function resolveOptions(context: Context): UserConfig;
28
+ //#endregion
29
+ export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
30
+ //# sourceMappingURL=resolve-options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.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"}
@@ -0,0 +1,129 @@
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
+ 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
+ exports: context.config?.tsdown && context.config.tsdown?.exports ? defu(isSetObject(context.config.tsdown?.exports) ? context.config.tsdown?.exports : {}, { customExports: (exports) => {
61
+ const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
62
+ if (isSetString(value)) return [key, value];
63
+ const currentExport = {};
64
+ if (isSetString(value.require)) currentExport.require = {
65
+ types: replaceExtension(value.require, ".d.cts", { fullExtension: true }),
66
+ default: value.require
67
+ };
68
+ if (isSetString(value.import)) currentExport.import = {
69
+ types: replaceExtension(value.import, ".d.mts", { fullExtension: true }),
70
+ default: value.import
71
+ };
72
+ if (!isSetObject(value.default)) {
73
+ if (isSetObject(currentExport.import)) currentExport.default = currentExport.import;
74
+ else if (isSetObject(currentExport.require)) currentExport.default = currentExport.require;
75
+ }
76
+ return [key, currentExport];
77
+ }));
78
+ return Object.keys(result).sort().reduce((ret, key) => {
79
+ ret[key] = result[key];
80
+ return ret;
81
+ }, {});
82
+ } }) : void 0
83
+ }, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
84
+ name: context.config.name,
85
+ cwd: appendPath(context.config.root, context.workspaceConfig.workspaceRoot),
86
+ define: context.config.define,
87
+ inputOptions: { transform: {
88
+ define: context.config.define,
89
+ inject: context.config.inject,
90
+ typescript: {
91
+ onlyRemoveTypeImports: context.tsconfig.options.verbatimModuleSyntax ? true : void 0,
92
+ target: context.tsconfig.options.target
93
+ }
94
+ } },
95
+ deps: {
96
+ neverBundle: external,
97
+ alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
98
+ onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
99
+ skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
100
+ },
101
+ alias: context.alias,
102
+ resolve: { alias: context.alias },
103
+ platform: context.config.platform,
104
+ dts: context.config.output.dts,
105
+ outDir: appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot),
106
+ tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
107
+ format: resolveFormat(context.config.output.format).filter(Boolean),
108
+ mode: context.config.mode,
109
+ treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
110
+ minify: context.config.mode === "production",
111
+ metafile: context.config.mode === "development",
112
+ sourcemap: context.config.mode === "development",
113
+ debug: context.config.mode === "development",
114
+ silent: context.config.logLevel === null || context.config.mode === "production",
115
+ logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
116
+ customLogger: {
117
+ level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
118
+ info: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs)),
119
+ warn: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
120
+ warnOnce: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
121
+ error: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
122
+ success: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.debug(formatMessage(context, ...msgs))
123
+ }
124
+ }, DEFAULT_TSDOWN_CONFIG);
125
+ }
126
+
127
+ //#endregion
128
+ export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
129
+ //# 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 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 define: context.config.define,\n inject: context.config.inject,\n typescript: {\n onlyRemoveTypeImports: context.tsconfig.options.verbatimModuleSyntax\n ? true\n : undefined,\n target: context.tsconfig.options.target\n }\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 platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: appendPath(\n context.config.output.path,\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":"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"}
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
4
+ let unplugin = require("unplugin");
5
+
6
+ //#region src/helpers/unplugin.ts
7
+ function createTsdownPlugin(context) {
8
+ return (0, unplugin.createRolldownPlugin)((0, _powerlines_core_lib_unplugin.createUnplugin)(context, { name: "tsdown" }))({});
9
+ }
10
+
11
+ //#endregion
12
+ exports.createTsdownPlugin = createTsdownPlugin;
@@ -0,0 +1,8 @@
1
+ import { TsdownPluginContext } from "../types/plugin.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 };
8
+ //# sourceMappingURL=unplugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unplugin.d.cts","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 { TsdownPluginContext } from "../types/plugin.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 };
8
+ //# sourceMappingURL=unplugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unplugin.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,11 @@
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, { name: "tsdown" }))({});
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, { name: \"tsdown\" }))({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,mBAAmB,SAA8B;AAC/D,QAAO,qBAAqB,eAAe,SAAS,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,43 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
4
+ const require_helpers_unplugin = require('./helpers/unplugin.cjs');
5
+ require('./helpers/index.cjs');
6
+ let _powerlines_core_plugin_utils_format_package_json = require("@powerlines/core/plugin-utils/format-package-json");
7
+ let defu = require("defu");
8
+ defu = require_runtime.__toESM(defu);
9
+ let tsdown = require("tsdown");
10
+
11
+ //#region src/index.ts
12
+ /**
13
+ * A Powerlines plugin to use Tsdown to build the project.
14
+ */
15
+ const plugin = (options = {}) => {
16
+ return {
17
+ name: "tsdown",
18
+ config() {
19
+ this.trace("Providing default configuration for the Powerlines `tsdown` build plugin.");
20
+ return {
21
+ output: { format: ["cjs", "esm"] },
22
+ tsdown: { ...options }
23
+ };
24
+ },
25
+ async build() {
26
+ this.trace("Starting Tsdown build process...");
27
+ await (0, tsdown.build)((0, defu.default)({
28
+ config: false,
29
+ plugins: require_helpers_unplugin.createTsdownPlugin(this)
30
+ }, require_helpers_resolve_options.resolveOptions(this)));
31
+ await (0, _powerlines_core_plugin_utils_format_package_json.formatPackageJson)(this);
32
+ }
33
+ };
34
+ };
35
+
36
+ //#endregion
37
+ exports.DEFAULT_TSDOWN_CONFIG = require_helpers_resolve_options.DEFAULT_TSDOWN_CONFIG;
38
+ exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
39
+ exports.default = plugin;
40
+ exports.plugin = plugin;
41
+ exports.resolveFormat = require_helpers_resolve_options.resolveFormat;
42
+ exports.resolveFromFormat = require_helpers_resolve_options.resolveFromFormat;
43
+ exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
@@ -0,0 +1,19 @@
1
+ import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.cjs";
2
+ import { TsdownOptions, __ΩTsdownOptions } from "./types/build.cjs";
3
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.cjs";
4
+ import { createTsdownPlugin } from "./helpers/unplugin.cjs";
5
+ import { Plugin } from "@powerlines/core";
6
+
7
+ //#region src/index.d.ts
8
+ declare module "@powerlines/core" {
9
+ interface Config {
10
+ tsdown?: TsdownPluginOptions;
11
+ }
12
+ }
13
+ /**
14
+ * A Powerlines plugin to use Tsdown to build the project.
15
+ */
16
+ declare const plugin: <TContext extends TsdownPluginContext = TsdownPluginContext>(options?: TsdownPluginOptions) => Plugin<TContext>;
17
+ //#endregion
18
+ export { DEFAULT_TSDOWN_CONFIG, TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, createTsdownPlugin, plugin as default, plugin, resolveFormat, resolveFromFormat, resolveOptions };
19
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YAkCY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;AAJgB;;;AAAA,cAWhB,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
@@ -0,0 +1,19 @@
1
+ import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.mjs";
2
+ import { TsdownOptions, __ΩTsdownOptions } from "./types/build.mjs";
3
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.mjs";
4
+ import { createTsdownPlugin } from "./helpers/unplugin.mjs";
5
+ import { Plugin } from "@powerlines/core";
6
+
7
+ //#region src/index.d.ts
8
+ declare module "@powerlines/core" {
9
+ interface Config {
10
+ tsdown?: TsdownPluginOptions;
11
+ }
12
+ }
13
+ /**
14
+ * A Powerlines plugin to use Tsdown to build the project.
15
+ */
16
+ declare const plugin: <TContext extends TsdownPluginContext = TsdownPluginContext>(options?: TsdownPluginOptions) => Plugin<TContext>;
17
+ //#endregion
18
+ export { DEFAULT_TSDOWN_CONFIG, TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, createTsdownPlugin, plugin as default, plugin, resolveFormat, resolveFromFormat, resolveOptions };
19
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YAkCY,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 ADDED
@@ -0,0 +1,35 @@
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 { formatPackageJson } from "@powerlines/core/plugin-utils/format-package-json";
5
+ import defu from "defu";
6
+ import { build } from "tsdown";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * A Powerlines plugin to use Tsdown to build the project.
11
+ */
12
+ const plugin = (options = {}) => {
13
+ return {
14
+ name: "tsdown",
15
+ config() {
16
+ this.trace("Providing default configuration for the Powerlines `tsdown` build plugin.");
17
+ return {
18
+ output: { format: ["cjs", "esm"] },
19
+ tsdown: { ...options }
20
+ };
21
+ },
22
+ async build() {
23
+ this.trace("Starting Tsdown build process...");
24
+ await build(defu({
25
+ config: false,
26
+ plugins: createTsdownPlugin(this)
27
+ }, resolveOptions(this)));
28
+ await formatPackageJson(this);
29
+ }
30
+ };
31
+ };
32
+
33
+ //#endregion
34
+ export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, plugin as default, plugin, resolveFormat, resolveFromFormat, resolveOptions };
35
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +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: createTsdownPlugin(this)\n },\n resolveOptions(this)\n )\n );\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AA0CA,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,mBAAmB,KAAK;IAClC,EACD,eAAe,KAAK,CACrB,CACF;AAED,SAAM,kBAAkB,KAAK;;EAEhC"}
File without changes
@@ -0,0 +1,8 @@
1
+ import { UserConfig } from "tsdown";
2
+
3
+ //#region src/types/build.d.ts
4
+ type TsdownOptions = Partial<Omit<UserConfig, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">>;
5
+ declare type __ΩTsdownOptions = any[];
6
+ //#endregion
7
+ export { TsdownOptions, __ΩTsdownOptions };
8
+ //# sourceMappingURL=build.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
@@ -0,0 +1,8 @@
1
+ import { UserConfig } from "tsdown";
2
+
3
+ //#region src/types/build.d.ts
4
+ type TsdownOptions = Partial<Omit<UserConfig, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">>;
5
+ declare type __ΩTsdownOptions = any[];
6
+ //#endregion
7
+ export { TsdownOptions, __ΩTsdownOptions };
8
+ //# sourceMappingURL=build.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
@@ -0,0 +1 @@
1
+ export { };
File without changes
@@ -0,0 +1,3 @@
1
+ import { TsdownOptions, __ΩTsdownOptions } from "./build.cjs";
2
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./plugin.cjs";
3
+ export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
@@ -0,0 +1,3 @@
1
+ import { TsdownOptions, __ΩTsdownOptions } from "./build.mjs";
2
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./plugin.mjs";
3
+ export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
@@ -0,0 +1 @@
1
+ export { };
File without changes
@@ -0,0 +1,19 @@
1
+ import { TsdownOptions } from "./build.cjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
+
4
+ //#region src/types/plugin.d.ts
5
+ type TsdownPluginOptions = Partial<TsdownOptions>;
6
+ interface TsdownPluginUserConfig extends UserConfig {
7
+ tsdown?: TsdownPluginOptions;
8
+ }
9
+ interface TsdownPluginResolvedConfig extends ResolvedConfig {
10
+ tsdown: TsdownOptions;
11
+ }
12
+ type TsdownPluginContext<TResolvedConfig extends TsdownPluginResolvedConfig = TsdownPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
+ declare type __ΩTsdownPluginOptions = any[];
14
+ declare type __ΩTsdownPluginUserConfig = any[];
15
+ declare type __ΩTsdownPluginResolvedConfig = any[];
16
+ declare type __ΩTsdownPluginContext = any[];
17
+ //#endregion
18
+ export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
19
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.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"}
@@ -0,0 +1,19 @@
1
+ import { TsdownOptions } from "./build.mjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
+
4
+ //#region src/types/plugin.d.ts
5
+ type TsdownPluginOptions = Partial<TsdownOptions>;
6
+ interface TsdownPluginUserConfig extends UserConfig {
7
+ tsdown?: TsdownPluginOptions;
8
+ }
9
+ interface TsdownPluginResolvedConfig extends ResolvedConfig {
10
+ tsdown: TsdownOptions;
11
+ }
12
+ type TsdownPluginContext<TResolvedConfig extends TsdownPluginResolvedConfig = TsdownPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
+ declare type __ΩTsdownPluginOptions = any[];
14
+ declare type __ΩTsdownPluginUserConfig = any[];
15
+ declare type __ΩTsdownPluginResolvedConfig = any[];
16
+ declare type __ΩTsdownPluginContext = any[];
17
+ //#endregion
18
+ export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
19
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.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"}
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-tsdown",
3
- "version": "0.1.311",
3
+ "version": "0.1.313",
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"],
@@ -73,8 +73,8 @@
73
73
  "typings": "dist/index.d.mts",
74
74
  "files": ["dist/**/*"],
75
75
  "dependencies": {
76
- "@powerlines/core": "^0.7.0",
77
- "@powerlines/plugin-rolldown": "^0.7.368",
76
+ "@powerlines/core": "^0.8.1",
77
+ "@powerlines/plugin-rolldown": "^0.7.370",
78
78
  "@stryke/convert": "^0.6.56",
79
79
  "defu": "^6.1.4",
80
80
  "unplugin": "^3.0.0"
@@ -83,5 +83,5 @@
83
83
  "peerDependencies": { "tsdown": ">=0.21.2" },
84
84
  "peerDependenciesMeta": { "tsdown": { "optional": false } },
85
85
  "publishConfig": { "access": "public" },
86
- "gitHead": "c3243c1ec0fbacb4afd4bd3db20432f443334076"
86
+ "gitHead": "af94c1952c9f2d293dac72a2d0ed3627be8d807d"
87
87
  }