@powerlines/plugin-babel 0.12.307 → 0.12.308

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 (159) hide show
  1. package/dist/ast-utils-BcmWaIan.cjs +45 -0
  2. package/dist/ast-utils-BgcE0CUh.mjs +33 -0
  3. package/dist/ast-utils-BgcE0CUh.mjs.map +1 -0
  4. package/dist/ast-utils-BrOP-SXX.d.cts +20 -0
  5. package/dist/ast-utils-BrOP-SXX.d.cts.map +1 -0
  6. package/dist/ast-utils-c95WpQzC.d.mts +20 -0
  7. package/dist/ast-utils-c95WpQzC.d.mts.map +1 -0
  8. package/dist/{_virtual/rolldown_runtime.cjs → chunk-CbDLau6x.cjs} +6 -1
  9. package/dist/config-B8fQjuSs.d.cts +86 -0
  10. package/dist/config-B8fQjuSs.d.cts.map +1 -0
  11. package/dist/config-BGnCc0aq.d.mts +86 -0
  12. package/dist/config-BGnCc0aq.d.mts.map +1 -0
  13. package/dist/config-BLkkDfsC.mjs +1 -0
  14. package/dist/config-QK0F_KAD.cjs +0 -0
  15. package/dist/create-plugin-BbG_dRTl.mjs +40 -0
  16. package/dist/create-plugin-BbG_dRTl.mjs.map +1 -0
  17. package/dist/create-plugin-D1_rga7H.d.cts +16 -0
  18. package/dist/create-plugin-D1_rga7H.d.cts.map +1 -0
  19. package/dist/create-plugin-DaXcRyMI.cjs +46 -0
  20. package/dist/create-plugin-H35OVSz7.d.mts +16 -0
  21. package/dist/create-plugin-H35OVSz7.d.mts.map +1 -0
  22. package/dist/filters-CU0L1nIa.cjs +79 -0
  23. package/dist/filters-DX-_VLWz.d.mts +43 -0
  24. package/dist/filters-DX-_VLWz.d.mts.map +1 -0
  25. package/dist/filters-DjAUc6r9.mjs +56 -0
  26. package/dist/filters-DjAUc6r9.mjs.map +1 -0
  27. package/dist/filters-xc5uoxxD.d.cts +43 -0
  28. package/dist/filters-xc5uoxxD.d.cts.map +1 -0
  29. package/dist/helpers/ast-utils.cjs +3 -34
  30. package/dist/helpers/ast-utils.d.cts +2 -20
  31. package/dist/helpers/ast-utils.d.mts +2 -20
  32. package/dist/helpers/ast-utils.mjs +2 -32
  33. package/dist/helpers/create-plugin.cjs +2 -40
  34. package/dist/helpers/create-plugin.d.cts +3 -16
  35. package/dist/helpers/create-plugin.d.mts +3 -17
  36. package/dist/helpers/create-plugin.mjs +2 -39
  37. package/dist/helpers/filters.cjs +5 -58
  38. package/dist/helpers/filters.d.cts +3 -43
  39. package/dist/helpers/filters.d.mts +3 -44
  40. package/dist/helpers/filters.mjs +2 -55
  41. package/dist/helpers/index.cjs +22 -21
  42. package/dist/helpers/index.d.cts +7 -5
  43. package/dist/helpers/index.d.mts +7 -5
  44. package/dist/helpers/index.mjs +6 -5
  45. package/dist/helpers/module-helpers.cjs +9 -102
  46. package/dist/helpers/module-helpers.d.cts +3 -50
  47. package/dist/helpers/module-helpers.d.mts +3 -50
  48. package/dist/helpers/module-helpers.mjs +3 -95
  49. package/dist/helpers/options.cjs +4 -48
  50. package/dist/helpers/options.d.cts +3 -19
  51. package/dist/helpers/options.d.mts +3 -20
  52. package/dist/helpers/options.mjs +3 -46
  53. package/dist/helpers-Bx2yBrpn.cjs +0 -0
  54. package/dist/helpers-DemUUgdw.mjs +1 -0
  55. package/dist/index-C2gUMYkE.d.cts +1 -0
  56. package/dist/index-D8dPsry7.d.mts +1 -0
  57. package/dist/index-OEBbnNdr.d.mts +1 -0
  58. package/dist/index-uTS5iDq_.d.cts +1 -0
  59. package/dist/index.cjs +30 -27
  60. package/dist/index.d.cts +10 -8
  61. package/dist/index.d.cts.map +1 -1
  62. package/dist/index.d.mts +10 -11
  63. package/dist/index.d.mts.map +1 -1
  64. package/dist/index.mjs +9 -6
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/module-helpers-B913A2FR.d.mts +50 -0
  67. package/dist/module-helpers-B913A2FR.d.mts.map +1 -0
  68. package/dist/module-helpers-BBKb6fKg.d.cts +50 -0
  69. package/dist/module-helpers-BBKb6fKg.d.cts.map +1 -0
  70. package/dist/module-helpers-DtOc93YQ.mjs +96 -0
  71. package/dist/module-helpers-DtOc93YQ.mjs.map +1 -0
  72. package/dist/module-helpers-Non-jHMu.cjs +138 -0
  73. package/dist/options-2JL6WIXT.cjs +59 -0
  74. package/dist/options-CNyetWnk.d.cts +19 -0
  75. package/dist/options-CNyetWnk.d.cts.map +1 -0
  76. package/dist/options-DT_wvMGu.mjs +47 -0
  77. package/dist/options-DT_wvMGu.mjs.map +1 -0
  78. package/dist/options-Z_v0-Y5V.d.mts +19 -0
  79. package/dist/options-Z_v0-Y5V.d.mts.map +1 -0
  80. package/dist/plugin-10Y9IjgN.d.cts +19 -0
  81. package/dist/plugin-10Y9IjgN.d.cts.map +1 -0
  82. package/dist/plugin-25m6BdNV.d.mts +19 -0
  83. package/dist/plugin-25m6BdNV.d.mts.map +1 -0
  84. package/dist/plugin-BX9Q6Mnb.mjs +1 -0
  85. package/dist/plugin-DkYJiG5m.cjs +0 -0
  86. package/dist/types/config.cjs +1 -0
  87. package/dist/types/config.d.cts +2 -87
  88. package/dist/types/config.d.mts +2 -88
  89. package/dist/types/config.mjs +2 -0
  90. package/dist/types/index.cjs +3 -0
  91. package/dist/types/index.d.cts +3 -2
  92. package/dist/types/index.d.mts +3 -2
  93. package/dist/types/index.mjs +4 -0
  94. package/dist/types/plugin.cjs +1 -0
  95. package/dist/types/plugin.d.cts +3 -20
  96. package/dist/types/plugin.d.mts +3 -21
  97. package/dist/types/plugin.mjs +2 -0
  98. package/dist/types-Bjn15Uy6.mjs +1 -0
  99. package/dist/types-D10T4PdD.cjs +0 -0
  100. package/package.json +2 -2
  101. package/dist/core/src/lib/logger.cjs +0 -41
  102. package/dist/core/src/lib/logger.mjs +0 -40
  103. package/dist/core/src/lib/logger.mjs.map +0 -1
  104. package/dist/core/src/types/api.d.cts +0 -103
  105. package/dist/core/src/types/api.d.cts.map +0 -1
  106. package/dist/core/src/types/api.d.mts +0 -103
  107. package/dist/core/src/types/api.d.mts.map +0 -1
  108. package/dist/core/src/types/commands.d.cts +0 -9
  109. package/dist/core/src/types/commands.d.cts.map +0 -1
  110. package/dist/core/src/types/commands.d.mts +0 -10
  111. package/dist/core/src/types/commands.d.mts.map +0 -1
  112. package/dist/core/src/types/config.d.cts +0 -551
  113. package/dist/core/src/types/config.d.cts.map +0 -1
  114. package/dist/core/src/types/config.d.mts +0 -551
  115. package/dist/core/src/types/config.d.mts.map +0 -1
  116. package/dist/core/src/types/context.d.cts +0 -511
  117. package/dist/core/src/types/context.d.cts.map +0 -1
  118. package/dist/core/src/types/context.d.mts +0 -511
  119. package/dist/core/src/types/context.d.mts.map +0 -1
  120. package/dist/core/src/types/fs.d.cts +0 -487
  121. package/dist/core/src/types/fs.d.cts.map +0 -1
  122. package/dist/core/src/types/fs.d.mts +0 -487
  123. package/dist/core/src/types/fs.d.mts.map +0 -1
  124. package/dist/core/src/types/hooks.d.cts +0 -99
  125. package/dist/core/src/types/hooks.d.cts.map +0 -1
  126. package/dist/core/src/types/hooks.d.mts +0 -99
  127. package/dist/core/src/types/hooks.d.mts.map +0 -1
  128. package/dist/core/src/types/index.d.mts +0 -9
  129. package/dist/core/src/types/plugin.d.cts +0 -204
  130. package/dist/core/src/types/plugin.d.cts.map +0 -1
  131. package/dist/core/src/types/plugin.d.mts +0 -204
  132. package/dist/core/src/types/plugin.d.mts.map +0 -1
  133. package/dist/core/src/types/tsconfig.d.cts +0 -70
  134. package/dist/core/src/types/tsconfig.d.cts.map +0 -1
  135. package/dist/core/src/types/tsconfig.d.mts +0 -70
  136. package/dist/core/src/types/tsconfig.d.mts.map +0 -1
  137. package/dist/core/src/types/unplugin.d.cts +0 -24
  138. package/dist/core/src/types/unplugin.d.cts.map +0 -1
  139. package/dist/core/src/types/unplugin.d.mts +0 -25
  140. package/dist/core/src/types/unplugin.d.mts.map +0 -1
  141. package/dist/helpers/ast-utils.d.cts.map +0 -1
  142. package/dist/helpers/ast-utils.d.mts.map +0 -1
  143. package/dist/helpers/ast-utils.mjs.map +0 -1
  144. package/dist/helpers/create-plugin.d.cts.map +0 -1
  145. package/dist/helpers/create-plugin.d.mts.map +0 -1
  146. package/dist/helpers/create-plugin.mjs.map +0 -1
  147. package/dist/helpers/filters.d.cts.map +0 -1
  148. package/dist/helpers/filters.d.mts.map +0 -1
  149. package/dist/helpers/filters.mjs.map +0 -1
  150. package/dist/helpers/module-helpers.d.cts.map +0 -1
  151. package/dist/helpers/module-helpers.d.mts.map +0 -1
  152. package/dist/helpers/module-helpers.mjs.map +0 -1
  153. package/dist/helpers/options.d.cts.map +0 -1
  154. package/dist/helpers/options.d.mts.map +0 -1
  155. package/dist/helpers/options.mjs.map +0 -1
  156. package/dist/types/config.d.cts.map +0 -1
  157. package/dist/types/config.d.mts.map +0 -1
  158. package/dist/types/plugin.d.cts.map +0 -1
  159. package/dist/types/plugin.d.mts.map +0 -1
