@powerlines/plugin-env 0.15.122 → 0.15.124

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 (219) hide show
  1. package/dist/babel/plugin.cjs +11 -11
  2. package/dist/babel/plugin.d.cts +2 -2
  3. package/dist/babel/plugin.d.mts +2 -3
  4. package/dist/babel/plugin.mjs +5 -5
  5. package/dist/components/docs.cjs +6 -6
  6. package/dist/components/docs.d.cts +1 -1
  7. package/dist/components/docs.d.mts +1 -1
  8. package/dist/components/docs.mjs +3 -3
  9. package/dist/components/env.cjs +40 -40
  10. package/dist/components/env.d.cts +2 -2
  11. package/dist/components/env.d.mts +2 -2
  12. package/dist/components/env.mjs +11 -11
  13. package/dist/helpers/automd-generator.cjs +2 -2
  14. package/dist/helpers/automd-generator.d.cts +1 -1
  15. package/dist/helpers/automd-generator.d.mts +1 -1
  16. package/dist/helpers/automd-generator.mjs +1 -1
  17. package/dist/helpers/load.cjs +7 -7
  18. package/dist/helpers/load.mjs +8 -8
  19. package/dist/helpers/persistence.cjs +23 -23
  20. package/dist/helpers/persistence.d.cts +1 -1
  21. package/dist/helpers/persistence.d.mts +1 -1
  22. package/dist/helpers/persistence.mjs +5 -5
  23. package/dist/helpers/reflect.cjs +5 -5
  24. package/dist/helpers/reflect.mjs +1 -1
  25. package/dist/helpers/source-file-env.cjs +1 -1
  26. package/dist/helpers/source-file-env.mjs +1 -1
  27. package/dist/index.cjs +13 -10
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.mjs +12 -12
  31. package/dist/types/plugin.cjs +19 -18
  32. package/dist/types/plugin.d.cts +5 -6
  33. package/dist/types/plugin.d.mts +4 -6
  34. package/dist/types/plugin.mjs +4 -4
  35. package/package.json +7 -7
  36. package/dist/deepkit/schemas/reflection.cjs +0 -5426
  37. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  38. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  39. package/dist/deepkit/schemas/reflection.mjs +0 -5423
  40. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  41. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  42. package/dist/deepkit/src/capnp.cjs +0 -1692
  43. package/dist/deepkit/src/capnp.mjs +0 -1690
  44. package/dist/deepkit/src/esbuild-plugin.cjs +0 -99
  45. package/dist/deepkit/src/esbuild-plugin.mjs +0 -98
  46. package/dist/deepkit/src/reflect-type.cjs +0 -40
  47. package/dist/deepkit/src/reflect-type.mjs +0 -38
  48. package/dist/deepkit/src/resolve-reflections.cjs +0 -23
  49. package/dist/deepkit/src/resolve-reflections.mjs +0 -22
  50. package/dist/deepkit/src/transformer.cjs +0 -92
  51. package/dist/deepkit/src/transformer.mjs +0 -89
  52. package/dist/deepkit/src/transpile.cjs +0 -39
  53. package/dist/deepkit/src/transpile.mjs +0 -37
  54. package/dist/deepkit/src/types.cjs +0 -22
  55. package/dist/deepkit/src/types.d.cts +0 -10
  56. package/dist/deepkit/src/types.d.mts +0 -10
  57. package/dist/deepkit/src/types.mjs +0 -21
  58. package/dist/deepkit/src/utilities.cjs +0 -184
  59. package/dist/deepkit/src/utilities.mjs +0 -183
  60. package/dist/plugin-alloy/src/core/components/output.cjs +0 -43
  61. package/dist/plugin-alloy/src/core/components/output.mjs +0 -42
  62. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  63. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  64. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  65. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  66. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  67. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  68. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -134
  69. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -126
  70. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  71. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  72. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -110
  73. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -101
  74. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -23
  75. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -22
  76. package/dist/plugin-alloy/src/index.cjs +0 -105
  77. package/dist/plugin-alloy/src/index.mjs +0 -103
  78. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
  79. package/dist/plugin-alloy/src/markdown/components/markdown-file.d.cts +0 -8
  80. package/dist/plugin-alloy/src/markdown/components/markdown-file.d.mts +0 -8
  81. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
  82. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
  83. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
  84. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -72
  85. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -71
  86. package/dist/plugin-alloy/src/types/components.cjs +0 -22
  87. package/dist/plugin-alloy/src/types/components.d.cts +0 -20
  88. package/dist/plugin-alloy/src/types/components.d.mts +0 -21
  89. package/dist/plugin-alloy/src/types/components.mjs +0 -21
  90. package/dist/plugin-alloy/src/types/index.d.cts +0 -2
  91. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  92. package/dist/plugin-alloy/src/types/plugin.cjs +0 -53
  93. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  94. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  95. package/dist/plugin-alloy/src/types/plugin.mjs +0 -50
  96. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -62
  97. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -26
  98. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  99. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -61
  100. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -131
  101. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -129
  102. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -451
  103. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -37
  104. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -37
  105. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -442
  106. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -216
  107. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -16
  108. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -16
  109. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -213
  110. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -72
  111. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -12
  112. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
  113. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -71
  114. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  115. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  116. package/dist/plugin-automd/src/index.cjs +0 -127
  117. package/dist/plugin-automd/src/index.mjs +0 -124
  118. package/dist/plugin-automd/src/types/plugin.cjs +0 -47
  119. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  120. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  121. package/dist/plugin-automd/src/types/plugin.mjs +0 -47
  122. package/dist/plugin-automd/src/types/toc.cjs +0 -26
  123. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  124. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  125. package/dist/plugin-automd/src/types/toc.mjs +0 -25
  126. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -74
  127. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -70
  128. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -71
  129. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -69
  130. package/dist/plugin-babel/src/helpers/filters.cjs +0 -158
  131. package/dist/plugin-babel/src/helpers/filters.mjs +0 -154
  132. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  133. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  134. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -200
  135. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -192
  136. package/dist/plugin-babel/src/helpers/options.cjs +0 -73
  137. package/dist/plugin-babel/src/helpers/options.mjs +0 -70
  138. package/dist/plugin-babel/src/index.cjs +0 -125
  139. package/dist/plugin-babel/src/index.mjs +0 -123
  140. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  141. package/dist/plugin-babel/src/types/plugin.cjs +0 -42
  142. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  143. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  144. package/dist/plugin-babel/src/types/plugin.mjs +0 -39
  145. package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -136
  146. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  147. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  148. package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -134
  149. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -142
  150. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -140
  151. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  152. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  153. package/dist/powerlines/src/lib/entry.cjs +0 -195
  154. package/dist/powerlines/src/lib/entry.mjs +0 -194
  155. package/dist/powerlines/src/lib/logger.cjs +0 -108
  156. package/dist/powerlines/src/lib/logger.mjs +0 -106
  157. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -41
  158. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -40
  159. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -98
  160. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -97
  161. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -139
  162. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -138
  163. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -74
  164. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -72
  165. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -69
  166. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -68
  167. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -68
  168. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -66
  169. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -46
  170. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -45
  171. package/dist/powerlines/src/types/api.cjs +0 -62
  172. package/dist/powerlines/src/types/api.d.cts +0 -104
  173. package/dist/powerlines/src/types/api.d.mts +0 -104
  174. package/dist/powerlines/src/types/api.mjs +0 -62
  175. package/dist/powerlines/src/types/babel.cjs +0 -156
  176. package/dist/powerlines/src/types/babel.d.cts +0 -23
  177. package/dist/powerlines/src/types/babel.d.mts +0 -23
  178. package/dist/powerlines/src/types/babel.mjs +0 -147
  179. package/dist/powerlines/src/types/build.cjs +0 -127
  180. package/dist/powerlines/src/types/build.d.cts +0 -185
  181. package/dist/powerlines/src/types/build.d.mts +0 -185
  182. package/dist/powerlines/src/types/build.mjs +0 -121
  183. package/dist/powerlines/src/types/commands.cjs +0 -16
  184. package/dist/powerlines/src/types/commands.d.cts +0 -8
  185. package/dist/powerlines/src/types/commands.d.mts +0 -9
  186. package/dist/powerlines/src/types/commands.mjs +0 -15
  187. package/dist/powerlines/src/types/config.cjs +0 -420
  188. package/dist/powerlines/src/types/config.d.cts +0 -435
  189. package/dist/powerlines/src/types/config.d.mts +0 -436
  190. package/dist/powerlines/src/types/config.mjs +0 -397
  191. package/dist/powerlines/src/types/context.cjs +0 -388
  192. package/dist/powerlines/src/types/context.d.cts +0 -514
  193. package/dist/powerlines/src/types/context.d.mts +0 -514
  194. package/dist/powerlines/src/types/context.mjs +0 -371
  195. package/dist/powerlines/src/types/fs.cjs +0 -78
  196. package/dist/powerlines/src/types/fs.d.cts +0 -486
  197. package/dist/powerlines/src/types/fs.d.mts +0 -486
  198. package/dist/powerlines/src/types/fs.mjs +0 -75
  199. package/dist/powerlines/src/types/hooks.cjs +0 -71
  200. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  201. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  202. package/dist/powerlines/src/types/hooks.mjs +0 -68
  203. package/dist/powerlines/src/types/index.cjs +0 -11
  204. package/dist/powerlines/src/types/index.d.mts +0 -12
  205. package/dist/powerlines/src/types/index.mjs +0 -13
  206. package/dist/powerlines/src/types/plugin.cjs +0 -184
  207. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  208. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  209. package/dist/powerlines/src/types/plugin.mjs +0 -178
  210. package/dist/powerlines/src/types/resolved.cjs +0 -149
  211. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  212. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  213. package/dist/powerlines/src/types/resolved.mjs +0 -144
  214. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  215. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  216. package/dist/powerlines/src/types/unplugin.cjs +0 -64
  217. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  218. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
  219. package/dist/powerlines/src/types/unplugin.mjs +0 -62
