@xfe-repo/mini-app 1.6.1 → 1.6.3

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/README.md CHANGED
@@ -1,3 +1,7 @@
1
1
  # `@xfe-repo/mini-app`
2
2
 
3
3
  mini框架基础库
4
+
5
+ H5 在启动前加载 Taro 已依赖的 `core-js/stable`,补充旧浏览器编译目标,并在生产构建中转译第三方和工作区依赖。小程序构建保持原有配置。
6
+
7
+ 这是 JS 兼容基线;具体组件样式和浏览器 Web API 仍需在目标浏览器验证。
package/babel.config.js CHANGED
@@ -2,10 +2,24 @@
2
2
  // https://docs.taro.zone/docs/next/babel-config
3
3
  module.exports = {
4
4
  presets: [
5
- ['taro', {
6
- framework: 'react',
7
- ts: true,
8
- compiler: 'webpack5',
9
- }]
10
- ]
5
+ [
6
+ 'taro',
7
+ {
8
+ framework: 'react',
9
+ ts: true,
10
+ compiler: 'webpack5',
11
+ targets:
12
+ process.env.TARO_ENV === 'h5'
13
+ ? {
14
+ edge: '18',
15
+ chrome: '64',
16
+ firefox: '60',
17
+ safari: '12',
18
+ ios: '9',
19
+ android: '5',
20
+ }
21
+ : undefined,
22
+ },
23
+ ],
24
+ ],
11
25
  }
package/config/index.ts CHANGED
@@ -117,6 +117,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
117
117
  },
118
118
  webpackChain(chain) {
119
119
  chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
120
+ chain.entry('app').prepend(require.resolve('core-js/stable', { paths: [require.resolve('babel-preset-taro')] }))
120
121
  },
121
122
  },
122
123
  rn: {
package/config/prod.ts CHANGED
@@ -5,5 +5,10 @@ export default {
5
5
  NODE_ENV: '"production"',
6
6
  },
7
7
  mini: {},
8
- h5: {},
8
+ h5: {
9
+ compile: {
10
+ // 工作区依赖可能解析到 node_modules 外,也需要转译。
11
+ include: [(filename: string) => !/node_modules[/\\](@babel|core-js|style-loader|css-loader|react|react-dom)[/\\]/.test(filename)],
12
+ },
13
+ },
9
14
  } satisfies UserConfigExport<'webpack5'>
package/deploy/.drone.yml CHANGED
@@ -230,6 +230,27 @@ steps:
230
230
  include:
231
231
  - refs/tags/release-*
232
232
 
233
+ - name: push-helm-chart
234
+ image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
235
+ environment:
236
+ USERNAME:
237
+ from_secret: username
238
+ PASSWORD:
239
+ from_secret: password
240
+ commands:
241
+ - chartName="${DRONE_REPO//\//-}"
242
+ - chartVersion="0.0.0-$DRONE_TAG"
243
+ - cp deploy/helm/values.prod.yaml deploy/helm/values.yaml
244
+ - sed -i "s/deployment/$chartName/g" deploy/helm/Chart.yaml
245
+ - helm package deploy/helm --version "$chartVersion"
246
+ - set +x
247
+ - printf '%s' "$PASSWORD" | helm registry login xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com --username "$USERNAME" --password-stdin
248
+ - helm push "$chartName-$chartVersion.tgz" oci://xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image
249
+ when:
250
+ ref:
251
+ include:
252
+ - refs/tags/release-*
253
+
233
254
  volumes:
234
255
  - name: node-modules
235
256
  host:
package/deploy/nginx.conf CHANGED
@@ -5,6 +5,13 @@ server {
5
5
  server_name -;
6
6
  root /code/www/deploy/webroot/app/current;
7
7
 
8
+ gzip on;
9
+ gzip_vary on;
10
+ gzip_proxied any;
11
+ gzip_comp_level 5;
12
+ gzip_min_length 1024;
13
+ gzip_types text/plain text/css text/javascript application/javascript application/json application/xml text/xml image/svg+xml;
14
+
8
15
  set $apiEnv test;
9
16
 
10
17
  if ( $host ~* ^(?<hostPrefix>[^.]+)?\.?(?<subDomain>.*?)\.?(?<domain>[^.]+)\.(?<ltd>[a-zA-Z]+)$ ) {
@@ -23,14 +30,24 @@ server {
23
30
  }
24
31
 
25
32
  location /check-update {
26
- add_header Cache-control no-cache;
33
+ add_header Cache-Control no-cache always;
27
34
 
28
35
  try_files /release =404;
29
36
  }
30
37
 
31
- # 兼容v2版本的静态资源
32
- location /v2/static {
33
- rewrite /v2(.*) $1 break;
38
+ # 仅带内容 hash 的资源使用长期缓存
39
+ location ~* "\.[0-9a-f]{8,}(\.chunk)?\.[^./]+$" {
40
+ rewrite ^/v[0-9]+(/(static|js|css)/.*)$ $1 break;
41
+ try_files $uri =404;
42
+
43
+ add_header 'Access-Control-Allow-Origin' '*';
44
+ add_header Cache-Control "public, max-age=31536000, immutable";
45
+ }
46
+
47
+ # 兼容 /v数字/ 前缀下的构建资源
48
+ location ~ ^/v[0-9]+/(static|js|css)/ {
49
+ rewrite ^/v[0-9]+(/.*)$ $1 break;
50
+ add_header Cache-Control no-cache always;
34
51
  }
35
52
 
36
53
  location / {
@@ -39,7 +56,7 @@ server {
39
56
  # 兼容微前端 允许跨域
40
57
  add_header 'Access-Control-Allow-Origin' '*';
41
58
 
42
- add_header Cache-Control no-cache;
59
+ add_header Cache-Control no-cache always;
43
60
  add_header Set-Cookie "apiEnv=${apiEnv}; Max-Age=2626560; Path=/;";
44
61
  }
45
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-app",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "bin": {
5
5
  "xfe-mini": "./bin/index.js"
6
6
  },
@@ -51,7 +51,7 @@
51
51
  "typescript": "5.3.3",
52
52
  "webpack": "5.91.0",
53
53
  "yaml": "^2.3.4",
54
- "@xfe-repo/typescript-config": "1.6.1",
54
+ "@xfe-repo/typescript-config": "1.6.2",
55
55
  "@xfe-repo/routes-define-webpack-plugin": "1.6.0"
56
56
  },
57
57
  "peerDependencies": {