@@ -1,22 +1,23 @@
1
- const require_helpers_filters = require('./filters.cjs');
2
- const require_helpers_options = require('./options.cjs');
3
- const require_helpers_ast_utils = require('./ast-utils.cjs');
4
- const require_helpers_create_plugin = require('./create-plugin.cjs');
5
- const require_helpers_module_helpers = require('./module-helpers.cjs');
1
+ const require_filters = require('../filters-CU0L1nIa.cjs');
2
+ const require_options = require('../options-2JL6WIXT.cjs');
3
+ const require_ast_utils = require('../ast-utils-BcmWaIan.cjs');
4
+ const require_create_plugin = require('../create-plugin-DaXcRyMI.cjs');
5
+ const require_module_helpers = require('../module-helpers-Non-jHMu.cjs');
6
+ require('../helpers-Bx2yBrpn.cjs');
6
7
 
7
- exports.addImport = require_helpers_module_helpers.addImport;
8
- exports.addImportsToProgram = require_helpers_module_helpers.addImportsToProgram;
9
- exports.addPluginFilter = require_helpers_filters.addPluginFilter;
10
- exports.createBabelPlugin = require_helpers_create_plugin.createBabelPlugin;
11
- exports.filterPluginByFileId = require_helpers_filters.filterPluginByFileId;
12
- exports.findExport = require_helpers_module_helpers.findExport;
13
- exports.generateFromAst = require_helpers_ast_utils.generateFromAst;
14
- exports.getImport = require_helpers_module_helpers.getImport;
15
- exports.getPluginName = require_helpers_filters.getPluginName;
16
- exports.isDuplicatePlugin = require_helpers_filters.isDuplicatePlugin;
17
- exports.isImportCall = require_helpers_module_helpers.isImportCall;
18
- exports.listExports = require_helpers_module_helpers.listExports;
19
- exports.listImports = require_helpers_module_helpers.listImports;
20
- exports.parseAst = require_helpers_ast_utils.parseAst;
21
- exports.resolveBabelPlugin = require_helpers_options.resolveBabelPlugin;
22
- exports.resolvePluginFunction = require_helpers_options.resolvePluginFunction;
8
+ exports.addImport = require_module_helpers.addImport;
9
+ exports.addImportsToProgram = require_module_helpers.addImportsToProgram;
10
+ exports.addPluginFilter = require_filters.addPluginFilter;
11
+ exports.createBabelPlugin = require_create_plugin.createBabelPlugin;
12
+ exports.filterPluginByFileId = require_filters.filterPluginByFileId;
13
+ exports.findExport = require_module_helpers.findExport;
14
+ exports.generateFromAst = require_ast_utils.generateFromAst;
15
+ exports.getImport = require_module_helpers.getImport;
16
+ exports.getPluginName = require_filters.getPluginName;
17
+ exports.isDuplicatePlugin = require_filters.isDuplicatePlugin;
18
+ exports.isImportCall = require_module_helpers.isImportCall;
19
+ exports.listExports = require_module_helpers.listExports;
20
+ exports.listImports = require_module_helpers.listImports;
21
+ exports.parseAst = require_ast_utils.parseAst;
22
+ exports.resolveBabelPlugin = require_options.resolveBabelPlugin;
23
+ exports.resolvePluginFunction = require_options.resolvePluginFunction;
@@ -1,6 +1,8 @@
1
- import { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./ast-utils.cjs";
2
- import { createBabelPlugin } from "./create-plugin.cjs";
3
- import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./filters.cjs";
4
- import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./module-helpers.cjs";
5
- import { resolveBabelPlugin, resolvePluginFunction } from "./options.cjs";
1
+ import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-BrOP-SXX.cjs";
2
+ import "../config-B8fQjuSs.cjs";
3
+ import { t as createBabelPlugin } from "../create-plugin-D1_rga7H.cjs";
4
+ import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-xc5uoxxD.cjs";
5
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-BBKb6fKg.cjs";
6
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-CNyetWnk.cjs";
7
+ import "../index-C2gUMYkE.cjs";
6
8
  export { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, addImport, addImportsToProgram, addPluginFilter, createBabelPlugin, filterPluginByFileId, findExport, generateFromAst, getImport, getPluginName, isDuplicatePlugin, isImportCall, listExports, listImports, parseAst, resolveBabelPlugin, resolvePluginFunction };
@@ -1,6 +1,8 @@
1
- import { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./ast-utils.mjs";
2
- import { createBabelPlugin } from "./create-plugin.mjs";
3
- import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./filters.mjs";
4
- import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./module-helpers.mjs";
5
- import { resolveBabelPlugin, resolvePluginFunction } from "./options.mjs";
1
+ import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-c95WpQzC.mjs";
2
+ import "../config-BGnCc0aq.mjs";
3
+ import { t as createBabelPlugin } from "../create-plugin-H35OVSz7.mjs";
4
+ import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-DX-_VLWz.mjs";
5
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-B913A2FR.mjs";
6
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-Z_v0-Y5V.mjs";
7
+ import "../index-OEBbnNdr.mjs";
6
8
  export { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, addImport, addImportsToProgram, addPluginFilter, createBabelPlugin, filterPluginByFileId, findExport, generateFromAst, getImport, getPluginName, isDuplicatePlugin, isImportCall, listExports, listImports, parseAst, resolveBabelPlugin, resolvePluginFunction };
@@ -1,7 +1,8 @@
1
- import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./filters.mjs";
2
- import { resolveBabelPlugin, resolvePluginFunction } from "./options.mjs";
3
- import { generateFromAst, parseAst } from "./ast-utils.mjs";
4
- import { createBabelPlugin } from "./create-plugin.mjs";
5
- import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./module-helpers.mjs";
1
+ import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-DjAUc6r9.mjs";
2
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-DT_wvMGu.mjs";
3
+ import { n as parseAst, t as generateFromAst } from "../ast-utils-BgcE0CUh.mjs";
4
+ import { t as createBabelPlugin } from "../create-plugin-BbG_dRTl.mjs";
5
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-DtOc93YQ.mjs";
6
+ import "../helpers-DemUUgdw.mjs";
6
7
 
7
8
  export { addImport, addImportsToProgram, addPluginFilter, createBabelPlugin, filterPluginByFileId, findExport, generateFromAst, getImport, getPluginName, isDuplicatePlugin, isImportCall, listExports, listImports, parseAst, resolveBabelPlugin, resolvePluginFunction };
@@ -1,103 +1,10 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_helpers_ast_utils = 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");
1
+ require('../ast-utils-BcmWaIan.cjs');
2
+ const require_module_helpers = require('../module-helpers-Non-jHMu.cjs');
6
3
 
7
- //#region src/helpers/module-helpers.ts
8
- /**
9
- * Finds an export in the given Babel AST program by its key.
10
- *
11
- * @param ast - The parsed Babel AST result containing the program body.
12
- * @param key - The name of the export to find (e.g., "default" or a named export).
13
- * @returns The declaration of the export if found, otherwise undefined.
14
- */
15
- function findExport(ast, key) {
16
- const type = key === "default" ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
17
- for (const node of ast.program.body) if (node.type === type) {
18
- if (key === "default") return node.declaration;
19
- if (node.declaration && "declarations" in node.declaration) {
20
- const declaration = node.declaration.declarations[0];
21
- if (declaration && "name" in declaration.id && declaration.id.name === key) return declaration.init;
22
- }
23
- }
24
- }
25
- /**
26
- * Lists all exports from the given Babel AST program.
27
- *
28
- * @param codeOrAst - The parsed Babel AST result containing the program body.
29
- * @returns An array of export names, including "default" for default exports.
30
- */
31
- function listExports(codeOrAst) {
32
- return ((0, __stryke_type_checks_is_string.isString)(codeOrAst) ? require_helpers_ast_utils.parseAst(codeOrAst) : codeOrAst).program.body.flatMap((i) => {
33
- if (i.type === "ExportDefaultDeclaration") return ["default"];
34
- if (i.type === "ExportNamedDeclaration" && i.declaration && "declarations" in i.declaration) return i.declaration.declarations.map((d) => "name" in d.id ? d.id.name : "");
35
- return [];
36
- }).filter(Boolean);
37
- }
38
- /**
39
- * Lists all imports from the given Babel AST program.
40
- *
41
- * @param ast - The parsed Babel AST result containing the program body.
42
- * @returns An array of import names, including "default" for default imports.
43
- */
44
- function listImports(ast) {
45
- return ast.program.body.flatMap((i) => {
46
- if (i.type === "ImportDeclaration") return i.specifiers.map((s) => {
47
- if (s.type === "ImportDefaultSpecifier") return "default";
48
- if (s.type === "ImportSpecifier" && "imported" in s) return s.imported.type === "Identifier" ? s.imported.name : s.imported.value;
49
- return "";
50
- });
51
- return [];
52
- }).filter(Boolean);
53
- }
54
- function isImportCall(calleePath) {
55
- return __babel_types.isImport(calleePath.node.callee);
56
- }
57
- /**
58
- * Gets the import declaration for a given name and specifier.
59
- *
60
- * @param specifier - The specifier of the import.
61
- * @param name - The name of the import.
62
- * @param named - Optional named import.
63
- * @returns The import declaration.
64
- */
65
- function getImport(specifier, name, named) {
66
- return __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(name), __babel_types.stringLiteral(named || name))], __babel_types.stringLiteral(specifier));
67
- }
68
- /**
69
- * Adds an import to the program if it doesn't already exist.
70
- *
71
- * @param path - The current NodePath in the AST.
72
- * @param specifier - The import specifier.
73
- */
74
- function addImport(path, specifier) {
75
- addImportsToProgram(path.scope.getProgramParent().path, specifier);
76
- }
77
- function isNonNamespacedImport(importDeclPath) {
78
- return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
79
- }
80
- function getExistingImports(program) {
81
- const existingImports = /* @__PURE__ */ new Map();
82
- program.traverse({ ImportDeclaration(path) {
83
- if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
84
- } });
85
- return existingImports;
86
- }
87
- function addImportsToProgram(path, specifier) {
88
- /**
89
- * If an existing import of this module exists (ie \`import \{ ... \} from
90
- * '<moduleName>'\`), inject new imported specifiers into the list of
91
- * destructured variables.
92
- */
93
- 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)));
94
- }
95
-
96
- //#endregion
97
- exports.addImport = addImport;
98
- exports.addImportsToProgram = addImportsToProgram;
99
- exports.findExport = findExport;
100
- exports.getImport = getImport;
101
- exports.isImportCall = isImportCall;
102
- exports.listExports = listExports;
103
- exports.listImports = listImports;
4
+ exports.addImport = require_module_helpers.addImport;
5
+ exports.addImportsToProgram = require_module_helpers.addImportsToProgram;
6
+ exports.findExport = require_module_helpers.findExport;
7
+ exports.getImport = require_module_helpers.getImport;
8
+ exports.isImportCall = require_module_helpers.isImportCall;
9
+ exports.listExports = require_module_helpers.listExports;
10
+ exports.listImports = require_module_helpers.listImports;
@@ -1,50 +1,3 @@
1
- import { ImportSpecifier } from "../types/config.cjs";
2
- import { ParseResult } from "@babel/parser";
3
- import * as t from "@babel/types";
4
- import { NodePath } from "@babel/core";
5
-
6
- //#region src/helpers/module-helpers.d.ts
7
-
8
- /**
9
- * Finds an export in the given Babel AST program by its key.
10
- *
11
- * @param ast - The parsed Babel AST result containing the program body.
12
- * @param key - The name of the export to find (e.g., "default" or a named export).
13
- * @returns The declaration of the export if found, otherwise undefined.
14
- */
15
- declare function findExport(ast: ParseResult<t.File>, key: string): any;
16
- /**
17
- * Lists all exports from the given Babel AST program.
18
- *
19
- * @param codeOrAst - The parsed Babel AST result containing the program body.
20
- * @returns An array of export names, including "default" for default exports.
21
- */
22
- declare function listExports(codeOrAst: ParseResult<t.File> | string): string[];
23
- /**
24
- * Lists all imports from the given Babel AST program.
25
- *
26
- * @param ast - The parsed Babel AST result containing the program body.
27
- * @returns An array of import names, including "default" for default imports.
28
- */
29
- declare function listImports(ast: ParseResult<t.File> | t.File): string[];
30
- declare function isImportCall(calleePath: NodePath<t.CallExpression | t.NewExpression>): boolean;
31
- /**
32
- * Gets the import declaration for a given name and specifier.
33
- *
34
- * @param specifier - The specifier of the import.
35
- * @param name - The name of the import.
36
- * @param named - Optional named import.
37
- * @returns The import declaration.
38
- */
39
- declare function getImport(specifier: string, name: string, named?: string): t.ImportDeclaration;
40
- /**
41
- * Adds an import to the program if it doesn't already exist.
42
- *
43
- * @param path - The current NodePath in the AST.
44
- * @param specifier - The import specifier.
45
- */
46
- declare function addImport(path: NodePath<any>, specifier: ImportSpecifier): void;
47
- declare function addImportsToProgram(path: NodePath<t.Program>, specifier: ImportSpecifier): void;
48
- //#endregion
49
- export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
50
- //# sourceMappingURL=module-helpers.d.cts.map
1
+ import "../config-B8fQjuSs.cjs";
2
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-BBKb6fKg.cjs";
3
+ export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
@@ -1,50 +1,3 @@
1
- import { ImportSpecifier } from "../types/config.mjs";
2
- import { NodePath } from "@babel/core";
3
- import { ParseResult } from "@babel/parser";
4
- import * as t from "@babel/types";
5
-
6
- //#region src/helpers/module-helpers.d.ts
7
-
8
- /**
9
- * Finds an export in the given Babel AST program by its key.
10
- *
11
- * @param ast - The parsed Babel AST result containing the program body.
12
- * @param key - The name of the export to find (e.g., "default" or a named export).
13
- * @returns The declaration of the export if found, otherwise undefined.
14
- */
15
- declare function findExport(ast: ParseResult<t.File>, key: string): any;
16
- /**
17
- * Lists all exports from the given Babel AST program.
18
- *
19
- * @param codeOrAst - The parsed Babel AST result containing the program body.
20
- * @returns An array of export names, including "default" for default exports.
21
- */
22
- declare function listExports(codeOrAst: ParseResult<t.File> | string): string[];
23
- /**
24
- * Lists all imports from the given Babel AST program.
25
- *
26
- * @param ast - The parsed Babel AST result containing the program body.
27
- * @returns An array of import names, including "default" for default imports.
28
- */
29
- declare function listImports(ast: ParseResult<t.File> | t.File): string[];
30
- declare function isImportCall(calleePath: NodePath<t.CallExpression | t.NewExpression>): boolean;
31
- /**
32
- * Gets the import declaration for a given name and specifier.
33
- *
34
- * @param specifier - The specifier of the import.
35
- * @param name - The name of the import.
36
- * @param named - Optional named import.
37
- * @returns The import declaration.
38
- */
39
- declare function getImport(specifier: string, name: string, named?: string): t.ImportDeclaration;
40
- /**
41
- * Adds an import to the program if it doesn't already exist.
42
- *
43
- * @param path - The current NodePath in the AST.
44
- * @param specifier - The import specifier.
45
- */
46
- declare function addImport(path: NodePath<any>, specifier: ImportSpecifier): void;
47
- declare function addImportsToProgram(path: NodePath<t.Program>, specifier: ImportSpecifier): void;
48
- //#endregion
49
- export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
50
- //# sourceMappingURL=module-helpers.d.mts.map
1
+ import "../config-BGnCc0aq.mjs";
2
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-B913A2FR.mjs";
3
+ export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
@@ -1,96 +1,4 @@
1
- import { parseAst } from "./ast-utils.mjs";
2
- import * as t from "@babel/types";
3
- import { isString } from "@stryke/type-checks/is-string";
1
+ import "../ast-utils-BgcE0CUh.mjs";
2
+ import { a as isImportCall, i as getImport, n as addImportsToProgram, o as listExports, r as findExport, s as listImports, t as addImport } from "../module-helpers-DtOc93YQ.mjs";
4
3
 
