@seayoo-web/scripts 1.3.4 → 1.3.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/index.js CHANGED
@@ -1,19 +1,44 @@
1
1
  import { join } from "node:path";
2
- import { defineConfig, loadEnv } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
3
  import { viteDeployPlugin } from "@seayoo-web/finder";
4
4
  import { sentryVitePlugin } from "@sentry/vite-plugin";
5
5
  import legacy from "@vitejs/plugin-legacy";
6
- import vue from "@vitejs/plugin-vue";
7
6
  import vueDevTools from "vite-plugin-vue-devtools";
8
7
  import { existsSync, readFileSync } from "fs";
8
+ import { loadEnv } from "vite";
9
9
  import "colors";
10
10
  import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-C3gyPvsT.js";
11
11
  import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
12
12
  import { vueTsConfigs, defineConfigWithVueTs } from "@vue/eslint-config-typescript";
13
13
  import { flatConfigs } from "eslint-plugin-import";
14
14
  import pluginVue from "eslint-plugin-vue";
15
+ function defineAppBuildConfig(option) {
16
+ const { plugins = [], build = {}, resolve = {}, ...optionReset } = option || {};
17
+ const { alias, ...resolveReset } = resolve || {};
18
+ return {
19
+ base: "./",
20
+ build: {
21
+ emptyOutDir: true,
22
+ outDir: join(process.cwd(), "./dist"),
23
+ assetsDir: "assets",
24
+ reportCompressedSize: false,
25
+ sourcemap: false,
26
+ ...build
27
+ },
28
+ plugins: [vue(), ...plugins],
29
+ resolve: {
30
+ alias: {
31
+ "@": join(process.cwd(), "./src"),
32
+ ...alias
33
+ },
34
+ extensions: [".mts", ".mjs", ".ts", ".js"],
35
+ ...resolveReset
36
+ },
37
+ ...optionReset
38
+ };
39
+ }
15
40
  function defineLibBuildConfig(option) {
16
- return defineConfig({
41
+ return {
17
42
  build: {
18
43
  outDir: (option == null ? void 0 : option.outDir) || "dist",
19
44
  lib: {
@@ -27,7 +52,7 @@ function defineLibBuildConfig(option) {
27
52
  external: (option == null ? void 0 : option.external) || [/^@seayoo-web\/(?:request|utils|combo-webview)/]
28
53
  }
29
54
  }
30
- });
55
+ };
31
56
  }
32
57
  const EnvPrefix = "SY_";
33
58
  function getBuildEnv(command, mode) {
@@ -102,21 +127,20 @@ function htmlInjectPlugin(data) {
102
127
  };
103
128
  }
104
129
  function definePageBuildConfig(option) {
105
- return defineConfig(async function(viteEnvs) {
106
- const { command, mode } = viteEnvs;
130
+ const {
131
+ plugins = [],
132
+ define = {},
133
+ build = {},
134
+ resolve = {},
135
+ server = {},
136
+ sentry = {},
137
+ ...optionReset
138
+ } = option || {};
139
+ const { alias, ...resolveReset } = resolve;
140
+ return async function({ command, mode }) {
107
141
  const envs = getBuildEnv(command, mode);
108
142
  const gitInfo = await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
109
143
  const isProductMode = mode === "production" || mode === "prod";
110
- const {
111
- plugins = [],
112
- define = {},
113
- build = {},
114
- resolve = {},
115
- server = {},
116
- sentry = {},
117
- ...optionReset
118
- } = option || {};
119
- const { alias, ...resolveReset } = resolve || {};
120
144
  return {
121
145
  base: "./",
122
146
  build: {
@@ -132,8 +156,7 @@ function definePageBuildConfig(option) {
132
156
  vueDevTools(),
133
157
  legacy({
134
158
  targets: [
135
- "defaults",
136
- "> 0.2%",
159
+ "> 0.1%",
137
160
  "last 5 versions and not dead",
138
161
  "Firefox ESR",
139
162
  "edge>=60",
@@ -148,7 +171,7 @@ function definePageBuildConfig(option) {
148
171
  // https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/src/index.ts#L170
149
172
  // https://unpkg.com/browse/core-js@3.41.0/
150
173
  additionalLegacyPolyfills: [
151
- "regenerator-runtime/runtime.js",
174
+ "regenerator-runtime/runtime",
152
175
  "core-js/es/array/flat",
153
176
  "core-js/es/global-this",
154
177
  "core-js/es/promise",
@@ -205,34 +228,7 @@ function definePageBuildConfig(option) {
205
228
  // envPrefix 不允许覆盖
206
229
  envPrefix: EnvPrefix
207
230
  };
208
- });
209
- }
210
- function defineAppBuildConfig(option) {
211
- return defineConfig(function() {
212
- const { plugins = [], build = {}, resolve = {}, ...optionReset } = option || {};
213
- const { alias, ...resolveReset } = resolve || {};
214
- return {
215
- base: "./",
216
- build: {
217
- emptyOutDir: true,
218
- outDir: join(process.cwd(), "./dist"),
219
- assetsDir: "assets",
220
- reportCompressedSize: false,
221
- sourcemap: false,
222
- ...build
223
- },
224
- plugins: [vue(), ...plugins],
225
- resolve: {
226
- alias: {
227
- "@": join(process.cwd(), "./src"),
228
- ...alias
229
- },
230
- extensions: [".mts", ".mjs", ".ts", ".js"],
231
- ...resolveReset
232
- },
233
- ...optionReset
234
- };
235
- });
231
+ };
236
232
  }
237
233
  const vueEslintConfig = [
238
234
  {
@@ -272,7 +268,6 @@ const importEslintConfig = [
272
268
  flatConfigs.recommended,
273
269
  {
274
270
  rules: {
275
- "import/no-deprecated": "error",
276
271
  "import/no-unresolved": "off",
277
272
  "import/named": "off",
278
273
  "import/namespace": "off",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "scripts for seayoo web monorepos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -60,15 +60,13 @@
60
60
  "stylelint": "^16.15.0",
61
61
  "stylelint-config-recess-order": "^6.0.0",
62
62
  "stylelint-config-standard": "^37.0.0",
63
- "vite": "^6.2.1",
64
63
  "@seayoo-web/tsconfig": "^1.0.3"
65
64
  },
66
65
  "peerDependencies": {
67
66
  "eslint": "^9.19.0",
68
67
  "stylelint": "^16.14.1",
69
68
  "stylelint-config-recess-order": "^6.0.0",
70
- "stylelint-config-standard": "^37.0.0",
71
- "vite": "^6.2.1"
69
+ "stylelint-config-standard": "^37.0.0"
72
70
  },
73
71
  "scripts": {
74
72
  "build": "vite build && tsc --emitDeclarationOnly",
package/types/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- export * from "./src/vite.lab";
2
- export * from "./src/vite.page";
3
- export * from "./src/vite.app";
1
+ export * from "./src/vite";
4
2
  export * from "./src/inject";
5
3
  export * from "./src/env";
6
4
  export * from "./src/eslint";
@@ -2,4 +2,4 @@ import { type UserConfig } from "vite";
2
2
  /**
3
3
  * 导出一个动态的配置工厂函数
4
4
  */
5
- export declare function defineAppBuildConfig(option?: UserConfig): import("vite").UserConfigFnObject;
5
+ export declare function defineAppBuildConfig(option?: UserConfig): UserConfig;
@@ -0,0 +1,4 @@
1
+ export type { UserConfig, UserConfigFnPromise } from "vite";
2
+ export * from "./vite.app";
3
+ export * from "./vite.lab";
4
+ export * from "./vite.page";
@@ -1,3 +1,4 @@
1
+ import { type UserConfig } from "vite";
1
2
  interface LibBuildOption {
2
3
  /** 输出目录,默认为 "dist" */
3
4
  outDir?: string;
@@ -11,5 +12,5 @@ interface LibBuildOption {
11
12
  *
12
13
  * 默认排除 "@seayoo-web/request" 和 "@seayoo-web/utils" 不打包
13
14
  */
14
- export declare function defineLibBuildConfig(option?: LibBuildOption): import("vite").UserConfig;
15
+ export declare function defineLibBuildConfig(option?: LibBuildOption): UserConfig;
15
16
  export {};
@@ -1,4 +1,4 @@
1
- import { type UserConfig } from "vite";
1
+ import type { UserConfig, UserConfigFnPromise } from "vite";
2
2
  interface ExternalConfig {
3
3
  /** sentry 配置 */
4
4
  sentry?: {
@@ -9,5 +9,5 @@ interface ExternalConfig {
9
9
  /**
10
10
  * 导出一个动态的配置工厂函数
11
11
  */
12
- export declare function definePageBuildConfig(option?: UserConfig & ExternalConfig): import("vite").UserConfigFnPromise;
12
+ export declare function definePageBuildConfig(option?: UserConfig & ExternalConfig): UserConfigFnPromise;
13
13
  export {};