@powerlines/plugin-babel 0.12.67 → 0.12.69
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-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
- package/dist/helpers/ast-utils.cjs +1 -1
- package/dist/helpers/ast-utils.d.cts +19 -2
- package/dist/helpers/ast-utils.d.mts +19 -2
- package/dist/helpers/ast-utils.mjs +1 -1
- package/dist/helpers/create-plugin.cjs +1 -1
- package/dist/helpers/create-plugin.d.cts +14 -2
- package/dist/helpers/create-plugin.d.mts +14 -2
- package/dist/helpers/create-plugin.mjs +1 -1
- package/dist/helpers/filters.cjs +1 -1
- package/dist/helpers/filters.d.cts +41 -2
- package/dist/helpers/filters.d.mts +42 -2
- package/dist/helpers/filters.mjs +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +5 -7
- package/dist/helpers/index.d.mts +5 -7
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/module-helpers.cjs +1 -1
- package/dist/helpers/module-helpers.d.cts +48 -2
- package/dist/helpers/module-helpers.d.mts +48 -2
- package/dist/helpers/module-helpers.mjs +1 -1
- package/dist/helpers/options.cjs +1 -1
- package/dist/helpers/options.d.cts +17 -2
- package/dist/helpers/options.d.mts +17 -2
- package/dist/helpers/options.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -9
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
- package/dist/powerlines/src/lib/logger.cjs +1 -0
- package/dist/powerlines/src/lib/logger.mjs +1 -0
- package/dist/powerlines/src/types/api.d.mts +5 -0
- package/dist/powerlines/src/types/babel.d.cts +50 -0
- package/dist/powerlines/src/types/babel.d.mts +50 -0
- package/dist/powerlines/src/types/build.d.cts +139 -0
- package/dist/powerlines/src/types/build.d.mts +139 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +356 -0
- package/dist/powerlines/src/types/config.d.mts +356 -0
- package/dist/powerlines/src/types/context.d.cts +347 -0
- package/dist/powerlines/src/types/context.d.mts +349 -0
- package/dist/powerlines/src/types/fs.d.cts +458 -0
- package/dist/powerlines/src/types/fs.d.mts +458 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/index.d.mts +12 -0
- package/dist/powerlines/src/types/plugin.d.cts +232 -0
- package/dist/powerlines/src/types/plugin.d.mts +232 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +82 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/powerlines/src/types/unplugin.d.mts +6 -0
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +1 -3
- package/dist/types/index.d.mts +1 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +18 -2
- package/dist/types/plugin.d.mts +18 -2
- package/dist/types/plugin.mjs +1 -1
- package/package.json +10 -10
- package/dist/ast-utils-BXgehtOj.cjs +0 -1
- package/dist/ast-utils-Bs6DBkKg.d.mts +0 -19
- package/dist/ast-utils-DeuXcuqs.d.cts +0 -19
- package/dist/ast-utils-QwV5Hp9M.mjs +0 -1
- package/dist/babel-ChnxDnEW.d.cts +0 -1692
- package/dist/babel-DTaio8BX.d.mts +0 -1692
- package/dist/create-plugin-BX_bUhNU.cjs +0 -1
- package/dist/create-plugin-CT3AmMST.d.cts +0 -14
- package/dist/create-plugin-CcyQJscB.d.mts +0 -14
- package/dist/create-plugin-pWE4rRW3.mjs +0 -1
- package/dist/filters-DJgM_YqO.cjs +0 -1
- package/dist/filters-DWUVYxNP.d.cts +0 -41
- package/dist/filters-Dy71Hudo.d.mts +0 -44
- package/dist/filters-H7GHqM8L.mjs +0 -1
- package/dist/helpers-Bx2yBrpn.cjs +0 -0
- package/dist/helpers-C23KLU23.mjs +0 -1
- package/dist/index-ClXLQ1fw.d.mts +0 -1
- package/dist/index-DeEmP3Jc.d.cts +0 -1
- package/dist/index-QbUkWSLh.d.mts +0 -1
- package/dist/index-zO0Ly4bS.d.cts +0 -1
- package/dist/module-helpers-BXxcpiSf.d.cts +0 -49
- package/dist/module-helpers-CBJeXQA-.cjs +0 -1
- package/dist/module-helpers-CFI-GsFM.mjs +0 -1
- package/dist/module-helpers-ptD32AP3.d.mts +0 -49
- package/dist/options-Bxa6CVME.d.cts +0 -17
- package/dist/options-WrgZrzO5.mjs +0 -1
- package/dist/options-d1d8EwPZ.cjs +0 -1
- package/dist/options-kquKKsDE.d.mts +0 -17
- package/dist/plugin-BSBH78mm.cjs +0 -0
- package/dist/plugin-Ckany8iM.d.cts +0 -17
- package/dist/plugin-CpXo1Y2H.d.mts +0 -17
- package/dist/plugin-CpyJWCZI.mjs +0 -1
- package/dist/types-CKPddlfS.cjs +0 -0
- package/dist/types-cM7ObqRe.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`chalk`);n=e.t(n);let r=require(`@babel/helper-plugin-utils`);require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let i=require(`@stryke/string-format/title-case`);const a=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`],o=(e,t)=>(r,...o)=>e(r,` ${n.default.inverse.hex(a[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%a.length]||a[0])(` ${(0,i.titleCase)(t)} `)} ${o.join(` `)} `);function s(e,i){let a=a=>(0,r.declare)((r,s,c)=>{r.cache.using(()=>a.meta.checksum),r.assertVersion(`^7.0.0-0`);let l=o(a.log,e);l(t.LogLevelLabel.TRACE,`Initializing the ${n.default.bold.cyanBright(e)} Babel plugin`);let u=i({log:l,name:e,api:r,options:s,context:a,dirname:c});return u.name=e,l(t.LogLevelLabel.TRACE,`Completed initialization of the ${n.default.bold.cyanBright(e)} Babel plugin`),u});return a.$$name=e,a}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { a as DeclareBabelTransformPluginReturn, n as BabelTransformPluginBuilder, u as Context } from "./babel-ChnxDnEW.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/create-plugin.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a Babel plugin using the provided builder function.
|
|
7
|
-
*
|
|
8
|
-
* @param name - The name of the plugin.
|
|
9
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
10
|
-
* @returns A Babel plugin declaration.
|
|
11
|
-
*/
|
|
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>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { createBabelPlugin as t };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { a as DeclareBabelTransformPluginReturn, n as BabelTransformPluginBuilder, u as Context } from "./babel-DTaio8BX.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/create-plugin.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a Babel plugin using the provided builder function.
|
|
7
|
-
*
|
|
8
|
-
* @param name - The name of the plugin.
|
|
9
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
10
|
-
* @returns A Babel plugin declaration.
|
|
11
|
-
*/
|
|
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>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { createBabelPlugin as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LogLevelLabel as e}from"@storm-software/config-tools/types";import t from"chalk";import{declare as n}from"@babel/helper-plugin-utils";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{titleCase as r}from"@stryke/string-format/title-case";const i=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`],a=(e,n)=>(a,...o)=>e(a,` ${t.inverse.hex(i[n.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%i.length]||i[0])(` ${r(n)} `)} ${o.join(` `)} `);function o(r,i){let o=o=>n((n,s,c)=>{n.cache.using(()=>o.meta.checksum),n.assertVersion(`^7.0.0-0`);let l=a(o.log,r);l(e.TRACE,`Initializing the ${t.bold.cyanBright(r)} Babel plugin`);let u=i({log:l,name:r,api:n,options:s,context:o,dirname:c});return u.name=r,l(e.TRACE,`Completed initialization of the ${t.bold.cyanBright(r)} Babel plugin`),u});return o.$$name=r,o}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@stryke/type-checks/is-function`),n=require(`@stryke/type-checks/is-object`),r=require(`@stryke/type-checks/is-set-string`);function i(e){return(0,r.isSetString)(e)?e:Array.isArray(e)&&e.length>0?i(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function a(e,t){return!!(i(t)&&e.some(e=>Array.isArray(e)&&i(e[0])===i(t)))}function o(e,t){return(n,r)=>t!==r&&e.fs.ids[t]!==r&&t!==e.fs.ids[r]&&e.fs.ids[t]!==e.fs.ids[r]}function s(e,a,o,c){if(!Array.isArray(a)||!a.some(e=>Array.isArray(e))&&a.length<4&&a.length>0&&((0,r.isSetString)(a[0])||(0,t.isFunction)(a[0])||a.length>1&&(0,n.isObject)(a[1])||a.length>2&&(0,n.isObject)(a[2])))return Array.isArray(a)?[a[0],a.length>1?a[1]:{},{filter:(e,n)=>o(e,n)&&(a.length<2||!(0,t.isFunction)(a[2])||a[2]?.(e,n))}]:[a,{},{filter:o}];if(!c)throw Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");let l=a.findIndex(e=>i(e)?.toLowerCase()===c.toLowerCase());return l>-1&&(a[l]=s(e,a[l],o,c)),a}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { i as BabelTransformPluginOptions, r as BabelTransformPluginFilter, s as ResolvedBabelTransformPluginOptions, t as BabelTransformPlugin, u as Context } from "./babel-ChnxDnEW.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/filters.d.ts
|
|
4
|
-
declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
7
|
-
*
|
|
8
|
-
* @param plugins - The list of existing Babel plugins.
|
|
9
|
-
* @param plugin - The Babel plugin to check for duplicates.
|
|
10
|
-
* @returns True if the plugin is a duplicate, false otherwise.
|
|
11
|
-
*/
|
|
12
|
-
declare function isDuplicatePlugin(plugins: (ResolvedBabelTransformPluginOptions | undefined)[], plugin: BabelTransformPluginOptions): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Filters a Babel plugin by its runtime ID.
|
|
15
|
-
*
|
|
16
|
-
* @param context - The context in which the filter is applied.
|
|
17
|
-
* @param fileId - The file ID to filter by.
|
|
18
|
-
* @returns A filter function that checks if a plugin's ID matches the runtime ID.
|
|
19
|
-
*/
|
|
20
|
-
declare function filterPluginByFileId<TContext extends Context = Context>(context: TContext, fileId: string): BabelTransformPluginFilter;
|
|
21
|
-
/**
|
|
22
|
-
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
23
|
-
*
|
|
24
|
-
* @param context - The context in which the plugin is being added.
|
|
25
|
-
* @param plugins - The Babel plugins to add the filter to.
|
|
26
|
-
* @param filter - The filter function to apply to the plugins.
|
|
27
|
-
* @param name - The name of the plugin to add the filter to.
|
|
28
|
-
* @returns The updated list of Babel plugins with the filter applied.
|
|
29
|
-
*/
|
|
30
|
-
declare function addPluginFilter(context: Context, plugins: BabelTransformPluginOptions[], filter: BabelTransformPluginFilter | null | undefined, name: string): BabelTransformPluginOptions[];
|
|
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 plugin - The Babel plugin to add the filter to.
|
|
36
|
-
* @param filter - The filter function to apply to the plugin.
|
|
37
|
-
* @returns The updated Babel plugin with the filter applied.
|
|
38
|
-
*/
|
|
39
|
-
declare function addPluginFilter(context: Context, plugin: BabelTransformPlugin | BabelTransformPluginOptions, filter: NonNullable<BabelTransformPluginFilter>): BabelTransformPluginOptions;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { isDuplicatePlugin as i, filterPluginByFileId as n, getPluginName as r, addPluginFilter as t };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { i as BabelTransformPluginOptions, r as BabelTransformPluginFilter, s as ResolvedBabelTransformPluginOptions, t as BabelTransformPlugin, u as Context } from "./babel-DTaio8BX.mjs";
|
|
2
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
-
import { UnpluginOptions } from "unplugin";
|
|
4
|
-
import { ArrayValues } from "@stryke/types/array";
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/filters.d.ts
|
|
7
|
-
declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
10
|
-
*
|
|
11
|
-
* @param plugins - The list of existing Babel plugins.
|
|
12
|
-
* @param plugin - The Babel plugin to check for duplicates.
|
|
13
|
-
* @returns True if the plugin is a duplicate, false otherwise.
|
|
14
|
-
*/
|
|
15
|
-
declare function isDuplicatePlugin(plugins: (ResolvedBabelTransformPluginOptions | undefined)[], plugin: BabelTransformPluginOptions): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Filters a Babel plugin by its runtime ID.
|
|
18
|
-
*
|
|
19
|
-
* @param context - The context in which the filter is applied.
|
|
20
|
-
* @param fileId - The file ID to filter by.
|
|
21
|
-
* @returns A filter function that checks if a plugin's ID matches the runtime ID.
|
|
22
|
-
*/
|
|
23
|
-
declare function filterPluginByFileId<TContext extends Context = Context>(context: TContext, fileId: string): BabelTransformPluginFilter;
|
|
24
|
-
/**
|
|
25
|
-
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The context in which the plugin is being added.
|
|
28
|
-
* @param plugins - The Babel plugins to add the filter to.
|
|
29
|
-
* @param filter - The filter function to apply to the plugins.
|
|
30
|
-
* @param name - The name of the plugin to add the filter to.
|
|
31
|
-
* @returns The updated list of Babel plugins with the filter applied.
|
|
32
|
-
*/
|
|
33
|
-
declare function addPluginFilter(context: Context, plugins: BabelTransformPluginOptions[], filter: BabelTransformPluginFilter | null | undefined, name: string): BabelTransformPluginOptions[];
|
|
34
|
-
/**
|
|
35
|
-
* Adds a filter to a Babel plugin or a list of Babel plugins.
|
|
36
|
-
*
|
|
37
|
-
* @param context - The context in which the plugin is being added.
|
|
38
|
-
* @param plugin - The Babel plugin to add the filter to.
|
|
39
|
-
* @param filter - The filter function to apply to the plugin.
|
|
40
|
-
* @returns The updated Babel plugin with the filter applied.
|
|
41
|
-
*/
|
|
42
|
-
declare function addPluginFilter(context: Context, plugin: BabelTransformPlugin | BabelTransformPluginOptions, filter: NonNullable<BabelTransformPluginFilter>): BabelTransformPluginOptions;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { isDuplicatePlugin as i, filterPluginByFileId as n, getPluginName as r, addPluginFilter as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isFunction as e}from"@stryke/type-checks/is-function";import{isObject as t}from"@stryke/type-checks/is-object";import{isSetString as n}from"@stryke/type-checks/is-set-string";function r(e){return n(e)?e:Array.isArray(e)&&e.length>0?r(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function i(e,t){return!!(r(t)&&e.some(e=>Array.isArray(e)&&r(e[0])===r(t)))}function a(e,t){return(n,r)=>t!==r&&e.fs.ids[t]!==r&&t!==e.fs.ids[r]&&e.fs.ids[t]!==e.fs.ids[r]}function o(i,a,s,c){if(!Array.isArray(a)||!a.some(e=>Array.isArray(e))&&a.length<4&&a.length>0&&(n(a[0])||e(a[0])||a.length>1&&t(a[1])||a.length>2&&t(a[2])))return Array.isArray(a)?[a[0],a.length>1?a[1]:{},{filter:(t,n)=>s(t,n)&&(a.length<2||!e(a[2])||a[2]?.(t,n))}]:[a,{},{filter:s}];if(!c)throw Error("No name was provided to `addPluginFilter`, could not find babel plugin without it.");let l=a.findIndex(e=>r(e)?.toLowerCase()===c.toLowerCase());return l>-1&&(a[l]=o(i,a[l],s,c)),a}export{i,a as n,r,o as t};
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { o as ImportSpecifier } from "./babel-ChnxDnEW.cjs";
|
|
2
|
-
import { ParseResult } from "@babel/parser";
|
|
3
|
-
import * as t from "@babel/types";
|
|
4
|
-
import { NodePath } from "@babel/core";
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/module-helpers.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Finds an export in the given Babel AST program by its key.
|
|
10
|
-
*
|
|
11
|
-
* @param ast - The parsed Babel AST result containing the program body.
|
|
12
|
-
* @param key - The name of the export to find (e.g., "default" or a named export).
|
|
13
|
-
* @returns The declaration of the export if found, otherwise undefined.
|
|
14
|
-
*/
|
|
15
|
-
declare function findExport(ast: ParseResult<t.File>, key: string): any;
|
|
16
|
-
/**
|
|
17
|
-
* Lists all exports from the given Babel AST program.
|
|
18
|
-
*
|
|
19
|
-
* @param codeOrAst - The parsed Babel AST result containing the program body.
|
|
20
|
-
* @returns An array of export names, including "default" for default exports.
|
|
21
|
-
*/
|
|
22
|
-
declare function listExports(codeOrAst: ParseResult<t.File> | string): string[];
|
|
23
|
-
/**
|
|
24
|
-
* Lists all imports from the given Babel AST program.
|
|
25
|
-
*
|
|
26
|
-
* @param ast - The parsed Babel AST result containing the program body.
|
|
27
|
-
* @returns An array of import names, including "default" for default imports.
|
|
28
|
-
*/
|
|
29
|
-
declare function listImports(ast: ParseResult<t.File> | t.File): string[];
|
|
30
|
-
declare function isImportCall(calleePath: NodePath<t.CallExpression | t.NewExpression>): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Gets the import declaration for a given name and specifier.
|
|
33
|
-
*
|
|
34
|
-
* @param specifier - The specifier of the import.
|
|
35
|
-
* @param name - The name of the import.
|
|
36
|
-
* @param named - Optional named import.
|
|
37
|
-
* @returns The import declaration.
|
|
38
|
-
*/
|
|
39
|
-
declare function getImport(specifier: string, name: string, named?: string): t.ImportDeclaration;
|
|
40
|
-
/**
|
|
41
|
-
* Adds an import to the program if it doesn't already exist.
|
|
42
|
-
*
|
|
43
|
-
* @param path - The current NodePath in the AST.
|
|
44
|
-
* @param specifier - The import specifier.
|
|
45
|
-
*/
|
|
46
|
-
declare function addImport(path: NodePath<any>, specifier: ImportSpecifier): void;
|
|
47
|
-
declare function addImportsToProgram(path: NodePath<t.Program>, specifier: ImportSpecifier): void;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { isImportCall as a, getImport as i, addImportsToProgram as n, listExports as o, findExport as r, listImports as s, addImport as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./ast-utils-BXgehtOj.cjs`);let n=require(`@babel/types`);n=e.t(n);let r=require(`@stryke/type-checks/is-string`);function i(e,t){let n=t===`default`?`ExportDefaultDeclaration`:`ExportNamedDeclaration`;for(let r of e.program.body)if(r.type===n){if(t===`default`)return r.declaration;if(r.declaration&&`declarations`in r.declaration){let e=r.declaration.declarations[0];if(e&&`name`in e.id&&e.id.name===t)return e.init}}}function a(e){return((0,r.isString)(e)?t.n(e):e).program.body.flatMap(e=>e.type===`ExportDefaultDeclaration`?[`default`]:e.type===`ExportNamedDeclaration`&&e.declaration&&`declarations`in e.declaration?e.declaration.declarations.map(e=>`name`in e.id?e.id.name:``):[]).filter(Boolean)}function o(e){return e.program.body.flatMap(e=>e.type===`ImportDeclaration`?e.specifiers.map(e=>e.type===`ImportDefaultSpecifier`?`default`:e.type===`ImportSpecifier`&&`imported`in e?e.imported.type===`Identifier`?e.imported.name:e.imported.value:``):[]).filter(Boolean)}function s(e){return n.isImport(e.node.callee)}function c(e,t,r){return n.importDeclaration([n.importSpecifier(n.identifier(t),n.stringLiteral(r||t))],n.stringLiteral(e))}function l(e,t){f(e.scope.getProgramParent().path,t)}function u(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function d(e){let t=new Map;return e.traverse({ImportDeclaration(e){u(e)&&t.set(e.node.source.value,e)}}),t}function f(e,t){d(e).get(t.module)||e.unshiftContainer(`body`,n.importDeclaration([n.importSpecifier(n.identifier(t.name||t.imported),n.identifier(t.imported))],n.stringLiteral(t.module)))}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./ast-utils-QwV5Hp9M.mjs";import*as t from"@babel/types";import{isString as n}from"@stryke/type-checks/is-string";function r(e,t){let n=t===`default`?`ExportDefaultDeclaration`:`ExportNamedDeclaration`;for(let r of e.program.body)if(r.type===n){if(t===`default`)return r.declaration;if(r.declaration&&`declarations`in r.declaration){let e=r.declaration.declarations[0];if(e&&`name`in e.id&&e.id.name===t)return e.init}}}function i(t){return(n(t)?e(t):t).program.body.flatMap(e=>e.type===`ExportDefaultDeclaration`?[`default`]:e.type===`ExportNamedDeclaration`&&e.declaration&&`declarations`in e.declaration?e.declaration.declarations.map(e=>`name`in e.id?e.id.name:``):[]).filter(Boolean)}function a(e){return e.program.body.flatMap(e=>e.type===`ImportDeclaration`?e.specifiers.map(e=>e.type===`ImportDefaultSpecifier`?`default`:e.type===`ImportSpecifier`&&`imported`in e?e.imported.type===`Identifier`?e.imported.name:e.imported.value:``):[]).filter(Boolean)}function o(e){return t.isImport(e.node.callee)}function s(e,n,r){return t.importDeclaration([t.importSpecifier(t.identifier(n),t.stringLiteral(r||n))],t.stringLiteral(e))}function c(e,t){d(e.scope.getProgramParent().path,t)}function l(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function u(e){let t=new Map;return e.traverse({ImportDeclaration(e){l(e)&&t.set(e.node.source.value,e)}}),t}function d(e,n){u(e).get(n.module)||e.unshiftContainer(`body`,t.importDeclaration([t.importSpecifier(t.identifier(n.name||n.imported),t.identifier(n.imported))],t.stringLiteral(n.module)))}export{o as a,s as i,d as n,i as o,r,a as s,c as t};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { o as ImportSpecifier } from "./babel-DTaio8BX.mjs";
|
|
2
|
-
import { NodePath } from "@babel/core";
|
|
3
|
-
import { ParseResult } from "@babel/parser";
|
|
4
|
-
import * as t from "@babel/types";
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/module-helpers.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Finds an export in the given Babel AST program by its key.
|
|
10
|
-
*
|
|
11
|
-
* @param ast - The parsed Babel AST result containing the program body.
|
|
12
|
-
* @param key - The name of the export to find (e.g., "default" or a named export).
|
|
13
|
-
* @returns The declaration of the export if found, otherwise undefined.
|
|
14
|
-
*/
|
|
15
|
-
declare function findExport(ast: ParseResult<t.File>, key: string): any;
|
|
16
|
-
/**
|
|
17
|
-
* Lists all exports from the given Babel AST program.
|
|
18
|
-
*
|
|
19
|
-
* @param codeOrAst - The parsed Babel AST result containing the program body.
|
|
20
|
-
* @returns An array of export names, including "default" for default exports.
|
|
21
|
-
*/
|
|
22
|
-
declare function listExports(codeOrAst: ParseResult<t.File> | string): string[];
|
|
23
|
-
/**
|
|
24
|
-
* Lists all imports from the given Babel AST program.
|
|
25
|
-
*
|
|
26
|
-
* @param ast - The parsed Babel AST result containing the program body.
|
|
27
|
-
* @returns An array of import names, including "default" for default imports.
|
|
28
|
-
*/
|
|
29
|
-
declare function listImports(ast: ParseResult<t.File> | t.File): string[];
|
|
30
|
-
declare function isImportCall(calleePath: NodePath<t.CallExpression | t.NewExpression>): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Gets the import declaration for a given name and specifier.
|
|
33
|
-
*
|
|
34
|
-
* @param specifier - The specifier of the import.
|
|
35
|
-
* @param name - The name of the import.
|
|
36
|
-
* @param named - Optional named import.
|
|
37
|
-
* @returns The import declaration.
|
|
38
|
-
*/
|
|
39
|
-
declare function getImport(specifier: string, name: string, named?: string): t.ImportDeclaration;
|
|
40
|
-
/**
|
|
41
|
-
* Adds an import to the program if it doesn't already exist.
|
|
42
|
-
*
|
|
43
|
-
* @param path - The current NodePath in the AST.
|
|
44
|
-
* @param specifier - The import specifier.
|
|
45
|
-
*/
|
|
46
|
-
declare function addImport(path: NodePath<any>, specifier: ImportSpecifier): void;
|
|
47
|
-
declare function addImportsToProgram(path: NodePath<t.Program>, specifier: ImportSpecifier): void;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { isImportCall as a, getImport as i, addImportsToProgram as n, listExports as o, findExport as r, listImports as s, addImport as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { i as BabelTransformPluginOptions, s as ResolvedBabelTransformPluginOptions, u as Context } from "./babel-ChnxDnEW.cjs";
|
|
2
|
-
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/options.d.ts
|
|
5
|
-
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
6
|
-
/**
|
|
7
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context for the transformation.
|
|
10
|
-
* @param code - The code to be transformed.
|
|
11
|
-
* @param id - The ID of the source file.
|
|
12
|
-
* @param plugin - The Babel plugin to resolve.
|
|
13
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
14
|
-
*/
|
|
15
|
-
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { resolvePluginFunction as n, resolveBabelPlugin as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./filters-H7GHqM8L.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import{isFunction as n}from"@stryke/type-checks/is-function";import r from"chalk";function i(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?n(t[0])?t[0](e):t[0]:n(t)?t(e):t}catch{return t[0]}}function a(a,o,s,c){if(Array.isArray(c)&&c.length>0&&c[0]){if(c.length>2&&c[2]&&n(c[2])&&!c[2](o,s)){a.log(t.TRACE,`Skipping filtered Babel plugin ${r.bold.cyanBright(e(c)||`unnamed`)} for ${s}`);return}return c.length>2?[i(a,c),c[1],c[2]]:[i(a,c),c[1],null]}return[i(a,c),{},null]}export{i as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./filters-DJgM_YqO.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`@stryke/type-checks/is-function`),i=require(`chalk`);i=e.t(i);function a(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?(0,r.isFunction)(t[0])?t[0](e):t[0]:(0,r.isFunction)(t)?t(e):t}catch{return t[0]}}function o(e,o,s,c){if(Array.isArray(c)&&c.length>0&&c[0]){if(c.length>2&&c[2]&&(0,r.isFunction)(c[2])&&!c[2](o,s)){e.log(n.LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${i.default.bold.cyanBright(t.r(c)||`unnamed`)} for ${s}`);return}return c.length>2?[a(e,c),c[1],c[2]]:[a(e,c),c[1],null]}return[a(e,c),{},null]}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { i as BabelTransformPluginOptions, s as ResolvedBabelTransformPluginOptions, u as Context } from "./babel-DTaio8BX.mjs";
|
|
2
|
-
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/options.d.ts
|
|
5
|
-
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
6
|
-
/**
|
|
7
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context for the transformation.
|
|
10
|
-
* @param code - The code to be transformed.
|
|
11
|
-
* @param id - The ID of the source file.
|
|
12
|
-
* @param plugin - The Babel plugin to resolve.
|
|
13
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
14
|
-
*/
|
|
15
|
-
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { resolvePluginFunction as n, resolveBabelPlugin as t };
|
package/dist/plugin-BSBH78mm.cjs
DELETED
|
File without changes
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { c as BabelUserConfig, d as PluginContext, l as UserConfig, m as ResolvedConfig, p as BabelResolvedConfig } from "./babel-ChnxDnEW.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/types/plugin.d.ts
|
|
4
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
5
|
-
type BabelPluginUserConfig = UserConfig;
|
|
6
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
7
|
-
transform: {
|
|
8
|
-
babel: BabelResolvedConfig;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
12
|
-
declare type __ΩBabelPluginOptions = any[];
|
|
13
|
-
declare type __ΩBabelPluginUserConfig = any[];
|
|
14
|
-
declare type __ΩBabelPluginResolvedConfig = any[];
|
|
15
|
-
declare type __ΩBabelPluginContext = any[];
|
|
16
|
-
//#endregion
|
|
17
|
-
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 };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { c as BabelUserConfig, d as PluginContext, l as UserConfig, m as ResolvedConfig, p as BabelResolvedConfig } from "./babel-DTaio8BX.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/types/plugin.d.ts
|
|
4
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
5
|
-
type BabelPluginUserConfig = UserConfig;
|
|
6
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
7
|
-
transform: {
|
|
8
|
-
babel: BabelResolvedConfig;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
12
|
-
declare type __ΩBabelPluginOptions = any[];
|
|
13
|
-
declare type __ΩBabelPluginUserConfig = any[];
|
|
14
|
-
declare type __ΩBabelPluginResolvedConfig = any[];
|
|
15
|
-
declare type __ΩBabelPluginContext = any[];
|
|
16
|
-
//#endregion
|
|
17
|
-
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 };
|
package/dist/plugin-CpyJWCZI.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
package/dist/types-CKPddlfS.cjs
DELETED
|
File without changes
|
package/dist/types-cM7ObqRe.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|