@powerlines/plugin-babel 0.12.7 → 0.12.9

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 (41) hide show
  1. package/dist/chunk-FBBMZ4NC.cjs +7 -0
  2. package/dist/chunk-UCUR73HG.js +7 -0
  3. package/dist/helpers/ast-utils.cjs +7 -0
  4. package/dist/helpers/ast-utils.d.cts +17 -0
  5. package/dist/helpers/ast-utils.d.ts +17 -0
  6. package/dist/helpers/ast-utils.js +7 -0
  7. package/dist/helpers/create-plugin.cjs +7 -0
  8. package/dist/helpers/create-plugin.d.cts +34 -0
  9. package/dist/helpers/create-plugin.d.ts +34 -0
  10. package/dist/helpers/create-plugin.js +7 -0
  11. package/dist/helpers/filters.cjs +7 -0
  12. package/dist/helpers/filters.d.cts +62 -0
  13. package/dist/helpers/filters.d.ts +62 -0
  14. package/dist/helpers/filters.js +7 -0
  15. package/dist/helpers/index.cjs +1 -0
  16. package/dist/helpers/index.d.cts +31 -0
  17. package/dist/helpers/index.d.ts +31 -0
  18. package/dist/helpers/index.js +1 -0
  19. package/dist/helpers/module-helpers.cjs +7 -0
  20. package/dist/helpers/module-helpers.d.cts +68 -0
  21. package/dist/helpers/module-helpers.d.ts +68 -0
  22. package/dist/helpers/module-helpers.js +7 -0
  23. package/dist/helpers/options.cjs +7 -0
  24. package/dist/helpers/options.d.cts +37 -0
  25. package/dist/helpers/options.d.ts +37 -0
  26. package/dist/helpers/options.js +7 -0
  27. package/dist/plugin-CObsHnry.d.cts +1367 -0
  28. package/dist/plugin-CObsHnry.d.ts +1367 -0
  29. package/dist/src/index.cjs +7 -0
  30. package/dist/src/index.d.cts +43 -0
  31. package/dist/src/index.d.ts +43 -0
  32. package/dist/src/index.js +7 -0
  33. package/dist/types/index.cjs +1 -0
  34. package/dist/types/index.d.cts +24 -0
  35. package/dist/types/index.d.ts +24 -0
  36. package/dist/types/index.js +1 -0
  37. package/dist/types/plugin.cjs +1 -0
  38. package/dist/types/plugin.d.cts +34 -0
  39. package/dist/types/plugin.d.ts +34 -0
  40. package/dist/types/plugin.js +0 -0
  41. package/package.json +14 -9
@@ -0,0 +1,7 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),core=require('@babel/core'),types$1=require('@storm-software/config-tools/types'),filePathFns=require('@stryke/path/file-path-fns'),isParentPath=require('@stryke/path/is-parent-path'),isSetObject=require('@stryke/type-checks/is-set-object'),a=require('defu'),filters=require('./helpers/filters'),options=require('./helpers/options'),helpers=require('./helpers'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);/*****************************************
2
+ *
3
+ * ⚡ Built by Storm Software
4
+ *
5
+ *****************************************/
6
+
7
+ const B=chunkFBBMZ4NC_cjs.a((i={})=>({name:"babel",config(){if(isSetObject.isSetObject(i))return {transform:{babel:i}}},configResolved:{order:"pre",handler(){this.devDependencies["@babel/core"]="^7.28.4",this.config.transform.babel=a__default.default(this.config.transform.babel??{},{plugins:[],presets:[]});}},async transform(t,e){if(isParentPath.isParentPath(e,this.powerlinesPath)||t.includes("/* @storm-ignore */")||t.includes("/* @storm-disable */"))return this.log(types$1.LogLevelLabel.TRACE,`Skipping Babel transformation for: ${e}`),{code:t,id:e};this.log(types$1.LogLevelLabel.TRACE,`Babel transforming file: ${e}`);const n=this.config.transform.babel.plugins.map(r=>options.resolveBabelPlugin(this,t,e,r)).filter((r,u,l)=>r&&!filters.isDuplicatePlugin(l,r)),o=this.config.transform.babel.presets.map(r=>options.resolveBabelPlugin(this,t,e,r)).filter((r,u,l)=>r&&!filters.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(filePathFns.findFileExtensionSafe(e))&&!filters.isDuplicatePlugin(n,"@babel/plugin-syntax-typescript")&&!filters.isDuplicatePlugin(o,"@babel/preset-typescript")&&n.unshift(["@babel/plugin-syntax-typescript",{isTSX:filePathFns.findFileExtension(e)===".tsx"}]);const f=await core.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__default.default(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__default.default(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 j=B;exports.default=j;exports.plugin=B;Object.keys(helpers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return helpers[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
@@ -0,0 +1,43 @@
1
+ import { P as Plugin } from '../plugin-CObsHnry.cjs';
2
+ import { BabelPluginOptions, BabelPluginContext } from '../types/plugin.cjs';
3
+ export { BabelPluginResolvedConfig, BabelPluginUserConfig } from '../types/plugin.cjs';
4
+ export { GenerateFromAstOptions, generateFromAst, parseAst } from '../helpers/ast-utils.cjs';
5
+ export { createBabelPlugin } from '../helpers/create-plugin.cjs';
6
+ export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from '../helpers/filters.cjs';
7
+ export { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from '../helpers/module-helpers.cjs';
8
+ export { resolveBabelPlugin, resolvePluginFunction } from '../helpers/options.cjs';
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 'oxc-parser';
25
+ import 'semver';
26
+ import '@stryke/types/tsconfig';
27
+ import 'typescript';
28
+ import '@stryke/json/types';
29
+ import 'memfs';
30
+ import 'node:fs';
31
+ import 'unionfs';
32
+ import '@babel/parser';
33
+ import '@babel/types';
34
+
35
+ /**
36
+ * Babel plugin for Powerlines.
37
+ *
38
+ * @param options - The Babel plugin user configuration options.
39
+ * @returns A Powerlines plugin that integrates Babel transformations.
40
+ */
41
+ declare const plugin: (options?: BabelPluginOptions) => Plugin<BabelPluginContext>;
42
+
43
+ export { BabelPluginContext, BabelPluginOptions, plugin as default, plugin };
@@ -0,0 +1,43 @@
1
+ import { P as Plugin } from '../plugin-CObsHnry.js';
2
+ import { BabelPluginOptions, BabelPluginContext } from '../types/plugin.js';
3
+ export { BabelPluginResolvedConfig, BabelPluginUserConfig } from '../types/plugin.js';
4
+ export { 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 'oxc-parser';
25
+ import 'semver';
26
+ import '@stryke/types/tsconfig';
27
+ import 'typescript';
28
+ import '@stryke/json/types';
29
+ import 'memfs';
30
+ import 'node:fs';
31
+ import 'unionfs';
32
+ import '@babel/parser';
33
+ import '@babel/types';
34
+
35
+ /**
36
+ * Babel plugin for Powerlines.
37
+ *
38
+ * @param options - The Babel plugin user configuration options.
39
+ * @returns A Powerlines plugin that integrates Babel transformations.
40
+ */
41
+ declare const plugin: (options?: BabelPluginOptions) => Plugin<BabelPluginContext>;
42
+
43
+ export { BabelPluginContext, BabelPluginOptions, plugin as default, plugin };
@@ -0,0 +1,7 @@
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};
@@ -0,0 +1 @@
1
+ 'use strict';var plugin=require('./plugin');Object.keys(plugin).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return plugin[k]}})});
@@ -0,0 +1,24 @@
1
+ export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from './plugin.cjs';
2
+ import '../plugin-CObsHnry.cjs';
3
+ import '@stryke/types/base';
4
+ import 'unplugin';
5
+ import '@stryke/types/array';
6
+ import '@babel/core';
7
+ import '@storm-software/build-tools/types';
8
+ import '@storm-software/config-tools/types';
9
+ import '@storm-software/config/types';
10
+ import '@stryke/types/configuration';
11
+ import '@stryke/types/file';
12
+ import 'vite';
13
+ import '@babel/helper-plugin-utils';
14
+ import '@stryke/env/get-env-paths';
15
+ import '@stryke/types/package-json';
16
+ import 'jiti';
17
+ import 'oxc-parser';
18
+ import 'semver';
19
+ import '@stryke/types/tsconfig';
20
+ import 'typescript';
21
+ import '@stryke/json/types';
22
+ import 'memfs';
23
+ import 'node:fs';
24
+ import 'unionfs';
@@ -0,0 +1,24 @@
1
+ export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from './plugin.js';
2
+ import '../plugin-CObsHnry.js';
3
+ import '@stryke/types/base';
4
+ import 'unplugin';
5
+ import '@stryke/types/array';
6
+ import '@babel/core';
7
+ import '@storm-software/build-tools/types';
8
+ import '@storm-software/config-tools/types';
9
+ import '@storm-software/config/types';
10
+ import '@stryke/types/configuration';
11
+ import '@stryke/types/file';
12
+ import 'vite';
13
+ import '@babel/helper-plugin-utils';
14
+ import '@stryke/env/get-env-paths';
15
+ import '@stryke/types/package-json';
16
+ import 'jiti';
17
+ import 'oxc-parser';
18
+ import 'semver';
19
+ import '@stryke/types/tsconfig';
20
+ import 'typescript';
21
+ import '@stryke/json/types';
22
+ import 'memfs';
23
+ import 'node:fs';
24
+ import 'unionfs';
@@ -0,0 +1 @@
1
+ export*from'./plugin';
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,34 @@
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-CObsHnry.cjs';
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 'oxc-parser';
17
+ import 'semver';
18
+ import '@stryke/types/tsconfig';
19
+ import 'typescript';
20
+ import '@stryke/json/types';
21
+ import 'memfs';
22
+ import 'node:fs';
23
+ import 'unionfs';
24
+
25
+ type BabelPluginOptions = Partial<BabelUserConfig>;
26
+ type BabelPluginUserConfig = UserConfig;
27
+ interface BabelPluginResolvedConfig extends ResolvedConfig {
28
+ transform: {
29
+ babel: BabelResolvedConfig;
30
+ };
31
+ }
32
+ type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
33
+
34
+ export type { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
@@ -0,0 +1,34 @@
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-CObsHnry.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 'oxc-parser';
17
+ import 'semver';
18
+ import '@stryke/types/tsconfig';
19
+ import 'typescript';
20
+ import '@stryke/json/types';
21
+ import 'memfs';
22
+ import 'node:fs';
23
+ import 'unionfs';
24
+
25
+ type BabelPluginOptions = Partial<BabelUserConfig>;
26
+ type BabelPluginUserConfig = UserConfig;
27
+ interface BabelPluginResolvedConfig extends ResolvedConfig {
28
+ transform: {
29
+ babel: BabelResolvedConfig;
30
+ };
31
+ }
32
+ type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
33
+
34
+ export type { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-babel",
3
- "version": "0.12.7",
3
+ "version": "0.12.9",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -126,28 +126,33 @@
126
126
  "typings": "dist/index.d.ts",
127
127
  "files": ["dist/**/*"],
128
128
  "keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
129
+ "peerDependencies": { "@babel/plugin-syntax-typescript": "^7.27.1" },
130
+ "peerDependenciesMeta": {
131
+ "@babel/plugin-syntax-typescript": { "optional": false }
132
+ },
129
133
  "dependencies": {
130
134
  "@babel/core": "^7.28.5",
131
135
  "@babel/generator": "^7.28.5",
132
136
  "@babel/helper-plugin-utils": "^7.27.1",
133
137
  "@babel/parser": "^7.28.5",
134
138
  "@babel/types": "^7.28.5",
135
- "@storm-software/config-tools": "^1.188.13",
136
- "@stryke/fs": "^0.32.3",
137
- "@stryke/path": "^0.17.0",
139
+ "@storm-software/config-tools": "^1.188.19",
140
+ "@stryke/fs": "^0.32.10",
141
+ "@stryke/path": "^0.18.5",
138
142
  "@stryke/type-checks": "^0.3.10",
139
143
  "@stryke/types": "^0.10.0",
140
144
  "chalk": "5.6.2",
141
145
  "defu": "^6.1.4",
142
146
  "jiti": "^2.6.1",
143
- "powerlines": "^0.14.1",
147
+ "powerlines": "^0.15.0",
144
148
  "unplugin": "^2.3.10"
145
149
  },
146
150
  "devDependencies": {
147
- "@powerlines/nx": "^0.9.5",
148
- "@powerlines/plugin-plugin": "^0.11.6",
149
- "@types/node": "^22.18.12"
151
+ "@babel/plugin-syntax-typescript": "^7.27.1",
152
+ "@powerlines/nx": "^0.10.0",
153
+ "@powerlines/plugin-plugin": "^0.11.8",
154
+ "@types/node": "^22.19.0"
150
155
  },
151
156
  "publishConfig": { "access": "public" },
152
- "gitHead": "a634cc7d8753c9f558df0016bf5b3222a2c1a2e4"
157
+ "gitHead": "b64f9a9d53b6eb8054c361da347f6623a7ba9e45"
153
158
  }