@powerlines/plugin-babel 0.12.303 → 0.12.304
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/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/core/src/lib/logger.cjs +41 -0
- package/dist/core/src/types/api.d.cts +103 -0
- package/dist/core/src/types/api.d.cts.map +1 -0
- package/dist/core/src/types/commands.d.cts +9 -0
- package/dist/core/src/types/commands.d.cts.map +1 -0
- package/dist/core/src/types/config.d.cts +551 -0
- package/dist/core/src/types/config.d.cts.map +1 -0
- package/dist/core/src/types/context.d.cts +511 -0
- package/dist/core/src/types/context.d.cts.map +1 -0
- package/dist/core/src/types/fs.d.cts +487 -0
- package/dist/core/src/types/fs.d.cts.map +1 -0
- package/dist/core/src/types/hooks.d.cts +99 -0
- package/dist/core/src/types/hooks.d.cts.map +1 -0
- package/dist/core/src/types/plugin.d.cts +204 -0
- package/dist/core/src/types/plugin.d.cts.map +1 -0
- package/dist/core/src/types/tsconfig.d.cts +70 -0
- package/dist/core/src/types/tsconfig.d.cts.map +1 -0
- package/dist/core/src/types/unplugin.d.cts +24 -0
- package/dist/core/src/types/unplugin.d.cts.map +1 -0
- package/dist/helpers/ast-utils.cjs +35 -0
- package/dist/helpers/ast-utils.d.cts +20 -0
- package/dist/helpers/ast-utils.d.cts.map +1 -0
- package/dist/helpers/create-plugin.cjs +41 -0
- package/dist/helpers/create-plugin.d.cts +16 -0
- package/dist/helpers/create-plugin.d.cts.map +1 -0
- package/dist/helpers/filters.cjs +59 -0
- package/dist/helpers/filters.d.cts +43 -0
- package/dist/helpers/filters.d.cts.map +1 -0
- package/dist/helpers/index.cjs +22 -0
- package/dist/helpers/index.d.cts +6 -0
- package/dist/helpers/module-helpers.cjs +103 -0
- package/dist/helpers/module-helpers.d.cts +50 -0
- package/dist/helpers/module-helpers.d.cts.map +1 -0
- package/dist/helpers/options.cjs +49 -0
- package/dist/helpers/options.d.cts +19 -0
- package/dist/helpers/options.d.cts.map +1 -0
- package/dist/index.cjs +104 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/types/config.cjs +0 -0
- package/dist/types/config.d.cts +87 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +20 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/package.json +41 -14
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_helpers_ast_utils = require('./ast-utils.cjs');
|
|
3
|
+
let __babel_types = require("@babel/types");
|
|
4
|
+
__babel_types = require_rolldown_runtime.__toESM(__babel_types);
|
|
5
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/module-helpers.ts
|
|
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
|
+
function findExport(ast, key) {
|
|
16
|
+
const type = key === "default" ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
|
|
17
|
+
for (const node of ast.program.body) if (node.type === type) {
|
|
18
|
+
if (key === "default") return node.declaration;
|
|
19
|
+
if (node.declaration && "declarations" in node.declaration) {
|
|
20
|
+
const declaration = node.declaration.declarations[0];
|
|
21
|
+
if (declaration && "name" in declaration.id && declaration.id.name === key) return declaration.init;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Lists all exports from the given Babel AST program.
|
|
27
|
+
*
|
|
28
|
+
* @param codeOrAst - The parsed Babel AST result containing the program body.
|
|
29
|
+
* @returns An array of export names, including "default" for default exports.
|
|
30
|
+
*/
|
|
31
|
+
function listExports(codeOrAst) {
|
|
32
|
+
return ((0, __stryke_type_checks_is_string.isString)(codeOrAst) ? require_helpers_ast_utils.parseAst(codeOrAst) : codeOrAst).program.body.flatMap((i) => {
|
|
33
|
+
if (i.type === "ExportDefaultDeclaration") return ["default"];
|
|
34
|
+
if (i.type === "ExportNamedDeclaration" && i.declaration && "declarations" in i.declaration) return i.declaration.declarations.map((d) => "name" in d.id ? d.id.name : "");
|
|
35
|
+
return [];
|
|
36
|
+
}).filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Lists all imports from the given Babel AST program.
|
|
40
|
+
*
|
|
41
|
+
* @param ast - The parsed Babel AST result containing the program body.
|
|
42
|
+
* @returns An array of import names, including "default" for default imports.
|
|
43
|
+
*/
|
|
44
|
+
function listImports(ast) {
|
|
45
|
+
return ast.program.body.flatMap((i) => {
|
|
46
|
+
if (i.type === "ImportDeclaration") return i.specifiers.map((s) => {
|
|
47
|
+
if (s.type === "ImportDefaultSpecifier") return "default";
|
|
48
|
+
if (s.type === "ImportSpecifier" && "imported" in s) return s.imported.type === "Identifier" ? s.imported.name : s.imported.value;
|
|
49
|
+
return "";
|
|
50
|
+
});
|
|
51
|
+
return [];
|
|
52
|
+
}).filter(Boolean);
|
|
53
|
+
}
|
|
54
|
+
function isImportCall(calleePath) {
|
|
55
|
+
return __babel_types.isImport(calleePath.node.callee);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the import declaration for a given name and specifier.
|
|
59
|
+
*
|
|
60
|
+
* @param specifier - The specifier of the import.
|
|
61
|
+
* @param name - The name of the import.
|
|
62
|
+
* @param named - Optional named import.
|
|
63
|
+
* @returns The import declaration.
|
|
64
|
+
*/
|
|
65
|
+
function getImport(specifier, name, named) {
|
|
66
|
+
return __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(name), __babel_types.stringLiteral(named || name))], __babel_types.stringLiteral(specifier));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Adds an import to the program if it doesn't already exist.
|
|
70
|
+
*
|
|
71
|
+
* @param path - The current NodePath in the AST.
|
|
72
|
+
* @param specifier - The import specifier.
|
|
73
|
+
*/
|
|
74
|
+
function addImport(path, specifier) {
|
|
75
|
+
addImportsToProgram(path.scope.getProgramParent().path, specifier);
|
|
76
|
+
}
|
|
77
|
+
function isNonNamespacedImport(importDeclPath) {
|
|
78
|
+
return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
|
|
79
|
+
}
|
|
80
|
+
function getExistingImports(program) {
|
|
81
|
+
const existingImports = /* @__PURE__ */ new Map();
|
|
82
|
+
program.traverse({ ImportDeclaration(path) {
|
|
83
|
+
if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
|
|
84
|
+
} });
|
|
85
|
+
return existingImports;
|
|
86
|
+
}
|
|
87
|
+
function addImportsToProgram(path, specifier) {
|
|
88
|
+
/**
|
|
89
|
+
* If an existing import of this module exists (ie \`import \{ ... \} from
|
|
90
|
+
* '<moduleName>'\`), inject new imported specifiers into the list of
|
|
91
|
+
* destructured variables.
|
|
92
|
+
*/
|
|
93
|
+
if (!getExistingImports(path).get(specifier.module)) path.unshiftContainer("body", __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(specifier.name || specifier.imported), __babel_types.identifier(specifier.imported))], __babel_types.stringLiteral(specifier.module)));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
exports.addImport = addImport;
|
|
98
|
+
exports.addImportsToProgram = addImportsToProgram;
|
|
99
|
+
exports.findExport = findExport;
|
|
100
|
+
exports.getImport = getImport;
|
|
101
|
+
exports.isImportCall = isImportCall;
|
|
102
|
+
exports.listExports = listExports;
|
|
103
|
+
exports.listImports = listImports;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ImportSpecifier } from "../types/config.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 { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports };
|
|
50
|
+
//# sourceMappingURL=module-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-helpers.d.cts","names":[],"sources":["../../src/helpers/module-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAgCA;AA6BA;AA4BA;;;AAAyD,iBAzDzC,UAAA,CAyDyC,GAAA,EAzDzB,WAyDyB,CAzDb,CAAA,CAAE,IAyDW,CAAA,EAAA,GAAA,EAAA,MAAA,CAAA,EAAA,GAAA;;AAsBzD;;;;;AAcgB,iBAhEA,WAAA,CAoEX,SAAA,EApEkC,WAoEjB,CApE6B,CAAA,CAAE,IAoE/B,CAAA,GAAA,MAAA,CAAA,EAAA,MAAA,EAAA;AAatB;AAuCA;;;;;iBA5FgB,WAAA,MAAiB,YAAY,CAAA,CAAE,QAAQ,CAAA,CAAE;iBAsBzC,YAAA,aACF,SAAS,CAAA,CAAE,iBAAiB,CAAA,CAAE;;;;;;;;;iBAa5B,SAAA,mDAIb,CAAA,CAAE;;;;;;;iBAaW,SAAA,OAAgB,0BAA0B;iBAuC1C,mBAAA,OACR,SAAS,CAAA,CAAE,qBACN"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_helpers_filters = require('./filters.cjs');
|
|
3
|
+
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
4
|
+
let chalk = require("chalk");
|
|
5
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/options.ts
|
|
8
|
+
function resolvePluginFunction(context, plugin) {
|
|
9
|
+
try {
|
|
10
|
+
return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? (0, __stryke_type_checks_is_function.isFunction)(plugin[0]) ? plugin[0](context) : plugin[0] : (0, __stryke_type_checks_is_function.isFunction)(plugin) ? plugin(context) : plugin;
|
|
11
|
+
} catch {
|
|
12
|
+
return plugin[0];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The context for the transformation.
|
|
19
|
+
* @param code - The code to be transformed.
|
|
20
|
+
* @param id - The ID of the source file.
|
|
21
|
+
* @param plugin - The Babel plugin to resolve.
|
|
22
|
+
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
23
|
+
*/
|
|
24
|
+
function resolveBabelPlugin(context, code, id, plugin) {
|
|
25
|
+
if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
|
|
26
|
+
if (plugin.length > 2 && plugin[2] && (0, __stryke_type_checks_is_function.isFunction)(plugin[2]) && !plugin[2](code, id)) {
|
|
27
|
+
context.trace(`Skipping filtered Babel plugin ${chalk.default.bold.cyanBright(require_helpers_filters.getPluginName(plugin) || "unnamed")} for ${id}`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return plugin.length > 2 ? [
|
|
31
|
+
resolvePluginFunction(context, plugin),
|
|
32
|
+
plugin[1],
|
|
33
|
+
plugin[2]
|
|
34
|
+
] : [
|
|
35
|
+
resolvePluginFunction(context, plugin),
|
|
36
|
+
plugin[1],
|
|
37
|
+
null
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
resolvePluginFunction(context, plugin),
|
|
42
|
+
{},
|
|
43
|
+
null
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.resolveBabelPlugin = resolveBabelPlugin;
|
|
49
|
+
exports.resolvePluginFunction = resolvePluginFunction;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "../core/src/types/context.cjs";
|
|
2
|
+
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "../types/config.cjs";
|
|
3
|
+
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/options.d.ts
|
|
6
|
+
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The context for the transformation.
|
|
11
|
+
* @param code - The code to be transformed.
|
|
12
|
+
* @param id - The ID of the source file.
|
|
13
|
+
* @param plugin - The Babel plugin to resolve.
|
|
14
|
+
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
15
|
+
*/
|
|
16
|
+
declare function resolveBabelPlugin(context: Context, code: string, id: string, plugin: BabelTransformPluginOptions): ResolvedBabelTransformPluginOptions | undefined;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { resolveBabelPlugin, resolvePluginFunction };
|
|
19
|
+
//# sourceMappingURL=options.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.cts","names":[],"sources":["../../src/helpers/options.ts"],"sourcesContent":[],"mappings":";;;;;iBA4BgB,qBAAA,UACL,uBAGL,wBAEC,cAAc,kBACd,cAAc,qCAClB;;AARH;;;;;;;;AAQ8B,iBAuBd,kBAAA,CAvBc,OAAA,EAwBnB,OAxBmB,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,MAAA,EAAA,MAAA,EA2BpB,2BA3BoB,CAAA,EA4B3B,mCA5B2B,GAAA,SAAA"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_helpers_filters = require('./helpers/filters.cjs');
|
|
4
|
+
const require_helpers_options = require('./helpers/options.cjs');
|
|
5
|
+
const require_helpers_ast_utils = require('./helpers/ast-utils.cjs');
|
|
6
|
+
const require_helpers_create_plugin = require('./helpers/create-plugin.cjs');
|
|
7
|
+
const require_helpers_module_helpers = require('./helpers/module-helpers.cjs');
|
|
8
|
+
require('./helpers/index.cjs');
|
|
9
|
+
let __babel_core = require("@babel/core");
|
|
10
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
11
|
+
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
12
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
15
|
+
|
|
16
|
+
//#region src/index.ts
|
|
17
|
+
/**
|
|
18
|
+
* Babel plugin for Powerlines.
|
|
19
|
+
*
|
|
20
|
+
* @param options - The Babel plugin user configuration options.
|
|
21
|
+
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
22
|
+
*/
|
|
23
|
+
const plugin = (options = {}) => {
|
|
24
|
+
return {
|
|
25
|
+
name: "babel",
|
|
26
|
+
config() {
|
|
27
|
+
if (!(0, __stryke_type_checks_is_set_object.isSetObject)(options)) return;
|
|
28
|
+
return { babel: options };
|
|
29
|
+
},
|
|
30
|
+
configResolved: {
|
|
31
|
+
order: "pre",
|
|
32
|
+
handler() {
|
|
33
|
+
this.config.babel = (0, defu.default)(this.config.babel ?? {}, {
|
|
34
|
+
plugins: [],
|
|
35
|
+
presets: []
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async transform(code, id) {
|
|
40
|
+
if ((0, __stryke_path_is_parent_path.isParentPath)(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
|
|
41
|
+
this.trace(`Skipping Babel transformation for: ${id}`);
|
|
42
|
+
return {
|
|
43
|
+
code,
|
|
44
|
+
id
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const plugins = this.config.babel.plugins.map((plugin$1) => require_helpers_options.resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !require_helpers_filters.isDuplicatePlugin(arr, plugin$1));
|
|
48
|
+
const presets = this.config.babel.presets.map((preset) => require_helpers_options.resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !require_helpers_filters.isDuplicatePlugin(arr, preset));
|
|
49
|
+
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
50
|
+
code,
|
|
51
|
+
id
|
|
52
|
+
};
|
|
53
|
+
if (/^(?:m|c)?tsx?$/.test((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true })) && !require_helpers_filters.isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !require_helpers_filters.isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === "tsx" }]);
|
|
54
|
+
this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
|
|
55
|
+
const result = await (0, __babel_core.transformAsync)(code, {
|
|
56
|
+
highlightCode: true,
|
|
57
|
+
code: true,
|
|
58
|
+
ast: false,
|
|
59
|
+
cloneInputAst: false,
|
|
60
|
+
comments: true,
|
|
61
|
+
sourceType: "module",
|
|
62
|
+
configFile: false,
|
|
63
|
+
babelrc: false,
|
|
64
|
+
envName: this.config.mode,
|
|
65
|
+
caller: { name: this.config.framework },
|
|
66
|
+
...this.config.babel ?? {},
|
|
67
|
+
filename: id,
|
|
68
|
+
plugins: plugins.map((plugin$1) => {
|
|
69
|
+
return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], (0, defu.default)(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
|
|
70
|
+
}).filter(Boolean),
|
|
71
|
+
presets: presets.map((preset) => {
|
|
72
|
+
return Array.isArray(preset) && preset.length >= 2 ? [preset[0], (0, defu.default)(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
|
|
73
|
+
}).filter(Boolean)
|
|
74
|
+
});
|
|
75
|
+
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
76
|
+
this.trace(`Completed babel transformations for file: ${id}`);
|
|
77
|
+
return {
|
|
78
|
+
code: result.code,
|
|
79
|
+
id
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
var src_default = plugin;
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
exports.addImport = require_helpers_module_helpers.addImport;
|
|
88
|
+
exports.addImportsToProgram = require_helpers_module_helpers.addImportsToProgram;
|
|
89
|
+
exports.addPluginFilter = require_helpers_filters.addPluginFilter;
|
|
90
|
+
exports.createBabelPlugin = require_helpers_create_plugin.createBabelPlugin;
|
|
91
|
+
exports.default = src_default;
|
|
92
|
+
exports.filterPluginByFileId = require_helpers_filters.filterPluginByFileId;
|
|
93
|
+
exports.findExport = require_helpers_module_helpers.findExport;
|
|
94
|
+
exports.generateFromAst = require_helpers_ast_utils.generateFromAst;
|
|
95
|
+
exports.getImport = require_helpers_module_helpers.getImport;
|
|
96
|
+
exports.getPluginName = require_helpers_filters.getPluginName;
|
|
97
|
+
exports.isDuplicatePlugin = require_helpers_filters.isDuplicatePlugin;
|
|
98
|
+
exports.isImportCall = require_helpers_module_helpers.isImportCall;
|
|
99
|
+
exports.listExports = require_helpers_module_helpers.listExports;
|
|
100
|
+
exports.listImports = require_helpers_module_helpers.listImports;
|
|
101
|
+
exports.parseAst = require_helpers_ast_utils.parseAst;
|
|
102
|
+
exports.plugin = plugin;
|
|
103
|
+
exports.resolveBabelPlugin = require_helpers_options.resolveBabelPlugin;
|
|
104
|
+
exports.resolvePluginFunction = require_helpers_options.resolvePluginFunction;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./helpers/ast-utils.cjs";
|
|
2
|
+
import { Plugin } from "./core/src/types/plugin.cjs";
|
|
3
|
+
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 "./types/config.cjs";
|
|
4
|
+
import { createBabelPlugin } from "./helpers/create-plugin.cjs";
|
|
5
|
+
import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./helpers/filters.cjs";
|
|
6
|
+
import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./helpers/module-helpers.cjs";
|
|
7
|
+
import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.cjs";
|
|
8
|
+
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./types/plugin.cjs";
|
|
9
|
+
|
|
10
|
+
//#region src/index.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Babel plugin for Powerlines.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The Babel plugin user configuration options.
|
|
15
|
+
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
16
|
+
*/
|
|
17
|
+
declare const plugin: <TContext extends BabelPluginContext = BabelPluginContext>(options?: BabelPluginOptions) => Plugin<TContext>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BabelPluginContext, BabelPluginOptions, BabelPluginPass, BabelPluginResolvedConfig, BabelPluginUserConfig, BabelResolvedConfig, BabelTransformInput, BabelTransformPlugin, BabelTransformPluginBuilder, BabelTransformPluginBuilderParams, BabelTransformPluginFilter, BabelTransformPluginOptions, BabelUserConfig, DeclareBabelTransformPluginReturn, DefaultImportDefinition, GenerateFromAstOptions, GeneratorResult, ImportDefinition, ImportSpecifier, NamedImportDefinition, ResolvedBabelTransformPluginOptions, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginPass, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig, __ΩBabelResolvedConfig, __ΩBabelTransformInput, __ΩBabelTransformPlugin, __ΩBabelTransformPluginBuilder, __ΩBabelTransformPluginBuilderParams, __ΩBabelTransformPluginFilter, __ΩBabelTransformPluginOptions, __ΩBabelUserConfig, __ΩDeclareBabelTransformPluginReturn, __ΩDefaultImportDefinition, __ΩGenerateFromAstOptions, __ΩImportDefinition, __ΩImportSpecifier, __ΩNamedImportDefinition, __ΩResolvedBabelTransformPluginOptions, addImport, addImportsToProgram, addPluginFilter, createBabelPlugin, plugin as default, plugin, filterPluginByFileId, findExport, generateFromAst, getImport, getPluginName, isDuplicatePlugin, isImportCall, listExports, listImports, parseAst, resolveBabelPlugin, resolvePluginFunction };
|
|
20
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;AAyCa,cAAA,MA8HZ,EAAA,CAAA,iBA7HkB,kBA6HlB,GA7HuC,kBA6HvC,CAAA,CAAA,OAAA,CAAA,EA3HU,kBA2HV,EAAA,GA1HE,MA0HF,CA1HS,QA0HT,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Context } from "../core/src/types/context.cjs";
|
|
2
|
+
import { LogFn } from "../core/src/types/config.cjs";
|
|
3
|
+
import { PluginItem, PluginObj, PluginPass, TransformOptions, transformAsync } from "@babel/core";
|
|
4
|
+
import { BabelAPI } from "@babel/helper-plugin-utils";
|
|
5
|
+
|
|
6
|
+
//#region src/types/config.d.ts
|
|
7
|
+
interface NamedImportDefinition {
|
|
8
|
+
name: string;
|
|
9
|
+
source: string;
|
|
10
|
+
kind: "named";
|
|
11
|
+
}
|
|
12
|
+
interface DefaultImportDefinition {
|
|
13
|
+
source: string;
|
|
14
|
+
kind: "default";
|
|
15
|
+
}
|
|
16
|
+
type ImportDefinition = NamedImportDefinition | DefaultImportDefinition;
|
|
17
|
+
type BabelPluginPass<TState = unknown> = PluginPass & TState;
|
|
18
|
+
type BabelTransformPluginFilter = (code: string, id: string) => boolean;
|
|
19
|
+
type BabelTransformPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = ((context: TContext) => (options: {
|
|
20
|
+
name: string;
|
|
21
|
+
log: LogFn;
|
|
22
|
+
api: BabelAPI;
|
|
23
|
+
options: TOptions;
|
|
24
|
+
context: TContext;
|
|
25
|
+
dirname: string;
|
|
26
|
+
}) => PluginObj<TOptions & BabelPluginPass<TState>>) & {
|
|
27
|
+
$$name: string;
|
|
28
|
+
};
|
|
29
|
+
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];
|
|
30
|
+
type ResolvedBabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter | null];
|
|
31
|
+
type BabelTransformInput = Omit<TransformOptions & Required<Pick<TransformOptions, "presets" | "plugins">>, "filename" | "root" | "sourceFileName" | "sourceMaps" | "inputSourceMap">;
|
|
32
|
+
interface BabelTransformPluginBuilderParams<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>> {
|
|
33
|
+
name: string;
|
|
34
|
+
log: LogFn;
|
|
35
|
+
api: BabelAPI;
|
|
36
|
+
options: TOptions;
|
|
37
|
+
context: TContext;
|
|
38
|
+
dirname: string;
|
|
39
|
+
}
|
|
40
|
+
type BabelTransformPluginBuilder<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = (params: BabelTransformPluginBuilderParams<TContext, TOptions>) => PluginObj<TState & BabelPluginPass<TOptions>>;
|
|
41
|
+
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">>;
|
|
42
|
+
/**
|
|
43
|
+
* A non-local import specifier represents an import that is not defined within the current module.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { bar as baz } from 'foo';
|
|
48
|
+
* // { name: 'baz', module: 'foo', imported: 'bar' }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* 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.
|
|
53
|
+
*/
|
|
54
|
+
interface ImportSpecifier {
|
|
55
|
+
name?: string;
|
|
56
|
+
module: string;
|
|
57
|
+
imported: string;
|
|
58
|
+
}
|
|
59
|
+
type BabelUserConfig = Parameters<typeof transformAsync>[1] & {
|
|
60
|
+
/**
|
|
61
|
+
* The Babel plugins to be used during the build process
|
|
62
|
+
*/
|
|
63
|
+
plugins?: BabelTransformPluginOptions[];
|
|
64
|
+
/**
|
|
65
|
+
* The Babel presets to be used during the build process
|
|
66
|
+
*/
|
|
67
|
+
presets?: BabelTransformPluginOptions[];
|
|
68
|
+
};
|
|
69
|
+
type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
|
|
70
|
+
declare type __ΩNamedImportDefinition = any[];
|
|
71
|
+
declare type __ΩDefaultImportDefinition = any[];
|
|
72
|
+
declare type __ΩImportDefinition = any[];
|
|
73
|
+
declare type __ΩBabelPluginPass = any[];
|
|
74
|
+
declare type __ΩBabelTransformPluginFilter = any[];
|
|
75
|
+
declare type __ΩBabelTransformPlugin = any[];
|
|
76
|
+
declare type __ΩBabelTransformPluginOptions = any[];
|
|
77
|
+
declare type __ΩResolvedBabelTransformPluginOptions = any[];
|
|
78
|
+
declare type __ΩBabelTransformInput = any[];
|
|
79
|
+
declare type __ΩBabelTransformPluginBuilderParams = any[];
|
|
80
|
+
declare type __ΩBabelTransformPluginBuilder = any[];
|
|
81
|
+
declare type __ΩDeclareBabelTransformPluginReturn = any[];
|
|
82
|
+
declare type __ΩImportSpecifier = any[];
|
|
83
|
+
declare type __ΩBabelUserConfig = any[];
|
|
84
|
+
declare type __ΩBabelResolvedConfig = any[];
|
|
85
|
+
//#endregion
|
|
86
|
+
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 };
|
|
87
|
+
//# sourceMappingURL=config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":"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"}
|
|
File without changes
|
|
@@ -0,0 +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.cjs";
|
|
2
|
+
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./plugin.cjs";
|
|
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 };
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PluginContext } from "../core/src/types/context.cjs";
|
|
2
|
+
import { ResolvedConfig, UserConfig } from "../core/src/types/config.cjs";
|
|
3
|
+
import { BabelResolvedConfig, BabelUserConfig } from "./config.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/types/plugin.d.ts
|
|
6
|
+
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
+
type BabelPluginUserConfig = UserConfig & {
|
|
8
|
+
babel?: BabelPluginOptions;
|
|
9
|
+
};
|
|
10
|
+
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
11
|
+
babel: BabelResolvedConfig;
|
|
12
|
+
}
|
|
13
|
+
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
|
+
declare type __ΩBabelPluginOptions = any[];
|
|
15
|
+
declare type __ΩBabelPluginUserConfig = any[];
|
|
16
|
+
declare type __ΩBabelPluginResolvedConfig = any[];
|
|
17
|
+
declare type __ΩBabelPluginContext = any[];
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig };
|
|
20
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAyBY,kBAAA,GAAqB,QAAQ;KAE7B,qBAAA,GAAwB;UAC1B;AAHV,CAAA;AAEY,UAIK,yBAAA,SAAkC,cAHzC,CAAA;EAGO,KAAA,EACR,mBADQ;AAIjB;AAC0B,KADd,kBACc,CAAA,wBAAA,yBAAA,GAA4B,yBAA5B,CAAA,GACtB,aADsB,CACR,eADQ,CAAA;AAA4B,qCAAA,GAAA,EAAA;AACpC,wCAAA,GAAA,EAAA;AAAd,4CAAA,GAAA,EAAA;AAAa,qCAAA,GAAA,EAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-babel",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.304",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": ["babel", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -40,21 +40,48 @@
|
|
|
40
40
|
],
|
|
41
41
|
"type": "module",
|
|
42
42
|
"exports": {
|
|
43
|
-
".": "./dist/index.mjs",
|
|
44
|
-
"./helpers":
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"./helpers/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"./
|
|
43
|
+
".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
|
|
44
|
+
"./helpers": {
|
|
45
|
+
"require": "./dist/helpers/index.cjs",
|
|
46
|
+
"import": "./dist/helpers/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./helpers/ast-utils": {
|
|
49
|
+
"require": "./dist/helpers/ast-utils.cjs",
|
|
50
|
+
"import": "./dist/helpers/ast-utils.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./helpers/create-plugin": {
|
|
53
|
+
"require": "./dist/helpers/create-plugin.cjs",
|
|
54
|
+
"import": "./dist/helpers/create-plugin.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./helpers/filters": {
|
|
57
|
+
"require": "./dist/helpers/filters.cjs",
|
|
58
|
+
"import": "./dist/helpers/filters.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./helpers/module-helpers": {
|
|
61
|
+
"require": "./dist/helpers/module-helpers.cjs",
|
|
62
|
+
"import": "./dist/helpers/module-helpers.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./helpers/options": {
|
|
65
|
+
"require": "./dist/helpers/options.cjs",
|
|
66
|
+
"import": "./dist/helpers/options.mjs"
|
|
67
|
+
},
|
|
68
|
+
"./types": {
|
|
69
|
+
"require": "./dist/types/index.cjs",
|
|
70
|
+
"import": "./dist/types/index.mjs"
|
|
71
|
+
},
|
|
72
|
+
"./types/config": {
|
|
73
|
+
"require": "./dist/types/config.cjs",
|
|
74
|
+
"import": "./dist/types/config.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./types/plugin": {
|
|
77
|
+
"require": "./dist/types/plugin.cjs",
|
|
78
|
+
"import": "./dist/types/plugin.mjs"
|
|
79
|
+
},
|
|
53
80
|
"./*": "./*"
|
|
54
81
|
},
|
|
55
|
-
"main": "./dist/index.
|
|
82
|
+
"main": "./dist/index.cjs",
|
|
56
83
|
"module": "./dist/index.mjs",
|
|
57
|
-
"types": "./dist/index.d.
|
|
84
|
+
"types": "./dist/index.d.cts",
|
|
58
85
|
"typings": "dist/index.d.mts",
|
|
59
86
|
"files": ["dist/**/*"],
|
|
60
87
|
"dependencies": {
|
|
@@ -120,5 +147,5 @@
|
|
|
120
147
|
"./package.json": "./package.json"
|
|
121
148
|
}
|
|
122
149
|
},
|
|
123
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "b4932f4bf2a6f97dd535eb6a05219db5722d4462"
|
|
124
151
|
}
|