@seayoo-web/scripts 2.0.11 → 2.1.0

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/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import vue from "@vitejs/plugin-vue";
3
+ import { visualizer } from "rollup-plugin-visualizer";
3
4
  import { viteDeployPlugin } from "@seayoo-web/finder";
4
5
  import { sentryVitePlugin } from "@sentry/vite-plugin";
5
6
  import legacy from "@vitejs/plugin-legacy";
@@ -25,7 +26,7 @@ function defineAppBuildConfig(option) {
25
26
  sourcemap: false,
26
27
  ...build
27
28
  },
28
- plugins: [vue(), ...plugins],
29
+ plugins: [vue(), (option == null ? void 0 : option.visualizer) ? visualizer() : null, ...plugins],
29
30
  resolve: {
30
31
  alias: {
31
32
  "@": join(process.cwd(), "./src"),
@@ -151,13 +152,12 @@ function definePageBuildConfig(option) {
151
152
  const gitInfo = justBuild ? null : await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
152
153
  const isProductMode = mode === "production" || mode === "prod";
153
154
  const trunkMap = {
154
- ...manualChunks,
155
155
  "naive-ui": "naive-ui",
156
156
  html2canvas: "html2canvas",
157
157
  thinkingdata: "thinkingdata",
158
- node_modules: "vendor"
158
+ ...manualChunks
159
159
  };
160
- const trunkKeys = Object.keys(trunkMap).sort((a, b) => a === "node_modules" ? 1 : b === "node_modules" ? -1 : 0);
160
+ const trunkKeys = Object.keys(trunkMap);
161
161
  const trunkFn = function(id) {
162
162
  const k = trunkKeys.find((k2) => id.includes(k2));
163
163
  if (k) return trunkMap[k];
@@ -230,7 +230,8 @@ function definePageBuildConfig(option) {
230
230
  org: "sentry",
231
231
  url: sentry.url || "https://sentry.seayoo.com/",
232
232
  project: sentry.project || "gamer-fe"
233
- }) : null
233
+ }) : null,
234
+ justBuild ? visualizer() : null
234
235
  ],
235
236
  define: transformEnvs({
236
237
  BUILD_TIME: envs.stamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "2.0.11",
3
+ "version": "2.1.0",
4
4
  "description": "scripts for seayoo web repos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -47,6 +47,7 @@
47
47
  "jiti": "^2.4.2",
48
48
  "ora": "^8.2.0",
49
49
  "postcss-html": "^1.8.0",
50
+ "rollup-plugin-visualizer": "^5.14.0",
50
51
  "terser": "^5.39.0",
51
52
  "vite-plugin-stylelint": "^6.0.0",
52
53
  "vite-plugin-vue-devtools": "^7.7.5",
@@ -2,4 +2,6 @@ import type { UserConfig } from "vite";
2
2
  /**
3
3
  * 导出一个动态的配置工厂函数
4
4
  */
5
- export declare function defineAppBuildConfig(option?: UserConfig): UserConfig;
5
+ export declare function defineAppBuildConfig(option?: UserConfig & {
6
+ visualizer?: boolean;
7
+ }): UserConfig;
@@ -1,4 +1,4 @@
1
- import { type UserConfig } from "vite";
1
+ import type { UserConfig } from "vite";
2
2
  interface LibBuildOption {
3
3
  /** 输出目录,默认为 "dist" */
4
4
  outDir?: string;
@@ -10,7 +10,7 @@ interface ExternalConfig {
10
10
  /**
11
11
  * 手工指定 trunk 合并策略,Record<key, chunk>,即 id.include(key) 则打到 trunk 中
12
12
  *
13
- * 默认 {`naive-ui`, `html2canvas`, `thinkingdata`, node_modules: `vendor`}
13
+ * 默认 {`naive-ui`, `html2canvas`, `thinkingdata`}
14
14
  *
15
15
  * 设置的值会跟默认值进行合并。
16
16
  *