tencentcloud-webar 2.0.3-dev.4 → 2.0.3-dev.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/build-esm/index.js +2 -2
- package/build-umd/avatar.umd.js +1 -1
- package/build-umd/hand-3d.umd.js +1 -1
- package/build-umd/stickers-3d.umd.js +1 -1
- package/build-umd/webar-sdk.umd.js +2 -2
- package/miniprogram_dist/core.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/plugin-3d.js +1 -1
- package/package.json +2 -1
- package/types/index.d.ts +689 -0
- package/.babelrc +0 -5
- package/babel.config.json +0 -4
- package/doc/EventBus /345/256/236/344/276/213/347/272/247/346/224/271/351/200/240/346/214/207/345/215/227.md" +0 -177
- package/doc//345/244/232SDK/345/256/236/344/276/213/344/272/222/347/233/270/345/275/261/345/223/215/347/232/204/345/270/270/350/247/201/351/227/256/351/242/230/345/217/212/350/247/243/345/206/263/346/226/271/346/241/210.md +0 -625
- package/webpack/common.js +0 -20
- package/webpack/esm/hand.dev.js +0 -150
- package/webpack/wx/hand.wx.dev.js +0 -164
package/webpack/esm/hand.dev.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
// const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
2
|
-
|
|
3
|
-
// const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
|
|
6
|
-
const workPath = process.cwd()
|
|
7
|
-
const WebpackObfuscator = require("webpack-obfuscator");
|
|
8
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
9
|
-
|
|
10
|
-
const buildPath = path.join(workPath, "build-esm");
|
|
11
|
-
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
12
|
-
const definePlugin = require('../config')
|
|
13
|
-
|
|
14
|
-
const useCustomDetect = true
|
|
15
|
-
const conditionalCompiler = {
|
|
16
|
-
loader: "js-conditional-compile-loader",
|
|
17
|
-
options: {
|
|
18
|
-
platform_h5: true, // enabled by `npm run build --myflag`
|
|
19
|
-
platform_wx: false, // enabled by `npm run build --myflag`
|
|
20
|
-
'3d_enabled': true, // three.js模式
|
|
21
|
-
pixi_3d_enabled: false, // pixi3d模式
|
|
22
|
-
for_console_debug: true, // 控制台调试
|
|
23
|
-
avatar_enabled: false, // 3D表情
|
|
24
|
-
build_esm: true,
|
|
25
|
-
hand_sdk: true,
|
|
26
|
-
custom_detect: useCustomDetect,
|
|
27
|
-
offical_detect: !useCustomDetect
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const webpack = require("webpack")
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
mode: "production",
|
|
34
|
-
experiments: {
|
|
35
|
-
outputModule: true,
|
|
36
|
-
},
|
|
37
|
-
entry: {
|
|
38
|
-
index: "./index.ts"
|
|
39
|
-
},
|
|
40
|
-
output: {
|
|
41
|
-
filename: "[name].js",
|
|
42
|
-
path: buildPath,
|
|
43
|
-
libraryTarget: "module",
|
|
44
|
-
clean: true,
|
|
45
|
-
publicPath: 'https://webar-static.tencent-cloud.com/ar-sdk/resources/dev/',
|
|
46
|
-
chunkFilename: '[name].[hash].js'
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
module: {
|
|
50
|
-
rules: [
|
|
51
|
-
{
|
|
52
|
-
test: /\.worker\.ts$/,
|
|
53
|
-
use: {
|
|
54
|
-
loader: "worker-loader",
|
|
55
|
-
options: {
|
|
56
|
-
filename: "[name].js",
|
|
57
|
-
inline: "no-fallback",
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
test: /\.(png|jpg)$/i,
|
|
63
|
-
use: {
|
|
64
|
-
loader: 'url-loader',
|
|
65
|
-
options: {
|
|
66
|
-
limit: 8192,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
exclude: [/node_modules/]
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
test: /\.tsx?$/,
|
|
74
|
-
use: [
|
|
75
|
-
{
|
|
76
|
-
loader: 'thread-loader',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
loader: "ts-loader",
|
|
80
|
-
options: {
|
|
81
|
-
configFile: "tsconfig.esm.json",
|
|
82
|
-
happyPackMode: true
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
conditionalCompiler,
|
|
86
|
-
],
|
|
87
|
-
exclude: [
|
|
88
|
-
/node_modules/,
|
|
89
|
-
path.resolve(workPath, "src/wx")
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
test: /\.js$/,
|
|
94
|
-
use: [
|
|
95
|
-
{
|
|
96
|
-
loader: 'babel-loader',
|
|
97
|
-
options: {
|
|
98
|
-
presets: ['@babel/preset-env']
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
conditionalCompiler
|
|
102
|
-
],
|
|
103
|
-
exclude: [
|
|
104
|
-
/node_modules/,
|
|
105
|
-
path.resolve(workPath, "src/wx"),
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
test: /\.(glsl|vs|fs|vert|frag)$/,
|
|
110
|
-
loader: "ts-shader-loader",
|
|
111
|
-
exclude: [path.resolve(workPath, "src/wx")],
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
resolve: {
|
|
116
|
-
extensions: [".tsx", ".ts", ".js"],
|
|
117
|
-
plugins: [
|
|
118
|
-
new TsconfigPathsPlugin({
|
|
119
|
-
configFile: path.resolve(workPath, "tsconfig.esm.json"),
|
|
120
|
-
}),
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
plugins: [
|
|
124
|
-
definePlugin
|
|
125
|
-
],
|
|
126
|
-
optimization: {
|
|
127
|
-
usedExports: true,
|
|
128
|
-
splitChunks: {
|
|
129
|
-
// chunks: 'all',
|
|
130
|
-
cacheGroups: {
|
|
131
|
-
three: {
|
|
132
|
-
test: /[\\/]three[\\/]/,
|
|
133
|
-
name: 'lib-3d',
|
|
134
|
-
chunks: 'all'
|
|
135
|
-
},
|
|
136
|
-
// packages: {
|
|
137
|
-
// test:/[\\/]packages[\\/]/,
|
|
138
|
-
// name: 'lib',
|
|
139
|
-
// chunks: 'all'
|
|
140
|
-
// }
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
minimize: false,
|
|
144
|
-
minimizer: [
|
|
145
|
-
new TerserPlugin({
|
|
146
|
-
extractComments: false,
|
|
147
|
-
}),
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
// const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
|
|
6
|
-
const version = parseInt(Math.random() * 100000000).toString();
|
|
7
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
8
|
-
const webpack = require("webpack");
|
|
9
|
-
const workPath = process.cwd();
|
|
10
|
-
|
|
11
|
-
const buildPath = path.join(
|
|
12
|
-
workPath,
|
|
13
|
-
"miniprogram_dist"
|
|
14
|
-
// "miniprogram/miniprogram/pages/index"
|
|
15
|
-
);
|
|
16
|
-
const CopyPlugin = require("copy-webpack-plugin");
|
|
17
|
-
const conditionalCompiler = {
|
|
18
|
-
loader: "js-conditional-compile-loader",
|
|
19
|
-
options: {
|
|
20
|
-
platform_wx: true,
|
|
21
|
-
platform_h5: false,
|
|
22
|
-
'3d_enabled': true, // three.js模式
|
|
23
|
-
hand_sdk: true,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
28
|
-
const definePlugin = require("../config");
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
class WxPrefixPlugin {
|
|
32
|
-
apply(compiler) {
|
|
33
|
-
compiler.hooks.emit.tapAsync("WxPrefixPlugin", (compilation, callback) => {
|
|
34
|
-
// console.log('compilation',compilation)
|
|
35
|
-
compilation.chunks.forEach((chunk) => {
|
|
36
|
-
chunk.files.forEach((filename) => {
|
|
37
|
-
// console.log(compilation.assets[filename].source())
|
|
38
|
-
// worker不处理
|
|
39
|
-
if (filename.indexOf("worker") === -1) {
|
|
40
|
-
let newContent =
|
|
41
|
-
`var self = wx;` + compilation.assets[filename].source();
|
|
42
|
-
compilation.assets[filename] = {
|
|
43
|
-
source: () => {
|
|
44
|
-
return newContent;
|
|
45
|
-
},
|
|
46
|
-
size: () => {
|
|
47
|
-
return Buffer.byteLength(newContent, "utf8");
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
callback();
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
module.exports = {
|
|
59
|
-
mode: "production",
|
|
60
|
-
// mode: "production",
|
|
61
|
-
experiments: {
|
|
62
|
-
outputModule: true,
|
|
63
|
-
},
|
|
64
|
-
entry: {
|
|
65
|
-
hand: "./src/wx/hand.js",
|
|
66
|
-
"worker/tick.worker": "./src/wx/worker/tick.worker.js",
|
|
67
|
-
"plugin-3d": "./src/plugins/stickers-3d/index.ts",
|
|
68
|
-
},
|
|
69
|
-
output: {
|
|
70
|
-
filename: "[name].js",
|
|
71
|
-
path: buildPath,
|
|
72
|
-
libraryTarget: "module",
|
|
73
|
-
},
|
|
74
|
-
module: {
|
|
75
|
-
rules: [
|
|
76
|
-
{
|
|
77
|
-
test: /\.js$/,
|
|
78
|
-
use: [conditionalCompiler],
|
|
79
|
-
exclude: [
|
|
80
|
-
/node_modules/,
|
|
81
|
-
path.resolve(workPath, "miniprogram"),
|
|
82
|
-
path.resolve(workPath, "src/h5/"),
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
test: /\.tsx?$/,
|
|
87
|
-
use: [
|
|
88
|
-
{
|
|
89
|
-
loader: "thread-loader",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
loader: "ts-loader",
|
|
93
|
-
options: {
|
|
94
|
-
configFile: "tsconfig.esm.json",
|
|
95
|
-
happyPackMode: true,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
conditionalCompiler,
|
|
99
|
-
],
|
|
100
|
-
exclude: [
|
|
101
|
-
/node_modules/,
|
|
102
|
-
path.resolve(workPath, "miniprogram"),
|
|
103
|
-
path.resolve(workPath, "src/h5/"),
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
test: /\.(glsl|vs|fs|vert|frag)$/,
|
|
108
|
-
loader: "ts-shader-loader",
|
|
109
|
-
exclude: [path.resolve(workPath, "src/wx")],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
resolve: {
|
|
114
|
-
extensions: [".tsx", ".ts", ".js"],
|
|
115
|
-
plugins: [
|
|
116
|
-
new TsconfigPathsPlugin({
|
|
117
|
-
configFile: path.resolve(workPath, "tsconfig.json"),
|
|
118
|
-
}),
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
plugins: [
|
|
122
|
-
definePlugin,
|
|
123
|
-
new WxPrefixPlugin(),
|
|
124
|
-
new CopyPlugin({
|
|
125
|
-
patterns: [
|
|
126
|
-
{
|
|
127
|
-
from: path.resolve(workPath, "src/wx/webar.js"),
|
|
128
|
-
to: path.resolve(workPath, "miniprogram_dist/webar.js"),
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
}),
|
|
132
|
-
],
|
|
133
|
-
optimization: {
|
|
134
|
-
usedExports: true,
|
|
135
|
-
sideEffects: true,
|
|
136
|
-
providedExports: true,
|
|
137
|
-
splitChunks: {
|
|
138
|
-
cacheGroups: {
|
|
139
|
-
// pixi: {
|
|
140
|
-
// test: /[\\/]pixi[\\/]/,
|
|
141
|
-
// name: "lib",
|
|
142
|
-
// chunks: "all",
|
|
143
|
-
// },
|
|
144
|
-
|
|
145
|
-
// three: {
|
|
146
|
-
// test: /[\\/]three[\\/]/,
|
|
147
|
-
// name: "three",
|
|
148
|
-
// chunks: "all",
|
|
149
|
-
// },
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
minimize: true,
|
|
153
|
-
minimizer: [
|
|
154
|
-
new TerserPlugin({
|
|
155
|
-
extractComments: false,
|
|
156
|
-
terserOptions: {
|
|
157
|
-
format: {
|
|
158
|
-
comments: false,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
}),
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
};
|