@vef-framework/dev 2.0.4 → 2.0.5
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/bin/vef.js +1 -1
- package/dist/cjs/index.cjs +1 -23
- package/dist/cjs/lint/commitlint.cjs +1 -14
- package/dist/cjs/lint/eslint.cjs +1 -981
- package/dist/cjs/lint/index.cjs +1 -14
- package/dist/cjs/lint/stylelint.cjs +1 -93
- package/dist/cjs/vite/chunks.cjs +1 -30
- package/dist/cjs/vite/config.cjs +1 -83
- package/dist/cjs/vite/constants.cjs +1 -30
- package/dist/cjs/vite/define.cjs +3 -18
- package/dist/cjs/vite/index.cjs +1 -11
- package/dist/cjs/vite/plugin-app-config.cjs +1 -38
- package/dist/cjs/vite/plugin-auto-enhance/core.cjs +1 -147
- package/dist/cjs/vite/plugin-auto-enhance/index.cjs +1 -40
- package/dist/cjs/vite/plugin-auto-enhance/plugins/index.cjs +1 -10
- package/dist/cjs/vite/plugin-auto-enhance/plugins/operation-column-width.cjs +1 -229
- package/dist/cjs/vite/plugin-conventional-config.cjs +1 -91
- package/dist/cjs/vite/plugin-eslint.cjs +1 -24
- package/dist/cjs/vite/plugin-html.cjs +2 -74
- package/dist/cjs/vite/plugin-icons.cjs +1 -22
- package/dist/cjs/vite/plugin-injection.cjs +1 -20
- package/dist/cjs/vite/plugin-inspect.cjs +1 -15
- package/dist/cjs/vite/plugin-react.cjs +1 -80
- package/dist/cjs/vite/plugin-router.cjs +4 -42
- package/dist/cjs/vite/plugin-stylelint.cjs +1 -24
- package/dist/cjs/vite/plugin-svgr.cjs +1 -59
- package/dist/cjs/vite/plugin-tsconfig-paths.cjs +1 -14
- package/dist/cjs/vite/postcss.cjs +1 -13
- package/dist/cli/index.js +5 -0
- package/dist/es/index.js +14 -8
- package/dist/es/lint/commitlint.js +5 -6
- package/dist/es/lint/eslint.js +135 -137
- package/dist/es/lint/index.js +8 -4
- package/dist/es/lint/stylelint.js +16 -19
- package/dist/es/vite/chunks.js +12 -18
- package/dist/es/vite/config.js +63 -68
- package/dist/es/vite/constants.js +15 -15
- package/dist/es/vite/define.js +10 -11
- package/dist/es/vite/index.js +5 -3
- package/dist/es/vite/plugin-app-config.js +19 -20
- package/dist/es/vite/plugin-auto-enhance/core.js +51 -90
- package/dist/es/vite/plugin-auto-enhance/index.js +19 -23
- package/dist/es/vite/plugin-auto-enhance/plugins/index.js +4 -2
- package/dist/es/vite/plugin-auto-enhance/plugins/operation-column-width.js +117 -181
- package/dist/es/vite/plugin-conventional-config.js +42 -44
- package/dist/es/vite/plugin-eslint.js +14 -15
- package/dist/es/vite/plugin-html.js +42 -53
- package/dist/es/vite/plugin-icons.js +10 -11
- package/dist/es/vite/plugin-injection.js +4 -4
- package/dist/es/vite/plugin-inspect.js +8 -9
- package/dist/es/vite/plugin-react.js +25 -35
- package/dist/es/vite/plugin-router.js +20 -21
- package/dist/es/vite/plugin-stylelint.js +14 -15
- package/dist/es/vite/plugin-svgr.js +19 -20
- package/dist/es/vite/plugin-tsconfig-paths.js +7 -8
- package/dist/es/vite/postcss.js +5 -5
- package/package.json +9 -8
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function defineStylelintConfig() {
|
|
1
|
+
import n from "stylelint-config-recess-order/groups";
|
|
2
|
+
function o() {
|
|
5
3
|
return {
|
|
6
4
|
extends: [
|
|
7
5
|
"stylelint-config-standard-scss",
|
|
@@ -19,28 +17,26 @@ function defineStylelintConfig() {
|
|
|
19
17
|
"at-rules",
|
|
20
18
|
"rules"
|
|
21
19
|
],
|
|
22
|
-
"order/properties-order":
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
20
|
+
"order/properties-order": n.map((e) => ({
|
|
21
|
+
...e,
|
|
22
|
+
emptyLineBefore: "never",
|
|
23
|
+
noEmptyLineBetween: !0
|
|
24
|
+
})),
|
|
29
25
|
"declaration-empty-line-before": "never",
|
|
30
26
|
"declaration-property-value-no-unknown": [
|
|
31
|
-
|
|
27
|
+
!0,
|
|
32
28
|
{
|
|
33
29
|
ignoreProperties: {}
|
|
34
30
|
}
|
|
35
31
|
],
|
|
36
32
|
"at-rule-no-unknown": [
|
|
37
|
-
|
|
33
|
+
!0,
|
|
38
34
|
{
|
|
39
35
|
ignoreAtRules: ["extend", "include"]
|
|
40
36
|
}
|
|
41
37
|
],
|
|
42
38
|
"function-no-unknown": [
|
|
43
|
-
|
|
39
|
+
!0,
|
|
44
40
|
{
|
|
45
41
|
ignoreFunctions: []
|
|
46
42
|
}
|
|
@@ -65,19 +61,19 @@ function defineStylelintConfig() {
|
|
|
65
61
|
"s"
|
|
66
62
|
],
|
|
67
63
|
"selector-pseudo-class-no-unknown": [
|
|
68
|
-
|
|
64
|
+
!0,
|
|
69
65
|
{
|
|
70
66
|
ignorePseudoClasses: ["global"]
|
|
71
67
|
}
|
|
72
68
|
],
|
|
73
69
|
"scss/function-no-unknown": [
|
|
74
|
-
|
|
70
|
+
!0,
|
|
75
71
|
{
|
|
76
72
|
ignoreFunctions: []
|
|
77
73
|
}
|
|
78
74
|
],
|
|
79
75
|
"scss/at-rule-no-unknown": [
|
|
80
|
-
|
|
76
|
+
!0,
|
|
81
77
|
{
|
|
82
78
|
ignoreAtRules: []
|
|
83
79
|
}
|
|
@@ -85,5 +81,6 @@ function defineStylelintConfig() {
|
|
|
85
81
|
}
|
|
86
82
|
};
|
|
87
83
|
}
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
export {
|
|
85
|
+
o as defineStylelintConfig
|
|
86
|
+
};
|
package/dist/es/vite/chunks.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (id.includes("node_modules/@vef-framework/")) {
|
|
1
|
+
function n(e) {
|
|
2
|
+
if (e.includes("node_modules/@vef-framework/"))
|
|
4
3
|
return "vef-framework";
|
|
5
|
-
|
|
6
|
-
if (id.includes("node_modules/lucide-react/")) {
|
|
4
|
+
if (e.includes("node_modules/lucide-react/"))
|
|
7
5
|
return "lucide-icons";
|
|
8
|
-
|
|
9
|
-
if (id.includes("node_modules/react/") || id.includes("node_modules/react-dom/") || id.includes("node_modules/scheduler/")) {
|
|
6
|
+
if (e.includes("node_modules/react/") || e.includes("node_modules/react-dom/") || e.includes("node_modules/scheduler/"))
|
|
10
7
|
return "react";
|
|
11
|
-
|
|
12
|
-
if (id.includes("node_modules/@tanstack/")) {
|
|
8
|
+
if (e.includes("node_modules/@tanstack/"))
|
|
13
9
|
return "tanstack";
|
|
14
|
-
|
|
15
|
-
if (id.includes("node_modules/pinyin-pro/") || id.includes("node_modules/@pinyin-pro/")) {
|
|
10
|
+
if (e.includes("node_modules/pinyin-pro/") || e.includes("node_modules/@pinyin-pro/"))
|
|
16
11
|
return "pinyin-vendor";
|
|
17
|
-
|
|
18
|
-
if (id.includes("node_modules/echarts/")) {
|
|
12
|
+
if (e.includes("node_modules/echarts/"))
|
|
19
13
|
return "echarts";
|
|
20
|
-
}
|
|
21
14
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
15
|
+
function u() {
|
|
16
|
+
return n;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
export {
|
|
19
|
+
u as createChunksConfig
|
|
20
|
+
};
|
package/dist/es/vite/config.js
CHANGED
|
@@ -1,79 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
react,
|
|
29
|
-
proxies
|
|
1
|
+
import { resolve as l } from "node:path";
|
|
2
|
+
import f from "node:process";
|
|
3
|
+
import s from "consola";
|
|
4
|
+
import u from "fs-extra";
|
|
5
|
+
import { defineConfig as P, loadEnv as g } from "vite";
|
|
6
|
+
import { ENV_DIR as _, ENV_BUILD_PREFIX as E } from "./constants.js";
|
|
7
|
+
import { createAppConfigPlugin as I } from "./plugin-app-config.js";
|
|
8
|
+
import { createAutoEnhancePlugin as V } from "./plugin-auto-enhance/index.js";
|
|
9
|
+
import { createConventionalConfigPlugin as D } from "./plugin-conventional-config.js";
|
|
10
|
+
import { createEslintPlugin as U } from "./plugin-eslint.js";
|
|
11
|
+
import { createHtmlPlugin as v } from "./plugin-html.js";
|
|
12
|
+
import { createIconsPlugin as A } from "./plugin-icons.js";
|
|
13
|
+
import { createInjectionPlugin as B } from "./plugin-injection.js";
|
|
14
|
+
import { createInspectPlugin as b } from "./plugin-inspect.js";
|
|
15
|
+
import { createReactPlugin as d } from "./plugin-react.js";
|
|
16
|
+
import { createRouterPlugin as L } from "./plugin-router.js";
|
|
17
|
+
import { createStylelintPlugin as R } from "./plugin-stylelint.js";
|
|
18
|
+
import { createSvgrPlugin as C } from "./plugin-svgr.js";
|
|
19
|
+
import { createTsconfigPathsPlugin as F } from "./plugin-tsconfig-paths.js";
|
|
20
|
+
import { operationColumnWidthPlugin as T } from "./plugin-auto-enhance/plugins/operation-column-width.js";
|
|
21
|
+
function $({
|
|
22
|
+
resolve: e,
|
|
23
|
+
plugins: t = [],
|
|
24
|
+
autoEnhancePlugins: i = [],
|
|
25
|
+
routerHistory: n = "browser",
|
|
26
|
+
react: a,
|
|
27
|
+
proxies: m
|
|
30
28
|
} = {}) {
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
console.table(env);
|
|
37
|
-
}
|
|
38
|
-
const appVersion = await getAppVersion(projectDir);
|
|
29
|
+
const r = f.cwd();
|
|
30
|
+
return P(async ({ mode: p }) => {
|
|
31
|
+
const o = g(p, _, E);
|
|
32
|
+
Object.keys(o).length > 0 && (s.info("Loaded environment variables:"), console.table(o));
|
|
33
|
+
const c = await N(r);
|
|
39
34
|
return {
|
|
40
|
-
resolve:
|
|
35
|
+
resolve: e,
|
|
41
36
|
plugins: [
|
|
42
|
-
...
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
appName:
|
|
46
|
-
appVersion,
|
|
47
|
-
projectDir,
|
|
48
|
-
basePublicPath:
|
|
49
|
-
outputDir:
|
|
50
|
-
serverPort: Number(
|
|
51
|
-
proxies
|
|
37
|
+
...t,
|
|
38
|
+
b(),
|
|
39
|
+
D({
|
|
40
|
+
appName: o.VEF_APP_NAME,
|
|
41
|
+
appVersion: c,
|
|
42
|
+
projectDir: r,
|
|
43
|
+
basePublicPath: o.VEF_BUILD_BASE_PUBLIC_PATH,
|
|
44
|
+
outputDir: o.VEF_BUILD_OUTPUT_DIR,
|
|
45
|
+
serverPort: Number(o.VEF_BUILD_SERVER_PORT),
|
|
46
|
+
proxies: m
|
|
52
47
|
}),
|
|
53
|
-
|
|
54
|
-
plugins: [
|
|
48
|
+
V({
|
|
49
|
+
plugins: [T, ...i]
|
|
55
50
|
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
basePublicPath:
|
|
63
|
-
outputDir:
|
|
64
|
-
appName:
|
|
51
|
+
L(r, n),
|
|
52
|
+
d(a),
|
|
53
|
+
F(r),
|
|
54
|
+
v(),
|
|
55
|
+
B(),
|
|
56
|
+
I({
|
|
57
|
+
basePublicPath: o.VEF_BUILD_BASE_PUBLIC_PATH,
|
|
58
|
+
outputDir: o.VEF_BUILD_OUTPUT_DIR,
|
|
59
|
+
appName: o.VEF_APP_NAME
|
|
65
60
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
A(r),
|
|
62
|
+
C(),
|
|
63
|
+
U(),
|
|
64
|
+
R()
|
|
70
65
|
].filter(Boolean)
|
|
71
66
|
};
|
|
72
67
|
});
|
|
73
68
|
}
|
|
74
|
-
async function
|
|
75
|
-
|
|
76
|
-
return packageJson.version;
|
|
69
|
+
async function N(e) {
|
|
70
|
+
return (await u.readJson(l(e, "package.json"), { encoding: "utf-8" })).version;
|
|
77
71
|
}
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
export {
|
|
73
|
+
$ as defineViteConfig
|
|
74
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
const _ = "1.0.0", E = "public", s = "env", R = "assets", t = "VEF_APP_", c = "VEF_BUILD_", o = "src", P = "dist", n = 3833, I = "APP", D = "pages", A = "router";
|
|
2
|
+
export {
|
|
3
|
+
R as ASSETS_DIR,
|
|
4
|
+
I as DEFAULT_APP_NAME,
|
|
5
|
+
P as DEFAULT_OUTPUT_DIR,
|
|
6
|
+
n as DEFAULT_SERVER_PORT,
|
|
7
|
+
t as ENV_APP_PREFIX,
|
|
8
|
+
c as ENV_BUILD_PREFIX,
|
|
9
|
+
s as ENV_DIR,
|
|
10
|
+
D as PAGES_DIR,
|
|
11
|
+
E as PUBLIC_DIR,
|
|
12
|
+
A as ROUTER_DIR,
|
|
13
|
+
o as SRC_DIR,
|
|
14
|
+
_ as VEF_FRAMEWORK_VERSION
|
|
15
|
+
};
|
package/dist/es/vite/define.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function defineConstants(appName, appVersion, isDev) {
|
|
1
|
+
import { DEFAULT_APP_NAME as t, VEF_FRAMEWORK_VERSION as c, ENV_APP_PREFIX as r } from "./constants.js";
|
|
2
|
+
function i(_, e, n) {
|
|
5
3
|
return {
|
|
6
|
-
__VEF_FRAMEWORK_VERSION__: `"${
|
|
7
|
-
__VEF_APP_VERSION__: `"${
|
|
8
|
-
__VEF_APP_CONFIG__:
|
|
4
|
+
__VEF_FRAMEWORK_VERSION__: `"${c}"`,
|
|
5
|
+
__VEF_APP_VERSION__: `"${e}"`,
|
|
6
|
+
__VEF_APP_CONFIG__: n ? `
|
|
9
7
|
(function () {
|
|
10
8
|
const env = import.meta.env;
|
|
11
|
-
const config = Object.keys(env).filter(key => key.startsWith(${JSON.stringify(
|
|
9
|
+
const config = Object.keys(env).filter(key => key.startsWith(${JSON.stringify(r)}))
|
|
12
10
|
.reduce((acc, key) => {
|
|
13
11
|
acc[key] = env[key];
|
|
14
12
|
return acc;
|
|
15
13
|
}, {});
|
|
16
14
|
return Object.freeze(config);
|
|
17
15
|
})()
|
|
18
|
-
` : `window.__PRODUCTION__VEF_${
|
|
16
|
+
` : `window.__PRODUCTION__VEF_${_ ?? t}__CONF__`
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
export {
|
|
20
|
+
i as defineConstants
|
|
21
|
+
};
|
package/dist/es/vite/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { defineViteConfig as f } from "./config.js";
|
|
2
|
+
import "./plugin-auto-enhance/index.js";
|
|
3
|
+
export {
|
|
4
|
+
f as defineViteConfig
|
|
5
|
+
};
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
outputDir,
|
|
9
|
-
appName = DEFAULT_APP_NAME
|
|
1
|
+
import { snake as i } from "radashi";
|
|
2
|
+
import r from "unplugin-config/vite";
|
|
3
|
+
import { ENV_APP_PREFIX as o, DEFAULT_OUTPUT_DIR as p, DEFAULT_APP_NAME as a } from "./constants.js";
|
|
4
|
+
function c({
|
|
5
|
+
basePublicPath: e,
|
|
6
|
+
outputDir: n,
|
|
7
|
+
appName: t = a
|
|
10
8
|
}) {
|
|
11
|
-
return
|
|
12
|
-
appName: `VEF_${
|
|
13
|
-
baseDir:
|
|
9
|
+
return r({
|
|
10
|
+
appName: `VEF_${f(t)}`,
|
|
11
|
+
baseDir: e,
|
|
14
12
|
configFile: {
|
|
15
|
-
generate:
|
|
13
|
+
generate: !0,
|
|
16
14
|
fileName: "app.config.js",
|
|
17
|
-
outputDir:
|
|
15
|
+
outputDir: n ?? p
|
|
18
16
|
},
|
|
19
17
|
htmlInjection: {
|
|
20
|
-
enable:
|
|
18
|
+
enable: !0,
|
|
21
19
|
position: "head-prepend",
|
|
22
20
|
templates: ["index.html"]
|
|
23
21
|
},
|
|
24
22
|
envVariables: {
|
|
25
|
-
prefix:
|
|
23
|
+
prefix: o,
|
|
26
24
|
files: ["env/.env", "env/.env.production"]
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
28
|
+
function f(e) {
|
|
29
|
+
return i(e).toUpperCase();
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
export {
|
|
32
|
+
c as createAppConfigPlugin
|
|
33
|
+
};
|
|
@@ -1,143 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { parse as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function matchesPattern(patterns, target) {
|
|
7
|
-
const patternArray = Array.isArray(patterns) ? patterns : [patterns];
|
|
8
|
-
return patternArray.some((pattern) => {
|
|
9
|
-
if (typeof pattern === "string") {
|
|
10
|
-
return target.includes(pattern);
|
|
11
|
-
}
|
|
12
|
-
return pattern.test(target);
|
|
13
|
-
});
|
|
1
|
+
import { basename as c } from "node:path";
|
|
2
|
+
import { parse as f } from "@babel/parser";
|
|
3
|
+
import { parse as g, print as p } from "recast";
|
|
4
|
+
function a(o, e) {
|
|
5
|
+
return (Array.isArray(o) ? o : [o]).some((r) => typeof r == "string" ? e.includes(r) : r.test(e));
|
|
14
6
|
}
|
|
15
|
-
class
|
|
7
|
+
class d {
|
|
16
8
|
plugins = [];
|
|
17
9
|
options;
|
|
18
|
-
constructor(
|
|
10
|
+
constructor(e = {}) {
|
|
19
11
|
this.options = {
|
|
20
12
|
include: [/\.tsx?(?:\?.*)?$/],
|
|
21
13
|
exclude: [/node_modules/, /\.d\.ts?(?:\?.*)?$/],
|
|
22
14
|
logPrefix: "🚀 VEF Auto-Enhance",
|
|
23
|
-
...
|
|
15
|
+
...e
|
|
24
16
|
};
|
|
25
17
|
}
|
|
26
18
|
/**
|
|
27
19
|
* Register a sub-plugin
|
|
28
20
|
*/
|
|
29
|
-
registerPlugin(
|
|
30
|
-
this.plugins.push(
|
|
21
|
+
registerPlugin(e) {
|
|
22
|
+
this.plugins.push(e);
|
|
31
23
|
}
|
|
32
24
|
/**
|
|
33
25
|
* Register multiple sub-plugins
|
|
34
26
|
*/
|
|
35
|
-
registerPlugins(
|
|
36
|
-
for (const
|
|
37
|
-
this.registerPlugin(
|
|
38
|
-
}
|
|
27
|
+
registerPlugins(e) {
|
|
28
|
+
for (const s of e)
|
|
29
|
+
this.registerPlugin(s);
|
|
39
30
|
}
|
|
40
31
|
/**
|
|
41
32
|
* Check if file should be processed
|
|
42
33
|
*/
|
|
43
|
-
shouldProcessFile(
|
|
44
|
-
const { include, exclude } = this.options;
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (include && !matchesPattern(include, id)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
34
|
+
shouldProcessFile(e) {
|
|
35
|
+
const { include: s, exclude: r } = this.options;
|
|
36
|
+
return !(r && a(r, e) || s && !a(s, e));
|
|
52
37
|
}
|
|
53
38
|
/**
|
|
54
39
|
* Create processing context
|
|
55
40
|
*/
|
|
56
|
-
createTransformationContext(
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
sourceFileName: basename(id),
|
|
41
|
+
createTransformationContext(e, s) {
|
|
42
|
+
const r = e.split("/").slice(-3).join("/"), i = g(s, {
|
|
43
|
+
sourceFileName: c(e),
|
|
60
44
|
parser: {
|
|
61
|
-
parse: (
|
|
45
|
+
parse: (l) => f(l, {
|
|
62
46
|
plugins: ["jsx", "typescript", "explicitResourceManagement"],
|
|
63
47
|
sourceType: "module",
|
|
64
|
-
tokens:
|
|
48
|
+
tokens: !0
|
|
65
49
|
})
|
|
66
50
|
}
|
|
67
51
|
});
|
|
68
52
|
return {
|
|
69
|
-
id,
|
|
70
|
-
fileName,
|
|
71
|
-
code,
|
|
72
|
-
ast
|
|
53
|
+
id: e,
|
|
54
|
+
fileName: r,
|
|
55
|
+
code: s,
|
|
56
|
+
ast: i
|
|
73
57
|
};
|
|
74
58
|
}
|
|
75
59
|
/**
|
|
76
60
|
* Execute transformation
|
|
77
61
|
*/
|
|
78
|
-
transform(
|
|
79
|
-
if (!this.shouldProcessFile(
|
|
62
|
+
transform(e, s) {
|
|
63
|
+
if (!this.shouldProcessFile(s) || this.plugins.length === 0)
|
|
80
64
|
return null;
|
|
81
|
-
}
|
|
82
|
-
if (this.plugins.length === 0) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
65
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
if (plugin.shouldProcess) {
|
|
89
|
-
return plugin.shouldProcess(context);
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
});
|
|
93
|
-
if (activePlugins.length === 0) {
|
|
66
|
+
const r = this.createTransformationContext(s, e), i = this.plugins.filter((t) => t.shouldProcess ? t.shouldProcess(r) : !0);
|
|
67
|
+
if (i.length === 0)
|
|
94
68
|
return null;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
for (const plugin of activePlugins) {
|
|
69
|
+
let l = !1;
|
|
70
|
+
const u = [];
|
|
71
|
+
for (const t of i)
|
|
99
72
|
try {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
if (result.logs) {
|
|
105
|
-
allLogs.push(...result.logs);
|
|
106
|
-
}
|
|
107
|
-
if (result.hasChanges) {
|
|
108
|
-
console.log(`${this.options.logPrefix}: Plugin "${plugin.name}" made changes to ${context.fileName}`);
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.warn(`${this.options.logPrefix}: Plugin "${plugin.name}" failed:`, error);
|
|
73
|
+
const n = t.transform(r);
|
|
74
|
+
n.hasChanges && (l = !0), n.logs && u.push(...n.logs), n.hasChanges && console.log(`${this.options.logPrefix}: Plugin "${t.name}" made changes to ${r.fileName}`);
|
|
75
|
+
} catch (n) {
|
|
76
|
+
console.warn(`${this.options.logPrefix}: Plugin "${t.name}" failed:`, n);
|
|
112
77
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (hasAnyChanges) {
|
|
118
|
-
const result = print(context.ast);
|
|
78
|
+
for (const t of u)
|
|
79
|
+
console.log(t);
|
|
80
|
+
if (l) {
|
|
81
|
+
const t = p(r.ast);
|
|
119
82
|
return {
|
|
120
|
-
code:
|
|
121
|
-
map:
|
|
83
|
+
code: t.code,
|
|
84
|
+
map: t.map || null
|
|
122
85
|
};
|
|
123
86
|
}
|
|
124
87
|
return null;
|
|
125
|
-
} catch (
|
|
126
|
-
console.warn(`${this.options.logPrefix}: Error processing ${
|
|
127
|
-
return null;
|
|
88
|
+
} catch (r) {
|
|
89
|
+
return console.warn(`${this.options.logPrefix}: Error processing ${s}:`, r), null;
|
|
128
90
|
}
|
|
129
91
|
}
|
|
130
92
|
/**
|
|
131
93
|
* Get registered plugin information
|
|
132
94
|
*/
|
|
133
95
|
getRegisteredPlugins() {
|
|
134
|
-
return this.plugins.map((
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
});
|
|
96
|
+
return this.plugins.map((e) => ({
|
|
97
|
+
name: e.name,
|
|
98
|
+
description: e.description
|
|
99
|
+
}));
|
|
140
100
|
}
|
|
141
101
|
}
|
|
142
|
-
|
|
143
|
-
|
|
102
|
+
export {
|
|
103
|
+
d as AutoEnhanceCore
|
|
104
|
+
};
|
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
plugins,
|
|
8
|
-
...options
|
|
1
|
+
import { AutoEnhanceCore as i } from "./core.js";
|
|
2
|
+
import "./plugins/index.js";
|
|
3
|
+
import { types as g } from "recast";
|
|
4
|
+
function a({
|
|
5
|
+
plugins: r,
|
|
6
|
+
...t
|
|
9
7
|
} = {}) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
core.registerPlugins(plugins);
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
8
|
+
const o = new i(t);
|
|
9
|
+
return r && o.registerPlugins(r), {
|
|
15
10
|
name: "vef-framework:auto-enhance",
|
|
16
11
|
enforce: "pre",
|
|
17
12
|
buildStart() {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
console.log(`🚀 Auto-Enhance: Loaded ${
|
|
21
|
-
for (const
|
|
22
|
-
console.log(` • ${
|
|
23
|
-
}
|
|
13
|
+
const e = o.getRegisteredPlugins();
|
|
14
|
+
if (e.length > 0) {
|
|
15
|
+
console.log(`🚀 Auto-Enhance: Loaded ${e.length} plugins:`);
|
|
16
|
+
for (const n of e)
|
|
17
|
+
console.log(` • ${n.name}${n.description ? ` - ${n.description}` : ""}`);
|
|
24
18
|
}
|
|
25
19
|
},
|
|
26
|
-
transform(
|
|
27
|
-
return
|
|
20
|
+
transform(e, n) {
|
|
21
|
+
return o.transform(e, n);
|
|
28
22
|
}
|
|
29
23
|
};
|
|
30
24
|
}
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
export {
|
|
26
|
+
a as createAutoEnhancePlugin,
|
|
27
|
+
g as types
|
|
28
|
+
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { operationColumnWidthPlugin as n } from "./operation-column-width.js";
|
|
2
|
+
export {
|
|
3
|
+
n as operationColumnWidthPlugin
|
|
4
|
+
};
|