@powerlines/plugin-vite 0.14.300 → 0.14.302

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 (155) hide show
  1. package/dist/build-CKSRktJj.d.mts +13 -0
  2. package/dist/build-CKSRktJj.d.mts.map +1 -0
  3. package/dist/build-DJTI0ZMx.cjs +0 -0
  4. package/dist/build-DVley5x8.d.cts +13 -0
  5. package/dist/build-DVley5x8.d.cts.map +1 -0
  6. package/dist/build-D_6wweLB.mjs +1 -0
  7. package/dist/helpers/index.cjs +6 -5
  8. package/dist/helpers/index.d.cts +5 -2
  9. package/dist/helpers/index.d.mts +5 -2
  10. package/dist/helpers/index.mjs +3 -2
  11. package/dist/helpers/resolve-options.cjs +3 -70
  12. package/dist/helpers/resolve-options.d.cts +3 -15
  13. package/dist/helpers/resolve-options.d.mts +3 -16
  14. package/dist/helpers/resolve-options.mjs +2 -68
  15. package/dist/helpers/unplugin.cjs +2 -11
  16. package/dist/helpers/unplugin.d.cts +4 -8
  17. package/dist/helpers/unplugin.d.mts +4 -8
  18. package/dist/helpers/unplugin.mjs +2 -11
  19. package/dist/helpers-DvTULET6.mjs +1 -0
  20. package/dist/helpers-yB1XkvQI.cjs +0 -0
  21. package/dist/index-B8OHl-c_.d.mts +1 -0
  22. package/dist/index-C-svZlpj.d.mts +1 -0
  23. package/dist/index-CFG0_wK4.d.cts +1 -0
  24. package/dist/index-CtCMUyZA.d.cts +1 -0
  25. package/dist/index.cjs +13 -11
  26. package/dist/index.d.cts +7 -5
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +7 -8
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +6 -3
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/plugin-CfromG2s.d.cts +22 -0
  33. package/dist/plugin-CfromG2s.d.cts.map +1 -0
  34. package/dist/plugin-D5qyQPqC.cjs +0 -0
  35. package/dist/plugin-DIEwkIcq.d.mts +22 -0
  36. package/dist/plugin-DIEwkIcq.d.mts.map +1 -0
  37. package/dist/plugin-HyYPEfea.mjs +1 -0
  38. package/dist/resolve-options-CGWH6O9W.cjs +113 -0
  39. package/dist/resolve-options-CZfGIJwj.mjs +69 -0
  40. package/dist/resolve-options-CZfGIJwj.mjs.map +1 -0
  41. package/dist/resolve-options-Cjw3kuSJ.d.cts +15 -0
  42. package/dist/resolve-options-Cjw3kuSJ.d.cts.map +1 -0
  43. package/dist/resolve-options-DDD8d7th.d.mts +15 -0
  44. package/dist/resolve-options-DDD8d7th.d.mts.map +1 -0
  45. package/dist/types/_internal.d.cts +3 -2
  46. package/dist/types/_internal.d.cts.map +1 -1
  47. package/dist/types/_internal.d.mts +3 -2
  48. package/dist/types/_internal.d.mts.map +1 -1
  49. package/dist/types/build.cjs +1 -0
  50. package/dist/types/build.d.cts +2 -13
  51. package/dist/types/build.d.mts +2 -13
  52. package/dist/types/build.mjs +2 -0
  53. package/dist/types/index.cjs +3 -0
  54. package/dist/types/index.d.cts +3 -2
  55. package/dist/types/index.d.mts +3 -2
  56. package/dist/types/index.mjs +4 -0
  57. package/dist/types/plugin.cjs +1 -0
  58. package/dist/types/plugin.d.cts +3 -23
  59. package/dist/types/plugin.d.mts +3 -24
  60. package/dist/types/plugin.mjs +2 -0
  61. package/dist/types-Cn_AzV39.mjs +1 -0
  62. package/dist/types-D208vOSb.cjs +0 -0
  63. package/dist/unplugin-BIIMkEyS.cjs +16 -0
  64. package/dist/unplugin-CmW69N5s.mjs +11 -0
  65. package/dist/unplugin-CmW69N5s.mjs.map +1 -0
  66. package/dist/unplugin-DIdD8ka4.d.mts +8 -0
  67. package/dist/unplugin-DIdD8ka4.d.mts.map +1 -0
  68. package/dist/unplugin-hWdrpmFt.d.cts +8 -0
  69. package/dist/unplugin-hWdrpmFt.d.cts.map +1 -0
  70. package/package.json +6 -6
  71. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  72. package/dist/core/src/lib/entry.cjs +0 -13
  73. package/dist/core/src/lib/entry.mjs +0 -15
  74. package/dist/core/src/lib/logger.cjs +0 -41
  75. package/dist/core/src/lib/logger.mjs +0 -40
  76. package/dist/core/src/lib/logger.mjs.map +0 -1
  77. package/dist/core/src/lib/unplugin/helpers.cjs +0 -19
  78. package/dist/core/src/lib/unplugin/helpers.mjs +0 -19
  79. package/dist/core/src/lib/unplugin/helpers.mjs.map +0 -1
  80. package/dist/core/src/lib/unplugin/index.cjs +0 -3
  81. package/dist/core/src/lib/unplugin/index.mjs +0 -5
  82. package/dist/core/src/lib/unplugin/module-resolution.cjs +0 -66
  83. package/dist/core/src/lib/unplugin/module-resolution.mjs +0 -66
  84. package/dist/core/src/lib/unplugin/module-resolution.mjs.map +0 -1
  85. package/dist/core/src/lib/unplugin/plugin.cjs +0 -71
  86. package/dist/core/src/lib/unplugin/plugin.mjs +0 -71
  87. package/dist/core/src/lib/unplugin/plugin.mjs.map +0 -1
  88. package/dist/core/src/lib/utilities/source-file.cjs +0 -22
  89. package/dist/core/src/lib/utilities/source-file.mjs +0 -21
  90. package/dist/core/src/lib/utilities/source-file.mjs.map +0 -1
  91. package/dist/core/src/plugin-utils/paths.cjs +0 -2
  92. package/dist/core/src/plugin-utils/paths.mjs +0 -4
  93. package/dist/core/src/types/_internal.d.cts +0 -85
  94. package/dist/core/src/types/_internal.d.cts.map +0 -1
  95. package/dist/core/src/types/_internal.d.mts +0 -85
  96. package/dist/core/src/types/_internal.d.mts.map +0 -1
  97. package/dist/core/src/types/api.d.cts +0 -103
  98. package/dist/core/src/types/api.d.cts.map +0 -1
  99. package/dist/core/src/types/api.d.mts +0 -103
  100. package/dist/core/src/types/api.d.mts.map +0 -1
  101. package/dist/core/src/types/commands.d.cts +0 -9
  102. package/dist/core/src/types/commands.d.cts.map +0 -1
  103. package/dist/core/src/types/commands.d.mts +0 -10
  104. package/dist/core/src/types/commands.d.mts.map +0 -1
  105. package/dist/core/src/types/config.d.cts +0 -552
  106. package/dist/core/src/types/config.d.cts.map +0 -1
  107. package/dist/core/src/types/config.d.mts +0 -552
  108. package/dist/core/src/types/config.d.mts.map +0 -1
  109. package/dist/core/src/types/context.d.cts +0 -511
  110. package/dist/core/src/types/context.d.cts.map +0 -1
  111. package/dist/core/src/types/context.d.mts +0 -511
  112. package/dist/core/src/types/context.d.mts.map +0 -1
  113. package/dist/core/src/types/fs.d.cts +0 -487
  114. package/dist/core/src/types/fs.d.cts.map +0 -1
  115. package/dist/core/src/types/fs.d.mts +0 -487
  116. package/dist/core/src/types/fs.d.mts.map +0 -1
  117. package/dist/core/src/types/hooks.d.cts +0 -99
  118. package/dist/core/src/types/hooks.d.cts.map +0 -1
  119. package/dist/core/src/types/hooks.d.mts +0 -99
  120. package/dist/core/src/types/hooks.d.mts.map +0 -1
  121. package/dist/core/src/types/index.d.mts +0 -9
  122. package/dist/core/src/types/plugin.d.cts +0 -204
  123. package/dist/core/src/types/plugin.d.cts.map +0 -1
  124. package/dist/core/src/types/plugin.d.mts +0 -204
  125. package/dist/core/src/types/plugin.d.mts.map +0 -1
  126. package/dist/core/src/types/tsconfig.d.cts +0 -70
  127. package/dist/core/src/types/tsconfig.d.cts.map +0 -1
  128. package/dist/core/src/types/tsconfig.d.mts +0 -70
  129. package/dist/core/src/types/tsconfig.d.mts.map +0 -1
  130. package/dist/core/src/types/unplugin.cjs +0 -21
  131. package/dist/core/src/types/unplugin.d.cts +0 -24
  132. package/dist/core/src/types/unplugin.d.cts.map +0 -1
  133. package/dist/core/src/types/unplugin.d.mts +0 -25
  134. package/dist/core/src/types/unplugin.d.mts.map +0 -1
  135. package/dist/core/src/types/unplugin.mjs +0 -22
  136. package/dist/core/src/types/unplugin.mjs.map +0 -1
  137. package/dist/helpers/resolve-options.d.cts.map +0 -1
  138. package/dist/helpers/resolve-options.d.mts.map +0 -1
  139. package/dist/helpers/resolve-options.mjs.map +0 -1
  140. package/dist/helpers/unplugin.d.cts.map +0 -1
  141. package/dist/helpers/unplugin.d.mts.map +0 -1
  142. package/dist/helpers/unplugin.mjs.map +0 -1
  143. package/dist/plugin-esbuild/src/helpers/resolve-options.cjs +0 -74
  144. package/dist/plugin-esbuild/src/helpers/resolve-options.mjs +0 -73
  145. package/dist/plugin-esbuild/src/helpers/resolve-options.mjs.map +0 -1
  146. package/dist/plugin-rolldown/src/helpers/resolve-options.cjs +0 -122
  147. package/dist/plugin-rolldown/src/helpers/resolve-options.mjs +0 -117
  148. package/dist/plugin-rolldown/src/helpers/resolve-options.mjs.map +0 -1
  149. package/dist/plugin-rollup/src/helpers/resolve-options.cjs +0 -123
  150. package/dist/plugin-rollup/src/helpers/resolve-options.mjs +0 -116
  151. package/dist/plugin-rollup/src/helpers/resolve-options.mjs.map +0 -1
  152. package/dist/types/build.d.cts.map +0 -1
  153. package/dist/types/build.d.mts.map +0 -1
  154. package/dist/types/plugin.d.cts.map +0 -1
  155. package/dist/types/plugin.d.mts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.mjs","names":["alias"],"sources":["../../../../../plugin-rolldown/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/types\";\nimport { BabelPluginResolvedConfig } from \"@powerlines/plugin-babel/types/plugin\";\nimport { dtsBundlePlugin } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { RollupPluginResolvedConfig } from \"@powerlines/plugin-rollup/types/plugin\";\nimport {\n getBabelInputPlugin,\n RollupBabelInputPluginOptions\n} from \"@rollup/plugin-babel\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { globSync } from \"node:fs\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { RolldownPluginResolvedConfig } from \"../types/plugin\";\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n (context.config as BabelPluginResolvedConfig).babel &&\n getBabelInputPlugin(\n defu((context.config as BabelPluginResolvedConfig).babel, {\n caller: {\n name: \"powerlines\",\n supportsStaticESM: true\n },\n cwd: context.config.root,\n babelrc: false,\n extensions: [\".js\", \".jsx\", \".ts\", \".tsx\"],\n babelHelpers: \"bundled\",\n skipPreflightCheck: true,\n exclude: /node_modules/\n }) as RollupBabelInputPluginOptions\n ),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ]\n },\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? (context.config as RolldownPluginResolvedConfig)?.rolldown\n : {},\n (context.config as RollupPluginResolvedConfig)?.rollup\n ? (context.config as RollupPluginResolvedConfig)?.rollup\n : {},\n {\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel: context.config.logLevel,\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (log.message?.trim()) {\n context.log(\n level === \"info\" ? \"debug\" : level,\n log.message?.trim() ?? \"\"\n );\n }\n },\n minify: context.config.mode === \"production\",\n output: [\n {\n dir: context.config.output.buildPath,\n format: \"es\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n },\n {\n dir: context.config.output.buildPath,\n format: \"cjs\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n }\n ]\n },\n {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,eAAe,SAAmC;AAChE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ual/rolldown_runtime.cjs');
