@powerlines/plugin-babel 0.12.299 → 0.12.300
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/core/src/lib/logger.mjs +40 -0
- package/dist/core/src/lib/logger.mjs.map +1 -0
- package/dist/core/src/types/api.d.mts +103 -0
- package/dist/core/src/types/api.d.mts.map +1 -0
- package/dist/core/src/types/commands.d.mts +10 -0
- package/dist/core/src/types/commands.d.mts.map +1 -0
- package/dist/core/src/types/config.d.mts +551 -0
- package/dist/core/src/types/config.d.mts.map +1 -0
- package/dist/core/src/types/context.d.mts +511 -0
- package/dist/core/src/types/context.d.mts.map +1 -0
- package/dist/core/src/types/fs.d.mts +487 -0
- package/dist/core/src/types/fs.d.mts.map +1 -0
- package/dist/core/src/types/hooks.d.mts +99 -0
- package/dist/core/src/types/hooks.d.mts.map +1 -0
- package/dist/core/src/types/index.d.mts +9 -0
- package/dist/core/src/types/plugin.d.mts +204 -0
- package/dist/core/src/types/plugin.d.mts.map +1 -0
- package/dist/core/src/types/tsconfig.d.mts +70 -0
- package/dist/core/src/types/tsconfig.d.mts.map +1 -0
- package/dist/core/src/types/unplugin.d.mts +25 -0
- package/dist/core/src/types/unplugin.d.mts.map +1 -0
- package/dist/helpers/create-plugin.d.mts +3 -2
- package/dist/helpers/create-plugin.d.mts.map +1 -1
- package/dist/helpers/create-plugin.mjs +1 -1
- package/dist/helpers/create-plugin.mjs.map +1 -1
- package/dist/helpers/filters.d.mts +4 -3
- package/dist/helpers/filters.d.mts.map +1 -1
- package/dist/helpers/filters.mjs.map +1 -1
- package/dist/helpers/module-helpers.d.mts +1 -1
- package/dist/helpers/module-helpers.mjs.map +1 -1
- package/dist/helpers/options.d.mts +3 -2
- package/dist/helpers/options.d.mts.map +1 -1
- package/dist/helpers/options.mjs.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/types/config.d.mts +88 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +1 -0
- package/dist/types/index.d.mts +2 -1
- package/dist/types/plugin.d.mts +8 -7
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +36 -153
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/helpers/ast-utils.cjs +0 -35
- package/dist/helpers/ast-utils.d.cts +0 -20
- package/dist/helpers/ast-utils.d.cts.map +0 -1
- package/dist/helpers/create-plugin.cjs +0 -41
- package/dist/helpers/create-plugin.d.cts +0 -16
- package/dist/helpers/create-plugin.d.cts.map +0 -1
- package/dist/helpers/filters.cjs +0 -59
- package/dist/helpers/filters.d.cts +0 -43
- package/dist/helpers/filters.d.cts.map +0 -1
- package/dist/helpers/index.cjs +0 -22
- package/dist/helpers/index.d.cts +0 -6
- package/dist/helpers/module-helpers.cjs +0 -103
- package/dist/helpers/module-helpers.d.cts +0 -50
- package/dist/helpers/module-helpers.d.cts.map +0 -1
- package/dist/helpers/options.cjs +0 -49
- package/dist/helpers/options.d.cts +0 -19
- package/dist/helpers/options.d.cts.map +0 -1
- package/dist/index.cjs +0 -104
- package/dist/index.d.cts +0 -21
- package/dist/index.d.cts.map +0 -1
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +0 -2
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +0 -20
- package/dist/types/plugin.d.cts.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["plugin"],"sources":["../src/index.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 { transformAsync } from \"@babel/core\";\nimport {\n findFileExtension,\n findFileExtensionSafe\n} from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport defu from \"defu\";\nimport {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["plugin"],"sources":["../src/index.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 { transformAsync } from \"@babel/core\";\nimport type { Plugin } from \"@powerlines/core/types\";\nimport {\n findFileExtension,\n findFileExtensionSafe\n} from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport defu from \"defu\";\nimport { isDuplicatePlugin } from \"./helpers/filters\";\nimport { resolveBabelPlugin } from \"./helpers/options\";\nimport { ResolvedBabelTransformPluginOptions } from \"./types/config\";\nimport { BabelPluginContext, BabelPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * Babel plugin for Powerlines.\n *\n * @param options - The Babel plugin user configuration options.\n * @returns A Powerlines plugin that integrates Babel transformations.\n */\nexport const plugin = <\n TContext extends BabelPluginContext = BabelPluginContext\n>(\n options: BabelPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"babel\",\n config() {\n if (!isSetObject(options)) {\n return undefined;\n }\n\n return {\n babel: options\n };\n },\n configResolved: {\n order: \"pre\",\n handler() {\n this.config.babel = defu(this.config.babel ?? {}, {\n plugins: [],\n presets: []\n });\n }\n },\n async transform(code: string, id: string) {\n if (\n isParentPath(id, this.powerlinesPath) ||\n code.includes(\"/* @powerlines-ignore */\") ||\n code.includes(\"/* @powerlines-disable */\")\n ) {\n this.trace(`Skipping Babel transformation for: ${id}`);\n\n return { code, id };\n }\n\n const plugins = this.config.babel.plugins\n .map(plugin => resolveBabelPlugin(this, code, id, plugin))\n .filter(\n (plugin, _, arr) => plugin && !isDuplicatePlugin(arr, plugin)\n ) as ResolvedBabelTransformPluginOptions[];\n const presets = this.config.babel.presets\n .map(preset => resolveBabelPlugin(this, code, id, preset))\n .filter(\n (preset, _, arr) => preset && !isDuplicatePlugin(arr, preset)\n ) as ResolvedBabelTransformPluginOptions[];\n\n if (\n Array.isArray(plugins) &&\n plugins.length === 0 &&\n Array.isArray(presets) &&\n presets.length === 0\n ) {\n return { code, id };\n }\n\n if (\n /^(?:m|c)?tsx?$/.test(\n findFileExtensionSafe(id, {\n fullExtension: true\n })\n ) &&\n !isDuplicatePlugin(plugins, \"@babel/plugin-syntax-typescript\") &&\n !isDuplicatePlugin(presets, \"@babel/preset-typescript\")\n ) {\n plugins.unshift([\n \"@babel/plugin-syntax-typescript\",\n { isTSX: findFileExtension(id) === \"tsx\" }\n ]);\n }\n\n this.trace(\n `Running babel transformations with ${plugins.length} plugins and ${\n presets.length\n } presets for file: ${id}`\n );\n\n const result = await transformAsync(code, {\n highlightCode: true,\n code: true,\n ast: false,\n cloneInputAst: false,\n comments: true,\n sourceType: \"module\",\n configFile: false,\n babelrc: false,\n envName: this.config.mode,\n caller: {\n name: this.config.framework\n },\n ...(this.config.babel ?? {}),\n filename: id,\n plugins: plugins\n .map(plugin => {\n return Array.isArray(plugin) && plugin.length >= 2\n ? [\n plugin[0],\n defu(plugin.length > 1 && plugin[1] ? plugin[1] : {}, {\n options\n })\n ]\n : plugin;\n })\n .filter(Boolean),\n presets: presets\n .map(preset => {\n return Array.isArray(preset) && preset.length >= 2\n ? [\n preset[0],\n defu(preset.length > 1 && preset[1] ? preset[1] : {}, {\n options\n })\n ]\n : preset;\n })\n .filter(Boolean)\n });\n if (!result?.code) {\n throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);\n }\n\n this.trace(`Completed babel transformations for file: ${id}`);\n\n return { code: result.code, id };\n }\n } as Plugin<TContext>;\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,MAAa,UAGX,UAA8B,EAAE,KACX;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,OAAI,CAAC,YAAY,QAAQ,CACvB;AAGF,UAAO,EACL,OAAO,SACR;;EAEH,gBAAgB;GACd,OAAO;GACP,UAAU;AACR,SAAK,OAAO,QAAQ,KAAK,KAAK,OAAO,SAAS,EAAE,EAAE;KAChD,SAAS,EAAE;KACX,SAAS,EAAE;KACZ,CAAC;;GAEL;EACD,MAAM,UAAU,MAAc,IAAY;AACxC,OACE,aAAa,IAAI,KAAK,eAAe,IACrC,KAAK,SAAS,2BAA2B,IACzC,KAAK,SAAS,4BAA4B,EAC1C;AACA,SAAK,MAAM,sCAAsC,KAAK;AAEtD,WAAO;KAAE;KAAM;KAAI;;GAGrB,MAAM,UAAU,KAAK,OAAO,MAAM,QAC/B,KAAI,aAAU,mBAAmB,MAAM,MAAM,IAAIA,SAAO,CAAC,CACzD,QACE,UAAQ,GAAG,QAAQA,YAAU,CAAC,kBAAkB,KAAKA,SAAO,CAC9D;GACH,MAAM,UAAU,KAAK,OAAO,MAAM,QAC/B,KAAI,WAAU,mBAAmB,MAAM,MAAM,IAAI,OAAO,CAAC,CACzD,QACE,QAAQ,GAAG,QAAQ,UAAU,CAAC,kBAAkB,KAAK,OAAO,CAC9D;AAEH,OACE,MAAM,QAAQ,QAAQ,IACtB,QAAQ,WAAW,KACnB,MAAM,QAAQ,QAAQ,I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../core/src/types/context.mjs";
|
|
2
|
+
import { LogFn } from "../core/src/types/config.mjs";
|
|
3
|
+
import "../core/src/types/index.mjs";
|
|
4
|
+
import { PluginItem, PluginObj, PluginPass, TransformOptions, transformAsync } from "@babel/core";
|
|
5
|
+
import { BabelAPI } from "@babel/helper-plugin-utils";
|
|
6
|
+
|
|
7
|
+
//#region src/types/config.d.ts
|
|
8
|
+
interface NamedImportDefinition {
|
|
9
|
+
name: string;
|
|
10
|
+
source: string;
|
|
11
|
+
kind: "named";
|
|
12
|
+
}
|
|
13
|
+
interface DefaultImportDefinition {
|
|
14
|
+
source: string;
|
|
15
|
+
kind: "default";
|
|
16
|
+
}
|
|
17
|
+
type ImportDefinition = NamedImportDefinition | DefaultImportDefinition;
|
|
18
|
+
type BabelPluginPass<TState = unknown> = PluginPass & TState;
|
|
19
|
+
type BabelTransformPluginFilter = (code: string, id: string) => boolean;
|
|
20
|
+
type BabelTransformPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = ((context: TContext) => (options: {
|
|
21
|
+
name: string;
|
|
22
|
+
log: LogFn;
|
|
23
|
+
api: BabelAPI;
|
|
24
|
+
options: TOptions;
|
|
25
|
+
context: TContext;
|
|
26
|
+
dirname: string;
|
|
27
|
+
}) => PluginObj<TOptions & BabelPluginPass<TState>>) & {
|
|
28
|
+
$$name: string;
|
|
29
|
+
};
|
|
30
|
+
type BabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | BabelTransformPlugin<TContext, TOptions, TState> | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions] | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter];
|
|
31
|
+
type ResolvedBabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter | null];
|
|
32
|
+
type BabelTransformInput = Omit<TransformOptions & Required<Pick<TransformOptions, "presets" | "plugins">>, "filename" | "root" | "sourceFileName" | "sourceMaps" | "inputSourceMap">;
|
|
33
|
+
interface BabelTransformPluginBuilderParams<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>> {
|
|
34
|
+
name: string;
|
|
35
|
+
log: LogFn;
|
|
36
|
+
api: BabelAPI;
|
|
37
|
+
options: TOptions;
|
|
38
|
+
context: TContext;
|
|
39
|
+
dirname: string;
|
|
40
|
+
}
|
|
41
|
+
type BabelTransformPluginBuilder<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = (params: BabelTransformPluginBuilderParams<TContext, TOptions>) => PluginObj<TState & BabelPluginPass<TOptions>>;
|
|
42
|
+
type DeclareBabelTransformPluginReturn<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = Omit<BabelTransformPlugin<TContext, TOptions, TState>, "$$name"> & Required<Pick<BabelTransformPlugin<TContext, TOptions, TState>, "$$name">>;
|
|
43
|
+
/**
|
|
44
|
+
* A non-local import specifier represents an import that is not defined within the current module.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* import { bar as baz } from 'foo';
|
|
49
|
+
* // { name: 'baz', module: 'foo', imported: 'bar' }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* It captures the details of an import statement, including the local name used in the module, the source module from which it is imported, and the original name of the export in the source module.
|
|
54
|
+
*/
|
|
55
|
+
interface ImportSpecifier {
|
|
56
|
+
name?: string;
|
|
57
|
+
module: string;
|
|
58
|
+
imported: string;
|
|
59
|
+
}
|
|
60
|
+
type BabelUserConfig = Parameters<typeof transformAsync>[1] & {
|
|
61
|
+
/**
|
|
62
|
+
* The Babel plugins to be used during the build process
|
|
63
|
+
*/
|
|
64
|
+
plugins?: BabelTransformPluginOptions[];
|
|
65
|
+
/**
|
|
66
|
+
* The Babel presets to be used during the build process
|
|
67
|
+
*/
|
|
68
|
+
presets?: BabelTransformPluginOptions[];
|
|
69
|
+
};
|
|
70
|
+
type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
|
|
71
|
+
declare type __ΩNamedImportDefinition = any[];
|
|
72
|
+
declare type __ΩDefaultImportDefinition = any[];
|
|
73
|
+
declare type __ΩImportDefinition = any[];
|
|
74
|
+
declare type __ΩBabelPluginPass = any[];
|
|
75
|
+
declare type __ΩBabelTransformPluginFilter = any[];
|
|
76
|
+
declare type __ΩBabelTransformPlugin = any[];
|
|
77
|
+
declare type __ΩBabelTransformPluginOptions = any[];
|
|
78
|
+
declare type __ΩResolvedBabelTransformPluginOptions = any[];
|
|
79
|
+
declare type __ΩBabelTransformInput = any[];
|
|
80
|
+
declare type __ΩBabelTransformPluginBuilderParams = any[];
|
|
81
|
+
declare type __ΩBabelTransformPluginBuilder = any[];
|
|
82
|
+
declare type __ΩDeclareBabelTransformPluginReturn = any[];
|
|
83
|
+
declare type __ΩImportSpecifier = any[];
|
|
84
|
+
declare type __ΩBabelUserConfig = any[];
|
|
85
|
+
declare type __ΩBabelResolvedConfig = any[];
|
|
86
|
+
//#endregion
|
|
87
|
+
export { BabelPluginPass, BabelResolvedConfig, BabelTransformInput, BabelTransformPlugin, BabelTransformPluginBuilder, BabelTransformPluginBuilderParams, BabelTransformPluginFilter, BabelTransformPluginOptions, BabelUserConfig, DeclareBabelTransformPluginReturn, DefaultImportDefinition, ImportDefinition, ImportSpecifier, NamedImportDefinition, ResolvedBabelTransformPluginOptions, __ΩBabelPluginPass, __ΩBabelResolvedConfig, __ΩBabelTransformInput, __ΩBabelTransformPlugin, __ΩBabelTransformPluginBuilder, __ΩBabelTransformPluginBuilderParams, __ΩBabelTransformPluginFilter, __ΩBabelTransformPluginOptions, __ΩBabelUserConfig, __ΩDeclareBabelTransformPluginReturn, __ΩDefaultImportDefinition, __ΩImportDefinition, __ΩImportSpecifier, __ΩNamedImportDefinition, __ΩResolvedBabelTransformPluginOptions };
|
|
88
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":";;;;;;;UA4BiB,qBAAA;;;;AAAjB;AAMiB,UAAA,uBAAA,CAAuB;EAK5B,MAAA,EAAA,MAAA;EAEA,IAAA,EAAA,SAAA;AAEZ;AAEY,KANA,gBAAA,GAAmB,qBAMC,GANuB,uBAMvB;AACb,KALP,eAKO,CAAA,SAAA,OAAA,CAAA,GAL6B,UAK7B,GAL0C,MAK1C;AAAU,KAHjB,0BAAA,GAGiB,CAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,MAAA,EAAA,GAAA,OAAA;AACV,KAFP,oBAEO,CAAA,iBADA,OACA,GADU,OACV,EAAA,iBAAA,MAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAsB,MAAtB,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,SAAA,OAAA,CAAA,GAAA,CAAA,CAAA,OAAA,EAGR,QAHQ,EAAA,GAAA,CAAA,OAAA,EAAA;EAAsB,IAAA,EAAA,MAAA;EAG9B,GAAA,EAGJ,KAHI;EAGJ,GAAA,EACA,QADA;EACA,OAAA,EACI,QADJ;EACI,OAAA,EACA,QADA;EACA,OAAA,EAAA,MAAA;CAEK,EAAA,GAAV,SAAU,CAAA,QAAA,GAAW,eAAX,CAA2B,MAA3B,CAAA,CAAA,CAAA,GAAA;EAA2B,MAAA,EAAA,MAAA;CAAhB;AAArB,KAIM,2BAJN,CAAA,iBAKa,OALb,GAKuB,OALvB,EAAA,iBAMa,MANb,CAAA,MAAA,EAAA,GAAA,CAAA,GAMmC,MANnC,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,SAAA,OAAA,CAAA,GASF,UATE,GAUF,oBAVE,CAUmB,QAVnB,EAU6B,QAV7B,EAUuC,MAVvC,CAA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;AAAU,sDAAA,GAAA,EAAA;AACV,sCAAA,GAAA,EAAA;AAAsB,oDAAA,GAAA,EAAA;AAGG,8CAAA,GAAA,EAAA;AAAU,oDAAA,GAAA,EAAA;AAA5C,kCAAA,GAAA,EAAA;AACK,kCAAA,GAAA,EAAA;AAAyB,sCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { BabelPluginPass, BabelResolvedConfig, BabelTransformInput, BabelTransformPlugin, BabelTransformPluginBuilder, BabelTransformPluginBuilderParams, BabelTransformPluginFilter, BabelTransformPluginOptions, BabelUserConfig, DeclareBabelTransformPluginReturn, DefaultImportDefinition, ImportDefinition, ImportSpecifier, NamedImportDefinition, ResolvedBabelTransformPluginOptions, __ΩBabelPluginPass, __ΩBabelResolvedConfig, __ΩBabelTransformInput, __ΩBabelTransformPlugin, __ΩBabelTransformPluginBuilder, __ΩBabelTransformPluginBuilderParams, __ΩBabelTransformPluginFilter, __ΩBabelTransformPluginOptions, __ΩBabelUserConfig, __ΩDeclareBabelTransformPluginReturn, __ΩDefaultImportDefinition, __ΩImportDefinition, __ΩImportSpecifier, __ΩNamedImportDefinition, __ΩResolvedBabelTransformPluginOptions } from "./config.mjs";
|
|
1
2
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./plugin.mjs";
|
|
2
|
-
export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig };
|
|
3
|
+
export { BabelPluginContext, BabelPluginOptions, BabelPluginPass, BabelPluginResolvedConfig, BabelPluginUserConfig, BabelResolvedConfig, BabelTransformInput, BabelTransformPlugin, BabelTransformPluginBuilder, BabelTransformPluginBuilderParams, BabelTransformPluginFilter, BabelTransformPluginOptions, BabelUserConfig, DeclareBabelTransformPluginReturn, DefaultImportDefinition, ImportDefinition, ImportSpecifier, NamedImportDefinition, ResolvedBabelTransformPluginOptions, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginPass, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig, __ΩBabelResolvedConfig, __ΩBabelTransformInput, __ΩBabelTransformPlugin, __ΩBabelTransformPluginBuilder, __ΩBabelTransformPluginBuilderParams, __ΩBabelTransformPluginFilter, __ΩBabelTransformPluginOptions, __ΩBabelUserConfig, __ΩDeclareBabelTransformPluginReturn, __ΩDefaultImportDefinition, __ΩImportDefinition, __ΩImportSpecifier, __ΩNamedImportDefinition, __ΩResolvedBabelTransformPluginOptions };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { PluginContext } from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { PluginContext } from "../core/src/types/context.mjs";
|
|
2
|
+
import { ResolvedConfig, UserConfig } from "../core/src/types/config.mjs";
|
|
3
|
+
import "../core/src/types/index.mjs";
|
|
4
|
+
import { BabelResolvedConfig, BabelUserConfig } from "./config.mjs";
|
|
4
5
|
|
|
5
6
|
//#region src/types/plugin.d.ts
|
|
6
7
|
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
-
type BabelPluginUserConfig = UserConfig
|
|
8
|
+
type BabelPluginUserConfig = UserConfig & {
|
|
9
|
+
babel?: BabelPluginOptions;
|
|
10
|
+
};
|
|
8
11
|
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
9
|
-
|
|
10
|
-
babel: BabelResolvedConfig;
|
|
11
|
-
};
|
|
12
|
+
babel: BabelResolvedConfig;
|
|
12
13
|
}
|
|
13
14
|
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
15
|
declare type __ΩBabelPluginOptions = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;KAyBY,kBAAA,GAAqB,QAAQ;KAE7B,qBAAA,GAAwB;UAC1B;;AAHE,UAMK,yBAAA,SAAkC,cANX,CAAA;EAE5B,KAAA,EAKH,mBALwB;AAIjC;AAIY,KAAA,kBAAkB,CAAA,wBACJ,yBADI,GACwB,yBADxB,CAAA,GAE1B,aAF0B,CAEZ,eAFY,CAAA;AACJ,qCAAA,GAAA,EAAA;AAA4B,wCAAA,GAAA,EAAA;AACpC,4CAAA,GAAA,EAAA;AAAd,qCAAA,GAAA,EAAA"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-babel",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.12.300",
|
|
4
|
+
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
|
+
"keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
|
|
7
|
+
"homepage": "https://stormsoftware.com",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://stormsoftware.com/support",
|
|
10
|
+
"email": "support@stormsoftware.com"
|
|
11
|
+
},
|
|
6
12
|
"repository": {
|
|
7
13
|
"type": "github",
|
|
8
14
|
"url": "https://github.com/storm-software/powerlines.git",
|
|
9
15
|
"directory": "packages/plugin-babel"
|
|
10
16
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"url": "https://
|
|
14
|
-
"email": "support@stormsoftware.com"
|
|
17
|
+
"funding": {
|
|
18
|
+
"type": "github",
|
|
19
|
+
"url": "https://github.com/sponsors/storm-software"
|
|
15
20
|
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
16
22
|
"author": {
|
|
17
23
|
"name": "Storm Software",
|
|
18
24
|
"email": "contact@stormsoftware.com",
|
|
@@ -32,151 +38,25 @@
|
|
|
32
38
|
"url": "https://stormsoftware.com"
|
|
33
39
|
}
|
|
34
40
|
],
|
|
35
|
-
"
|
|
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.mjs",
|
|
41
|
+
"type": "module",
|
|
43
42
|
"exports": {
|
|
44
|
-
".":
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"default": "./dist/index.mjs"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"./helpers": {
|
|
59
|
-
"require": {
|
|
60
|
-
"types": "./dist/helpers/index.d.cts",
|
|
61
|
-
"default": "./dist/helpers/index.cjs"
|
|
62
|
-
},
|
|
63
|
-
"import": {
|
|
64
|
-
"types": "./dist/helpers/index.d.mts",
|
|
65
|
-
"default": "./dist/helpers/index.mjs"
|
|
66
|
-
},
|
|
67
|
-
"default": {
|
|
68
|
-
"types": "./dist/helpers/index.d.mts",
|
|
69
|
-
"default": "./dist/helpers/index.mjs"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"./helpers/ast-utils": {
|
|
73
|
-
"require": {
|
|
74
|
-
"types": "./dist/helpers/ast-utils.d.cts",
|
|
75
|
-
"default": "./dist/helpers/ast-utils.cjs"
|
|
76
|
-
},
|
|
77
|
-
"import": {
|
|
78
|
-
"types": "./dist/helpers/ast-utils.d.mts",
|
|
79
|
-
"default": "./dist/helpers/ast-utils.mjs"
|
|
80
|
-
},
|
|
81
|
-
"default": {
|
|
82
|
-
"types": "./dist/helpers/ast-utils.d.mts",
|
|
83
|
-
"default": "./dist/helpers/ast-utils.mjs"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"./helpers/create-plugin": {
|
|
87
|
-
"require": {
|
|
88
|
-
"types": "./dist/helpers/create-plugin.d.cts",
|
|
89
|
-
"default": "./dist/helpers/create-plugin.cjs"
|
|
90
|
-
},
|
|
91
|
-
"import": {
|
|
92
|
-
"types": "./dist/helpers/create-plugin.d.mts",
|
|
93
|
-
"default": "./dist/helpers/create-plugin.mjs"
|
|
94
|
-
},
|
|
95
|
-
"default": {
|
|
96
|
-
"types": "./dist/helpers/create-plugin.d.mts",
|
|
97
|
-
"default": "./dist/helpers/create-plugin.mjs"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"./helpers/filters": {
|
|
101
|
-
"require": {
|
|
102
|
-
"types": "./dist/helpers/filters.d.cts",
|
|
103
|
-
"default": "./dist/helpers/filters.cjs"
|
|
104
|
-
},
|
|
105
|
-
"import": {
|
|
106
|
-
"types": "./dist/helpers/filters.d.mts",
|
|
107
|
-
"default": "./dist/helpers/filters.mjs"
|
|
108
|
-
},
|
|
109
|
-
"default": {
|
|
110
|
-
"types": "./dist/helpers/filters.d.mts",
|
|
111
|
-
"default": "./dist/helpers/filters.mjs"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"./helpers/module-helpers": {
|
|
115
|
-
"require": {
|
|
116
|
-
"types": "./dist/helpers/module-helpers.d.cts",
|
|
117
|
-
"default": "./dist/helpers/module-helpers.cjs"
|
|
118
|
-
},
|
|
119
|
-
"import": {
|
|
120
|
-
"types": "./dist/helpers/module-helpers.d.mts",
|
|
121
|
-
"default": "./dist/helpers/module-helpers.mjs"
|
|
122
|
-
},
|
|
123
|
-
"default": {
|
|
124
|
-
"types": "./dist/helpers/module-helpers.d.mts",
|
|
125
|
-
"default": "./dist/helpers/module-helpers.mjs"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"./helpers/options": {
|
|
129
|
-
"require": {
|
|
130
|
-
"types": "./dist/helpers/options.d.cts",
|
|
131
|
-
"default": "./dist/helpers/options.cjs"
|
|
132
|
-
},
|
|
133
|
-
"import": {
|
|
134
|
-
"types": "./dist/helpers/options.d.mts",
|
|
135
|
-
"default": "./dist/helpers/options.mjs"
|
|
136
|
-
},
|
|
137
|
-
"default": {
|
|
138
|
-
"types": "./dist/helpers/options.d.mts",
|
|
139
|
-
"default": "./dist/helpers/options.mjs"
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
"./package.json": "./package.json",
|
|
143
|
-
"./types": {
|
|
144
|
-
"require": {
|
|
145
|
-
"types": "./dist/types/index.d.cts",
|
|
146
|
-
"default": "./dist/types/index.cjs"
|
|
147
|
-
},
|
|
148
|
-
"import": {
|
|
149
|
-
"types": "./dist/types/index.d.mts",
|
|
150
|
-
"default": "./dist/types/index.mjs"
|
|
151
|
-
},
|
|
152
|
-
"default": {
|
|
153
|
-
"types": "./dist/types/index.d.mts",
|
|
154
|
-
"default": "./dist/types/index.mjs"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"./types/plugin": {
|
|
158
|
-
"require": {
|
|
159
|
-
"types": "./dist/types/plugin.d.cts",
|
|
160
|
-
"default": "./dist/types/plugin.cjs"
|
|
161
|
-
},
|
|
162
|
-
"import": {
|
|
163
|
-
"types": "./dist/types/plugin.d.mts",
|
|
164
|
-
"default": "./dist/types/plugin.mjs"
|
|
165
|
-
},
|
|
166
|
-
"default": {
|
|
167
|
-
"types": "./dist/types/plugin.d.mts",
|
|
168
|
-
"default": "./dist/types/plugin.mjs"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
43
|
+
".": "./dist/index.mjs",
|
|
44
|
+
"./helpers": "./dist/helpers/index.mjs",
|
|
45
|
+
"./helpers/ast-utils": "./dist/helpers/ast-utils.mjs",
|
|
46
|
+
"./helpers/create-plugin": "./dist/helpers/create-plugin.mjs",
|
|
47
|
+
"./helpers/filters": "./dist/helpers/filters.mjs",
|
|
48
|
+
"./helpers/module-helpers": "./dist/helpers/module-helpers.mjs",
|
|
49
|
+
"./helpers/options": "./dist/helpers/options.mjs",
|
|
50
|
+
"./types": "./dist/types/index.mjs",
|
|
51
|
+
"./types/config": "./dist/types/config.mjs",
|
|
52
|
+
"./types/plugin": "./dist/types/plugin.mjs",
|
|
53
|
+
"./*": "./*"
|
|
171
54
|
},
|
|
172
|
-
"
|
|
55
|
+
"main": "./dist/index.mjs",
|
|
56
|
+
"module": "./dist/index.mjs",
|
|
57
|
+
"types": "./dist/index.d.mts",
|
|
173
58
|
"typings": "dist/index.d.mts",
|
|
174
59
|
"files": ["dist/**/*"],
|
|
175
|
-
"keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
|
|
176
|
-
"peerDependencies": { "@babel/plugin-syntax-typescript": "^7.27.1" },
|
|
177
|
-
"peerDependenciesMeta": {
|
|
178
|
-
"@babel/plugin-syntax-typescript": { "optional": false }
|
|
179
|
-
},
|
|
180
60
|
"dependencies": {
|
|
181
61
|
"@babel/core": "^7.29.0",
|
|
182
62
|
"@babel/generator": "^7.29.1",
|
|
@@ -184,19 +64,22 @@
|
|
|
184
64
|
"@babel/parser": "^7.29.0",
|
|
185
65
|
"@babel/plugin-syntax-typescript": "^7.28.6",
|
|
186
66
|
"@babel/types": "^7.29.0",
|
|
187
|
-
"@storm-software/config-tools": "^1.189.
|
|
67
|
+
"@storm-software/config-tools": "^1.189.10",
|
|
188
68
|
"@stryke/fs": "^0.33.43",
|
|
189
69
|
"@stryke/path": "^0.26.6",
|
|
190
70
|
"@stryke/type-checks": "^0.5.25",
|
|
191
71
|
"@stryke/types": "^0.10.39",
|
|
192
72
|
"chalk": "5.6.2",
|
|
193
73
|
"defu": "^6.1.4",
|
|
194
|
-
"jiti": "^2.6.1"
|
|
195
|
-
"powerlines": "^0.38.57"
|
|
74
|
+
"jiti": "^2.6.1"
|
|
196
75
|
},
|
|
197
76
|
"devDependencies": {
|
|
198
|
-
"@
|
|
199
|
-
"@types/
|
|
77
|
+
"@types/node": "^25.3.2",
|
|
78
|
+
"@types/babel__helper-plugin-utils": "^7.10.3"
|
|
79
|
+
},
|
|
80
|
+
"peerDependencies": { "@babel/plugin-syntax-typescript": "^7.27.1" },
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"@babel/plugin-syntax-typescript": { "optional": false }
|
|
200
83
|
},
|
|
201
84
|
"publishConfig": {
|
|
202
85
|
"access": "public",
|
|
@@ -237,5 +120,5 @@
|
|
|
237
120
|
"./package.json": "./package.json"
|
|
238
121
|
}
|
|
239
122
|
},
|
|
240
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "0dcb16f054b8a69915b074578e6d4dfa3ecc1529"
|
|
241
124
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __babel_generator = require("@babel/generator");
|
|
3
|
-
__babel_generator = require_rolldown_runtime.__toESM(__babel_generator);
|
|
4
|
-
let __babel_parser = require("@babel/parser");
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/ast-utils.ts
|
|
7
|
-
/**
|
|
8
|
-
* Parse the given code into an AST.
|
|
9
|
-
*
|
|
10
|
-
* @param code - The code to parse.
|
|
11
|
-
* @param opts - The options for parsing.
|
|
12
|
-
* @returns The parsed AST.
|
|
13
|
-
*/
|
|
14
|
-
function parseAst(code, opts = {}) {
|
|
15
|
-
return (0, __babel_parser.parse)(code, {
|
|
16
|
-
plugins: ["typescript"],
|
|
17
|
-
sourceType: "module",
|
|
18
|
-
allowImportExportEverywhere: true,
|
|
19
|
-
allowAwaitOutsideFunction: true,
|
|
20
|
-
...opts
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
let generate = __babel_generator.default;
|
|
24
|
-
if ("default" in generate) generate = generate.default;
|
|
25
|
-
function generateFromAst(ast, opts) {
|
|
26
|
-
return generate(ast, opts ? {
|
|
27
|
-
importAttributesKeyword: "with",
|
|
28
|
-
sourceMaps: true,
|
|
29
|
-
...opts
|
|
30
|
-
} : void 0);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.generateFromAst = generateFromAst;
|
|
35
|
-
exports.parseAst = parseAst;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GeneratorOptions, GeneratorResult, GeneratorResult as GeneratorResult$1 } from "@babel/generator";
|
|
2
|
-
import { ParseResult, ParserOptions } from "@babel/parser";
|
|
3
|
-
import * as t from "@babel/types";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/ast-utils.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Parse the given code into an AST.
|
|
9
|
-
*
|
|
10
|
-
* @param code - The code to parse.
|
|
11
|
-
* @param opts - The options for parsing.
|
|
12
|
-
* @returns The parsed AST.
|
|
13
|
-
*/
|
|
14
|
-
declare function parseAst(code: string, opts?: ParserOptions): ParseResult<t.File>;
|
|
15
|
-
type GenerateFromAstOptions = GeneratorOptions & Required<Pick<GeneratorOptions, "sourceFileName" | "filename">>;
|
|
16
|
-
declare function generateFromAst(ast: t.Node, opts?: GenerateFromAstOptions): GeneratorResult$1;
|
|
17
|
-
declare type __ΩGenerateFromAstOptions = any[];
|
|
18
|
-
//#endregion
|
|
19
|
-
export { GenerateFromAstOptions, type GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst };
|
|
20
|
-
//# sourceMappingURL=ast-utils.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.d.cts","names":[],"sources":["../../src/helpers/ast-utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA+BA;;;;;AAkBY,iBAlBI,QAAA,CAkBkB,IAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAhB1B,aAgB0B,CAAA,EAf/B,WAe+B,CAfnB,CAAA,CAAE,IAeiB,CAAA;AAAG,KAAzB,sBAAA,GAAyB,gBAAA,GACnC,QADmC,CAC1B,IAD0B,CACrB,gBADqB,EAAA,gBAAA,GAAA,UAAA,CAAA,CAAA;AACrB,iBAEA,eAAA,CAFA,GAAA,EAGT,CAAA,CAAE,IAHO,EAAA,IAAA,CAAA,EAIP,sBAJO,CAAA,EAKb,iBALa;AAAd,yCAAA,GAAA,EAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let chalk = require("chalk");
|
|
3
|
-
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
4
|
-
let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
|
|
5
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
-
let powerlines_lib_logger = require("powerlines/lib/logger");
|
|
7
|
-
|
|
8
|
-
//#region src/helpers/create-plugin.ts
|
|
9
|
-
/**
|
|
10
|
-
* Create a Babel plugin using the provided builder function.
|
|
11
|
-
*
|
|
12
|
-
* @param name - The name of the plugin.
|
|
13
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
14
|
-
* @returns A Babel plugin declaration.
|
|
15
|
-
*/
|
|
16
|
-
function createBabelPlugin(name, builder) {
|
|
17
|
-
const plugin = (context) => {
|
|
18
|
-
return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
|
|
19
|
-
api.cache.using(() => context.meta.checksum);
|
|
20
|
-
api.assertVersion("^7.0.0-0");
|
|
21
|
-
const log = (0, powerlines_lib_logger.extendLog)(context.log, name);
|
|
22
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
23
|
-
const result = builder({
|
|
24
|
-
log,
|
|
25
|
-
name,
|
|
26
|
-
api,
|
|
27
|
-
options,
|
|
28
|
-
context,
|
|
29
|
-
dirname
|
|
30
|
-
});
|
|
31
|
-
result.name = name;
|
|
32
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
33
|
-
return result;
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
plugin.$$name = name;
|
|
37
|
-
return plugin;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
exports.createBabelPlugin = createBabelPlugin;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BabelTransformPluginBuilder, DeclareBabelTransformPluginReturn } from "powerlines/types/babel";
|
|
2
|
-
import { Context } from "powerlines/types/context";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/create-plugin.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a Babel plugin using the provided builder function.
|
|
8
|
-
*
|
|
9
|
-
* @param name - The name of the plugin.
|
|
10
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
11
|
-
* @returns A Babel plugin declaration.
|
|
12
|
-
*/
|
|
13
|
-
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
|
-
//#endregion
|
|
15
|
-
export { createBabelPlugin };
|
|
16
|
-
//# sourceMappingURL=create-plugin.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-plugin.d.cts","names":[],"sources":["../../src/helpers/create-plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAmCA;;;;;AAKuC,iBALvB,iBAKuB,CAAA,iBAJpB,OAIoB,GAJV,OAIU,EAAA,iBAHpB,MAGoB,CAAA,MAAA,EAAA,GAAA,CAAA,GAHE,MAGF,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAA5B,2BAA4B,CAAA,QAAA,EAAU,QAAV,CAAA,CAAA,EACpC,iCADoC,CACF,QADE,EACQ,QADR,CAAA"}
|
package/dist/helpers/filters.cjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
3
|
-
let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
4
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/filters.ts
|
|
7
|
-
function getPluginName(plugin) {
|
|
8
|
-
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;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
12
|
-
*
|
|
13
|
-
* @param plugins - The list of existing Babel plugins.
|
|
14
|
-
* @param plugin - The Babel plugin to check for duplicates.
|
|
15
|
-
* @returns True if the plugin is a duplicate, false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
function isDuplicatePlugin(plugins, plugin) {
|
|
18
|
-
return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Filters a Babel plugin by its runtime ID.
|
|
22
|
-
*
|
|
23
|
-
* @param context - The context in which the filter is applied.
|
|
24
|
-
* @param fileId - The file ID to filter by.
|
|
25
|
-
* @returns A filter function that checks if a plugin's ID matches the runtime ID.
|
|
26
|
-
*/
|
|
27
|
-
function filterPluginByFileId(context, fileId) {
|
|
28
|
-
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];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
32
|
-
*
|
|
33
|
-
* @param context - The context in which the plugin is being added.
|
|
34
|
-
* @param pluginOrPlugins - The Babel plugin or plugins to add the filter to.
|
|
35
|
-
* @param filter - The filter function to apply to the plugins.
|
|
36
|
-
* @param name - The name of the plugin to add the filter to.
|
|
37
|
-
* @returns The updated list of Babel plugins with the filter applied.
|
|
38
|
-
*/
|
|
39
|
-
function addPluginFilter(context, pluginOrPlugins, filter, name) {
|
|
40
|
-
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) ? [
|
|
41
|
-
pluginOrPlugins[0],
|
|
42
|
-
pluginOrPlugins.length > 1 ? pluginOrPlugins[1] : {},
|
|
43
|
-
{ filter: (code, id) => filter(code, id) && (pluginOrPlugins.length < 2 || !(0, __stryke_type_checks_is_function.isFunction)(pluginOrPlugins[2]) || pluginOrPlugins[2]?.(code, id)) }
|
|
44
|
-
] : [
|
|
45
|
-
pluginOrPlugins,
|
|
46
|
-
{},
|
|
47
|
-
{ filter }
|
|
48
|
-
];
|
|
49
|
-
if (!name) throw new Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");
|
|
50
|
-
const foundIndex = pluginOrPlugins.findIndex((plugin) => getPluginName(plugin)?.toLowerCase() === name.toLowerCase());
|
|
51
|
-
if (foundIndex > -1) pluginOrPlugins[foundIndex] = addPluginFilter(context, pluginOrPlugins[foundIndex], filter, name);
|
|
52
|
-
return pluginOrPlugins;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
exports.addPluginFilter = addPluginFilter;
|
|
57
|
-
exports.filterPluginByFileId = filterPluginByFileId;
|
|
58
|
-
exports.getPluginName = getPluginName;
|
|
59
|
-
exports.isDuplicatePlugin = isDuplicatePlugin;
|