@powerlines/plugin-babel 0.12.56 → 0.12.58

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 (113) hide show
  1. package/README.md +8 -2
  2. package/dist/ast-utils-BXgehtOj.cjs +1 -0
  3. package/dist/{helpers/ast-utils.d.ts → ast-utils-Bs6DBkKg.d.mts} +8 -7
  4. package/dist/ast-utils-Bs6DBkKg.d.mts.map +1 -0
  5. package/dist/ast-utils-DeuXcuqs.d.cts +20 -0
  6. package/dist/ast-utils-DeuXcuqs.d.cts.map +1 -0
  7. package/dist/ast-utils-QwV5Hp9M.mjs +2 -0
  8. package/dist/ast-utils-QwV5Hp9M.mjs.map +1 -0
  9. package/dist/babel-B0EpFTZb.d.cts +1696 -0
  10. package/dist/babel-B0EpFTZb.d.cts.map +1 -0
  11. package/dist/babel-DioHQPr5.d.mts +1696 -0
  12. package/dist/babel-DioHQPr5.d.mts.map +1 -0
  13. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  14. package/dist/create-plugin-BX_bUhNU.cjs +1 -0
  15. package/dist/create-plugin-C9XMtUiM.d.cts +15 -0
  16. package/dist/create-plugin-C9XMtUiM.d.cts.map +1 -0
  17. package/dist/create-plugin-o_LwpezO.d.mts +15 -0
  18. package/dist/create-plugin-o_LwpezO.d.mts.map +1 -0
  19. package/dist/create-plugin-pWE4rRW3.mjs +2 -0
  20. package/dist/create-plugin-pWE4rRW3.mjs.map +1 -0
  21. package/dist/{helpers/filters.d.ts → filters-C_9_knbA.d.cts} +5 -26
  22. package/dist/filters-C_9_knbA.d.cts.map +1 -0
  23. package/dist/filters-DJgM_YqO.cjs +1 -0
  24. package/dist/filters-H7GHqM8L.mjs +2 -0
  25. package/dist/filters-H7GHqM8L.mjs.map +1 -0
  26. package/dist/filters-pmcaYp4q.d.mts +45 -0
  27. package/dist/filters-pmcaYp4q.d.mts.map +1 -0
  28. package/dist/helpers/ast-utils.cjs +1 -7
  29. package/dist/helpers/ast-utils.d.cts +2 -19
  30. package/dist/helpers/ast-utils.d.mts +2 -0
  31. package/dist/helpers/ast-utils.mjs +1 -0
  32. package/dist/helpers/create-plugin.cjs +1 -7
  33. package/dist/helpers/create-plugin.d.cts +3 -35
  34. package/dist/helpers/create-plugin.d.mts +3 -0
  35. package/dist/helpers/create-plugin.mjs +1 -0
  36. package/dist/helpers/filters.cjs +1 -7
  37. package/dist/helpers/filters.d.cts +3 -63
  38. package/dist/helpers/filters.d.mts +3 -0
  39. package/dist/helpers/filters.mjs +1 -0
  40. package/dist/helpers/index.cjs +1 -1
  41. package/dist/helpers/index.d.cts +8 -32
  42. package/dist/helpers/index.d.mts +8 -0
  43. package/dist/helpers/index.mjs +1 -0
  44. package/dist/helpers/module-helpers.cjs +1 -7
  45. package/dist/helpers/module-helpers.d.cts +3 -69
  46. package/dist/helpers/module-helpers.d.mts +3 -0
  47. package/dist/helpers/module-helpers.mjs +1 -0
  48. package/dist/helpers/options.cjs +1 -7
  49. package/dist/helpers/options.d.cts +3 -38
  50. package/dist/helpers/options.d.mts +3 -0
  51. package/dist/helpers/options.mjs +1 -0
  52. package/dist/helpers-C23KLU23.mjs +1 -0
  53. package/dist/index-ClXLQ1fw.d.mts +1 -0
  54. package/dist/index-DeEmP3Jc.d.cts +1 -0
  55. package/dist/index-QbUkWSLh.d.mts +1 -0
  56. package/dist/index-zO0Ly4bS.d.cts +1 -0
  57. package/dist/index.cjs +1 -7
  58. package/dist/index.d.cts +13 -36
  59. package/dist/index.d.cts.map +1 -0
  60. package/dist/index.d.mts +21 -0
  61. package/dist/index.d.mts.map +1 -0
  62. package/dist/index.mjs +2 -0
  63. package/dist/index.mjs.map +1 -0
  64. package/dist/{helpers/module-helpers.d.ts → module-helpers-BzPwtKvm.d.cts} +9 -28
  65. package/dist/module-helpers-BzPwtKvm.d.cts.map +1 -0
  66. package/dist/module-helpers-CBJeXQA-.cjs +1 -0
  67. package/dist/module-helpers-CFI-GsFM.mjs +2 -0
  68. package/dist/module-helpers-CFI-GsFM.mjs.map +1 -0
  69. package/dist/module-helpers-c5XPX8yl.d.mts +50 -0
  70. package/dist/module-helpers-c5XPX8yl.d.mts.map +1 -0
  71. package/dist/options-BKuJqVQa.d.cts +18 -0
  72. package/dist/options-BKuJqVQa.d.cts.map +1 -0
  73. package/dist/options-DqYK3Sbw.d.mts +18 -0
  74. package/dist/options-DqYK3Sbw.d.mts.map +1 -0
  75. package/dist/options-WrgZrzO5.mjs +2 -0
  76. package/dist/options-WrgZrzO5.mjs.map +1 -0
  77. package/dist/options-d1d8EwPZ.cjs +1 -0
  78. package/dist/plugin-BSBH78mm.cjs +0 -0
  79. package/dist/plugin-CpyJWCZI.mjs +1 -0
  80. package/dist/plugin-DNeuXNS0.d.cts +18 -0
  81. package/dist/plugin-DNeuXNS0.d.cts.map +1 -0
  82. package/dist/plugin-sSlCWUMB.d.mts +18 -0
  83. package/dist/plugin-sSlCWUMB.d.mts.map +1 -0
  84. package/dist/types/index.cjs +1 -1
  85. package/dist/types/index.d.cts +4 -25
  86. package/dist/types/index.d.mts +4 -0
  87. package/dist/types/index.mjs +1 -0
  88. package/dist/types/plugin.cjs +1 -1
  89. package/dist/types/plugin.d.cts +3 -39
  90. package/dist/types/plugin.d.mts +3 -0
  91. package/dist/types/plugin.mjs +1 -0
  92. package/dist/types-CKPddlfS.cjs +0 -0
  93. package/dist/types-cM7ObqRe.mjs +1 -0
  94. package/package.json +52 -34
  95. package/dist/chunk-FBBMZ4NC.cjs +0 -7
  96. package/dist/chunk-UCUR73HG.js +0 -7
  97. package/dist/helpers/ast-utils.js +0 -7
  98. package/dist/helpers/create-plugin.d.ts +0 -35
  99. package/dist/helpers/create-plugin.js +0 -7
  100. package/dist/helpers/filters.js +0 -7
  101. package/dist/helpers/index.d.ts +0 -32
  102. package/dist/helpers/index.js +0 -1
  103. package/dist/helpers/module-helpers.js +0 -7
  104. package/dist/helpers/options.d.ts +0 -38
  105. package/dist/helpers/options.js +0 -7
  106. package/dist/index.d.ts +0 -44
  107. package/dist/index.js +0 -7
  108. package/dist/plugin-C57J4nVr.d.cts +0 -1615
  109. package/dist/plugin-C57J4nVr.d.ts +0 -1615
  110. package/dist/types/index.d.ts +0 -25
  111. package/dist/types/index.js +0 -1
  112. package/dist/types/plugin.d.ts +0 -39
  113. /package/dist/{types/plugin.js → helpers-Bx2yBrpn.cjs} +0 -0
