@gct-paas/build 0.1.6-dev.4 → 0.1.6-dev.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/dist/stylelint/stylelint-config/stylelint-config.cjs +1 -1
- package/dist/vite/index.cjs +6 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/vite-config/vite-config.cjs +13 -6
- package/dist/vite/vite-config/vite-config.d.ts +7 -0
- package/dist/vite/vite-config/vite-plugin-config.cjs +54 -1
- package/dist/vite/vite-config/vite-plugin-config.d.ts +8 -0
- package/es/stylelint/stylelint-config/stylelint-config.mjs +4 -1
- package/es/vite/index.d.ts +1 -1
- package/es/vite/index.mjs +1 -0
- package/es/vite/vite-config/vite-config.d.ts +7 -0
- package/es/vite/vite-config/vite-config.mjs +16 -11
- package/es/vite/vite-config/vite-plugin-config.d.ts +8 -0
- package/es/vite/vite-config/vite-plugin-config.mjs +62 -1
- package/package.json +10 -5
|
@@ -7,7 +7,7 @@ exports.defineStylelintConfig = defineStylelintConfig;
|
|
|
7
7
|
var _lodashEs = require("lodash-es");
|
|
8
8
|
function defineStylelintConfig(config = {}) {
|
|
9
9
|
return (0, _lodashEs.merge)({
|
|
10
|
-
extends: ["stylelint-config-standard", "stylelint-config-
|
|
10
|
+
extends: ["stylelint-config-standard-scss", "stylelint-config-recess-order"],
|
|
11
11
|
rules: {
|
|
12
12
|
"annotation-no-unknown": null,
|
|
13
13
|
"color-no-invalid-hex": true,
|
package/dist/vite/index.cjs
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "definePkgDevViteConfig", {
|
|
|
33
33
|
return _vitePkgDevConfig.definePkgDevViteConfig;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "definePluginViteConfig", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _vitePluginConfig.definePluginViteConfig;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "defineProjectViteConfig", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
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 { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
6
6
|
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
|
@@ -18,6 +18,16 @@ function defineViteConfig(opts = {}) {
|
|
|
18
18
|
rf.sync(outDir);
|
|
19
19
|
return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)((0, _vite.defineConfig)({
|
|
20
20
|
build: {
|
|
21
|
+
minify: "terser",
|
|
22
|
+
terserOptions: {
|
|
23
|
+
compress: {
|
|
24
|
+
drop_console: false,
|
|
25
|
+
dead_code: true,
|
|
26
|
+
unused: true,
|
|
27
|
+
passes: 2
|
|
28
|
+
},
|
|
29
|
+
mangle: true
|
|
30
|
+
},
|
|
21
31
|
lib: {
|
|
22
32
|
entry: _path.default.resolve(cwd, "src/index.ts"),
|
|
23
33
|
formats: ["es"],
|
|
@@ -31,14 +41,11 @@ function defineLoaderViteConfig(opts = {}) {
|
|
|
31
41
|
const cwd = process.cwd();
|
|
32
42
|
const outDir = _path.default.resolve(cwd, "dist");
|
|
33
43
|
rf.sync(outDir);
|
|
34
|
-
return (0, _vite.mergeConfig)((
|
|
44
|
+
return (0, _vite.mergeConfig)(defineViteConfig({
|
|
35
45
|
build: {
|
|
36
46
|
lib: {
|
|
37
|
-
entry: _path.default.resolve(cwd, "src/loader.ts")
|
|
38
|
-
formats: ["es"],
|
|
39
|
-
cssFileName: "index.min",
|
|
40
|
-
fileName: "[name].[format].min"
|
|
47
|
+
entry: _path.default.resolve(cwd, "src/loader.ts")
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
|
-
})
|
|
50
|
+
}), opts);
|
|
44
51
|
}
|
|
@@ -7,4 +7,11 @@ import { UserConfig } from 'vite';
|
|
|
7
7
|
* @returns {*} {UserConfig}
|
|
8
8
|
*/
|
|
9
9
|
export declare function defineViteConfig(opts?: UserConfig): UserConfig;
|
|
10
|
+
/**
|
|
11
|
+
* 构建 loader 模块的 vite 配置,基于此配置构建基于 index 模式下的上层样式加载封装
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @param {UserConfig} [opts={}]
|
|
15
|
+
* @return {*} {UserConfig}
|
|
16
|
+
*/
|
|
10
17
|
export declare function defineLoaderViteConfig(opts?: UserConfig): UserConfig;
|
|
@@ -5,12 +5,65 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defineDesignPluginViteConfig = defineDesignPluginViteConfig;
|
|
7
7
|
exports.defineMobilePluginViteConfig = defineMobilePluginViteConfig;
|
|
8
|
+
exports.definePluginViteConfig = definePluginViteConfig;
|
|
8
9
|
exports.defineWebPluginViteConfig = defineWebPluginViteConfig;
|
|
9
10
|
var _vite = require("vite");
|
|
10
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
+
var _vite2 = require("@module-federation/vite");
|
|
11
13
|
var _viteBaseConfig = require("./vite-base-config.cjs");
|
|
14
|
+
var _constants = require("../../constants/index.cjs");
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const formats = ["
|
|
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
|
+
function definePluginViteConfig(opts = {}) {
|
|
32
|
+
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
|
+
optimizeDeps: {
|
|
40
|
+
exclude: _constants.DEFAULT_EXTERNAL
|
|
41
|
+
},
|
|
42
|
+
plugins: [importMapExternalPlugin(_constants.DEFAULT_EXTERNAL), {
|
|
43
|
+
// Dev 模式:vite:import-analysis 把裸模块改成了 `<base>/@id/<module>`
|
|
44
|
+
// 这里再把它还原成裸说明符,让浏览器的 importmap 接管
|
|
45
|
+
name: "vite-plugin-importmap-external-dev",
|
|
46
|
+
enforce: "post",
|
|
47
|
+
apply: "serve",
|
|
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"
|
|
63
|
+
}
|
|
64
|
+
})]
|
|
65
|
+
}), opts);
|
|
66
|
+
}
|
|
14
67
|
function formatFileName(format) {
|
|
15
68
|
return `[name].${format}.min.js`;
|
|
16
69
|
}
|
|
@@ -2,7 +2,10 @@ import { merge } from "lodash-es";
|
|
|
2
2
|
export function defineStylelintConfig(config = {}) {
|
|
3
3
|
return merge(
|
|
4
4
|
{
|
|
5
|
-
extends: [
|
|
5
|
+
extends: [
|
|
6
|
+
"stylelint-config-standard-scss",
|
|
7
|
+
"stylelint-config-recess-order"
|
|
8
|
+
],
|
|
6
9
|
rules: {
|
|
7
10
|
"annotation-no-unknown": null,
|
|
8
11
|
"color-no-invalid-hex": true,
|
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 { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { definePluginViteConfig, defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
6
6
|
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
package/es/vite/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ export { defineViteConfig, defineLoaderViteConfig } from "./vite-config/vite-con
|
|
|
3
3
|
export { defineDevViteConfig } from "./vite-config/vite-dev-config.mjs";
|
|
4
4
|
export { definePkgDevViteConfig } from "./vite-config/vite-pkg-dev-config.mjs";
|
|
5
5
|
export {
|
|
6
|
+
definePluginViteConfig,
|
|
6
7
|
defineDesignPluginViteConfig,
|
|
7
8
|
defineMobilePluginViteConfig,
|
|
8
9
|
defineWebPluginViteConfig
|
|
@@ -7,4 +7,11 @@ import { UserConfig } from 'vite';
|
|
|
7
7
|
* @returns {*} {UserConfig}
|
|
8
8
|
*/
|
|
9
9
|
export declare function defineViteConfig(opts?: UserConfig): UserConfig;
|
|
10
|
+
/**
|
|
11
|
+
* 构建 loader 模块的 vite 配置,基于此配置构建基于 index 模式下的上层样式加载封装
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @param {UserConfig} [opts={}]
|
|
15
|
+
* @return {*} {UserConfig}
|
|
16
|
+
*/
|
|
10
17
|
export declare function defineLoaderViteConfig(opts?: UserConfig): UserConfig;
|
|
@@ -10,6 +10,16 @@ export function defineViteConfig(opts = {}) {
|
|
|
10
10
|
defineViteBaseConfig(
|
|
11
11
|
defineConfig({
|
|
12
12
|
build: {
|
|
13
|
+
minify: "terser",
|
|
14
|
+
terserOptions: {
|
|
15
|
+
compress: {
|
|
16
|
+
drop_console: false,
|
|
17
|
+
dead_code: true,
|
|
18
|
+
unused: true,
|
|
19
|
+
passes: 2
|
|
20
|
+
},
|
|
21
|
+
mangle: true
|
|
22
|
+
},
|
|
13
23
|
lib: {
|
|
14
24
|
entry: path.resolve(cwd, "src/index.ts"),
|
|
15
25
|
formats: ["es"],
|
|
@@ -27,18 +37,13 @@ export function defineLoaderViteConfig(opts = {}) {
|
|
|
27
37
|
const outDir = path.resolve(cwd, "dist");
|
|
28
38
|
rf.sync(outDir);
|
|
29
39
|
return mergeConfig(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
entry: path.resolve(cwd, "src/loader.ts"),
|
|
35
|
-
formats: ["es"],
|
|
36
|
-
cssFileName: "index.min",
|
|
37
|
-
fileName: "[name].[format].min"
|
|
38
|
-
}
|
|
40
|
+
defineViteConfig({
|
|
41
|
+
build: {
|
|
42
|
+
lib: {
|
|
43
|
+
entry: path.resolve(cwd, "src/loader.ts")
|
|
39
44
|
}
|
|
40
|
-
}
|
|
41
|
-
),
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
42
47
|
opts
|
|
43
48
|
);
|
|
44
49
|
}
|
|
@@ -1,7 +1,68 @@
|
|
|
1
1
|
import { mergeConfig } from "vite";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import { federation } from "@module-federation/vite";
|
|
3
4
|
import { defineViteBaseConfig } from "./vite-base-config.mjs";
|
|
4
|
-
|
|
5
|
+
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
6
|
+
const formats = ["es"];
|
|
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
|
+
}
|
|
18
|
+
export function definePluginViteConfig(opts = {}) {
|
|
19
|
+
return mergeConfig(
|
|
20
|
+
defineViteBaseConfig({
|
|
21
|
+
base: "/plugin-design/",
|
|
22
|
+
server: {
|
|
23
|
+
host: "0.0.0.0",
|
|
24
|
+
port: 7001,
|
|
25
|
+
allowedHosts: true
|
|
26
|
+
},
|
|
27
|
+
optimizeDeps: {
|
|
28
|
+
exclude: DEFAULT_EXTERNAL
|
|
29
|
+
},
|
|
30
|
+
plugins: [
|
|
31
|
+
importMapExternalPlugin(DEFAULT_EXTERNAL),
|
|
32
|
+
{
|
|
33
|
+
// Dev 模式:vite:import-analysis 把裸模块改成了 `<base>/@id/<module>`
|
|
34
|
+
// 这里再把它还原成裸说明符,让浏览器的 importmap 接管
|
|
35
|
+
name: "vite-plugin-importmap-external-dev",
|
|
36
|
+
enforce: "post",
|
|
37
|
+
apply: "serve",
|
|
38
|
+
transform(code) {
|
|
39
|
+
return code.replace(
|
|
40
|
+
/"[^"]*\/@id\/([^"]+)"/g,
|
|
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
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}),
|
|
63
|
+
opts
|
|
64
|
+
);
|
|
65
|
+
}
|
|
5
66
|
function formatFileName(format) {
|
|
6
67
|
return `[name].${format}.min.js`;
|
|
7
68
|
}
|
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.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -71,8 +71,10 @@
|
|
|
71
71
|
"prettier": "^3.8.1",
|
|
72
72
|
"rimraf": "^6.1.3",
|
|
73
73
|
"sass": "^1.98.0",
|
|
74
|
-
"stylelint": "
|
|
75
|
-
"stylelint-config-
|
|
74
|
+
"stylelint": "~16.26.1",
|
|
75
|
+
"stylelint-config-recess-order": "~7.4.0",
|
|
76
|
+
"stylelint-config-standard-scss": "~16.0.0",
|
|
77
|
+
"stylelint-scss": "~6.14.0",
|
|
76
78
|
"typescript-eslint": "^8.57.0",
|
|
77
79
|
"unocss": "66.6.6",
|
|
78
80
|
"vite": "^8.0.0",
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
81
83
|
"vite-plugin-static-copy": "^3.3.0",
|
|
82
84
|
"vue-eslint-parser": "^10.4.0",
|
|
83
|
-
"vue-tsc": "^3.2.
|
|
85
|
+
"vue-tsc": "^3.2.6"
|
|
84
86
|
},
|
|
85
87
|
"devDependencies": {
|
|
86
88
|
"@commitlint/types": "^20.4.4",
|
|
@@ -94,5 +96,8 @@
|
|
|
94
96
|
"typescript": "^5.9.3",
|
|
95
97
|
"unbuild": "^3.6.1"
|
|
96
98
|
},
|
|
97
|
-
"
|
|
99
|
+
"peerDependencies": {
|
|
100
|
+
"@gct-paas/scss": "*"
|
|
101
|
+
},
|
|
102
|
+
"gitHead": "6385e29b22a78c9971112aa313aa5c4154b8d0e5"
|
|
98
103
|
}
|