tencentcloud-webar 1.0.23-9 → 1.0.23
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/auth.ts +1 -32
- package/build-esm/450.js +1 -0
- package/build-esm/682.js +1 -0
- package/build-esm/avatar.js +1 -1
- package/build-esm/hand3d.js +1 -0
- package/build-esm/index.js +1 -1
- package/build-esm/lib-3d.js +2 -2
- package/build-esm/sticker3d.js +1 -1
- package/build-umd/avatar.umd.js +167 -4
- package/build-umd/hand-3d.umd.48af7ededdd387d6d5e1.js +11 -0
- package/build-umd/stickers-3d.umd.js +4 -4
- package/build-umd/webar-sdk.umd.js +2 -2
- package/miniprogram_dist/0.wasm.br +0 -0
- package/miniprogram_dist/core.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/lib.js +1 -1
- package/miniprogram_dist/plugin-3d.js +1 -1
- package/miniprogram_dist/webar.js +1 -1
- package/miniprogram_dist/worker/tick.worker.js +1 -1
- package/package.json +3 -1
- package/webpack/esm/hand.dev.js +150 -0
- package/webpack/wx/hand.wx.dev.js +165 -0
- package/build-esm/542.js +0 -1
- package/build-esm/avatar.worker.js +0 -6
- package/build-esm/sticker3d.worker.js +0 -6
- package/miniprogram_dist/0.wasm +0 -0
- package/miniprogram_dist/auth.js +0 -1
- package/miniprogram_dist/lib-3d.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./
|
|
1
|
+
import"./core";import"./lib";export{ArSdk}from"./index";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
let e;worker.onMessage((r=>{"start"===r?e=setInterval((()=>{worker.postMessage({})}),33):clearInterval(e)}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tencentcloud-webar",
|
|
3
|
-
"version": "1.0.23
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build-esm/index.js",
|
|
6
6
|
"devDependencies": {
|
|
@@ -61,9 +61,11 @@
|
|
|
61
61
|
"build": "npm run install-pixi-dependency && npm run build-esm && npm run build-umd && npm run build-wx",
|
|
62
62
|
"build-esm:dev": "npx webpack --config ./webpack/esm/webpack.esm.dev.js && node upload.js",
|
|
63
63
|
"build-esm": "npx webpack --config ./webpack/esm/webpack.prod.js && node upload.js",
|
|
64
|
+
"build-hand:dev": "npx webpack --config ./webpack/esm/hand.dev.js && node upload.js",
|
|
64
65
|
"build-umd": "npx webpack --config ./webpack/umd/webpack.umd.js",
|
|
65
66
|
"build-umd:dev": "npx webpack --config ./webpack/umd/webpack.umd.dev.js",
|
|
66
67
|
"build-wx:dev": "npx webpack --config ./webpack/wx/webpack.wx.dev.js",
|
|
68
|
+
"build-wx-hand:dev": "npx webpack --config ./webpack/wx/hand.wx.dev.js",
|
|
67
69
|
"build-wx": "npx webpack --config ./webpack/wx/webpack.wx.js",
|
|
68
70
|
"build-metric": "npx webpack --config ./webpack/metric/webpack.config.js && cd ./packages/metric-solver && npm install && node enc.js",
|
|
69
71
|
"pack-custom-detect": "node ./packages/wasm/enc.js",
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
face_sdk: false,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
29
|
+
const definePlugin = require("../config");
|
|
30
|
+
|
|
31
|
+
//
|
|
32
|
+
class WxPrefixPlugin {
|
|
33
|
+
apply(compiler) {
|
|
34
|
+
compiler.hooks.emit.tapAsync("WxPrefixPlugin", (compilation, callback) => {
|
|
35
|
+
// console.log('compilation',compilation)
|
|
36
|
+
compilation.chunks.forEach((chunk) => {
|
|
37
|
+
chunk.files.forEach((filename) => {
|
|
38
|
+
// console.log(compilation.assets[filename].source())
|
|
39
|
+
// worker不处理
|
|
40
|
+
if (filename.indexOf("worker") === -1) {
|
|
41
|
+
let newContent =
|
|
42
|
+
`var self = wx;` + compilation.assets[filename].source();
|
|
43
|
+
compilation.assets[filename] = {
|
|
44
|
+
source: () => {
|
|
45
|
+
return newContent;
|
|
46
|
+
},
|
|
47
|
+
size: () => {
|
|
48
|
+
return Buffer.byteLength(newContent, "utf8");
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
callback();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
mode: "production",
|
|
61
|
+
// mode: "production",
|
|
62
|
+
experiments: {
|
|
63
|
+
outputModule: true,
|
|
64
|
+
},
|
|
65
|
+
entry: {
|
|
66
|
+
hand: "./src/wx/hand.js",
|
|
67
|
+
"worker/tick.worker": "./src/wx/worker/tick.worker.js",
|
|
68
|
+
"plugin-3d": "./src/plugins/stickers-3d/index.ts",
|
|
69
|
+
},
|
|
70
|
+
output: {
|
|
71
|
+
filename: "[name].js",
|
|
72
|
+
path: buildPath,
|
|
73
|
+
libraryTarget: "module",
|
|
74
|
+
},
|
|
75
|
+
module: {
|
|
76
|
+
rules: [
|
|
77
|
+
{
|
|
78
|
+
test: /\.js$/,
|
|
79
|
+
use: [conditionalCompiler],
|
|
80
|
+
exclude: [
|
|
81
|
+
/node_modules/,
|
|
82
|
+
path.resolve(workPath, "miniprogram"),
|
|
83
|
+
path.resolve(workPath, "src/h5/"),
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
test: /\.tsx?$/,
|
|
88
|
+
use: [
|
|
89
|
+
{
|
|
90
|
+
loader: "thread-loader",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
loader: "ts-loader",
|
|
94
|
+
options: {
|
|
95
|
+
configFile: "tsconfig.esm.json",
|
|
96
|
+
happyPackMode: true,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
conditionalCompiler,
|
|
100
|
+
],
|
|
101
|
+
exclude: [
|
|
102
|
+
/node_modules/,
|
|
103
|
+
path.resolve(workPath, "miniprogram"),
|
|
104
|
+
path.resolve(workPath, "src/h5/"),
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
test: /\.(glsl|vs|fs|vert|frag)$/,
|
|
109
|
+
loader: "ts-shader-loader",
|
|
110
|
+
exclude: [path.resolve(workPath, "src/wx")],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
resolve: {
|
|
115
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
116
|
+
plugins: [
|
|
117
|
+
new TsconfigPathsPlugin({
|
|
118
|
+
configFile: path.resolve(workPath, "tsconfig.json"),
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
plugins: [
|
|
123
|
+
definePlugin,
|
|
124
|
+
new WxPrefixPlugin(),
|
|
125
|
+
new CopyPlugin({
|
|
126
|
+
patterns: [
|
|
127
|
+
{
|
|
128
|
+
from: path.resolve(workPath, "src/wx/webar.js"),
|
|
129
|
+
to: path.resolve(workPath, "miniprogram_dist/webar.js"),
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
}),
|
|
133
|
+
],
|
|
134
|
+
optimization: {
|
|
135
|
+
usedExports: true,
|
|
136
|
+
sideEffects: true,
|
|
137
|
+
providedExports: true,
|
|
138
|
+
splitChunks: {
|
|
139
|
+
cacheGroups: {
|
|
140
|
+
// pixi: {
|
|
141
|
+
// test: /[\\/]pixi[\\/]/,
|
|
142
|
+
// name: "lib",
|
|
143
|
+
// chunks: "all",
|
|
144
|
+
// },
|
|
145
|
+
|
|
146
|
+
// three: {
|
|
147
|
+
// test: /[\\/]three[\\/]/,
|
|
148
|
+
// name: "three",
|
|
149
|
+
// chunks: "all",
|
|
150
|
+
// },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
minimize: true,
|
|
154
|
+
minimizer: [
|
|
155
|
+
new TerserPlugin({
|
|
156
|
+
extractComments: false,
|
|
157
|
+
terserOptions: {
|
|
158
|
+
format: {
|
|
159
|
+
comments: false,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
};
|