2
- let defu = require("defu");
3
- defu = require_rolldown_runtime.__toESM(defu);
4
- let __stryke_convert_to_array = require("@stryke/convert/to-array");
5
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
6
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let __rollup_plugin_alias = require("@rollup/plugin-alias");
8
- __rollup_plugin_alias = require_rolldown_runtime.__toESM(__rollup_plugin_alias);
9
- let __rollup_plugin_babel = require("@rollup/plugin-babel");
10
- let __rollup_plugin_inject = require("@rollup/plugin-inject");
11
- __rollup_plugin_inject = require_rolldown_runtime.__toESM(__rollup_plugin_inject);
12
- let __rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
13
- __rollup_plugin_node_resolve = require_rolldown_runtime.__toESM(__rollup_plugin_node_resolve);
14
- let __rollup_plugin_replace = require("@rollup/plugin-replace");
15
- __rollup_plugin_replace = require_rolldown_runtime.__toESM(__rollup_plugin_replace);
16
- let node_fs = require("node:fs");
17
- let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
18
- rollup_plugin_typescript2 = require_rolldown_runtime.__toESM(rollup_plugin_typescript2);
19
-
20
- //#region ../plugin-rollup/src/helpers/resolve-options.ts
21
- /**
22
- * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
23
- *
24
- * @remarks
25
- * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
26
- */
27
- const dtsBundlePlugin = {
28
- name: "powerlines:dts-bundle",
29
- async generateBundle(_opts, bundle) {
30
- for (const [, file] of Object.entries(bundle)) {
31
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
32
- const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
33
- const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
34
- this.emitFile({
35
- type: "asset",
36
- fileName: dtsFileName,
37
- source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
38
- });
39
- }
40
- }
41
- };
42
- /**
43
- * Resolves the options for [rollup](https://rollupjs.org).
44
- *
45
- * @param context - The build context.
46
- * @returns The resolved options.
47
- */
48
- function resolveOptions(context) {
49
- return (0, defu.default)({
50
- input: (0, node_fs.globSync)((0, __stryke_convert_to_array.toArray)(context.entry).map((entry) => (0, __stryke_type_checks_is_string.isString)(entry) ? entry : entry.file)).flat(),
51
- external: (source) => {
52
- if (context.config.resolve.external && (0, __stryke_convert_to_array.toArray)(context.config.resolve.external).includes(source)) return true;
53
- if (context.config.resolve.noExternal && (0, __stryke_convert_to_array.toArray)(context.config.resolve.noExternal).includes(source)) return false;
54
- if (context.builtins.includes(source)) return context.config.projectType !== "application";
55
- return !context.config.resolve.skipNodeModulesBundle;
56
- },
57
- plugins: [
58
- (0, rollup_plugin_typescript2.default)({
59
- check: false,
60
- tsconfig: context.tsconfig.tsconfigFilePath
61
- }),
62
- context.config.define && Object.keys(context.config.define).length > 0 && (0, __rollup_plugin_replace.default)({
63
- sourceMap: context.config.mode === "development",
64
- preventAssignment: true,
65
- ...context.config.define ?? {}
66
- }),
67
- context.config.inject && Object.keys(context.config.inject).length > 0 && (0, __rollup_plugin_inject.default)({
68
- sourceMap: context.config.mode === "development",
69
- ...context.config.inject
70
- }),
71
- (0, __rollup_plugin_alias.default)({ entries: Object.entries(context.alias).reduce((ret, [id, path]) => {
72
- if (!ret.find((e) => e.find === id)) ret.push({
73
- find: id,
74
- replacement: path
75
- });
76
- else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
77
- return ret;
78
- }, []) }),
79
- context.config.babel && (0, __rollup_plugin_babel.getBabelInputPlugin)((0, defu.default)(context.config.babel, {
80
- caller: {
81
- name: "powerlines",
82
- supportsStaticESM: true
83
- },
84
- cwd: context.config.root,
85
- babelrc: false,
86
- extensions: [
87
- ".js",
88
- ".jsx",
89
- ".ts",
90
- ".tsx"
91
- ],
92
- babelHelpers: "bundled",
93
- skipPreflightCheck: true,
94
- exclude: /node_modules/
95
- })),
96
- (0, __rollup_plugin_node_resolve.default)({
97
- moduleDirectories: ["node_modules"],
98
- preferBuiltins: true
99
- }),
100
- dtsBundlePlugin
101
- ].filter(Boolean)
102
- }, context.config?.rollup ? context.config?.rollup : {}, {
103
- cache: !context.config.skipCache ? (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "rollup") : false,
104
- logLevel: context.config.logLevel,
105
- output: [{
106
- dir: context.config.output.buildPath,
107
- format: "es",
108
- entryFileNames: "[name].js",
109
- preserveModules: true,
110
- sourcemap: context.config.mode === "development"
111
- }, {
112
- dir: context.config.output.buildPath,
113
- format: "cjs",
114
- entryFileNames: "[name].cjs",
115
- preserveModules: true,
116
- sourcemap: context.config.mode === "development"
117
- }]
118
- });
119
- }
120
-
121
- //#endregion
122
- exports.dtsBundlePlugin = dtsBundlePlugin;
123
- exports.resolveOptions = resolveOptions;
@@ -1,116 +0,0 @@
1
- import defu from "defu";
2
- import { toArray } from "@stryke/convert/to-array";
3
- import { joinPaths } from "@stryke/path/join-paths";
4
- import { isString } from "@stryke/type-checks/is-string";
5
- import alias from "@rollup/plugin-alias";
6
- import { getBabelInputPlugin } from "@rollup/plugin-babel";
7
- import inject from "@rollup/plugin-inject";
8
- import resolve from "@rollup/plugin-node-resolve";
9
- import replace from "@rollup/plugin-replace";
10
- import { globSync } from "node:fs";
11
- import typescriptPlugin from "rollup-plugin-typescript2";
12
-
13
- //#region ../plugin-rollup/src/helpers/resolve-options.ts
14
- /**
15
- * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
16
- *
17
- * @remarks
18
- * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
19
- */
20
- const dtsBundlePlugin = {
21
- name: "powerlines:dts-bundle",
22
- async generateBundle(_opts, bundle) {
23
- for (const [, file] of Object.entries(bundle)) {
24
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
25
- const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
26
- const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
27
- this.emitFile({
28
- type: "asset",
29
- fileName: dtsFileName,
30
- source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
31
- });
32
- }
33
- }
34
- };
35
- /**
36
- * Resolves the options for [rollup](https://rollupjs.org).
37
- *
38
- * @param context - The build context.
39
- * @returns The resolved options.
40
- */
41
- function resolveOptions(context) {
42
- return defu({
43
- input: globSync(toArray(context.entry).map((entry) => isString(entry) ? entry : entry.file)).flat(),
44
- external: (source) => {
45
- if (context.config.resolve.external && toArray(context.config.resolve.external).includes(source)) return true;
46
- if (context.config.resolve.noExternal && toArray(context.config.resolve.noExternal).includes(source)) return false;
47
- if (context.builtins.includes(source)) return context.config.projectType !== "application";
48
- return !context.config.resolve.skipNodeModulesBundle;
49
- },
50
- plugins: [
51
- typescriptPlugin({
52
- check: false,
53
- tsconfig: context.tsconfig.tsconfigFilePath
54
- }),
55
- context.config.define && Object.keys(context.config.define).length > 0 && replace({
56
- sourceMap: context.config.mode === "development",
57
- preventAssignment: true,
58
- ...context.config.define ?? {}
59
- }),
60
- context.config.inject && Object.keys(context.config.inject).length > 0 && inject({
61
- sourceMap: context.config.mode === "development",
62
- ...context.config.inject
63
- }),
64
- alias({ entries: Object.entries(context.alias).reduce((ret, [id, path]) => {
65
- if (!ret.find((e) => e.find === id)) ret.push({
66
- find: id,
67
- replacement: path
68
- });
69
- else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
70
- return ret;
71
- }, []) }),
72
- context.config.babel && getBabelInputPlugin(defu(context.config.babel, {
73
- caller: {
74
- name: "powerlines",
75
- supportsStaticESM: true
76
- },
77
- cwd: context.config.root,
78
- babelrc: false,
79
- extensions: [
80
- ".js",
81
- ".jsx",
82
- ".ts",
83
- ".tsx"
84
- ],
85
- babelHelpers: "bundled",
86
- skipPreflightCheck: true,
87
- exclude: /node_modules/
88
- })),
89
- resolve({
90
- moduleDirectories: ["node_modules"],
91
- preferBuiltins: true
92
- }),
93
- dtsBundlePlugin
94
- ].filter(Boolean)
95
- }, context.config?.rollup ? context.config?.rollup : {}, {
96
- cache: !context.config.skipCache ? joinPaths(context.cachePath, "rollup") : false,
97
- logLevel: context.config.logLevel,
98
- output: [{
99
- dir: context.config.output.buildPath,
100
- format: "es",
101
- entryFileNames: "[name].js",
102
- preserveModules: true,
103
- sourcemap: context.config.mode === "development"
104
- }, {
105
- dir: context.config.output.buildPath,
106
- format: "cjs",
107
- entryFileNames: "[name].cjs",
108
- preserveModules: true,
109
- sourcemap: context.config.mode === "development"
110
- }]
111
- });
112
- }
113
-
114
- //#endregion
115
- export { dtsBundlePlugin, resolveOptions };
116
- //# sourceMappingURL=resolve-options.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.mjs","names":["dtsBundlePlugin: Plugin"],"sources":["../../../../../plugin-rollup/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/types\";\nimport { BabelPluginResolvedConfig } from \"@powerlines/plugin-babel/types/plugin\";\nimport alias from \"@rollup/plugin-alias\";\nimport {\n getBabelInputPlugin,\n RollupBabelInputPluginOptions\n} from \"@rollup/plugin-babel\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { RollupPluginResolvedConfig } from \"../types/plugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): RollupOptions {\n const result = defu(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n (context.config as BabelPluginResolvedConfig).babel &&\n getBabelInputPlugin(\n defu((context.config as BabelPluginResolvedConfig).babel, {\n caller: {\n name: \"powerlines\",\n supportsStaticESM: true\n },\n cwd: context.config.root,\n babelrc: false,\n extensions: [\".js\", \".jsx\", \".ts\", \".tsx\"],\n babelHelpers: \"bundled\",\n skipPreflightCheck: true,\n exclude: /node_modules/\n }) as RollupBabelInputPluginOptions\n ),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[]\n },\n (context.config as RollupPluginResolvedConfig)?.rollup\n ? (context.config as RollupPluginResolvedConfig)?.rollup\n : {},\n {\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rollup\")\n : false,\n logLevel: context.config.logLevel,\n output: [\n {\n dir: context.config.output.buildPath,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n },\n {\n dir: context.config.output.buildPath,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n }\n ]\n }\n ) as RollupOptions;\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,MAAaA,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;AAClC,OAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,OAAO,EAAE;AAC7C,OACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,KAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,QACD;GAED,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,GAAG,GACxD;AAED,QAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,UAAU,GACpC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;IAC5C,CAAC;;;CAGP;;;;;;;AAQD,SAAgB,eAAe,SAAiC;AAmH9D,QAlHe,KACb;EACE,OAAO,SACL,QAAQ,QAAQ,MAAM,CAAC,KAAI,UACzB,SAAS,MAAM,GAAG,QAAQ,MAAM,KACjC,CACF,CAAC,MAAM;EACR,WAAW,WAAmB;AAC5B,OACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC,SAAS,OAAO,CAEzD,QAAO;AAGT,OACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,CAAC,SAAS,OAAO,CAE3D,QAAO;AAGT,OAAI,QAAQ,SAAS,SAAS,OAAO,CACnC,QAAO,QAAQ,OAAO,gBAAgB;AAGxC,U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GAC3B,QAAQ;GACR,gBAAgB;GAChB,iBAAiB;GACjB,WAAW,QAAQ,OAAO,SAAS;GACpC,EACD;GACE,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,gBAAgB;GAChB,iBAAiB;GACjB,WAAW,QAAQ,OAAO,SAAS;GACpC,CACF;EACF,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,WAAA,GAAc,KACxB;;AADF;;EAA0B,YAAA,CAAA,EAeT,IAfS,CAeJ,sBAfI,EAAA,YAAA,CAAA;CAeJ;AAAL,8BAAA,GAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,WAAA,GAAc,KACxB;;AADF;;EAA0B,YAAA,CAAA,EAeT,IAfS,CAeJ,sBAfI,EAAA,YAAA,CAAA;CAeJ;AAAL,8BAAA,GAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KA0BY,iBAAA,GAAoB,QAAQ;UAEvB,oBAAA,SAA6B;SACrC;AAHT;AAEiB,UAIA,wBAAA,SAAiC,cAJJ,CAAA;EAI7B,IAAA,EACT,WADS;AAIjB;AAC0B,KADd,iBACc,CAAA,wBAAA,wBAAA,GAA2B,wBAA3B,CAAA,GACtB,aADsB,CACR,eADQ,CAAA,GAAA;EAA2B,GAAA,EAAA,OAAA;EACnC,SAAA,EAEL,SAFK;CAAd;AAES,oCAAA,GAAA,EAAA;AAAS,uCAAA,GAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;KA0BY,iBAAA,GAAoB,QAAQ;UAEvB,oBAAA,SAA6B;SACrC;;AAHG,UAMK,wBAAA,SAAiC,cANX,CAAA;EAEtB,IAAA,EAKT,WALS;AAIjB;AAIY,KAAA,iBAAiB,CAAA,wBACH,wBADG,GACwB,wBADxB,CAAA,GAEzB,aAFyB,CAEX,eAFW,CAAA,GAAA;EACH,GAAA,EAAA,OAAA;EAA2B,SAAA,EAGxC,SAHwC;CACnC;AAAd,oCAAA,GAAA,EAAA;AAES,uCAAA,GAAA,EAAA;AAAS,2CAAA,GAAA,EAAA"}