5
- //#region src/helpers/module-helpers.ts
6
- /**
7
- * Finds an export in the given Babel AST program by its key.
8
- *
9
- * @param ast - The parsed Babel AST result containing the program body.
10
- * @param key - The name of the export to find (e.g., "default" or a named export).
11
- * @returns The declaration of the export if found, otherwise undefined.
12
- */
13
- function findExport(ast, key) {
14
- const type = key === "default" ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
15
- for (const node of ast.program.body) if (node.type === type) {
16
- if (key === "default") return node.declaration;
17
- if (node.declaration && "declarations" in node.declaration) {
18
- const declaration = node.declaration.declarations[0];
19
- if (declaration && "name" in declaration.id && declaration.id.name === key) return declaration.init;
20
- }
21
- }
22
- }
23
- /**
24
- * Lists all exports from the given Babel AST program.
25
- *
26
- * @param codeOrAst - The parsed Babel AST result containing the program body.
27
- * @returns An array of export names, including "default" for default exports.
28
- */
29
- function listExports(codeOrAst) {
30
- return (isString(codeOrAst) ? parseAst(codeOrAst) : codeOrAst).program.body.flatMap((i) => {
31
- if (i.type === "ExportDefaultDeclaration") return ["default"];
32
- if (i.type === "ExportNamedDeclaration" && i.declaration && "declarations" in i.declaration) return i.declaration.declarations.map((d) => "name" in d.id ? d.id.name : "");
33
- return [];
34
- }).filter(Boolean);
35
- }
36
- /**
37
- * Lists all imports from the given Babel AST program.
38
- *
39
- * @param ast - The parsed Babel AST result containing the program body.
40
- * @returns An array of import names, including "default" for default imports.
41
- */
42
- function listImports(ast) {
43
- return ast.program.body.flatMap((i) => {
44
- if (i.type === "ImportDeclaration") return i.specifiers.map((s) => {
45
- if (s.type === "ImportDefaultSpecifier") return "default";
46
- if (s.type === "ImportSpecifier" && "imported" in s) return s.imported.type === "Identifier" ? s.imported.name : s.imported.value;
47
- return "";
48
- });
49
- return [];
50
- }).filter(Boolean);
51
- }
52
- function isImportCall(calleePath) {
53
- return t.isImport(calleePath.node.callee);
54
- }
55
- /**
56
- * Gets the import declaration for a given name and specifier.
57
- *
58
- * @param specifier - The specifier of the import.
59
- * @param name - The name of the import.
60
- * @param named - Optional named import.
61
- * @returns The import declaration.
62
- */
63
- function getImport(specifier, name, named) {
64
- return t.importDeclaration([t.importSpecifier(t.identifier(name), t.stringLiteral(named || name))], t.stringLiteral(specifier));
65
- }
66
- /**
67
- * Adds an import to the program if it doesn't already exist.
68
- *
69
- * @param path - The current NodePath in the AST.
70
- * @param specifier - The import specifier.
71
- */
72
- function addImport(path, specifier) {
73
- addImportsToProgram(path.scope.getProgramParent().path, specifier);
74
- }
75
- function isNonNamespacedImport(importDeclPath) {
76
- return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
77
- }
78
- function getExistingImports(program) {
79
- const existingImports = /* @__PURE__ */ new Map();
80
- program.traverse({ ImportDeclaration(path) {
81
- if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
82
- } });
83
- return existingImports;
84
- }
85
- function addImportsToProgram(path, specifier) {
86
- /**
87
- * If an existing import of this module exists (ie \`import \{ ... \} from
88
- * '<moduleName>'\`), inject new imported specifiers into the list of
89
- * destructured variables.
90
- */
91
- 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)));
92
- }
93
-
94
- //#endregion
95
- export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
96
- //# sourceMappingURL=module-helpers.mjs.map
4
+ export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
@@ -1,49 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_helpers_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);
1
+ require('../filters-CU0L1nIa.cjs');
2
+ const require_options = require('../options-2JL6WIXT.cjs');
6
3
 
