@powerlines/plugin-rollup 0.7.132 → 0.7.134

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 (130) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/helpers/index.cjs +2 -3
  3. package/dist/helpers/index.d.cts +1 -3
  4. package/dist/helpers/index.d.mts +1 -3
  5. package/dist/helpers/index.mjs +1 -2
  6. package/dist/helpers/unplugin.cjs +11 -2
  7. package/dist/helpers/unplugin.d.cts +6 -2
  8. package/dist/helpers/unplugin.d.mts +6 -2
  9. package/dist/helpers/unplugin.mjs +9 -1
  10. package/dist/index.cjs +7 -135
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +3 -127
  14. package/dist/powerlines/schemas/fs.cjs +226 -0
  15. package/dist/powerlines/schemas/fs.mjs +224 -0
  16. package/dist/powerlines/src/api.cjs +580 -0
  17. package/dist/powerlines/src/api.mjs +578 -0
  18. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -0
  19. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -0
  20. package/dist/powerlines/src/internal/helpers/environment.cjs +52 -0
  21. package/dist/powerlines/src/internal/helpers/environment.mjs +48 -0
  22. package/dist/powerlines/src/internal/helpers/generate-types.cjs +51 -0
  23. package/dist/powerlines/src/internal/helpers/generate-types.mjs +49 -0
  24. package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -0
  25. package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -0
  26. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -0
  27. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -0
  28. package/dist/powerlines/src/internal/helpers/install.cjs +37 -0
  29. package/dist/powerlines/src/internal/helpers/install.mjs +36 -0
  30. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +98 -0
  31. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +94 -0
  32. package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
  33. package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
  34. package/dist/powerlines/src/lib/build/rollup.cjs +134 -0
  35. package/dist/powerlines/src/lib/build/rollup.mjs +127 -0
  36. package/dist/powerlines/src/lib/config-file.cjs +79 -0
  37. package/dist/powerlines/src/lib/config-file.mjs +76 -0
  38. package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
  39. package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
  40. package/dist/powerlines/src/lib/contexts/context.cjs +933 -0
  41. package/dist/powerlines/src/lib/contexts/context.mjs +931 -0
  42. package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -0
  43. package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -0
  44. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -0
  45. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -0
  46. package/dist/powerlines/src/lib/entry.cjs +69 -0
  47. package/dist/powerlines/src/lib/entry.mjs +67 -0
  48. package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
  49. package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
  50. package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
  51. package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
  52. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
  53. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
  54. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
  55. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
  56. package/dist/powerlines/src/lib/fs/vfs.cjs +830 -0
  57. package/dist/powerlines/src/lib/fs/vfs.mjs +828 -0
  58. package/dist/powerlines/src/lib/logger.cjs +58 -0
  59. package/dist/powerlines/src/lib/logger.mjs +55 -0
  60. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -0
  61. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -0
  62. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
  63. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
  64. package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
  65. package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
  66. package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -0
  67. package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -0
  68. package/dist/powerlines/src/lib/unplugin/index.cjs +3 -0
  69. package/dist/powerlines/src/lib/unplugin/index.mjs +5 -0
  70. package/dist/powerlines/src/lib/unplugin/plugin.cjs +128 -0
  71. package/dist/powerlines/src/lib/unplugin/plugin.mjs +127 -0
  72. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  73. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  74. package/dist/powerlines/src/lib/utilities/meta.cjs +45 -0
  75. package/dist/powerlines/src/lib/utilities/meta.mjs +41 -0
  76. package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
  77. package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
  78. package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -0
  79. package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -0
  80. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  81. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  82. package/dist/powerlines/src/types/babel.d.mts +4 -0
  83. package/dist/powerlines/src/types/build.cjs +15 -0
  84. package/dist/powerlines/src/types/build.d.cts +152 -0
  85. package/dist/powerlines/src/types/build.d.mts +152 -0
  86. package/dist/powerlines/src/types/build.mjs +14 -0
  87. package/dist/powerlines/src/types/commands.cjs +16 -0
  88. package/dist/powerlines/src/types/commands.d.cts +8 -0
  89. package/dist/powerlines/src/types/commands.d.mts +9 -0
  90. package/dist/powerlines/src/types/commands.mjs +15 -0
  91. package/dist/powerlines/src/types/config.d.cts +377 -0
  92. package/dist/powerlines/src/types/config.d.mts +379 -0
  93. package/dist/powerlines/src/types/context.d.cts +403 -0
  94. package/dist/powerlines/src/types/context.d.mts +405 -0
  95. package/dist/powerlines/src/types/fs.d.cts +486 -0
  96. package/dist/powerlines/src/types/fs.d.mts +486 -0
  97. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  98. package/dist/powerlines/src/types/plugin.cjs +32 -0
  99. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  100. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  101. package/dist/powerlines/src/types/plugin.mjs +31 -0
  102. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  103. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  104. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  105. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  106. package/dist/types/index.cjs +0 -2
  107. package/dist/types/index.d.cts +1 -2
  108. package/dist/types/index.d.mts +1 -2
  109. package/dist/types/index.mjs +0 -3
  110. package/dist/types/plugin.cjs +0 -1
  111. package/dist/types/plugin.d.cts +12 -1
  112. package/dist/types/plugin.d.mts +12 -1
  113. package/dist/types/plugin.mjs +0 -2
  114. package/package.json +5 -5
  115. package/dist/helpers-B15z10jN.mjs +0 -1
  116. package/dist/helpers-LF26RHol.cjs +0 -0
  117. package/dist/index-9iG2qHLe.d.mts +0 -1
  118. package/dist/index-D4ELpJXS.d.cts +0 -1
  119. package/dist/index-D6CnpA_r.d.cts +0 -1
  120. package/dist/index-DL0uimUT.d.mts +0 -1
  121. package/dist/plugin-BMNRNHoI.d.cts +0 -1765
  122. package/dist/plugin-DXiYtwg7.d.mts +0 -1768
  123. package/dist/plugin-ifZVa20V.mjs +0 -1
  124. package/dist/plugin-pBKbb5K9.cjs +0 -0
  125. package/dist/types-U3zd8PTP.mjs +0 -1
  126. package/dist/types-o3zWarRp.cjs +0 -0
  127. package/dist/unplugin-BTY940wP.d.mts +0 -7
  128. package/dist/unplugin-CBMVMkto.d.cts +0 -7
  129. package/dist/unplugin-CL6dGu0d.cjs +0 -4659
  130. package/dist/unplugin-D_hWDyNp.mjs +0 -4615
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
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,4 +1,3 @@
1
- const require_unplugin = require('../unplugin-CL6dGu0d.cjs');
2
- require('../helpers-LF26RHol.cjs');
1
+ const require_helpers_unplugin = require('./unplugin.cjs');
3
2
 
