@powerlines/plugin-babel 0.12.344 → 0.12.346
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/README.md +14 -16
- package/dist/{ast-utils-CDYUuqd-.d.mts → ast-utils-BGST1RhV.d.cts} +1 -2
- package/dist/ast-utils-BGST1RhV.d.cts.map +1 -0
- package/dist/{ast-utils-BrOP-SXX.d.cts → ast-utils-BeOv3AgV.d.mts} +1 -2
- package/dist/ast-utils-BeOv3AgV.d.mts.map +1 -0
- package/dist/{chunk-CbDLau6x.cjs → chunk-C0xms8kb.cjs} +1 -1
- package/dist/{config-CCcSPqTr.d.mts → config-CuJGOt8R.d.cts} +2 -2
- package/dist/config-CuJGOt8R.d.cts.map +1 -0
- package/dist/{config-CdGXI-Ik.d.cts → config-D_d7N-Sl.d.mts} +2 -2
- package/dist/config-D_d7N-Sl.d.mts.map +1 -0
- package/dist/{create-plugin-CY4-luEx.d.mts → create-plugin-BIwCYvvY.d.mts} +2 -3
- package/dist/create-plugin-BIwCYvvY.d.mts.map +1 -0
- package/dist/{create-plugin-EhzG7u2c.d.cts → create-plugin-D_a-SigP.d.cts} +2 -3
- package/dist/create-plugin-D_a-SigP.d.cts.map +1 -0
- package/dist/{filters-DxhmCwwY.d.cts → filters-CJGhJSwI.d.mts} +2 -2
- package/dist/filters-CJGhJSwI.d.mts.map +1 -0
- package/dist/{filters-DDGNo9hw.d.mts → filters-DSaGPmrz.d.cts} +2 -2
- package/dist/filters-DSaGPmrz.d.cts.map +1 -0
- package/dist/helpers/ast-utils.cjs +35 -3
- package/dist/helpers/ast-utils.d.cts +1 -1
- package/dist/helpers/ast-utils.d.mts +1 -1
- package/dist/helpers/ast-utils.mjs +32 -2
- package/dist/helpers/ast-utils.mjs.map +1 -0
- package/dist/helpers/create-plugin.cjs +41 -2
- package/dist/helpers/create-plugin.d.cts +1 -2
- package/dist/helpers/create-plugin.d.mts +1 -2
- package/dist/helpers/create-plugin.mjs +39 -2
- package/dist/helpers/create-plugin.mjs.map +1 -0
- package/dist/helpers/filters.cjs +59 -5
- package/dist/helpers/filters.d.cts +1 -2
- package/dist/helpers/filters.d.mts +1 -2
- package/dist/helpers/filters.mjs +55 -2
- package/dist/helpers/filters.mjs.map +1 -0
- package/dist/helpers/index.cjs +22 -22
- package/dist/helpers/index.d.cts +5 -7
- package/dist/helpers/index.d.mts +5 -7
- package/dist/helpers/index.mjs +5 -6
- package/dist/helpers/module-helpers.cjs +103 -9
- package/dist/helpers/module-helpers.d.cts +1 -2
- package/dist/helpers/module-helpers.d.mts +1 -2
- package/dist/helpers/module-helpers.mjs +95 -3
- package/dist/helpers/module-helpers.mjs.map +1 -0
- package/dist/helpers/options.cjs +49 -4
- package/dist/helpers/options.d.cts +1 -2
- package/dist/helpers/options.d.mts +1 -2
- package/dist/helpers/options.mjs +46 -3
- package/dist/helpers/options.mjs.map +1 -0
- package/dist/index.cjs +37 -38
- package/dist/index.d.cts +7 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{module-helpers-So_G9K5a.d.mts → module-helpers-BeUcHHvL.d.cts} +3 -4
- package/dist/module-helpers-BeUcHHvL.d.cts.map +1 -0
- package/dist/{module-helpers-UpBemakt.d.cts → module-helpers-BmiPAh2F.d.mts} +3 -4
- package/dist/module-helpers-BmiPAh2F.d.mts.map +1 -0
- package/dist/{options-CpcC_kcf.d.mts → options-CuRFY_V6.d.mts} +2 -2
- package/dist/options-CuRFY_V6.d.mts.map +1 -0
- package/dist/{options-DvKZh-FA.d.cts → options-ku57q3v6.d.cts} +2 -2
- package/dist/options-ku57q3v6.d.cts.map +1 -0
- package/dist/types/config.d.cts +1 -1
- package/dist/types/config.d.mts +1 -1
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.mts +2 -3
- package/dist/types/plugin.d.cts +19 -3
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +19 -3
- package/dist/types/plugin.d.mts.map +1 -0
- package/package.json +24 -23
- package/dist/ast-utils-BcmWaIan.cjs +0 -45
- package/dist/ast-utils-BgcE0CUh.mjs +0 -33
- package/dist/ast-utils-BgcE0CUh.mjs.map +0 -1
- package/dist/ast-utils-BrOP-SXX.d.cts.map +0 -1
- package/dist/ast-utils-CDYUuqd-.d.mts.map +0 -1
- package/dist/config-BLkkDfsC.mjs +0 -1
- package/dist/config-CCcSPqTr.d.mts.map +0 -1
- package/dist/config-CdGXI-Ik.d.cts.map +0 -1
- package/dist/config-QK0F_KAD.cjs +0 -0
- package/dist/create-plugin-BbG_dRTl.mjs +0 -40
- package/dist/create-plugin-BbG_dRTl.mjs.map +0 -1
- package/dist/create-plugin-CY4-luEx.d.mts.map +0 -1
- package/dist/create-plugin-DaXcRyMI.cjs +0 -46
- package/dist/create-plugin-EhzG7u2c.d.cts.map +0 -1
- package/dist/filters-CU0L1nIa.cjs +0 -79
- package/dist/filters-DDGNo9hw.d.mts.map +0 -1
- package/dist/filters-DjAUc6r9.mjs +0 -56
- package/dist/filters-DjAUc6r9.mjs.map +0 -1
- package/dist/filters-DxhmCwwY.d.cts.map +0 -1
- package/dist/helpers-Bx2yBrpn.cjs +0 -0
- package/dist/helpers-DemUUgdw.mjs +0 -1
- package/dist/index-BHI9uOzY.d.mts +0 -1
- package/dist/index-C2gUMYkE.d.cts +0 -1
- package/dist/index-CzpoWrv9.d.mts +0 -1
- package/dist/index-uTS5iDq_.d.cts +0 -1
- package/dist/module-helpers-DtOc93YQ.mjs +0 -96
- package/dist/module-helpers-DtOc93YQ.mjs.map +0 -1
- package/dist/module-helpers-Non-jHMu.cjs +0 -138
- package/dist/module-helpers-So_G9K5a.d.mts.map +0 -1
- package/dist/module-helpers-UpBemakt.d.cts.map +0 -1
- package/dist/options-2JL6WIXT.cjs +0 -59
- package/dist/options-CpcC_kcf.d.mts.map +0 -1
- package/dist/options-DT_wvMGu.mjs +0 -47
- package/dist/options-DT_wvMGu.mjs.map +0 -1
- package/dist/options-DvKZh-FA.d.cts.map +0 -1
- package/dist/plugin-BX9Q6Mnb.mjs +0 -1
- package/dist/plugin-C15DYbCC.d.mts +0 -19
- package/dist/plugin-C15DYbCC.d.mts.map +0 -1
- package/dist/plugin-DkYJiG5m.cjs +0 -0
- package/dist/plugin-F6ospfOM.d.cts +0 -19
- package/dist/plugin-F6ospfOM.d.cts.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/powerlines) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -58,21 +58,19 @@ A package containing the Babel plugin for Powerlines, various helper utilities,
|
|
|
58
58
|
|
|
59
59
|
## Table of Contents
|
|
60
60
|
|
|
61
|
-
- [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- [Contributing](#contributing)
|
|
75
|
-
- [Contributors](#contributors)
|
|
61
|
+
- [Installing](#installing)
|
|
62
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
63
|
+
- [Development](#development)
|
|
64
|
+
- [Building](#building)
|
|
65
|
+
- [Running unit tests](#running-unit-tests)
|
|
66
|
+
- [Linting](#linting)
|
|
67
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
68
|
+
- [Roadmap](#roadmap)
|
|
69
|
+
- [Support](#support)
|
|
70
|
+
- [License](#license)
|
|
71
|
+
- [Changelog](#changelog)
|
|
72
|
+
- [Contributing](#contributing)
|
|
73
|
+
- [Contributors](#contributors)
|
|
76
74
|
|
|
77
75
|
<!-- END doctoc -->
|
|
78
76
|
|
|
@@ -3,7 +3,6 @@ import { ParseResult, ParserOptions } from "@babel/parser";
|
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/ast-utils.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Parse the given code into an AST.
|
|
9
8
|
*
|
|
@@ -17,4 +16,4 @@ declare function generateFromAst(ast: t.Node, opts?: GenerateFromAstOptions): Ge
|
|
|
17
16
|
declare type __ΩGenerateFromAstOptions = any[];
|
|
18
17
|
//#endregion
|
|
19
18
|
export { parseAst as a, generateFromAst as i, GeneratorResult$1 as n, __ΩGenerateFromAstOptions as r, GenerateFromAstOptions as t };
|
|
20
|
-
//# sourceMappingURL=ast-utils-
|
|
19
|
+
//# sourceMappingURL=ast-utils-BGST1RhV.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-utils-BGST1RhV.d.cts","names":[],"sources":["../src/helpers/ast-utils.ts"],"mappings":";;;;;;;AA+BA;;;;;iBAAgB,QAAA,CACd,IAAA,UACA,IAAA,GAAM,aAAA,GACL,WAAA,CAAY,CAAA,CAAE,IAAA;AAAA,KAeL,sBAAA,GAAyB,gBAAA,GACnC,QAAA,CAAS,IAAA,CAAK,gBAAA;AAAA,iBAEA,eAAA,CACd,GAAA,EAAK,CAAA,CAAE,IAAA,EACP,IAAA,GAAO,sBAAA,GACN,eAAA;AAAA"}
|
|
@@ -3,7 +3,6 @@ import { ParseResult, ParserOptions } from "@babel/parser";
|
|
|
3
3
|
import * as t from "@babel/types";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/ast-utils.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Parse the given code into an AST.
|
|
9
8
|
*
|
|
@@ -17,4 +16,4 @@ declare function generateFromAst(ast: t.Node, opts?: GenerateFromAstOptions): Ge
|
|
|
17
16
|
declare type __ΩGenerateFromAstOptions = any[];
|
|
18
17
|
//#endregion
|
|
19
18
|
export { parseAst as a, generateFromAst as i, GeneratorResult$1 as n, __ΩGenerateFromAstOptions as r, GenerateFromAstOptions as t };
|
|
20
|
-
//# sourceMappingURL=ast-utils-
|
|
19
|
+
//# sourceMappingURL=ast-utils-BeOv3AgV.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-utils-BeOv3AgV.d.mts","names":[],"sources":["../src/helpers/ast-utils.ts"],"mappings":";;;;;;;AA+BA;;;;;iBAAgB,QAAA,CACd,IAAA,UACA,IAAA,GAAM,aAAA,GACL,WAAA,CAAY,CAAA,CAAE,IAAA;AAAA,KAeL,sBAAA,GAAyB,gBAAA,GACnC,QAAA,CAAS,IAAA,CAAK,gBAAA;AAAA,iBAEA,eAAA,CACd,GAAA,EAAK,CAAA,CAAE,IAAA,EACP,IAAA,GAAO,sBAAA,GACN,eAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Context, LogFn } from "@powerlines/core";
|
|
1
2
|
import { PluginItem, PluginObj, PluginPass, TransformOptions, transformAsync } from "@babel/core";
|
|
2
3
|
import { BabelAPI } from "@babel/helper-plugin-utils";
|
|
3
|
-
import { Context, LogFn } from "@powerlines/core";
|
|
4
4
|
|
|
5
5
|
//#region src/types/config.d.ts
|
|
6
6
|
interface NamedImportDefinition {
|
|
@@ -83,4 +83,4 @@ declare type __ΩBabelUserConfig = any[];
|
|
|
83
83
|
declare type __ΩBabelResolvedConfig = any[];
|
|
84
84
|
//#endregion
|
|
85
85
|
export { __ΩResolvedBabelTransformPluginOptions as A, __ΩBabelTransformPluginOptions as C, __ΩImportDefinition as D, __ΩDefaultImportDefinition as E, __ΩImportSpecifier as O, __ΩBabelTransformPluginFilter as S, __ΩDeclareBabelTransformPluginReturn as T, __ΩBabelResolvedConfig as _, BabelTransformPluginBuilder as a, __ΩBabelTransformPluginBuilder as b, BabelTransformPluginOptions as c, DefaultImportDefinition as d, ImportDefinition as f, __ΩBabelPluginPass as g, ResolvedBabelTransformPluginOptions as h, BabelTransformPlugin as i, __ΩNamedImportDefinition as k, BabelUserConfig as l, NamedImportDefinition as m, BabelResolvedConfig as n, BabelTransformPluginBuilderParams as o, ImportSpecifier as p, BabelTransformInput as r, BabelTransformPluginFilter as s, BabelPluginPass as t, DeclareBabelTransformPluginReturn as u, __ΩBabelTransformInput as v, __ΩBabelUserConfig as w, __ΩBabelTransformPluginBuilderParams as x, __ΩBabelTransformPlugin as y };
|
|
86
|
-
//# sourceMappingURL=config-
|
|
86
|
+
//# sourceMappingURL=config-CuJGOt8R.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CuJGOt8R.d.cts","names":[],"sources":["../src/types/config.ts"],"mappings":";;;;;UA4BiB,qBAAA;EACf,IAAA;EACA,MAAA;EACA,IAAA;AAAA;AAAA,UAGe,uBAAA;EACf,MAAA;EACA,IAAA;AAAA;AAAA,KAGU,gBAAA,GAAmB,qBAAA,GAAwB,uBAAA;AAAA,KAE3C,eAAA,qBAAoC,UAAA,GAAa,MAAA;AAAA,KAEjD,0BAAA,IAA8B,IAAA,UAAc,EAAA;AAAA,KAE5C,oBAAA,kBACO,OAAA,GAAU,OAAA,mBACV,MAAA,gBAAsB,MAAA,qCAGvC,OAAA,EAAS,QAAA,MACL,OAAA;EACJ,IAAA;EACA,GAAA,EAAK,KAAA;EACL,GAAA,EAAK,QAAA;EACL,OAAA,EAAS,QAAA;EACT,OAAA,EAAS,QAAA;EACT,OAAA;AAAA,MACI,SAAA,CAAU,QAAA,GAAW,eAAA,CAAgB,MAAA;EACzC,MAAA;AAAA;AAAA,KAGU,2BAAA,kBACO,OAAA,GAAU,OAAA,mBACV,MAAA,gBAAsB,MAAA,mCAGrC,UAAA,GACA,oBAAA,CAAqB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AA,CAAS,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Context, LogFn } from "@powerlines/core";
|
|
2
1
|
import { PluginItem, PluginObj, PluginPass, TransformOptions, transformAsync } from "@babel/core";
|
|
3
2
|
import { BabelAPI } from "@babel/helper-plugin-utils";
|
|
3
|
+
import { Context, LogFn } from "@powerlines/core";
|
|
4
4
|
|
|
5
5
|
//#region src/types/config.d.ts
|
|
6
6
|
interface NamedImportDefinition {
|
|
@@ -83,4 +83,4 @@ declare type __ΩBabelUserConfig = any[];
|
|
|
83
83
|
declare type __ΩBabelResolvedConfig = any[];
|
|
84
84
|
//#endregion
|
|
85
85
|
export { __ΩResolvedBabelTransformPluginOptions as A, __ΩBabelTransformPluginOptions as C, __ΩImportDefinition as D, __ΩDefaultImportDefinition as E, __ΩImportSpecifier as O, __ΩBabelTransformPluginFilter as S, __ΩDeclareBabelTransformPluginReturn as T, __ΩBabelResolvedConfig as _, BabelTransformPluginBuilder as a, __ΩBabelTransformPluginBuilder as b, BabelTransformPluginOptions as c, DefaultImportDefinition as d, ImportDefinition as f, __ΩBabelPluginPass as g, ResolvedBabelTransformPluginOptions as h, BabelTransformPlugin as i, __ΩNamedImportDefinition as k, BabelUserConfig as l, NamedImportDefinition as m, BabelResolvedConfig as n, BabelTransformPluginBuilderParams as o, ImportSpecifier as p, BabelTransformInput as r, BabelTransformPluginFilter as s, BabelPluginPass as t, DeclareBabelTransformPluginReturn as u, __ΩBabelTransformInput as v, __ΩBabelUserConfig as w, __ΩBabelTransformPluginBuilderParams as x, __ΩBabelTransformPlugin as y };
|
|
86
|
-
//# sourceMappingURL=config-
|
|
86
|
+
//# sourceMappingURL=config-D_d7N-Sl.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-D_d7N-Sl.d.mts","names":[],"sources":["../src/types/config.ts"],"mappings":";;;;;UA4BiB,qBAAA;EACf,IAAA;EACA,MAAA;EACA,IAA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U,OAAA,mBACV,MAAA,gBAAsB,MAAA,gCAGvC,MAAA,EAAQ,iCAAA,CAAkC,QAAA,EAAU,QAAA,MACjD,SAAA,CAAU,MAAA,GAAS,eAAA,CAAgB,QAAA;AAAA,KAE5B,iCAAA,kBACO,OAAA,GAAU,OAAA,mBACV,MAAA,gBAAsB,MAAA,+BAErC,IAAA,CAAK,oBAAA,CAAqB,QAAA,EAAU,QAAA,EAAU,MAAA,eAChD,QAAA,CAAS,IAAA,CAAK,oBAAA,CAAqB,QAAA,EAAU,QAAA,EAAU,MAAA;;;;;;;;;;;;;UAcxC,eAAA;EACf,IAAA;EACA,MAAA;EACA,QAAA;AAAA;AAAA,KAGU,eAAA,GAAkB,UAAA,QAAkB,cAAA;EAxF9C;;;EA4FA,OAAA,GAAU,2BAAA;EAxFV;;;EA6FA,OAAA,GAAU,2BAAA;AAAA;AAAA,KAGA,mBAAA,GAAsB,IAAA,CAAK,eAAA,2BACrC,QAAA,CAAS,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as BabelTransformPluginBuilder, u as DeclareBabelTransformPluginReturn } from "./config-
|
|
1
|
+
import { a as BabelTransformPluginBuilder, u as DeclareBabelTransformPluginReturn } from "./config-D_d7N-Sl.mjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/create-plugin.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Create a Babel plugin using the provided builder function.
|
|
8
7
|
*
|
|
@@ -13,4 +12,4 @@ import { Context } from "@powerlines/core";
|
|
|
13
12
|
declare function createBabelPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>>(name: string, builder: BabelTransformPluginBuilder<TContext, TOptions>): DeclareBabelTransformPluginReturn<TContext, TOptions>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { createBabelPlugin as t };
|
|
16
|
-
//# sourceMappingURL=create-plugin-
|
|
15
|
+
//# sourceMappingURL=create-plugin-BIwCYvvY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plugin-BIwCYvvY.d.mts","names":[],"sources":["../src/helpers/create-plugin.ts"],"mappings":";;;;;;AAmCA;;;;;iBAAgB,iBAAA,kBACG,OAAA,GAAU,OAAA,mBACV,MAAA,gBAAsB,MAAA,cAAA,CAEvC,IAAA,UACA,OAAA,EAAS,2BAAA,CAA4B,QAAA,EAAU,QAAA,IAC9C,iCAAA,CAAkC,QAAA,EAAU,QAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as BabelTransformPluginBuilder, u as DeclareBabelTransformPluginReturn } from "./config-
|
|
1
|
+
import { a as BabelTransformPluginBuilder, u as DeclareBabelTransformPluginReturn } from "./config-CuJGOt8R.cjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/create-plugin.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Create a Babel plugin using the provided builder function.
|
|
8
7
|
*
|
|
@@ -13,4 +12,4 @@ import { Context } from "@powerlines/core";
|
|
|
13
12
|
declare function createBabelPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>>(name: string, builder: BabelTransformPluginBuilder<TContext, TOptions>): DeclareBabelTransformPluginReturn<TContext, TOptions>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { createBabelPlugin as t };
|
|
16
|
-
//# sourceMappingURL=create-plugin-
|
|
15
|
+
//# sourceMappingURL=create-plugin-D_a-SigP.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plugin-D_a-SigP.d.cts","names":[],"sources":["../src/helpers/create-plugin.ts"],"mappings":";;;;;;AAmCA;;;;;iBAAgB,iBAAA,kBACG,OAAA,GAAU,OAAA,mBACV,MAAA,gBAAsB,MAAA,cAAA,CAEvC,IAAA,UACA,OAAA,EAAS,2BAAA,CAA4B,QAAA,EAAU,QAAA,IAC9C,iCAAA,CAAkC,QAAA,EAAU,QAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as BabelTransformPluginOptions, h as ResolvedBabelTransformPluginOptions, i as BabelTransformPlugin, s as BabelTransformPluginFilter } from "./config-
|
|
1
|
+
import { c as BabelTransformPluginOptions, h as ResolvedBabelTransformPluginOptions, i as BabelTransformPlugin, s as BabelTransformPluginFilter } from "./config-D_d7N-Sl.mjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/filters.d.ts
|
|
@@ -40,4 +40,4 @@ declare function addPluginFilter(context: Context, plugins: BabelTransformPlugin
|
|
|
40
40
|
declare function addPluginFilter(context: Context, plugin: BabelTransformPlugin | BabelTransformPluginOptions, filter: NonNullable<BabelTransformPluginFilter>): BabelTransformPluginOptions;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { isDuplicatePlugin as i, filterPluginByFileId as n, getPluginName as r, addPluginFilter as t };
|
|
43
|
-
//# sourceMappingURL=filters-
|
|
43
|
+
//# sourceMappingURL=filters-CJGhJSwI.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters-CJGhJSwI.d.mts","names":[],"sources":["../src/helpers/filters.ts"],"mappings":";;;;iBA6BgB,aAAA,CACd,MAAA,GACI,2BAAA,kCAIK,IAAA;;AANX;;;;;;iBA2BgB,iBAAA,CACd,OAAA,GAAU,mCAAA,iBACV,MAAA,EAAQ,2BAAA;;;AAFV;;;;;iBAqBgB,oBAAA,kBAAsC,OAAA,GAAU,OAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,MAAA,WACC,0BAAA;;;;;AAHH;;;;;iBAuBgB,eAAA,CACd,OAAA,EAAS,OAAA,EACT,OAAA,EAAS,2BAAA,IACT,MAAA,EAAQ,0BAAA,qBACR,IAAA,WACC,2BAAA;;;;;;;;;iBAUa,eAAA,CACd,OAAA,EAAS,OAAA,EACT,MAAA,EAAQ,oBAAA,GAAuB,2BAAA,EAC/B,MAAA,EAAQ,WAAA,CAAY,0BAAA,IACnB,2BAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as BabelTransformPluginOptions, h as ResolvedBabelTransformPluginOptions, i as BabelTransformPlugin, s as BabelTransformPluginFilter } from "./config-
|
|
1
|
+
import { c as BabelTransformPluginOptions, h as ResolvedBabelTransformPluginOptions, i as BabelTransformPlugin, s as BabelTransformPluginFilter } from "./config-CuJGOt8R.cjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/filters.d.ts
|
|
@@ -40,4 +40,4 @@ declare function addPluginFilter(context: Context, plugins: BabelTransformPlugin
|
|
|
40
40
|
declare function addPluginFilter(context: Context, plugin: BabelTransformPlugin | BabelTransformPluginOptions, filter: NonNullable<BabelTransformPluginFilter>): BabelTransformPluginOptions;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { isDuplicatePlugin as i, filterPluginByFileId as n, getPluginName as r, addPluginFilter as t };
|
|
43
|
-
//# sourceMappingURL=filters-
|
|
43
|
+
//# sourceMappingURL=filters-DSaGPmrz.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters-DSaGPmrz.d.cts","names":[],"sources":["../src/helpers/filters.ts"],"mappings":";;;;iBA6BgB,aAAA,CACd,MAAA,GACI,2BAAA,kCAIK,IAAA;;AANX;;;;;;iBA2BgB,iBAAA,CACd,OAAA,GAAU,mCAAA,iBACV,MAAA,EAAQ,2BAAA;;;AAFV;;;;;iBAqBgB,oBAAA,kBAAsC,OAAA,GAAU,OAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,MAAA,WACC,0BAAA;;;;;AAHH;;;;;iBAuBgB,eAAA,CACd,OAAA,EAAS,OAAA,EACT,OAAA,EAAS,2BAAA,IACT,MAAA,EAAQ,0BAAA,qBACR,IAAA,WACC,2BAAA;;;;;;;;;iBAUa,eAAA,CACd,OAAA,EAAS,OAAA,EACT,MAAA,EAAQ,oBAAA,GAAuB,2BAAA,EAC/B,MAAA,EAAQ,WAAA,CAAY,0BAAA,IACnB,2BAAA"}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../chunk-C0xms8kb.cjs');
|
|
3
|
+
let _babel_generator = require("@babel/generator");
|
|
4
|
+
_babel_generator = require_chunk.__toESM(_babel_generator);
|
|
5
|
+
let _babel_parser = require("@babel/parser");
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
//#region src/helpers/ast-utils.ts
|
|
8
|
+
/**
|
|
9
|
+
* Parse the given code into an AST.
|
|
10
|
+
*
|
|
11
|
+
* @param code - The code to parse.
|
|
12
|
+
* @param opts - The options for parsing.
|
|
13
|
+
* @returns The parsed AST.
|
|
14
|
+
*/
|
|
15
|
+
function parseAst(code, opts = {}) {
|
|
16
|
+
return (0, _babel_parser.parse)(code, {
|
|
17
|
+
plugins: ["typescript"],
|
|
18
|
+
sourceType: "module",
|
|
19
|
+
allowImportExportEverywhere: true,
|
|
20
|
+
allowAwaitOutsideFunction: true,
|
|
21
|
+
...opts
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
let generate = _babel_generator.default;
|
|
25
|
+
if ("default" in generate) generate = generate.default;
|
|
26
|
+
function generateFromAst(ast, opts) {
|
|
27
|
+
return generate(ast, opts ? {
|
|
28
|
+
importAttributesKeyword: "with",
|
|
29
|
+
sourceMaps: true,
|
|
30
|
+
...opts
|
|
31
|
+
} : void 0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.generateFromAst = generateFromAst;
|
|
36
|
+
exports.parseAst = parseAst;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-
|
|
1
|
+
import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-BGST1RhV.cjs";
|
|
2
2
|
export { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-
|
|
1
|
+
import { a as parseAst, i as generateFromAst, n as GeneratorResult, r as __ΩGenerateFromAstOptions, t as GenerateFromAstOptions } from "../ast-utils-BeOv3AgV.mjs";
|
|
2
2
|
export { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst };
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _generate from "@babel/generator";
|
|
2
|
+
import { parse } from "@babel/parser";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/helpers/ast-utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Parse the given code into an AST.
|
|
7
|
+
*
|
|
8
|
+
* @param code - The code to parse.
|
|
9
|
+
* @param opts - The options for parsing.
|
|
10
|
+
* @returns The parsed AST.
|
|
11
|
+
*/
|
|
12
|
+
function parseAst(code, opts = {}) {
|
|
13
|
+
return parse(code, {
|
|
14
|
+
plugins: ["typescript"],
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
allowImportExportEverywhere: true,
|
|
17
|
+
allowAwaitOutsideFunction: true,
|
|
18
|
+
...opts
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
let generate = _generate;
|
|
22
|
+
if ("default" in generate) generate = generate.default;
|
|
23
|
+
function generateFromAst(ast, opts) {
|
|
24
|
+
return generate(ast, opts ? {
|
|
25
|
+
importAttributesKeyword: "with",
|
|
26
|
+
sourceMaps: true,
|
|
27
|
+
...opts
|
|
28
|
+
} : void 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { generateFromAst, parseAst };
|
|
33
|
+
//# sourceMappingURL=ast-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-utils.mjs","names":[],"sources":["../../src/helpers/ast-utils.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 type { GeneratorOptions, GeneratorResult } from \"@babel/generator\";\nimport _generate from \"@babel/generator\";\nimport type { ParseResult, ParserOptions } from \"@babel/parser\";\nimport { parse } from \"@babel/parser\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Parse the given code into an AST.\n *\n * @param code - The code to parse.\n * @param opts - The options for parsing.\n * @returns The parsed AST.\n */\nexport function parseAst(\n code: string,\n opts: ParserOptions = {}\n): ParseResult<t.File> {\n return parse(code, {\n plugins: [\"typescript\"],\n sourceType: \"module\",\n allowImportExportEverywhere: true,\n allowAwaitOutsideFunction: true,\n ...opts\n });\n}\n\nlet generate = _generate;\nif (\"default\" in generate) {\n generate = generate.default as typeof generate;\n}\n\nexport type GenerateFromAstOptions = GeneratorOptions &\n Required<Pick<GeneratorOptions, \"sourceFileName\" | \"filename\">>;\n\nexport function generateFromAst(\n ast: t.Node,\n opts?: GenerateFromAstOptions\n): GeneratorResult {\n return generate(\n ast,\n opts\n ? { importAttributesKeyword: \"with\", sourceMaps: true, ...opts }\n : undefined\n );\n}\n\nexport type { GeneratorResult } from \"@babel/generator\";\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,SACd,MACA,OAAsB,EAAE,EACH;AACrB,QAAO,MAAM,MAAM;EACjB,SAAS,CAAC,aAAa;EACvB,YAAY;EACZ,6BAA6B;EAC7B,2BAA2B;EAC3B,GAAG;EACJ,CAAC;;AAGJ,IAAI,WAAW;AACf,IAAI,aAAa,SACf,YAAW,SAAS;AAMtB,SAAgB,gBACd,KACA,MACiB;AACjB,QAAO,SACL,KACA,OACI;EAAE,yBAAyB;EAAQ,YAAY;EAAM,GAAG;EAAM,GAC9D,OACL"}
|
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../chunk-C0xms8kb.cjs');
|
|
3
|
+
let chalk = require("chalk");
|
|
4
|
+
chalk = require_chunk.__toESM(chalk);
|
|
5
|
+
let _babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
|
|
6
|
+
let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
|
|
7
|
+
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
//#region src/helpers/create-plugin.ts
|
|
10
|
+
/**
|
|
11
|
+
* Create a Babel plugin using the provided builder function.
|
|
12
|
+
*
|
|
13
|
+
* @param name - The name of the plugin.
|
|
14
|
+
* @param builder - The builder function that defines the plugin behavior.
|
|
15
|
+
* @returns A Babel plugin declaration.
|
|
16
|
+
*/
|
|
17
|
+
function createBabelPlugin(name, builder) {
|
|
18
|
+
const plugin = (context) => {
|
|
19
|
+
return (0, _babel_helper_plugin_utils.declare)((api, options, dirname) => {
|
|
20
|
+
api.cache.using(() => context.meta.checksum);
|
|
21
|
+
api.assertVersion("^7.0.0-0");
|
|
22
|
+
const log = (0, _powerlines_core_lib_logger.extendLog)(context.log, name);
|
|
23
|
+
log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
24
|
+
const result = builder({
|
|
25
|
+
log,
|
|
26
|
+
name,
|
|
27
|
+
api,
|
|
28
|
+
options,
|
|
29
|
+
context,
|
|
30
|
+
dirname
|
|
31
|
+
});
|
|
32
|
+
result.name = name;
|
|
33
|
+
log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
34
|
+
return result;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
plugin.$$name = name;
|
|
38
|
+
return plugin;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.createBabelPlugin = createBabelPlugin;
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { declare } from "@babel/helper-plugin-utils";
|
|
3
|
+
import { extendLog } from "@powerlines/core/lib/logger";
|
|
4
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
//#region src/helpers/create-plugin.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create a Babel plugin using the provided builder function.
|
|
9
|
+
*
|
|
10
|
+
* @param name - The name of the plugin.
|
|
11
|
+
* @param builder - The builder function that defines the plugin behavior.
|
|
12
|
+
* @returns A Babel plugin declaration.
|
|
13
|
+
*/
|
|
14
|
+
function createBabelPlugin(name, builder) {
|
|
15
|
+
const plugin = (context) => {
|
|
16
|
+
return declare((api, options, dirname) => {
|
|
17
|
+
api.cache.using(() => context.meta.checksum);
|
|
18
|
+
api.assertVersion("^7.0.0-0");
|
|
19
|
+
const log = extendLog(context.log, name);
|
|
20
|
+
log(LogLevelLabel.TRACE, `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`);
|
|
21
|
+
const result = builder({
|
|
22
|
+
log,
|
|
23
|
+
name,
|
|
24
|
+
api,
|
|
25
|
+
options,
|
|
26
|
+
context,
|
|
27
|
+
dirname
|
|
28
|
+
});
|
|
29
|
+
result.name = name;
|
|
30
|
+
log(LogLevelLabel.TRACE, `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`);
|
|
31
|
+
return result;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
plugin.$$name = name;
|
|
35
|
+
return plugin;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { createBabelPlugin };
|
|
40
|
+
//# sourceMappingURL=create-plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plugin.mjs","names":[],"sources":["../../src/helpers/create-plugin.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 { declare } from \"@babel/helper-plugin-utils\";\nimport { Context } from \"@powerlines/core\";\nimport { extendLog } from \"@powerlines/core/lib/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport chalk from \"chalk\";\nimport {\n BabelTransformPluginBuilder,\n DeclareBabelTransformPluginReturn\n} from \"../types/config\";\n\n/**\n * Create a Babel plugin using the provided builder function.\n *\n * @param name - The name of the plugin.\n * @param builder - The builder function that defines the plugin behavior.\n * @returns A Babel plugin declaration.\n */\nexport function createBabelPlugin<\n TContext extends Context = Context,\n TOptions extends Record<string, any> = Record<string, any>\n>(\n name: string,\n builder: BabelTransformPluginBuilder<TContext, TOptions>\n): DeclareBabelTransformPluginReturn<TContext, TOptions> {\n const plugin = (context: TContext) => {\n return declare<TOptions>((api, options, dirname) => {\n api.cache.using(() => context.meta.checksum);\n api.assertVersion(\"^7.0.0-0\");\n\n const log = extendLog(context.log, name);\n log(\n LogLevelLabel.TRACE,\n `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`\n );\n\n const result = builder({\n log,\n name,\n api,\n options,\n context,\n dirname\n });\n result.name = name;\n\n log(\n LogLevelLabel.TRACE,\n `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`\n );\n\n return result;\n });\n };\n plugin.$$name = name;\n\n return plugin;\n}\n"],"mappings":";;;;;;;;;;;;;AAmCA,SAAgB,kBAId,MACA,SACuD;CACvD,MAAM,UAAU,YAAsB;AACpC,SAAO,SAAmB,KAAK,SAAS,YAAY;AAClD,OAAI,MAAM,YAAY,QAAQ,KAAK,SAAS;AAC5C,OAAI,cAAc,WAAW;GAE7B,MAAM,MAAM,UAAU,QAAQ,KAAK,KAAK;AACxC,OACE,cAAc,OACd,oBAAoB,MAAM,KAAK,WAAW,KAAK,CAAC,eACjD;GAED,MAAM,SAAS,QAAQ;IACrB;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;AACF,UAAO,OAAO;AAEd,OACE,cAAc,OACd,mCAAmC,MAAM,KAAK,WAAW,KAAK,CAAC,eAChE;AAED,UAAO;IACP;;AAEJ,QAAO,SAAS;AAEhB,QAAO"}
|
package/dist/helpers/filters.cjs
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../chunk-C0xms8kb.cjs');
|
|
3
|
+
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
4
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
5
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
//#region src/helpers/filters.ts
|
|
8
|
+
function getPluginName(plugin) {
|
|
9
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
13
|
+
*
|
|
14
|
+
* @param plugins - The list of existing Babel plugins.
|
|
15
|
+
* @param plugin - The Babel plugin to check for duplicates.
|
|
16
|
+
* @returns True if the plugin is a duplicate, false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
function isDuplicatePlugin(plugins, plugin) {
|
|
19
|
+
return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Filters a Babel plugin by its runtime ID.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The context in which the filter is applied.
|
|
25
|
+
* @param fileId - The file ID to filter by.
|
|
26
|
+
* @returns A filter function that checks if a plugin's ID matches the runtime ID.
|
|
27
|
+
*/
|
|
28
|
+
function filterPluginByFileId(context, fileId) {
|
|
29
|
+
return (code, id) => fileId !== id && context.fs.ids[fileId] !== id && fileId !== context.fs.ids[id] && context.fs.ids[fileId] !== context.fs.ids[id] && context.fs.paths[fileId] !== id && fileId !== context.fs.paths[id] && context.fs.paths[fileId] !== context.fs.paths[id];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
33
|
+
*
|
|
34
|
+
* @param context - The context in which the plugin is being added.
|
|
35
|
+
* @param pluginOrPlugins - The Babel plugin or plugins to add the filter to.
|
|
36
|
+
* @param filter - The filter function to apply to the plugins.
|
|
37
|
+
* @param name - The name of the plugin to add the filter to.
|
|
38
|
+
* @returns The updated list of Babel plugins with the filter applied.
|
|
39
|
+
*/
|
|
40
|
+
function addPluginFilter(context, pluginOrPlugins, filter, name) {
|
|
41
|
+
if (!Array.isArray(pluginOrPlugins) || !pluginOrPlugins.some((plugin) => Array.isArray(plugin)) && pluginOrPlugins.length < 4 && pluginOrPlugins.length > 0 && ((0, _stryke_type_checks_is_set_string.isSetString)(pluginOrPlugins[0]) || (0, _stryke_type_checks_is_function.isFunction)(pluginOrPlugins[0]) || pluginOrPlugins.length > 1 && (0, _stryke_type_checks_is_object.isObject)(pluginOrPlugins[1]) || pluginOrPlugins.length > 2 && (0, _stryke_type_checks_is_object.isObject)(pluginOrPlugins[2]))) return Array.isArray(pluginOrPlugins) ? [
|
|
42
|
+
pluginOrPlugins[0],
|
|
43
|
+
pluginOrPlugins.length > 1 ? pluginOrPlugins[1] : {},
|
|
44
|
+
{ filter: (code, id) => filter(code, id) && (pluginOrPlugins.length < 2 || !(0, _stryke_type_checks_is_function.isFunction)(pluginOrPlugins[2]) || pluginOrPlugins[2]?.(code, id)) }
|
|
45
|
+
] : [
|
|
46
|
+
pluginOrPlugins,
|
|
47
|
+
{},
|
|
48
|
+
{ filter }
|
|
49
|
+
];
|
|
50
|
+
if (!name) throw new Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");
|
|
51
|
+
const foundIndex = pluginOrPlugins.findIndex((plugin) => getPluginName(plugin)?.toLowerCase() === name.toLowerCase());
|
|
52
|
+
if (foundIndex > -1) pluginOrPlugins[foundIndex] = addPluginFilter(context, pluginOrPlugins[foundIndex], filter, name);
|
|
53
|
+
return pluginOrPlugins;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
exports.addPluginFilter = addPluginFilter;
|
|
58
|
+
exports.filterPluginByFileId = filterPluginByFileId;
|
|
59
|
+
exports.getPluginName = getPluginName;
|
|
60
|
+
exports.isDuplicatePlugin = isDuplicatePlugin;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-DxhmCwwY.cjs";
|
|
1
|
+
import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-DSaGPmrz.cjs";
|
|
3
2
|
export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-DDGNo9hw.mjs";
|
|
1
|
+
import { i as isDuplicatePlugin, n as filterPluginByFileId, r as getPluginName, t as addPluginFilter } from "../filters-CJGhJSwI.mjs";
|
|
3
2
|
export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin };
|
package/dist/helpers/filters.mjs
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
2
|
+
import { isObject } from "@stryke/type-checks/is-object";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
//#region src/helpers/filters.ts
|
|
6
|
+
function getPluginName(plugin) {
|
|
7
|
+
return isSetString(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
11
|
+
*
|
|
12
|
+
* @param plugins - The list of existing Babel plugins.
|
|
13
|
+
* @param plugin - The Babel plugin to check for duplicates.
|
|
14
|
+
* @returns True if the plugin is a duplicate, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
function isDuplicatePlugin(plugins, plugin) {
|
|
17
|
+
return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Filters a Babel plugin by its runtime ID.
|
|
21
|
+
*
|
|
22
|
+
* @param context - The context in which the filter is applied.
|
|
23
|
+
* @param fileId - The file ID to filter by.
|
|
24
|
+
* @returns A filter function that checks if a plugin's ID matches the runtime ID.
|
|
25
|
+
*/
|
|
26
|
+
function filterPluginByFileId(context, fileId) {
|
|
27
|
+
return (code, id) => fileId !== id && context.fs.ids[fileId] !== id && fileId !== context.fs.ids[id] && context.fs.ids[fileId] !== context.fs.ids[id] && context.fs.paths[fileId] !== id && fileId !== context.fs.paths[id] && context.fs.paths[fileId] !== context.fs.paths[id];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The context in which the plugin is being added.
|
|
33
|
+
* @param pluginOrPlugins - The Babel plugin or plugins to add the filter to.
|
|
34
|
+
* @param filter - The filter function to apply to the plugins.
|
|
35
|
+
* @param name - The name of the plugin to add the filter to.
|
|
36
|
+
* @returns The updated list of Babel plugins with the filter applied.
|
|
37
|
+
*/
|
|
38
|
+
function addPluginFilter(context, pluginOrPlugins, filter, name) {
|
|
39
|
+
if (!Array.isArray(pluginOrPlugins) || !pluginOrPlugins.some((plugin) => Array.isArray(plugin)) && pluginOrPlugins.length < 4 && pluginOrPlugins.length > 0 && (isSetString(pluginOrPlugins[0]) || isFunction(pluginOrPlugins[0]) || pluginOrPlugins.length > 1 && isObject(pluginOrPlugins[1]) || pluginOrPlugins.length > 2 && isObject(pluginOrPlugins[2]))) return Array.isArray(pluginOrPlugins) ? [
|
|
40
|
+
pluginOrPlugins[0],
|
|
41
|
+
pluginOrPlugins.length > 1 ? pluginOrPlugins[1] : {},
|
|
42
|
+
{ filter: (code, id) => filter(code, id) && (pluginOrPlugins.length < 2 || !isFunction(pluginOrPlugins[2]) || pluginOrPlugins[2]?.(code, id)) }
|
|
43
|
+
] : [
|
|
44
|
+
pluginOrPlugins,
|
|
45
|
+
{},
|
|
46
|
+
{ filter }
|
|
47
|
+
];
|
|
48
|
+
if (!name) throw new Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");
|
|
49
|
+
const foundIndex = pluginOrPlugins.findIndex((plugin) => getPluginName(plugin)?.toLowerCase() === name.toLowerCase());
|
|
50
|
+
if (foundIndex > -1) pluginOrPlugins[foundIndex] = addPluginFilter(context, pluginOrPlugins[foundIndex], filter, name);
|
|
51
|
+
return pluginOrPlugins;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin };
|
|
56
|
+
//# sourceMappingURL=filters.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.mjs","names":[],"sources":["../../src/helpers/filters.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 { Context } from \"@powerlines/core\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n BabelTransformPlugin,\n BabelTransformPluginFilter,\n BabelTransformPluginOptions,\n ResolvedBabelTransformPluginOptions\n} from \"../types/config\";\n\nexport function getPluginName(\n plugin?:\n | BabelTransformPluginOptions\n | string\n | false\n | object\n | ((...args: any[]) => any)\n | undefined\n): string | undefined {\n return isSetString(plugin)\n ? plugin\n : Array.isArray(plugin) && plugin.length > 0\n ? getPluginName(plugin[0])\n : (plugin as BabelTransformPlugin).$$name ||\n (plugin as BabelTransformPlugin).name\n ? (plugin as BabelTransformPlugin).$$name ||\n (plugin as BabelTransformPlugin).name\n : undefined;\n}\n\n/**\n * Check if a Babel plugin is a duplicate of another plugin in the list.\n *\n * @param plugins - The list of existing Babel plugins.\n * @param plugin - The Babel plugin to check for duplicates.\n * @returns True if the plugin is a duplicate, false otherwise.\n */\nexport function isDuplicatePlugin(\n plugins: (ResolvedBabelTransformPluginOptions | undefined)[],\n plugin: BabelTransformPluginOptions\n): boolean {\n return !!(\n getPluginName(plugin) &&\n plugins.some(\n existing =>\n Array.isArray(existing) &&\n getPluginName(existing[0]) === getPluginName(plugin)\n )\n );\n}\n\n/**\n * Filters a Babel plugin by its runtime ID.\n *\n * @param context - The context in which the filter is applied.\n * @param fileId - The file ID to filter by.\n * @returns A filter function that checks if a plugin's ID matches the runtime ID.\n */\nexport function filterPluginByFileId<TContext extends Context = Context>(\n context: TContext,\n fileId: string\n): BabelTransformPluginFilter {\n return (code: string, id: string): boolean =>\n fileId !== id &&\n context.fs.ids[fileId] !== id &&\n fileId !== context.fs.ids[id] &&\n context.fs.ids[fileId] !== context.fs.ids[id] &&\n context.fs.paths[fileId] !== id &&\n fileId !== context.fs.paths[id] &&\n context.fs.paths[fileId] !== context.fs.paths[id];\n}\n\n/**\n * Adds a filter to a Babel plugin or a list of Babel plugins.\n *\n * @param context - The context in which the plugin is being added.\n * @param plugins - The Babel plugins to add the filter to.\n * @param filter - The filter function to apply to the plugins.\n * @param name - The name of the plugin to add the filter to.\n * @returns The updated list of Babel plugins with the filter applied.\n */\nexport function addPluginFilter(\n context: Context,\n plugins: BabelTransformPluginOptions[],\n filter: BabelTransformPluginFilter | null | undefined,\n name: string\n): BabelTransformPluginOptions[];\n\n/**\n * Adds a filter to a Babel plugin or a list of Babel plugins.\n *\n * @param context - The context in which the plugin is being added.\n * @param plugin - The Babel plugin to add the filter to.\n * @param filter - The filter function to apply to the plugin.\n * @returns The updated Babel plugin with the filter applied.\n */\nexport function addPluginFilter(\n context: Context,\n plugin: BabelTransformPlugin | BabelTransformPluginOptions,\n filter: NonNullable<BabelTransformPluginFilter>\n): BabelTransformPluginOptions;\n\n/**\n * Adds a filter to a Babel plugin or a list of Babel plugins.\n *\n * @param context - The context in which the plugin is being added.\n * @param pluginOrPlugins - The Babel plugin or plugins to add the filter to.\n * @param filter - The filter function to apply to the plugins.\n * @param name - The name of the plugin to add the filter to.\n * @returns The updated list of Babel plugins with the filter applied.\n */\nexport function addPluginFilter<\n T extends\n | BabelTransformPlugin\n | BabelTransformPluginOptions\n | BabelTransformPluginOptions[]\n>(\n context: Context,\n pluginOrPlugins: T,\n filter: NonNullable<BabelTransformPluginFilter>,\n name?: string\n): T extends BabelTransformPluginOptions[]\n ? BabelTransformPluginOptions[]\n : BabelTransformPluginOptions {\n if (\n !Array.isArray(pluginOrPlugins) ||\n (!pluginOrPlugins.some(plugin => Array.isArray(plugin)) &&\n pluginOrPlugins.length < 4 &&\n pluginOrPlugins.length > 0 &&\n (isSetString(pluginOrPlugins[0]) ||\n isFunction(pluginOrPlugins[0]) ||\n (pluginOrPlugins.length > 1 && isObject(pluginOrPlugins[1])) ||\n (pluginOrPlugins.length > 2 && isObject(pluginOrPlugins[2]))))\n ) {\n return Array.isArray(pluginOrPlugins)\n ? [\n pluginOrPlugins[0],\n pluginOrPlugins.length > 1 ? pluginOrPlugins[1] : {},\n {\n filter: (code, id) =>\n filter(code, id) &&\n (pluginOrPlugins.length < 2 ||\n !isFunction(pluginOrPlugins[2]) ||\n pluginOrPlugins[2]?.(code, id))\n }\n ]\n : [\n pluginOrPlugins,\n {},\n {\n filter\n }\n ];\n }\n\n if (!name) {\n throw new Error(\n \"No name was provided to \\`addPluginFilter\\`, could not find babel plugin without it.\"\n );\n }\n\n const foundIndex = pluginOrPlugins.findIndex(\n plugin => getPluginName(plugin)?.toLowerCase() === name.toLowerCase()\n );\n if (foundIndex > -1) {\n pluginOrPlugins[foundIndex] = addPlu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