@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
package/dist/constants/index.cjs
CHANGED
|
@@ -3,8 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PROD_MODE = exports.DEV_MODE = exports.
|
|
6
|
+
exports.PROD_MODE = exports.DEV_MODE = exports.DEFAULT_EXTERNAL = void 0;
|
|
7
7
|
const DEV_MODE = exports.DEV_MODE = "development";
|
|
8
8
|
const PROD_MODE = exports.PROD_MODE = "production";
|
|
9
|
-
const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = [
|
|
10
|
-
|
|
9
|
+
const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = [
|
|
10
|
+
// vue 相关依赖
|
|
11
|
+
"vue", "vue-router", "vue-i18n", "pinia",
|
|
12
|
+
// 第三方依赖
|
|
13
|
+
"axios", "dayjs", "lodash-es", "qs", "bignumber.js", "wujie", "sql-formatter", "mqtt", "@fingerprintjs/fingerprintjs", "overlayscrollbars", "@jsplumb/browser-ui", "sortablejs", "bwip-js", "interactjs",
|
|
14
|
+
// 组件库相关依赖
|
|
15
|
+
"vuedraggable", "vue-grid-layout", "vant", "ant-design-vue",
|
|
16
|
+
// 图标库相关依赖
|
|
17
|
+
"@ant-design/icons-vue", "@icon-park/vue-next/es/all", "@icon-park/vue-next/icons.json",
|
|
18
|
+
// @gct-paas 相关依赖
|
|
19
|
+
"@gct-paas/build", "@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/formula-editor", "@gct-paas/platform-icons"];
|
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,17 @@ Object.keys(_commitlint).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _constants = require("./constants/index.cjs");
|
|
18
|
+
Object.keys(_constants).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _constants[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
var _eslint = require("./eslint/index.cjs");
|
|
18
29
|
Object.keys(_eslint).forEach(function (key) {
|
|
19
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -36,17 +47,6 @@ Object.keys(_prettier).forEach(function (key) {
|
|
|
36
47
|
}
|
|
37
48
|
});
|
|
38
49
|
});
|
|
39
|
-
var _rollup = require("./rollup/index.cjs");
|
|
40
|
-
Object.keys(_rollup).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _rollup[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _rollup[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
50
|
var _stylelint = require("./stylelint/index.cjs");
|
|
51
51
|
Object.keys(_stylelint).forEach(function (key) {
|
|
52
52
|
if (key === "default" || key === "__esModule") return;
|
package/dist/index.d.ts
CHANGED
package/dist/vite/index.cjs
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "defineDevViteConfig", {
|
|
|
15
15
|
return _viteDevConfig.defineDevViteConfig;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "defineLoaderViteConfig", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _viteConfig.defineLoaderViteConfig;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "defineMobilePluginViteConfig", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
2
|
-
export { defineViteConfig } from './vite-config/vite-config';
|
|
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
5
|
export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
@@ -8,7 +8,6 @@ var _vite = require("vite");
|
|
|
8
8
|
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
9
9
|
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
10
10
|
var _vite2 = _interopRequireDefault(require("unocss/vite"));
|
|
11
|
-
var _viteTsconfigPaths = _interopRequireDefault(require("vite-tsconfig-paths"));
|
|
12
11
|
var _path = _interopRequireDefault(require("path"));
|
|
13
12
|
var _constants = require("../../constants/index.cjs");
|
|
14
13
|
var _util = require("../../util/index.cjs");
|
|
@@ -30,29 +29,8 @@ function defineViteBaseConfig(opts = {}) {
|
|
|
30
29
|
external: _constants.DEFAULT_EXTERNAL
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
|
-
plugins: [(0,
|
|
32
|
+
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)(), (0, _vite2.default)({
|
|
34
33
|
hmrTopLevelAwait: false
|
|
35
|
-
})
|
|
36
|
-
// 关系 babel 配置,这个配置要放在具体的 project vite 编译配置中,底包应该是干净的
|
|
37
|
-
// babel({
|
|
38
|
-
// babelHelpers: 'bundled',
|
|
39
|
-
// presets: [
|
|
40
|
-
// [
|
|
41
|
-
// '@babel/preset-env',
|
|
42
|
-
// {
|
|
43
|
-
// useBuiltIns: false,
|
|
44
|
-
// corejs: 3,
|
|
45
|
-
// bugfixes: true,
|
|
46
|
-
// targets: {
|
|
47
|
-
// chrome: '85',
|
|
48
|
-
// edge: '85',
|
|
49
|
-
// firefox: '79',
|
|
50
|
-
// safari: '14.1',
|
|
51
|
-
// },
|
|
52
|
-
// },
|
|
53
|
-
// ],
|
|
54
|
-
// ],
|
|
55
|
-
// }),
|
|
56
|
-
]
|
|
34
|
+
})]
|
|
57
35
|
}), opts);
|
|
58
36
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.defineLoaderViteConfig = defineLoaderViteConfig;
|
|
6
7
|
exports.defineViteConfig = defineViteConfig;
|
|
7
8
|
var _vite = require("vite");
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -17,27 +18,26 @@ function defineViteConfig(opts = {}) {
|
|
|
17
18
|
rf.sync(outDir);
|
|
18
19
|
return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)((0, _vite.defineConfig)({
|
|
19
20
|
build: {
|
|
20
|
-
rollupOptions: {
|
|
21
|
-
output: {
|
|
22
|
-
exports: "named"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
21
|
lib: {
|
|
26
22
|
entry: _path.default.resolve(cwd, "src/index.ts"),
|
|
27
|
-
formats: ["
|
|
23
|
+
formats: ["es"],
|
|
28
24
|
cssFileName: "index.min",
|
|
29
|
-
fileName
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
fileName: "[name].[format].min"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})), opts);
|
|
29
|
+
}
|
|
30
|
+
function defineLoaderViteConfig(opts = {}) {
|
|
31
|
+
const cwd = process.cwd();
|
|
32
|
+
const outDir = _path.default.resolve(cwd, "dist");
|
|
33
|
+
rf.sync(outDir);
|
|
34
|
+
return (0, _vite.mergeConfig)((0, _viteBaseConfig.defineViteBaseConfig)((0, _vite.defineConfig)({
|
|
35
|
+
build: {
|
|
36
|
+
lib: {
|
|
37
|
+
entry: _path.default.resolve(cwd, "src/loader.ts"),
|
|
38
|
+
formats: ["es"],
|
|
39
|
+
cssFileName: "index.min",
|
|
40
|
+
fileName: "[name].[format].min"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
})), opts);
|
|
@@ -7,7 +7,6 @@ exports.defineDevViteConfig = defineDevViteConfig;
|
|
|
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 _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
function defineDevViteConfig(opts = {}) {
|
|
13
12
|
return (0, _vite.mergeConfig)((0, _vite.defineConfig)({
|
|
@@ -18,6 +17,6 @@ function defineDevViteConfig(opts = {}) {
|
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
},
|
|
21
|
-
plugins: [(0,
|
|
20
|
+
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)()]
|
|
22
21
|
}), opts);
|
|
23
22
|
}
|
|
@@ -10,11 +10,9 @@ var rf = _interopRequireWildcard(require("rimraf"));
|
|
|
10
10
|
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
11
11
|
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
12
12
|
var _vitePluginLibInjectCss = require("vite-plugin-lib-inject-css");
|
|
13
|
-
var _viteTsconfigPaths = _interopRequireDefault(require("vite-tsconfig-paths"));
|
|
14
13
|
var _vitePluginStaticCopy = require("vite-plugin-static-copy");
|
|
15
14
|
var _vitePluginDts = _interopRequireDefault(require("vite-plugin-dts"));
|
|
16
15
|
var _fs = require("fs");
|
|
17
|
-
var _vite2 = _interopRequireDefault(require("unocss/vite"));
|
|
18
16
|
var _util = require("../../util/index.cjs");
|
|
19
17
|
var _constants = require("../../constants/index.cjs");
|
|
20
18
|
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); }
|
|
@@ -46,7 +44,7 @@ function definePkgDevViteConfig(opts = {}) {
|
|
|
46
44
|
target: "esnext",
|
|
47
45
|
minify: false,
|
|
48
46
|
sourcemap: isDev,
|
|
49
|
-
|
|
47
|
+
rolldownOptions: {
|
|
50
48
|
external: id => {
|
|
51
49
|
if (pkgDependencies.some(dep => id === dep || id.startsWith(dep + "/"))) {
|
|
52
50
|
return true;
|
|
@@ -73,9 +71,9 @@ function definePkgDevViteConfig(opts = {}) {
|
|
|
73
71
|
formats: ["es"]
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
|
-
plugins: [(0,
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)(),
|
|
75
|
+
// UnoCSS({ hmrTopLevelAwait: false }) as PluginOption,
|
|
76
|
+
(0, _vitePluginLibInjectCss.libInjectCss)(), (0, _vitePluginDts.default)({
|
|
79
77
|
outDir: [outDir],
|
|
80
78
|
compilerOptions: {
|
|
81
79
|
declarationMap: isDev
|
|
@@ -7,54 +7,26 @@ exports.defineProjectViteConfig = defineProjectViteConfig;
|
|
|
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 _pluginLegacy = _interopRequireDefault(require("@vitejs/plugin-legacy"));
|
|
11
10
|
var _vite2 = _interopRequireDefault(require("unocss/vite"));
|
|
12
11
|
var _path = _interopRequireDefault(require("path"));
|
|
13
12
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
14
|
-
var _simpleGit = require("simple-git");
|
|
15
13
|
var _util = require("../../util/index.cjs");
|
|
14
|
+
var _constants = require("../../constants/index.cjs");
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
|
|
18
|
-
httpProxyConfig: {
|
|
19
|
-
alpha: "http://paas.alpha.gct-paas.com",
|
|
20
|
-
beta: "http://paas.beta.gct-paas.com",
|
|
21
|
-
"paas-ai-dev": "http://paas.aidev.gct-paas.com",
|
|
22
|
-
"paas-dev": "http://paas.paasdev.gct-paas.com",
|
|
23
|
-
"paas-test": "http://paas.paastest.gct-paas.com",
|
|
24
|
-
"mom-dev": "http://paas.momdev.gct-paas.com",
|
|
25
|
-
"mom-test": "http://paas.momtest.gct-paas.com",
|
|
26
|
-
"ncdp-dev": "http://paas.ncdpdev.gct-paas.com",
|
|
27
|
-
"ncdp-test": "http://paas.ncdptest.gct-paas.com",
|
|
28
|
-
"ipaas-dev": "http://paas.ipaasdev.gct-paas.com",
|
|
29
|
-
"ipaas-test": "http://paas.ipaastest.gct-paas.com",
|
|
30
|
-
"edhr-dev": "http://paas.edhrdev.gct-paas.com",
|
|
31
|
-
"edhr-test": "http://paas.edhrtest.gct-paas.com",
|
|
32
|
-
"datav-dev": "http://paas.datavdev.gct-paas.com"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
36
|
-
const _gctOpts = (0, _util.mergeConfig)(gctOptsDefault, gctOpts);
|
|
16
|
+
function defineProjectViteConfig(opts = {}) {
|
|
37
17
|
return (0, _vite.defineConfig)(async () => {
|
|
38
18
|
const cwd = process.cwd();
|
|
39
19
|
const pkg = _fsExtra.default.readJsonSync(_path.default.resolve(cwd, "package.json"));
|
|
40
|
-
const git = (0, _simpleGit.simpleGit)({
|
|
41
|
-
baseDir: cwd
|
|
42
|
-
});
|
|
43
|
-
const branchSummary = await git.branch();
|
|
44
|
-
const httpProxyKey = Object.keys(_gctOpts.httpProxyConfig).find(key => {
|
|
45
|
-
return key.startsWith(branchSummary.current);
|
|
46
|
-
}) || "paas-test";
|
|
47
|
-
const httpProxy = _gctOpts.httpProxyConfig[httpProxyKey];
|
|
48
20
|
return (0, _util.mergeConfig)({
|
|
49
|
-
base: "./",
|
|
50
21
|
resolve: {
|
|
51
22
|
alias: {
|
|
52
|
-
"
|
|
23
|
+
"@/*": "src/*"
|
|
53
24
|
}
|
|
54
25
|
},
|
|
26
|
+
base: "./",
|
|
55
27
|
build: {
|
|
56
|
-
|
|
57
|
-
external:
|
|
28
|
+
rolldownOptions: {
|
|
29
|
+
external: _constants.DEFAULT_EXTERNAL
|
|
58
30
|
}
|
|
59
31
|
},
|
|
60
32
|
css: {
|
|
@@ -72,11 +44,7 @@ function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
|
72
44
|
strict: false
|
|
73
45
|
},
|
|
74
46
|
proxy: {
|
|
75
|
-
hostname: "0.0.0.0"
|
|
76
|
-
...["/gct-platform", "/gct-apaas", "/gct-ipaas", "/minio"].reduce((acc, item) => {
|
|
77
|
-
acc[item] = httpProxy;
|
|
78
|
-
return acc;
|
|
79
|
-
}, {})
|
|
47
|
+
hostname: "0.0.0.0"
|
|
80
48
|
}
|
|
81
49
|
},
|
|
82
50
|
define: {
|
|
@@ -87,11 +55,6 @@ function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
|
87
55
|
},
|
|
88
56
|
plugins: [(0, _pluginVue.default)(), (0, _pluginVueJsx.default)(), (0, _vite2.default)({
|
|
89
57
|
hmrTopLevelAwait: false
|
|
90
|
-
}), (0, _pluginLegacy.default)({
|
|
91
|
-
targets: ["chrome>=85", "edge>=85", "firefox>=79", "safari>=14.1"],
|
|
92
|
-
externalSystemJS: true,
|
|
93
|
-
// 关键配置:false 时只生成 legacy 版本
|
|
94
|
-
renderModernChunks: true
|
|
95
58
|
})]
|
|
96
59
|
}, opts);
|
|
97
60
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UserConfig, UserConfigFnPromise } from 'vite';
|
|
2
|
-
import { GctOpts } from '../gct-opts.interface';
|
|
3
2
|
/**
|
|
4
3
|
* 构建本地开发 project 项目 vite 通用配置,基于此配置构建其他 vite 配置
|
|
5
4
|
* 参数合并时,数组会被合并而不是被替换
|
|
@@ -10,4 +9,4 @@ import { GctOpts } from '../gct-opts.interface';
|
|
|
10
9
|
* @param {UserConfig} [opts={}]
|
|
11
10
|
* @returns {*} {Promise<UserConfig>}
|
|
12
11
|
*/
|
|
13
|
-
export declare function defineProjectViteConfig(
|
|
12
|
+
export declare function defineProjectViteConfig(opts?: UserConfig): UserConfigFnPromise;
|
package/es/constants/index.d.ts
CHANGED
package/es/constants/index.mjs
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
export const DEV_MODE = "development";
|
|
2
2
|
export const PROD_MODE = "production";
|
|
3
3
|
export const DEFAULT_EXTERNAL = [
|
|
4
|
+
// vue 相关依赖
|
|
4
5
|
"vue",
|
|
5
6
|
"vue-router",
|
|
6
7
|
"vue-i18n",
|
|
8
|
+
"pinia",
|
|
9
|
+
// 第三方依赖
|
|
7
10
|
"axios",
|
|
8
11
|
"dayjs",
|
|
9
12
|
"lodash-es",
|
|
10
13
|
"qs",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
14
|
+
"bignumber.js",
|
|
15
|
+
"wujie",
|
|
16
|
+
"sql-formatter",
|
|
17
|
+
"mqtt",
|
|
18
|
+
"@fingerprintjs/fingerprintjs",
|
|
19
|
+
"overlayscrollbars",
|
|
20
|
+
"@jsplumb/browser-ui",
|
|
13
21
|
"sortablejs",
|
|
22
|
+
"bwip-js",
|
|
23
|
+
"interactjs",
|
|
24
|
+
// 组件库相关依赖
|
|
25
|
+
"vuedraggable",
|
|
14
26
|
"vue-grid-layout",
|
|
15
27
|
"vant",
|
|
16
28
|
"ant-design-vue",
|
|
29
|
+
// 图标库相关依赖
|
|
30
|
+
"@ant-design/icons-vue",
|
|
31
|
+
"@icon-park/vue-next/es/all",
|
|
32
|
+
"@icon-park/vue-next/icons.json",
|
|
33
|
+
// @gct-paas 相关依赖
|
|
17
34
|
"@gct-paas/build",
|
|
18
35
|
"@gct-paas/api",
|
|
19
36
|
"@gct-paas/core",
|
|
@@ -24,10 +41,12 @@ export const DEFAULT_EXTERNAL = [
|
|
|
24
41
|
"@gct-paas/design-mobile",
|
|
25
42
|
"@gct-paas/design-web",
|
|
26
43
|
"@gct-paas/design-pad",
|
|
27
|
-
"@gct-paas/
|
|
44
|
+
"@gct-paas/render",
|
|
45
|
+
"@gct-paas/render-mobile",
|
|
46
|
+
"@gct-paas/render-pad",
|
|
47
|
+
"@gct-paas/render-web",
|
|
48
|
+
"@gct-paas/schema",
|
|
28
49
|
"@gct-paas/scss",
|
|
29
|
-
"@gct-paas/
|
|
30
|
-
"@gct-paas/
|
|
31
|
-
"systemjs"
|
|
50
|
+
"@gct-paas/formula-editor",
|
|
51
|
+
"@gct-paas/platform-icons"
|
|
32
52
|
];
|
|
33
|
-
export const DEFAULT_IGNORED_DEPENDENCIES = ["path-browserify", "qx-util"];
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./commitlint/index.mjs";
|
|
2
|
+
export * from "./constants/index.mjs";
|
|
2
3
|
export * from "./eslint/index.mjs";
|
|
3
4
|
export * from "./prettier/index.mjs";
|
|
4
|
-
export * from "./rollup/index.mjs";
|
|
5
5
|
export * from "./stylelint/index.mjs";
|
|
6
6
|
export * from "./unocss/index.mjs";
|
|
7
7
|
export * from "./util/index.mjs";
|
package/es/vite/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
2
|
-
export { defineViteConfig } from './vite-config/vite-config';
|
|
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
5
|
export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
package/es/vite/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineViteBaseConfig } from "./vite-config/vite-base-config.mjs";
|
|
2
|
-
export { defineViteConfig } from "./vite-config/vite-config.mjs";
|
|
2
|
+
export { defineViteConfig, defineLoaderViteConfig } from "./vite-config/vite-config.mjs";
|
|
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 {
|
|
@@ -2,7 +2,6 @@ import { defineConfig } from "vite";
|
|
|
2
2
|
import vue from "@vitejs/plugin-vue";
|
|
3
3
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
4
|
import UnoCSS from "unocss/vite";
|
|
5
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
6
5
|
import path from "path";
|
|
7
6
|
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
8
7
|
import { mergeConfig } from "../../util/index.mjs";
|
|
@@ -25,30 +24,9 @@ export function defineViteBaseConfig(opts = {}) {
|
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
26
|
plugins: [
|
|
28
|
-
tsconfigPaths(),
|
|
29
27
|
vue(),
|
|
30
28
|
vueJsx(),
|
|
31
29
|
UnoCSS({ hmrTopLevelAwait: false })
|
|
32
|
-
// 关系 babel 配置,这个配置要放在具体的 project vite 编译配置中,底包应该是干净的
|
|
33
|
-
// babel({
|
|
34
|
-
// babelHelpers: 'bundled',
|
|
35
|
-
// presets: [
|
|
36
|
-
// [
|
|
37
|
-
// '@babel/preset-env',
|
|
38
|
-
// {
|
|
39
|
-
// useBuiltIns: false,
|
|
40
|
-
// corejs: 3,
|
|
41
|
-
// bugfixes: true,
|
|
42
|
-
// targets: {
|
|
43
|
-
// chrome: '85',
|
|
44
|
-
// edge: '85',
|
|
45
|
-
// firefox: '79',
|
|
46
|
-
// safari: '14.1',
|
|
47
|
-
// },
|
|
48
|
-
// },
|
|
49
|
-
// ],
|
|
50
|
-
// ],
|
|
51
|
-
// }),
|
|
52
30
|
]
|
|
53
31
|
}),
|
|
54
32
|
opts
|
|
@@ -10,27 +10,31 @@ export function defineViteConfig(opts = {}) {
|
|
|
10
10
|
defineViteBaseConfig(
|
|
11
11
|
defineConfig({
|
|
12
12
|
build: {
|
|
13
|
-
rollupOptions: {
|
|
14
|
-
output: {
|
|
15
|
-
exports: "named"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
13
|
lib: {
|
|
19
14
|
entry: path.resolve(cwd, "src/index.ts"),
|
|
20
|
-
formats: ["
|
|
15
|
+
formats: ["es"],
|
|
21
16
|
cssFileName: "index.min",
|
|
22
|
-
fileName
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
fileName: "[name].[format].min"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
),
|
|
22
|
+
opts
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export function defineLoaderViteConfig(opts = {}) {
|
|
26
|
+
const cwd = process.cwd();
|
|
27
|
+
const outDir = path.resolve(cwd, "dist");
|
|
28
|
+
rf.sync(outDir);
|
|
29
|
+
return mergeConfig(
|
|
30
|
+
defineViteBaseConfig(
|
|
31
|
+
defineConfig({
|
|
32
|
+
build: {
|
|
33
|
+
lib: {
|
|
34
|
+
entry: path.resolve(cwd, "src/loader.ts"),
|
|
35
|
+
formats: ["es"],
|
|
36
|
+
cssFileName: "index.min",
|
|
37
|
+
fileName: "[name].[format].min"
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig, mergeConfig } from "vite";
|
|
2
2
|
import vue from "@vitejs/plugin-vue";
|
|
3
3
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
|
-
import json from "@rollup/plugin-json";
|
|
5
4
|
export function defineDevViteConfig(opts = {}) {
|
|
6
5
|
return mergeConfig(
|
|
7
6
|
defineConfig({
|
|
@@ -12,7 +11,7 @@ export function defineDevViteConfig(opts = {}) {
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
|
-
plugins: [
|
|
14
|
+
plugins: [vue(), vueJsx()]
|
|
16
15
|
}),
|
|
17
16
|
opts
|
|
18
17
|
);
|
|
@@ -4,11 +4,9 @@ import * as rf from "rimraf";
|
|
|
4
4
|
import vue from "@vitejs/plugin-vue";
|
|
5
5
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
6
6
|
import { libInjectCss } from "vite-plugin-lib-inject-css";
|
|
7
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
8
7
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
9
8
|
import dts from "vite-plugin-dts";
|
|
10
9
|
import { readFileSync } from "fs";
|
|
11
|
-
import UnoCSS from "unocss/vite";
|
|
12
10
|
import { mergeConfig, IS_NODE_MODULE } from "../../util/index.mjs";
|
|
13
11
|
import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
|
|
14
12
|
export function definePkgDevViteConfig(opts = {}) {
|
|
@@ -38,7 +36,7 @@ export function definePkgDevViteConfig(opts = {}) {
|
|
|
38
36
|
target: "esnext",
|
|
39
37
|
minify: false,
|
|
40
38
|
sourcemap: isDev,
|
|
41
|
-
|
|
39
|
+
rolldownOptions: {
|
|
42
40
|
external: (id) => {
|
|
43
41
|
if (pkgDependencies.some(
|
|
44
42
|
(dep) => id === dep || id.startsWith(dep + "/")
|
|
@@ -66,10 +64,9 @@ export function definePkgDevViteConfig(opts = {}) {
|
|
|
66
64
|
}
|
|
67
65
|
},
|
|
68
66
|
plugins: [
|
|
69
|
-
tsconfigPaths(),
|
|
70
67
|
vue(),
|
|
71
68
|
vueJsx(),
|
|
72
|
-
UnoCSS({ hmrTopLevelAwait: false }),
|
|
69
|
+
// UnoCSS({ hmrTopLevelAwait: false }) as PluginOption,
|
|
73
70
|
libInjectCss(),
|
|
74
71
|
dts({
|
|
75
72
|
outDir: [outDir],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UserConfig, UserConfigFnPromise } from 'vite';
|
|
2
|
-
import { GctOpts } from '../gct-opts.interface';
|
|
3
2
|
/**
|
|
4
3
|
* 构建本地开发 project 项目 vite 通用配置,基于此配置构建其他 vite 配置
|
|
5
4
|
* 参数合并时,数组会被合并而不是被替换
|
|
@@ -10,4 +9,4 @@ import { GctOpts } from '../gct-opts.interface';
|
|
|
10
9
|
* @param {UserConfig} [opts={}]
|
|
11
10
|
* @returns {*} {Promise<UserConfig>}
|
|
12
11
|
*/
|
|
13
|
-
export declare function defineProjectViteConfig(
|
|
12
|
+
export declare function defineProjectViteConfig(opts?: UserConfig): UserConfigFnPromise;
|