4
- exports.createRollupPlugin = require_unplugin.createRollupPlugin;
3
+ exports.createRollupPlugin = require_helpers_unplugin.createRollupPlugin;
@@ -1,4 +1,2 @@
1
- import "../plugin-BMNRNHoI.cjs";
2
- import { t as createRollupPlugin } from "../unplugin-CBMVMkto.cjs";
3
- import "../index-D6CnpA_r.cjs";
1
+ import { createRollupPlugin } from "./unplugin.cjs";
4
2
  export { createRollupPlugin };
@@ -1,4 +1,2 @@
1
- import "../plugin-DXiYtwg7.mjs";
2
- import { t as createRollupPlugin } from "../unplugin-BTY940wP.mjs";
3
- import "../index-DL0uimUT.mjs";
1
+ import { createRollupPlugin } from "./unplugin.mjs";
4
2
  export { createRollupPlugin };
@@ -1,4 +1,3 @@
1
- import { t as createRollupPlugin } from "../unplugin-D_hWDyNp.mjs";
2
- import "../helpers-B15z10jN.mjs";
1
+ import { createRollupPlugin } from "./unplugin.mjs";
3
2
 
4
3
  export { createRollupPlugin };
@@ -1,3 +1,12 @@
1
- const require_unplugin = require('../unplugin-CL6dGu0d.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_plugin = require('../powerlines/src/lib/unplugin/plugin.cjs');
3
+ require('../powerlines/src/lib/unplugin/index.cjs');
4
+ let unplugin = require("unplugin");
2
5
 
3
- exports.createRollupPlugin = require_unplugin.createRollupPlugin;
6
+ //#region src/helpers/unplugin.ts
7
+ function createRollupPlugin(context) {
8
+ return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
9
+ }
10
+
11
+ //#endregion
12
+ exports.createRollupPlugin = createRollupPlugin;
@@ -1,3 +1,7 @@
1
- import "../plugin-BMNRNHoI.cjs";
2
- import { t as createRollupPlugin } from "../unplugin-CBMVMkto.cjs";
1
+ import { RollupPluginContext } from "../types/plugin.cjs";
2
+ import * as esbuild0 from "esbuild";
3
+
4
+ //#region src/helpers/unplugin.d.ts
5
+ declare function createRollupPlugin(context: RollupPluginContext): esbuild0.Plugin;
6
+ //#endregion
3
7
  export { createRollupPlugin };
@@ -1,3 +1,7 @@
1
- import "../plugin-DXiYtwg7.mjs";
2
- import { t as createRollupPlugin } from "../unplugin-BTY940wP.mjs";
1
+ import { RollupPluginContext } from "../types/plugin.mjs";
2
+ import * as esbuild0 from "esbuild";
3
+
4
+ //#region src/helpers/unplugin.d.ts
5
+ declare function createRollupPlugin(context: RollupPluginContext): esbuild0.Plugin;
6
+ //#endregion
3
7
  export { createRollupPlugin };
@@ -1,3 +1,11 @@
1
- import { t as createRollupPlugin } from "../unplugin-D_hWDyNp.mjs";
1
+ import { createUnplugin } from "../powerlines/src/lib/unplugin/plugin.mjs";
2
+ import "../powerlines/src/lib/unplugin/index.mjs";
3
+ import { createEsbuildPlugin } from "unplugin";
2
4
 
5
+ //#region src/helpers/unplugin.ts
6
+ function createRollupPlugin(context) {
7
+ return createEsbuildPlugin(createUnplugin(context))({});
8
+ }
9
+
10
+ //#endregion
3
11
  export { createRollupPlugin };
package/dist/index.cjs CHANGED
@@ -1,141 +1,13 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_unplugin = require('./unplugin-CL6dGu0d.cjs');
3
- require('./helpers-LF26RHol.cjs');
4
- require('./plugin-pBKbb5K9.cjs');
5
- require('./types-o3zWarRp.cjs');
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_rollup = require('./powerlines/src/lib/build/rollup.cjs');
4
+ const require_helpers_unplugin = require('./helpers/unplugin.cjs');
5
+ require('./helpers/index.cjs');
6
6
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
7
7
  let defu = require("defu");
8
- defu = require_unplugin.__toESM(defu);
9
- let __rollup_plugin_alias = require("@rollup/plugin-alias");
10
- __rollup_plugin_alias = require_unplugin.__toESM(__rollup_plugin_alias);
11
- let __rollup_plugin_babel = require("@rollup/plugin-babel");
12
- let __rollup_plugin_inject = require("@rollup/plugin-inject");
13
- __rollup_plugin_inject = require_unplugin.__toESM(__rollup_plugin_inject);
14
- let __rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
15
- __rollup_plugin_node_resolve = require_unplugin.__toESM(__rollup_plugin_node_resolve);
16
- let __rollup_plugin_replace = require("@rollup/plugin-replace");
17
- __rollup_plugin_replace = require_unplugin.__toESM(__rollup_plugin_replace);
18
- let __stryke_helpers_omit = require("@stryke/helpers/omit");
19
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
20
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
21
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
22
- let node_fs = require("node:fs");
23
- let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
24
- rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2);
8
+ defu = require_rolldown_runtime.__toESM(defu);
25
9
  let rollup = require("rollup");