File without changes
@@ -0,0 +1 @@
1
+ export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-babel",
3
- "version": "0.12.56",
3
+ "version": "0.12.58",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -39,91 +39,109 @@
39
39
  "license": "Apache-2.0",
40
40
  "private": false,
41
41
  "main": "dist/index.cjs",
42
- "module": "dist/index.js",
42
+ "module": "dist/index.mjs",
43
43
  "exports": {
44
44
  "./package.json": "./package.json",
45
45
  ".": {
46
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
46
+ "import": {
47
+ "types": "./dist/index.d.mts",
48
+ "default": "./dist/index.mjs"
49
+ },
47
50
  "require": {
48
51
  "types": "./dist/index.d.cts",
49
52
  "default": "./dist/index.cjs"
50
53
  },
51
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
54
+ "default": {
55
+ "types": "./dist/index.d.mts",
56
+ "default": "./dist/index.mjs"
57
+ }
52
58
  },
53
59
  "./index": {
54
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
60
+ "import": {
61
+ "types": "./dist/index.d.mts",
62
+ "default": "./dist/index.mjs"
63
+ },
55
64
  "require": {
56
65
  "types": "./dist/index.d.cts",
57
66
  "default": "./dist/index.cjs"
58
67
  },
59
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
68
+ "default": {
69
+ "types": "./dist/index.d.mts",
70
+ "default": "./dist/index.mjs"
71
+ }
60
72
  },
61
73
  "./plugin": {
62
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
74
+ "import": {
75
+ "types": "./dist/index.d.mts",
76
+ "default": "./dist/index.mjs"
77
+ },
63
78
  "require": {
64
79
  "types": "./dist/index.d.cts",
65
80
  "default": "./dist/index.cjs"
66
81
  },
67
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
82
+ "default": {
83
+ "types": "./dist/index.d.mts",
84
+ "default": "./dist/index.mjs"
85
+ }
68
86
  },
69
87
  "./types": {
70
88
  "import": {
71
- "types": "./dist/types/index.d.ts",
72
- "default": "./dist/types/index.js"
89
+ "types": "./dist/types/index.d.mts",
90
+ "default": "./dist/types/index.mjs"
73
91
  },
74
92
  "require": {
75
93
  "types": "./dist/types/index.d.cts",
76
94
  "default": "./dist/types/index.cjs"
77
95
  },
78
96
  "default": {
79
- "types": "./dist/types/index.d.ts",
80
- "default": "./dist/types/index.js"
97
+ "types": "./dist/types/index.d.mts",
98
+ "default": "./dist/types/index.mjs"
81
99
  }
82
100
  },
83
101
  "./types/*": {
84
102
  "import": {
85
- "types": "./dist/types/*.d.ts",
86
- "default": "./dist/types/*.js"
103
+ "types": "./dist/types/*.d.mts",
104
+ "default": "./dist/types/*.mjs"
87
105
  },
88
106
  "require": {
89
107
  "types": "./dist/types/*.d.cts",
90
108
  "default": "./dist/types/*.cjs"
91
109
  },
92
110
  "default": {
93
- "types": "./dist/types/*.d.ts",
94
- "default": "./dist/types/*.js"
111
+ "types": "./dist/types/*.d.mts",
112
+ "default": "./dist/types/*.mjs"
95
113
  }
96
114
  },
97
115
  "./helpers": {
98
116
  "import": {
99
- "types": "./dist/helpers/index.d.ts",
100
- "default": "./dist/helpers/index.js"
117
+ "types": "./dist/helpers/index.d.mts",
118
+ "default": "./dist/helpers/index.mjs"
101
119
  },
102
120
  "require": {
103
121
  "types": "./dist/helpers/index.d.cts",
104
122
  "default": "./dist/helpers/index.cjs"
105
123
  },
106
124
  "default": {
107
- "types": "./dist/helpers/index.d.ts",
108
- "default": "./dist/helpers/index.js"
125
+ "types": "./dist/helpers/index.d.mts",
126
+ "default": "./dist/helpers/index.mjs"
109
127
  }
110
128
  },
111
129
  "./helpers/*": {
112
130
  "import": {
113
- "types": "./dist/helpers/*.d.ts",
114
- "default": "./dist/helpers/*.js"
131
+ "types": "./dist/helpers/*.d.mts",
132
+ "default": "./dist/helpers/*.mjs"
115
133
  },
116
134
  "require": {
117
135
  "types": "./dist/helpers/*.d.cts",
118
136
  "default": "./dist/helpers/*.cjs"
119
137
  },
120
138
  "default": {
121
- "types": "./dist/helpers/*.d.ts",
122
- "default": "./dist/helpers/*.js"
139
+ "types": "./dist/helpers/*.d.mts",
140
+ "default": "./dist/helpers/*.mjs"
123
141
  }
124
142
  }
125
143
  },
