@gct-paas/build 0.1.4-dev.2 → 0.1.4-dev.4

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.
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
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 = ["vue", "vue-router", "vue-i18n", "axios", "dayjs", "lodash-es", "qs", "pinia", "vuedraggable", "sortablejs", "vue-grid-layout", "vant", "ant-design-vue", "@gct-paas/build", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-web", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/mobile", "@gct-paas/scss", "@gct-paas/web", "systemjs"];
9
+ const DEFAULT_EXTERNAL = exports.DEFAULT_EXTERNAL = ["vue", "vue-router", "vue-i18n", "axios", "dayjs", "lodash-es", "qs", "pinia", "vuedraggable", "sortablejs", "vue-grid-layout", "vant", "ant-design-vue", "@gct-paas/build", "@gct-paas/api", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-web", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-web", "@gct-paas/mobile", "@gct-paas/scss", "@gct-paas/web", "systemjs"];
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.definePrettierConfig = definePrettierConfig;
7
- var _lodashEs = require("lodash-es");
7
+ var _util = require("../../util/index.cjs");
8
8
  function definePrettierConfig(config = {}) {
9
- return (0, _lodashEs.merge)({
9
+ return (0, _util.mergeConfig)({
10
10
  // 起始格式化间隔
11
11
  tabWidth: 2,
12
12
  // 使用单引号
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.defineRollupConfig = defineRollupConfig;
7
7
  var _rollup = require("rollup");
8
- var _lodashEs = require("lodash-es");
9
8
  var _path = _interopRequireDefault(require("path"));
10
9
  var _fastGlob = _interopRequireDefault(require("fast-glob"));
11
10
  var _pluginNodeResolve = require("@rollup/plugin-node-resolve");
@@ -74,16 +73,25 @@ function defineRollupConfig(opts = {}) {
74
73
  }
75
74
  const output = [{
76
75
  dir: outDir,
76
+ esModule: true,
77
77
  format: "es",
78
78
  sourcemap: false,
79
79
  preserveModules: true,
80
80
  preserveModulesRoot: rootDir,
81
81
  entryFileNames: "[name].mjs"
82
82
  }];
83
- return (0, _lodashEs.merge)((0, _rollup.defineConfig)({
83
+ return (0, _util.mergeConfig)((0, _rollup.defineConfig)({
84
84
  input,
85
85
  treeshake: false,
86
- external: _constants.DEFAULT_EXTERNAL,
86
+ external: id => {
87
+ if (_util.IS_NODE_MODULE.test(id)) {
88
+ return true;
89
+ }
90
+ if (_constants.DEFAULT_EXTERNAL.includes(id)) {
91
+ return true;
92
+ }
93
+ return false;
94
+ },
87
95
  output,
88
96
  plugins: [(0, _rollupPlugins.ignoreCompilerFile)(externalCompileFileReg), (0, _pluginJson.default)(), (0, _pluginVue.default)({
89
97
  isProduction: isProd
@@ -9,12 +9,29 @@ Object.defineProperty(exports, "CopyWatch", {
9
9
  return _watcher.CopyWatch;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "IS_NODE_MODULE", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _regExp.IS_NODE_MODULE;
16
+ }
17
+ });
18
+ exports.mergeConfig = mergeConfig;
12
19
  exports.unixToWinPath = unixToWinPath;
13
20
  exports.winToUnixPath = winToUnixPath;
21
+ var _lodashEs = require("lodash-es");
22
+ var _regExp = require("./reg-exp/reg-exp.cjs");
14
23
  var _watcher = require("./watcher/watcher.cjs");
15
24
  function winToUnixPath(pathStr) {
16
25
  return pathStr.replace(/\\/g, "/");
17
26
  }
18
27
  function unixToWinPath(pathStr) {
19
28
  return pathStr.replace(/\//g, "\\");
29
+ }
30
+ function mergeConfig(obj, obj2) {
31
+ return (0, _lodashEs.mergeWith)(obj, obj2, (objValue, srcValue) => {
32
+ if (Array.isArray(objValue) && Array.isArray(srcValue)) {
33
+ return objValue.concat(srcValue);
34
+ }
35
+ return void 0;
36
+ });
20
37
  }
@@ -1,3 +1,4 @@
1
+ export { IS_NODE_MODULE } from './reg-exp/reg-exp';
1
2
  export { CopyWatch } from './watcher/watcher';
2
3
  /**
3
4
  * win 路径 \\ 转 linux 路径 /
@@ -15,3 +16,15 @@ export declare function winToUnixPath(pathStr: string): string;
15
16
  * @return {*} {string}
16
17
  */
17
18
  export declare function unixToWinPath(pathStr: string): string;
19
+ /**
20
+ * 自定义合并配置,数据非替换为 concat 合并
21
+ *
22
+ * @author chitanda
23
+ * @date 2025-08-20 20:08:45
24
+ * @export
25
+ * @template T
26
+ * @param {T} obj
27
+ * @param {U} obj2
28
+ * @returns {*} {T}
29
+ */
30
+ export declare function mergeConfig<T extends object, U extends object>(obj: T, obj2: U): T & U;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IS_NODE_MODULE = void 0;
7
+ const IS_NODE_MODULE = exports.IS_NODE_MODULE = /node_modules\//;
@@ -0,0 +1 @@
1
+ export declare const IS_NODE_MODULE: RegExp;
@@ -11,11 +11,12 @@ var _pluginBabel = require("@rollup/plugin-babel");
11
11
  var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
12
12
  var _path = _interopRequireDefault(require("path"));
13
13
  var _constants = require("../../constants/index.cjs");
14
+ var _util = require("../../util/index.cjs");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  function defineViteBaseConfig(opts = {}) {
16
17
  const cwd = process.cwd();
17
18
  const outDir = _path.default.resolve(cwd, "dist");
18
- return (0, _vite.mergeConfig)((0, _vite.defineConfig)({
19
+ return (0, _util.mergeConfig)((0, _vite.defineConfig)({
19
20
  css: {
20
21
  preprocessorOptions: {
21
22
  scss: {
@@ -15,6 +15,7 @@ export const DEFAULT_EXTERNAL = [
15
15
  "vant",
16
16
  "ant-design-vue",
17
17
  "@gct-paas/build",
18
+ "@gct-paas/api",
18
19
  "@gct-paas/core",
19
20
  "@gct-paas/core-mobile",
20
21
  "@gct-paas/core-web",
@@ -1,6 +1,6 @@
1
- import { merge } from "lodash-es";
1
+ import { mergeConfig } from "../../util/index.mjs";
2
2
  export function definePrettierConfig(config = {}) {
3
- return merge(
3
+ return mergeConfig(
4
4
  {
5
5
  // 起始格式化间隔
6
6
  tabWidth: 2,
@@ -1,5 +1,4 @@
1
1
  import { defineConfig } from "rollup";
2
- import { merge } from "lodash-es";
3
2
  import path from "path";
4
3
  import glob from "fast-glob";
5
4
  import { nodeResolve } from "@rollup/plugin-node-resolve";
@@ -15,7 +14,7 @@ import fs from "fs-extra";
15
14
  import os from "os";
16
15
  import { copyFile, ignoreCompilerFile } from "../rollup-plugins/index.mjs";
17
16
  import { DEFAULT_EXTERNAL, PROD_MODE } from "../../constants/index.mjs";
18
- import { winToUnixPath } from "../../util/index.mjs";
17
+ import { IS_NODE_MODULE, mergeConfig, winToUnixPath } from "../../util/index.mjs";
19
18
  export function defineRollupConfig(opts = {}) {
20
19
  process.on("SIGINT", () => {
21
20
  process.exit();
@@ -72,6 +71,7 @@ export function defineRollupConfig(opts = {}) {
72
71
  const output = [
73
72
  {
74
73
  dir: outDir,
74
+ esModule: true,
75
75
  format: "es",
76
76
  sourcemap: false,
77
77
  preserveModules: true,
@@ -79,11 +79,19 @@ export function defineRollupConfig(opts = {}) {
79
79
  entryFileNames: "[name].mjs"
80
80
  }
81
81
  ];
82
- return merge(
82
+ return mergeConfig(
83
83
  defineConfig({
84
84
  input,
85
85
  treeshake: false,
86
- external: DEFAULT_EXTERNAL,
86
+ external: (id) => {
87
+ if (IS_NODE_MODULE.test(id)) {
88
+ return true;
89
+ }
90
+ if (DEFAULT_EXTERNAL.includes(id)) {
91
+ return true;
92
+ }
93
+ return false;
94
+ },
87
95
  output,
88
96
  plugins: [
89
97
  ignoreCompilerFile(externalCompileFileReg),
@@ -1,3 +1,4 @@
1
+ export { IS_NODE_MODULE } from './reg-exp/reg-exp';
1
2
  export { CopyWatch } from './watcher/watcher';
2
3
  /**
3
4
  * win 路径 \\ 转 linux 路径 /
@@ -15,3 +16,15 @@ export declare function winToUnixPath(pathStr: string): string;
15
16
  * @return {*} {string}
16
17
  */
17
18
  export declare function unixToWinPath(pathStr: string): string;
19
+ /**
20
+ * 自定义合并配置,数据非替换为 concat 合并
21
+ *
22
+ * @author chitanda
23
+ * @date 2025-08-20 20:08:45
24
+ * @export
25
+ * @template T
26
+ * @param {T} obj
27
+ * @param {U} obj2
28
+ * @returns {*} {T}
29
+ */
30
+ export declare function mergeConfig<T extends object, U extends object>(obj: T, obj2: U): T & U;
package/es/util/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { mergeWith } from "lodash-es";
2
+ export { IS_NODE_MODULE } from "./reg-exp/reg-exp.mjs";
1
3
  export { CopyWatch } from "./watcher/watcher.mjs";
2
4
  export function winToUnixPath(pathStr) {
3
5
  return pathStr.replace(/\\/g, "/");
@@ -5,3 +7,11 @@ export function winToUnixPath(pathStr) {
5
7
  export function unixToWinPath(pathStr) {
6
8
  return pathStr.replace(/\//g, "\\");
7
9
  }
10
+ export function mergeConfig(obj, obj2) {
11
+ return mergeWith(obj, obj2, (objValue, srcValue) => {
12
+ if (Array.isArray(objValue) && Array.isArray(srcValue)) {
13
+ return objValue.concat(srcValue);
14
+ }
15
+ return void 0;
16
+ });
17
+ }
@@ -0,0 +1 @@
1
+ export declare const IS_NODE_MODULE: RegExp;
@@ -0,0 +1 @@
1
+ export const IS_NODE_MODULE = /node_modules\//;
@@ -1,10 +1,11 @@
1
- import { defineConfig, mergeConfig } from "vite";
1
+ import { defineConfig } from "vite";
2
2
  import vue from "@vitejs/plugin-vue";
3
3
  import vueJsx from "@vitejs/plugin-vue-jsx";
4
4
  import { babel } from "@rollup/plugin-babel";
5
5
  import json from "@rollup/plugin-json";
6
6
  import path from "path";
7
7
  import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
8
+ import { mergeConfig } from "../../util/index.mjs";
8
9
  export function defineViteBaseConfig(opts = {}) {
9
10
  const cwd = process.cwd();
10
11
  const outDir = path.resolve(cwd, "dist");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/build",
3
- "version": "0.1.4-dev.2",
3
+ "version": "0.1.4-dev.4",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "main": "dist/index.cjs",
@@ -39,13 +39,13 @@
39
39
  "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
40
40
  },
41
41
  "dependencies": {
42
- "@babel/core": "^7.28.0",
43
- "@babel/preset-env": "^7.28.0",
42
+ "@babel/core": "^7.28.3",
43
+ "@babel/preset-env": "^7.28.3",
44
44
  "@commitlint/cli": "^19.8.1",
45
45
  "@commitlint/config-conventional": "^19.8.1",
46
46
  "@eslint/js": "^9.33.0",
47
- "@gct-paas/scss": "^0.1.4-dev.2",
48
- "@inquirer/prompts": "^7.8.1",
47
+ "@gct-paas/scss": "^0.1.4-dev.4",
48
+ "@inquirer/prompts": "^7.8.3",
49
49
  "@rollup/plugin-babel": "^6.0.4",
50
50
  "@rollup/plugin-commonjs": "^28.0.6",
51
51
  "@rollup/plugin-eslint": "^9.0.5",
@@ -60,14 +60,14 @@
60
60
  "consola": "^3.4.2",
61
61
  "copy-file": "^11.1.0",
62
62
  "core-js": "^3.45.0",
63
- "cpy": "^12.0.0",
63
+ "cpy": "^12.0.1",
64
64
  "crypto": "^1.0.1",
65
65
  "esbuild": "^0.25.9",
66
66
  "eslint": "^9.33.0",
67
67
  "eslint-config-prettier": "^10.1.8",
68
68
  "eslint-plugin-import": "^2.32.0",
69
69
  "eslint-plugin-prettier": "^5.5.4",
70
- "eslint-plugin-unused-imports": "^4.1.4",
70
+ "eslint-plugin-unused-imports": "^4.2.0",
71
71
  "eslint-plugin-vue": "^10.4.0",
72
72
  "fast-glob": "^3.3.3",
73
73
  "fs-extra": "^11.3.1",
@@ -77,12 +77,12 @@
77
77
  "picocolors": "^1.1.1",
78
78
  "prettier": "^3.6.2",
79
79
  "rimraf": "^6.0.1",
80
- "rollup": "^4.46.2",
80
+ "rollup": "^4.46.4",
81
81
  "rollup-plugin-esbuild": "^6.2.1",
82
82
  "stylelint": "^16.23.1",
83
83
  "stylelint-config-standard-scss": "^15.0.1",
84
- "typescript-eslint": "^8.39.1",
85
- "vite": "^7.1.2",
84
+ "typescript-eslint": "^8.40.0",
85
+ "vite": "^7.1.3",
86
86
  "vite-plugin-dts": "^4.5.4",
87
87
  "vue-eslint-parser": "^10.2.0",
88
88
  "vue-tsc": "^3.0.5"
@@ -93,10 +93,10 @@
93
93
  "@types/babel__preset-env": "^7.10.0",
94
94
  "@types/fs-extra": "^11.0.4",
95
95
  "@types/lodash-es": "^4.17.12",
96
- "@types/node": "^24.2.1",
96
+ "@types/node": "^24.3.0",
97
97
  "tsx": "^4.20.4",
98
98
  "typescript": "^5.9.2",
99
- "unbuild": "^3.6.0"
99
+ "unbuild": "^3.6.1"
100
100
  },
101
- "gitHead": "d837ea9836db8bae169908326208cc031b2e9eac"
101
+ "gitHead": "8243f48a5c33973e9d610917555d9a3e27e6bd04"
102
102
  }