26
10
 
27
- //#region ../powerlines/src/lib/build/rollup.ts
28
- /**
29
- * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.
30
- *
31
- * @remarks
32
- * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.
33
- */
34
- const dtsBundlePlugin = {
35
- name: "powerlines:dts-bundle",
36
- async generateBundle(_opts, bundle) {
37
- for (const [, file] of Object.entries(bundle)) {
38
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) continue;
39
- const dtsFileName = file.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/, ".d.ts");
40
- const relativeSourceDtsName = JSON.stringify(`./${file.facadeModuleId.replace(/\.[cm]?[jt]sx?$/, "")}`);
41
- this.emitFile({
42
- type: "asset",
43
- fileName: dtsFileName,
44
- source: file.exports.includes("default") ? `export * from ${relativeSourceDtsName};\nexport { default } from ${relativeSourceDtsName};\n` : `export * from ${relativeSourceDtsName};\n`
45
- });
46
- }
47
- }
48
- };
49
- /**
50
- * Resolves the options for [rollup](https://rollupjs.org).
51
- *
52
- * @param context - The build context.
53
- * @returns The resolved options.
54
- */
55
- function extractRollupConfig(context) {
56
- return (0, defu.default)({
57
- 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(),
58
- external: (source, importer, isResolved) => {
59
- const externalFn = context.config.build.variant === "rollup" && context.config.build.override.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.override.external) ? context.config.build.override.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build.override.external).includes(id) : context.config.build.variant === "vite" && context.config.build.override.build?.rollupOptions?.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.override.build?.rollupOptions?.external) ? context.config.build.override.build?.rollupOptions?.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build?.build?.rollupOptions?.external).includes(id) : context.config.build.variant === "rollup" && context.config.build.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.external) ? context.config.build.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build.external).includes(id) : context.config.build.variant === "vite" && context.config.build.build?.rollupOptions?.external ? (0, __stryke_type_checks_is_function.isFunction)(context.config.build.build?.rollupOptions?.external) ? context.config.build.build?.rollupOptions?.external : (id) => (0, __stryke_convert_to_array.toArray)(context.config.build?.build?.rollupOptions?.external).includes(id) : void 0;
60
- if ((0, __stryke_type_checks_is_function.isFunction)(externalFn) && externalFn(source, importer, isResolved)) return true;
61
- if (context.config.build.external && (0, __stryke_convert_to_array.toArray)(context.config.build.external).includes(source)) return true;
62
- if (context.config.build.noExternal && (0, __stryke_convert_to_array.toArray)(context.config.build.noExternal).includes(source)) return false;
63
- if (context.builtins.includes(source)) return context.config.projectType !== "application";
64
- return !context.config.build.skipNodeModulesBundle;
65
- },
66
- plugins: [
67
- (0, rollup_plugin_typescript2.default)({
68
- check: false,
69
- tsconfig: context.tsconfig.tsconfigFilePath
70
- }),
71
- context.config.build.define && Object.keys(context.config.build.define).length > 0 && (0, __rollup_plugin_replace.default)({
72
- sourceMap: context.config.mode === "development",
73
- preventAssignment: true,
74
- ...context.config.build.define ?? {}
75
- }),
76
- context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && (0, __rollup_plugin_inject.default)({
77
- sourceMap: context.config.mode === "development",
78
- ...context.config.build.inject
79
- }),
80
- (0, __rollup_plugin_alias.default)({ entries: context.builtins.reduce((ret, id) => {
81
- if (!ret.find((e) => e.find === id)) {
82
- const path = context.fs.ids[id];
83
- if (path) ret.push({
84
- find: id,
85
- replacement: path
86
- });
87
- }
88
- return ret;
89
- }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
90
- if (!ret.find((e) => e.find === id)) ret.push({
91
- find: id,
92
- replacement: path
93
- });
94
- return ret;
95
- }, []) : []) }),
96
- (0, __rollup_plugin_babel.getBabelInputPlugin)((0, defu.default)(context.config.transform.babel, {
97
- caller: {
98
- name: "powerlines",
99
- supportsStaticESM: true
100
- },
101
- cwd: context.config.projectRoot,
102
- babelrc: false,
103
- extensions: [
104
- ".js",
105
- ".jsx",
106
- ".ts",
107
- ".tsx"
108
- ],
109
- babelHelpers: "bundled",
110
- skipPreflightCheck: true,
111
- exclude: /node_modules/
112
- })),
113
- (0, __rollup_plugin_node_resolve.default)({
114
- moduleDirectories: ["node_modules"],
115
- preferBuiltins: true
116
- }),
117
- dtsBundlePlugin
118
- ].filter(Boolean)
119
- }, context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rollup" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build?.rollupOptions : {}, {
120
- cache: !context.config.skipCache ? (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "rollup") : false,
121
- logLevel: context.config.logLevel,
122
- output: [{
123
- dir: context.config.output.buildPath,
124
- format: "es",
125
- entryFileNames: "[name].js",
126
- preserveModules: true,
127
- sourcemap: context.config.mode === "development"
128
- }, {
129
- dir: context.config.output.buildPath,
130
- format: "cjs",
131
- entryFileNames: "[name].cjs",
132
- preserveModules: true,
133
- sourcemap: context.config.mode === "development"
134
- }]
135
- });
136
- }
137
-
138
- //#endregion
139
11
  //#region src/index.ts
