@powerlines/plugin-babel 0.12.55 → 0.12.57
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.
- package/dist/ast-utils-BXgehtOj.cjs +1 -0
- package/dist/{helpers/ast-utils.d.ts → ast-utils-Bs6DBkKg.d.mts} +8 -7
- package/dist/ast-utils-Bs6DBkKg.d.mts.map +1 -0
- package/dist/ast-utils-DeuXcuqs.d.cts +20 -0
- package/dist/ast-utils-DeuXcuqs.d.cts.map +1 -0
- package/dist/ast-utils-QwV5Hp9M.mjs +2 -0
- package/dist/ast-utils-QwV5Hp9M.mjs.map +1 -0
- package/dist/babel-DUp3iLgB.d.cts +1696 -0
- package/dist/babel-DUp3iLgB.d.cts.map +1 -0
- package/dist/babel-Ny1M4Lo1.d.mts +1696 -0
- package/dist/babel-Ny1M4Lo1.d.mts.map +1 -0
- package/dist/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/create-plugin-BReiEjbd.d.mts +15 -0
- package/dist/create-plugin-BReiEjbd.d.mts.map +1 -0
- package/dist/create-plugin-BX_bUhNU.cjs +1 -0
- package/dist/create-plugin-D4xkNYdM.d.cts +15 -0
- package/dist/create-plugin-D4xkNYdM.d.cts.map +1 -0
- package/dist/create-plugin-pWE4rRW3.mjs +2 -0
- package/dist/create-plugin-pWE4rRW3.mjs.map +1 -0
- package/dist/{helpers/filters.d.ts → filters-Bn8Rw_y0.d.cts} +5 -23
- package/dist/filters-Bn8Rw_y0.d.cts.map +1 -0
- package/dist/filters-DJgM_YqO.cjs +1 -0
- package/dist/filters-DiGgT5l3.d.mts +45 -0
- package/dist/filters-DiGgT5l3.d.mts.map +1 -0
- package/dist/filters-H7GHqM8L.mjs +2 -0
- package/dist/filters-H7GHqM8L.mjs.map +1 -0
- package/dist/helpers/ast-utils.cjs +1 -7
- package/dist/helpers/ast-utils.d.cts +2 -19
- package/dist/helpers/ast-utils.d.mts +2 -0
- package/dist/helpers/ast-utils.mjs +1 -0
- package/dist/helpers/create-plugin.cjs +1 -7
- package/dist/helpers/create-plugin.d.cts +3 -32
- package/dist/helpers/create-plugin.d.mts +3 -0
- package/dist/helpers/create-plugin.mjs +1 -0
- package/dist/helpers/filters.cjs +1 -7
- package/dist/helpers/filters.d.cts +3 -60
- package/dist/helpers/filters.d.mts +3 -0
- package/dist/helpers/filters.mjs +1 -0
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +8 -29
- package/dist/helpers/index.d.mts +8 -0
- package/dist/helpers/index.mjs +1 -0
- package/dist/helpers/module-helpers.cjs +1 -7
- package/dist/helpers/module-helpers.d.cts +3 -66
- package/dist/helpers/module-helpers.d.mts +3 -0
- package/dist/helpers/module-helpers.mjs +1 -0
- package/dist/helpers/options.cjs +1 -7
- package/dist/helpers/options.d.cts +3 -35
- package/dist/helpers/options.d.mts +3 -0
- package/dist/helpers/options.mjs +1 -0
- package/dist/helpers-C23KLU23.mjs +1 -0
- package/dist/index-ClXLQ1fw.d.mts +1 -0
- package/dist/index-DeEmP3Jc.d.cts +1 -0
- package/dist/index-QbUkWSLh.d.mts +1 -0
- package/dist/index-zO0Ly4bS.d.cts +1 -0
- package/dist/index.cjs +1 -7
- package/dist/index.d.cts +13 -33
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/module-helpers-CBJeXQA-.cjs +1 -0
- package/dist/module-helpers-CFI-GsFM.mjs +2 -0
- package/dist/module-helpers-CFI-GsFM.mjs.map +1 -0
- package/dist/{helpers/module-helpers.d.ts → module-helpers-CliGsjDF.d.mts} +9 -25
- package/dist/module-helpers-CliGsjDF.d.mts.map +1 -0
- package/dist/module-helpers-vWFW7b4i.d.cts +50 -0
- package/dist/module-helpers-vWFW7b4i.d.cts.map +1 -0
- package/dist/options-B2GpXLT2.d.mts +18 -0
- package/dist/options-B2GpXLT2.d.mts.map +1 -0
- package/dist/options-D2AF5e39.d.cts +18 -0
- package/dist/options-D2AF5e39.d.cts.map +1 -0
- package/dist/options-WrgZrzO5.mjs +2 -0
- package/dist/options-WrgZrzO5.mjs.map +1 -0
- package/dist/options-d1d8EwPZ.cjs +1 -0
- package/dist/plugin-BSBH78mm.cjs +0 -0
- package/dist/plugin-BTZ_-wLO.d.mts +18 -0
- package/dist/plugin-BTZ_-wLO.d.mts.map +1 -0
- package/dist/plugin-CpyJWCZI.mjs +1 -0
- package/dist/plugin-DKSpgBMK.d.cts +18 -0
- package/dist/plugin-DKSpgBMK.d.cts.map +1 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +4 -22
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.cts +3 -36
- package/dist/types/plugin.d.mts +3 -0
- package/dist/types/plugin.mjs +1 -0
- package/dist/types-CKPddlfS.cjs +0 -0
- package/dist/types-cM7ObqRe.mjs +1 -0
- package/package.json +52 -34
- package/dist/chunk-FBBMZ4NC.cjs +0 -7
- package/dist/chunk-UCUR73HG.js +0 -7
- package/dist/helpers/ast-utils.js +0 -7
- package/dist/helpers/create-plugin.d.ts +0 -32
- package/dist/helpers/create-plugin.js +0 -7
- package/dist/helpers/filters.js +0 -7
- package/dist/helpers/index.d.ts +0 -29
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/module-helpers.js +0 -7
- package/dist/helpers/options.d.ts +0 -35
- package/dist/helpers/options.js +0 -7
- package/dist/index.d.ts +0 -41
- package/dist/index.js +0 -7
- package/dist/plugin-ZWwqzlgV.d.cts +0 -1545
- package/dist/plugin-ZWwqzlgV.d.ts +0 -1545
- package/dist/types/index.d.ts +0 -22
- package/dist/types/index.js +0 -1
- package/dist/types/plugin.d.ts +0 -36
- /package/dist/{types/plugin.js → helpers-Bx2yBrpn.cjs} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-babel",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.57",
|
|
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.
|
|
42
|
+
"module": "dist/index.mjs",
|
|
43
43
|
"exports": {
|
|
44
44
|
"./package.json": "./package.json",
|
|
45
45
|
".": {
|
|
46
|
-
"import": {
|
|
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": {
|
|
54
|
+
"default": {
|
|
55
|
+
"types": "./dist/index.d.mts",
|
|
56
|
+
"default": "./dist/index.mjs"
|
|
57
|
+
}
|
|
52
58
|
},
|
|
53
59
|
"./index": {
|
|
54
|
-
"import": {
|
|
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": {
|
|
68
|
+
"default": {
|
|
69
|
+
"types": "./dist/index.d.mts",
|
|
70
|
+
"default": "./dist/index.mjs"
|
|
71
|
+
}
|
|
60
72
|
},
|
|
61
73
|
"./plugin": {
|
|
62
|
-
"import": {
|
|
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": {
|
|
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.
|
|
72
|
-
"default": "./dist/types/index.
|
|
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.
|
|
80
|
-
"default": "./dist/types/index.
|
|
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.
|
|
86
|
-
"default": "./dist/types/*.
|
|
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.
|
|
94
|
-
"default": "./dist/types/*.
|
|
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.
|
|
100
|
-
"default": "./dist/helpers/index.
|
|
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.
|
|
108
|
-
"default": "./dist/helpers/index.
|
|
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.
|
|
114
|
-
"default": "./dist/helpers/*.
|
|
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.
|
|
122
|
-
"default": "./dist/helpers/*.
|
|
139
|
+
"types": "./dist/helpers/*.d.mts",
|
|
140
|
+
"default": "./dist/helpers/*.mjs"
|
|
123
141
|
}
|
|
124
142
|
}
|
|
125
143
|
},
|
|
126
|
-
"typings": "dist/index.d.
|
|
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" },
|
|
@@ -137,22 +155,22 @@
|
|
|
137
155
|
"@babel/parser": "^7.28.5",
|
|
138
156
|
"@babel/types": "^7.28.5",
|
|
139
157
|
"@storm-software/config-tools": "^1.188.50",
|
|
140
|
-
"@stryke/fs": "^0.33.
|
|
141
|
-
"@stryke/path": "^0.
|
|
142
|
-
"@stryke/type-checks": "^0.
|
|
143
|
-
"@stryke/types": "^0.10.
|
|
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.
|
|
148
|
-
"unplugin": "
|
|
165
|
+
"powerlines": "^0.29.0",
|
|
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.
|
|
153
|
-
"@powerlines/plugin-plugin": "^0.
|
|
170
|
+
"@powerlines/nx": "^0.10.48",
|
|
171
|
+
"@powerlines/plugin-plugin": "^0.12.0",
|
|
154
172
|
"@types/node": "^24.10.1"
|
|
155
173
|
},
|
|
156
174
|
"publishConfig": { "access": "public" },
|
|
157
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "f65e5efb5fd5a7f5eab1936aec5a2807b931ae87"
|
|
158
176
|
}
|
package/dist/chunk-FBBMZ4NC.cjs
DELETED
package/dist/chunk-UCUR73HG.js
DELETED
|
@@ -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,32 +0,0 @@
|
|
|
1
|
-
import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-ZWwqzlgV.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/types/package-json';
|
|
15
|
-
import 'jiti';
|
|
16
|
-
import 'magic-string';
|
|
17
|
-
import 'semver';
|
|
18
|
-
import 'ts-morph';
|
|
19
|
-
import '@stryke/fs/resolve';
|
|
20
|
-
import '@stryke/types/tsconfig';
|
|
21
|
-
import 'typescript';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Create a Babel plugin using the provided builder function.
|
|
25
|
-
*
|
|
26
|
-
* @param name - The name of the plugin.
|
|
27
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
28
|
-
* @returns A Babel plugin declaration.
|
|
29
|
-
*/
|
|
30
|
-
declare function createBabelPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>>(name: string, builder: BabelTransformPluginBuilder<TContext, TOptions>): DeclareBabelTransformPluginReturn<TContext, TOptions>;
|
|
31
|
-
|
|
32
|
-
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};
|
package/dist/helpers/filters.js
DELETED
|
@@ -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};
|
package/dist/helpers/index.d.ts
DELETED
|
@@ -1,29 +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-ZWwqzlgV.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/types/package-json';
|
|
23
|
-
import 'jiti';
|
|
24
|
-
import 'magic-string';
|
|
25
|
-
import 'semver';
|
|
26
|
-
import 'ts-morph';
|
|
27
|
-
import '@stryke/fs/resolve';
|
|
28
|
-
import '@stryke/types/tsconfig';
|
|
29
|
-
import 'typescript';
|
package/dist/helpers/index.js
DELETED
|
@@ -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,35 +0,0 @@
|
|
|
1
|
-
import { PluginTarget, PluginOptions } from '@babel/core';
|
|
2
|
-
import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-ZWwqzlgV.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/types/package-json';
|
|
15
|
-
import 'jiti';
|
|
16
|
-
import 'magic-string';
|
|
17
|
-
import 'semver';
|
|
18
|
-
import 'ts-morph';
|
|
19
|
-
import '@stryke/fs/resolve';
|
|
20
|
-
import '@stryke/types/tsconfig';
|
|
21
|
-
import 'typescript';
|
|
22
|
-
|
|
23
|
-
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
24
|
-
/**
|
|
25
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The context for the transformation.
|
|
28
|
-
* @param code - The code to be transformed.
|
|
29
|
-
* @param id - The ID of the source file.
|
|
30
|
-
* @param plugin - The Babel plugin to resolve.
|
|
31
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
32
|
-
*/
|
|
33
|
-
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
34
|
-
|
|
35
|
-
export { resolveBabelPlugin, resolvePluginFunction };
|
package/dist/helpers/options.js
DELETED
|
@@ -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,41 +0,0 @@
|
|
|
1
|
-
import { P as Plugin } from './plugin-ZWwqzlgV.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/types/package-json';
|
|
23
|
-
import 'jiti';
|
|
24
|
-
import 'magic-string';
|
|
25
|
-
import 'semver';
|
|
26
|
-
import 'ts-morph';
|
|
27
|
-
import '@stryke/fs/resolve';
|
|
28
|
-
import '@stryke/types/tsconfig';
|
|
29
|
-
import 'typescript';
|
|
30
|
-
import '@babel/parser';
|
|
31
|
-
import '@babel/types';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Babel plugin for Powerlines.
|
|
35
|
-
*
|
|
36
|
-
* @param options - The Babel plugin user configuration options.
|
|
37
|
-
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
38
|
-
*/
|
|
39
|
-
declare const plugin: (options?: BabelPluginOptions) => Plugin<BabelPluginContext>;
|
|
40
|
-
|
|
41
|
-
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};
|