@xylink/xy-rtc-sdk 2.1.2 → 3.8.0-beta.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/README.MD +37 -37
- package/lib/{src/action → action}/index.d.ts +237 -236
- package/lib/{src/enum → enum}/contraints.d.ts +116 -116
- package/lib/{src/enum → enum}/errorCode.d.ts +880 -880
- package/lib/{src/enum → enum}/index.d.ts +137 -133
- package/lib/{src/index.d.ts → index.d.ts} +34 -34
- package/lib/{src/main → main}/client.d.ts +878 -808
- package/lib/{src/main → main}/deviceManager.d.ts +164 -164
- package/lib/{src/main → main}/helper.d.ts +51 -51
- package/lib/{src/main → main}/iauth.d.ts +33 -33
- package/lib/{src/main → main}/layoutManager.d.ts +214 -214
- package/lib/{src/main → main}/peer.d.ts +311 -311
- package/lib/{src/main → main}/qualityManager.d.ts +39 -39
- package/lib/{src/main → main}/stream.d.ts +263 -243
- package/lib/{src/main → main}/videoManager.d.ts +65 -65
- package/lib/{src/tools → tools}/audioLevel.d.ts +23 -23
- package/lib/{src/tools → tools}/browser.d.ts +55 -55
- package/lib/{src/tools → tools}/config.d.ts +12 -12
- package/lib/{src/tools → tools}/db.d.ts +85 -85
- package/lib/{src/tools → tools}/detect.d.ts +44 -45
- package/lib/{src/tools → tools}/emmitter.d.ts +15 -15
- package/lib/{src/tools → tools}/enum.d.ts +6 -6
- package/lib/{src/tools → tools}/httpClient.d.ts +64 -64
- package/lib/{src/tools → tools}/i18n.d.ts +8 -8
- package/lib/{src/tools → tools}/index.d.ts +8 -8
- package/lib/{src/tools → tools}/logger.d.ts +151 -151
- package/lib/{src/tools → tools}/socket.d.ts +53 -53
- package/lib/{src/tools → tools}/store.d.ts +15 -15
- package/lib/{src/tools → tools}/template.d.ts +14 -14
- package/lib/{src/tools → tools}/utils.d.ts +73 -67
- package/lib/{src/tools → tools}/verify.d.ts +7 -7
- package/lib/{src/type → type}/base.d.ts +71 -71
- package/lib/{src/type → type}/client.d.ts +1121 -1106
- package/lib/{src/type → type}/device.d.ts +77 -77
- package/lib/{src/type → type}/index.d.ts +11 -11
- package/lib/{src/type → type}/quality.d.ts +77 -77
- package/lib/{src/type → type}/stream.d.ts +426 -426
- package/lib/xyrtc.cjs.js +1 -0
- package/lib/xyrtc.umd.js +1 -0
- package/package.json +119 -130
- package/scripts/build_lib.js +16 -0
- package/scripts/utils.js +27 -0
- package/scripts/webpack.common.js +139 -0
- package/scripts/webpack.dev.js +27 -0
- package/scripts/webpack.sdk.js +68 -0
- package/tsconfig.lib.json +37 -0
- package/lib/index.es.js +0 -3
- package/lib/index.js +0 -3
package/package.json
CHANGED
|
@@ -1,130 +1,119 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xylink/xy-rtc-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
],
|
|
11
|
-
"main": "lib/
|
|
12
|
-
"types": "lib/
|
|
13
|
-
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"build:demo": "
|
|
17
|
-
"
|
|
18
|
-
"build
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"version:beta": "npm version prerelease --preid=beta",
|
|
22
|
-
"publish:beta": "npm publish --tag beta --access public"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"@babel/
|
|
33
|
-
"@babel/
|
|
34
|
-
"@babel/
|
|
35
|
-
"@babel/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"revert",
|
|
121
|
-
"merge"
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"lint-staged": {
|
|
126
|
-
"{src,demo}/**/*.{js,jsx,json,ts,tsx,scss,sass,css,md}": [
|
|
127
|
-
"prettier --write"
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xylink/xy-rtc-sdk",
|
|
3
|
+
"version": "3.8.0-beta.1",
|
|
4
|
+
"description": "XYLink RTC SDK(小鱼易连WebRTC SDK)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"XYLink RTC SDK",
|
|
7
|
+
"XYLink WebRTC SDK",
|
|
8
|
+
"WebRTC SDK",
|
|
9
|
+
"RTC SDK"
|
|
10
|
+
],
|
|
11
|
+
"main": "lib/xyrtc.cjs.js",
|
|
12
|
+
"types": "lib/index.d.ts",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "npm run start",
|
|
15
|
+
"start": "cross-env NODE_ENV=development webpack serve --config ./scripts/webpack.dev.js",
|
|
16
|
+
"build:demo": "cross-env NODE_ENV=production webpack --config ./scripts/webpack.common.js",
|
|
17
|
+
"build:lib": "cross-env NODE_ENV=production webpack --config ./scripts/webpack.sdk.js",
|
|
18
|
+
"build:nodeLib": "node ./scripts/build_lib.js",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"xytools": "xytools",
|
|
21
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
22
|
+
"publish:beta": "npm publish --tag beta --access public"
|
|
23
|
+
},
|
|
24
|
+
"author": "jinghui-Luo",
|
|
25
|
+
"email": "luojinghui424@gmail.com",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/xylink-com/xylink-rtc-demo/issues",
|
|
28
|
+
"email": "luojinghui424@gmail.com"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.18.10",
|
|
32
|
+
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
33
|
+
"@babel/preset-env": "^7.18.10",
|
|
34
|
+
"@babel/preset-react": "^7.18.6",
|
|
35
|
+
"@babel/preset-typescript": "^7.7.4",
|
|
36
|
+
"@svgr/webpack": "^6.3.1",
|
|
37
|
+
"@types/clone-deep": "^4.0.1",
|
|
38
|
+
"@types/crypto-js": "^4.0.1",
|
|
39
|
+
"@types/downloadjs": "^1.4.2",
|
|
40
|
+
"@types/react": "^17.0.3",
|
|
41
|
+
"@types/react-dom": "^17.0.6",
|
|
42
|
+
"@types/uuid": "^8.3.0",
|
|
43
|
+
"antd": "4.10.1",
|
|
44
|
+
"axios": "^0.19.1",
|
|
45
|
+
"babel-loader": "^8.2.5",
|
|
46
|
+
"babel-plugin-import": "^1.13.5",
|
|
47
|
+
"clone-deep": "^4.0.1",
|
|
48
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
49
|
+
"core-js": "^3.24.1",
|
|
50
|
+
"cross-env": "^7.0.3",
|
|
51
|
+
"css-loader": "^6.7.1",
|
|
52
|
+
"dexie": "^2.0.4",
|
|
53
|
+
"dexie-export-import": "^1.0.0-rc.1",
|
|
54
|
+
"downloadjs": "^1.4.7",
|
|
55
|
+
"eslint": "^6.7.1",
|
|
56
|
+
"eslint-config-alloy": "^3.4.0",
|
|
57
|
+
"html-webpack-plugin": "^5.5.0",
|
|
58
|
+
"husky": "^4.3.8",
|
|
59
|
+
"jest": "^25.1.0",
|
|
60
|
+
"jszip": "^3.5.0",
|
|
61
|
+
"less": "^4.1.3",
|
|
62
|
+
"less-loader": "^11.0.0",
|
|
63
|
+
"lint-staged": "^10.5.4",
|
|
64
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
65
|
+
"postcss-loader": "^7.0.1",
|
|
66
|
+
"prettier": "^1.19.1",
|
|
67
|
+
"react": "^16.10.2",
|
|
68
|
+
"react-dom": "^16.10.2",
|
|
69
|
+
"sass": "^1.54.3",
|
|
70
|
+
"sass-loader": "^13.0.2",
|
|
71
|
+
"style-loader": "^3.3.1",
|
|
72
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
73
|
+
"ts-loader": "^9.3.1",
|
|
74
|
+
"typescript": "^4.3.2",
|
|
75
|
+
"validate-commit-msg": "^2.14.0",
|
|
76
|
+
"vconsole": "^3.3.4",
|
|
77
|
+
"webpack": "^5.74.0",
|
|
78
|
+
"webpack-cli": "^4.10.0",
|
|
79
|
+
"webpack-dev-server": "^4.9.3",
|
|
80
|
+
"worker-loader": "^3.0.8",
|
|
81
|
+
"xytools": "^1.5.7"
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"crypto-browserify": "^3.12.0",
|
|
85
|
+
"crypto-js": "^4.1.1",
|
|
86
|
+
"encryptlong": "^3.1.4",
|
|
87
|
+
"js-base64": "^3.6.1",
|
|
88
|
+
"uuid": "^7.0.2"
|
|
89
|
+
},
|
|
90
|
+
"husky": {
|
|
91
|
+
"hooks": {
|
|
92
|
+
"pre-commit": "lint-staged",
|
|
93
|
+
"commit-msg": "validate-commit-msg"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"config": {
|
|
97
|
+
"validate-commit-msg": {
|
|
98
|
+
"types": [
|
|
99
|
+
"feat",
|
|
100
|
+
"fix",
|
|
101
|
+
"docs",
|
|
102
|
+
"style",
|
|
103
|
+
"refactor",
|
|
104
|
+
"perf",
|
|
105
|
+
"test",
|
|
106
|
+
"build",
|
|
107
|
+
"ci",
|
|
108
|
+
"chore",
|
|
109
|
+
"revert",
|
|
110
|
+
"merge"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"lint-staged": {
|
|
115
|
+
"{src,demo}/**/*.{js,jsx,json,ts,tsx,scss,sass,css,md}": [
|
|
116
|
+
"prettier --write"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XYLink WebRTC SDK Build Npm Script
|
|
3
|
+
*
|
|
4
|
+
* Created at : 2022-08-12 19:11:52
|
|
5
|
+
* Last modified : 2022-08-16 21:01:37
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const shell = require('shelljs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const cross = `${path.resolve(__dirname, '../node_modules/cross-env/src/bin/cross-env.js')}`;
|
|
12
|
+
const webpack = `${path.resolve(__dirname, '../node_modules/webpack/bin/webpack.js')}`;
|
|
13
|
+
|
|
14
|
+
shell.exec(`${cross} NODE_ENV=production && ${webpack} --config ./scripts/webpack.sdk.js`, () => {
|
|
15
|
+
console.log('构建包结束');
|
|
16
|
+
});
|
package/scripts/utils.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const currentTime = () => {
|
|
2
|
+
const now = new Date();
|
|
3
|
+
const year = now.getFullYear(); //年
|
|
4
|
+
const month = now.getMonth() + 1; //月
|
|
5
|
+
const day = now.getDate(); //日
|
|
6
|
+
const hh = now.getHours(); //时
|
|
7
|
+
const mm = now.getMinutes(); //分
|
|
8
|
+
let clock = year + '-';
|
|
9
|
+
|
|
10
|
+
if (month < 10) clock += '0';
|
|
11
|
+
clock += month + '-';
|
|
12
|
+
|
|
13
|
+
if (day < 10) clock += '0';
|
|
14
|
+
clock += day + ' ';
|
|
15
|
+
|
|
16
|
+
if (hh < 10) clock += '0';
|
|
17
|
+
clock += hh + ':';
|
|
18
|
+
|
|
19
|
+
if (mm < 10) clock += '0';
|
|
20
|
+
clock += mm;
|
|
21
|
+
|
|
22
|
+
return clock;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
currentTime
|
|
27
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
|
+
const CopyPlugin = require('copy-webpack-plugin');
|
|
6
|
+
const { currentTime } = require('./utils');
|
|
7
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
8
|
+
|
|
9
|
+
const version = JSON.stringify(`${require('../package.json').version} - build on ${currentTime()}`);
|
|
10
|
+
const isProduction = !!(process.env.NODE_ENV === 'production');
|
|
11
|
+
|
|
12
|
+
const getStyleLoader = (...restLoader) => {
|
|
13
|
+
const loaders = [];
|
|
14
|
+
|
|
15
|
+
if (isProduction) {
|
|
16
|
+
loaders.push(MiniCssExtractPlugin.loader);
|
|
17
|
+
} else {
|
|
18
|
+
loaders.push('style-loader');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
loaders.push('css-loader');
|
|
22
|
+
|
|
23
|
+
restLoader.forEach((item) => {
|
|
24
|
+
loaders.push(item);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return loaders;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
entry: './demo/index.tsx',
|
|
32
|
+
output: {
|
|
33
|
+
filename: 'xyrtc.[name].js',
|
|
34
|
+
chunkFilename: 'xyrtc_[name].js',
|
|
35
|
+
path: path.resolve(__dirname, '../build'),
|
|
36
|
+
clean: true
|
|
37
|
+
},
|
|
38
|
+
mode: isProduction ? 'production' : 'development',
|
|
39
|
+
devtool: false,
|
|
40
|
+
resolve: {
|
|
41
|
+
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
|
42
|
+
alias: {
|
|
43
|
+
'@': path.resolve(__dirname, '../demo'),
|
|
44
|
+
'@xylink/xy-rtc-sdk': path.resolve(__dirname, '../src/index.ts')
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
externals: {},
|
|
48
|
+
optimization: {
|
|
49
|
+
moduleIds: 'deterministic',
|
|
50
|
+
runtimeChunk: 'single',
|
|
51
|
+
splitChunks: {
|
|
52
|
+
chunks: 'all',
|
|
53
|
+
cacheGroups: {
|
|
54
|
+
vendor: {
|
|
55
|
+
test: /[\\/]node_modules[\\/]/,
|
|
56
|
+
name: 'vendors',
|
|
57
|
+
chunks: 'all'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
minimize: false,
|
|
62
|
+
minimizer: [
|
|
63
|
+
new TerserPlugin({
|
|
64
|
+
terserOptions: { format: { comments: false } },
|
|
65
|
+
extractComments: false
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
cache: {
|
|
70
|
+
type: 'filesystem',
|
|
71
|
+
buildDependencies: {
|
|
72
|
+
// 更改配置文件时,重新缓存
|
|
73
|
+
config: [__filename]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
module: {
|
|
77
|
+
rules: [
|
|
78
|
+
{
|
|
79
|
+
test: /\.worker\.ts$/,
|
|
80
|
+
loader: 'worker-loader',
|
|
81
|
+
options: { inline: 'no-fallback' }
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
test: /\.(ts|tsx|js|jsx)$/,
|
|
85
|
+
loader: 'babel-loader',
|
|
86
|
+
options: {
|
|
87
|
+
cacheDirectory: true
|
|
88
|
+
},
|
|
89
|
+
exclude: /node_modules/
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
test: /\.css$/,
|
|
93
|
+
use: getStyleLoader()
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
test: /\.(css|scss)$/,
|
|
97
|
+
use: getStyleLoader('postcss-loader', 'sass-loader')
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
test: /\.(less)$/,
|
|
101
|
+
use: getStyleLoader({
|
|
102
|
+
loader: 'less-loader',
|
|
103
|
+
options: {
|
|
104
|
+
lessOptions: {
|
|
105
|
+
javascriptEnabled: true,
|
|
106
|
+
modifyVars: {
|
|
107
|
+
'@primary-color': '#3876ff',
|
|
108
|
+
'@success-color': '#32CFA8',
|
|
109
|
+
'@text-color': '#3A3A3A',
|
|
110
|
+
'@primary-5': '#3876ff'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|otf|ogg|wav)$/,
|
|
118
|
+
type: 'asset/resource',
|
|
119
|
+
generator: {
|
|
120
|
+
filename: 'source/[name].[hash:6][ext]'
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
test: /\.svg$/i,
|
|
125
|
+
issuer: /\.[jt]sx?$/,
|
|
126
|
+
use: ['@svgr/webpack']
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
plugins: [
|
|
131
|
+
new HtmlWebpackPlugin({ template: './public/index.html', publicPath: './' }),
|
|
132
|
+
new MiniCssExtractPlugin({ filename: 'css/[name].[hash].css' }),
|
|
133
|
+
new webpack.HotModuleReplacementPlugin({}),
|
|
134
|
+
new webpack.DefinePlugin({
|
|
135
|
+
_BUILDVERSION_: version
|
|
136
|
+
}),
|
|
137
|
+
new CopyPlugin({ patterns: ['public/login.ico'] })
|
|
138
|
+
]
|
|
139
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { merge } = require('webpack-merge');
|
|
3
|
+
const common = require('./webpack.common.js');
|
|
4
|
+
|
|
5
|
+
module.exports = merge(common, {
|
|
6
|
+
devServer: {
|
|
7
|
+
open: true,
|
|
8
|
+
host: 'localhost',
|
|
9
|
+
hot: true,
|
|
10
|
+
port: 8082,
|
|
11
|
+
static: {
|
|
12
|
+
directory: path.join(__dirname, 'public')
|
|
13
|
+
},
|
|
14
|
+
client: {
|
|
15
|
+
reconnect: 5
|
|
16
|
+
},
|
|
17
|
+
historyApiFallback: true
|
|
18
|
+
},
|
|
19
|
+
target: 'web',
|
|
20
|
+
cache: {
|
|
21
|
+
type: 'filesystem',
|
|
22
|
+
buildDependencies: {
|
|
23
|
+
config: [__filename]
|
|
24
|
+
},
|
|
25
|
+
name: 'development-cache'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const { currentTime } = require('./utils');
|
|
4
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
5
|
+
|
|
6
|
+
const version = JSON.stringify(`${require('../package.json').version} - build on ${currentTime()}`);
|
|
7
|
+
const isProduction = !!(process.env.NODE_ENV === 'production');
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
entry: {
|
|
11
|
+
umd: {
|
|
12
|
+
import: './src/index.ts',
|
|
13
|
+
library: { name: 'xyRTC', type: 'umd' }
|
|
14
|
+
},
|
|
15
|
+
cjs: {
|
|
16
|
+
import: './src/index.ts',
|
|
17
|
+
library: { type: 'commonjs' }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
output: {
|
|
21
|
+
filename: 'xyrtc.[name].js',
|
|
22
|
+
chunkFilename: 'xyrtc_[name].js',
|
|
23
|
+
path: path.resolve(__dirname, '../lib'),
|
|
24
|
+
clean: true
|
|
25
|
+
},
|
|
26
|
+
mode: isProduction ? 'production' : 'development',
|
|
27
|
+
devtool: false,
|
|
28
|
+
resolve: {
|
|
29
|
+
extensions: ['.ts', '.js'],
|
|
30
|
+
alias: {}
|
|
31
|
+
},
|
|
32
|
+
optimization: {
|
|
33
|
+
minimize: true,
|
|
34
|
+
minimizer: [
|
|
35
|
+
new TerserPlugin({
|
|
36
|
+
terserOptions: { format: { comments: false } },
|
|
37
|
+
extractComments: false
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
module: {
|
|
42
|
+
rules: [
|
|
43
|
+
{
|
|
44
|
+
test: /\.worker\.ts$/,
|
|
45
|
+
use: [
|
|
46
|
+
'babel-loader',
|
|
47
|
+
{
|
|
48
|
+
loader: 'worker-loader',
|
|
49
|
+
options: { inline: 'no-fallback' }
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
test: /\.(ts)$/,
|
|
55
|
+
use: [
|
|
56
|
+
'babel-loader',
|
|
57
|
+
{
|
|
58
|
+
loader: 'ts-loader',
|
|
59
|
+
options: {
|
|
60
|
+
configFile: 'tsconfig.lib.json'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
plugins: [new webpack.DefinePlugin({ _BUILDVERSION_: version })]
|
|
68
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"sourceMap": true,
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"preserveConstEnums": true,
|
|
12
|
+
"outDir": "lib",
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"useUnknownInCatchVariables": false,
|
|
18
|
+
"jsx": "preserve",
|
|
19
|
+
"lib": [
|
|
20
|
+
"es2015.promise",
|
|
21
|
+
"es5",
|
|
22
|
+
"dom",
|
|
23
|
+
"webworker"
|
|
24
|
+
],
|
|
25
|
+
"baseUrl": ".",
|
|
26
|
+
"paths": {}
|
|
27
|
+
},
|
|
28
|
+
"exclude": [
|
|
29
|
+
"node_modules",
|
|
30
|
+
"lib",
|
|
31
|
+
"output",
|
|
32
|
+
"build"
|
|
33
|
+
],
|
|
34
|
+
"include": [
|
|
35
|
+
"src/**/*",
|
|
36
|
+
]
|
|
37
|
+
}
|