@powerlines/plugin-date 0.12.260 → 0.12.261

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 (184) hide show
  1. package/dist/components/date-fns.cjs +3 -2
  2. package/dist/components/date-fns.mjs +1 -1
  3. package/dist/components/dayjs.cjs +3 -2
  4. package/dist/components/dayjs.mjs +1 -1
  5. package/dist/components/luxon.cjs +3 -2
  6. package/dist/components/luxon.mjs +1 -1
  7. package/dist/components/moment.cjs +3 -2
  8. package/dist/components/moment.mjs +1 -1
  9. package/dist/index.cjs +3 -2
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/types/plugin.d.cts +1 -1
  14. package/dist/types/plugin.d.mts +1 -1
  15. package/package.json +4 -4
  16. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  17. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  18. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  19. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  20. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  21. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  22. package/dist/deepkit/src/capnp.cjs +0 -913
  23. package/dist/deepkit/src/capnp.mjs +0 -911
  24. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  25. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  26. package/dist/deepkit/src/reflect-type.cjs +0 -22
  27. package/dist/deepkit/src/reflect-type.mjs +0 -20
  28. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  29. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  30. package/dist/deepkit/src/transformer.cjs +0 -52
  31. package/dist/deepkit/src/transformer.mjs +0 -49
  32. package/dist/deepkit/src/transpile.cjs +0 -29
  33. package/dist/deepkit/src/transpile.mjs +0 -27
  34. package/dist/deepkit/src/types.d.cts +0 -10
  35. package/dist/deepkit/src/types.d.mts +0 -10
  36. package/dist/deepkit/src/utilities.cjs +0 -67
  37. package/dist/deepkit/src/utilities.mjs +0 -66
  38. package/dist/plugin-alloy/src/core/components/output.cjs +0 -36
  39. package/dist/plugin-alloy/src/core/components/output.mjs +0 -35
  40. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  41. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  42. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -38
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -34
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  52. package/dist/plugin-alloy/src/index.cjs +0 -102
  53. package/dist/plugin-alloy/src/index.mjs +0 -100
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -89
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -88
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -33
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -32
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  60. package/dist/plugin-alloy/src/types/components.d.mts +0 -3
  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 -52
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -51
  66. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -78
  67. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -76
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -364
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -355
  70. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -157
  71. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -154
  72. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -57
  73. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -56
  74. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  75. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  76. package/dist/plugin-automd/src/index.cjs +0 -101
  77. package/dist/plugin-automd/src/index.mjs +0 -98
  78. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  79. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  80. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  81. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  82. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  83. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  84. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  85. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  86. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  87. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  88. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  89. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  90. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  91. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  92. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  93. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  94. package/dist/plugin-babel/src/index.cjs +0 -85
  95. package/dist/plugin-babel/src/index.mjs +0 -83
  96. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  97. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  98. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  99. package/dist/plugin-env/src/babel/index.cjs +0 -1
  100. package/dist/plugin-env/src/babel/index.mjs +0 -3
  101. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  102. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  103. package/dist/plugin-env/src/components/docs.cjs +0 -60
  104. package/dist/plugin-env/src/components/docs.mjs +0 -59
  105. package/dist/plugin-env/src/components/env.cjs +0 -497
  106. package/dist/plugin-env/src/components/env.mjs +0 -494
  107. package/dist/plugin-env/src/components/index.cjs +0 -2
  108. package/dist/plugin-env/src/components/index.mjs +0 -4
  109. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  110. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  111. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  112. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  113. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  114. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  115. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  116. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  117. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  118. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  119. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  120. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  121. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  122. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  123. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  124. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  125. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  126. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  127. package/dist/plugin-env/src/index.cjs +0 -174
  128. package/dist/plugin-env/src/index.mjs +0 -172
  129. package/dist/plugin-env/src/types/plugin.d.cts +0 -148
  130. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  131. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  132. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  133. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  134. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  135. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  136. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  137. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  138. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  139. package/dist/powerlines/src/lib/entry.cjs +0 -11
  140. package/dist/powerlines/src/lib/entry.mjs +0 -13
  141. package/dist/powerlines/src/lib/logger.cjs +0 -41
  142. package/dist/powerlines/src/lib/logger.mjs +0 -39
  143. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  144. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  145. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  146. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  147. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  148. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  149. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  150. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  151. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  152. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  153. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  154. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  155. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  156. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  157. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  158. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  159. package/dist/powerlines/src/types/api.d.cts +0 -104
  160. package/dist/powerlines/src/types/api.d.mts +0 -104
  161. package/dist/powerlines/src/types/babel.d.cts +0 -22
  162. package/dist/powerlines/src/types/babel.d.mts +0 -22
  163. package/dist/powerlines/src/types/build.cjs +0 -21
  164. package/dist/powerlines/src/types/build.d.cts +0 -185
  165. package/dist/powerlines/src/types/build.d.mts +0 -185
  166. package/dist/powerlines/src/types/build.mjs +0 -21
  167. package/dist/powerlines/src/types/commands.d.cts +0 -8
  168. package/dist/powerlines/src/types/commands.d.mts +0 -9
  169. package/dist/powerlines/src/types/config.d.cts +0 -435
  170. package/dist/powerlines/src/types/config.d.mts +0 -436
  171. package/dist/powerlines/src/types/context.d.cts +0 -514
  172. package/dist/powerlines/src/types/context.d.mts +0 -514
  173. package/dist/powerlines/src/types/fs.d.cts +0 -486
  174. package/dist/powerlines/src/types/fs.d.mts +0 -486
  175. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  176. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  177. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  178. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  179. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  180. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  181. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  182. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  183. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  184. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,9 +0,0 @@