126
- "typings": "dist/index.d.ts",
144
+ "typings": "dist/index.d.mts",
127
145
  "files": ["dist/**/*"],
128
146
  "keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
129
147
  "peerDependencies": { "@babel/plugin-syntax-typescript": "^7.27.1" },
@@ -136,23 +154,23 @@
136
154
  "@babel/helper-plugin-utils": "^7.27.1",
137
155
  "@babel/parser": "^7.28.5",
138
156
  "@babel/types": "^7.28.5",
139
- "@storm-software/config-tools": "^1.188.50",
140
- "@stryke/fs": "^0.33.8",
141
- "@stryke/path": "^0.21.6",
142
- "@stryke/type-checks": "^0.4.3",
143
- "@stryke/types": "^0.10.12",
157
+ "@storm-software/config-tools": "^1.188.52",
158
+ "@stryke/fs": "^0.33.9",
159
+ "@stryke/path": "^0.22.0",
160
+ "@stryke/type-checks": "^0.4.4",
161
+ "@stryke/types": "^0.10.13",
144
162
  "chalk": "5.6.2",
145
163
  "defu": "^6.1.4",
146
164
  "jiti": "^2.6.1",
147
- "powerlines": "^0.28.0",
165
+ "powerlines": "^0.30.0",
148
166
  "unplugin": "3.0.0-beta.3"