140
12
  /**
141
13
  * A Powerlines plugin to assist in developing other Powerlines plugins.
@@ -153,7 +25,7 @@ const plugin = (options = {}) => {
153
25
  };
154
26
  },
155
27
  async build() {
156
- const result = await (0, rollup.rollup)((0, defu.default)({ plugins: [require_unplugin.createRollupPlugin(this)] }, extractRollupConfig(this)));
28
+ const result = await (0, rollup.rollup)((0, defu.default)({ plugins: [require_helpers_unplugin.createRollupPlugin(this)] }, require_rollup.extractRollupConfig(this)));
157
29
  await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.output.format).map(async (format) => result.write({ format })));
158
30
  }
159
31
  };
@@ -161,6 +33,6 @@ const plugin = (options = {}) => {
161
33
  var src_default = plugin;
162
34
 
163
35
  //#endregion
164
- exports.createRollupPlugin = require_unplugin.createRollupPlugin;
36
+ exports.createRollupPlugin = require_helpers_unplugin.createRollupPlugin;
165
37
  exports.default = src_default;
166
38
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { a as __ΩRollupPluginOptions, i as __ΩRollupPluginContext, n as RollupPluginOptions, o as __ΩRollupPluginResolvedConfig, r as RollupPluginResolvedConfig, s as Plugin, t as RollupPluginContext } from "./plugin-BMNRNHoI.cjs";
2
- import { t as createRollupPlugin } from "./unplugin-CBMVMkto.cjs";
3
- import "./index-D6CnpA_r.cjs";
4
- import "./index-D4ELpJXS.cjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.cjs";
2
+ import { RollupPluginContext, RollupPluginOptions, RollupPluginResolvedConfig, __ΩRollupPluginContext, __ΩRollupPluginOptions, __ΩRollupPluginResolvedConfig } from "./types/plugin.cjs";
3
+ import { createRollupPlugin } from "./helpers/unplugin.cjs";
5
4
 
6
5
  //#region src/index.d.ts
7
6
 
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { a as __ΩRollupPluginOptions, i as __ΩRollupPluginContext, n as RollupPluginOptions, o as __ΩRollupPluginResolvedConfig, r as RollupPluginResolvedConfig, s as Plugin, t as RollupPluginContext } from "./plugin-DXiYtwg7.mjs";
2
- import { t as createRollupPlugin } from "./unplugin-BTY940wP.mjs";
3
- import "./index-DL0uimUT.mjs";
4
- import "./index-9iG2qHLe.mjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.mjs";
2
+ import { RollupPluginContext, RollupPluginOptions, RollupPluginResolvedConfig, __ΩRollupPluginContext, __ΩRollupPluginOptions, __ΩRollupPluginResolvedConfig } from "./types/plugin.mjs";
3
+ import { createRollupPlugin } from "./helpers/unplugin.mjs";
4
+ import "./helpers/index.mjs";
5
+ import "./types/index.mjs";
5
6
 
6
7
  //#region src/index.d.ts
7
-
8
8
  /**
9
9
  * A Powerlines plugin to assist in developing other Powerlines plugins.
10
10
  */
