@powerlines/plugin-tsdown 0.1.406 → 0.1.409

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 (50) hide show
  1. package/dist/build-CFHXlkSV.d.mts +8 -0
  2. package/dist/build-CFHXlkSV.d.mts.map +1 -0
  3. package/dist/build-DGSkbjen.d.cts +8 -0
  4. package/dist/build-DGSkbjen.d.cts.map +1 -0
  5. package/dist/index.cjs +40 -16
  6. package/dist/index.d.cts +3 -6
  7. package/dist/index.d.cts.map +1 -1
  8. package/dist/index.d.mts +3 -6
  9. package/dist/index.d.mts.map +1 -1
  10. package/dist/index.mjs +12 -8
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/types/build.d.cts +2 -8
  13. package/dist/types/build.d.mts +2 -8
  14. package/dist/types/index.cjs +2 -0
  15. package/dist/types/index.d.cts +3 -3
  16. package/dist/types/index.d.mts +3 -3
  17. package/dist/types/index.mjs +3 -0
  18. package/dist/types/plugin.d.cts +3 -5
  19. package/dist/types/plugin.d.cts.map +1 -1
  20. package/dist/types/plugin.d.mts +3 -5
  21. package/dist/types/plugin.d.mts.map +1 -1
  22. package/package.json +11 -11
  23. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  24. package/dist/helpers/build-helpers.cjs +0 -23
  25. package/dist/helpers/build-helpers.d.cts +0 -14
  26. package/dist/helpers/build-helpers.d.cts.map +0 -1
  27. package/dist/helpers/build-helpers.d.mts +0 -14
  28. package/dist/helpers/build-helpers.d.mts.map +0 -1
  29. package/dist/helpers/build-helpers.mjs +0 -22
  30. package/dist/helpers/build-helpers.mjs.map +0 -1
  31. package/dist/helpers/index.cjs +0 -11
  32. package/dist/helpers/index.d.cts +0 -4
  33. package/dist/helpers/index.d.mts +0 -4
  34. package/dist/helpers/index.mjs +0 -5
  35. package/dist/helpers/resolve-options.cjs +0 -132
  36. package/dist/helpers/resolve-options.d.cts +0 -30
  37. package/dist/helpers/resolve-options.d.cts.map +0 -1
  38. package/dist/helpers/resolve-options.d.mts +0 -30
  39. package/dist/helpers/resolve-options.d.mts.map +0 -1
  40. package/dist/helpers/resolve-options.mjs +0 -127
  41. package/dist/helpers/resolve-options.mjs.map +0 -1
  42. package/dist/helpers/unplugin.cjs +0 -18
  43. package/dist/helpers/unplugin.d.cts +0 -8
  44. package/dist/helpers/unplugin.d.cts.map +0 -1
  45. package/dist/helpers/unplugin.d.mts +0 -8
  46. package/dist/helpers/unplugin.d.mts.map +0 -1
  47. package/dist/helpers/unplugin.mjs +0 -17
  48. package/dist/helpers/unplugin.mjs.map +0 -1
  49. package/dist/types/build.d.cts.map +0 -1
  50. package/dist/types/build.d.mts.map +0 -1
@@ -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 as n, TsdownOptions as t };
8
+ //# sourceMappingURL=build-CFHXlkSV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-CFHXlkSV.d.mts","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 as n, TsdownOptions as t };
8
+ //# sourceMappingURL=build-DGSkbjen.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-DGSkbjen.d.cts","names":[],"sources":["../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
package/dist/index.cjs CHANGED
@@ -1,14 +1,39 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_helpers_build_helpers = require('./helpers/build-helpers.cjs');
4
- const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
5
- const require_helpers_unplugin = require('./helpers/unplugin.cjs');
6
- require('./helpers/index.cjs');
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ let _powerlines_core = require("@powerlines/core");
7
30
  let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
8
31
  let _powerlines_core_plugin_utils_format_package_json = require("@powerlines/core/plugin-utils/format-package-json");
32
+ let _powerlines_unplugin_tsdown = require("@powerlines/unplugin/tsdown");
9
33
  let defu = require("defu");
10
- defu = require_runtime.__toESM(defu, 1);
34
+ defu = __toESM(defu, 1);
11
35
  let tsdown = require("tsdown");
36
+ let unplugin = require("unplugin");
12
37
 
13
38
  //#region src/index.ts
