@powerlines/plugin-babel 0.12.241 → 0.12.242
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/helpers/create-plugin.cjs +2 -2
- package/dist/helpers/create-plugin.d.cts +2 -2
- package/dist/helpers/create-plugin.d.mts +2 -2
- package/dist/helpers/create-plugin.mjs +1 -1
- package/dist/helpers/filters.d.cts +2 -2
- package/dist/helpers/filters.d.mts +2 -3
- package/dist/helpers/module-helpers.d.cts +1 -1
- package/dist/helpers/module-helpers.d.mts +1 -1
- package/dist/helpers/options.d.cts +2 -2
- package/dist/helpers/options.d.mts +2 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +1 -1
- package/dist/types/plugin.d.cts +3 -3
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +3 -3
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
- package/dist/powerlines/src/lib/logger.cjs +0 -41
- package/dist/powerlines/src/lib/logger.mjs +0 -39
- package/dist/powerlines/src/types/api.d.cts +0 -104
- package/dist/powerlines/src/types/api.d.mts +0 -104
- package/dist/powerlines/src/types/babel.d.cts +0 -50
- package/dist/powerlines/src/types/babel.d.mts +0 -50
- package/dist/powerlines/src/types/build.d.cts +0 -185
- package/dist/powerlines/src/types/build.d.mts +0 -185
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -435
- package/dist/powerlines/src/types/config.d.mts +0 -435
- package/dist/powerlines/src/types/context.d.cts +0 -514
- package/dist/powerlines/src/types/context.d.mts +0 -514
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.cts +0 -32
- package/dist/powerlines/src/types/hooks.d.mts +0 -32
- package/dist/powerlines/src/types/index.d.mts +0 -12
- package/dist/powerlines/src/types/plugin.d.cts +0 -205
- package/dist/powerlines/src/types/plugin.d.mts +0 -205
- package/dist/powerlines/src/types/resolved.d.cts +0 -94
- package/dist/powerlines/src/types/resolved.d.mts +0 -94
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
- package/dist/powerlines/src/types/unplugin.d.cts +0 -22
- package/dist/powerlines/src/types/unplugin.d.mts +0 -23
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_logger = require('../powerlines/src/lib/logger.cjs');
|
|
3
2
|
let chalk = require("chalk");
|
|
4
3
|
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
5
4
|
let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
|
|
6
5
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
+
let powerlines_lib_logger = require("powerlines/lib/logger");
|
|
7
7
|
|
|
8
8
|
//#region src/helpers/create-plugin.ts
|
|
9
9
|
/**
|
|
@@ -18,7 +18,7 @@ function createBabelPlugin(name, builder) {
|
|
|
18
18
|
return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
|
|
19
19
|
api.cache.using(() => context.meta.checksum);
|
|
20
20
|
api.assertVersion("^7.0.0-0");
|
|
21
|
-
const log =
|
|
21
|
+
const log = (0, powerlines_lib_logger.extendLog)(context.log, name);
|
|
22
22
|
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
23
23
|
const result = builder({
|
|
24
24
|
log,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BabelTransformPluginBuilder, DeclareBabelTransformPluginReturn } from "powerlines/types/babel";
|
|
2
|
+
import { Context } from "powerlines/types/context";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/create-plugin.d.ts
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BabelTransformPluginBuilder, DeclareBabelTransformPluginReturn } from "powerlines/types/babel";
|
|
2
|
+
import { Context } from "powerlines/types/context";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/create-plugin.d.ts
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { extendLog } from "../powerlines/src/lib/logger.mjs";
|
|
2
1
|
import chalk from "chalk";
|
|
3
2
|
import { declare } from "@babel/helper-plugin-utils";
|
|
4
3
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
4
|
+
import { extendLog } from "powerlines/lib/logger";
|
|
5
5
|
|
|
6
6
|
//#region src/helpers/create-plugin.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "powerlines/types/babel";
|
|
2
|
+
import { Context } from "powerlines/types";
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/filters.d.ts
|
|
5
5
|
declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../powerlines/src/types/index.mjs";
|
|
1
|
+
import { BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "powerlines/types/babel";
|
|
2
|
+
import { Context } from "powerlines/types";
|
|
4
3
|
|
|
5
4
|
//#region src/helpers/filters.d.ts
|
|
6
5
|
declare function getPluginName(plugin: BabelTransformPluginOptions): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ImportSpecifier } from "../powerlines/src/types/babel.cjs";
|
|
2
1
|
import { ParseResult } from "@babel/parser";
|
|
3
2
|
import * as t from "@babel/types";
|
|
3
|
+
import { ImportSpecifier } from "powerlines/types/babel";
|
|
4
4
|
import { NodePath } from "@babel/core";
|
|
5
5
|
|
|
6
6
|
//#region src/helpers/module-helpers.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ImportSpecifier } from "../powerlines/src/types/babel.mjs";
|
|
2
1
|
import { NodePath } from "@babel/core";
|
|
3
2
|
import { ParseResult } from "@babel/parser";
|
|
4
3
|
import * as t from "@babel/types";
|
|
4
|
+
import { ImportSpecifier } from "powerlines/types/babel";
|
|
5
5
|
|
|
6
6
|
//#region src/helpers/module-helpers.d.ts
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "powerlines/types/babel";
|
|
2
|
+
import { Context } from "powerlines/types/context";
|
|
3
3
|
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/options.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Context } from "../powerlines/src/types/context.mjs";
|
|
2
|
-
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "../powerlines/src/types/babel.mjs";
|
|
3
1
|
import { PluginOptions, PluginTarget } from "@babel/core";
|
|
2
|
+
import { BabelTransformPluginOptions, ResolvedBabelTransformPluginOptions } from "powerlines/types/babel";
|
|
3
|
+
import { Context } from "powerlines/types/context";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/options.d.ts
|
|
6
6
|
declare function resolvePluginFunction(context: Context, plugin: any | PluginTarget | any[] | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]): BabelTransformPluginOptions;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./helpers/ast-utils.cjs";
|
|
2
|
-
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
3
2
|
import { createBabelPlugin } from "./helpers/create-plugin.cjs";
|
|
4
3
|
import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./helpers/filters.cjs";
|
|
5
4
|
import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./helpers/module-helpers.cjs";
|
|
6
5
|
import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.cjs";
|
|
6
|
+
import "./helpers/index.cjs";
|
|
7
7
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./types/plugin.cjs";
|
|
8
|
+
import "./types/index.cjs";
|
|
9
|
+
import { Plugin } from "powerlines/types/plugin";
|
|
8
10
|
|
|
9
11
|
//#region src/index.d.ts
|
|
10
|
-
|
|
11
12
|
/**
|
|
12
13
|
* Babel plugin for Powerlines.
|
|
13
14
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GenerateFromAstOptions, GeneratorResult, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./helpers/ast-utils.mjs";
|
|
2
|
-
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
3
2
|
import { createBabelPlugin } from "./helpers/create-plugin.mjs";
|
|
4
3
|
import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./helpers/filters.mjs";
|
|
5
4
|
import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./helpers/module-helpers.mjs";
|
|
@@ -7,6 +6,7 @@ import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.mjs
|
|
|
7
6
|
import "./helpers/index.mjs";
|
|
8
7
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./types/plugin.mjs";
|
|
9
8
|
import "./types/index.mjs";
|
|
9
|
+
import { Plugin } from "powerlines/types/plugin";
|
|
10
10
|
|
|
11
11
|
//#region src/index.d.ts
|
|
12
12
|
/**
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { PluginContext } from "powerlines/types/context";
|
|
2
|
+
import { BabelUserConfig, UserConfig } from "powerlines/types/config";
|
|
3
|
+
import { BabelResolvedConfig, ResolvedConfig } from "powerlines/types/resolved";
|
|
4
4
|
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
6
|
type BabelPluginOptions = Partial<BabelUserConfig>;
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { PluginContext } from "powerlines/types/context";
|
|
2
|
+
import { BabelUserConfig, UserConfig } from "powerlines/types/config";
|
|
3
|
+
import { BabelResolvedConfig, ResolvedConfig } from "powerlines/types/resolved";
|
|
4
4
|
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
6
|
type BabelPluginOptions = Partial<BabelUserConfig>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-babel",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.242",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"powerlines": "^0.38.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
105
|
+
"@powerlines/plugin-plugin": "^0.12.184",
|
|
106
106
|
"@types/node": "^24.10.9"
|
|
107
107
|
},
|
|
108
108
|
"publishConfig": {
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"./package.json": "./package.json"
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "8a8bee34b0195608f4e45380ea3bcf33b9da18d7"
|
|
148
148
|
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { SelectHooksOptions } from "../../types/context.cjs";
|
|
2
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
-
|
|
4
|
-
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
5
|
-
type CallHookOptions = SelectHooksOptions & (({
|
|
6
|
-
/**
|
|
7
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue true
|
|
10
|
-
*/
|
|
11
|
-
sequential?: true;
|
|
12
|
-
} & ({
|
|
13
|
-
/**
|
|
14
|
-
* How to handle multiple return values from hooks.
|
|
15
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
16
|
-
* - "first": Return the first non-undefined value.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Merging only works if the return values are objects.
|
|
20
|
-
*
|
|
21
|
-
* @defaultValue "merge"
|
|
22
|
-
*/
|
|
23
|
-
result: "first";
|
|
24
|
-
} | {
|
|
25
|
-
/**
|
|
26
|
-
* How to handle multiple return values from hooks.
|
|
27
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
28
|
-
* - "first": Return the first non-undefined value.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Merging only works if the return values are objects.
|
|
32
|
-
*
|
|
33
|
-
* @defaultValue "merge"
|
|
34
|
-
*/
|
|
35
|
-
result?: "merge" | "last";
|
|
36
|
-
/**
|
|
37
|
-
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
38
|
-
*/
|
|
39
|
-
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
40
|
-
})) | {
|
|
41
|
-
/**
|
|
42
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
43
|
-
*/
|
|
44
|
-
sequential: false;
|
|
45
|
-
});
|
|
46
|
-
//#endregion
|
|
47
|
-
export { CallHookOptions };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import "../../types/resolved.mjs";
|
|
2
|
-
import "../../types/hooks.mjs";
|
|
3
|
-
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
4
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
-
|
|
6
|
-
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
7
|
-
type CallHookOptions = SelectHooksOptions & (({
|
|
8
|
-
/**
|
|
9
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue true
|
|
12
|
-
*/
|
|
13
|
-
sequential?: true;
|
|
14
|
-
} & ({
|
|
15
|
-
/**
|
|
16
|
-
* How to handle multiple return values from hooks.
|
|
17
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
18
|
-
* - "first": Return the first non-undefined value.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Merging only works if the return values are objects.
|
|
22
|
-
*
|
|
23
|
-
* @defaultValue "merge"
|
|
24
|
-
*/
|
|
25
|
-
result: "first";
|
|
26
|
-
} | {
|
|
27
|
-
/**
|
|
28
|
-
* How to handle multiple return values from hooks.
|
|
29
|
-
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
30
|
-
* - "first": Return the first non-undefined value.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Merging only works if the return values are objects.
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue "merge"
|
|
36
|
-
*/
|
|
37
|
-
result?: "merge" | "last";
|
|
38
|
-
/**
|
|
39
|
-
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
40
|
-
*/
|
|
41
|
-
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
42
|
-
})) | {
|
|
43
|
-
/**
|
|
44
|
-
* Whether to call the hooks sequentially or in parallel.
|
|
45
|
-
*/
|
|
46
|
-
sequential: false;
|
|
47
|
-
});
|
|
48
|
-
//#endregion
|
|
49
|
-
export { CallHookOptions };
|
|
@@ -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 __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
|
-
require("@storm-software/config-tools/logger");
|
|
6
|
-
require("@storm-software/config-tools/utilities/colors");
|
|
7
|
-
require("@stryke/helpers/noop");
|
|
8
|
-
require("@stryke/string-format/kebab-case");
|
|
9
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
-
|
|
11
|
-
//#region ../powerlines/src/lib/logger.ts
|
|
12
|
-
const BADGE_COLORS = [
|
|
13
|
-
"#00A0DD",
|
|
14
|
-
"#6FCE4E",
|
|
15
|
-
"#FBBF24",
|
|
16
|
-
"#F43F5E",
|
|
17
|
-
"#3B82F6",
|
|
18
|
-
"#A855F7",
|
|
19
|
-
"#469592",
|
|
20
|
-
"#288EDF",
|
|
21
|
-
"#D8B4FE",
|
|
22
|
-
"#10B981",
|
|
23
|
-
"#EF4444",
|
|
24
|
-
"#F0EC56",
|
|
25
|
-
"#F472B6",
|
|
26
|
-
"#22D3EE",
|
|
27
|
-
"#EAB308",
|
|
28
|
-
"#84CC16",
|
|
29
|
-
"#F87171",
|
|
30
|
-
"#0EA5E9",
|
|
31
|
-
"#D946EF",
|
|
32
|
-
"#FACC15",
|
|
33
|
-
"#34D399",
|
|
34
|
-
"#8B5CF6"
|
|
35
|
-
];
|
|
36
|
-
const extendLog = (logFn, name) => {
|
|
37
|
-
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
exports.extendLog = extendLog;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
-
import "@storm-software/config-tools/logger";
|
|
4
|
-
import "@storm-software/config-tools/utilities/colors";
|
|
5
|
-
import "@stryke/helpers/noop";
|
|
6
|
-
import "@stryke/string-format/kebab-case";
|
|
7
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
-
|
|
9
|
-
//#region ../powerlines/src/lib/logger.ts
|
|
10
|
-
const BADGE_COLORS = [
|
|
11
|
-
"#00A0DD",
|
|
12
|
-
"#6FCE4E",
|
|
13
|
-
"#FBBF24",
|
|
14
|
-
"#F43F5E",
|
|
15
|
-
"#3B82F6",
|
|
16
|
-
"#A855F7",
|
|
17
|
-
"#469592",
|
|
18
|
-
"#288EDF",
|
|
19
|
-
"#D8B4FE",
|
|
20
|
-
"#10B981",
|
|
21
|
-
"#EF4444",
|
|
22
|
-
"#F0EC56",
|
|
23
|
-
"#F472B6",
|
|
24
|
-
"#22D3EE",
|
|
25
|
-
"#EAB308",
|
|
26
|
-
"#84CC16",
|
|
27
|
-
"#F87171",
|
|
28
|
-
"#0EA5E9",
|
|
29
|
-
"#D946EF",
|
|
30
|
-
"#FACC15",
|
|
31
|
-
"#34D399",
|
|
32
|
-
"#8B5CF6"
|
|
33
|
-
];
|
|
34
|
-
const extendLog = (logFn, name) => {
|
|
35
|
-
return (type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { extendLog };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from "./resolved.cjs";
|
|
2
|
-
import { CallHookOptions } from "../internal/helpers/hooks.cjs";
|
|
3
|
-
import { InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
4
|
-
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
5
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
6
|
-
|
|
7
|
-
//#region ../powerlines/src/types/api.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Powerlines API Interface
|
|
11
|
-
*/
|
|
12
|
-
interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
13
|
-
/**
|
|
14
|
-
* The Powerlines shared API context
|
|
15
|
-
*/
|
|
16
|
-
context: APIContext<TResolvedConfig>;
|
|
17
|
-
/**
|
|
18
|
-
* Prepare the Powerlines API
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
22
|
-
*
|
|
23
|
-
* @param inlineConfig - The inline configuration for the prepare command
|
|
24
|
-
*/
|
|
25
|
-
prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new Powerlines project
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* This method will create a new Powerlines project in the current directory.
|
|
31
|
-
*
|
|
32
|
-
* @param inlineConfig - The inline configuration for the new command
|
|
33
|
-
* @returns A promise that resolves when the project has been created
|
|
34
|
-
*/
|
|
35
|
-
new: (inlineConfig: NewInlineConfig) => Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Clean any previously prepared artifacts
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* This method will remove the previous Powerlines artifacts from the project.
|
|
41
|
-
*
|
|
42
|
-
* @param inlineConfig - The inline configuration for the clean command
|
|
43
|
-
* @returns A promise that resolves when the clean command has completed
|
|
44
|
-
*/
|
|
45
|
-
clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Lint the project source code
|
|
48
|
-
*
|
|
49
|
-
* @param inlineConfig - The inline configuration for the lint command
|
|
50
|
-
* @returns A promise that resolves when the lint command has completed
|
|
51
|
-
*/
|
|
52
|
-
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Build the project
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
58
|
-
*
|
|
59
|
-
* @param inlineConfig - The inline configuration for the build command
|
|
60
|
-
* @returns A promise that resolves when the build command has completed
|
|
61
|
-
*/
|
|
62
|
-
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Prepare the documentation for the project
|
|
65
|
-
*
|
|
66
|
-
* @param inlineConfig - The inline configuration for the docs command
|
|
67
|
-
* @returns A promise that resolves when the documentation generation has completed
|
|
68
|
-
*/
|
|
69
|
-
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Deploy the project source code
|
|
72
|
-
*
|
|
73
|
-
* @remarks
|
|
74
|
-
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
75
|
-
*
|
|
76
|
-
* @param inlineConfig - The inline configuration for the deploy command
|
|
77
|
-
*/
|
|
78
|
-
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Finalization process
|
|
81
|
-
*
|
|
82
|
-
* @remarks
|
|
83
|
-
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
84
|
-
*
|
|
85
|
-
* @returns A promise that resolves when the finalization process has completed
|
|
86
|
-
*/
|
|
87
|
-
finalize: () => Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Invokes the configured plugin hooks
|
|
90
|
-
*
|
|
91
|
-
* @remarks
|
|
92
|
-
* By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
|
|
93
|
-
*
|
|
94
|
-
* @param hook - The hook to call
|
|
95
|
-
* @param options - The options to provide to the hook
|
|
96
|
-
* @param args - The arguments to pass to the hook
|
|
97
|
-
* @returns The result of the hook call
|
|
98
|
-
*/
|
|
99
|
-
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
|
-
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
|
-
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { API };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from "./resolved.mjs";
|
|
2
|
-
import { CallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
3
|
-
import { InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
4
|
-
import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
|
|
5
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
6
|
-
|
|
7
|
-
//#region ../powerlines/src/types/api.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Powerlines API Interface
|
|
11
|
-
*/
|
|
12
|
-
interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
13
|
-
/**
|
|
14
|
-
* The Powerlines shared API context
|
|
15
|
-
*/
|
|
16
|
-
context: APIContext<TResolvedConfig>;
|
|
17
|
-
/**
|
|
18
|
-
* Prepare the Powerlines API
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
22
|
-
*
|
|
23
|
-
* @param inlineConfig - The inline configuration for the prepare command
|
|
24
|
-
*/
|
|
25
|
-
prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new Powerlines project
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* This method will create a new Powerlines project in the current directory.
|
|
31
|
-
*
|
|
32
|
-
* @param inlineConfig - The inline configuration for the new command
|
|
33
|
-
* @returns A promise that resolves when the project has been created
|
|
34
|
-
*/
|
|
35
|
-
new: (inlineConfig: NewInlineConfig) => Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Clean any previously prepared artifacts
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* This method will remove the previous Powerlines artifacts from the project.
|
|
41
|
-
*
|
|
42
|
-
* @param inlineConfig - The inline configuration for the clean command
|
|
43
|
-
* @returns A promise that resolves when the clean command has completed
|
|
44
|
-
*/
|
|
45
|
-
clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Lint the project source code
|
|
48
|
-
*
|
|
49
|
-
* @param inlineConfig - The inline configuration for the lint command
|
|
50
|
-
* @returns A promise that resolves when the lint command has completed
|
|
51
|
-
*/
|
|
52
|
-
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Build the project
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
58
|
-
*
|
|
59
|
-
* @param inlineConfig - The inline configuration for the build command
|
|
60
|
-
* @returns A promise that resolves when the build command has completed
|
|
61
|
-
*/
|
|
62
|
-
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Prepare the documentation for the project
|
|
65
|
-
*
|
|
66
|
-
* @param inlineConfig - The inline configuration for the docs command
|
|
67
|
-
* @returns A promise that resolves when the documentation generation has completed
|
|
68
|
-
*/
|
|
69
|
-
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Deploy the project source code
|
|
72
|
-
*
|
|
73
|
-
* @remarks
|
|
74
|
-
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
75
|
-
*
|
|
76
|
-
* @param inlineConfig - The inline configuration for the deploy command
|
|
77
|
-
*/
|
|
78
|
-
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Finalization process
|
|
81
|
-
*
|
|
82
|
-
* @remarks
|
|
83
|
-
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
84
|
-
*
|
|
85
|
-
* @returns A promise that resolves when the finalization process has completed
|
|
86
|
-
*/
|
|
87
|
-
finalize: () => Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Invokes the configured plugin hooks
|
|
90
|
-
*
|
|
91
|
-
* @remarks
|
|
92
|
-
* By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
|
|
93
|
-
*
|
|
94
|
-
* @param hook - The hook to call
|
|
95
|
-
* @param options - The options to provide to the hook
|
|
96
|
-
* @param args - The arguments to pass to the hook
|
|
97
|
-
* @returns The result of the hook call
|
|
98
|
-
*/
|
|
99
|
-
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
|
-
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
|
-
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { API };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Context } from "./context.cjs";
|
|
2
|
-
import { LogFn } from "./config.cjs";
|
|
3
|
-
import { PluginItem, PluginObj, PluginPass } from "@babel/core";
|
|
4
|
-
import { BabelAPI } from "@babel/helper-plugin-utils";
|
|
5
|
-
|
|
6
|
-
//#region ../powerlines/src/types/babel.d.ts
|
|
7
|
-
|
|
8
|
-
type BabelPluginPass<TState = unknown> = PluginPass & TState;
|
|
9
|
-
type BabelTransformPluginFilter = (code: string, id: string) => boolean;
|
|
10
|
-
type BabelTransformPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = ((context: TContext) => (options: {
|
|
11
|
-
name: string;
|
|
12
|
-
log: LogFn;
|
|
13
|
-
api: BabelAPI;
|
|
14
|
-
options: TOptions;
|
|
15
|
-
context: TContext;
|
|
16
|
-
dirname: string;
|
|
17
|
-
}) => PluginObj<TOptions & BabelPluginPass<TState>>) & {
|
|
18
|
-
$$name: string;
|
|
19
|
-
};
|
|
20
|
-
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];
|
|
21
|
-
type ResolvedBabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter | null];
|
|
22
|
-
interface BabelTransformPluginBuilderParams<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>> {
|
|
23
|
-
name: string;
|
|
24
|
-
log: LogFn;
|
|
25
|
-
api: BabelAPI;
|
|
26
|
-
options: TOptions;
|
|
27
|
-
context: TContext;
|
|
28
|
-
dirname: string;
|
|
29
|
-
}
|
|
30
|
-
type BabelTransformPluginBuilder<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = (params: BabelTransformPluginBuilderParams<TContext, TOptions>) => PluginObj<TState & BabelPluginPass<TOptions>>;
|
|
31
|
-
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">>;
|
|
32
|
-
/**
|
|
33
|
-
* A non-local import specifier represents an import that is not defined within the current module.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* import { bar as baz } from 'foo';
|
|
38
|
-
* // { name: 'baz', module: 'foo', imported: 'bar' }
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @remarks
|
|
42
|
-
* 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.
|
|
43
|
-
*/
|
|
44
|
-
interface ImportSpecifier {
|
|
45
|
-
name?: string;
|
|
46
|
-
module: string;
|
|
47
|
-
imported: string;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
export { BabelTransformPlugin, BabelTransformPluginBuilder, BabelTransformPluginFilter, BabelTransformPluginOptions, DeclareBabelTransformPluginReturn, ImportSpecifier, ResolvedBabelTransformPluginOptions };
|