@gct-paas/build 0.1.6-dev.5 → 0.1.6-dev.6
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 +3 -3
- package/dist/vite/index.cjs +6 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/vite-config/vite-base-config.cjs +7 -4
- package/dist/vite/vite-config/vite-config.cjs +5 -8
- package/dist/vite/vite-config/vite-plugin-config.cjs +48 -110
- package/dist/vite/vite-config/vite-plugin-config.d.ts +14 -6
- package/dist/vite/vite-plugins/imnport-external-plugin.cjs +21 -0
- package/dist/vite/vite-plugins/imnport-external-plugin.d.ts +16 -0
- package/es/constants/index.mjs +5 -2
- package/es/vite/index.d.ts +1 -1
- package/es/vite/index.mjs +1 -0
- package/es/vite/vite-config/vite-base-config.mjs +7 -3
- package/es/vite/vite-config/vite-config.mjs +5 -6
- package/es/vite/vite-config/vite-plugin-config.d.ts +14 -6
- package/es/vite/vite-config/vite-plugin-config.mjs +50 -115
- package/es/vite/vite-plugins/imnport-external-plugin.d.ts +16 -0
- package/es/vite/vite-plugins/imnport-external-plugin.mjs +14 -0
- package/package.json +4 -4
package/dist/constants/index.cjs
CHANGED
|
@@ -10,10 +10,10 @@ const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = [
|
|
|
10
10
|
// vue 相关依赖
|
|
11
11
|
"vue", "vue-router", "vue-i18n", "pinia",
|
|
12
12
|
// 第三方依赖
|
|
13
|
-
"axios", "dayjs", "lodash-es", "qs", "bignumber.js", "wujie", "sql-formatter", "mqtt", "@fingerprintjs/fingerprintjs", "overlayscrollbars", "@jsplumb/browser-ui", "sortablejs", "interactjs",
|
|
13
|
+
"axios", "dayjs", "lodash-es", "qs", "bignumber.js", "wujie", "@module-federation/runtime", "sql-formatter", "mqtt", "@fingerprintjs/fingerprintjs", "overlayscrollbars", "@jsplumb/browser-ui", "sortablejs", "interactjs", "bwip-js",
|
|
14
14
|
// 组件库相关依赖
|
|
15
|
-
"vuedraggable", "vue-grid-layout", "vant", "ant-design-vue",
|
|
15
|
+
"vuedraggable", "vue-grid-layout", "vant", "ant-design-vue", "vxe-table",
|
|
16
16
|
// 图标库相关依赖
|
|
17
17
|
"@ant-design/icons-vue", "@icon-park/vue-next/es/all", "@icon-park/vue-next/icons.json",
|
|
18
18
|
// @gct-paas 相关依赖
|
|
19
|
-
"@gct-paas/api", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-web", "@gct-paas/core-pad", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/design-pad", "@gct-paas/render", "@gct-paas/render-mobile", "@gct-paas/render-pad", "@gct-paas/render-web", "@gct-paas/schema", "@gct-paas/scss", "@gct-paas/
|
|
19
|
+
"@gct-paas/api", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-web", "@gct-paas/core-pad", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/design-pad", "@gct-paas/render", "@gct-paas/render-mobile", "@gct-paas/render-pad", "@gct-paas/render-web", "@gct-paas/schema", "@gct-paas/scss", "@gct-paas/platform-icons", "@gct-paas/vue-pdf"];
|
package/dist/vite/index.cjs
CHANGED
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "defineMobilePluginViteConfig", {
|
|
|
27
27
|
return _vitePluginConfig.defineMobilePluginViteConfig;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "definePadPluginViteConfig", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _vitePluginConfig.definePadPluginViteConfig;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "definePkgDevViteConfig", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
|
2
2
|
export { defineViteConfig, defineLoaderViteConfig } from './vite-config/vite-config';
|
|
3
3
|
export { defineDevViteConfig } from './vite-config/vite-dev-config';
|
|
4
4
|
export { definePkgDevViteConfig } from './vite-config/vite-pkg-dev-config';
|
|
5
|
-
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, definePadPluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
6
6
|
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
|
@@ -7,7 +7,6 @@ exports.defineViteBaseConfig = defineViteBaseConfig;
|
|
|
7
7
|
var _vite = require("vite");
|
|
8
8
|
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
9
9
|
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
10
|
-
var _vite2 = _interopRequireDefault(require("unocss/vite"));
|
|
11
10
|
var _path = _interopRequireDefault(require("path"));
|
|
12
11
|
var _constants = require("../../constants/index.cjs");
|
|
13
12
|
var _util = require("../../util/index.cjs");
|
|
@@ -16,6 +15,11 @@ function defineViteBaseConfig(opts = {}) {
|
|
|
16
15
|
const cwd = process.cwd();
|
|
17
16
|
const outDir = _path.default.resolve(cwd, "dist");
|
|
18
17
|
return (0, _util.mergeConfig)((0, _vite.defineConfig)({
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: {
|
|
20
|
+
"@": _path.default.resolve(cwd, "./src")
|
|
21
|
+
}
|
|
22
|
+
},
|
|
19
23
|
css: {
|
|
20
24
|
preprocessorOptions: {
|
|
21
25
|
scss: {
|
|
@@ -25,12 +29,11 @@ function defineViteBaseConfig(opts = {}) {
|
|
|
25
29
|
},
|
|
26
30
|
build: {
|
|
27
31
|
outDir,
|
|
32
|
+
target: "chrome89",
|
|
28
33
|
rolldownOptions: {
|
|
29
34
|
external: _constants.DEFAULT_EXTERNAL
|
|
30
35
|
}
|
|
31
36
|
},
|
|
32
|
-
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)()
|
|
33
|
-
hmrTopLevelAwait: false
|
|
34
|
-
})]
|
|
37
|
+
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)()]
|
|
35
38
|
}), opts);
|
|
36
39
|
}
|
|
@@ -7,15 +7,11 @@ exports.defineLoaderViteConfig = defineLoaderViteConfig;
|
|
|
7
7
|
exports.defineViteConfig = defineViteConfig;
|
|
8
8
|
var _vite = require("vite");
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var
|
|
10
|
+
var _vite2 = _interopRequireDefault(require("unocss/vite"));
|
|
11
11
|
var _viteBaseConfig = require("./vite-base-config.cjs");
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
13
|
function defineViteConfig(opts = {}) {
|
|
16
14
|
const cwd = process.cwd();
|
|
17
|
-
const outDir = _path.default.resolve(cwd, "dist");
|
|
18
|
-
rf.sync(outDir);
|
|
19
15
|
return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)((0, _vite.defineConfig)({
|
|
20
16
|
build: {
|
|
21
17
|
minify: "terser",
|
|
@@ -34,13 +30,14 @@ function defineViteConfig(opts = {}) {
|
|
|
34
30
|
cssFileName: "index.min",
|
|
35
31
|
fileName: "[name].[format].min"
|
|
36
32
|
}
|
|
37
|
-
}
|
|
33
|
+
},
|
|
34
|
+
plugins: [(0, _vite2.default)({
|
|
35
|
+
hmrTopLevelAwait: false
|
|
36
|
+
})]
|
|
38
37
|
})), opts);
|
|
39
38
|
}
|
|
40
39
|
function defineLoaderViteConfig(opts = {}) {
|
|
41
40
|
const cwd = process.cwd();
|
|
42
|
-
const outDir = _path.default.resolve(cwd, "dist");
|
|
43
|
-
rf.sync(outDir);
|
|
44
41
|
return (0, _vite.mergeConfig)(defineViteConfig({
|
|
45
42
|
build: {
|
|
46
43
|
lib: {
|
|
@@ -5,140 +5,78 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defineDesignPluginViteConfig = defineDesignPluginViteConfig;
|
|
7
7
|
exports.defineMobilePluginViteConfig = defineMobilePluginViteConfig;
|
|
8
|
+
exports.definePadPluginViteConfig = definePadPluginViteConfig;
|
|
8
9
|
exports.definePluginViteConfig = definePluginViteConfig;
|
|
9
10
|
exports.defineWebPluginViteConfig = defineWebPluginViteConfig;
|
|
10
11
|
var _vite = require("vite");
|
|
11
12
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var _vite2 = require("@module-federation/vite");
|
|
13
13
|
var _viteBaseConfig = require("./vite-base-config.cjs");
|
|
14
14
|
var _constants = require("../../constants/index.cjs");
|
|
15
|
+
var _imnportExternalPlugin = require("../vite-plugins/imnport-external-plugin.cjs");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const formats = ["es"];
|
|
17
|
-
function importMapExternalPlugin(modules) {
|
|
18
|
-
return {
|
|
19
|
-
name: "vite-plugin-importmap-external",
|
|
20
|
-
enforce: "pre",
|
|
21
|
-
resolveId(id) {
|
|
22
|
-
if (modules.includes(id) || modules.some(m => id.startsWith(m + "/"))) {
|
|
23
|
-
return {
|
|
24
|
-
id,
|
|
25
|
-
external: true
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
17
|
function definePluginViteConfig(opts = {}) {
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
const entry = _path.default.resolve(cwd, "src/index.ts");
|
|
20
|
+
const loaderEntry = _path.default.resolve(cwd, "src/loader.ts");
|
|
21
|
+
const isProd = process.env.NODE_ENV === "production";
|
|
32
22
|
return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)({
|
|
33
|
-
base: "/plugin-design/",
|
|
34
|
-
server: {
|
|
35
|
-
host: "0.0.0.0",
|
|
36
|
-
port: 7001,
|
|
37
|
-
allowedHosts: true
|
|
38
|
-
},
|
|
39
23
|
optimizeDeps: {
|
|
40
24
|
exclude: _constants.DEFAULT_EXTERNAL
|
|
41
25
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
transform(code) {
|
|
49
|
-
return code.replace(/"[^"]*\/@id\/([^"]+)"/g, (match, specifier) => {
|
|
50
|
-
const decoded = decodeURIComponent(specifier);
|
|
51
|
-
if (_constants.DEFAULT_EXTERNAL.some(m => decoded === m || decoded.startsWith(m + "/"))) {
|
|
52
|
-
return `"${decoded}"`;
|
|
53
|
-
}
|
|
54
|
-
return match;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, (0, _vite2.federation)({
|
|
58
|
-
name: "gct-paas-plugin",
|
|
59
|
-
filename: "remoteEntry.js",
|
|
60
|
-
dts: false,
|
|
61
|
-
exposes: {
|
|
62
|
-
".": "./src/index.ts"
|
|
26
|
+
build: {
|
|
27
|
+
lib: {
|
|
28
|
+
entry: isProd ? loaderEntry : entry,
|
|
29
|
+
formats: ["es"],
|
|
30
|
+
cssFileName: "index.min",
|
|
31
|
+
fileName: "[name].[format].min"
|
|
63
32
|
}
|
|
64
|
-
}
|
|
33
|
+
},
|
|
34
|
+
plugins: [...(0, _imnportExternalPlugin.importMapExternalPlugin)(_constants.DEFAULT_EXTERNAL)
|
|
35
|
+
// federation({
|
|
36
|
+
// name: 'gct-paas-plugin',
|
|
37
|
+
// filename: 'remoteEntry.js',
|
|
38
|
+
// dts: false,
|
|
39
|
+
// manifest: true,
|
|
40
|
+
// exposes: {
|
|
41
|
+
// '.': './src/index.ts',
|
|
42
|
+
// },
|
|
43
|
+
// }),
|
|
44
|
+
]
|
|
65
45
|
}), opts);
|
|
66
46
|
}
|
|
67
|
-
function formatFileName(format) {
|
|
68
|
-
return `[name].${format}.min.js`;
|
|
69
|
-
}
|
|
70
|
-
function assetFileNames(assetInfo, name) {
|
|
71
|
-
if (assetInfo.names.length > 0 && assetInfo.names[0].endsWith(".css")) {
|
|
72
|
-
return name + ".min.css";
|
|
73
|
-
}
|
|
74
|
-
return assetInfo.names[0];
|
|
75
|
-
}
|
|
76
47
|
function defineDesignPluginViteConfig(opts = {}) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
rolldownOptions: {
|
|
83
|
-
output: {
|
|
84
|
-
assetFileNames: assetInfo => {
|
|
85
|
-
return assetFileNames(assetInfo, "design");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
lib: {
|
|
90
|
-
entry: {
|
|
91
|
-
design: designEntry
|
|
92
|
-
},
|
|
93
|
-
formats,
|
|
94
|
-
fileName: formatFileName
|
|
95
|
-
}
|
|
48
|
+
return (0, _vite.mergeConfig)(definePluginViteConfig({
|
|
49
|
+
server: {
|
|
50
|
+
port: 7001,
|
|
51
|
+
host: "0.0.0.0",
|
|
52
|
+
allowedHosts: true
|
|
96
53
|
}
|
|
97
54
|
}), opts);
|
|
98
55
|
}
|
|
99
56
|
function defineMobilePluginViteConfig(opts = {}) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
mobile: mobileEntry
|
|
115
|
-
},
|
|
116
|
-
formats,
|
|
117
|
-
fileName: formatFileName
|
|
118
|
-
}
|
|
57
|
+
return (0, _vite.mergeConfig)(definePluginViteConfig({
|
|
58
|
+
server: {
|
|
59
|
+
port: 7002,
|
|
60
|
+
host: "0.0.0.0",
|
|
61
|
+
allowedHosts: true
|
|
62
|
+
}
|
|
63
|
+
}), opts);
|
|
64
|
+
}
|
|
65
|
+
function definePadPluginViteConfig(opts = {}) {
|
|
66
|
+
return (0, _vite.mergeConfig)(definePluginViteConfig({
|
|
67
|
+
server: {
|
|
68
|
+
port: 7003,
|
|
69
|
+
host: "0.0.0.0",
|
|
70
|
+
allowedHosts: true
|
|
119
71
|
}
|
|
120
72
|
}), opts);
|
|
121
73
|
}
|
|
122
74
|
function defineWebPluginViteConfig(opts = {}) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
rolldownOptions: {
|
|
129
|
-
output: {
|
|
130
|
-
assetFileNames: assetInfo => {
|
|
131
|
-
return assetFileNames(assetInfo, "web");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
lib: {
|
|
136
|
-
entry: {
|
|
137
|
-
web: webEntry
|
|
138
|
-
},
|
|
139
|
-
formats,
|
|
140
|
-
fileName: formatFileName
|
|
141
|
-
}
|
|
75
|
+
return (0, _vite.mergeConfig)(definePluginViteConfig({
|
|
76
|
+
server: {
|
|
77
|
+
port: 7004,
|
|
78
|
+
host: "0.0.0.0",
|
|
79
|
+
allowedHosts: true
|
|
142
80
|
}
|
|
143
81
|
}), opts);
|
|
144
82
|
}
|
|
@@ -8,26 +8,34 @@ import { UserConfig } from 'vite';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function definePluginViteConfig(opts?: UserConfig): UserConfig;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* 设计界面插件构建配置
|
|
12
12
|
*
|
|
13
13
|
* @export
|
|
14
14
|
* @param {UserConfig} [opts={}]
|
|
15
|
-
* @
|
|
15
|
+
* @return {*} {UserConfig}
|
|
16
16
|
*/
|
|
17
17
|
export declare function defineDesignPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 设计界面插件构建配置
|
|
20
20
|
*
|
|
21
21
|
* @export
|
|
22
22
|
* @param {UserConfig} [opts={}]
|
|
23
|
-
* @
|
|
23
|
+
* @return {*} {UserConfig}
|
|
24
24
|
*/
|
|
25
25
|
export declare function defineMobilePluginViteConfig(opts?: UserConfig): UserConfig;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 设计界面插件构建配置
|
|
28
28
|
*
|
|
29
29
|
* @export
|
|
30
30
|
* @param {UserConfig} [opts={}]
|
|
31
|
-
* @
|
|
31
|
+
* @return {*} {UserConfig}
|
|
32
|
+
*/
|
|
33
|
+
export declare function definePadPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
34
|
+
/**
|
|
35
|
+
* 设计界面插件构建配置
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @param {UserConfig} [opts={}]
|
|
39
|
+
* @return {*} {UserConfig}
|
|
32
40
|
*/
|
|
33
41
|
export declare function defineWebPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.importMapExternalPlugin = importMapExternalPlugin;
|
|
7
|
+
function importMapExternalPlugin(modules) {
|
|
8
|
+
return [{
|
|
9
|
+
name: "gct-vite-plugin:import-external",
|
|
10
|
+
apply: "serve",
|
|
11
|
+
enforce: "pre",
|
|
12
|
+
resolveId(id) {
|
|
13
|
+
if (modules.includes(id)) {
|
|
14
|
+
return {
|
|
15
|
+
id,
|
|
16
|
+
external: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}];
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 在 dev 模式下:告诉 Rollup/Rolldown 指定模块是 external
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {string[]} modules
|
|
6
|
+
* @return {*}
|
|
7
|
+
*/
|
|
8
|
+
export declare function importMapExternalPlugin(modules: string[]): {
|
|
9
|
+
name: string;
|
|
10
|
+
apply: "serve";
|
|
11
|
+
enforce: "pre";
|
|
12
|
+
resolveId(id: string): {
|
|
13
|
+
id: string;
|
|
14
|
+
external: boolean;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}[];
|
package/es/constants/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ export const DEFAULT_EXTERNAL = [
|
|
|
13
13
|
"qs",
|
|
14
14
|
"bignumber.js",
|
|
15
15
|
"wujie",
|
|
16
|
+
"@module-federation/runtime",
|
|
16
17
|
"sql-formatter",
|
|
17
18
|
"mqtt",
|
|
18
19
|
"@fingerprintjs/fingerprintjs",
|
|
@@ -20,11 +21,13 @@ export const DEFAULT_EXTERNAL = [
|
|
|
20
21
|
"@jsplumb/browser-ui",
|
|
21
22
|
"sortablejs",
|
|
22
23
|
"interactjs",
|
|
24
|
+
"bwip-js",
|
|
23
25
|
// 组件库相关依赖
|
|
24
26
|
"vuedraggable",
|
|
25
27
|
"vue-grid-layout",
|
|
26
28
|
"vant",
|
|
27
29
|
"ant-design-vue",
|
|
30
|
+
"vxe-table",
|
|
28
31
|
// 图标库相关依赖
|
|
29
32
|
"@ant-design/icons-vue",
|
|
30
33
|
"@icon-park/vue-next/es/all",
|
|
@@ -45,6 +48,6 @@ export const DEFAULT_EXTERNAL = [
|
|
|
45
48
|
"@gct-paas/render-web",
|
|
46
49
|
"@gct-paas/schema",
|
|
47
50
|
"@gct-paas/scss",
|
|
48
|
-
"@gct-paas/
|
|
49
|
-
"@gct-paas/
|
|
51
|
+
"@gct-paas/platform-icons",
|
|
52
|
+
"@gct-paas/vue-pdf"
|
|
50
53
|
];
|
package/es/vite/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
|
2
2
|
export { defineViteConfig, defineLoaderViteConfig } from './vite-config/vite-config';
|
|
3
3
|
export { defineDevViteConfig } from './vite-config/vite-dev-config';
|
|
4
4
|
export { definePkgDevViteConfig } from './vite-config/vite-pkg-dev-config';
|
|
5
|
-
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, definePadPluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
6
6
|
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
package/es/vite/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ export {
|
|
|
6
6
|
definePluginViteConfig,
|
|
7
7
|
defineDesignPluginViteConfig,
|
|
8
8
|
defineMobilePluginViteConfig,
|
|
9
|
+
definePadPluginViteConfig,
|
|
9
10
|
defineWebPluginViteConfig
|
|
10
11
|
} from "./vite-config/vite-plugin-config.mjs";
|
|
11
12
|
export { defineProjectViteConfig } from "./vite-config/vite-project-config.mjs";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig } from "vite";
|
|
2
2
|
import vue from "@vitejs/plugin-vue";
|
|
3
3
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
|
-
import UnoCSS from "unocss/vite";
|
|
5
4
|
import path from "path";
|
|
6
5
|
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
7
6
|
import { mergeConfig } from "../../util/index.mjs";
|
|
@@ -10,6 +9,11 @@ export function defineViteBaseConfig(opts = {}) {
|
|
|
10
9
|
const outDir = path.resolve(cwd, "dist");
|
|
11
10
|
return mergeConfig(
|
|
12
11
|
defineConfig({
|
|
12
|
+
resolve: {
|
|
13
|
+
alias: {
|
|
14
|
+
"@": path.resolve(cwd, "./src")
|
|
15
|
+
}
|
|
16
|
+
},
|
|
13
17
|
css: {
|
|
14
18
|
preprocessorOptions: {
|
|
15
19
|
scss: {
|
|
@@ -19,14 +23,14 @@ export function defineViteBaseConfig(opts = {}) {
|
|
|
19
23
|
},
|
|
20
24
|
build: {
|
|
21
25
|
outDir,
|
|
26
|
+
target: "chrome89",
|
|
22
27
|
rolldownOptions: {
|
|
23
28
|
external: DEFAULT_EXTERNAL
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
plugins: [
|
|
27
32
|
vue(),
|
|
28
|
-
vueJsx()
|
|
29
|
-
UnoCSS({ hmrTopLevelAwait: false })
|
|
33
|
+
vueJsx()
|
|
30
34
|
]
|
|
31
35
|
}),
|
|
32
36
|
opts
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { defineConfig, mergeConfig } from "vite";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import
|
|
3
|
+
import UnoCSS from "unocss/vite";
|
|
4
4
|
import { defineViteBaseConfig } from "./vite-base-config.mjs";
|
|
5
5
|
export function defineViteConfig(opts = {}) {
|
|
6
6
|
const cwd = process.cwd();
|
|
7
|
-
const outDir = path.resolve(cwd, "dist");
|
|
8
|
-
rf.sync(outDir);
|
|
9
7
|
return mergeConfig(
|
|
10
8
|
defineViteBaseConfig(
|
|
11
9
|
defineConfig({
|
|
@@ -26,7 +24,10 @@ export function defineViteConfig(opts = {}) {
|
|
|
26
24
|
cssFileName: "index.min",
|
|
27
25
|
fileName: "[name].[format].min"
|
|
28
26
|
}
|
|
29
|
-
}
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
UnoCSS({ hmrTopLevelAwait: false })
|
|
30
|
+
]
|
|
30
31
|
})
|
|
31
32
|
),
|
|
32
33
|
opts
|
|
@@ -34,8 +35,6 @@ export function defineViteConfig(opts = {}) {
|
|
|
34
35
|
}
|
|
35
36
|
export function defineLoaderViteConfig(opts = {}) {
|
|
36
37
|
const cwd = process.cwd();
|
|
37
|
-
const outDir = path.resolve(cwd, "dist");
|
|
38
|
-
rf.sync(outDir);
|
|
39
38
|
return mergeConfig(
|
|
40
39
|
defineViteConfig({
|
|
41
40
|
build: {
|
|
@@ -8,26 +8,34 @@ import { UserConfig } from 'vite';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function definePluginViteConfig(opts?: UserConfig): UserConfig;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* 设计界面插件构建配置
|
|
12
12
|
*
|
|
13
13
|
* @export
|
|
14
14
|
* @param {UserConfig} [opts={}]
|
|
15
|
-
* @
|
|
15
|
+
* @return {*} {UserConfig}
|
|
16
16
|
*/
|
|
17
17
|
export declare function defineDesignPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 设计界面插件构建配置
|
|
20
20
|
*
|
|
21
21
|
* @export
|
|
22
22
|
* @param {UserConfig} [opts={}]
|
|
23
|
-
* @
|
|
23
|
+
* @return {*} {UserConfig}
|
|
24
24
|
*/
|
|
25
25
|
export declare function defineMobilePluginViteConfig(opts?: UserConfig): UserConfig;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 设计界面插件构建配置
|
|
28
28
|
*
|
|
29
29
|
* @export
|
|
30
30
|
* @param {UserConfig} [opts={}]
|
|
31
|
-
* @
|
|
31
|
+
* @return {*} {UserConfig}
|
|
32
|
+
*/
|
|
33
|
+
export declare function definePadPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
34
|
+
/**
|
|
35
|
+
* 设计界面插件构建配置
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @param {UserConfig} [opts={}]
|
|
39
|
+
* @return {*} {UserConfig}
|
|
32
40
|
*/
|
|
33
41
|
export declare function defineWebPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
@@ -1,150 +1,85 @@
|
|
|
1
1
|
import { mergeConfig } from "vite";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { federation } from "@module-federation/vite";
|
|
4
3
|
import { defineViteBaseConfig } from "./vite-base-config.mjs";
|
|
5
4
|
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
6
|
-
|
|
7
|
-
function importMapExternalPlugin(modules) {
|
|
8
|
-
return {
|
|
9
|
-
name: "vite-plugin-importmap-external",
|
|
10
|
-
enforce: "pre",
|
|
11
|
-
resolveId(id) {
|
|
12
|
-
if (modules.includes(id) || modules.some((m) => id.startsWith(m + "/"))) {
|
|
13
|
-
return { id, external: true };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
5
|
+
import { importMapExternalPlugin } from "../vite-plugins/imnport-external-plugin.mjs";
|
|
18
6
|
export function definePluginViteConfig(opts = {}) {
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
const entry = path.resolve(cwd, "src/index.ts");
|
|
9
|
+
const loaderEntry = path.resolve(cwd, "src/loader.ts");
|
|
10
|
+
const isProd = process.env.NODE_ENV === "production";
|
|
19
11
|
return mergeConfig(
|
|
20
12
|
defineViteBaseConfig({
|
|
21
|
-
base: "/plugin-design/",
|
|
22
|
-
server: {
|
|
23
|
-
host: "0.0.0.0",
|
|
24
|
-
port: 7001,
|
|
25
|
-
allowedHosts: true
|
|
26
|
-
},
|
|
27
13
|
optimizeDeps: {
|
|
28
14
|
exclude: DEFAULT_EXTERNAL
|
|
29
15
|
},
|
|
16
|
+
build: {
|
|
17
|
+
lib: {
|
|
18
|
+
entry: isProd ? loaderEntry : entry,
|
|
19
|
+
formats: ["es"],
|
|
20
|
+
cssFileName: "index.min",
|
|
21
|
+
fileName: "[name].[format].min"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
30
24
|
plugins: [
|
|
31
|
-
importMapExternalPlugin(DEFAULT_EXTERNAL)
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(match, specifier) => {
|
|
42
|
-
const decoded = decodeURIComponent(specifier);
|
|
43
|
-
if (DEFAULT_EXTERNAL.some(
|
|
44
|
-
(m) => decoded === m || decoded.startsWith(m + "/")
|
|
45
|
-
)) {
|
|
46
|
-
return `"${decoded}"`;
|
|
47
|
-
}
|
|
48
|
-
return match;
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
federation({
|
|
54
|
-
name: "gct-paas-plugin",
|
|
55
|
-
filename: "remoteEntry.js",
|
|
56
|
-
dts: false,
|
|
57
|
-
exposes: {
|
|
58
|
-
".": "./src/index.ts"
|
|
59
|
-
}
|
|
60
|
-
})
|
|
25
|
+
...importMapExternalPlugin(DEFAULT_EXTERNAL)
|
|
26
|
+
// federation({
|
|
27
|
+
// name: 'gct-paas-plugin',
|
|
28
|
+
// filename: 'remoteEntry.js',
|
|
29
|
+
// dts: false,
|
|
30
|
+
// manifest: true,
|
|
31
|
+
// exposes: {
|
|
32
|
+
// '.': './src/index.ts',
|
|
33
|
+
// },
|
|
34
|
+
// }),
|
|
61
35
|
]
|
|
62
36
|
}),
|
|
63
37
|
opts
|
|
64
38
|
);
|
|
65
39
|
}
|
|
66
|
-
function formatFileName(format) {
|
|
67
|
-
return `[name].${format}.min.js`;
|
|
68
|
-
}
|
|
69
|
-
function assetFileNames(assetInfo, name) {
|
|
70
|
-
if (assetInfo.names.length > 0 && assetInfo.names[0].endsWith(".css")) {
|
|
71
|
-
return name + ".min.css";
|
|
72
|
-
}
|
|
73
|
-
return assetInfo.names[0];
|
|
74
|
-
}
|
|
75
40
|
export function defineDesignPluginViteConfig(opts = {}) {
|
|
76
|
-
const cwd = process.cwd();
|
|
77
|
-
const designEntry = path.resolve(cwd, "src/index.ts");
|
|
78
41
|
return mergeConfig(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
assetFileNames: (assetInfo) => {
|
|
85
|
-
return assetFileNames(assetInfo, "design");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
lib: {
|
|
90
|
-
entry: {
|
|
91
|
-
design: designEntry
|
|
92
|
-
},
|
|
93
|
-
formats,
|
|
94
|
-
fileName: formatFileName
|
|
95
|
-
}
|
|
42
|
+
definePluginViteConfig({
|
|
43
|
+
server: {
|
|
44
|
+
port: 7001,
|
|
45
|
+
host: "0.0.0.0",
|
|
46
|
+
allowedHosts: true
|
|
96
47
|
}
|
|
97
48
|
}),
|
|
98
49
|
opts
|
|
99
50
|
);
|
|
100
51
|
}
|
|
101
52
|
export function defineMobilePluginViteConfig(opts = {}) {
|
|
102
|
-
const cwd = process.cwd();
|
|
103
|
-
const mobileEntry = path.resolve(cwd, "src/index.ts");
|
|
104
53
|
return mergeConfig(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
54
|
+
definePluginViteConfig({
|
|
55
|
+
server: {
|
|
56
|
+
port: 7002,
|
|
57
|
+
host: "0.0.0.0",
|
|
58
|
+
allowedHosts: true
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
opts
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export function definePadPluginViteConfig(opts = {}) {
|
|
65
|
+
return mergeConfig(
|
|
66
|
+
definePluginViteConfig({
|
|
67
|
+
server: {
|
|
68
|
+
port: 7003,
|
|
69
|
+
host: "0.0.0.0",
|
|
70
|
+
allowedHosts: true
|
|
122
71
|
}
|
|
123
72
|
}),
|
|
124
73
|
opts
|
|
125
74
|
);
|
|
126
75
|
}
|
|
127
76
|
export function defineWebPluginViteConfig(opts = {}) {
|
|
128
|
-
const cwd = process.cwd();
|
|
129
|
-
const webEntry = path.resolve(cwd, "src/index.ts");
|
|
130
77
|
return mergeConfig(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
assetFileNames: (assetInfo) => {
|
|
137
|
-
return assetFileNames(assetInfo, "web");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
lib: {
|
|
142
|
-
entry: {
|
|
143
|
-
web: webEntry
|
|
144
|
-
},
|
|
145
|
-
formats,
|
|
146
|
-
fileName: formatFileName
|
|
147
|
-
}
|
|
78
|
+
definePluginViteConfig({
|
|
79
|
+
server: {
|
|
80
|
+
port: 7004,
|
|
81
|
+
host: "0.0.0.0",
|
|
82
|
+
allowedHosts: true
|
|
148
83
|
}
|
|
149
84
|
}),
|
|
150
85
|
opts
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 在 dev 模式下:告诉 Rollup/Rolldown 指定模块是 external
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {string[]} modules
|
|
6
|
+
* @return {*}
|
|
7
|
+
*/
|
|
8
|
+
export declare function importMapExternalPlugin(modules: string[]): {
|
|
9
|
+
name: string;
|
|
10
|
+
apply: "serve";
|
|
11
|
+
enforce: "pre";
|
|
12
|
+
resolveId(id: string): {
|
|
13
|
+
id: string;
|
|
14
|
+
external: boolean;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/build",
|
|
3
|
-
"version": "0.1.6-dev.
|
|
3
|
+
"version": "0.1.6-dev.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@commitlint/config-conventional": "^20.4.4",
|
|
44
44
|
"@eslint/config-helpers": "^0.5.3",
|
|
45
45
|
"@eslint/js": "^9.39.4",
|
|
46
|
-
"@gct-paas/scss": "
|
|
46
|
+
"@gct-paas/scss": "latest",
|
|
47
47
|
"@inquirer/prompts": "^8.3.0",
|
|
48
48
|
"@module-federation/vite": "^1.13.0",
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"stylelint-scss": "~6.14.0",
|
|
78
78
|
"typescript-eslint": "^8.57.0",
|
|
79
79
|
"unocss": "66.6.6",
|
|
80
|
-
"vite": "^8.0.
|
|
80
|
+
"vite": "^8.0.1",
|
|
81
81
|
"vite-plugin-dts": "^4.5.4",
|
|
82
82
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
83
83
|
"vite-plugin-static-copy": "^3.3.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@gct-paas/scss": "*"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "2e48c22f823afd42f491f0df915aeca837964f19"
|
|
103
103
|
}
|