14
39
  /**
@@ -31,10 +56,15 @@ const plugin = (options = {}) => {
31
56
  },
32
57
  async build() {
33
58
  this.debug("Starting Tsdown build process...");
34
- const options = (0, defu.default)({
59
+ const resolved = (0, _powerlines_unplugin_tsdown.resolveOptions)(this);
60
+ const options = (0, defu.default)(this.config.tsdown, {
61
+ ...resolved,
35
62
  config: false,
36
- plugins: require_helpers_unplugin.createTsdownPlugin(this)
37
- }, require_helpers_resolve_options.resolveOptions(this));
63
+ plugins: [(0, unplugin.createRolldownPlugin)((0, _powerlines_core.createUnplugin)(this, {
64
+ silenceHookLogging: true,
65
+ name: "tsdown"
66
+ }))()]
67
+ });
38
68
  this.debug({
39
69
  meta: { category: "config" },
40
70
  message: `Resolved Tsdown configuration: \n${(0, _powerlines_core_plugin_utils.formatConfig)(options)}`
@@ -46,11 +76,5 @@ const plugin = (options = {}) => {
46
76
  };
47
77
 
48
78
  //#endregion
49
- exports.DEFAULT_TSDOWN_CONFIG = require_helpers_resolve_options.DEFAULT_TSDOWN_CONFIG;
50
- exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
51
79
  exports.default = plugin;
52
- exports.plugin = plugin;
53
- exports.getDependencyConfig = require_helpers_build_helpers.getDependencyConfig;
54
- exports.resolveFormat = require_helpers_resolve_options.resolveFormat;
55
- exports.resolveFromFormat = require_helpers_resolve_options.resolveFromFormat;
56
- exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
80
+ exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,5 @@
1
- import { getDependencyConfig } from "./helpers/build-helpers.cjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.cjs";
3
- import { TsdownOptions, __ΩTsdownOptions } from "./types/build.cjs";
4
- import { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.cjs";
5
- import { createTsdownPlugin } from "./helpers/unplugin.cjs";
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-DGSkbjen.cjs";
2
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.cjs";
6
3
  import { Plugin } from "@powerlines/core";
7
4
 
8
5
  //#region src/index.d.ts
@@ -16,5 +13,5 @@ declare module "@powerlines/core" {
16
13
  */
17
14
  declare const plugin: <TContext extends TsdownPluginContext = TsdownPluginContext>(options?: TsdownPluginOptions) => Plugin<TContext>;
18
15
  //#endregion
