@gct-paas/build 0.1.5-dev.9 → 0.1.6-dev.2
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/constants/index.cjs +12 -3
- package/dist/constants/index.d.ts +0 -4
- package/dist/eslint/eslint-config/eslint-config.cjs +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/vite/index.cjs +6 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/vite-config/vite-base-config.cjs +2 -24
- package/dist/vite/vite-config/vite-config.cjs +18 -18
- package/dist/vite/vite-config/vite-config.d.ts +1 -0
- package/dist/vite/vite-config/vite-dev-config.cjs +1 -2
- package/dist/vite/vite-config/vite-pkg-dev-config.cjs +4 -6
- package/dist/vite/vite-config/vite-project-config.cjs +7 -44
- package/dist/vite/vite-config/vite-project-config.d.ts +1 -2
- package/es/constants/index.d.ts +0 -4
- package/es/constants/index.mjs +26 -7
- package/es/eslint/eslint-config/eslint-config.mjs +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/vite/index.d.ts +1 -1
- package/es/vite/index.mjs +1 -1
- package/es/vite/vite-config/vite-base-config.mjs +0 -22
- package/es/vite/vite-config/vite-config.d.ts +1 -0
- package/es/vite/vite-config/vite-config.mjs +22 -18
- package/es/vite/vite-config/vite-dev-config.mjs +1 -2
- package/es/vite/vite-config/vite-pkg-dev-config.mjs +2 -5
- package/es/vite/vite-config/vite-project-config.d.ts +1 -2
- package/es/vite/vite-config/vite-project-config.mjs +8 -63
- package/package.json +18 -33
- package/dist/rollup/index.cjs +0 -35
- package/dist/rollup/index.d.ts +0 -3
- package/dist/rollup/rollup-config/build-config.cjs +0 -60
- package/dist/rollup/rollup-config/build-config.d.ts +0 -9
- package/dist/rollup/rollup-config/dev-config.cjs +0 -107
- package/dist/rollup/rollup-config/dev-config.d.ts +0 -9
- package/dist/rollup/rollup-plugins/copy-file.cjs +0 -24
- package/dist/rollup/rollup-plugins/copy-file.d.ts +0 -37
- package/dist/rollup/rollup-plugins/ignore-compiler-file.cjs +0 -23
- package/dist/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
- package/dist/rollup/rollup-plugins/index.cjs +0 -19
- package/dist/rollup/rollup-plugins/index.d.ts +0 -2
- package/dist/vite/gct-opts.interface.cjs +0 -1
- package/dist/vite/gct-opts.interface.d.ts +0 -18
- package/es/rollup/index.d.ts +0 -3
- package/es/rollup/index.mjs +0 -3
- package/es/rollup/rollup-config/build-config.d.ts +0 -9
- package/es/rollup/rollup-config/build-config.mjs +0 -67
- package/es/rollup/rollup-config/dev-config.d.ts +0 -9
- package/es/rollup/rollup-config/dev-config.mjs +0 -124
- package/es/rollup/rollup-plugins/copy-file.d.ts +0 -37
- package/es/rollup/rollup-plugins/copy-file.mjs +0 -18
- package/es/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
- package/es/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -17
- package/es/rollup/rollup-plugins/index.d.ts +0 -2
- package/es/rollup/rollup-plugins/index.mjs +0 -2
- package/es/vite/gct-opts.interface.d.ts +0 -18
- package/es/vite/gct-opts.interface.mjs +0 -0
|
@@ -3,68 +3,26 @@ import {
|
|
|
3
3
|
} from "vite";
|
|
4
4
|
import vue from "@vitejs/plugin-vue";
|
|
5
5
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
6
|
-
import legacy from "@vitejs/plugin-legacy";
|
|
7
6
|
import UnoCSS from "unocss/vite";
|
|
8
7
|
import path from "path";
|
|
9
8
|
import fse from "fs-extra";
|
|
10
|
-
import { simpleGit } from "simple-git";
|
|
11
9
|
import { mergeConfig } from "../../util/index.mjs";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alpha: "http://paas.alpha.gct-paas.com",
|
|
15
|
-
beta: "http://paas.beta.gct-paas.com",
|
|
16
|
-
"paas-ai-dev": "http://paas.aidev.gct-paas.com",
|
|
17
|
-
"paas-dev": "http://paas.paasdev.gct-paas.com",
|
|
18
|
-
"paas-test": "http://paas.paastest.gct-paas.com",
|
|
19
|
-
"mom-dev": "http://paas.momdev.gct-paas.com",
|
|
20
|
-
"mom-test": "http://paas.momtest.gct-paas.com",
|
|
21
|
-
"ncdp-dev": "http://paas.ncdpdev.gct-paas.com",
|
|
22
|
-
"ncdp-test": "http://paas.ncdptest.gct-paas.com",
|
|
23
|
-
"ipaas-dev": "http://paas.ipaasdev.gct-paas.com",
|
|
24
|
-
"ipaas-test": "http://paas.ipaastest.gct-paas.com",
|
|
25
|
-
"edhr-dev": "http://paas.edhrdev.gct-paas.com",
|
|
26
|
-
"edhr-test": "http://paas.edhrtest.gct-paas.com",
|
|
27
|
-
"datav-dev": "http://paas.datavdev.gct-paas.com"
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
31
|
-
const _gctOpts = mergeConfig(gctOptsDefault, gctOpts);
|
|
10
|
+
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
11
|
+
export function defineProjectViteConfig(opts = {}) {
|
|
32
12
|
return defineConfig(async () => {
|
|
33
13
|
const cwd = process.cwd();
|
|
34
14
|
const pkg = fse.readJsonSync(path.resolve(cwd, "package.json"));
|
|
35
|
-
const git = simpleGit({ baseDir: cwd });
|
|
36
|
-
const branchSummary = await git.branch();
|
|
37
|
-
const httpProxyKey = Object.keys(_gctOpts.httpProxyConfig).find((key) => {
|
|
38
|
-
return key.startsWith(branchSummary.current);
|
|
39
|
-
}) || "paas-test";
|
|
40
|
-
const httpProxy = _gctOpts.httpProxyConfig[httpProxyKey];
|
|
41
15
|
return mergeConfig(
|
|
42
16
|
{
|
|
43
|
-
base: "./",
|
|
44
17
|
resolve: {
|
|
45
18
|
alias: {
|
|
46
|
-
"
|
|
19
|
+
"@/*": "src/*"
|
|
47
20
|
}
|
|
48
21
|
},
|
|
22
|
+
base: "./",
|
|
49
23
|
build: {
|
|
50
|
-
|
|
51
|
-
external:
|
|
52
|
-
"axios",
|
|
53
|
-
"dayjs",
|
|
54
|
-
"pinia",
|
|
55
|
-
"lodash-es",
|
|
56
|
-
"vue",
|
|
57
|
-
"vue-i18n",
|
|
58
|
-
"vue-router",
|
|
59
|
-
"ant-design-vue",
|
|
60
|
-
"pinia",
|
|
61
|
-
"systemjs",
|
|
62
|
-
"@gct-paas/core",
|
|
63
|
-
"@gct-paas/core-web",
|
|
64
|
-
"@gct-paas/api/apaas",
|
|
65
|
-
"@gct-paas/api/ipaas",
|
|
66
|
-
"@gct-paas/api/platform"
|
|
67
|
-
]
|
|
24
|
+
rolldownOptions: {
|
|
25
|
+
external: DEFAULT_EXTERNAL
|
|
68
26
|
}
|
|
69
27
|
},
|
|
70
28
|
css: {
|
|
@@ -82,14 +40,7 @@ export function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
|
82
40
|
strict: false
|
|
83
41
|
},
|
|
84
42
|
proxy: {
|
|
85
|
-
hostname: "0.0.0.0"
|
|
86
|
-
...["/gct-platform", "/gct-apaas", "/gct-ipaas", "/minio"].reduce(
|
|
87
|
-
(acc, item) => {
|
|
88
|
-
acc[item] = httpProxy;
|
|
89
|
-
return acc;
|
|
90
|
-
},
|
|
91
|
-
{}
|
|
92
|
-
)
|
|
43
|
+
hostname: "0.0.0.0"
|
|
93
44
|
}
|
|
94
45
|
},
|
|
95
46
|
define: {
|
|
@@ -101,13 +52,7 @@ export function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
|
101
52
|
plugins: [
|
|
102
53
|
vue(),
|
|
103
54
|
vueJsx(),
|
|
104
|
-
UnoCSS({ hmrTopLevelAwait: false })
|
|
105
|
-
legacy({
|
|
106
|
-
targets: ["chrome>=85", "edge>=85", "firefox>=79", "safari>=14.1"],
|
|
107
|
-
externalSystemJS: true,
|
|
108
|
-
// 关键配置:false 时只生成 legacy 版本
|
|
109
|
-
renderModernChunks: true
|
|
110
|
-
})
|
|
55
|
+
UnoCSS({ hmrTopLevelAwait: false })
|
|
111
56
|
]
|
|
112
57
|
},
|
|
113
58
|
opts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/build",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-dev.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -39,34 +39,24 @@
|
|
|
39
39
|
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@eslint/config-helpers": "^0.5.2",
|
|
47
|
-
"@eslint/js": "^9.39.3",
|
|
42
|
+
"@commitlint/cli": "^20.4.4",
|
|
43
|
+
"@commitlint/config-conventional": "^20.4.4",
|
|
44
|
+
"@eslint/config-helpers": "^0.5.3",
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
48
46
|
"@gct-paas/scss": "^0.1.5",
|
|
49
47
|
"@inquirer/prompts": "^8.3.0",
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
55
|
-
"@rollup/plugin-typescript": "^12.3.0",
|
|
56
|
-
"@vitejs/plugin-legacy": "^7.2.1",
|
|
57
|
-
"@vitejs/plugin-vue": "^6.0.4",
|
|
58
|
-
"@vitejs/plugin-vue-jsx": "^5.1.4",
|
|
59
|
-
"@vue/compiler-sfc": "^3.5.29",
|
|
48
|
+
"@module-federation/vite": "^1.13.0",
|
|
49
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
50
|
+
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
51
|
+
"@vue/compiler-sfc": "^3.5.30",
|
|
60
52
|
"chokidar": "^5.0.0",
|
|
61
53
|
"commander": "^14.0.3",
|
|
62
54
|
"consola": "^3.4.2",
|
|
63
55
|
"copy-file": "^11.1.0",
|
|
64
56
|
"core-js": "^3.48.0",
|
|
65
|
-
"cpy": "^12.1.0",
|
|
66
57
|
"crypto": "^1.0.1",
|
|
67
|
-
"cssnano": "^7.1.
|
|
68
|
-
"
|
|
69
|
-
"eslint": "^9.39.3",
|
|
58
|
+
"cssnano": "^7.1.3",
|
|
59
|
+
"eslint": "^9.39.4",
|
|
70
60
|
"eslint-config-prettier": "^10.1.8",
|
|
71
61
|
"eslint-plugin-import": "^2.32.0",
|
|
72
62
|
"eslint-plugin-prettier": "^5.5.5",
|
|
@@ -80,30 +70,25 @@
|
|
|
80
70
|
"picocolors": "^1.1.1",
|
|
81
71
|
"prettier": "^3.8.1",
|
|
82
72
|
"rimraf": "^6.1.3",
|
|
83
|
-
"
|
|
84
|
-
"rollup-plugin-esbuild": "^6.2.1",
|
|
85
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
86
|
-
"sass": "^1.97.3",
|
|
87
|
-
"simple-git": "^3.32.3",
|
|
73
|
+
"sass": "^1.98.0",
|
|
88
74
|
"stylelint": "^17.4.0",
|
|
89
75
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
90
|
-
"typescript-eslint": "^8.
|
|
91
|
-
"unocss": "66.6.
|
|
92
|
-
"vite": "^
|
|
76
|
+
"typescript-eslint": "^8.57.0",
|
|
77
|
+
"unocss": "66.6.6",
|
|
78
|
+
"vite": "^8.0.0",
|
|
93
79
|
"vite-plugin-dts": "^4.5.4",
|
|
94
80
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
95
|
-
"vite-plugin-static-copy": "^3.
|
|
96
|
-
"vite-tsconfig-paths": "^6.1.1",
|
|
81
|
+
"vite-plugin-static-copy": "^3.3.0",
|
|
97
82
|
"vue-eslint-parser": "^10.4.0",
|
|
98
83
|
"vue-tsc": "^3.2.5"
|
|
99
84
|
},
|
|
100
85
|
"devDependencies": {
|
|
101
|
-
"@commitlint/types": "^20.4.
|
|
86
|
+
"@commitlint/types": "^20.4.4",
|
|
102
87
|
"@types/babel__core": "^7.20.5",
|
|
103
88
|
"@types/babel__preset-env": "^7.10.0",
|
|
104
89
|
"@types/fs-extra": "^11.0.4",
|
|
105
90
|
"@types/lodash-es": "^4.17.12",
|
|
106
|
-
"@types/node": "^25.
|
|
91
|
+
"@types/node": "^25.5.0",
|
|
107
92
|
"postcss": "^8.5.8",
|
|
108
93
|
"tsx": "^4.21.0",
|
|
109
94
|
"typescript": "^5.9.3",
|
package/dist/rollup/index.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
defineRollupBuildConfig: true,
|
|
8
|
-
defineRollupConfig: true
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "defineRollupBuildConfig", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _buildConfig.defineRollupBuildConfig;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "defineRollupConfig", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return _devConfig.defineRollupConfig;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
var _buildConfig = require("./rollup-config/build-config.cjs");
|
|
23
|
-
var _devConfig = require("./rollup-config/dev-config.cjs");
|
|
24
|
-
var _rollupPlugins = require("./rollup-plugins/index.cjs");
|
|
25
|
-
Object.keys(_rollupPlugins).forEach(function (key) {
|
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
-
if (key in exports && exports[key] === _rollupPlugins[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _rollupPlugins[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
package/dist/rollup/index.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.defineRollupBuildConfig = defineRollupBuildConfig;
|
|
7
|
-
var _rollup = require("rollup");
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _pluginNodeResolve = require("@rollup/plugin-node-resolve");
|
|
10
|
-
var _pluginCommonjs = _interopRequireDefault(require("@rollup/plugin-commonjs"));
|
|
11
|
-
var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
12
|
-
var _rollupPluginEsbuild = _interopRequireWildcard(require("rollup-plugin-esbuild"));
|
|
13
|
-
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
14
|
-
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
15
|
-
var rf = _interopRequireWildcard(require("rimraf"));
|
|
16
|
-
var _rollupPlugins = require("../rollup-plugins/index.cjs");
|
|
17
|
-
var _constants = require("../../constants/index.cjs");
|
|
18
|
-
var _util = require("../../util/index.cjs");
|
|
19
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
function defineRollupBuildConfig(opts = {}) {
|
|
23
|
-
process.on("SIGINT", () => {
|
|
24
|
-
process.exit();
|
|
25
|
-
});
|
|
26
|
-
const cwd = process.cwd();
|
|
27
|
-
const isProd = process.env.NODE_ENV === _constants.PROD_MODE;
|
|
28
|
-
const outDir = _path.default.resolve(cwd, "es");
|
|
29
|
-
const externalCompileFileReg = /\.(d\.ts)+$/;
|
|
30
|
-
rf.sync(outDir);
|
|
31
|
-
const output = [{
|
|
32
|
-
file: "dist/index.esm.min.js",
|
|
33
|
-
format: "es"
|
|
34
|
-
}, {
|
|
35
|
-
file: "dist/index.system.min.js",
|
|
36
|
-
format: "system"
|
|
37
|
-
}, {
|
|
38
|
-
file: "dist/index.cjs.min.js",
|
|
39
|
-
format: "cjs",
|
|
40
|
-
exports: "named"
|
|
41
|
-
}];
|
|
42
|
-
return (0, _util.mergeConfig)((0, _rollup.defineConfig)({
|
|
43
|
-
input: "src/index.ts",
|
|
44
|
-
treeshake: false,
|
|
45
|
-
external: _constants.DEFAULT_EXTERNAL,
|
|
46
|
-
output,
|
|
47
|
-
plugins: [(0, _rollupPlugins.ignoreCompilerFile)(externalCompileFileReg), (0, _pluginJson.default)(), (0, _pluginVue.default)({
|
|
48
|
-
isProduction: isProd
|
|
49
|
-
}), (0, _pluginVueJsx.default)({}), (0, _pluginNodeResolve.nodeResolve)({
|
|
50
|
-
extensions: [".cjs", ".mjs", ".js", ".ts"]
|
|
51
|
-
}), (0, _pluginCommonjs.default)(), (0, _rollupPluginEsbuild.default)({
|
|
52
|
-
logLevel: "verbose",
|
|
53
|
-
sourceMap: false,
|
|
54
|
-
target: ["esnext"],
|
|
55
|
-
loaders: {
|
|
56
|
-
".vue": "ts"
|
|
57
|
-
}
|
|
58
|
-
}), (0, _rollupPluginEsbuild.minify)()]
|
|
59
|
-
}), opts);
|
|
60
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.defineRollupConfig = defineRollupConfig;
|
|
7
|
-
var _rollup = require("rollup");
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _pluginNodeResolve = require("@rollup/plugin-node-resolve");
|
|
10
|
-
var _pluginCommonjs = _interopRequireDefault(require("@rollup/plugin-commonjs"));
|
|
11
|
-
var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
12
|
-
var _rollupPluginEsbuild = _interopRequireDefault(require("rollup-plugin-esbuild"));
|
|
13
|
-
var _vitePluginDts = _interopRequireDefault(require("vite-plugin-dts"));
|
|
14
|
-
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
15
|
-
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
16
|
-
var rf = _interopRequireWildcard(require("rimraf"));
|
|
17
|
-
var _cpy = _interopRequireDefault(require("cpy"));
|
|
18
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
19
|
-
var _os = _interopRequireDefault(require("os"));
|
|
20
|
-
var _rollupPlugins = require("../rollup-plugins/index.cjs");
|
|
21
|
-
var _constants = require("../../constants/index.cjs");
|
|
22
|
-
var _util = require("../../util/index.cjs");
|
|
23
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
|
-
function defineRollupConfig(opts = {}) {
|
|
27
|
-
process.on("SIGINT", () => {
|
|
28
|
-
process.exit();
|
|
29
|
-
});
|
|
30
|
-
const cwd = process.cwd();
|
|
31
|
-
const isProd = process.env.NODE_ENV === _constants.PROD_MODE;
|
|
32
|
-
const rootDir = _path.default.resolve(cwd, "src");
|
|
33
|
-
const outDir = _path.default.resolve(cwd, "es");
|
|
34
|
-
const assetsDir = _path.default.resolve(cwd, "public");
|
|
35
|
-
const externalCompileFileReg = /\.(scss|css|less|d\.ts)+$/;
|
|
36
|
-
rf.sync(outDir);
|
|
37
|
-
if (isProd) {
|
|
38
|
-
const isWin = _os.default.platform() === "win32";
|
|
39
|
-
if (isWin) {
|
|
40
|
-
if (_fsExtra.default.pathExistsSync(assetsDir)) {
|
|
41
|
-
(0, _cpy.default)((0, _util.winToUnixPath)(assetsDir), (0, _util.winToUnixPath)(outDir));
|
|
42
|
-
}
|
|
43
|
-
(0, _cpy.default)((0, _util.winToUnixPath)(_path.default.resolve(cwd, "src/**/*.{scss,css,less,d.ts}")), (0, _util.winToUnixPath)(outDir));
|
|
44
|
-
} else {
|
|
45
|
-
if (_fsExtra.default.pathExistsSync(assetsDir)) {
|
|
46
|
-
(0, _cpy.default)(assetsDir, outDir);
|
|
47
|
-
}
|
|
48
|
-
(0, _cpy.default)(_path.default.resolve(cwd, "src/**/*.{scss,css,less,d.ts}"), outDir);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
(0, _rollupPlugins.copyFile)([{
|
|
52
|
-
from: assetsDir,
|
|
53
|
-
to: outDir
|
|
54
|
-
}, {
|
|
55
|
-
from: rootDir,
|
|
56
|
-
to: outDir,
|
|
57
|
-
opts: {
|
|
58
|
-
ignored: (file, stats) => {
|
|
59
|
-
if (stats && stats.isFile()) {
|
|
60
|
-
return !externalCompileFileReg.test(file);
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}]);
|
|
66
|
-
}
|
|
67
|
-
const output = [{
|
|
68
|
-
dir: outDir,
|
|
69
|
-
esModule: true,
|
|
70
|
-
format: "es",
|
|
71
|
-
sourcemap: false,
|
|
72
|
-
preserveModules: true,
|
|
73
|
-
preserveModulesRoot: rootDir,
|
|
74
|
-
exports: "named",
|
|
75
|
-
entryFileNames: "[name].mjs"
|
|
76
|
-
}];
|
|
77
|
-
return (0, _util.mergeConfig)((0, _rollup.defineConfig)({
|
|
78
|
-
input: "src/index.ts",
|
|
79
|
-
treeshake: false,
|
|
80
|
-
external: id => {
|
|
81
|
-
if (_util.IS_NODE_MODULE.test(id)) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
if (_constants.DEFAULT_EXTERNAL.includes(id)) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
},
|
|
89
|
-
output,
|
|
90
|
-
plugins: [(0, _rollupPlugins.ignoreCompilerFile)(externalCompileFileReg), (0, _pluginJson.default)(), (0, _pluginVue.default)({
|
|
91
|
-
isProduction: isProd
|
|
92
|
-
}), (0, _pluginVueJsx.default)({}), (0, _pluginNodeResolve.nodeResolve)({
|
|
93
|
-
extensions: [".cjs", ".mjs", ".js", ".ts"]
|
|
94
|
-
}), (0, _pluginCommonjs.default)(), (0, _rollupPluginEsbuild.default)({
|
|
95
|
-
logLevel: "verbose",
|
|
96
|
-
sourceMap: false,
|
|
97
|
-
target: ["esnext"],
|
|
98
|
-
loaders: {
|
|
99
|
-
".vue": "ts"
|
|
100
|
-
}
|
|
101
|
-
}), (0, _vitePluginDts.default)({
|
|
102
|
-
outDir: [outDir],
|
|
103
|
-
// 排除测试目录,以及测试文件
|
|
104
|
-
exclude: ["**/test/**", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
|
|
105
|
-
})]
|
|
106
|
-
}), opts);
|
|
107
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyFile = copyFile;
|
|
7
|
-
var _util = require("../../util/index.cjs");
|
|
8
|
-
function copyFile(opts) {
|
|
9
|
-
if (opts.length === 0) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const arr = [];
|
|
13
|
-
opts.forEach(opt => {
|
|
14
|
-
arr.push(new _util.CopyWatch(opt.from, opt.to, opt.opts));
|
|
15
|
-
});
|
|
16
|
-
process.on("exit", () => {
|
|
17
|
-
if (!opts.length) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
arr.forEach(item => {
|
|
21
|
-
item.unwatch();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as chokidar from 'chokidar';
|
|
2
|
-
/**
|
|
3
|
-
* 文件拷贝插件配置参数
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @interface CopyFilePluginOptions
|
|
7
|
-
*/
|
|
8
|
-
export interface CopyFilePluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* 源文件
|
|
11
|
-
*
|
|
12
|
-
* @type {string}
|
|
13
|
-
* @memberof CopyFilePluginOptions
|
|
14
|
-
*/
|
|
15
|
-
from: string;
|
|
16
|
-
/**
|
|
17
|
-
* 目标文件
|
|
18
|
-
*
|
|
19
|
-
* @type {string}
|
|
20
|
-
* @memberof CopyFilePluginOptions
|
|
21
|
-
*/
|
|
22
|
-
to: string;
|
|
23
|
-
/**
|
|
24
|
-
* chokidar watch 配置
|
|
25
|
-
*
|
|
26
|
-
* @type {chokidar.ChokidarOptions}
|
|
27
|
-
*/
|
|
28
|
-
opts?: chokidar.ChokidarOptions;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 文件拷贝插件,在开发模式下会监控文件变更,并自动拷贝文件
|
|
32
|
-
*
|
|
33
|
-
* @export
|
|
34
|
-
* @param {CopyFilePluginOptions[]} opts
|
|
35
|
-
* @return {*} {Plugin}
|
|
36
|
-
*/
|
|
37
|
-
export declare function copyFile(opts: CopyFilePluginOptions[]): void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ignoreCompilerFile = ignoreCompilerFile;
|
|
7
|
-
function ignoreCompilerFile(extReg) {
|
|
8
|
-
return {
|
|
9
|
-
name: "gct:ignore-compiler-file",
|
|
10
|
-
resolveId(source) {
|
|
11
|
-
if (extReg.test(source)) {
|
|
12
|
-
return {
|
|
13
|
-
id: source,
|
|
14
|
-
external: true
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
},
|
|
19
|
-
load() {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "copyFile", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _copyFile.copyFile;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ignoreCompilerFile", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _ignoreCompilerFile.ignoreCompilerFile;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _copyFile = require("./copy-file.cjs");
|
|
19
|
-
var _ignoreCompilerFile = require("./ignore-compiler-file.cjs");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 项目自定义配置接口
|
|
3
|
-
*
|
|
4
|
-
* @author chitanda
|
|
5
|
-
* @date 2025-08-24 11:08:43
|
|
6
|
-
* @export
|
|
7
|
-
* @interface GctOpts
|
|
8
|
-
*/
|
|
9
|
-
export interface GctOpts {
|
|
10
|
-
/**
|
|
11
|
-
* HTTP 代理配置,根据分支前缀匹配
|
|
12
|
-
*
|
|
13
|
-
* @author chitanda
|
|
14
|
-
* @date 2025-08-24 11:08:56
|
|
15
|
-
* @type {Record<string, string>}
|
|
16
|
-
*/
|
|
17
|
-
httpProxyConfig: Record<string, string>;
|
|
18
|
-
}
|
package/es/rollup/index.d.ts
DELETED
package/es/rollup/index.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "rollup";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
4
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
5
|
-
import json from "@rollup/plugin-json";
|
|
6
|
-
import esbuild, { minify } from "rollup-plugin-esbuild";
|
|
7
|
-
import vue from "@vitejs/plugin-vue";
|
|
8
|
-
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
9
|
-
import * as rf from "rimraf";
|
|
10
|
-
import { ignoreCompilerFile } from "../rollup-plugins/index.mjs";
|
|
11
|
-
import { DEFAULT_EXTERNAL, PROD_MODE } from "../../constants/index.mjs";
|
|
12
|
-
import { mergeConfig } from "../../util/index.mjs";
|
|
13
|
-
export function defineRollupBuildConfig(opts = {}) {
|
|
14
|
-
process.on("SIGINT", () => {
|
|
15
|
-
process.exit();
|
|
16
|
-
});
|
|
17
|
-
const cwd = process.cwd();
|
|
18
|
-
const isProd = process.env.NODE_ENV === PROD_MODE;
|
|
19
|
-
const outDir = path.resolve(cwd, "es");
|
|
20
|
-
const externalCompileFileReg = /\.(d\.ts)+$/;
|
|
21
|
-
rf.sync(outDir);
|
|
22
|
-
const output = [
|
|
23
|
-
{
|
|
24
|
-
file: "dist/index.esm.min.js",
|
|
25
|
-
format: "es"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
file: "dist/index.system.min.js",
|
|
29
|
-
format: "system"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
file: "dist/index.cjs.min.js",
|
|
33
|
-
format: "cjs",
|
|
34
|
-
exports: "named"
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
return mergeConfig(
|
|
38
|
-
defineConfig({
|
|
39
|
-
input: "src/index.ts",
|
|
40
|
-
treeshake: false,
|
|
41
|
-
external: DEFAULT_EXTERNAL,
|
|
42
|
-
output,
|
|
43
|
-
plugins: [
|
|
44
|
-
ignoreCompilerFile(externalCompileFileReg),
|
|
45
|
-
json(),
|
|
46
|
-
vue({
|
|
47
|
-
isProduction: isProd
|
|
48
|
-
}),
|
|
49
|
-
vueJsx({}),
|
|
50
|
-
nodeResolve({
|
|
51
|
-
extensions: [".cjs", ".mjs", ".js", ".ts"]
|
|
52
|
-
}),
|
|
53
|
-
commonjs(),
|
|
54
|
-
esbuild({
|
|
55
|
-
logLevel: "verbose",
|
|
56
|
-
sourceMap: false,
|
|
57
|
-
target: ["esnext"],
|
|
58
|
-
loaders: {
|
|
59
|
-
".vue": "ts"
|
|
60
|
-
}
|
|
61
|
-
}),
|
|
62
|
-
minify()
|
|
63
|
-
]
|
|
64
|
-
}),
|
|
65
|
-
opts
|
|
66
|
-
);
|
|
67
|
-
}
|