@powerlines/plugin-nodejs 0.1.117 → 0.1.119

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 (194) hide show
  1. package/dist/components/env.cjs +14 -14
  2. package/dist/components/env.d.cts +1 -1
  3. package/dist/components/env.d.mts +1 -1
  4. package/dist/components/env.mjs +6 -6
  5. package/dist/index.cjs +8 -6
  6. package/dist/index.d.cts +1 -1
  7. package/dist/index.d.mts +1 -1
  8. package/dist/index.mjs +5 -5
  9. package/dist/types/plugin.d.cts +2 -2
  10. package/dist/types/plugin.d.mts +2 -2
  11. package/package.json +6 -6
  12. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  13. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  14. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  15. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  16. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  17. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  18. package/dist/deepkit/src/capnp.cjs +0 -913
  19. package/dist/deepkit/src/capnp.mjs +0 -911
  20. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  21. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  22. package/dist/deepkit/src/reflect-type.cjs +0 -22
  23. package/dist/deepkit/src/reflect-type.mjs +0 -20
  24. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  25. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  26. package/dist/deepkit/src/transformer.cjs +0 -52
  27. package/dist/deepkit/src/transformer.mjs +0 -49
  28. package/dist/deepkit/src/transpile.cjs +0 -29
  29. package/dist/deepkit/src/transpile.mjs +0 -27
  30. package/dist/deepkit/src/types.d.cts +0 -10
  31. package/dist/deepkit/src/types.d.mts +0 -10
  32. package/dist/deepkit/src/utilities.cjs +0 -67
  33. package/dist/deepkit/src/utilities.mjs +0 -66
  34. package/dist/plugin-alloy/src/core/components/output.cjs +0 -43
  35. package/dist/plugin-alloy/src/core/components/output.mjs +0 -42
  36. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  37. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  38. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  39. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  40. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  41. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  42. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -49
  43. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -44
  44. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  45. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  46. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  47. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  48. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  49. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  50. package/dist/plugin-alloy/src/index.cjs +0 -105
  51. package/dist/plugin-alloy/src/index.mjs +0 -103
  52. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
  53. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
  54. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
  55. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
  56. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  57. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  58. package/dist/plugin-alloy/src/types/components.d.cts +0 -20
  59. package/dist/plugin-alloy/src/types/components.d.mts +0 -21
  60. package/dist/plugin-alloy/src/types/index.d.cts +0 -2
  61. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  62. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  63. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  64. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -62
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -26
  66. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  67. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -61
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -131
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -129
  70. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -451
  71. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -37
  72. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -37
  73. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -442
  74. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -216
  75. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -16
  76. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -16
  77. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -213
  78. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -72
  79. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -4
  80. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -4
  81. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -71
  82. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  83. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  84. package/dist/plugin-automd/src/index.cjs +0 -101
  85. package/dist/plugin-automd/src/index.mjs +0 -98
  86. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  87. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  88. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  89. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  90. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  91. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  92. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  93. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  94. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  95. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  96. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  97. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  98. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  99. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  100. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  101. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  102. package/dist/plugin-babel/src/index.cjs +0 -85
  103. package/dist/plugin-babel/src/index.mjs +0 -83
  104. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  105. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  106. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  107. package/dist/plugin-env/src/babel/index.cjs +0 -1
  108. package/dist/plugin-env/src/babel/index.mjs +0 -3
  109. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  110. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  111. package/dist/plugin-env/src/components/docs.cjs +0 -70
  112. package/dist/plugin-env/src/components/docs.mjs +0 -69
  113. package/dist/plugin-env/src/components/env.cjs +0 -589
  114. package/dist/plugin-env/src/components/env.d.cts +0 -11
  115. package/dist/plugin-env/src/components/env.d.mts +0 -11
  116. package/dist/plugin-env/src/components/env.mjs +0 -586
  117. package/dist/plugin-env/src/components/index.cjs +0 -2
  118. package/dist/plugin-env/src/components/index.mjs +0 -4
  119. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  120. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  121. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  122. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  123. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  124. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  125. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  126. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  127. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  128. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  129. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  130. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  131. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  132. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  133. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  134. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  135. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  136. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  137. package/dist/plugin-env/src/index.cjs +0 -177
  138. package/dist/plugin-env/src/index.mjs +0 -175
  139. package/dist/plugin-env/src/types/plugin.d.cts +0 -149
  140. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  141. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  142. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  143. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  144. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  145. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  146. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  147. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  148. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  149. package/dist/powerlines/src/lib/entry.cjs +0 -11
  150. package/dist/powerlines/src/lib/entry.mjs +0 -13
  151. package/dist/powerlines/src/lib/logger.cjs +0 -41
  152. package/dist/powerlines/src/lib/logger.mjs +0 -39
  153. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -38
  154. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -35
  155. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  156. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  157. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  158. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  159. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  160. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  161. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  162. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  163. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  164. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  165. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  166. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  167. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  168. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  169. package/dist/powerlines/src/types/api.d.cts +0 -104
  170. package/dist/powerlines/src/types/api.d.mts +0 -104
  171. package/dist/powerlines/src/types/babel.d.cts +0 -22
  172. package/dist/powerlines/src/types/babel.d.mts +0 -22
  173. package/dist/powerlines/src/types/build.cjs +0 -21
  174. package/dist/powerlines/src/types/build.d.cts +0 -185
  175. package/dist/powerlines/src/types/build.d.mts +0 -185
  176. package/dist/powerlines/src/types/build.mjs +0 -21
  177. package/dist/powerlines/src/types/commands.d.cts +0 -8
  178. package/dist/powerlines/src/types/commands.d.mts +0 -9
  179. package/dist/powerlines/src/types/config.d.cts +0 -435
  180. package/dist/powerlines/src/types/config.d.mts +0 -436
  181. package/dist/powerlines/src/types/context.d.cts +0 -514
  182. package/dist/powerlines/src/types/context.d.mts +0 -514
  183. package/dist/powerlines/src/types/fs.d.cts +0 -486
  184. package/dist/powerlines/src/types/fs.d.mts +0 -486
  185. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  186. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  187. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  188. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  189. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  190. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  191. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  192. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  193. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  194. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,46 +0,0 @@
1
- import { getPluginName } from "./filters.mjs";
2
- import { isFunction } from "@stryke/type-checks/is-function";
3
- import chalk from "chalk";
4
-
5
- //#region ../plugin-babel/src/helpers/options.ts
6
- function resolvePluginFunction(context, plugin) {
7
- try {
8
- return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? isFunction(plugin[0]) ? plugin[0](context) : plugin[0] : isFunction(plugin) ? plugin(context) : plugin;
9
- } catch {
10
- return plugin[0];
11
- }
12
- }
13
- /**
14
- * Resolve the [Babel](https://babeljs.io/) plugin.
15
- *
16
- * @param context - The context for the transformation.
17
- * @param code - The code to be transformed.
18
- * @param id - The ID of the source file.
19
- * @param plugin - The Babel plugin to resolve.
20
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
21
- */
22
- function resolveBabelPlugin(context, code, id, plugin) {
23
- if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
24
- if (plugin.length > 2 && plugin[2] && isFunction(plugin[2]) && !plugin[2](code, id)) {
25
- context.trace(`Skipping filtered Babel plugin ${chalk.bold.cyanBright(getPluginName(plugin) || "unnamed")} for ${id}`);
26
- return;
27
- }
28
- return plugin.length > 2 ? [
29
- resolvePluginFunction(context, plugin),
30
- plugin[1],
31
- plugin[2]
32
- ] : [
33
- resolvePluginFunction(context, plugin),
34
- plugin[1],
35
- null
36
- ];
37
- }
38
- return [
39
- resolvePluginFunction(context, plugin),
40
- {},
41
- null
42
- ];
43
- }
44
-
45
- //#endregion
46
- export { resolveBabelPlugin, resolvePluginFunction };
@@ -1,85 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_filters = require('./helpers/filters.cjs');
3
- const require_options = require('./helpers/options.cjs');
4
- const require_create_plugin = require('./helpers/create-plugin.cjs');
5
- const require_module_helpers = require('./helpers/module-helpers.cjs');
6
- require('./helpers/index.cjs');
7
- let __babel_core = require("@babel/core");
8
- let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
9
- let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
10
- let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
11
- let defu = require("defu");
12
- defu = require_rolldown_runtime.__toESM(defu);
13
-
14
- //#region ../plugin-babel/src/index.ts
15
- /**
16
- * Babel plugin for Powerlines.
17
- *
18
- * @param options - The Babel plugin user configuration options.
19
- * @returns A Powerlines plugin that integrates Babel transformations.
20
- */
21
- const plugin = (options = {}) => {
22
- return {
23
- name: "babel",
24
- config() {
25
- if (!(0, __stryke_type_checks_is_set_object.isSetObject)(options)) return;
26
- return { transform: { babel: options } };
27
- },
28
- configResolved: {
29
- order: "pre",
30
- handler() {
31
- this.config.transform.babel = (0, defu.default)(this.config.transform.babel ?? {}, {
32
- plugins: [],
33
- presets: []
34
- });
35
- }
36
- },
37
- async transform(code, id) {
38
- if ((0, __stryke_path_is_parent_path.isParentPath)(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
39
- this.trace(`Skipping Babel transformation for: ${id}`);
40
- return {
41
- code,
42
- id
43
- };
44
- }
45
- const plugins = this.config.transform.babel.plugins.map((plugin$1) => require_options.resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !require_filters.isDuplicatePlugin(arr, plugin$1));
46
- const presets = this.config.transform.babel.presets.map((preset) => require_options.resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !require_filters.isDuplicatePlugin(arr, preset));
47
- if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
48
- code,
49
- id
50
- };
51
- if (/^(?:m|c)?tsx?$/.test((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true })) && !require_filters.isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !require_filters.isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === "tsx" }]);
52
- this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
53
- const result = await (0, __babel_core.transformAsync)(code, {
54
- highlightCode: true,
55
- code: true,
56
- ast: false,
57
- cloneInputAst: false,
58
- comments: true,
59
- sourceType: "module",
60
- configFile: false,
61
- babelrc: false,
62
- envName: this.config.mode,
63
- caller: { name: this.config.framework },
64
- ...this.config.transform.babel ?? {},
65
- filename: id,
66
- plugins: plugins.map((plugin$1) => {
67
- return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], (0, defu.default)(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
68
- }).filter(Boolean),
69
- presets: presets.map((preset) => {
70
- return Array.isArray(preset) && preset.length >= 2 ? [preset[0], (0, defu.default)(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
71
- }).filter(Boolean)
72
- });
73
- if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
74
- this.trace(`Completed babel transformations for file: ${id}`);
75
- return {
76
- code: result.code,
77
- id
78
- };
79
- }
80
- };
81
- };
82
- var src_default = plugin;
83
-
84
- //#endregion
85
- exports.default = src_default;
@@ -1,83 +0,0 @@
1
- import { getPluginName, isDuplicatePlugin } from "./helpers/filters.mjs";
2
- import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.mjs";
3
- import { createBabelPlugin } from "./helpers/create-plugin.mjs";
4
- import { addImport, addImportsToProgram } from "./helpers/module-helpers.mjs";
5
- import "./helpers/index.mjs";
6
- import { transformAsync } from "@babel/core";
7
- import { findFileExtension, findFileExtensionSafe } from "@stryke/path/file-path-fns";
8
- import { isParentPath } from "@stryke/path/is-parent-path";
9
- import { isSetObject } from "@stryke/type-checks/is-set-object";
10
- import defu from "defu";
11
-
12
- //#region ../plugin-babel/src/index.ts
13
- /**
14
- * Babel plugin for Powerlines.
15
- *
16
- * @param options - The Babel plugin user configuration options.
17
- * @returns A Powerlines plugin that integrates Babel transformations.
18
- */
19
- const plugin = (options = {}) => {
20
- return {
21
- name: "babel",
22
- config() {
23
- if (!isSetObject(options)) return;
24
- return { transform: { babel: options } };
25
- },
26
- configResolved: {
27
- order: "pre",
28
- handler() {
29
- this.config.transform.babel = defu(this.config.transform.babel ?? {}, {
30
- plugins: [],
31
- presets: []
32
- });
33
- }
34
- },
35
- async transform(code, id) {
36
- if (isParentPath(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
37
- this.trace(`Skipping Babel transformation for: ${id}`);
38
- return {
39
- code,
40
- id
41
- };
42
- }
43
- const plugins = this.config.transform.babel.plugins.map((plugin$1) => resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !isDuplicatePlugin(arr, plugin$1));
44
- const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
45
- if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
46
- code,
47
- id
48
- };
49
- 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" }]);
50
- this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
51
- const result = await transformAsync(code, {
52
- highlightCode: true,
53
- code: true,
54
- ast: false,
55
- cloneInputAst: false,
56
- comments: true,
57
- sourceType: "module",
58
- configFile: false,
59
- babelrc: false,
60
- envName: this.config.mode,
61
- caller: { name: this.config.framework },
62
- ...this.config.transform.babel ?? {},
63
- filename: id,
64
- plugins: plugins.map((plugin$1) => {
65
- return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], defu(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
66
- }).filter(Boolean),
67
- presets: presets.map((preset) => {
68
- return Array.isArray(preset) && preset.length >= 2 ? [preset[0], defu(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
69
- }).filter(Boolean)
70
- });
71
- if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
72
- this.trace(`Completed babel transformations for file: ${id}`);
73
- return {
74
- code: result.code,
75
- id
76
- };
77
- }
78
- };
79
- };
80
- var src_default = plugin;
81
-
82
- //#endregion
83
- export { src_default as default };
@@ -1 +0,0 @@
1
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "./plugin.mjs";
@@ -1,15 +0,0 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
3
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.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 { PluginContext } from "../../../powerlines/src/types/context.mjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
3
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.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 +0,0 @@
1
- const require_plugin = require('./plugin.cjs');
@@ -1,3 +0,0 @@
1
- import { envBabelPlugin } from "./plugin.mjs";
2
-
3
- export { };
@@ -1,70 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_create_plugin = require('../../../plugin-babel/src/helpers/create-plugin.cjs');
3
- const require_module_helpers = require('../../../plugin-babel/src/helpers/module-helpers.cjs');
4
- const require_utilities = require('../../../deepkit/src/utilities.cjs');
5
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
6
-
7
- //#region ../plugin-env/src/babel/plugin.ts
8
- const envBabelPlugin = require_create_plugin.createBabelPlugin("env", ({ log, context }) => {
9
- function extractEnv(node, pass, isInjectable = false) {
10
- const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
11
- if (node.name) {
12
- const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
13
- let name = node.name;
14
- if (prefix) name = node.name.replace(`${prefix}_`, "");
15
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
16
- if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
17
- const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
18
- if (!envProperty || envProperty.isIgnored()) return;
19
- if (!context.env.used.env.hasProperty(name)) {
20
- log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
21
- context.env.used.env.addProperty(envProperty.property);
22
- }
23
- if (context.config.env.inject && isInjectable) {
24
- let value = context.env.parsed?.[name];
25
- if (value === void 0) {
26
- const prefix$1 = context.config.env.prefix.find((pre) => {
27
- return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
28
- });
29
- if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
30
- }
31
- value ??= envProperty.getDefaultValue();
32
- if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
33
- return require_utilities.stringifyDefaultValue(envProperty, value);
34
- }
35
- } else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
36
-
37
- The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
38
- }
39
- }
40
- return { visitor: { MemberExpression(path, pass) {
41
- if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
42
- const identifier = path.get("property")?.node;
43
- if (!identifier.name) return;
44
- extractEnv(identifier, pass, false);
45
- path.replaceWithSourceString(`env.${identifier.name}`);
46
- require_module_helpers.addImport(path, {
47
- module: `${context.config.framework || "powerlines"}:env`,
48
- name: "env",
49
- imported: "env"
50
- });
51
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
52
- const identifier = path.get("property")?.node;
53
- if (!identifier.name) return;
54
- extractEnv(identifier, pass, false);
55
- path.replaceWithSourceString(`env.${identifier.name}`);
56
- require_module_helpers.addImport(path, {
57
- module: `${context.config.framework || "powerlines"}:env`,
58
- name: "env",
59
- imported: "env"
60
- });
61
- } else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
62
- const identifier = path.get("property")?.node;
63
- if (!identifier.name) return;
64
- extractEnv(identifier, pass, false);
65
- }
66
- } } };
67
- });
68
-
69
- //#endregion
70
- exports.envBabelPlugin = envBabelPlugin;
@@ -1,69 +0,0 @@
1
- import { createBabelPlugin } from "../../../plugin-babel/src/helpers/create-plugin.mjs";
2
- import { addImport } from "../../../plugin-babel/src/helpers/module-helpers.mjs";
3
- import { stringifyDefaultValue } from "../../../deepkit/src/utilities.mjs";
4
- import { LogLevelLabel } from "@storm-software/config-tools/types";
5
-
6
- //#region ../plugin-env/src/babel/plugin.ts
7
- const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
8
- function extractEnv(node, pass, isInjectable = false) {
9
- const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
10
- if (node.name) {
11
- const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
12
- let name = node.name;
13
- if (prefix) name = node.name.replace(`${prefix}_`, "");
14
- log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
15
- if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
16
- const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
17
- if (!envProperty || envProperty.isIgnored()) return;
18
- if (!context.env.used.env.hasProperty(name)) {
19
- log(LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
20
- context.env.used.env.addProperty(envProperty.property);
21
- }
22
- if (context.config.env.inject && isInjectable) {
23
- let value = context.env.parsed?.[name];
24
- if (value === void 0) {
25
- const prefix$1 = context.config.env.prefix.find((pre) => {
26
- return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
27
- });
28
- if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
29
- }
30
- value ??= envProperty.getDefaultValue();
31
- if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
32
- return stringifyDefaultValue(envProperty, value);
33
- }
34
- } else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
35
-
36
- The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
37
- }
38
- }
39
- return { visitor: { MemberExpression(path, pass) {
40
- if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
41
- const identifier = path.get("property")?.node;
42
- if (!identifier.name) return;
43
- extractEnv(identifier, pass, false);
44
- path.replaceWithSourceString(`env.${identifier.name}`);
45
- addImport(path, {
46
- module: `${context.config.framework || "powerlines"}:env`,
47
- name: "env",
48
- imported: "env"
49
- });
50
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
51
- const identifier = path.get("property")?.node;
52
- if (!identifier.name) return;
53
- extractEnv(identifier, pass, false);
54
- path.replaceWithSourceString(`env.${identifier.name}`);
55
- addImport(path, {
56
- module: `${context.config.framework || "powerlines"}:env`,
57
- name: "env",
58
- imported: "env"
59
- });
60
- } else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
61
- const identifier = path.get("property")?.node;
62
- if (!identifier.name) return;
63
- extractEnv(identifier, pass, false);
64
- }
65
- } } };
66
- });
67
-
68
- //#endregion
69
- export { envBabelPlugin };
@@ -1,70 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_context = require('../../../plugin-alloy/src/core/contexts/context.cjs');
3
- const require_markdown_file = require('../../../plugin-alloy/src/markdown/components/markdown-file.cjs');
4
- const require_markdown_table = require('../../../plugin-alloy/src/markdown/components/markdown-table.cjs');
5
- const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
6
- const require_docs_helper = require('../helpers/docs-helper.cjs');
7
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
9
- let __alloy_js_core = require("@alloy-js/core");
10
- let __stryke_path_join = require("@stryke/path/join");
11
- let __alloy_js_markdown = require("@alloy-js/markdown");
12
-
13
- //#region ../plugin-env/src/components/docs.tsx
14
- /**
15
- * Generates the environment configuration markdown documentation for the Powerlines project.
16
- */
17
- function EnvDocsFile(props) {
18
- const { levelOffset = 0, ...rest } = props;
19
- const context = require_context.usePowerlinesSafe();
20
- if (!context) return null;
21
- const reflection = require_create_reflection_resource.createReflectionResource(context);
22
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_markdown_file.MarkdownFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get path() {
23
- return (0, __stryke_path_join.joinPaths)(require_docs_helper.getDocsOutputPath(context), "env.md");
24
- } }, rest, { get children() {
25
- return [
26
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
27
- level: 1 + levelOffset,
28
- children: "Environment Configuration"
29
- }),
30
- __alloy_js_core.code`Below is a list of environment variables used by the`,
31
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
32
- get when() {
33
- return !!context?.packageJson.name;
34
- },
35
- get children() {
36
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Link, {
37
- get href() {
38
- return `https://www.npmjs.com/package/${context?.packageJson.name}`;
39
- },
40
- get title() {
41
- return context.packageJson.name;
42
- }
43
- });
44
- }
45
- }),
46
- __alloy_js_core.code`package. These values can be updated in the \`.env\` file in the root of the project.`,
47
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
48
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
49
- level: 2 + levelOffset,
50
- children: "Environment Variables"
51
- }),
52
- __alloy_js_core.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
53
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
54
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_markdown_table.MarkdownTable, { get data() {
55
- return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
56
- return {
57
- name: reflectionProperty.getNameAsString().trim(),
58
- description: (reflectionProperty.getDescription() ?? "").trim(),
59
- type: (0, __powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
60
- defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
61
- required: reflectionProperty.isValueRequired() ? "" : "✔"
62
- };
63
- }) ?? [];
64
- } })
65
- ];
66
- } }));
67
- }
68
-
69
- //#endregion
70
- exports.EnvDocsFile = EnvDocsFile;
@@ -1,69 +0,0 @@
1
- import { usePowerlinesSafe } from "../../../plugin-alloy/src/core/contexts/context.mjs";
2
- import { MarkdownFile } from "../../../plugin-alloy/src/markdown/components/markdown-file.mjs";
3
- import { MarkdownTable } from "../../../plugin-alloy/src/markdown/components/markdown-table.mjs";
4
- import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
5
- import { getDocsOutputPath } from "../helpers/docs-helper.mjs";
6
- import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
7
- import { stringifyType } from "@powerlines/deepkit/vendor/type";
8
- import { Show, code } from "@alloy-js/core";
9
- import { joinPaths } from "@stryke/path/join";
10
- import { Heading, Link } from "@alloy-js/markdown";
11
-
12
- //#region ../plugin-env/src/components/docs.tsx
13
- /**
14
- * Generates the environment configuration markdown documentation for the Powerlines project.
15
- */
16
- function EnvDocsFile(props) {
17
- const { levelOffset = 0, ...rest } = props;
18
- const context = usePowerlinesSafe();
19
- if (!context) return null;
20
- const reflection = createReflectionResource(context);
21
- return createComponent(MarkdownFile, mergeProps({ get path() {
22
- return joinPaths(getDocsOutputPath(context), "env.md");
23
- } }, rest, { get children() {
24
- return [
25
- createComponent(Heading, {
26
- level: 1 + levelOffset,
27
- children: "Environment Configuration"
28
- }),
29
- code`Below is a list of environment variables used by the`,
30
- createComponent(Show, {
31
- get when() {
32
- return !!context?.packageJson.name;
33
- },
34
- get children() {
35
- return createComponent(Link, {
36
- get href() {
37
- return `https://www.npmjs.com/package/${context?.packageJson.name}`;
38
- },
39
- get title() {
40
- return context.packageJson.name;
41
- }
42
- });
43
- }
44
- }),
45
- code`package. These values can be updated in the \`.env\` file in the root of the project.`,
46
- createIntrinsic("hbr", {}),
47
- createComponent(Heading, {
48
- level: 2 + levelOffset,
49
- children: "Environment Variables"
50
- }),
51
- code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
52
- createIntrinsic("hbr", {}),
53
- createComponent(MarkdownTable, { get data() {
54
- return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
55
- return {
56
- name: reflectionProperty.getNameAsString().trim(),
57
- description: (reflectionProperty.getDescription() ?? "").trim(),
58
- type: stringifyType(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
59
- defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
60
- required: reflectionProperty.isValueRequired() ? "" : "✔"
61
- };
62
- }) ?? [];
63
- } })
64
- ];
65
- } }));
66
- }
67
-
68
- //#endregion
69
- export { EnvDocsFile };