@powerlines/plugin-babel 0.12.261 → 0.12.263
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/{chunk-CbDLau6x.cjs → _virtual/rolldown_runtime.cjs} +1 -6
- package/dist/helpers/ast-utils.cjs +34 -3
- package/dist/helpers/ast-utils.d.cts +20 -2
- package/dist/helpers/ast-utils.d.cts.map +1 -0
- package/dist/helpers/ast-utils.d.mts +20 -2
- package/dist/helpers/ast-utils.d.mts.map +1 -0
- package/dist/helpers/ast-utils.mjs +32 -2
- package/dist/helpers/ast-utils.mjs.map +1 -0
- package/dist/helpers/create-plugin.cjs +40 -2
- package/dist/helpers/create-plugin.d.cts +16 -2
- package/dist/helpers/create-plugin.d.cts.map +1 -0
- package/dist/helpers/create-plugin.d.mts +16 -2
- package/dist/helpers/create-plugin.d.mts.map +1 -0
- package/dist/helpers/create-plugin.mjs +39 -2
- package/dist/helpers/create-plugin.mjs.map +1 -0
- package/dist/helpers/filters.cjs +58 -5
- package/dist/helpers/filters.d.cts +43 -2
- package/dist/helpers/filters.d.cts.map +1 -0
- package/dist/helpers/filters.d.mts +43 -2
- package/dist/helpers/filters.d.mts.map +1 -0
- package/dist/helpers/filters.mjs +55 -2
- package/dist/helpers/filters.mjs.map +1 -0
- package/dist/helpers/index.cjs +21 -22
- package/dist/helpers/index.d.cts +5 -6
- package/dist/helpers/index.d.mts +5 -6
- package/dist/helpers/index.mjs +5 -6
- package/dist/helpers/module-helpers.cjs +102 -9
- package/dist/helpers/module-helpers.d.cts +50 -2
- package/dist/helpers/module-helpers.d.cts.map +1 -0
- package/dist/helpers/module-helpers.d.mts +50 -2
- package/dist/helpers/module-helpers.d.mts.map +1 -0
- package/dist/helpers/module-helpers.mjs +95 -3
- package/dist/helpers/module-helpers.mjs.map +1 -0
- package/dist/helpers/options.cjs +48 -4
- package/dist/helpers/options.d.cts +19 -2
- package/dist/helpers/options.d.cts.map +1 -0
- package/dist/helpers/options.d.mts +19 -2
- package/dist/helpers/options.d.mts.map +1 -0
- package/dist/helpers/options.mjs +46 -3
- package/dist/helpers/options.mjs.map +1 -0
- package/dist/index.cjs +27 -29
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +6 -8
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +20 -2
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +20 -2
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +0 -2
- package/package.json +8 -8
- package/dist/ast-utils-BcmWaIan.cjs +0 -45
- package/dist/ast-utils-Bs6DBkKg.d.mts +0 -20
- package/dist/ast-utils-Bs6DBkKg.d.mts.map +0 -1
- package/dist/ast-utils-DU1foCxH.mjs +0 -33
- package/dist/ast-utils-DU1foCxH.mjs.map +0 -1
- package/dist/ast-utils-DeuXcuqs.d.cts +0 -20
- package/dist/ast-utils-DeuXcuqs.d.cts.map +0 -1
- package/dist/create-plugin-BSNFeead.mjs +0 -40
- package/dist/create-plugin-BSNFeead.mjs.map +0 -1
- package/dist/create-plugin-Bf7dRYZB.cjs +0 -46
- package/dist/create-plugin-DU9FBfyz.d.cts +0 -16
- package/dist/create-plugin-DU9FBfyz.d.cts.map +0 -1
- package/dist/create-plugin-DgfkdI-s.d.mts +0 -16
- package/dist/create-plugin-DgfkdI-s.d.mts.map +0 -1
- package/dist/filters-CU0L1nIa.cjs +0 -79
- package/dist/filters-CpjboNi8.mjs +0 -56
- package/dist/filters-CpjboNi8.mjs.map +0 -1
- package/dist/filters-D75MrPzl.d.mts +0 -43
- package/dist/filters-D75MrPzl.d.mts.map +0 -1
- package/dist/filters-DKyk7Jxg.d.cts +0 -43
- package/dist/filters-DKyk7Jxg.d.cts.map +0 -1
- package/dist/helpers-BnW_4z5h.mjs +0 -1
- package/dist/helpers-Bx2yBrpn.cjs +0 -0
- package/dist/index-BXxhKmeA.d.mts +0 -1
- package/dist/index-CqdNToYT.d.cts +0 -1
- package/dist/index-DJOHDG5e.d.mts +0 -1
- package/dist/index-sQecLSpR.d.cts +0 -1
- package/dist/module-helpers-07-NCXys.d.cts +0 -50
- package/dist/module-helpers-07-NCXys.d.cts.map +0 -1
- package/dist/module-helpers-B1gnVB7F.d.mts +0 -50
- package/dist/module-helpers-B1gnVB7F.d.mts.map +0 -1
- package/dist/module-helpers-Ckq8sc4l.mjs +0 -96
- package/dist/module-helpers-Ckq8sc4l.mjs.map +0 -1
- package/dist/module-helpers-Non-jHMu.cjs +0 -138
- package/dist/options-2JL6WIXT.cjs +0 -59
- package/dist/options-CpZXObFr.d.mts +0 -19
- package/dist/options-CpZXObFr.d.mts.map +0 -1
- package/dist/options-DZkAyLff.d.cts +0 -19
- package/dist/options-DZkAyLff.d.cts.map +0 -1
- package/dist/options-DwynxlP6.mjs +0 -47
- package/dist/options-DwynxlP6.mjs.map +0 -1
- package/dist/plugin-BL8TLixo.mjs +0 -1
- package/dist/plugin-BSBH78mm.cjs +0 -0
- package/dist/plugin-C-FvkCBm.d.cts +0 -20
- package/dist/plugin-C-FvkCBm.d.cts.map +0 -1
- package/dist/plugin-Sxw1QP5p.d.mts +0 -20
- package/dist/plugin-Sxw1QP5p.d.mts.map +0 -1
- package/dist/types-CKPddlfS.cjs +0 -0
- package/dist/types-CvhspRRt.mjs +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "powerlines/types/babel";
|
|
2
|
-
import { Context } from "powerlines/types/context";
|
|
3
|
-
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/options.d.ts
|
|
6
|
-
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
7
|
-
/**
|
|
8
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The context for the transformation.
|
|
11
|
-
* @param code - The code to be transformed.
|
|
12
|
-
* @param id - The ID of the source file.
|
|
13
|
-
* @param plugin - The Babel plugin to resolve.
|
|
14
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
15
|
-
*/
|
|
16
|
-
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { resolvePluginFunction as n, resolveBabelPlugin as t };
|
|
19
|
-
//# sourceMappingURL=options-DZkAyLff.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options-DZkAyLff.d.cts","names":[],"sources":["../src/helpers/options.ts"],"sourcesContent":[],"mappings":";;;;;iBA4BgB,qBAAA,UACL,uBAGL,wBAEC,cAAc,kBACd,cAAc,qCAClB;;AARH;;;;;;;;AAQ8B,iBAuBd,kBAAA,CAvBc,OAAA,EAwBnB,OAxBmB,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,MAAA,EAAA,MAAA,EA2BpB,2BA3BoB,CAAA,EA4B3B,mCA5B2B,GAAA,SAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { r as getPluginName } from "./filters-CpjboNi8.mjs";
|
|
2
|
-
import { isFunction } from "@stryke/type-checks/is-function";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/options.ts
|
|
6
|
-
function resolvePluginFunction(context, plugin) {
|
|
7
|
-
try {
|
|
8
|
-
return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? isFunction(plugin[0]) ? plugin[0](context) : plugin[0] : isFunction(plugin) ? plugin(context) : plugin;
|
|
9
|
-
} catch {
|
|
10
|
-
return plugin[0];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
15
|
-
*
|
|
16
|
-
* @param context - The context for the transformation.
|
|
17
|
-
* @param code - The code to be transformed.
|
|
18
|
-
* @param id - The ID of the source file.
|
|
19
|
-
* @param plugin - The Babel plugin to resolve.
|
|
20
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
21
|
-
*/
|
|
22
|
-
function resolveBabelPlugin(context, code, id, plugin) {
|
|
23
|
-
if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
|
|
24
|
-
if (plugin.length > 2 && plugin[2] && isFunction(plugin[2]) && !plugin[2](code, id)) {
|
|
25
|
-
context.trace(`Skipping filtered Babel plugin ${chalk.bold.cyanBright(getPluginName(plugin) || "unnamed")} for ${id}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
return plugin.length > 2 ? [
|
|
29
|
-
resolvePluginFunction(context, plugin),
|
|
30
|
-
plugin[1],
|
|
31
|
-
plugin[2]
|
|
32
|
-
] : [
|
|
33
|
-
resolvePluginFunction(context, plugin),
|
|
34
|
-
plugin[1],
|
|
35
|
-
null
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
return [
|
|
39
|
-
resolvePluginFunction(context, plugin),
|
|
40
|
-
{},
|
|
41
|
-
null
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { resolvePluginFunction as n, resolveBabelPlugin as t };
|
|
47
|
-
//# sourceMappingURL=options-DwynxlP6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options-DwynxlP6.mjs","names":[],"sources":["../src/helpers/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { PluginOptions, PluginTarget } from \"@babel/core\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport chalk from \"chalk\";\nimport {\n BabelTransformPluginOptions,\n ResolvedBabelTransformPluginOptions\n} from \"powerlines/types/babel\";\nimport { Context } from \"powerlines/types/context\";\nimport { getPluginName } from \"./filters\";\n\nexport function resolvePluginFunction(\n context: Context,\n plugin:\n | any\n | PluginTarget\n | any[]\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | undefined]\n): BabelTransformPluginOptions {\n try {\n return Array.isArray(plugin) && plugin.length > 0 && plugin[0]\n ? isFunction(plugin[0])\n ? plugin[0](context)\n : plugin[0]\n : isFunction(plugin)\n ? plugin(context)\n : plugin;\n } catch {\n return plugin[0];\n }\n}\n\n/**\n * Resolve the [Babel](https://babeljs.io/) plugin.\n *\n * @param context - The context for the transformation.\n * @param code - The code to be transformed.\n * @param id - The ID of the source file.\n * @param plugin - The Babel plugin to resolve.\n * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.\n */\nexport function resolveBabelPlugin(\n context: Context,\n code: string,\n id: string,\n plugin: BabelTransformPluginOptions\n): ResolvedBabelTransformPluginOptions | undefined {\n if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {\n if (\n plugin.length > 2 &&\n plugin[2] &&\n isFunction(plugin[2]) &&\n !plugin[2](code, id)\n ) {\n context.trace(\n `Skipping filtered Babel plugin ${chalk.bold.cyanBright(\n getPluginName(plugin) || \"unnamed\"\n )} for ${id}`\n );\n\n return undefined;\n }\n\n return plugin.length > 2\n ? [resolvePluginFunction(context, plugin), plugin[1], plugin[2]]\n : [resolvePluginFunction(context, plugin), plugin[1], null];\n }\n\n return [resolvePluginFunction(context, plugin), {}, null];\n}\n"],"mappings":";;;;;AA4BA,SAAgB,sBACd,SACA,QAM6B;AAC7B,KAAI;AACF,SAAO,MAAM,QAAQ,OAAO,IAAI,OAAO,SAAS,KAAK,OAAO,KACxD,WAAW,OAAO,GAAG,GACnB,OAAO,GAAG,QAAQ,GAClB,OAAO,KACT,WAAW,OAAO,GAChB,OAAO,QAAQ,GACf;SACA;AACN,SAAO,OAAO;;;;;;;;;;;;AAalB,SAAgB,mBACd,SACA,MACA,IACA,QACiD;AACjD,KAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,SAAS,KAAK,OAAO,IAAI;AAC3D,MACE,OAAO,SAAS,KAChB,OAAO,MACP,WAAW,OAAO,GAAG,IACrB,CAAC,OAAO,GAAG,MAAM,GAAG,EACpB;AACA,WAAQ,MACN,kCAAkC,MAAM,KAAK,WAC3C,cAAc,OAAO,IAAI,UAC1B,CAAC,OAAO,KACV;AAED;;AAGF,SAAO,OAAO,SAAS,IACnB;GAAC,sBAAsB,SAAS,OAAO;GAAE,OAAO;GAAI,OAAO;GAAG,GAC9D;GAAC,sBAAsB,SAAS,OAAO;GAAE,OAAO;GAAI;GAAK;;AAG/D,QAAO;EAAC,sBAAsB,SAAS,OAAO;EAAE,EAAE;EAAE;EAAK"}
|
package/dist/plugin-BL8TLixo.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/plugin-BSBH78mm.cjs
DELETED
|
File without changes
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PluginContext } from "powerlines/types/context";
|
|
2
|
-
import { BabelUserConfig, UserConfig } from "powerlines/types/config";
|
|
3
|
-
import { BabelResolvedConfig, ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/plugin.d.ts
|
|
6
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
-
type BabelPluginUserConfig = UserConfig;
|
|
8
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
9
|
-
transform: {
|
|
10
|
-
babel: BabelResolvedConfig;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
|
-
declare type __ΩBabelPluginOptions = any[];
|
|
15
|
-
declare type __ΩBabelPluginUserConfig = any[];
|
|
16
|
-
declare type __ΩBabelPluginResolvedConfig = any[];
|
|
17
|
-
declare type __ΩBabelPluginContext = any[];
|
|
18
|
-
//#endregion
|
|
19
|
-
export { __ΩBabelPluginContext as a, __ΩBabelPluginUserConfig as c, BabelPluginUserConfig as i, BabelPluginOptions as n, __ΩBabelPluginOptions as o, BabelPluginResolvedConfig as r, __ΩBabelPluginResolvedConfig as s, BabelPluginContext as t };
|
|
20
|
-
//# sourceMappingURL=plugin-C-FvkCBm.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-C-FvkCBm.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,kBAAA,GAAqB,QAAQ;KAE7B,qBAAA,GAAwB;AAFxB,UAIK,yBAAA,SAAkC,cAJX,CAAA;EAE5B,SAAA,EAAA;IAEK,KAAA,EAEN,mBAFgC;EAM/B,CAAA;;AAC0C,KAD1C,kBAC0C,CAAA,wBAA5B,yBAA4B,GAAA,yBAAA,CAAA,GAClD,aADkD,CACpC,eADoC,CAAA;AACpC,qCAAA,GAAA,EAAA;AAAd,wCAAA,GAAA,EAAA;AAAa,4CAAA,GAAA,EAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PluginContext } from "powerlines/types/context";
|
|
2
|
-
import { BabelUserConfig, UserConfig } from "powerlines/types/config";
|
|
3
|
-
import { BabelResolvedConfig, ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/plugin.d.ts
|
|
6
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
-
type BabelPluginUserConfig = UserConfig;
|
|
8
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
9
|
-
transform: {
|
|
10
|
-
babel: BabelResolvedConfig;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
|
-
declare type __ΩBabelPluginOptions = any[];
|
|
15
|
-
declare type __ΩBabelPluginUserConfig = any[];
|
|
16
|
-
declare type __ΩBabelPluginResolvedConfig = any[];
|
|
17
|
-
declare type __ΩBabelPluginContext = any[];
|
|
18
|
-
//#endregion
|
|
19
|
-
export { __ΩBabelPluginContext as a, __ΩBabelPluginUserConfig as c, BabelPluginUserConfig as i, BabelPluginOptions as n, __ΩBabelPluginOptions as o, BabelPluginResolvedConfig as r, __ΩBabelPluginResolvedConfig as s, BabelPluginContext as t };
|
|
20
|
-
//# sourceMappingURL=plugin-Sxw1QP5p.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-Sxw1QP5p.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,kBAAA,GAAqB,QAAQ;KAE7B,qBAAA,GAAwB;AAFxB,UAIK,yBAAA,SAAkC,cAJX,CAAA;EAE5B,SAAA,EAAA;IAEK,KAAA,EAEN,mBAFgC;EAM/B,CAAA;;AAC0C,KAD1C,kBAC0C,CAAA,wBAA5B,yBAA4B,GAAA,yBAAA,CAAA,GAClD,aADkD,CACpC,eADoC,CAAA;AACpC,qCAAA,GAAA,EAAA;AAAd,wCAAA,GAAA,EAAA;AAAa,4CAAA,GAAA,EAAA"}
|
package/dist/types-CKPddlfS.cjs
DELETED
|
File without changes
|
package/dist/types-CvhspRRt.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|