19
- export { DEFAULT_TSDOWN_CONFIG, TsdownOptions, TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, createTsdownPlugin, plugin as default, plugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
16
+ export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, plugin as default, plugin };
20
17
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;YA+BY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;AAJgB;;cAWhB,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YA8BY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;;;cAOA,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.d.mts CHANGED
@@ -1,8 +1,5 @@
1
- import { getDependencyConfig } from "./helpers/build-helpers.mjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.mjs";
3
- import { TsdownOptions, __ΩTsdownOptions } from "./types/build.mjs";
4
- import { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.mjs";
5
- import { createTsdownPlugin } from "./helpers/unplugin.mjs";
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "./build-CFHXlkSV.mjs";
2
+ import { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./types/plugin.mjs";
6
3
  import { Plugin } from "@powerlines/core";
7
4
 
8
5
  //#region src/index.d.ts
@@ -16,5 +13,5 @@ declare module "@powerlines/core" {
16
13
  */
17
14
  declare const plugin: <TContext extends TsdownPluginContext = TsdownPluginContext>(options?: TsdownPluginOptions) => Plugin<TContext>;
18
15
  //#endregion
19
- export { DEFAULT_TSDOWN_CONFIG, TsdownOptions, TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, createTsdownPlugin, plugin as default, plugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
16
+ export { TsdownOptions, TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig, plugin as default, plugin };
20
17
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;YA+BY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;AAJgB;;cAWhB,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YA8BY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;;;cAOA,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
- import { getDependencyConfig } from "./helpers/build-helpers.mjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./helpers/resolve-options.mjs";
3
- import { createTsdownPlugin } from "./helpers/unplugin.mjs";
4
- import "./helpers/index.mjs";
1
+ import { createUnplugin } from "@powerlines/core";
5
2
  import { formatConfig } from "@powerlines/core/plugin-utils";
6
3
  import { formatPackageJson } from "@powerlines/core/plugin-utils/format-package-json";
4
+ import { resolveOptions } from "@powerlines/unplugin/tsdown";
7
5
  import defu from "defu";
8
6
  import { build } from "tsdown";
7
+ import { createRolldownPlugin } from "unplugin";
9
8
 
10
9
  //#region src/index.ts
11
10
  /**
@@ -28,10 +27,15 @@ const plugin = (options = {}) => {
28
27
  },
29
28
  async build() {
30
29
  this.debug("Starting Tsdown build process...");
31
- const options = defu({
30
+ const resolved = resolveOptions(this);
31
+ const options = defu(this.config.tsdown, {
32
+ ...resolved,
32
33
  config: false,
33
- plugins: createTsdownPlugin(this)
34
- }, resolveOptions(this));
34
+ plugins: [createRolldownPlugin(createUnplugin(this, {
35
+ silenceHookLogging: true,
36
+ name: "tsdown"
37
+ }))()]
38
+ });
35
39
  this.debug({
36
40
  meta: { category: "config" },
37
41
  message: `Resolved Tsdown configuration: \n${formatConfig(options)}`
@@ -43,5 +47,5 @@ const plugin = (options = {}) => {
43
47
  };
44
48
 
45
49
  //#endregion
46
- export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, plugin as default, plugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
50
+ export { plugin as default, plugin };
47
51
  //# sourceMappingURL=index.mjs.map
@@ -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 { formatConfig } from \"@powerlines/core/plugin-utils\";\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 { TsdownPluginContext, TsdownPluginOptions } 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.debug(\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 };\n },\n configResolved() {\n this.debug(\n \"Checking for Tsdown related dependencies required by the project.\"\n );\n\n if (this.config.tsdown?.attw) {\n this.devDependencies[\"@arethetypeswrong/core\"] = \"^0.18.2\";\n }\n\n if (this.config.tsdown?.publint) {\n this.devDependencies.publint = \"^0.3.18\";\n }\n },\n async build() {\n this.debug(\"Starting Tsdown build process...\");\n\n const options = defu(\n {\n config: false,\n plugins: createTsdownPlugin(this)\n },\n resolveOptions(this)\n );\n\n this.debug({\n meta: {\n category: \"config\"\n },\n message: `Resolved Tsdown configuration: \\n${formatConfig(options)}`\n });\n\n await build(options);\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AAuCA,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,iBAAiB;AACf,QAAK,MACH,oEACD;AAED,OAAI,KAAK,OAAO,QAAQ,KACtB,MAAK,gBAAgB,4BAA4B;AAGnD,OAAI,KAAK,OAAO,QAAQ,QACtB,MAAK,gBAAgB,UAAU;;EAGnC,MAAM,QAAQ;AACZ,QAAK,MAAM,mCAAmC;GAE9C,MAAM,UAAU,KACd;IACE,QAAQ;IACR,SAAS,mBAAmB,KAAK;IAClC,EACD,eAAe,KAAK,CACrB;AAED,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,oCAAoC,aAAa,QAAQ;IACnE,CAAC;AAEF,SAAM,MAAM,QAAQ;AACpB,SAAM,kBAAkB,KAAK;;EAEhC"}
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 { createUnplugin, Plugin } from \"@powerlines/core\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { formatPackageJson } from \"@powerlines/core/plugin-utils/format-package-json\";\nimport { resolveOptions } from \"@powerlines/unplugin/tsdown\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"tsdown\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { TsdownPluginContext, TsdownPluginOptions } from \"./types/plugin\";\n\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.debug(\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 };\n },\n configResolved() {\n this.debug(\n \"Checking for Tsdown related dependencies required by the project.\"\n );\n\n if (this.config.tsdown?.attw) {\n this.devDependencies[\"@arethetypeswrong/core\"] = \"^0.18.2\";\n }\n\n if (this.config.tsdown?.publint) {\n this.devDependencies.publint = \"^0.3.18\";\n }\n },\n async build() {\n this.debug(\"Starting Tsdown build process...\");\n\n const resolved = resolveOptions(this);\n const options = defu(this.config.tsdown, {\n ...resolved,\n config: false,\n plugins: [\n createRolldownPlugin(\n createUnplugin(this, {\n silenceHookLogging: true,\n name: \"tsdown\"\n })\n )()\n ]\n }) as InlineConfig;\n\n this.debug({\n meta: {\n category: \"config\"\n },\n message: `Resolved Tsdown configuration: \\n${formatConfig(options)}`\n });\n\n await build(options);\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAsCA,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,iBAAiB;AACf,QAAK,MACH,oEACD;AAED,OAAI,KAAK,OAAO,QAAQ,KACtB,MAAK,gBAAgB,4BAA4B;AAGnD,OAAI,KAAK,OAAO,QAAQ,QACtB,MAAK,gBAAgB,UAAU;;EAGnC,MAAM,QAAQ;AACZ,QAAK,MAAM,mCAAmC;GAE9C,MAAM,WAAW,eAAe,KAAK;GACrC,MAAM,UAAU,KAAK,KAAK,OAAO,QAAQ;IACvC,GAAG;IACH,QAAQ;IACR,SAAS,CACP,qBACE,eAAe,MAAM;KACnB,oBAAoB;KACpB,MAAM;KACP,CAAC,CACH,EAAE,CACJ;IACF,CAAC;AAEF,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,oCAAoC,aAAa,QAAQ;IACnE,CAAC;AAEF,SAAM,MAAM,QAAQ;AACpB,SAAM,kBAAkB,KAAK;;EAEhC"}
@@ -1,8 +1,2 @@
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
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-DGSkbjen.cjs";
2
+ export { TsdownOptions, __ΩTsdownOptions };
@@ -1,8 +1,2 @@
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
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-CFHXlkSV.mjs";
2
+ export { TsdownOptions, __ΩTsdownOptions };
@@ -0,0 +1,2 @@
1
+ require('./plugin.cjs');
2
+ require('./build.cjs');
@@ -1,3 +1,3 @@
1
- import { TsdownOptions, __ΩTsdownOptions } from "./build.cjs";
2
- import { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./plugin.cjs";
3
- export { TsdownOptions, TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-DGSkbjen.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 };
@@ -1,3 +1,3 @@
1
- import { TsdownOptions, __ΩTsdownOptions } from "./build.mjs";
2
- import { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig } from "./plugin.mjs";
3
- export { TsdownOptions, TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownOptions, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
1
+ import { n as __ΩTsdownOptions, t as TsdownOptions } from "../build-CFHXlkSV.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 };
@@ -1 +1,4 @@
1
+ import "./plugin.mjs";
2
+ import "./build.mjs";
3
+
1
4
  export { };
@@ -1,21 +1,19 @@
1
- import { TsdownOptions } from "./build.cjs";
2
- import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
1
+ import { t as TsdownOptions } from "../build-DGSkbjen.cjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
3
 
4
4
  //#region src/types/plugin.d.ts
5
5
  type TsdownPluginOptions = Partial<TsdownOptions>;
6
6
  interface TsdownPluginUserConfig extends UserConfig {
7
7
  tsdown?: TsdownPluginOptions;
8
8
  }
9
- type TsdownPluginInitialConfig = InitialPluginConfig<TsdownPluginUserConfig>;
10
9
  interface TsdownPluginResolvedConfig extends ResolvedConfig {
11
10
  tsdown: TsdownOptions;
12
11
  }
13
12
  type TsdownPluginContext<TResolvedConfig extends TsdownPluginResolvedConfig = TsdownPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
13
  declare type __ΩTsdownPluginOptions = any[];
15
14
  declare type __ΩTsdownPluginUserConfig = any[];
16
- declare type __ΩTsdownPluginInitialConfig = any[];
17
15
  declare type __ΩTsdownPluginResolvedConfig = any[];
18
16
  declare type __ΩTsdownPluginContext = any[];
19
17
  //#endregion
20
- export { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
18
+ export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
21
19
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,mBAAA,GAAsB,OAAA,CAAQ,aAAA;AAAA,UAEzB,sBAAA,SAA+B,UAAA;EAC9C,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,yBAAA,GACV,mBAAA,CAAoB,sBAAA;AAAA,UAEL,0BAAA,SAAmC,cAAA;EAClD,MAAA,EAAQ,aAAA;AAAA;AAAA,KAGE,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
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"}
@@ -1,21 +1,19 @@
1
- import { TsdownOptions } from "./build.mjs";
2
- import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
1
+ import { t as TsdownOptions } from "../build-CFHXlkSV.mjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
3
 
4
4
  //#region src/types/plugin.d.ts
5
5
  type TsdownPluginOptions = Partial<TsdownOptions>;
6
6
  interface TsdownPluginUserConfig extends UserConfig {
7
7
  tsdown?: TsdownPluginOptions;
8
8
  }
9
- type TsdownPluginInitialConfig = InitialPluginConfig<TsdownPluginUserConfig>;
10
9
  interface TsdownPluginResolvedConfig extends ResolvedConfig {
11
10
  tsdown: TsdownOptions;
12
11
  }
13
12
  type TsdownPluginContext<TResolvedConfig extends TsdownPluginResolvedConfig = TsdownPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
13
  declare type __ΩTsdownPluginOptions = any[];
15
14
  declare type __ΩTsdownPluginUserConfig = any[];
16
- declare type __ΩTsdownPluginInitialConfig = any[];
17
15
  declare type __ΩTsdownPluginResolvedConfig = any[];
18
16
  declare type __ΩTsdownPluginContext = any[];
19
17
  //#endregion
20
- export { TsdownPluginContext, TsdownPluginInitialConfig, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginInitialConfig, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
18
+ export { TsdownPluginContext, TsdownPluginOptions, TsdownPluginResolvedConfig, TsdownPluginUserConfig, __ΩTsdownPluginContext, __ΩTsdownPluginOptions, __ΩTsdownPluginResolvedConfig, __ΩTsdownPluginUserConfig };
21
19
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,mBAAA,GAAsB,OAAA,CAAQ,aAAA;AAAA,UAEzB,sBAAA,SAA+B,UAAA;EAC9C,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,yBAAA,GACV,mBAAA,CAAoB,sBAAA;AAAA,UAEL,0BAAA,SAAmC,cAAA;EAClD,MAAA,EAAQ,aAAA;AAAA;AAAA,KAGE,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-tsdown",
3
- "version": "0.1.406",
3
+ "version": "0.1.409",
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"],
@@ -12,7 +12,7 @@
12
12
  "repository": {
13
13
  "type": "github",
14
14
  "url": "https://github.com/storm-software/powerlines.git",
15
- "directory": "packages/plugin-tsdown"
15
+ "directory": "packages/plugins/plugin-tsdown"
16
16
  },
17
17
  "funding": {
18
18
  "type": "github",
@@ -71,26 +71,26 @@
71
71
  "module": "./dist/index.mjs",
72
72
  "types": "./dist/index.d.cts",
73
73
  "typings": "dist/index.d.mts",
74
- "files": ["dist/**/*"],
74
+ "files": ["dist"],
75
75
  "dependencies": {
76
- "@powerlines/core": "^0.47.4",
77
- "@powerlines/plugin-rolldown": "^0.7.462",
78
- "@stryke/convert": "^0.7.3",
79
- "@stryke/helpers": "^0.10.12",
76
+ "@powerlines/core": "^0.9.2",
77
+ "@powerlines/unplugin": "^0.0.4",
78
+ "@stryke/convert": "^0.7.6",
79
+ "@stryke/helpers": "^0.10.15",
80
80
  "defu": "^6.1.7",
81
81
  "unplugin": "^3.0.0"
82
82
  },
83
- "devDependencies": { "@types/node": "^25.6.0", "tsdown": "^0.21.10" },
83
+ "devDependencies": { "@types/node": "^25.7.0", "tsdown": "^0.21.10" },
84
84
  "peerDependencies": {
85
85
  "@arethetypeswrong/core": ">=0.18.2",
86
86
  "publint": ">=0.3.18",
87
87
  "tsdown": ">=0.21.2"
88
88
  },
89
89
  "peerDependenciesMeta": {
90
- "tsdown": { "optional": false },
91
90
  "@arethetypeswrong/core": { "optional": true },
92
- "publint": { "optional": true }
91
+ "publint": { "optional": true },
92
+ "tsdown": { "optional": false }
93
93
  },
94
94
  "publishConfig": { "access": "public" },
95
- "gitHead": "af32ddb830394bb40196113171aa009dd5b7e28a"
95
+ "gitHead": "3c5c701e16af74006dd70b965009d41eb22ace2a"
96
96
  }
@@ -1,29 +0,0 @@
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;
@@ -1,23 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
4
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
- let _stryke_path_glob_to_regex = require("@stryke/path/glob-to-regex");
6
-
7
- //#region src/helpers/build-helpers.ts
8
- /**
9
- * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
10
- *
11
- * @param context - The build context.
12
- * @returns The dependency configuration.
13
- */
14
- function getDependencyConfig(context) {
15
- const { external, noExternal } = (0, _powerlines_core_plugin_utils.getDependencyConfig)(context);
16
- return {
17
- external: !external || external.length === 0 ? void 0 : external.map((ext) => (0, _stryke_type_checks_is_set_string.isSetString)(ext) && ext.includes("*") ? (0, _stryke_path_glob_to_regex.globToRegex)(ext) : ext),
18
- noExternal: !noExternal || noExternal.length === 0 ? void 0 : noExternal.map((noExt) => (0, _stryke_type_checks_is_set_string.isSetString)(noExt) && noExt.includes("*") ? (0, _stryke_path_glob_to_regex.globToRegex)(noExt) : noExt)
19
- };
20
- }
21
-
22
- //#endregion
23
- exports.getDependencyConfig = getDependencyConfig;
@@ -1,14 +0,0 @@
1
- import { Context } from "@powerlines/core";
2
- import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
3
-
4
- //#region src/helpers/build-helpers.d.ts
5
- /**
6
- * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
7
- *
8
- * @param context - The build context.
9
- * @returns The dependency configuration.
10
- */
11
- declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
12
- //#endregion
13
- export { getDependencyConfig };
14
- //# sourceMappingURL=build-helpers.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-helpers.d.cts","names":[],"sources":["../../src/helpers/build-helpers.ts"],"mappings":";;;;;;AAgCA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,OAAA,GACR,yBAAA"}
@@ -1,14 +0,0 @@
1
- import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
2
- import { Context } from "@powerlines/core";
3
-
4
- //#region src/helpers/build-helpers.d.ts
5
- /**
6
- * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
7
- *
8
- * @param context - The build context.
9
- * @returns The dependency configuration.
10
- */
11
- declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
12
- //#endregion
13
- export { getDependencyConfig };
14
- //# sourceMappingURL=build-helpers.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-helpers.d.mts","names":[],"sources":["../../src/helpers/build-helpers.ts"],"mappings":";;;;;;AAgCA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,OAAA,GACR,yBAAA"}
@@ -1,22 +0,0 @@
1
- import { getDependencyConfig as getDependencyConfig$1 } from "@powerlines/core/plugin-utils";
2
- import { isSetString } from "@stryke/type-checks/is-set-string";
3
- import { globToRegex } from "@stryke/path/glob-to-regex";
4
-
5
- //#region src/helpers/build-helpers.ts
6
- /**
7
- * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
8
- *
9
- * @param context - The build context.
10
- * @returns The dependency configuration.
11
- */
12
- function getDependencyConfig(context) {
13
- const { external, noExternal } = getDependencyConfig$1(context);
14
- return {
15
- external: !external || external.length === 0 ? void 0 : external.map((ext) => isSetString(ext) && ext.includes("*") ? globToRegex(ext) : ext),
16
- noExternal: !noExternal || noExternal.length === 0 ? void 0 : noExternal.map((noExt) => isSetString(noExt) && noExt.includes("*") ? globToRegex(noExt) : noExt)
17
- };
18
- }
19
-
20
- //#endregion
21
- export { getDependencyConfig };
22
- //# sourceMappingURL=build-helpers.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-helpers.mjs","names":["_getDependencyConfig"],"sources":["../../src/helpers/build-helpers.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\n// eslint-disable-next-line ts/no-unused-vars\nimport type { Context, ResolveConfig } from \"@powerlines/core\";\nimport type { GetDependencyConfigResult } from \"@powerlines/core/plugin-utils\";\n\nimport { getDependencyConfig as _getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport { globToRegex } from \"@stryke/path/glob-to-regex\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig(\n context: Context\n): GetDependencyConfigResult {\n const { external, noExternal } = _getDependencyConfig(context);\n\n return {\n external:\n !external || external.length === 0\n ? undefined\n : external.map(ext =>\n isSetString(ext) && ext.includes(\"*\") ? globToRegex(ext) : ext\n ),\n noExternal:\n !noExternal || noExternal.length === 0\n ? undefined\n : noExternal.map(noExt =>\n isSetString(noExt) && noExt.includes(\"*\")\n ? globToRegex(noExt)\n : noExt\n )\n };\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,EAAE,UAAU,eAAeA,sBAAqB,QAAQ;AAE9D,QAAO;EACL,UACE,CAAC,YAAY,SAAS,WAAW,IAC7B,SACA,SAAS,KAAI,QACX,YAAY,IAAI,IAAI,IAAI,SAAS,IAAI,GAAG,YAAY,IAAI,GAAG,IAC5D;EACP,YACE,CAAC,cAAc,WAAW,WAAW,IACjC,SACA,WAAW,KAAI,UACb,YAAY,MAAM,IAAI,MAAM,SAAS,IAAI,GACrC,YAAY,MAAM,GAClB,MACL;EACR"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers_build_helpers = require('./build-helpers.cjs');
3
- const require_helpers_resolve_options = require('./resolve-options.cjs');
4
- const require_helpers_unplugin = require('./unplugin.cjs');
5
-
6
- exports.DEFAULT_TSDOWN_CONFIG = require_helpers_resolve_options.DEFAULT_TSDOWN_CONFIG;
7
- exports.createTsdownPlugin = require_helpers_unplugin.createTsdownPlugin;
8
- exports.getDependencyConfig = require_helpers_build_helpers.getDependencyConfig;
9
- exports.resolveFormat = require_helpers_resolve_options.resolveFormat;
10
- exports.resolveFromFormat = require_helpers_resolve_options.resolveFromFormat;
11
- exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
@@ -1,4 +0,0 @@
1
- import { getDependencyConfig } from "./build-helpers.cjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.cjs";
3
- import { createTsdownPlugin } from "./unplugin.cjs";
4
- export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
@@ -1,4 +0,0 @@
1
- import { getDependencyConfig } from "./build-helpers.mjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.mjs";
3
- import { createTsdownPlugin } from "./unplugin.mjs";
4
- export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
@@ -1,5 +0,0 @@
1
- import { getDependencyConfig } from "./build-helpers.mjs";
2
- import { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions } from "./resolve-options.mjs";
3
- import { createTsdownPlugin } from "./unplugin.mjs";
4
-
5
- export { DEFAULT_TSDOWN_CONFIG, createTsdownPlugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
@@ -1,132 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_helpers_build_helpers = require('./build-helpers.cjs');
4
- let defu = require("defu");
5
- defu = require_runtime.__toESM(defu, 1);
6
- let _stryke_convert_to_array = require("@stryke/convert/to-array");
7
- let _stryke_path_append = require("@stryke/path/append");
8
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
9
- let _stryke_path_join_paths = require("@stryke/path/join-paths");
10
- let _stryke_path_replace = require("@stryke/path/replace");
11
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
12
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
13
-
14
- //#region src/helpers/resolve-options.ts
15
- const DEFAULT_TSDOWN_CONFIG = {
16
- platform: "neutral",
17
- target: "esnext",
18
- fixedExtension: true,
19
- nodeProtocol: true,
20
- clean: false
21
- };
22
- /**
23
- * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
24
- *
25
- * @param formats - The formats to resolve.
26
- * @returns The resolved entry options.
27
- */
28
- function resolveFormat(formats) {
29
- return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
30
- switch (format) {
31
- case "cjs": return "cjs";
32
- case "iife": return "iife";
33
- default: return "esm";
34
- }
35
- });
36
- }
37
- /**
38
- * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
39
- *
40
- * @param formats - The formats to resolve.
41
- * @returns The resolved entry options.
42
- */
43
- function resolveFromFormat(formats) {
44
- return (0, _stryke_convert_to_array.toArray)(formats).map((format) => {
45
- switch (format) {
46
- case "cjs":
47
- case "commonjs": return "cjs";
48
- case "iife": return "iife";
49
- default: return "esm";
50
- }
51
- });
52
- }
53
- const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").trim().replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "").trim();
54
- /**
55
- * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
56
- *
57
- * @param context - The build context.
58
- * @returns The resolved options.
59
- */
60
- function resolveOptions(context) {
61
- const { external, noExternal } = require_helpers_build_helpers.getDependencyConfig(context);
62
- return (0, defu.default)({
63
- 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.config.cwd, context.config.root, "src", "**/*.ts"), (0, _stryke_path_join_paths.joinPaths)(context.config.cwd, context.config.root, "src", "**/*.tsx")],
64
- 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) => {
65
- const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
66
- if ((0, _stryke_type_checks_is_set_string.isSetString)(value)) return [key, value];
67
- const currentExport = {};
68
- if ((0, _stryke_type_checks_is_set_string.isSetString)(value.require)) currentExport.require = {
69
- types: (0, _stryke_path_replace.replaceExtension)(value.require, ".d.cts", { fullExtension: true }),
70
- default: value.require
71
- };
72
- if ((0, _stryke_type_checks_is_set_string.isSetString)(value.import)) currentExport.import = {
73
- types: (0, _stryke_path_replace.replaceExtension)(value.import, ".d.mts", { fullExtension: true }),
74
- default: value.import
75
- };
76
- if (!(0, _stryke_type_checks_is_set_object.isSetObject)(value.default)) {
77
- if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.import)) currentExport.default = currentExport.import;
78
- else if ((0, _stryke_type_checks_is_set_object.isSetObject)(currentExport.require)) currentExport.default = currentExport.require;
79
- }
80
- return [key, currentExport];
81
- }));
82
- return Object.keys(result).sort().reduce((ret, key) => {
83
- ret[key] = result[key];
84
- return ret;
85
- }, {});
86
- } }) : void 0
87
- }, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
88
- name: context.config.name,
89
- cwd: (0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd),
90
- define: context.config.define,
91
- inputOptions: { transform: {
92
- define: context.config.define,
93
- inject: context.config.inject,
94
- typescript: { target: context.tsconfig.tsconfigJson?.compilerOptions?.target }
95
- } },
96
- deps: {
97
- neverBundle: external,
98
- alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
99
- onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
100
- skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
101
- },
102
- alias: context.alias,
103
- resolve: { alias: context.alias },
104
- platform: context.config.platform,
105
- dts: context.config.output.dts,
106
- outDir: (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
107
- tsconfig: (0, _stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.config.cwd),
108
- format: resolveFormat(context.config.output.format).filter(Boolean),
109
- mode: context.config.mode,
110
- treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
111
- minify: context.config.output.minify,
112
- metafile: context.config.mode === "development",
113
- sourcemap: context.config.output.sourceMap,
114
- debug: context.config.mode === "development",
115
- silent: context.config.logLevel.general === "silent" || context.config.mode === "production",
116
- logLevel: context.config.logLevel.general === "trace" ? "debug" : "error",
117
- customLogger: {
118
- level: context.config.logLevel.general === "trace" ? "debug" : "error",
119
- info: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.trace(formatMessage(context, ...msgs)),
120
- warn: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
121
- warnOnce: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
122
- error: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
123
- success: (...msgs) => (0, _stryke_type_checks_is_set_string.isSetString)(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.trace(formatMessage(context, ...msgs))
124
- }
125
- }, DEFAULT_TSDOWN_CONFIG);
126
- }
127
-
128
- //#endregion
129
- exports.DEFAULT_TSDOWN_CONFIG = DEFAULT_TSDOWN_CONFIG;
130
- exports.resolveFormat = resolveFormat;
131
- exports.resolveFromFormat = resolveFromFormat;
132
- exports.resolveOptions = resolveOptions;
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.cts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;;cAiCa,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;;;;;;;iBAkCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.mts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;;cAiCa,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;;;;;;;iBAkCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,UAAA"}
@@ -1,127 +0,0 @@
1
- import { getDependencyConfig } from "./build-helpers.mjs";
2
- import defu from "defu";
3
- import { toArray } from "@stryke/convert/to-array";
4
- import { appendPath } from "@stryke/path/append";
5
- import { relativePath } from "@stryke/path/file-path-fns";
6
- import { joinPaths } from "@stryke/path/join-paths";
7
- import { replaceExtension, replacePath } from "@stryke/path/replace";
8
- import { isSetObject } from "@stryke/type-checks/is-set-object";
9
- import { isSetString } from "@stryke/type-checks/is-set-string";
10
-
11
- //#region src/helpers/resolve-options.ts
12
- const DEFAULT_TSDOWN_CONFIG = {
13
- platform: "neutral",
14
- target: "esnext",
15
- fixedExtension: true,
16
- nodeProtocol: true,
17
- clean: false
18
- };
19
- /**
20
- * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
21
- *
22
- * @param formats - The formats to resolve.
23
- * @returns The resolved entry options.
24
- */
25
- function resolveFormat(formats) {
26
- return toArray(formats).map((format) => {
27
- switch (format) {
28
- case "cjs": return "cjs";
29
- case "iife": return "iife";
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
- default: return "esm";
47
- }
48
- });
49
- }
50
- const formatMessage = (context, ...msgs) => msgs.filter(Boolean).join(" ").trim().replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "").trim();
51
- /**
52
- * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).
53
- *
54
- * @param context - The build context.
55
- * @returns The resolved options.
56
- */
57
- function resolveOptions(context) {
58
- const { external, noExternal } = getDependencyConfig(context);
59
- return defu({
60
- 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.config.cwd, context.config.root, "src", "**/*.ts"), joinPaths(context.config.cwd, context.config.root, "src", "**/*.tsx")],
61
- exports: context.config?.tsdown && context.config.tsdown?.exports ? defu(isSetObject(context.config.tsdown?.exports) ? context.config.tsdown?.exports : {}, { customExports: (exports) => {
62
- const result = Object.fromEntries(Object.entries(exports).map(([key, value]) => {
63
- if (isSetString(value)) return [key, value];
64
- const currentExport = {};
65
- if (isSetString(value.require)) currentExport.require = {
66
- types: replaceExtension(value.require, ".d.cts", { fullExtension: true }),
67
- default: value.require
68
- };
69
- if (isSetString(value.import)) currentExport.import = {
70
- types: replaceExtension(value.import, ".d.mts", { fullExtension: true }),
71
- default: value.import
72
- };
73
- if (!isSetObject(value.default)) {
74
- if (isSetObject(currentExport.import)) currentExport.default = currentExport.import;
75
- else if (isSetObject(currentExport.require)) currentExport.default = currentExport.require;
76
- }
77
- return [key, currentExport];
78
- }));
79
- return Object.keys(result).sort().reduce((ret, key) => {
80
- ret[key] = result[key];
81
- return ret;
82
- }, {});
83
- } }) : void 0
84
- }, context.config?.tsdown ? context.config?.tsdown : {}, context.config?.rolldown ? { inputOptions: context.config?.rolldown } : {}, {
85
- name: context.config.name,
86
- cwd: appendPath(context.config.root, context.config.cwd),
87
- define: context.config.define,
88
- inputOptions: { transform: {
89
- define: context.config.define,
90
- inject: context.config.inject,
91
- typescript: { target: context.tsconfig.tsconfigJson?.compilerOptions?.target }
92
- } },
93
- deps: {
94
- neverBundle: external,
95
- alwaysBundle: context.config.resolve.skipNodeModulesBundle ? void 0 : noExternal,
96
- onlyBundle: context.config.resolve.skipNodeModulesBundle ? noExternal : void 0,
97
- skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle
98
- },
99
- alias: context.alias,
100
- resolve: { alias: context.alias },
101
- platform: context.config.platform,
102
- dts: context.config.output.dts,
103
- outDir: relativePath(appendPath(context.config.root, context.config.cwd), context.config.output.path),
104
- tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.config.cwd),
105
- format: resolveFormat(context.config.output.format).filter(Boolean),
106
- mode: context.config.mode,
107
- treeshake: context.config?.tsdown ? context.config?.tsdown?.treeshake : void 0,
108
- minify: context.config.output.minify,
109
- metafile: context.config.mode === "development",
110
- sourcemap: context.config.output.sourceMap,
111
- debug: context.config.mode === "development",
112
- silent: context.config.logLevel.general === "silent" || context.config.mode === "production",
113
- logLevel: context.config.logLevel.general === "trace" ? "debug" : "error",
114
- customLogger: {
115
- level: context.config.logLevel.general === "trace" ? "debug" : "error",
116
- info: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.trace(formatMessage(context, ...msgs)),
117
- warn: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
118
- warnOnce: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)),
119
- error: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)),
120
- success: (...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.trace(formatMessage(context, ...msgs))
121
- }
122
- }, DEFAULT_TSDOWN_CONFIG);
123
- }
124
-
125
- //#endregion
126
- export { DEFAULT_TSDOWN_CONFIG, resolveFormat, resolveFromFormat, resolveOptions };
127
- //# sourceMappingURL=resolve-options.mjs.map
@@ -1 +0,0 @@
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 { 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 { relativePath } from \"@stryke/path/file-path-fns\";\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\";\nimport { getDependencyConfig } from \"./build-helpers\";\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 .trim()\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.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.config.cwd,\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(context.config.root, context.config.cwd),\n define: context.config.define,\n inputOptions: {\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.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: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\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.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n logLevel: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n customLogger: {\n level: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(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.trace(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_TSDOWN_CONFIG\n ) as BuildOptions;\n}\n"],"mappings":"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"}
@@ -1,18 +0,0 @@
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, {
9
- silenceHookLogging: true,
10
- name: "tsdown"
11
- }))({
12
- ...context.options,
13
- ...context.config.initialConfig
14
- });
15
- }
16
-
17
- //#endregion
18
- exports.createTsdownPlugin = createTsdownPlugin;
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"unplugin.d.cts","names":[],"sources":["../../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,kBAAA,CAAmB,OAAA,EAAS,mBAAA,GAAmB,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"unplugin.d.mts","names":[],"sources":["../../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,kBAAA,CAAmB,OAAA,EAAS,mBAAA,GAAmB,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
@@ -1,17 +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
- silenceHookLogging: true,
8
- name: "tsdown"
9
- }))({
10
- ...context.options,
11
- ...context.config.initialConfig
12
- });
13
- }
14
-
15
- //#endregion
16
- export { createTsdownPlugin };
17
- //# sourceMappingURL=unplugin.mjs.map
@@ -1 +0,0 @@
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(\n createUnplugin(context, { silenceHookLogging: true, name: \"tsdown\" })\n )({ ...context.options, ...context.config.initialConfig });\n}\n"],"mappings":";;;;AAsBA,SAAgB,mBAAmB,SAA8B;AAC/D,QAAO,qBACL,eAAe,SAAS;EAAE,oBAAoB;EAAM,MAAM;EAAU,CAAC,CACtE,CAAC;EAAE,GAAG,QAAQ;EAAS,GAAG,QAAQ,OAAO;EAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,aAAA,GAAgB,OAAA,CAC1B,IAAA,CACE,UAAA;AAAA"}