@@ -1,123 +0,0 @@
1
- import { __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./types/plugin.mjs";
2
- import { createBabelPlugin } from "./helpers/create-plugin.mjs";
3
- import { __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./helpers/ast-utils.mjs";
4
- import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./helpers/module-helpers.mjs";
5
- import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./helpers/filters.mjs";
6
- import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.mjs";
7
- import "./helpers/index.mjs";
8
- import defu$1 from "defu";
9
- import { findFileExtension, findFileExtensionSafe } from "@stryke/path/file-path-fns";
10
- import { isSetObject } from "@stryke/type-checks/is-set-object";
11
- import { isParentPath } from "@stryke/path/is-parent-path";
12
- import { transformAsync } from "@babel/core";
13
-
14
- //#region ../plugin-babel/src/index.ts
15
- function __assignType(fn, args) {
16
- fn.__type = args;
17
- return fn;
18
- }
19
- /**
20
- * Babel plugin for Powerlines.
21
- *
22
- * @param options - The Babel plugin user configuration options.
23
- * @returns A Powerlines plugin that integrates Babel transformations.
24
- */
25
- const plugin = __assignType((options = {}) => {
26
- return {
27
- name: "babel",
28
- config: __assignType(function config() {
29
- if (!isSetObject(options)) return;
30
- return { transform: { babel: options } };
31
- }, ["config", "P\"/!"]),
32
- configResolved: {
33
- order: "pre",
34
- handler: __assignType(function handler() {
35
- this.config.transform.babel = defu$1(this.config.transform.babel ?? {}, {
36
- plugins: [],
37
- presets: []
38
- });
39
- }, ["handler", "P\"/!"])
40
- },
41
- async transform(code, id) {
42
- if (isParentPath(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
43
- this.trace(`Skipping Babel transformation for: ${id}`);
44
- return {
45
- code,
46
- id
47
- };
48
- }
49
- const plugins = this.config.transform.babel.plugins.map(__assignType((plugin$1) => resolveBabelPlugin(this, code, id, plugin$1), [
50
- "plugin",
51
- "",
52
- "P\"2!\"/\""
53
- ])).filter(__assignType((plugin$1, _, arr) => plugin$1 && !isDuplicatePlugin(arr, plugin$1), [
54
- "plugin",
55
- "_",
56
- "arr",
57
- "",
58
- "P\"2!\"2\"\"2#\"/$"
59
- ]));
60
- const presets = this.config.transform.babel.presets.map(__assignType((preset) => resolveBabelPlugin(this, code, id, preset), [
61
- "preset",
62
- "",
63
- "P\"2!\"/\""
64
- ])).filter(__assignType((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset), [
65
- "preset",
66
- "_",
67
- "arr",
68
- "",
69
- "P\"2!\"2\"\"2#\"/$"
70
- ]));
71
- if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
72
- code,
73
- id
74
- };
75
- if (/^(?:m|c)?tsx?$/.test(findFileExtensionSafe(id, { fullExtension: true })) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: findFileExtension(id) === "tsx" }]);
76
- this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
77
- const result = await transformAsync(code, {
78
- highlightCode: true,
79
- code: true,
80
- ast: false,
81
- cloneInputAst: false,
82
- comments: true,
83
- sourceType: "module",
84
- configFile: false,
85
- babelrc: false,
86
- envName: this.config.mode,
87
- caller: { name: this.config.framework },
88
- ...this.config.transform.babel ?? {},
89
- filename: id,
90
- plugins: plugins.map(__assignType((plugin$1) => {
91
- return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], defu$1(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
92
- }, [
93
- "plugin",
94
- "",
95
- "P\"2!\"/\""
96
- ])).filter(Boolean),
97
- presets: presets.map(__assignType((preset) => {
98
- return Array.isArray(preset) && preset.length >= 2 ? [preset[0], defu$1(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
99
- }, [
100
- "preset",
101
- "",
102
- "P\"2!\"/\""
103
- ])).filter(Boolean)
104
- });
105
- if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
106
- this.trace(`Completed babel transformations for file: ${id}`);
107
- return {
108
- code: result.code,
109
- id
110
- };
111
- }
112
- };
113
- }, [
114
- () => __ΩBabelPluginOptions,
115
- "options",
116
- () => ({}),
117
- "",
118
- "Pn!2\">#\"/$"
119
- ]);
120
- var src_default = plugin;
121
-
122
- //#endregion
123
- export { src_default as default };
@@ -1 +0,0 @@
1
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "./plugin.mjs";
@@ -1,42 +0,0 @@
1
- const require_config = require('../../../powerlines/src/types/config.cjs');
2
- const require_resolved = require('../../../powerlines/src/types/resolved.cjs');
3
- const require_context = require('../../../powerlines/src/types/context.cjs');
4
-
5
- //#region ../plugin-babel/src/types/plugin.ts
6
- const __ΩPartial = [
7
- "T",
8
- "Partial",
9
- "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
10
- ];
11
- const __ΩBabelPluginOptions = [
12
- () => __ΩPartial,
13
- () => require_config.__ΩBabelUserConfig,
14
- "BabelPluginOptions",
15
- "n\"o!\"w#y"
16
- ];
17
- const __ΩBabelPluginUserConfig = [
18
- () => require_config.__ΩUserConfig,
19
- "BabelPluginUserConfig",
20
- "n!w\"y"
21
- ];
22
- const __ΩBabelPluginResolvedConfig = [
23
- () => require_resolved.__ΩResolvedConfig,
24
- () => require_resolved.__ΩBabelResolvedConfig,
25
- "babel",
26
- "transform",
27
- "BabelPluginResolvedConfig",
28
- "Pn!Pn\"4#M4$Mw%y"
29
- ];
30
- const __ΩBabelPluginContext = [
31
- () => __ΩBabelPluginResolvedConfig,
32
- "TResolvedConfig",
33
- () => require_context.__ΩPluginContext,
34
- "BabelPluginContext",
35
- "n!c\"e!!o#\"w$y"
36
- ];
37
-
38
- //#endregion
39
- exports.__ΩBabelPluginContext = __ΩBabelPluginContext;
40
- exports.__ΩBabelPluginOptions = __ΩBabelPluginOptions;
41
- exports.__ΩBabelPluginResolvedConfig = __ΩBabelPluginResolvedConfig;
42
- exports.__ΩBabelPluginUserConfig = __ΩBabelPluginUserConfig;
@@ -1,15 +0,0 @@
1
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
2
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
3
- import { PluginContext } from "../../../powerlines/src/types/context.cjs";
4
-
5
- //#region ../plugin-babel/src/types/plugin.d.ts
6
- type BabelPluginOptions = Partial<BabelUserConfig>;
7
- type BabelPluginUserConfig = UserConfig;
8
- interface BabelPluginResolvedConfig extends ResolvedConfig {
9
- transform: {
10
- babel: BabelResolvedConfig;
11
- };
12
- }
13
- type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- //#endregion
15
- export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
@@ -1,15 +0,0 @@
1
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
2
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
3
- import { PluginContext } from "../../../powerlines/src/types/context.mjs";
4
-
5
- //#region ../plugin-babel/src/types/plugin.d.ts
6
- type BabelPluginOptions = Partial<BabelUserConfig>;
7
- type BabelPluginUserConfig = UserConfig;
8
- interface BabelPluginResolvedConfig extends ResolvedConfig {
9
- transform: {
10
- babel: BabelResolvedConfig;
11
- };
12
- }
13
- type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- //#endregion
15
- export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
@@ -1,39 +0,0 @@
1
- import { __ΩBabelUserConfig, __ΩUserConfig } from "../../../powerlines/src/types/config.mjs";
2
- import { __ΩBabelResolvedConfig, __ΩResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
3
- import { __ΩPluginContext } from "../../../powerlines/src/types/context.mjs";
4
-
5
- //#region ../plugin-babel/src/types/plugin.ts
6
- const __ΩPartial = [
7
- "T",
8
- "Partial",
9
- "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
10
- ];
11
- const __ΩBabelPluginOptions = [
12
- () => __ΩPartial,
13
- () => __ΩBabelUserConfig,
14
- "BabelPluginOptions",
15
- "n\"o!\"w#y"
16
- ];
17
- const __ΩBabelPluginUserConfig = [
18
- () => __ΩUserConfig,
19
- "BabelPluginUserConfig",
20
- "n!w\"y"
21
- ];
22
- const __ΩBabelPluginResolvedConfig = [
23
- () => __ΩResolvedConfig,
24
- () => __ΩBabelResolvedConfig,
25
- "babel",
26
- "transform",
27
- "BabelPluginResolvedConfig",
28
- "Pn!Pn\"4#M4$Mw%y"
29
- ];
30
- const __ΩBabelPluginContext = [
31
- () => __ΩBabelPluginResolvedConfig,
32
- "TResolvedConfig",
33
- () => __ΩPluginContext,
34
- "BabelPluginContext",
35
- "n!c\"e!!o#\"w$y"
36
- ];
37
-
38
- //#endregion
39
- export { __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig };
@@ -1,136 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_context = require('../../types/context.cjs');
3
- const require_hooks = require('../../types/hooks.cjs');
4
- let defu = require("defu");
5
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
6
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
7
- let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
8
- let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
9
- let chalk = require("chalk");
10
- chalk = require_rolldown_runtime.__toESM(chalk);
11
-
12
- //#region ../powerlines/src/internal/helpers/hooks.ts
13
- function __assignType(fn, args) {
14
- fn.__type = args;
15
- return fn;
16
- }
17
- const __ΩCallHookOptions = [
18
- () => require_context.__ΩSelectHooksOptions,
19
- true,
20
- "sequential",
21
- true,
22
- "Whether to call the hooks sequentially or in parallel.",
23
- "first",
24
- "result",
25
- "merge",
26
- "How to handle multiple return values from hooks.\n- \"merge\": Merge all non-undefined return values (if they are objects).\n- \"first\": Return the first non-undefined value.",
27
- "merge",
28
- "last",
29
- false,
30
- "previousResult",
31
- "",
32
- "asNextParam",
33
- "An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter",
34
- false,
35
- "CallHookOptions",
36
- "Pn!PPP.\"4#8>$?%MPP.&4'>(?)MPP.*.+J4'8>(?)P.,P\"2-!/.J4/8?0MJKP.14#?%MJKw2y"
37
- ];
38
- const mergeResults = (0, defu.createDefu)(__assignType((obj, key, value) => {
39
- if ((0, __stryke_type_checks_is_string.isString)(obj[key]) && (0, __stryke_type_checks_is_string.isString)(value)) {
40
- obj[key] = `${obj[key] || ""}\n${value || ""}`.trim();
41
- return true;
42
- }
43
- return false;
44
- }, [
45
- "obj",
46
- "key",
47
- "value",
48
- "",
49
- "P\"2!\"g2\"\"2#\"/$"
50
- ]));
51
- /**
52
- * Calls a hook with the given context, options, and arguments.
53
- *
54
- * @param context - The context to use when calling the hook.
55
- * @param key - The hook to call.
56
- * @param options - Options for calling the hook.
57
- * @param args - Arguments to pass to the hook.
58
- * @returns The return value of the hook.
59
- */
60
- async function callHook(context, key, options, ...args) {
61
- const hooks = context.selectHooks(key, options);
62
- if (hooks.length > 0) {
63
- context.debug(` 🧩 Calling plugin hook: ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
64
- const invokeHook = __assignType(async (hook, hookArgs) => {
65
- return Reflect.apply(hook.handler, hook.context, hookArgs);
66
- }, [
67
- "hook",
68
- () => require_hooks.__ΩInferHookParameters,
69
- () => require_context.__ΩPluginContext,
70
- () => context,
71
- () => require_context.__ΩEnvironmentContext,
72
- () => args,
73
- () => require_hooks.__ΩInferHookParameters,
74
- () => require_context.__ΩPluginContext,
75
- () => args,
76
- () => require_hooks.__ΩInferHookParameters,
77
- () => require_context.__ΩPluginContext,
78
- "hookArgs",
79
- "",
80
- "P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
81
- ]);
82
- let results = [];
83
- if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
84
- if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
85
- return invokeHook(hook, [...args]);
86
- }, [
87
- "hook",
88
- "",
89
- "P\"2!\"/\""
90
- ])));
91
- else for (const hook of hooks) {
92
- if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
93
- if (options?.result === "first" || options?.asNextParam === false) {
94
- results.push(await Promise.resolve(invokeHook(hook, [...args])));
95
- if (options?.result === "first" && (0, __stryke_type_checks_is_set.isSet)(results[results.length - 1])) break;
96
- } else {
97
- const sequenceArgs = [...args];
98
- if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = (0, __stryke_type_checks_is_function.isFunction)(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
99
- const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
100
- if (result) {
101
- if (options?.result === "last") results = [result];
102
- else if ((0, __stryke_type_checks_is_string.isString)(result)) results = [`${(0, __stryke_type_checks_is_string.isString)(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
103
- else if ((0, __stryke_type_checks_is_object.isObject)(result)) results = [mergeResults(result, results[0] ?? {})];
104
- }
105
- }
106
- }
107
- const definedResults = results.filter(__assignType((result) => (0, __stryke_type_checks_is_set.isSet)(result), [
108
- "result",
109
- "",
110
- "P\"2!!/\""
111
- ]));
112
- if (definedResults.length > 0) {
113
- let mergedResult = void 0;
114
- for (const result of definedResults) mergedResult = (0, defu.defu)(result, mergedResult ?? {});
115
- return mergedResult;
116
- }
117
- }
118
- }
119
- callHook.__type = [
120
- () => require_context.__ΩEnvironmentContext,
121
- "context",
122
- "key",
123
- () => __ΩCallHookOptions,
124
- "options",
125
- () => require_hooks.__ΩInferHookParameters,
126
- () => require_context.__ΩPluginContext,
127
- "args",
128
- () => require_hooks.__ΩInferHookReturnType,
129
- () => require_context.__ΩPluginContext,
130
- "callHook",
131
- "Calls a hook with the given context, options, and arguments.",
132
- "P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
133
- ];
134
-
135
- //#endregion
136
- exports.__ΩCallHookOptions = __ΩCallHookOptions;
@@ -1,47 +0,0 @@
1
- import { SelectHooksOptions } from "../../types/context.cjs";
2
- import { MaybePromise } from "@stryke/types/base";
3
-
4
- //#region ../powerlines/src/internal/helpers/hooks.d.ts
5
- type CallHookOptions = SelectHooksOptions & (({
6
- /**
7
- * Whether to call the hooks sequentially or in parallel.
8
- *
9
- * @defaultValue true
10
- */
11
- sequential?: true;
12
- } & ({
13
- /**
14
- * How to handle multiple return values from hooks.
15
- * - "merge": Merge all non-undefined return values (if they are objects).
16
- * - "first": Return the first non-undefined value.
17
- *
18
- * @remarks
19
- * Merging only works if the return values are objects.
20
- *
21
- * @defaultValue "merge"
22
- */
23
- result: "first";
24
- } | {
25
- /**
26
- * How to handle multiple return values from hooks.
27
- * - "merge": Merge all non-undefined return values (if they are objects).
28
- * - "first": Return the first non-undefined value.
29
- *
30
- * @remarks
31
- * Merging only works if the return values are objects.
32
- *
33
- * @defaultValue "merge"
34
- */
35
- result?: "merge" | "last";
36
- /**
37
- * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
38
- */
39
- asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
40
- })) | {
41
- /**
42
- * Whether to call the hooks sequentially or in parallel.
43
- */
44
- sequential: false;
45
- });
46
- //#endregion
47
- export { CallHookOptions };
@@ -1,49 +0,0 @@
1
- import "../../types/hooks.mjs";
2
- import "../../types/resolved.mjs";
3
- import { SelectHooksOptions } from "../../types/context.mjs";
4
- import { MaybePromise } from "@stryke/types/base";
5
-
6
- //#region ../powerlines/src/internal/helpers/hooks.d.ts
7
- type CallHookOptions = SelectHooksOptions & (({
8
- /**
9
- * Whether to call the hooks sequentially or in parallel.
10
- *
11
- * @defaultValue true
12
- */
13
- sequential?: true;
14
- } & ({
15
- /**
16
- * How to handle multiple return values from hooks.
17
- * - "merge": Merge all non-undefined return values (if they are objects).
18
- * - "first": Return the first non-undefined value.
19
- *
20
- * @remarks
21
- * Merging only works if the return values are objects.
22
- *
23
- * @defaultValue "merge"
24
- */
25
- result: "first";
26
- } | {
27
- /**
28
- * How to handle multiple return values from hooks.
29
- * - "merge": Merge all non-undefined return values (if they are objects).
30
- * - "first": Return the first non-undefined value.
31
- *
32
- * @remarks
33
- * Merging only works if the return values are objects.
34
- *
35
- * @defaultValue "merge"
36
- */
37
- result?: "merge" | "last";
38
- /**
39
- * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
40
- */
41
- asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
42
- })) | {
43
- /**
44
- * Whether to call the hooks sequentially or in parallel.
45
- */
46
- sequential: false;
47
- });
48
- //#endregion
49
- export { CallHookOptions };
@@ -1,134 +0,0 @@
1
- import { __ΩEnvironmentContext, __ΩPluginContext, __ΩSelectHooksOptions } from "../../types/context.mjs";
2
- import { __ΩInferHookParameters, __ΩInferHookReturnType } from "../../types/hooks.mjs";
3
- import { createDefu, defu } from "defu";
4
- import { isString } from "@stryke/type-checks/is-string";
5
- import { isFunction } from "@stryke/type-checks/is-function";
6
- import { isObject } from "@stryke/type-checks/is-object";
7
- import { isSet } from "@stryke/type-checks/is-set";
8
- import chalk from "chalk";
9
-
10
- //#region ../powerlines/src/internal/helpers/hooks.ts
11
- function __assignType(fn, args) {
12
- fn.__type = args;
13
- return fn;
14
- }
15
- const __ΩCallHookOptions = [
16
- () => __ΩSelectHooksOptions,
17
- true,
18
- "sequential",
19
- true,
20
- "Whether to call the hooks sequentially or in parallel.",
21
- "first",
22
- "result",
23
- "merge",
24
- "How to handle multiple return values from hooks.\n- \"merge\": Merge all non-undefined return values (if they are objects).\n- \"first\": Return the first non-undefined value.",
25
- "merge",
26
- "last",
27
- false,
28
- "previousResult",
29
- "",
30
- "asNextParam",
31
- "An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter",
32
- false,
33
- "CallHookOptions",
34
- "Pn!PPP.\"4#8>$?%MPP.&4'>(?)MPP.*.+J4'8>(?)P.,P\"2-!/.J4/8?0MJKP.14#?%MJKw2y"
35
- ];
36
- const mergeResults = createDefu(__assignType((obj, key, value) => {
37
- if (isString(obj[key]) && isString(value)) {
38
- obj[key] = `${obj[key] || ""}\n${value || ""}`.trim();
39
- return true;
40
- }
41
- return false;
42
- }, [
43
- "obj",
44
- "key",
45
- "value",
46
- "",
47
- "P\"2!\"g2\"\"2#\"/$"
48
- ]));
49
- /**
50
- * Calls a hook with the given context, options, and arguments.
51
- *
52
- * @param context - The context to use when calling the hook.
53
- * @param key - The hook to call.
54
- * @param options - Options for calling the hook.
55
- * @param args - Arguments to pass to the hook.
56
- * @returns The return value of the hook.
57
- */
58
- async function callHook(context, key, options, ...args) {
59
- const hooks = context.selectHooks(key, options);
60
- if (hooks.length > 0) {
61
- context.debug(` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
62
- const invokeHook = __assignType(async (hook, hookArgs) => {
63
- return Reflect.apply(hook.handler, hook.context, hookArgs);
64
- }, [
65
- "hook",
66
- () => __ΩInferHookParameters,
67
- () => __ΩPluginContext,
68
- () => context,
69
- () => __ΩEnvironmentContext,
70
- () => args,
71
- () => __ΩInferHookParameters,
72
- () => __ΩPluginContext,
73
- () => args,
74
- () => __ΩInferHookParameters,
75
- () => __ΩPluginContext,
76
- "hookArgs",
77
- "",
78
- "P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
79
- ]);
80
- let results = [];
81
- if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
82
- if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
83
- return invokeHook(hook, [...args]);
84
- }, [
85
- "hook",
86
- "",
87
- "P\"2!\"/\""
88
- ])));
89
- else for (const hook of hooks) {
90
- if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
91
- if (options?.result === "first" || options?.asNextParam === false) {
92
- results.push(await Promise.resolve(invokeHook(hook, [...args])));
93
- if (options?.result === "first" && isSet(results[results.length - 1])) break;
94
- } else {
95
- const sequenceArgs = [...args];
96
- if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
97
- const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
98
- if (result) {
99
- if (options?.result === "last") results = [result];
100
- else if (isString(result)) results = [`${isString(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
101
- else if (isObject(result)) results = [mergeResults(result, results[0] ?? {})];
102
- }
103
- }
104
- }
105
- const definedResults = results.filter(__assignType((result) => isSet(result), [
106
- "result",
107
- "",
108
- "P\"2!!/\""
109
- ]));
110
- if (definedResults.length > 0) {
111
- let mergedResult = void 0;
112
- for (const result of definedResults) mergedResult = defu(result, mergedResult ?? {});
113
- return mergedResult;
114
- }
115
- }
116
- }
117
- callHook.__type = [
118
- () => __ΩEnvironmentContext,
119
- "context",
120
- "key",
121
- () => __ΩCallHookOptions,
122
- "options",
123
- () => __ΩInferHookParameters,
124
- () => __ΩPluginContext,
125
- "args",
126
- () => __ΩInferHookReturnType,
127
- () => __ΩPluginContext,
128
- "callHook",
129
- "Calls a hook with the given context, options, and arguments.",
130
- "P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
131
- ];
132
-
133
- //#endregion
134
- export { __ΩCallHookOptions };