149
167
  },
150
168
  "devDependencies": {
151
169
  "@babel/plugin-syntax-typescript": "^7.27.1",
152
- "@powerlines/nx": "^0.10.47",
153
- "@powerlines/plugin-plugin": "^0.11.55",
170
+ "@powerlines/nx": "^0.10.49",
171
+ "@powerlines/plugin-plugin": "^0.12.1",
154
172
  "@types/node": "^24.10.1"
155
173
  },
156
174
  "publishConfig": { "access": "public" },
157
- "gitHead": "3feaa815e117c46d827eee84c3521e54670abb9b"
175
+ "gitHead": "f0a4e1526773f5d4bfb63fd5ba1d02d5aa9bc771"
158
176
  }
@@ -1,7 +0,0 @@
1
- 'use strict';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:true});exports.a=d;
@@ -1,7 +0,0 @@
1
- /*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:true});export{d as a};
@@ -1,7 +0,0 @@
1
- import {a}from'../chunk-UCUR73HG.js';import a$1 from'@babel/generator';import {parse}from'@babel/parser';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function l(r,e={}){return parse(r,{plugins:["typescript"],sourceType:"module",allowImportExportEverywhere:true,allowAwaitOutsideFunction:true,...e})}a(l,"parseAst");let t=a$1;"default"in t&&(t=t.default);function m(r,e){return t(r,e?{importAttributesKeyword:"with",sourceMaps:true,...e}:void 0)}a(m,"generateFromAst");export{m as generateFromAst,l as parseAst};
@@ -1,35 +0,0 @@
1
- import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-C57J4nVr.js';
2
- import '@stryke/types/base';
3
- import 'unplugin';
4
- import '@stryke/types/array';
5
- import '@babel/core';
6
- import '@storm-software/build-tools/types';
7
- import '@storm-software/config-tools/types';
8
- import '@storm-software/config/types';
9
- import '@stryke/types/configuration';
10
- import '@stryke/types/file';
11
- import 'vite';
12
- import '@babel/helper-plugin-utils';
13
- import '@stryke/env/get-env-paths';
14
- import '@stryke/http/fetch';
15
- import '@stryke/types/package-json';
16
- import 'jiti';
17
- import 'magic-string';
18
- import 'oxc-parser';
19
- import 'semver';
20
- import 'ts-morph';
21
- import 'undici';
22
- import '@stryke/fs/resolve';
23
- import '@stryke/types/tsconfig';
24
- import 'typescript';
25
-
26
- /**
27
- * Create a Babel plugin using the provided builder function.
28
- *
29
- * @param name - The name of the plugin.
30
- * @param builder - The builder function that defines the plugin behavior.
31
- * @returns A Babel plugin declaration.
32
- */
33
- declare function createBabelPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>>(name: string, builder: BabelTransformPluginBuilder<TContext, TOptions>): DeclareBabelTransformPluginReturn<TContext, TOptions>;
34
-
35
- export { createBabelPlugin };
@@ -1,7 +0,0 @@
1
- import {a}from'../chunk-UCUR73HG.js';import {declare}from'@babel/helper-plugin-utils';import {LogLevelLabel}from'@storm-software/config-tools/types';import s from'chalk';import {extendLog}from'powerlines/lib/logger';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function L(t,g){const i=a(e=>declare((r,u,m)=>{r.cache.using(()=>e.meta.checksum),r.assertVersion("^7.0.0-0");const n=extendLog(e.log,t);n(LogLevelLabel.TRACE,`Initializing the ${s.bold.cyanBright(t)} Babel plugin`);const l=g({log:n,name:t,api:r,options:u,context:e,dirname:m});return l.name=t,n(LogLevelLabel.TRACE,`Completed initialization of the ${s.bold.cyanBright(t)} Babel plugin`),l}),"plugin");return i.$$name=t,i}a(L,"createBabelPlugin");export{L as createBabelPlugin};
@@ -1,7 +0,0 @@
1
- import {a}from'../chunk-UCUR73HG.js';import {isFunction}from'@stryke/type-checks/is-function';import {isObject}from'@stryke/type-checks/is-object';import {isSetString}from'@stryke/type-checks/is-set-string';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function s(e){return isSetString(e)?e:Array.isArray(e)&&e.length>0?s(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}a(s,"getPluginName");function N(e,r){return !!(s(r)&&e.some(n=>Array.isArray(n)&&s(n[0])===s(r)))}a(N,"isDuplicatePlugin");function $(e,r){return (n,o)=>r!==o&&e.fs.ids[r]!==o&&r!==e.fs.ids[o]&&e.fs.ids[r]!==e.fs.ids[o]}a($,"filterPluginByFileId");function T(e,r,n,o){if(!Array.isArray(r)||!r.some(t=>Array.isArray(t))&&r.length<4&&r.length>0&&(isSetString(r[0])||isFunction(r[0])||r.length>1&&isObject(r[1])||r.length>2&&isObject(r[2])))return Array.isArray(r)?[r[0],r.length>1?r[1]:{},{filter:a((t,i)=>n(t,i)&&(r.length<2||!isFunction(r[2])||r[2]?.(t,i)),"filter")}]:[r,{},{filter:n}];if(!o)throw new Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");const f=r.findIndex(t=>s(t)?.toLowerCase()===o.toLowerCase());return f>-1&&(r[f]=T(e,r[f],n,o)),r}a(T,"addPluginFilter");export{T as addPluginFilter,$ as filterPluginByFileId,s as getPluginName,N as isDuplicatePlugin};
@@ -1,32 +0,0 @@
1
- export { GenerateFromAstOptions, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from './ast-utils.js';
2
- export { createBabelPlugin } from './create-plugin.js';
3
- export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from './filters.js';
4
- export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from './module-helpers.js';
5
- export { resolveBabelPlugin, resolvePluginFunction } from './options.js';
6
- export { GeneratorResult } from '@babel/generator';
7
- import '@babel/parser';
8
- import '@babel/types';
9
- import '../plugin-C57J4nVr.js';
10
- import '@stryke/types/base';
11
- import 'unplugin';
12
- import '@stryke/types/array';
13
- import '@babel/core';
14
- import '@storm-software/build-tools/types';
15
- import '@storm-software/config-tools/types';
16
- import '@storm-software/config/types';
17
- import '@stryke/types/configuration';
18
- import '@stryke/types/file';
19
- import 'vite';
20
- import '@babel/helper-plugin-utils';
21
- import '@stryke/env/get-env-paths';
22
- import '@stryke/http/fetch';
23
- import '@stryke/types/package-json';
24
- import 'jiti';
25
- import 'magic-string';
26
- import 'oxc-parser';
27
- import 'semver';
28
- import 'ts-morph';
29
- import 'undici';
30
- import '@stryke/fs/resolve';
31
- import '@stryke/types/tsconfig';
32
- import 'typescript';
@@ -1 +0,0 @@
1
- export*from'./ast-utils';export*from'./create-plugin';export*from'./filters';export*from'./module-helpers';export*from'./options';
@@ -1,7 +0,0 @@
1
- import {a}from'../chunk-UCUR73HG.js';import*as o from'@babel/types';import {isString}from'@stryke/type-checks/is-string';import {parseAst}from'./ast-utils';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function E(r,t){const e=t==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration";for(const n of r.program.body)if(n.type===e){if(t==="default")return n.declaration;if(n.declaration&&"declarations"in n.declaration){const a=n.declaration.declarations[0];if(a&&"name"in a.id&&a.id.name===t)return a.init}}}a(E,"findExport");function S(r){return (isString(r)?parseAst(r):r).program.body.flatMap(e=>e.type==="ExportDefaultDeclaration"?["default"]:e.type==="ExportNamedDeclaration"&&e.declaration&&"declarations"in e.declaration?e.declaration.declarations.map(n=>"name"in n.id?n.id.name:""):[]).filter(Boolean)}a(S,"listExports");function h(r){return r.program.body.flatMap(t=>t.type==="ImportDeclaration"?t.specifiers.map(e=>e.type==="ImportDefaultSpecifier"?"default":e.type==="ImportSpecifier"&&"imported"in e?e.imported.type==="Identifier"?e.imported.name:e.imported.value:""):[]).filter(Boolean)}a(h,"listImports");function b(r){return o.isImport(r.node.callee)}a(b,"isImportCall");function v(r,t,e){return o.importDeclaration([o.importSpecifier(o.identifier(t),o.stringLiteral(e||t))],o.stringLiteral(r))}a(v,"getImport");function F(r,t){s(r.scope.getProgramParent().path,t);}a(F,"addImport");function l(r){return r.get("specifiers").filter(Boolean).every(t=>t?.isImportSpecifier())&&r.node.importKind!=="type"&&r.node.importKind!=="typeof"}a(l,"isNonNamespacedImport");function d(r){const t=new Map;return r.traverse({ImportDeclaration(e){l(e)&&t.set(e.node.source.value,e);}}),t}a(d,"getExistingImports");function s(r,t){d(r).get(t.module)||r.unshiftContainer("body",o.importDeclaration([o.importSpecifier(o.identifier(t.name||t.imported),o.identifier(t.imported))],o.stringLiteral(t.module)));}a(s,"addImportsToProgram");export{F as addImport,s as addImportsToProgram,E as findExport,v as getImport,b as isImportCall,S as listExports,h as listImports};
@@ -1,38 +0,0 @@
1
- import { PluginTarget, PluginOptions } from '@babel/core';
2
- import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-C57J4nVr.js';
3
- import '@stryke/types/base';
4
- import 'unplugin';
5
- import '@stryke/types/array';
6
- import '@storm-software/build-tools/types';
7
- import '@storm-software/config-tools/types';
8
- import '@storm-software/config/types';
9
- import '@stryke/types/configuration';
10
- import '@stryke/types/file';
11
- import 'vite';
12
- import '@babel/helper-plugin-utils';
13
- import '@stryke/env/get-env-paths';
14
- import '@stryke/http/fetch';
15
- import '@stryke/types/package-json';
16
- import 'jiti';
17
- import 'magic-string';
18
- import 'oxc-parser';
19
- import 'semver';
20
- import 'ts-morph';
21
- import 'undici';
22
- import '@stryke/fs/resolve';
23
- import '@stryke/types/tsconfig';
24
- import 'typescript';
25
-
26
- declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
27
- /**
28
- * Resolve the [Babel](https://babeljs.io/) plugin.
29
- *
30
- * @param context - The context for the transformation.
31
- * @param code - The code to be transformed.
32
- * @param id - The ID of the source file.
33
- * @param plugin - The Babel plugin to resolve.
34
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
35
- */
36
- declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
37
-
38
- export { resolveBabelPlugin, resolvePluginFunction };
@@ -1,7 +0,0 @@
1
- import {a as a$1}from'../chunk-UCUR73HG.js';import {LogLevelLabel}from'@storm-software/config-tools/types';import {isFunction}from'@stryke/type-checks/is-function';import f from'chalk';import {getPluginName}from'./filters';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function a(o,e){try{return Array.isArray(e)&&e.length>0&&e[0]?isFunction(e[0])?e[0](o):e[0]:isFunction(e)?e(o):e}catch{return e[0]}}a$1(a,"resolvePluginFunction");function C(o,e,i,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&isFunction(r[2])&&!r[2](e,i)){o.log(LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${f.bold.cyanBright(getPluginName(r)||"unnamed")} for ${i}`);return}return r.length>2?[a(o,r),r[1],r[2]]:[a(o,r),r[1],null]}return [a(o,r),{},null]}a$1(C,"resolveBabelPlugin");export{C as resolveBabelPlugin,a as resolvePluginFunction};
package/dist/index.d.ts DELETED
@@ -1,44 +0,0 @@
1
- import { P as Plugin } from './plugin-C57J4nVr.js';
2
- import { BabelPluginOptions, BabelPluginContext } from './types/plugin.js';
3
- export { BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from './types/plugin.js';
4
- export { GenerateFromAstOptions, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from './helpers/ast-utils.js';
5
- export { createBabelPlugin } from './helpers/create-plugin.js';
6
- export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from './helpers/filters.js';
7
- export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from './helpers/module-helpers.js';
8
- export { resolveBabelPlugin, resolvePluginFunction } from './helpers/options.js';
9
- export { GeneratorResult } from '@babel/generator';
10
- import '@stryke/types/base';
11
- import 'unplugin';
12
- import '@stryke/types/array';
13
- import '@babel/core';
14
- import '@storm-software/build-tools/types';
15
- import '@storm-software/config-tools/types';
16
- import '@storm-software/config/types';
17
- import '@stryke/types/configuration';
18
- import '@stryke/types/file';
19
- import 'vite';
20
- import '@babel/helper-plugin-utils';
21
- import '@stryke/env/get-env-paths';
22
- import '@stryke/http/fetch';
23
- import '@stryke/types/package-json';
24
- import 'jiti';
25
- import 'magic-string';
26
- import 'oxc-parser';
27
- import 'semver';
28
- import 'ts-morph';
29
- import 'undici';
30
- import '@stryke/fs/resolve';
31
- import '@stryke/types/tsconfig';
32
- import 'typescript';
33
- import '@babel/parser';
34
- import '@babel/types';
35
-
36
- /**
37
- * Babel plugin for Powerlines.
38
- *
39
- * @param options - The Babel plugin user configuration options.
40
- * @returns A Powerlines plugin that integrates Babel transformations.
41
- */
42
- declare const plugin: (options?: BabelPluginOptions) => Plugin<BabelPluginContext>;
43
-
44
- export { BabelPluginContext, BabelPluginOptions, plugin as default, plugin };
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- import {a}from'./chunk-UCUR73HG.js';import {transformAsync}from'@babel/core';import {LogLevelLabel}from'@storm-software/config-tools/types';import {findFileExtensionSafe,findFileExtension}from'@stryke/path/file-path-fns';import {isParentPath}from'@stryke/path/is-parent-path';import {isSetObject}from'@stryke/type-checks/is-set-object';import a$1 from'defu';import {isDuplicatePlugin}from'./helpers/filters';import {resolveBabelPlugin}from'./helpers/options';export*from'./helpers';export*from'./types';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- const B=a((i={})=>({name:"babel",config(){if(isSetObject(i))return {transform:{babel:i}}},configResolved:{order:"pre",handler(){this.devDependencies["@babel/core"]="^7.28.4",this.config.transform.babel=a$1(this.config.transform.babel??{},{plugins:[],presets:[]});}},async transform(t,e){if(isParentPath(e,this.powerlinesPath)||t.includes("/* @storm-ignore */")||t.includes("/* @storm-disable */"))return this.log(LogLevelLabel.TRACE,`Skipping Babel transformation for: ${e}`),{code:t,id:e};this.log(LogLevelLabel.TRACE,`Babel transforming file: ${e}`);const n=this.config.transform.babel.plugins.map(r=>resolveBabelPlugin(this,t,e,r)).filter((r,u,l)=>r&&!isDuplicatePlugin(l,r)),o=this.config.transform.babel.presets.map(r=>resolveBabelPlugin(this,t,e,r)).filter((r,u,l)=>r&&!isDuplicatePlugin(l,r));if(Array.isArray(n)&&n.length===0&&Array.isArray(o)&&o.length===0)return {code:t,id:e};["ts","cts","mts","tsx"].includes(findFileExtensionSafe(e))&&!isDuplicatePlugin(n,"@babel/plugin-syntax-typescript")&&!isDuplicatePlugin(o,"@babel/preset-typescript")&&n.unshift(["@babel/plugin-syntax-typescript",{isTSX:findFileExtension(e)===".tsx"}]);const f=await transformAsync(t,{highlightCode:true,code:true,ast:false,cloneInputAst:false,comments:true,sourceType:"module",configFile:false,babelrc:false,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:e,plugins:n.map(r=>Array.isArray(r)&&r.length>=2?[r[0],a$1(r.length>1&&r[1]?r[1]:{},{options:i})]:r).filter(Boolean),presets:o.map(r=>Array.isArray(r)&&r.length>=2?[r[0],a$1(r.length>1&&r[1]?r[1]:{},{options:i})]:r).filter(Boolean)});if(!f?.code)throw new Error(`Powerlines - Babel plugin failed to compile ${e}`);return {code:f.code,id:e}}}),"plugin");var I=B;export{I as default,B as plugin};