package/dist/index.mjs CHANGED
@@ -1,134 +1,10 @@
1
- import { t as createRollupPlugin } from "./unplugin-D_hWDyNp.mjs";
2
- import "./helpers-B15z10jN.mjs";
3
- import "./plugin-ifZVa20V.mjs";
4
- import "./types-U3zd8PTP.mjs";
1
+ import { extractRollupConfig } from "./powerlines/src/lib/build/rollup.mjs";
2
+ import { createRollupPlugin } from "./helpers/unplugin.mjs";
3
+ import "./helpers/index.mjs";
5
4
  import { toArray } from "@stryke/convert/to-array";
6
5
  import defu$1 from "defu";
7
- import alias from "@rollup/plugin-alias";
8
- import { getBabelInputPlugin } from "@rollup/plugin-babel";
9
- import inject from "@rollup/plugin-inject";
10
- import resolve from "@rollup/plugin-node-resolve";
11
- import replace from "@rollup/plugin-replace";
12
- import { omit } from "@stryke/helpers/omit";
13
- import { joinPaths } from "@stryke/path/join-paths";
14
- import { isFunction } from "@stryke/type-checks/is-function";
15
- import { isString } from "@stryke/type-checks/is-string";
16
- import { globSync } from "node:fs";
17
- import typescriptPlugin from "rollup-plugin-typescript2";
18
6
  import { rollup } from "rollup";
19
7
 
20
- //#region ../powerlines/src/lib/build/rollup.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 extractRollupConfig(context) {
49
- return defu$1({
50
- input: globSync(toArray(context.entry).map((entry) => isString(entry) ? entry : entry.file)).flat(),
51
- external: (source, importer, isResolved) => {
52
- const externalFn = context.config.build.variant === "rollup" && context.config.build.override.external ? isFunction(context.config.build.override.external) ? context.config.build.override.external : (id) => toArray(context.config.build.override.external).includes(id) : context.config.build.variant === "vite" && context.config.build.override.build?.rollupOptions?.external ? isFunction(context.config.build.override.build?.rollupOptions?.external) ? context.config.build.override.build?.rollupOptions?.external : (id) => toArray(context.config.build?.build?.rollupOptions?.external).includes(id) : context.config.build.variant === "rollup" && context.config.build.external ? isFunction(context.config.build.external) ? context.config.build.external : (id) => toArray(context.config.build.external).includes(id) : context.config.build.variant === "vite" && context.config.build.build?.rollupOptions?.external ? isFunction(context.config.build.build?.rollupOptions?.external) ? context.config.build.build?.rollupOptions?.external : (id) => toArray(context.config.build?.build?.rollupOptions?.external).includes(id) : void 0;
53
- if (isFunction(externalFn) && externalFn(source, importer, isResolved)) return true;
54
- if (context.config.build.external && toArray(context.config.build.external).includes(source)) return true;
55
- if (context.config.build.noExternal && toArray(context.config.build.noExternal).includes(source)) return false;
56
- if (context.builtins.includes(source)) return context.config.projectType !== "application";
57
- return !context.config.build.skipNodeModulesBundle;
58
- },
59
- plugins: [
60
- typescriptPlugin({
61
- check: false,
62
- tsconfig: context.tsconfig.tsconfigFilePath
63
- }),
64
- context.config.build.define && Object.keys(context.config.build.define).length > 0 && replace({
65
- sourceMap: context.config.mode === "development",
66
- preventAssignment: true,
67
- ...context.config.build.define ?? {}
68
- }),
69
- context.config.build.inject && Object.keys(context.config.build.inject).length > 0 && inject({
70
- sourceMap: context.config.mode === "development",
71
- ...context.config.build.inject
72
- }),
73
- alias({ entries: context.builtins.reduce((ret, id) => {
74
- if (!ret.find((e) => e.find === id)) {
75
- const path = context.fs.ids[id];
76
- if (path) ret.push({
77
- find: id,
78
- replacement: path
79
- });
80
- }
81
- return ret;
82
- }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
83
- if (!ret.find((e) => e.find === id)) ret.push({
84
- find: id,
85
- replacement: path
86
- });
87
- return ret;
88
- }, []) : []) }),
89
- getBabelInputPlugin(defu$1(context.config.transform.babel, {
90
- caller: {
91
- name: "powerlines",
92
- supportsStaticESM: true
93
- },
94
- cwd: context.config.projectRoot,
95
- babelrc: false,
96
- extensions: [
97
- ".js",
98
- ".jsx",
99
- ".ts",
100
- ".tsx"
101
- ],
102
- babelHelpers: "bundled",
103
- skipPreflightCheck: true,
104
- exclude: /node_modules/
105
- })),
106
- resolve({
107
- moduleDirectories: ["node_modules"],
108
- preferBuiltins: true
109
- }),
110
- dtsBundlePlugin
111
- ].filter(Boolean)
112
- }, context.config.build.variant === "rollup" ? context.config.build.override : {}, context.config.build.variant === "vite" ? context.config.build.override.build?.rollupOptions : {}, context.config.build.variant === "rollup" ? omit(context.config.build, ["override", "variant"]) : {}, context.config.build.variant === "vite" ? context.config.build.build?.rollupOptions : {}, {
113
- cache: !context.config.skipCache ? joinPaths(context.cachePath, "rollup") : false,
114
- logLevel: context.config.logLevel,
115
- output: [{
116
- dir: context.config.output.buildPath,
117
- format: "es",
118
- entryFileNames: "[name].js",
119
- preserveModules: true,
120
- sourcemap: context.config.mode === "development"
121
- }, {
122
- dir: context.config.output.buildPath,
123
- format: "cjs",
124
- entryFileNames: "[name].cjs",
125
- preserveModules: true,
126
- sourcemap: context.config.mode === "development"
127
- }]
128
- });
129
- }
130
-
131
- //#endregion
132
8
  //#region src/index.ts