7
- //#region 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_helpers_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;
4
+ exports.resolveBabelPlugin = require_options.resolveBabelPlugin;
5
+ exports.resolvePluginFunction = require_options.resolvePluginFunction;
@@ -1,19 +1,3 @@
1
- import { Context } from "../core/src/types/context.cjs";
2
- import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "../types/config.cjs";
3
- import { PluginOptions, PluginTarget } from "@babel/core";
4
-
5
- //#region src/helpers/options.d.ts
6
- declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
7
- /**
8
- * Resolve the [Babel](https://babeljs.io/) plugin.
9
- *
10
- * @param context - The context for the transformation.
11
- * @param code - The code to be transformed.
12
- * @param id - The ID of the source file.
13
- * @param plugin - The Babel plugin to resolve.
14
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
15
- */
16
- declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
17
- //#endregion
18
- export { resolveBabelPlugin, resolvePluginFunction };
19
- //# sourceMappingURL=options.d.cts.map
1
+ import "../config-B8fQjuSs.cjs";
2
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-CNyetWnk.cjs";
3
+ export { resolveBabelPlugin, resolvePluginFunction };
@@ -1,20 +1,3 @@
1
- import { Context } from "../core/src/types/context.mjs";
2
- import "../core/src/types/index.mjs";
3
- import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "../types/config.mjs";
4
- import { PluginOptions, PluginTarget } from "@babel/core";
5
-
6
- //#region src/helpers/options.d.ts
7
- declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
8
- /**
9
- * Resolve the [Babel](https://babeljs.io/) plugin.
10
- *
11
- * @param context - The context for the transformation.
12
- * @param code - The code to be transformed.
13
- * @param id - The ID of the source file.
14
- * @param plugin - The Babel plugin to resolve.
15
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
16
- */
17
- declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
18
- //#endregion
19
- export { resolveBabelPlugin, resolvePluginFunction };
20
- //# sourceMappingURL=options.d.mts.map
1
+ import "../config-BGnCc0aq.mjs";
2
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-Z_v0-Y5V.mjs";
3
+ export { resolveBabelPlugin, resolvePluginFunction };
@@ -1,47 +1,4 @@
1
- import { getPluginName } from "./filters.mjs";
2
- import { isFunction } from "@stryke/type-checks/is-function";
3
- import chalk from "chalk";
1
+ import "../filters-DjAUc6r9.mjs";
2
+ import { n as resolvePluginFunction, t as resolveBabelPlugin } from "../options-DT_wvMGu.mjs";
4
3
 
5
- //#region 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 };
47
- //# sourceMappingURL=options.mjs.map
4
+ export { resolveBabelPlugin, resolvePluginFunction };
File without changes
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };