@powerlines/plugin-babel 0.1.0
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/LICENSE +201 -0
- package/README.md +294 -0
- package/dist/chunk-SHUYVCID.js +4 -0
- package/dist/chunk-USNT2KNT.cjs +6 -0
- package/dist/helpers/ast-utils.cjs +37 -0
- package/dist/helpers/ast-utils.d.cts +17 -0
- package/dist/helpers/ast-utils.d.ts +17 -0
- package/dist/helpers/ast-utils.js +30 -0
- package/dist/helpers/create-plugin.cjs +38 -0
- package/dist/helpers/create-plugin.d.cts +13 -0
- package/dist/helpers/create-plugin.d.ts +13 -0
- package/dist/helpers/create-plugin.js +32 -0
- package/dist/helpers/filters.cjs +50 -0
- package/dist/helpers/filters.d.cts +41 -0
- package/dist/helpers/filters.d.ts +41 -0
- package/dist/helpers/filters.js +45 -0
- package/dist/helpers/index.cjs +40 -0
- package/dist/helpers/index.d.cts +12 -0
- package/dist/helpers/index.d.ts +12 -0
- package/dist/helpers/index.js +5 -0
- package/dist/helpers/module-helpers.cjs +123 -0
- package/dist/helpers/module-helpers.d.cts +47 -0
- package/dist/helpers/module-helpers.d.ts +47 -0
- package/dist/helpers/module-helpers.js +95 -0
- package/dist/helpers/options.cjs +46 -0
- package/dist/helpers/options.d.cts +17 -0
- package/dist/helpers/options.d.ts +17 -0
- package/dist/helpers/options.js +39 -0
- package/dist/index.cjs +120 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +99 -0
- package/dist/types/index.cjs +12 -0
- package/dist/types/index.d.cts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +1 -0
- package/dist/types/plugin.cjs +2 -0
- package/dist/types/plugin.d.cts +14 -0
- package/dist/types/plugin.d.ts +14 -0
- package/dist/types/plugin.js +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PluginTarget, PluginOptions } from '@babel/core';
|
|
2
|
+
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from 'powerlines/types/babel';
|
|
3
|
+
import { Context } from 'powerlines/types/context';
|
|
4
|
+
|
|
5
|
+
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context for the transformation.
|
|
10
|
+
* @param code - The code to be transformed.
|
|
11
|
+
* @param id - The ID of the source file.
|
|
12
|
+
* @param plugin - The Babel plugin to resolve.
|
|
13
|
+
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
16
|
+
|
|
17
|
+
export { resolveBabelPlugin, resolvePluginFunction };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PluginTarget, PluginOptions } from '@babel/core';
|
|
2
|
+
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from 'powerlines/types/babel';
|
|
3
|
+
import { Context } from 'powerlines/types/context';
|
|
4
|
+
|
|
5
|
+
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context for the transformation.
|
|
10
|
+
* @param code - The code to be transformed.
|
|
11
|
+
* @param id - The ID of the source file.
|
|
12
|
+
* @param plugin - The Babel plugin to resolve.
|
|
13
|
+
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
16
|
+
|
|
17
|
+
export { resolveBabelPlugin, resolvePluginFunction };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
|
+
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
3
|
+
import { isFunction } from '@stryke/type-checks/is-function';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { getPluginName } from './filters';
|
|
6
|
+
|
|
7
|
+
function resolvePluginFunction(context, plugin) {
|
|
8
|
+
try {
|
|
9
|
+
return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? isFunction(plugin[0]) ? plugin[0](context) : plugin[0] : isFunction(plugin) ? plugin(context) : plugin;
|
|
10
|
+
} catch {
|
|
11
|
+
return plugin[0];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
__name(resolvePluginFunction, "resolvePluginFunction");
|
|
15
|
+
function resolveBabelPlugin(context, code, id, plugin) {
|
|
16
|
+
if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
|
|
17
|
+
if (plugin.length > 2 && plugin[2] && isFunction(plugin[2]) && !plugin[2](code, id)) {
|
|
18
|
+
context.log(LogLevelLabel.TRACE, `Skipping filtered Babel plugin ${chalk.bold.cyanBright(getPluginName(plugin) || "unnamed")} for ${id}`);
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
return plugin.length > 2 ? [
|
|
22
|
+
resolvePluginFunction(context, plugin),
|
|
23
|
+
plugin[1],
|
|
24
|
+
plugin[2]
|
|
25
|
+
] : [
|
|
26
|
+
resolvePluginFunction(context, plugin),
|
|
27
|
+
plugin[1],
|
|
28
|
+
null
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
resolvePluginFunction(context, plugin),
|
|
33
|
+
{},
|
|
34
|
+
null
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
__name(resolveBabelPlugin, "resolveBabelPlugin");
|
|
38
|
+
|
|
39
|
+
export { resolveBabelPlugin, resolvePluginFunction };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
6
|
+
var core = require('@babel/core');
|
|
7
|
+
var types$1 = require('@storm-software/config-tools/types');
|
|
8
|
+
var isParentPath = require('@stryke/path/is-parent-path');
|
|
9
|
+
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
10
|
+
var defu = require('defu');
|
|
11
|
+
var filters = require('./helpers/filters');
|
|
12
|
+
var options = require('./helpers/options');
|
|
13
|
+
var helpers = require('./helpers');
|
|
14
|
+
var types = require('./types');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var defu__default = /*#__PURE__*/_interopDefault(defu);
|
|
19
|
+
|
|
20
|
+
const plugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((options$1 = {}) => {
|
|
21
|
+
return {
|
|
22
|
+
name: "babel",
|
|
23
|
+
config() {
|
|
24
|
+
if (!isSetObject.isSetObject(options$1)) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
transform: {
|
|
29
|
+
babel: options$1
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
configResolved: {
|
|
34
|
+
order: "pre",
|
|
35
|
+
handler() {
|
|
36
|
+
this.dependencies["@babel/core"] = {
|
|
37
|
+
type: "devDependency",
|
|
38
|
+
version: "^7.28.4"
|
|
39
|
+
};
|
|
40
|
+
this.config.transform.babel = defu__default.default(this.config.transform.babel ?? {}, {
|
|
41
|
+
plugins: [],
|
|
42
|
+
presets: []
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
async transform(code, id) {
|
|
47
|
+
if (process.env.POWERLINES_LOCAL && isParentPath.isParentPath(id, this.corePackagePath) || code.includes("/* @storm-ignore */") || code.includes("/* @storm-disable */")) {
|
|
48
|
+
this.log(types$1.LogLevelLabel.TRACE, `Skipping Babel transformation for: ${id}`);
|
|
49
|
+
return {
|
|
50
|
+
code,
|
|
51
|
+
id
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
this.log(types$1.LogLevelLabel.TRACE, `Babel transforming file: ${id}`);
|
|
55
|
+
const plugins = this.config.transform.babel.plugins.map((plugin2) => options.resolveBabelPlugin(this, code, id, plugin2)).filter((plugin2, _, arr) => plugin2 && !filters.isDuplicatePlugin(arr, plugin2));
|
|
56
|
+
const presets = this.config.transform.babel.presets.map((preset) => options.resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !filters.isDuplicatePlugin(arr, preset));
|
|
57
|
+
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) {
|
|
58
|
+
return {
|
|
59
|
+
code,
|
|
60
|
+
id
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const result = await core.transformAsync(code, {
|
|
64
|
+
highlightCode: true,
|
|
65
|
+
code: true,
|
|
66
|
+
ast: false,
|
|
67
|
+
cloneInputAst: false,
|
|
68
|
+
comments: true,
|
|
69
|
+
sourceType: "module",
|
|
70
|
+
configFile: false,
|
|
71
|
+
babelrc: false,
|
|
72
|
+
envName: this.config.mode,
|
|
73
|
+
caller: {
|
|
74
|
+
name: "powerlines"
|
|
75
|
+
},
|
|
76
|
+
...this.config.transform.babel ?? {},
|
|
77
|
+
filename: id,
|
|
78
|
+
plugins: plugins.map((plugin2) => {
|
|
79
|
+
return Array.isArray(plugin2) && plugin2.length >= 2 ? [
|
|
80
|
+
plugin2[0],
|
|
81
|
+
defu__default.default(plugin2.length > 1 && plugin2[1] ? plugin2[1] : {}, {
|
|
82
|
+
options: options$1
|
|
83
|
+
})
|
|
84
|
+
] : plugin2;
|
|
85
|
+
}).filter(Boolean),
|
|
86
|
+
presets: presets.map((preset) => {
|
|
87
|
+
return Array.isArray(preset) && preset.length >= 2 ? [
|
|
88
|
+
preset[0],
|
|
89
|
+
defu__default.default(preset.length > 1 && preset[1] ? preset[1] : {}, {
|
|
90
|
+
options: options$1
|
|
91
|
+
})
|
|
92
|
+
] : preset;
|
|
93
|
+
}).filter(Boolean)
|
|
94
|
+
});
|
|
95
|
+
if (!result?.code) {
|
|
96
|
+
throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
code: result.code,
|
|
100
|
+
id
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}, "plugin");
|
|
105
|
+
var index_default = plugin;
|
|
106
|
+
|
|
107
|
+
exports.default = index_default;
|
|
108
|
+
exports.plugin = plugin;
|
|
109
|
+
Object.keys(helpers).forEach(function (k) {
|
|
110
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () { return helpers[k]; }
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
Object.keys(types).forEach(function (k) {
|
|
116
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () { return types[k]; }
|
|
119
|
+
});
|
|
120
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from 'powerlines/types/plugin';
|
|
2
|
+
import { BabelPluginContext, BabelPluginOptions } 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, filterPluginByRuntimeId, 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 'powerlines/types/config';
|
|
11
|
+
import 'powerlines/types/context';
|
|
12
|
+
import 'powerlines/types/resolved';
|
|
13
|
+
import '@babel/parser';
|
|
14
|
+
import '@babel/types';
|
|
15
|
+
import 'powerlines/types/babel';
|
|
16
|
+
import 'powerlines/types';
|
|
17
|
+
import '@babel/core';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Babel plugin for Powerlines.
|
|
21
|
+
*
|
|
22
|
+
* @param options - The Babel plugin user configuration options.
|
|
23
|
+
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
24
|
+
*/
|
|
25
|
+
declare const plugin: <TContext extends BabelPluginContext = BabelPluginContext>(options?: BabelPluginOptions) => Plugin<TContext>;
|
|
26
|
+
|
|
27
|
+
export { BabelPluginContext, BabelPluginOptions, plugin as default, plugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from 'powerlines/types/plugin';
|
|
2
|
+
import { BabelPluginContext, BabelPluginOptions } 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, filterPluginByRuntimeId, 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 'powerlines/types/config';
|
|
11
|
+
import 'powerlines/types/context';
|
|
12
|
+
import 'powerlines/types/resolved';
|
|
13
|
+
import '@babel/parser';
|
|
14
|
+
import '@babel/types';
|
|
15
|
+
import 'powerlines/types/babel';
|
|
16
|
+
import 'powerlines/types';
|
|
17
|
+
import '@babel/core';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Babel plugin for Powerlines.
|
|
21
|
+
*
|
|
22
|
+
* @param options - The Babel plugin user configuration options.
|
|
23
|
+
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
24
|
+
*/
|
|
25
|
+
declare const plugin: <TContext extends BabelPluginContext = BabelPluginContext>(options?: BabelPluginOptions) => Plugin<TContext>;
|
|
26
|
+
|
|
27
|
+
export { BabelPluginContext, BabelPluginOptions, plugin as default, plugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
+
import { transformAsync } from '@babel/core';
|
|
3
|
+
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
4
|
+
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
5
|
+
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
6
|
+
import defu from 'defu';
|
|
7
|
+
import { isDuplicatePlugin } from './helpers/filters';
|
|
8
|
+
import { resolveBabelPlugin } from './helpers/options';
|
|
9
|
+
export * from './helpers';
|
|
10
|
+
export * from './types';
|
|
11
|
+
|
|
12
|
+
const plugin = /* @__PURE__ */ __name((options = {}) => {
|
|
13
|
+
return {
|
|
14
|
+
name: "babel",
|
|
15
|
+
config() {
|
|
16
|
+
if (!isSetObject(options)) {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
transform: {
|
|
21
|
+
babel: options
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
configResolved: {
|
|
26
|
+
order: "pre",
|
|
27
|
+
handler() {
|
|
28
|
+
this.dependencies["@babel/core"] = {
|
|
29
|
+
type: "devDependency",
|
|
30
|
+
version: "^7.28.4"
|
|
31
|
+
};
|
|
32
|
+
this.config.transform.babel = defu(this.config.transform.babel ?? {}, {
|
|
33
|
+
plugins: [],
|
|
34
|
+
presets: []
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
async transform(code, id) {
|
|
39
|
+
if (process.env.POWERLINES_LOCAL && isParentPath(id, this.corePackagePath) || code.includes("/* @storm-ignore */") || code.includes("/* @storm-disable */")) {
|
|
40
|
+
this.log(LogLevelLabel.TRACE, `Skipping Babel transformation for: ${id}`);
|
|
41
|
+
return {
|
|
42
|
+
code,
|
|
43
|
+
id
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
this.log(LogLevelLabel.TRACE, `Babel transforming file: ${id}`);
|
|
47
|
+
const plugins = this.config.transform.babel.plugins.map((plugin2) => resolveBabelPlugin(this, code, id, plugin2)).filter((plugin2, _, arr) => plugin2 && !isDuplicatePlugin(arr, plugin2));
|
|
48
|
+
const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
|
|
49
|
+
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) {
|
|
50
|
+
return {
|
|
51
|
+
code,
|
|
52
|
+
id
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const result = await transformAsync(code, {
|
|
56
|
+
highlightCode: true,
|
|
57
|
+
code: true,
|
|
58
|
+
ast: false,
|
|
59
|
+
cloneInputAst: false,
|
|
60
|
+
comments: true,
|
|
61
|
+
sourceType: "module",
|
|
62
|
+
configFile: false,
|
|
63
|
+
babelrc: false,
|
|
64
|
+
envName: this.config.mode,
|
|
65
|
+
caller: {
|
|
66
|
+
name: "powerlines"
|
|
67
|
+
},
|
|
68
|
+
...this.config.transform.babel ?? {},
|
|
69
|
+
filename: id,
|
|
70
|
+
plugins: plugins.map((plugin2) => {
|
|
71
|
+
return Array.isArray(plugin2) && plugin2.length >= 2 ? [
|
|
72
|
+
plugin2[0],
|
|
73
|
+
defu(plugin2.length > 1 && plugin2[1] ? plugin2[1] : {}, {
|
|
74
|
+
options
|
|
75
|
+
})
|
|
76
|
+
] : plugin2;
|
|
77
|
+
}).filter(Boolean),
|
|
78
|
+
presets: presets.map((preset) => {
|
|
79
|
+
return Array.isArray(preset) && preset.length >= 2 ? [
|
|
80
|
+
preset[0],
|
|
81
|
+
defu(preset.length > 1 && preset[1] ? preset[1] : {}, {
|
|
82
|
+
options
|
|
83
|
+
})
|
|
84
|
+
] : preset;
|
|
85
|
+
}).filter(Boolean)
|
|
86
|
+
});
|
|
87
|
+
if (!result?.code) {
|
|
88
|
+
throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
code: result.code,
|
|
92
|
+
id
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, "plugin");
|
|
97
|
+
var index_default = plugin;
|
|
98
|
+
|
|
99
|
+
export { index_default as default, plugin };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var plugin = require('./plugin');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(plugin).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return plugin[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './plugin';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BabelUserConfig, UserConfig } from 'powerlines/types/config';
|
|
2
|
+
import { PluginContext } from 'powerlines/types/context';
|
|
3
|
+
import { ResolvedConfig, BabelResolvedConfig } from 'powerlines/types/resolved';
|
|
4
|
+
|
|
5
|
+
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
6
|
+
type BabelPluginUserConfig = UserConfig;
|
|
7
|
+
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
8
|
+
transform: {
|
|
9
|
+
babel: BabelResolvedConfig;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
13
|
+
|
|
14
|
+
export type { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BabelUserConfig, UserConfig } from 'powerlines/types/config';
|
|
2
|
+
import { PluginContext } from 'powerlines/types/context';
|
|
3
|
+
import { ResolvedConfig, BabelResolvedConfig } from 'powerlines/types/resolved';
|
|
4
|
+
|
|
5
|
+
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
6
|
+
type BabelPluginUserConfig = UserConfig;
|
|
7
|
+
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
8
|
+
transform: {
|
|
9
|
+
babel: BabelResolvedConfig;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
13
|
+
|
|
14
|
+
export type { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@powerlines/plugin-babel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "github",
|
|
8
|
+
"url": "https://github.com/storm-software/powerlines.git",
|
|
9
|
+
"directory": "packages/plugin-babel"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://stormsoftware.com",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://stormsoftware.com/support",
|
|
14
|
+
"email": "support@stormsoftware.com"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Storm Software",
|
|
18
|
+
"email": "contact@stormsoftware.com",
|
|
19
|
+
"url": "https://stormsoftware.com"
|
|
20
|
+
},
|
|
21
|
+
"maintainers": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Storm Software",
|
|
24
|
+
"email": "contact@stormsoftware.com",
|
|
25
|
+
"url": "https://stormsoftware.com"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"contributors": [
|
|
29
|
+
{
|
|
30
|
+
"name": "Storm Software",
|
|
31
|
+
"email": "contact@stormsoftware.com",
|
|
32
|
+
"url": "https://stormsoftware.com"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"funding": {
|
|
36
|
+
"type": "github",
|
|
37
|
+
"url": "https://github.com/sponsors/storm-software"
|
|
38
|
+
},
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"private": false,
|
|
41
|
+
"main": "dist/index.cjs",
|
|
42
|
+
"module": "dist/index.js",
|
|
43
|
+
"exports": {
|
|
44
|
+
"./package.json": "./package.json",
|
|
45
|
+
".": {
|
|
46
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/index.d.cts",
|
|
49
|
+
"default": "./dist/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
52
|
+
},
|
|
53
|
+
"./index": {
|
|
54
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/index.d.cts",
|
|
57
|
+
"default": "./dist/index.cjs"
|
|
58
|
+
},
|
|
59
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
60
|
+
},
|
|
61
|
+
"./plugin": {
|
|
62
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
63
|
+
"require": {
|
|
64
|
+
"types": "./dist/index.d.cts",
|
|
65
|
+
"default": "./dist/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
68
|
+
},
|
|
69
|
+
"./types": {
|
|
70
|
+
"import": {
|
|
71
|
+
"types": "./dist/types/index.d.ts",
|
|
72
|
+
"default": "./dist/types/index.js"
|
|
73
|
+
},
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/types/index.d.cts",
|
|
76
|
+
"default": "./dist/types/index.cjs"
|
|
77
|
+
},
|
|
78
|
+
"default": {
|
|
79
|
+
"types": "./dist/types/index.d.ts",
|
|
80
|
+
"default": "./dist/types/index.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"./types/*": {
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./dist/types/*.d.ts",
|
|
86
|
+
"default": "./dist/types/*.js"
|
|
87
|
+
},
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./dist/types/*.d.cts",
|
|
90
|
+
"default": "./dist/types/*.cjs"
|
|
91
|
+
},
|
|
92
|
+
"default": {
|
|
93
|
+
"types": "./dist/types/*.d.ts",
|
|
94
|
+
"default": "./dist/types/*.js"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"./helpers": {
|
|
98
|
+
"import": {
|
|
99
|
+
"types": "./dist/helpers/index.d.ts",
|
|
100
|
+
"default": "./dist/helpers/index.js"
|
|
101
|
+
},
|
|
102
|
+
"require": {
|
|
103
|
+
"types": "./dist/helpers/index.d.cts",
|
|
104
|
+
"default": "./dist/helpers/index.cjs"
|
|
105
|
+
},
|
|
106
|
+
"default": {
|
|
107
|
+
"types": "./dist/helpers/index.d.ts",
|
|
108
|
+
"default": "./dist/helpers/index.js"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"./helpers/*": {
|
|
112
|
+
"import": {
|
|
113
|
+
"types": "./dist/helpers/*.d.ts",
|
|
114
|
+
"default": "./dist/helpers/*.js"
|
|
115
|
+
},
|
|
116
|
+
"require": {
|
|
117
|
+
"types": "./dist/helpers/*.d.cts",
|
|
118
|
+
"default": "./dist/helpers/*.cjs"
|
|
119
|
+
},
|
|
120
|
+
"default": {
|
|
121
|
+
"types": "./dist/helpers/*.d.ts",
|
|
122
|
+
"default": "./dist/helpers/*.js"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"typings": "dist/index.d.ts",
|
|
127
|
+
"files": ["dist/**/*"],
|
|
128
|
+
"keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"@babel/core": "^7.28.4",
|
|
131
|
+
"@babel/generator": "^7.28.3",
|
|
132
|
+
"@babel/helper-plugin-utils": "^7.27.1",
|
|
133
|
+
"@babel/parser": "^7.28.4",
|
|
134
|
+
"@babel/types": "^7.28.4",
|
|
135
|
+
"@storm-software/config-tools": "^1.188.6",
|
|
136
|
+
"@stryke/fs": "^0.31.4",
|
|
137
|
+
"@stryke/path": "^0.15.5",
|
|
138
|
+
"@stryke/type-checks": "^0.3.10",
|
|
139
|
+
"@stryke/types": "^0.10.0",
|
|
140
|
+
"chalk": "^5.6.2",
|
|
141
|
+
"defu": "^6.1.4",
|
|
142
|
+
"jiti": "^2.6.1",
|
|
143
|
+
"powerlines": "^0.1.0",
|
|
144
|
+
"unplugin": "^2.3.10"
|
|
145
|
+
},
|
|
146
|
+
"devDependencies": { "@powerlines/nx": "^0.1.0", "@types/node": "^22.18.11" },
|
|
147
|
+
"publishConfig": { "access": "public" },
|
|
148
|
+
"gitHead": "ecb19d2493e29805acdca3a87b7ffaf6d331dfec"
|
|
149
|
+
}
|