1
- import _generate from "@babel/generator";
2
- import "@babel/parser";
3
-
4
- //#region ../plugin-babel/src/helpers/ast-utils.ts
5
- let generate = _generate;
6
- if ("default" in generate) generate = generate.default;
7
-
8
- //#endregion
9
- export { };
@@ -1,41 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_logger = require('../../../powerlines/src/lib/logger.cjs');
3
- let chalk = require("chalk");
4
- chalk = require_rolldown_runtime.__toESM(chalk);
5
- let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
6
- let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
7
-
8
- //#region ../plugin-babel/src/helpers/create-plugin.ts
9
- /**
10
- * Create a Babel plugin using the provided builder function.
11
- *
12
- * @param name - The name of the plugin.
13
- * @param builder - The builder function that defines the plugin behavior.
14
- * @returns A Babel plugin declaration.
15
- */
16
- function createBabelPlugin(name, builder) {
17
- const plugin = (context) => {
18
- return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
19
- api.cache.using(() => context.meta.checksum);
20
- api.assertVersion("^7.0.0-0");
21
- const log = require_logger.extendLog(context.log, name);
22
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
23
- const result = builder({
24
- log,
25
- name,
26
- api,
27
- options,
28
- context,
29
- dirname
30
- });
31
- result.name = name;
32
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
33
- return result;
34
- });
35
- };
36
- plugin.$$name = name;
37
- return plugin;
38
- }
39
-
40
- //#endregion
41
- exports.createBabelPlugin = createBabelPlugin;
@@ -1,39 +0,0 @@
1
- import { extendLog } from "../../../powerlines/src/lib/logger.mjs";
2
- import chalk from "chalk";
3
- import { declare } from "@babel/helper-plugin-utils";
4
- import { LogLevelLabel } from "@storm-software/config-tools/types";
5
-
6
- //#region ../plugin-babel/src/helpers/create-plugin.ts
7
- /**
8
- * Create a Babel plugin using the provided builder function.
9
- *
10
- * @param name - The name of the plugin.
11
- * @param builder - The builder function that defines the plugin behavior.
12
- * @returns A Babel plugin declaration.
13
- */
14
- function createBabelPlugin(name, builder) {
15
- const plugin = (context) => {
16
- return declare((api, options, dirname) => {
17
- api.cache.using(() => context.meta.checksum);
18
- api.assertVersion("^7.0.0-0");
19
- const log = extendLog(context.log, name);
20
- log(LogLevelLabel.TRACE, `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`);
21
- const result = builder({
22
- log,
23
- name,
24
- api,
25
- options,
26
- context,
27
- dirname
28
- });
29
- result.name = name;
30
- log(LogLevelLabel.TRACE, `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`);
31
- return result;
32
- });
33
- };
34
- plugin.$$name = name;
35
- return plugin;
36
- }
37
-
38
- //#endregion
39
- export { createBabelPlugin };
@@ -1,23 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
3
- require("@stryke/type-checks/is-object");
4
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
-
6
- //#region ../plugin-babel/src/helpers/filters.ts
7
- function getPluginName(plugin) {
8
- return (0, __stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
9
- }
10
- /**
11
- * Check if a Babel plugin is a duplicate of another plugin in the list.
12
- *
13
- * @param plugins - The list of existing Babel plugins.
14
- * @param plugin - The Babel plugin to check for duplicates.
15
- * @returns True if the plugin is a duplicate, false otherwise.
16
- */
17
- function isDuplicatePlugin(plugins, plugin) {
18
- return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
19
- }
20
-
21
- //#endregion
22
- exports.getPluginName = getPluginName;
23
- exports.isDuplicatePlugin = isDuplicatePlugin;
@@ -1,21 +0,0 @@
1
- import { isFunction } from "@stryke/type-checks/is-function";
2
- import "@stryke/type-checks/is-object";
3
- import { isSetString } from "@stryke/type-checks/is-set-string";
4
-
5
- //#region ../plugin-babel/src/helpers/filters.ts
6
- function getPluginName(plugin) {
7
- return isSetString(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
8
- }
9
- /**
10
- * Check if a Babel plugin is a duplicate of another plugin in the list.
11
- *
12
- * @param plugins - The list of existing Babel plugins.
13
- * @param plugin - The Babel plugin to check for duplicates.
14
- * @returns True if the plugin is a duplicate, false otherwise.
15
- */
16
- function isDuplicatePlugin(plugins, plugin) {
17
- return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
18
- }
19
-
20
- //#endregion
21
- export { getPluginName, isDuplicatePlugin };
@@ -1,5 +0,0 @@
1
- const require_filters = require('./filters.cjs');
2
- const require_options = require('./options.cjs');
3
- require('./ast-utils.cjs');
4
- const require_create_plugin = require('./create-plugin.cjs');
5
- const require_module_helpers = require('./module-helpers.cjs');
@@ -1,7 +0,0 @@
1
- import { getPluginName, isDuplicatePlugin } from "./filters.mjs";
2
- import { resolveBabelPlugin, resolvePluginFunction } from "./options.mjs";
3
- import "./ast-utils.mjs";
4
- import { createBabelPlugin } from "./create-plugin.mjs";
5
- import { addImport, addImportsToProgram } from "./module-helpers.mjs";
6
-
7
- export { };
@@ -1,38 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- require('./ast-utils.cjs');
3
- let __babel_types = require("@babel/types");
4
- __babel_types = require_rolldown_runtime.__toESM(__babel_types);
5
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
6
-
7
- //#region ../plugin-babel/src/helpers/module-helpers.ts
8
- /**
9
- * Adds an import to the program if it doesn't already exist.
10
- *
11
- * @param path - The current NodePath in the AST.
12
- * @param specifier - The import specifier.
13
- */
14
- function addImport(path, specifier) {
15
- addImportsToProgram(path.scope.getProgramParent().path, specifier);
16
- }
17
- function isNonNamespacedImport(importDeclPath) {
18
- return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
19
- }
20
- function getExistingImports(program) {
21
- const existingImports = /* @__PURE__ */ new Map();
22
- program.traverse({ ImportDeclaration(path) {
23
- if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
24
- } });
25
- return existingImports;
26
- }
27
- function addImportsToProgram(path, specifier) {
28
- /**
29
- * If an existing import of this module exists (ie \`import \{ ... \} from
30
- * '<moduleName>'\`), inject new imported specifiers into the list of
31
- * destructured variables.
32
- */
33
- if (!getExistingImports(path).get(specifier.module)) path.unshiftContainer("body", __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(specifier.name || specifier.imported), __babel_types.identifier(specifier.imported))], __babel_types.stringLiteral(specifier.module)));
34
- }
35
-
36
- //#endregion
37
- exports.addImport = addImport;
38
- exports.addImportsToProgram = addImportsToProgram;
@@ -1,35 +0,0 @@
1
- import "./ast-utils.mjs";
2
- import * as t from "@babel/types";
3
- import { isString } from "@stryke/type-checks/is-string";
4
-
5
- //#region ../plugin-babel/src/helpers/module-helpers.ts
6
- /**
7
- * Adds an import to the program if it doesn't already exist.
8
- *
9
- * @param path - The current NodePath in the AST.
10
- * @param specifier - The import specifier.
11
- */
12
- function addImport(path, specifier) {
13
- addImportsToProgram(path.scope.getProgramParent().path, specifier);
14
- }
15
- function isNonNamespacedImport(importDeclPath) {
16
- return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
17
- }
18
- function getExistingImports(program) {
19
- const existingImports = /* @__PURE__ */ new Map();
20
- program.traverse({ ImportDeclaration(path) {
21
- if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
22
- } });
23
- return existingImports;
24
- }
25
- function addImportsToProgram(path, specifier) {
26
- /**
27
- * If an existing import of this module exists (ie \`import \{ ... \} from
28
- * '<moduleName>'\`), inject new imported specifiers into the list of
29
- * destructured variables.
30
- */
31
- if (!getExistingImports(path).get(specifier.module)) path.unshiftContainer("body", t.importDeclaration([t.importSpecifier(t.identifier(specifier.name || specifier.imported), t.identifier(specifier.imported))], t.stringLiteral(specifier.module)));
32
- }
33
-
34
- //#endregion
35
- export { addImport, addImportsToProgram };
@@ -1,49 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_filters = require('./filters.cjs');
3
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
4
- let chalk = require("chalk");
5
- chalk = require_rolldown_runtime.__toESM(chalk);
6
-
7
- //#region ../plugin-babel/src/helpers/options.ts
8
- function resolvePluginFunction(context, plugin) {
9
- try {
10
- return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? (0, __stryke_type_checks_is_function.isFunction)(plugin[0]) ? plugin[0](context) : plugin[0] : (0, __stryke_type_checks_is_function.isFunction)(plugin) ? plugin(context) : plugin;
11
- } catch {
12
- return plugin[0];
13
- }
14
- }
15
- /**
16
- * Resolve the [Babel](https://babeljs.io/) plugin.
17
- *
18
- * @param context - The context for the transformation.
19
- * @param code - The code to be transformed.
20
- * @param id - The ID of the source file.
21
- * @param plugin - The Babel plugin to resolve.
22
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
23
- */
24
- function resolveBabelPlugin(context, code, id, plugin) {
25
- if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
26
- if (plugin.length > 2 && plugin[2] && (0, __stryke_type_checks_is_function.isFunction)(plugin[2]) && !plugin[2](code, id)) {
27
- context.trace(`Skipping filtered Babel plugin ${chalk.default.bold.cyanBright(require_filters.getPluginName(plugin) || "unnamed")} for ${id}`);
28
- return;
29
- }
30
- return plugin.length > 2 ? [
31
- resolvePluginFunction(context, plugin),
32
- plugin[1],
33
- plugin[2]
34
- ] : [
35
- resolvePluginFunction(context, plugin),
36
- plugin[1],
37
- null
38
- ];
39
- }
40
- return [
41
- resolvePluginFunction(context, plugin),
42
- {},
43
- null
44
- ];
45
- }
46
-
47
- //#endregion
48
- exports.resolveBabelPlugin = resolveBabelPlugin;
49
- exports.resolvePluginFunction = resolvePluginFunction;
@@ -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 { 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 +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;