agora-toolchain 3.6.4 → 3.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-toolchain",
3
- "version": "3.6.4",
3
+ "version": "3.7.1",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "agora-tc-transpile": "./scripts/transpile.js",
@@ -45,6 +45,7 @@ module.exports = {
45
45
  electron: 'commonjs2 electron',
46
46
  winston: 'commonjs2 winston',
47
47
  'node:fs': 'commonjs2 node:fs',
48
+ 'node:fs/promises': 'commonjs2 node:fs/promises',
48
49
  fs: 'commonjs2 fs',
49
50
  'node:path': 'commonjs2 node:path',
50
51
  path: 'commonjs2 path',
@@ -110,7 +110,7 @@ module.exports = createConfig = ({ entry, port = 3000, analyze }) => {
110
110
  codeAppendPlugins.push(
111
111
  new AppendCodePlugin({
112
112
  code: `window.runtime && window.runtime.setFragmentOptions('${fragment}', ${windowOptions} || {}, ${webPreferences} || {});`,
113
- patterns: [/main.js$/, ...fragments.map((f) => new RegExp(`${f}.js$`))],
113
+ patterns: [/main.[0-9a-f]{20}.js$/, ...fragments.map((f) => new RegExp(`${f}.[0-9a-f]{20}.js$`))],
114
114
  }),
115
115
  );
116
116
 
@@ -139,7 +139,7 @@ module.exports = createConfig = ({ entry, port = 3000, analyze }) => {
139
139
  window.module.paths.unshift(${normalizedNodeModulePath});
140
140
  }
141
141
  `,
142
- patterns: [/main.js$/, ...fragments.map((f) => new RegExp(`${f}.js$`))],
142
+ patterns: [/main.[0-9a-f]{20}.js$/, ...fragments.map((f) => new RegExp(`${f}.[0-9a-f]{20}.js$`))],
143
143
  }),
144
144
  );
145
145
  }
@@ -156,6 +156,41 @@ module.exports = createConfig = ({ entry, port = 3000, analyze }) => {
156
156
  mode: 'development',
157
157
  devtool: 'eval-source-map',
158
158
  entry: entries,
159
+ output: {
160
+ filename: '[name].[contenthash].js',
161
+ chunkFilename: '[name].[contenthash].chunk.js',
162
+ },
163
+ optimization: {
164
+ splitChunks: {
165
+ chunks: 'all',
166
+ cacheGroups: {
167
+ // 第三方库分包
168
+ vendor: {
169
+ test: /[\\/]node_modules[\\/]/,
170
+ name: 'vendors',
171
+ chunks: 'all',
172
+ priority: 10,
173
+ },
174
+ // React相关库单独分包
175
+ react: {
176
+ test: /[\\/]node_modules[\\/](react|react-dom|@hot-loader\/react-dom)[\\/]/,
177
+ name: 'react',
178
+ chunks: 'all',
179
+ priority: 20,
180
+ },
181
+ // Agora相关库单独分包
182
+ agora: {
183
+ test: /[\\/]node_modules[\\/](agora-foundation|agora-ui-foundation|agora-rte-sdk|fcr-core)[\\/]/,
184
+ name: 'agora',
185
+ chunks: 'all',
186
+ priority: 20,
187
+ },
188
+ },
189
+ },
190
+ runtimeChunk: {
191
+ name: 'runtime',
192
+ },
193
+ },
159
194
  devServer: {
160
195
  static: [
161
196
  {
@@ -99,7 +99,7 @@ module.exports = createConfig = ({ entry, analyze, out = 'dist' }) => {
99
99
  codeAppendPlugins.push(
100
100
  new AppendCodePlugin({
101
101
  code: `window.runtime && window.runtime.setFragmentOptions('${fragment}', ${windowOptions} || {}, ${webPreferences} || {});`,
102
- patterns: [/main.js$/, ...fragments.map((f) => new RegExp(`${f}.js$`))],
102
+ patterns: [/main.[0-9a-f]{20}.js$/, ...fragments.map((f) => new RegExp(`${f}.[0-9a-f]{20}.js$`))],
103
103
  }),
104
104
  );
105
105
 
@@ -136,9 +136,72 @@ module.exports = createConfig = ({ entry, analyze, out = 'dist' }) => {
136
136
  type: 'umd',
137
137
  },
138
138
  path: resolveCwd(out),
139
+ filename: '[name].[contenthash].js',
140
+ chunkFilename: '[name].[contenthash].chunk.js',
139
141
  // path: resolveCwd('dist'),
140
142
  // filename: '[name].[contenthash].bundle.js',
141
143
  },
144
+ optimization: {
145
+ splitChunks: {
146
+ chunks: 'all',
147
+ cacheGroups: {
148
+ // 第三方库分包
149
+ vendor: {
150
+ test: /[\\/]node_modules[\\/]/,
151
+ name: 'vendors',
152
+ chunks: 'all',
153
+ priority: 10,
154
+ },
155
+ rtc: {
156
+ test: /[\\/]node_modules[\\/](agora-rtc-sdk-ng)[\\/]/,
157
+ name: 'agoraRTCNg',
158
+ chunks: 'all',
159
+ priority: 20,
160
+ },
161
+ rtm: {
162
+ test: /[\\/]node_modules[\\/](agora-rtm)[\\/]/,
163
+ name: 'agoraRTM',
164
+ chunks: 'all',
165
+ priority: 20,
166
+ },
167
+ virtualBackground: {
168
+ test: /[\\/]node_modules[\\/](agora-extension-virtual-background)[\\/]/,
169
+ name: 'virtualBackground',
170
+ chunks: 'all',
171
+ priority: 20,
172
+ },
173
+ denoise: {
174
+ test: /[\\/]node_modules[\\/](agora-extension-ai-denoise)[\\/]/,
175
+ name: 'denoise',
176
+ chunks: 'all',
177
+ priority: 20,
178
+ },
179
+ beauty: {
180
+ test: /[\\/]node_modules[\\/](agora-extension-beauty-effect)[\\/]/,
181
+ name: 'beauty',
182
+ chunks: 'all',
183
+ priority: 20,
184
+ },
185
+ // React相关库单独分包
186
+ react: {
187
+ test: /[\\/]node_modules[\\/](react|react-dom|@hot-loader\/react-dom)[\\/]/,
188
+ name: 'react',
189
+ chunks: 'all',
190
+ priority: 20,
191
+ },
192
+ // Agora相关库单独分包
193
+ agora: {
194
+ test: /[\\/]node_modules[\\/](agora-foundation|agora-ui-foundation|agora-rte-sdk|fcr-core)[\\/]/,
195
+ name: 'agora',
196
+ chunks: 'all',
197
+ priority: 20,
198
+ },
199
+ },
200
+ },
201
+ runtimeChunk: {
202
+ name: 'runtime',
203
+ },
204
+ },
142
205
  module: {
143
206
  rules: [
144
207
  {
@@ -154,6 +217,7 @@ module.exports = createConfig = ({ entry, analyze, out = 'dist' }) => {
154
217
  plugins: [
155
218
  new MiniCssExtractPlugin({
156
219
  filename: '[name].[contenthash].css',
220
+ chunkFilename: '[name].[contenthash].chunk.css',
157
221
  }),
158
222
  new CopyWebpackPlugin({
159
223
  patterns: [
@@ -93,9 +93,9 @@ const options = {
93
93
  // gatekeeperAssess: true,
94
94
  entitlements: resolveCwd('installer/mac/entitlements.mac.plist'),
95
95
  extendInfo: {
96
- NSMicrophoneUsageDescription: 'Fcr Meeting wants to acquire your microphone permission',
97
- NSCameraUsageDescription: 'Fcr Meeting wants to acquire your camera permission',
98
- NSScreenCaptureDescription: 'Fcr Meeting wants to acquire your screen capture permission',
96
+ NSMicrophoneUsageDescription: 'This app wants to acquire your microphone permission',
97
+ NSCameraUsageDescription: 'This app wants to acquire your camera permission',
98
+ NSScreenCaptureDescription: 'This app wants to acquire your screen capture permission',
99
99
  'com.apple.security.device.audio-input': true,
100
100
  'com.apple.security.cs.allow-jit': true,
101
101
  'com.apple.security.cs.allow-unsigned-executable-memory': true,
@@ -76,7 +76,31 @@ const options = {
76
76
  output: resolveCwd('release'),
77
77
  buildResources: resolveCwd('installer/resources'),
78
78
  },
79
- files: ['!**/artifactory_deps/**/*', '!**/mac-release/**/*'],
79
+ files: [
80
+ 'dist/**/*',
81
+ '!**/artifactory_deps/**/*',
82
+ '!**/mac-release/**/*',
83
+ '!**/scr/**/*',
84
+ "!**/node_modules/**/{CHANGELOG.md,README.md,README,readme.md,README.zh.md}",
85
+ "!**/node_modules/**/{nodemon.json,rollup.config.js,tsconfig.json,typedoc.json,rc_message.proto}",
86
+ "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
87
+ "!**/node_modules/.bin",
88
+ "!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
89
+ "!.editorconfig",
90
+ "!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
91
+ "!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
92
+ "!**/{appveyor.yml,.travis.yml,circle.yml}",
93
+ "!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}",
94
+ "!**/*.dSYM",
95
+ "!**/*.{lproj}",
96
+ "!**/*.config.js",
97
+ "!**/*.config.ts",
98
+ "!**/*.config.json",
99
+ "!**/*.config.yaml",
100
+ "!**/*.config.yml",
101
+ "!**/*.config.xml",
102
+ "!**/*.config.html",
103
+ ],
80
104
  extraResources: [
81
105
  // 内置资源
82
106
  {
@@ -111,9 +135,9 @@ const options = {
111
135
  // gatekeeperAssess: true,
112
136
  entitlements: resolveCwd('installer/mac/entitlements.mac.plist'),
113
137
  extendInfo: {
114
- NSMicrophoneUsageDescription: 'Fcr Meeting wants to acquire your microphone permission',
115
- NSCameraUsageDescription: 'Fcr Meeting wants to acquire your camera permission',
116
- NSScreenCaptureDescription: 'Fcr Meeting wants to acquire your screen capture permission',
138
+ NSMicrophoneUsageDescription: 'This app wants to acquire your microphone permission',
139
+ NSCameraUsageDescription: 'This app wants to acquire your camera permission',
140
+ NSScreenCaptureDescription: 'This app wants to acquire your screen capture permission',
117
141
  LSUIElement: 1,
118
142
  },
119
143
  },
@@ -2,11 +2,14 @@ const { spawn } = require('child_process');
2
2
  const os = require('os');
3
3
 
4
4
  const _spawn = (cmd, args, options) => {
5
+ const presetOptions = {};
6
+
5
7
  if (os.platform() === 'win32') {
6
8
  cmd = `${cmd}.cmd`;
9
+ presetOptions.shell = true;
7
10
  }
8
11
 
9
- return spawn(cmd, args, options);
12
+ return spawn(cmd, args, { ...presetOptions, ...options });
10
13
  };
11
14
 
12
15
  module.exports = {