133
9
  /**
134
10
  * A Powerlines plugin to assist in developing other Powerlines plugins.
@@ -0,0 +1,226 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_capnp = require("@stryke/capnp");
3
+ __stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
4
+
5
+ //#region ../powerlines/schemas/fs.ts
6
+ var FileMetadata_KeyValuePair = class extends __stryke_capnp.Struct {
7
+ static _capnp = {
8
+ displayName: "KeyValuePair",
9
+ id: "eabb26cf58b2a14c",
10
+ size: new __stryke_capnp.ObjectSize(0, 2)
11
+ };
12
+ get key() {
13
+ return __stryke_capnp.utils.getText(0, this);
14
+ }
15
+ set key(value) {
16
+ __stryke_capnp.utils.setText(0, value, this);
17
+ }
18
+ get value() {
19
+ return __stryke_capnp.utils.getText(1, this);
20
+ }
21
+ set value(value) {
22
+ __stryke_capnp.utils.setText(1, value, this);
23
+ }
24
+ toString() {
25
+ return "FileMetadata_KeyValuePair_" + super.toString();
26
+ }
27
+ };
28
+ /**
29
+ * The identifier for the file data.
30
+ *
31
+ */
32
+ var FileMetadata = class FileMetadata extends __stryke_capnp.Struct {
33
+ static KeyValuePair = FileMetadata_KeyValuePair;
34
+ static _capnp = {
35
+ displayName: "FileMetadata",
36
+ id: "8e2cab5d7e28c7b3",
37
+ size: new __stryke_capnp.ObjectSize(8, 3),
38
+ defaultType: "normal"
39
+ };
40
+ static _Properties;
41
+ /**
42
+ * The type of the file.
43
+ *
44
+ */
45
+ get id() {
46
+ return __stryke_capnp.utils.getText(0, this);
47
+ }
48
+ set id(value) {
49
+ __stryke_capnp.utils.setText(0, value, this);
50
+ }
51
+ /**
52
+ * The timestamp representing the file's creation date.
53
+ *
54
+ */
55
+ get type() {
56
+ return __stryke_capnp.utils.getText(1, this, FileMetadata._capnp.defaultType);
57
+ }
58
+ set type(value) {
59
+ __stryke_capnp.utils.setText(1, value, this);
60
+ }
61
+ /**
62
+ * Additional metadata associated with the file.
63
+ *
64
+ */
65
+ get timestamp() {
66
+ return __stryke_capnp.utils.getUint32(0, this);
67
+ }
68
+ set timestamp(value) {
69
+ __stryke_capnp.utils.setUint32(0, value, this);
70
+ }
71
+ _adoptProperties(value) {
72
+ __stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(2, this));
73
+ }
74
+ _disownProperties() {
75
+ return __stryke_capnp.utils.disown(this.properties);
76
+ }
77
+ get properties() {
78
+ return __stryke_capnp.utils.getList(2, FileMetadata._Properties, this);
79
+ }
80
+ _hasProperties() {
81
+ return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(2, this));
82
+ }
83
+ _initProperties(length) {
84
+ return __stryke_capnp.utils.initList(2, FileMetadata._Properties, length, this);
85
+ }
86
+ set properties(value) {
87
+ __stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(2, this));
88
+ }
89
+ toString() {
90
+ return "FileMetadata_" + super.toString();
91
+ }
92
+ };
93
+ /**
94
+ * An identifier for the file.
95
+ *
96
+ */
97
+ var FileId = class extends __stryke_capnp.Struct {
98
+ static _capnp = {
99
+ displayName: "FileId",
100
+ id: "990d6a471072f997",
101
+ size: new __stryke_capnp.ObjectSize(0, 2)
102
+ };
103
+ /**
104
+ * A virtual (or actual) path to the file in the file system.
105
+ *
106
+ */
107
+ get id() {
108
+ return __stryke_capnp.utils.getText(0, this);
109
+ }
110
+ set id(value) {
111
+ __stryke_capnp.utils.setText(0, value, this);
112
+ }
113
+ get path() {
114
+ return __stryke_capnp.utils.getText(1, this);
115
+ }
116
+ set path(value) {
117
+ __stryke_capnp.utils.setText(1, value, this);
118
+ }
119
+ toString() {
120
+ return "FileId_" + super.toString();
121
+ }
122
+ };
123
+ /**
124
+ * An identifier for the file.
125
+ *
126
+ */
127
+ var FileStorage = class extends __stryke_capnp.Struct {
128
+ static _capnp = {
129
+ displayName: "FileStorage",
130
+ id: "9dca66ac858c9ebe",
131
+ size: new __stryke_capnp.ObjectSize(0, 2)
132
+ };
133
+ /**
134
+ * A virtual (or actual) path to the file in the file system.
135
+ *
136
+ */
137
+ get path() {
138
+ return __stryke_capnp.utils.getText(0, this);
139
+ }
140
+ set path(value) {
141
+ __stryke_capnp.utils.setText(0, value, this);
142
+ }
143
+ get code() {
144
+ return __stryke_capnp.utils.getText(1, this);
145
+ }
146
+ set code(value) {
147
+ __stryke_capnp.utils.setText(1, value, this);
148
+ }
149
+ toString() {
150
+ return "FileStorage_" + super.toString();
151
+ }
152
+ };
153
+ var FileSystem = class FileSystem extends __stryke_capnp.Struct {
154
+ static _capnp = {
155
+ displayName: "FileSystem",
156
+ id: "ae0c23d43e56abcf",
157
+ size: new __stryke_capnp.ObjectSize(0, 3)
158
+ };
159
+ static _Ids;
160
+ static _Storage;
161
+ static _Metadata;
162
+ _adoptIds(value) {
163
+ __stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(0, this));
164
+ }
165
+ _disownIds() {
166
+ return __stryke_capnp.utils.disown(this.ids);
167
+ }
168
+ get ids() {
169
+ return __stryke_capnp.utils.getList(0, FileSystem._Ids, this);
170
+ }
171
+ _hasIds() {
172
+ return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(0, this));
173
+ }
174
+ _initIds(length) {
175
+ return __stryke_capnp.utils.initList(0, FileSystem._Ids, length, this);
176
+ }
177
+ set ids(value) {
178
+ __stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(0, this));
179
+ }
180
+ _adoptStorage(value) {
181
+ __stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(1, this));
182
+ }
183
+ _disownStorage() {
184
+ return __stryke_capnp.utils.disown(this.storage);
185
+ }
186
+ get storage() {
187
+ return __stryke_capnp.utils.getList(1, FileSystem._Storage, this);
188
+ }
189
+ _hasStorage() {
190
+ return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(1, this));
191
+ }
192
+ _initStorage(length) {
193
+ return __stryke_capnp.utils.initList(1, FileSystem._Storage, length, this);
194
+ }
195
+ set storage(value) {
196
+ __stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(1, this));
197
+ }
198
+ _adoptMetadata(value) {
199
+ __stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(2, this));
200
+ }
201
+ _disownMetadata() {
202
+ return __stryke_capnp.utils.disown(this.metadata);
203
+ }
204
+ get metadata() {
205
+ return __stryke_capnp.utils.getList(2, FileSystem._Metadata, this);
206
+ }
207
+ _hasMetadata() {
208
+ return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(2, this));
209
+ }
210
+ _initMetadata(length) {
211
+ return __stryke_capnp.utils.initList(2, FileSystem._Metadata, length, this);
212
+ }
213
+ set metadata(value) {
214
+ __stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(2, this));
215
+ }
216
+ toString() {
217
+ return "FileSystem_" + super.toString();
218
+ }
219
+ };
220
+ FileMetadata._Properties = __stryke_capnp.CompositeList(FileMetadata_KeyValuePair);
221
+ FileSystem._Ids = __stryke_capnp.CompositeList(FileId);
222
+ FileSystem._Storage = __stryke_capnp.CompositeList(FileStorage);
223
+ FileSystem._Metadata = __stryke_capnp.CompositeList(FileMetadata);
224
+
225
+ //#endregion
226
+ exports.FileSystem = FileSystem;