zmp-cli 3.15.5 → 3.15.6-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 +1 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/init-zmp-ui.js +1 -216
- package/create/templates/app-parameters.js +9 -25
- package/create/templates/common/webpack/build.js +2 -40
- package/create/templates/copy-assets.js +1 -158
- package/create/templates/core/copy-assets.js +14 -82
- package/create/templates/core/generate-home-page.js +16 -38
- package/create/templates/core/generate-root.js +28 -63
- package/create/templates/core/generate-routes.js +12 -38
- package/create/templates/core/generate-scripts.js +16 -65
- package/create/templates/create-folders.js +1 -30
- package/create/templates/generate-config-xml.js +2 -9
- package/create/templates/generate-index.js +10 -35
- package/create/templates/generate-manifest.js +1 -49
- package/create/templates/generate-recoil.js +4 -16
- package/create/templates/generate-routes.js +1 -16
- package/create/templates/generate-scripts.js +1 -16
- package/create/templates/generate-service-worker.js +4 -10
- package/create/templates/generate-store.js +4 -15
- package/create/templates/generate-styles.js +10 -64
- package/create/templates/generate-webpack-config.js +43 -125
- package/create/templates/generate-zmp-custom.js +14 -72
- package/create/templates/react/copy-assets.js +1 -85
- package/create/templates/react/generate-home-page.js +20 -50
- package/create/templates/react/generate-root.js +15 -44
- package/create/templates/react/generate-routes.js +1 -16
- package/create/templates/react/generate-scripts.js +12 -38
- package/create/templates/react/pages/404.js +2 -10
- package/create/templates/react/pages/about.js +2 -10
- package/create/templates/react/pages/catalog.js +3 -17
- package/create/templates/react/pages/dynamic-route.js +2 -10
- package/create/templates/react/pages/form.js +6 -26
- package/create/templates/react/pages/index copy.js +1 -17
- package/create/templates/react/pages/index.js +1 -17
- package/create/templates/react/pages/settings.js +3 -17
- package/create/templates/react/pages/user.js +8 -27
- package/create/templates/react-typescript/components/app-items.js +2 -9
- package/create/templates/react-typescript/components/index.js +1 -9
- package/create/templates/react-typescript/components/navbar-back.js +2 -9
- package/create/templates/react-typescript/components/user-card.js +2 -9
- package/create/templates/react-typescript/copy-assets.js +1 -94
- package/create/templates/react-typescript/generate-home-page.js +20 -52
- package/create/templates/react-typescript/generate-root.js +14 -45
- package/create/templates/react-typescript/generate-routes.js +1 -12
- package/create/templates/react-typescript/generate-scripts.js +12 -37
- package/create/templates/react-typescript/pages/404.js +2 -10
- package/create/templates/react-typescript/pages/about.js +2 -10
- package/create/templates/react-typescript/pages/catalog.js +3 -17
- package/create/templates/react-typescript/pages/dynamic-route.js +2 -10
- package/create/templates/react-typescript/pages/form.js +6 -26
- package/create/templates/react-typescript/pages/index.js +1 -17
- package/create/templates/react-typescript/pages/settings.js +3 -17
- package/create/templates/react-typescript/pages/user.js +8 -27
- package/create/templates/svelte/copy-assets.js +1 -47
- package/create/templates/svelte/generate-home-page.js +20 -56
- package/create/templates/svelte/generate-root.js +22 -80
- package/create/templates/svelte/generate-routes.js +7 -22
- package/create/templates/svelte/generate-scripts.js +7 -23
- package/create/templates/vue/copy-assets.js +1 -67
- package/create/templates/vue/generate-home-page.js +2 -8
- package/create/templates/vue/generate-root.js +3 -13
- package/create/templates/vue/generate-routes.js +1 -7
- package/create/templates/vue/generate-scripts.js +9 -26
- package/create/templates/vue/global-components.d.js +1 -0
- package/create/templates/zaui/copy-assets.js +1 -90
- package/create/templates/zaui/generate-home-page.js +27 -53
- package/create/templates/zaui/generate-root.js +14 -34
- package/create/templates/zaui/generate-routes.js +1 -10
- package/create/templates/zaui/generate-scripts.js +6 -20
- package/create/templates/zaui/generate-user-card.js +3 -18
- package/create/templates/zaui/pages/about.js +3 -20
- package/create/templates/zaui/pages/form.js +3 -20
- package/create/templates/zaui/pages/index.js +1 -9
- package/create/templates/zaui/pages/user.js +3 -20
- package/create/utils/colors.js +1 -94
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-gitignore.js +1 -43
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/generate-package-json.js +1 -132
- package/create/utils/generate-readme.js +1 -28
- package/create/utils/get-options.js +1 -204
- package/create/utils/indent.js +1 -31
- package/create/utils/npm-scripts.js +1 -62
- package/create/utils/string.js +1 -13
- package/create/utils/styles-extension.js +1 -9
- package/create/utils/template-if.js +1 -9
- package/deploy/index.js +1 -148
- package/deploy/utils/get-options.js +1 -69
- package/deploy/utils/request-upload.js +1 -34
- package/deploy/utils/upload-app.js +1 -82
- package/index.js +1 -319
- package/login/index.js +1 -169
- package/login/utils/get-options.js +1 -58
- package/login/utils/zalo-login.js +1 -32
- package/migrate/icons/update-icon-v3.js +1 -19
- package/migrate/index.js +1 -60
- package/migrate/utils/get-options.js +1 -46
- package/migrate/utils/migrate-react.js +1 -33
- package/package.json +11 -39
- package/start/generate-hr-config.js +1 -59
- package/start/index.js +1 -382
- package/sync/index-to-app-config.js +1 -146
- package/sync/index.js +1 -55
- package/utils/axios.js +1 -15
- package/utils/check-update.js +1 -53
- package/utils/constants.js +1 -20
- package/utils/env.js +1 -39
- package/utils/error.js +1 -16
- package/utils/find-files-by-ext.js +1 -27
- package/utils/find-free-port.js +1 -11
- package/utils/fs-extra.js +1 -90
- package/utils/generate-pages-map.js +1 -17
- package/utils/get-app-info.js +1 -22
- package/utils/get-current-project.js +1 -25
- package/utils/get-ip.js +1 -19
- package/utils/log.js +1 -19
- package/utils/node-blob.js +1 -106
- package/utils/resumable.d.js +1 -0
- package/utils/resumable.js +1 -1204
- package/utils/spinner.js +1 -25
- package/utils/tunnel.js +1 -36
- package/.editorconfig +0 -15
- package/.eslintignore +0 -8
- package/.eslintrc.js +0 -10
- package/.vscode/launch.json +0 -23
- package/LICENSE +0 -21
- package/README.git.md +0 -37
- package/assets/index.js +0 -147
- package/build/dist/index.dev.js +0 -217
- package/config/dist/index.dev.js +0 -48
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/utils/dist/get-options.dev.js +0 -277
- package/deploy/dist/index.dev.js +0 -227
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/screenshots/wellcome.jpg +0 -0
- package/show-qr-app/assets/css/style.css +0 -87
- package/show-qr-app/assets/js/qrcode.min.js +0 -1
- package/show-qr-app/index.html +0 -57
- package/show-qr-app/package.json +0 -14
- package/start/dist/index.dev.js +0 -312
- package/ui/server.js +0 -194
- package/ui/www/css/app.css +0 -1
- package/ui/www/css/app.css.map +0 -1
- package/ui/www/fonts/ZMPIcons-Regular.eot +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.ttf +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff2 +0 -0
- package/ui/www/images/logo.png +0 -0
- package/ui/www/index.html +0 -1
- package/ui/www/js/app.js +0 -3
- package/ui/www/js/app.js.LICENSE.txt +0 -20
- package/ui/www/js/app.js.map +0 -1
- package/ui/www/static/icons/apple-touch-icon.png +0 -0
- package/ui/www/static/icons/favicon.png +0 -0
- package/utils/dist/get-app-info.dev.js +0 -54
package/start/index.js
CHANGED
|
@@ -1,382 +1 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint no-console: off */
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const ora = require('ora');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const qrcode = require('qrcode-terminal');
|
|
7
|
-
const logSymbols = require('log-symbols');
|
|
8
|
-
const { createServer } = require('vite');
|
|
9
|
-
const chii = require('chii');
|
|
10
|
-
const { hri } = require('human-readable-ids');
|
|
11
|
-
|
|
12
|
-
const config = require('../config');
|
|
13
|
-
const envUtils = require('../utils/env');
|
|
14
|
-
const fs = require('../utils/fs-extra');
|
|
15
|
-
const fse = require('../utils/fs-extra');
|
|
16
|
-
const findFreePort = require('../utils/find-free-port');
|
|
17
|
-
const { openTunnel } = require('../utils/tunnel');
|
|
18
|
-
const { deviceModeSetup } = require('../utils/constants');
|
|
19
|
-
const { generateHrFromIndex } = require('./generate-hr-config');
|
|
20
|
-
|
|
21
|
-
const spinner = ora('Starting mini app...');
|
|
22
|
-
|
|
23
|
-
module.exports = async (options = {}, logger, { exitOnError = true } = {}) => {
|
|
24
|
-
function errorExit(err) {
|
|
25
|
-
logger.error(err.stderr || err);
|
|
26
|
-
if (exitOnError) process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
if (!logger) {
|
|
29
|
-
// eslint-disable-next-line
|
|
30
|
-
logger = {
|
|
31
|
-
statusStart() {},
|
|
32
|
-
statusDone() {},
|
|
33
|
-
statusError() {},
|
|
34
|
-
text() {},
|
|
35
|
-
error() {},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
spinner.start();
|
|
39
|
-
const cwd = options.cwd || process.cwd();
|
|
40
|
-
const appId = options.appId || envUtils.getEnv(config.env.appId);
|
|
41
|
-
const previewOnZalo = options.previewOnZalo;
|
|
42
|
-
const isIOS = options.ios;
|
|
43
|
-
const iosHostName = options.iosHostName;
|
|
44
|
-
const usingFrame = options.frame;
|
|
45
|
-
const host = isIOS ? iosHostName : 'localhost';
|
|
46
|
-
const port = options.port;
|
|
47
|
-
const remoteDebugPort = port - 2;
|
|
48
|
-
const mode = options.mode || (previewOnZalo ? 'production' : 'development');
|
|
49
|
-
const deviceMode = options.deviceMode;
|
|
50
|
-
try {
|
|
51
|
-
if (previewOnZalo) {
|
|
52
|
-
const hrConfigPath = path.join(cwd, 'hr.config.json');
|
|
53
|
-
const remoteDebugScript = {
|
|
54
|
-
id: 'remote-debug-script',
|
|
55
|
-
innerHTML: `(function () { var script = document.createElement('script'); script.src='http://${host}:${remoteDebugPort}/target.js'; document.body.appendChild(script); })()`,
|
|
56
|
-
type: 'text/javascript',
|
|
57
|
-
};
|
|
58
|
-
if (!fs.existsSync(hrConfigPath)) {
|
|
59
|
-
const hrConfig = {
|
|
60
|
-
listCSS: [],
|
|
61
|
-
listJS: [
|
|
62
|
-
{
|
|
63
|
-
src: '/src/app.js',
|
|
64
|
-
type: 'module',
|
|
65
|
-
async: true,
|
|
66
|
-
},
|
|
67
|
-
remoteDebugScript,
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
fs.writeFileSync(hrConfigPath, JSON.stringify(hrConfig, undefined, 4));
|
|
71
|
-
} else {
|
|
72
|
-
const fileData = fs.readFileSync(hrConfigPath);
|
|
73
|
-
const hrConfig = JSON.parse(fileData);
|
|
74
|
-
|
|
75
|
-
let listJS = hrConfig.listJS;
|
|
76
|
-
if (!Array.isArray(listJS)) {
|
|
77
|
-
listJS = [];
|
|
78
|
-
}
|
|
79
|
-
const remoteDebugScriptIndex = listJS.findIndex(
|
|
80
|
-
(js) => js.id === 'remote-debug-script'
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
if (remoteDebugScriptIndex <= 0) {
|
|
84
|
-
listJS.push(remoteDebugScript);
|
|
85
|
-
} else {
|
|
86
|
-
listJS.splice(remoteDebugScriptIndex, 1);
|
|
87
|
-
listJS.push(remoteDebugScript);
|
|
88
|
-
}
|
|
89
|
-
hrConfig.listJS = listJS;
|
|
90
|
-
fs.writeFileSync(hrConfigPath, JSON.stringify(hrConfig, undefined, 4));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const localServer = {};
|
|
94
|
-
|
|
95
|
-
const publicServer = {
|
|
96
|
-
host: '0.0.0.0',
|
|
97
|
-
hmr: {
|
|
98
|
-
host: host,
|
|
99
|
-
protocol: 'ws',
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
let viteConfig = 'vite.config.js';
|
|
104
|
-
const isTypeScriptProject = fse.existsSync(
|
|
105
|
-
path.join(cwd, 'vite.config.ts')
|
|
106
|
-
);
|
|
107
|
-
if (isTypeScriptProject) {
|
|
108
|
-
viteConfig = 'vite.config.ts';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
let server;
|
|
112
|
-
let subdomain;
|
|
113
|
-
let freePort;
|
|
114
|
-
if (deviceMode) {
|
|
115
|
-
// generate a subdomain for the tunnel
|
|
116
|
-
subdomain = hri.random();
|
|
117
|
-
// start the chii server
|
|
118
|
-
freePort = await findFreePort();
|
|
119
|
-
chii.start({
|
|
120
|
-
port: freePort,
|
|
121
|
-
});
|
|
122
|
-
// expose the chii server by using localtunnel
|
|
123
|
-
const chiiUrl = await openTunnel(freePort);
|
|
124
|
-
const remoteHost = `${subdomain}.${deviceModeSetup.TUNNEL_SERVER_HOST}`;
|
|
125
|
-
|
|
126
|
-
server = await createServer({
|
|
127
|
-
configFile: path.join(cwd, viteConfig),
|
|
128
|
-
root: cwd,
|
|
129
|
-
mode,
|
|
130
|
-
define: {
|
|
131
|
-
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
132
|
-
'process.env.previewOnZalo': true,
|
|
133
|
-
},
|
|
134
|
-
server: {
|
|
135
|
-
port: port,
|
|
136
|
-
host: 'localhost',
|
|
137
|
-
origin: `https://${remoteHost}`,
|
|
138
|
-
base: `/zapps/${appId}/`,
|
|
139
|
-
hmr: {
|
|
140
|
-
host: remoteHost,
|
|
141
|
-
clientPort: 443,
|
|
142
|
-
protocol: 'wss',
|
|
143
|
-
},
|
|
144
|
-
https: false,
|
|
145
|
-
},
|
|
146
|
-
plugins: [
|
|
147
|
-
{
|
|
148
|
-
name: 'hr-config-plugin',
|
|
149
|
-
configureServer(server) {
|
|
150
|
-
const setupCors = (req, res) => {
|
|
151
|
-
if (
|
|
152
|
-
['https://h5.zdn.vn', 'zbrowser://h5.zdn.vn'].includes(
|
|
153
|
-
req.headers.origin
|
|
154
|
-
)
|
|
155
|
-
) {
|
|
156
|
-
res.setHeader(
|
|
157
|
-
'Access-Control-Allow-Origin',
|
|
158
|
-
req.headers.origin
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
server.middlewares.use('/app-config.json', (req, res, next) => {
|
|
163
|
-
// there would be another originalUrl - app-config.json?module that would be dynamicly imported in js format
|
|
164
|
-
if (req.originalUrl === '/app-config.json') {
|
|
165
|
-
res.setHeader('Content-Type', 'application/javascript');
|
|
166
|
-
setupCors(req, res);
|
|
167
|
-
return res.end(
|
|
168
|
-
fs.readFileSync(path.join(cwd, 'app-config.json'))
|
|
169
|
-
);
|
|
170
|
-
} else {
|
|
171
|
-
return next();
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
server.middlewares.use('/hr.config.json', async (req, res) => {
|
|
175
|
-
res.setHeader('Content-Type', 'application/json');
|
|
176
|
-
setupCors(req, res);
|
|
177
|
-
const hrConfig = await generateHrFromIndex(
|
|
178
|
-
`http://localhost:${app.httpServer.address().port}`,
|
|
179
|
-
{
|
|
180
|
-
chiiUrl,
|
|
181
|
-
exposedUrl: `https://${subdomain}.${deviceModeSetup.TUNNEL_SERVER_HOST}`,
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
res.end(JSON.stringify(hrConfig));
|
|
185
|
-
});
|
|
186
|
-
server.middlewares.use('/studio.module.js', async (req, res) => {
|
|
187
|
-
res.setHeader('Content-Type', 'text/javascript');
|
|
188
|
-
setupCors(req, res);
|
|
189
|
-
res.end(`
|
|
190
|
-
import { createHotContext } from "/@vite/client";
|
|
191
|
-
import.meta.hot = createHotContext("${subdomain}");
|
|
192
|
-
if (import.meta.hot) {
|
|
193
|
-
import.meta.hot.on("vite:beforeFullReload", () => {
|
|
194
|
-
window.location.href = window.BACKUP_URL;
|
|
195
|
-
ZJSBridge.callCustomAction("action.ma.menu.reload", {}, () => {});
|
|
196
|
-
throw "(skipping full reload)";
|
|
197
|
-
});
|
|
198
|
-
import.meta.hot.on('zmp:close', (data) => {
|
|
199
|
-
ZJSBridge.callCustomAction("action.window.close", {}, () => {});
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
let shownTip = false;
|
|
204
|
-
window.onerror = function (message, url, line, column, error) {
|
|
205
|
-
if (!error) {
|
|
206
|
-
console.error(
|
|
207
|
-
"An uncaught error has occurred, but the detailed error message cannot be displayed due to the cross-origin policy."
|
|
208
|
-
);
|
|
209
|
-
if (!shownTip) {
|
|
210
|
-
console.warn(
|
|
211
|
-
"To view the detailed error message, you can try one of the following methods:\\n\\n1. Wrap your code in a try-catch block, use .catch with Promises, or use <ErrorBoundary> in React to catch the detailed error object.\\n2. Try to reproduce the issue using a simulator."
|
|
212
|
-
);
|
|
213
|
-
shownTip = true;
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
console.error("[" + error.name + "] " + error.message);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
} catch (error) {
|
|
220
|
-
console.error(error);
|
|
221
|
-
}
|
|
222
|
-
`);
|
|
223
|
-
});
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
});
|
|
228
|
-
} else {
|
|
229
|
-
server = await createServer({
|
|
230
|
-
configFile: path.join(cwd, viteConfig),
|
|
231
|
-
root: cwd,
|
|
232
|
-
mode,
|
|
233
|
-
define: {
|
|
234
|
-
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
235
|
-
'process.env.previewOnZalo': previewOnZalo,
|
|
236
|
-
},
|
|
237
|
-
server: {
|
|
238
|
-
port: usingFrame ? port - 1 : port,
|
|
239
|
-
...(previewOnZalo ? publicServer : localServer),
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
const app = await server.listen();
|
|
244
|
-
|
|
245
|
-
if (!previewOnZalo) {
|
|
246
|
-
if (!deviceMode) {
|
|
247
|
-
if (usingFrame) {
|
|
248
|
-
//run frame server
|
|
249
|
-
const serverFrame = await createServer({
|
|
250
|
-
// any valid user config options, plus `mode` and `configFile`
|
|
251
|
-
configFile: false,
|
|
252
|
-
root: __dirname + '/frame',
|
|
253
|
-
server: {
|
|
254
|
-
port: app.httpServer.address().port + 1,
|
|
255
|
-
strictPort: true,
|
|
256
|
-
open: true,
|
|
257
|
-
},
|
|
258
|
-
});
|
|
259
|
-
spinner.stop();
|
|
260
|
-
await serverFrame.listen();
|
|
261
|
-
const info = serverFrame.config.logger.info;
|
|
262
|
-
info(chalk.green(`Zalo Mini App dev server is running at:\n`));
|
|
263
|
-
serverFrame.printUrls();
|
|
264
|
-
} else {
|
|
265
|
-
spinner.stop();
|
|
266
|
-
const info = server.config.logger.info;
|
|
267
|
-
info(chalk.green(`Zalo Mini App dev server is running at:\n`));
|
|
268
|
-
server.printUrls();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
try {
|
|
273
|
-
chii.start({
|
|
274
|
-
port: remoteDebugPort,
|
|
275
|
-
});
|
|
276
|
-
logger.text(
|
|
277
|
-
chalk.green(
|
|
278
|
-
`${logSymbols.info} ${chalk.bold(
|
|
279
|
-
`Remote debugging tool is running at: http://localhost:${remoteDebugPort}`
|
|
280
|
-
)}`
|
|
281
|
-
)
|
|
282
|
-
);
|
|
283
|
-
if (!isIOS) {
|
|
284
|
-
const processAdbReverseRemoteDEbug = require('child_process').spawn(
|
|
285
|
-
`adb`,
|
|
286
|
-
['reverse', `tcp:${remoteDebugPort}`, `tcp:${remoteDebugPort}`]
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
processAdbReverseRemoteDEbug.stderr.on('data', function (data) {
|
|
290
|
-
logger.error(data.toString());
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
} catch (error) {
|
|
294
|
-
logger.text(
|
|
295
|
-
`${logSymbols.info} ${chalk.red(`Can not start remote debug server`)}`
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
spinner.stop();
|
|
301
|
-
return await new Promise(async () => {
|
|
302
|
-
if (previewOnZalo) {
|
|
303
|
-
const previewOnZaloURL = `https://zalo.me/app/link/zapps/${appId}/?env=TESTING_LOCAL&clientIp=http://${host}:${app.config.server.port}`;
|
|
304
|
-
qrcode.generate(previewOnZaloURL, { small: true }, function (qrcode) {
|
|
305
|
-
logger.text(
|
|
306
|
-
chalk.green(
|
|
307
|
-
`${logSymbols.info} ${chalk.bold(
|
|
308
|
-
`Zalo Mini App dev server is running at: ${host}:${app.config.server.port}`
|
|
309
|
-
)}`
|
|
310
|
-
)
|
|
311
|
-
);
|
|
312
|
-
logger.text(
|
|
313
|
-
chalk.green(
|
|
314
|
-
`${logSymbols.info} ${chalk.bold(
|
|
315
|
-
`Trying reverse socket connection`
|
|
316
|
-
)}`
|
|
317
|
-
)
|
|
318
|
-
);
|
|
319
|
-
if (isIOS) {
|
|
320
|
-
const qrCode = `${logSymbols.info} ${chalk.bold(
|
|
321
|
-
`Scan the QR code with Zalo app:\n${qrcode}`
|
|
322
|
-
)}`;
|
|
323
|
-
logger.text(qrCode);
|
|
324
|
-
} else {
|
|
325
|
-
const processAdbReverse = require('child_process').spawn(`adb`, [
|
|
326
|
-
'reverse',
|
|
327
|
-
`tcp:${app.config.server.port}`,
|
|
328
|
-
`tcp:${app.config.server.port}`,
|
|
329
|
-
]);
|
|
330
|
-
|
|
331
|
-
processAdbReverse.stderr.on('data', function (data) {
|
|
332
|
-
logger.error(data.toString());
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
processAdbReverse.on('exit', function (code) {
|
|
336
|
-
if (code !== 0) {
|
|
337
|
-
throw new Error(`adb reverse error: ${code}`);
|
|
338
|
-
} else {
|
|
339
|
-
const qrCode = `${logSymbols.info} ${chalk.bold(
|
|
340
|
-
`Scan the QR code with Zalo app:\n${qrcode}`
|
|
341
|
-
)}`;
|
|
342
|
-
logger.text(qrCode);
|
|
343
|
-
const processAdbDevices = require('child_process').spawn(
|
|
344
|
-
`adb`,
|
|
345
|
-
['devices']
|
|
346
|
-
);
|
|
347
|
-
|
|
348
|
-
processAdbDevices.stdout.on('data', function (data) {
|
|
349
|
-
logger.text(`${chalk.yellow(data.toString())}`);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
if (deviceMode) {
|
|
357
|
-
const port = app.httpServer.address().port;
|
|
358
|
-
const remoteUrl = await openTunnel(port, subdomain);
|
|
359
|
-
const deviceModeUrl = `https://zalo.me/app/link/zapps/${appId}/?env=TESTING_LOCAL&clientIp=${remoteUrl}`;
|
|
360
|
-
qrcode.generate(deviceModeUrl, { small: true }, function (qrcode) {
|
|
361
|
-
const qrCode = `${logSymbols.info} ${chalk.bold(
|
|
362
|
-
`Scan the QR code with Zalo app:\n${qrcode}`
|
|
363
|
-
)}`;
|
|
364
|
-
logger.text(qrCode);
|
|
365
|
-
logger.text(
|
|
366
|
-
`${logSymbols.info} ${chalk.bold(
|
|
367
|
-
`To inspect your app, open: http://localhost:${freePort} in ${chalk.green(
|
|
368
|
-
`Google Chrome`
|
|
369
|
-
)} or a ${chalk.blue(`Chromium-based`)} browser.`
|
|
370
|
-
)}`
|
|
371
|
-
);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
} catch (err) {
|
|
376
|
-
logger.statusError('Error starting project');
|
|
377
|
-
// if (err) logger.error(err.stderr || err);
|
|
378
|
-
logger.error(err);
|
|
379
|
-
errorExit(err);
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
};
|
|
1
|
+
'use strict';function _0x3182(_0x3cabb3,_0x10864f){const _0x123dce=_0x123d();return _0x3182=function(_0x3182ce,_0x4f2fbf){_0x3182ce=_0x3182ce-0x1f3;let _0x3fb4ea=_0x123dce[_0x3182ce];return _0x3fb4ea;},_0x3182(_0x3cabb3,_0x10864f);}const _0xeb2948=_0x3182;(function(_0x125008,_0x6200c){const _0x24d1a=_0x3182,_0x588187=_0x125008();while(!![]){try{const _0x8f8336=parseInt(_0x24d1a(0x265))/0x1+-parseInt(_0x24d1a(0x236))/0x2+-parseInt(_0x24d1a(0x24b))/0x3*(parseInt(_0x24d1a(0x20e))/0x4)+parseInt(_0x24d1a(0x23c))/0x5*(-parseInt(_0x24d1a(0x204))/0x6)+-parseInt(_0x24d1a(0x23e))/0x7*(parseInt(_0x24d1a(0x237))/0x8)+parseInt(_0x24d1a(0x20a))/0x9+parseInt(_0x24d1a(0x200))/0xa;if(_0x8f8336===_0x6200c)break;else _0x588187['push'](_0x588187['shift']());}catch(_0x2ea47f){_0x588187['push'](_0x588187['shift']());}}}(_0x123d,0xf3cf4));const e=require(_0xeb2948(0x263)),r=require(_0xeb2948(0x216)),t=require(_0xeb2948(0x21c)),o=require(_0xeb2948(0x248)),i=require(_0xeb2948(0x222)),{createServer:n}=require(_0xeb2948(0x214)),s=require(_0xeb2948(0x250)),{hri:a}=require('human-readable-ids'),l=require(_0xeb2948(0x24e)),c=require(_0xeb2948(0x1fc)),p=require(_0xeb2948(0x219)),d=require(_0xeb2948(0x219)),u=require(_0xeb2948(0x256)),{openTunnel:g}=require(_0xeb2948(0x261)),{deviceModeSetup:h}=require(_0xeb2948(0x259)),{generateHrFromIndex:f}=require('./generate-hr-config'),m=r('Starting\x20mini\x20app...');function _0x123d(){const _0x2c8816=['originalUrl','Zalo\x20Mini\x20App\x20dev\x20server\x20is\x20running\x20at:\x0a','headers','../utils/find-free-port','/hr.config.json','writeFileSync','../utils/constants','error','join','stringify','zbrowser://h5.zdn.vn','blue','localhost','/app-config.json','../utils/tunnel','reverse','chalk','listen','1450220YvkffA','/frame','stop','server','app-config.json','address','info','config','\x20browser.','appId','use','findIndex','port','../utils/env','Trying\x20reverse\x20socket\x20connection','adb\x20reverse\x20error:\x20','exit','41469510vJuIty','existsSync','previewOnZalo','(function\x20()\x20{\x20var\x20script\x20=\x20document.createElement(\x27script\x27);\x20script.src=\x27http://','426nagxWX','http://localhost:','\x22);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if\x20(import.meta.hot)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20import.meta.hot.on(\x22vite:beforeFullReload\x22,\x20()\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.location.href\x20=\x20window.BACKUP_URL;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ZJSBridge.callCustomAction(\x22action.ma.menu.reload\x22,\x20{},\x20()\x20=>\x20{});\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20throw\x20\x22(skipping\x20full\x20reload)\x22;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20import.meta.hot.on(\x27zmp:close\x27,\x20(data)\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ZJSBridge.callCustomAction(\x22action.window.close\x22,\x20{},\x20()\x20=>\x20{});\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20try\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20let\x20shownTip\x20=\x20false;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.onerror\x20=\x20function\x20(message,\x20url,\x20line,\x20column,\x20error)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if\x20(!error)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20console.error(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22An\x20uncaught\x20error\x20has\x20occurred,\x20but\x20the\x20detailed\x20error\x20message\x20cannot\x20be\x20displayed\x20due\x20to\x20the\x20cross-origin\x20policy.\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if\x20(!shownTip)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20console.warn(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22To\x20view\x20the\x20detailed\x20error\x20message,\x20you\x20can\x20try\x20one\x20of\x20the\x20following\x20methods:\x5cn\x5cn1.\x20Wrap\x20your\x20code\x20in\x20a\x20try-catch\x20block,\x20use\x20.catch\x20with\x20Promises,\x20or\x20use\x20<ErrorBoundary>\x20in\x20React\x20to\x20catch\x20the\x20detailed\x20error\x20object.\x5cn2.\x20Try\x20to\x20reproduce\x20the\x20issue\x20using\x20a\x20simulator.\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20shownTip\x20=\x20true;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20console.error(\x22[\x22\x20+\x20error.name\x20+\x20\x22]\x20\x22\x20+\x20error.message);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20};\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x20catch\x20(error)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20console.error(error);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','https://h5.zdn.vn','logger','child_process','6308640GvXgZB','production','tcp:','application/json','92flePbR','module','TUNNEL_SERVER_HOST','spawn','Error\x20starting\x20project','toString','vite','remote-debug-script','ora','exports','iosHostName','../utils/fs-extra','middlewares','/target.js\x27;\x20document.body.appendChild(script);\x20})()','path','text','Google\x20Chrome','stderr','Zalo\x20Mini\x20App\x20dev\x20server\x20is\x20running\x20at:\x20','/zapps/','log-symbols','includes','0.0.0.0','mode','Remote\x20debugging\x20tool\x20is\x20running\x20at:\x20http://localhost:','cwd','end','Content-Type','bold','text/javascript','generate','red','splice','start','/?env=TESTING_LOCAL&clientIp=http://','\x20in\x20','yellow','stdout','random','ios','3444052VwBsIp','552BxuvMA','https://zalo.me/app/link/zapps/','httpServer','Access-Control-Allow-Origin','push','111595akIJtr','Can\x20not\x20start\x20remote\x20debug\x20server','142513CSzges','frame','statusError','adb','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20import\x20{\x20createHotContext\x20}\x20from\x20\x22/@vite/client\x22;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20import.meta.hot\x20=\x20createHotContext(\x22','devices','listJS','/?env=TESTING_LOCAL&clientIp=','green','printUrls','qrcode-terminal','https://','readFileSync','76701AoxITr','development','vite.config.ts','../config','data','chii','Chromium-based','deviceMode'];_0x123d=function(){return _0x2c8816;};return _0x123d();}module[_0xeb2948(0x217)]=async(_0x16b07e={},_0x2200b3,{exitOnError:_0x394c75=!0x0}={})=>{const _0x29f768=_0xeb2948;_0x2200b3||(_0x2200b3={'statusStart'(){},'statusDone'(){},'statusError'(){},'text'(){},'error'(){}}),m[_0x29f768(0x22f)]();let _0x427c11=_0x16b07e[_0x29f768(0x227)]||process['cwd'](),_0x569b5c=_0x16b07e[_0x29f768(0x1f8)]||c['getEnv'](l['env'][_0x29f768(0x1f8)]),_0x497ff5=_0x16b07e[_0x29f768(0x202)],_0x4c1d16=_0x16b07e[_0x29f768(0x235)],_0x4ab47c=_0x16b07e[_0x29f768(0x218)],_0x3c9524=_0x16b07e[_0x29f768(0x23f)],_0x1ba2d3=_0x4c1d16?_0x4ab47c:_0x29f768(0x25f),_0x4844b7=_0x16b07e['port'],_0x5993e7=_0x4844b7-0x2,_0x108a32=_0x16b07e[_0x29f768(0x225)]||(_0x497ff5?_0x29f768(0x20b):_0x29f768(0x24c)),_0x36a69b=_0x16b07e[_0x29f768(0x252)];try{let _0x5bb199,_0x573200,_0x2baed7;if(_0x497ff5){let _0x84c53e=t[_0x29f768(0x25b)](_0x427c11,'hr.config.json'),_0x536225={'id':_0x29f768(0x215),'innerHTML':_0x29f768(0x203)+_0x1ba2d3+':'+_0x5993e7+_0x29f768(0x21b),'type':'text/javascript'};if(p[_0x29f768(0x201)](_0x84c53e)){let _0x4fe60e=p[_0x29f768(0x24a)](_0x84c53e),_0x700108=JSON['parse'](_0x4fe60e),_0x435f20=_0x700108[_0x29f768(0x244)];Array['isArray'](_0x435f20)||(_0x435f20=[]);let _0x3cb23d=_0x435f20[_0x29f768(0x1fa)](_0x54ad78=>_0x29f768(0x215)===_0x54ad78['id']);_0x3cb23d<=0x0||_0x435f20[_0x29f768(0x22e)](_0x3cb23d,0x1),_0x435f20[_0x29f768(0x23b)](_0x536225),_0x700108[_0x29f768(0x244)]=_0x435f20,p[_0x29f768(0x258)](_0x84c53e,JSON['stringify'](_0x700108,void 0x0,0x4));}else p[_0x29f768(0x258)](_0x84c53e,JSON['stringify']({'listCSS':[],'listJS':[{'src':'/src/app.js','type':_0x29f768(0x20f),'async':!0x0},_0x536225]},void 0x0,0x4));}let _0xefe267='vite.config.js';if(d[_0x29f768(0x201)](t['join'](_0x427c11,_0x29f768(0x24d)))&&(_0xefe267=_0x29f768(0x24d)),_0x36a69b){_0x573200=a[_0x29f768(0x234)](),_0x2baed7=await u(),s[_0x29f768(0x22f)]({'port':_0x2baed7});let _0x491aa0=await g(_0x2baed7),_0x1485e2=_0x573200+'.'+h[_0x29f768(0x210)];_0x5bb199=await n({'configFile':t[_0x29f768(0x25b)](_0x427c11,_0xefe267),'root':_0x427c11,'mode':_0x108a32,'define':{'process.env.NODE_ENV':JSON[_0x29f768(0x25c)](_0x108a32),'process.env.previewOnZalo':!0x0},'server':{'port':_0x4844b7,'host':_0x29f768(0x25f),'origin':'https://'+_0x1485e2,'base':_0x29f768(0x221)+_0x569b5c+'/','hmr':{'host':_0x1485e2,'clientPort':0x1bb,'protocol':'wss'},'https':!0x1},'plugins':[{'name':'hr-config-plugin','configureServer'(_0x3a5131){const _0x42d72c=_0x29f768;let _0x5a174c=(_0x18b79e,_0x273096)=>{const _0x11b675=_0x3182;[_0x11b675(0x207),_0x11b675(0x25d)][_0x11b675(0x223)](_0x18b79e[_0x11b675(0x255)]['origin'])&&_0x273096['setHeader'](_0x11b675(0x23a),_0x18b79e['headers']['origin']);};_0x3a5131[_0x42d72c(0x21a)]['use'](_0x42d72c(0x260),(_0xf894f,_0x5e899a,_0x141897)=>'/app-config.json'===_0xf894f[_0x42d72c(0x253)]?(_0x5e899a['setHeader']('Content-Type','application/javascript'),_0x5a174c(_0xf894f,_0x5e899a),_0x5e899a[_0x42d72c(0x228)](p[_0x42d72c(0x24a)](t[_0x42d72c(0x25b)](_0x427c11,_0x42d72c(0x1f3))))):_0x141897()),_0x3a5131['middlewares'][_0x42d72c(0x1f9)](_0x42d72c(0x257),async(_0x18cf20,_0x155f06)=>{const _0x33dac3=_0x42d72c;_0x155f06['setHeader']('Content-Type',_0x33dac3(0x20d)),_0x5a174c(_0x18cf20,_0x155f06);let _0x3a3d5f=await f(_0x33dac3(0x205)+_0x5db50d[_0x33dac3(0x239)][_0x33dac3(0x1f4)]()[_0x33dac3(0x1fb)],{'chiiUrl':_0x491aa0,'exposedUrl':_0x33dac3(0x249)+_0x573200+'.'+h[_0x33dac3(0x210)]});_0x155f06[_0x33dac3(0x228)](JSON['stringify'](_0x3a3d5f));}),_0x3a5131[_0x42d72c(0x21a)][_0x42d72c(0x1f9)]('/studio.module.js',async(_0x1fec65,_0x5639ad)=>{const _0x43bae8=_0x42d72c;_0x5639ad['setHeader'](_0x43bae8(0x229),_0x43bae8(0x22b)),_0x5a174c(_0x1fec65,_0x5639ad),_0x5639ad['end'](_0x43bae8(0x242)+_0x573200+_0x43bae8(0x206));});}}]});}else _0x5bb199=await n({'configFile':t['join'](_0x427c11,_0xefe267),'root':_0x427c11,'mode':_0x108a32,'define':{'process.env.NODE_ENV':JSON[_0x29f768(0x25c)](_0x108a32),'process.env.previewOnZalo':_0x497ff5},'server':{'port':_0x3c9524?_0x4844b7-0x1:_0x4844b7,..._0x497ff5?{'host':_0x29f768(0x224),'hmr':{'host':_0x1ba2d3,'protocol':'ws'}}:{}}});let _0x5db50d=await _0x5bb199[_0x29f768(0x264)]();if(_0x497ff5)try{s['start']({'port':_0x5993e7}),_0x2200b3[_0x29f768(0x21d)](e[_0x29f768(0x246)](i[_0x29f768(0x1f5)]+'\x20'+e[_0x29f768(0x22a)](_0x29f768(0x226)+_0x5993e7))),_0x4c1d16||require(_0x29f768(0x209))['spawn'](_0x29f768(0x241),[_0x29f768(0x262),_0x29f768(0x20c)+_0x5993e7,_0x29f768(0x20c)+_0x5993e7])[_0x29f768(0x21f)]['on'](_0x29f768(0x24f),function(_0x352717){const _0x2c9d69=_0x29f768;_0x2200b3['error'](_0x352717[_0x2c9d69(0x213)]());});}catch(_0x30e4dc){_0x2200b3[_0x29f768(0x21d)](i['info']+'\x20'+e[_0x29f768(0x22d)](_0x29f768(0x23d)));}else{if(!_0x36a69b){if(_0x3c9524){let _0x1335ac=await n({'configFile':!0x1,'root':__dirname+_0x29f768(0x266),'server':{'port':_0x5db50d['httpServer'][_0x29f768(0x1f4)]()['port']+0x1,'strictPort':!0x0,'open':!0x0}});m['stop'](),await _0x1335ac[_0x29f768(0x264)](),(0x0,_0x1335ac['config']['logger'][_0x29f768(0x1f5)])(e['green'](_0x29f768(0x254))),_0x1335ac['printUrls']();}else m[_0x29f768(0x267)](),(0x0,_0x5bb199[_0x29f768(0x1f6)][_0x29f768(0x208)][_0x29f768(0x1f5)])(e[_0x29f768(0x246)](_0x29f768(0x254))),_0x5bb199[_0x29f768(0x247)]();}}return m[_0x29f768(0x267)](),await new Promise(async()=>{const _0x3e7190=_0x29f768;if(_0x497ff5){let _0x32fc51=_0x3e7190(0x238)+_0x569b5c+_0x3e7190(0x230)+_0x1ba2d3+':'+_0x5db50d[_0x3e7190(0x1f6)][_0x3e7190(0x268)][_0x3e7190(0x1fb)];o[_0x3e7190(0x22c)](_0x32fc51,{'small':!0x0},function(_0x1eb534){const _0x1f98dd=_0x3e7190;if(_0x2200b3['text'](e[_0x1f98dd(0x246)](i[_0x1f98dd(0x1f5)]+'\x20'+e[_0x1f98dd(0x22a)](_0x1f98dd(0x220)+_0x1ba2d3+':'+_0x5db50d[_0x1f98dd(0x1f6)][_0x1f98dd(0x268)][_0x1f98dd(0x1fb)]))),_0x2200b3[_0x1f98dd(0x21d)](e['green'](i['info']+'\x20'+e['bold'](_0x1f98dd(0x1fd)))),_0x4c1d16){let _0x191245=i[_0x1f98dd(0x1f5)]+'\x20'+e[_0x1f98dd(0x22a)]('Scan\x20the\x20QR\x20code\x20with\x20Zalo\x20app:\x0a'+_0x1eb534);_0x2200b3[_0x1f98dd(0x21d)](_0x191245);}else{let _0x2b0bc5=require(_0x1f98dd(0x209))[_0x1f98dd(0x211)](_0x1f98dd(0x241),[_0x1f98dd(0x262),_0x1f98dd(0x20c)+_0x5db50d[_0x1f98dd(0x1f6)][_0x1f98dd(0x268)]['port'],_0x1f98dd(0x20c)+_0x5db50d[_0x1f98dd(0x1f6)]['server'][_0x1f98dd(0x1fb)]]);_0x2b0bc5['stderr']['on']('data',function(_0xe1067e){const _0xa9380=_0x1f98dd;_0x2200b3[_0xa9380(0x25a)](_0xe1067e[_0xa9380(0x213)]());}),_0x2b0bc5['on'](_0x1f98dd(0x1ff),function(_0x3b24cf){const _0x1e117d=_0x1f98dd;if(0x0!==_0x3b24cf)throw Error(_0x1e117d(0x1fe)+_0x3b24cf);{let _0x52f412=i[_0x1e117d(0x1f5)]+'\x20'+e[_0x1e117d(0x22a)]('Scan\x20the\x20QR\x20code\x20with\x20Zalo\x20app:\x0a'+_0x1eb534);_0x2200b3[_0x1e117d(0x21d)](_0x52f412),require('child_process')[_0x1e117d(0x211)]('adb',[_0x1e117d(0x243)])[_0x1e117d(0x233)]['on'](_0x1e117d(0x24f),function(_0x4ea7e3){const _0x5a5bcb=_0x1e117d;_0x2200b3[_0x5a5bcb(0x21d)](''+e[_0x5a5bcb(0x232)](_0x4ea7e3['toString']()));});}});}});}if(_0x36a69b){let _0x46d8d0=_0x5db50d[_0x3e7190(0x239)][_0x3e7190(0x1f4)]()[_0x3e7190(0x1fb)],_0xbfbc80=await g(_0x46d8d0,_0x573200),_0x4084fc='https://zalo.me/app/link/zapps/'+_0x569b5c+_0x3e7190(0x245)+_0xbfbc80;o[_0x3e7190(0x22c)](_0x4084fc,{'small':!0x0},function(_0x45878d){const _0x40079e=_0x3e7190;let _0x3c11fb=i['info']+'\x20'+e[_0x40079e(0x22a)]('Scan\x20the\x20QR\x20code\x20with\x20Zalo\x20app:\x0a'+_0x45878d);_0x2200b3[_0x40079e(0x21d)](_0x3c11fb),_0x2200b3[_0x40079e(0x21d)](i[_0x40079e(0x1f5)]+'\x20'+e[_0x40079e(0x22a)]('To\x20inspect\x20your\x20app,\x20open:\x20http://localhost:'+_0x2baed7+_0x40079e(0x231)+e[_0x40079e(0x246)](_0x40079e(0x21e))+'\x20or\x20a\x20'+e[_0x40079e(0x25e)](_0x40079e(0x251))+_0x40079e(0x1f7)));});}});}catch(_0x50c032){_0x2200b3[_0x29f768(0x240)](_0x29f768(0x212)),_0x2200b3['error'](_0x50c032),_0x2200b3['error'](_0x50c032[_0x29f768(0x21f)]||_0x50c032),_0x394c75&&process[_0x29f768(0x1ff)](0x1);return;}};
|
|
@@ -1,146 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const { axiosClient } = require('../utils/axios');
|
|
4
|
-
|
|
5
|
-
async function generateListResourcesFromIndex(
|
|
6
|
-
html,
|
|
7
|
-
{ outputDir, rootElement }
|
|
8
|
-
) {
|
|
9
|
-
const listCSS = [];
|
|
10
|
-
const listSyncJS = [];
|
|
11
|
-
const listAsyncJS = [];
|
|
12
|
-
let inlineJS = '';
|
|
13
|
-
try {
|
|
14
|
-
const parser = new DomParser();
|
|
15
|
-
const doc = parser.parseFromString(html, 'text/html');
|
|
16
|
-
const headInlines = [];
|
|
17
|
-
const bodyInlines = [];
|
|
18
|
-
|
|
19
|
-
const scripts = doc.getElementsByTagName('script');
|
|
20
|
-
for (const script of scripts) {
|
|
21
|
-
const src = script.getAttribute('src');
|
|
22
|
-
const type = script.getAttribute('type');
|
|
23
|
-
const async = script.getAttribute('async');
|
|
24
|
-
const inline = script.innerHTML;
|
|
25
|
-
try {
|
|
26
|
-
if (inline) {
|
|
27
|
-
bodyInlines.push(script.outerHTML);
|
|
28
|
-
} else {
|
|
29
|
-
let scriptName = src;
|
|
30
|
-
if (src.includes('://')) {
|
|
31
|
-
let filename = src.substring(src.lastIndexOf('/') + 1);
|
|
32
|
-
filename = `cdn.` + filename;
|
|
33
|
-
const response = await axiosClient({
|
|
34
|
-
method: 'get',
|
|
35
|
-
url: src,
|
|
36
|
-
responseType: 'stream',
|
|
37
|
-
});
|
|
38
|
-
const fileStream = fs.createWriteStream(`${outputDir}/${filename}`);
|
|
39
|
-
response.data.pipe(fileStream);
|
|
40
|
-
|
|
41
|
-
await new Promise((resolve, reject) => {
|
|
42
|
-
fileStream.on('finish', resolve);
|
|
43
|
-
fileStream.on('error', reject);
|
|
44
|
-
});
|
|
45
|
-
scriptName = filename;
|
|
46
|
-
}
|
|
47
|
-
if (type === 'module' && !scriptName.endsWith('module.js')) {
|
|
48
|
-
const newName = src.slice(0, -3).concat('.module.js');
|
|
49
|
-
fs.rename(scriptName, newName);
|
|
50
|
-
scriptName = newName;
|
|
51
|
-
}
|
|
52
|
-
(async ? listAsyncJS : listSyncJS).push(scriptName);
|
|
53
|
-
}
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.warn(
|
|
56
|
-
'\n⚠️ Unable to download resource from CDN. Please handle this file manually!',
|
|
57
|
-
src
|
|
58
|
-
);
|
|
59
|
-
console.error(error.message);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const styles = doc.getElementsByTagName('style');
|
|
64
|
-
styles.forEach((style) => {
|
|
65
|
-
const inline = style.innerHTML;
|
|
66
|
-
if (inline) {
|
|
67
|
-
headInlines.push(style.outerHTML);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const links = doc.getElementsByTagName('link');
|
|
72
|
-
for (const link of links) {
|
|
73
|
-
const rel = link.getAttribute('rel');
|
|
74
|
-
const href = link.getAttribute('href');
|
|
75
|
-
try {
|
|
76
|
-
if (rel === 'stylesheet') {
|
|
77
|
-
let filename = href;
|
|
78
|
-
if (href.includes('://')) {
|
|
79
|
-
filename = href.substring(href.lastIndexOf('/') + 1);
|
|
80
|
-
filename = `cdn.` + filename;
|
|
81
|
-
const response = await axiosClient({
|
|
82
|
-
method: 'get',
|
|
83
|
-
url: href,
|
|
84
|
-
responseType: 'stream',
|
|
85
|
-
});
|
|
86
|
-
const fileStream = fs.createWriteStream(`${outputDir}/${filename}`);
|
|
87
|
-
response.data.pipe(fileStream);
|
|
88
|
-
|
|
89
|
-
await new Promise((resolve, reject) => {
|
|
90
|
-
fileStream.on('finish', resolve);
|
|
91
|
-
fileStream.on('error', reject);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
listCSS.push(filename);
|
|
95
|
-
}
|
|
96
|
-
} catch (error) {
|
|
97
|
-
console.error(
|
|
98
|
-
'\n⚠️ Unable to download resource from CDN. Please handle this file manually!',
|
|
99
|
-
href
|
|
100
|
-
);
|
|
101
|
-
console.error(error.message);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const metas = doc.getElementsByTagName('meta');
|
|
106
|
-
metas.forEach((meta) => {
|
|
107
|
-
headInlines.push(meta.outerHTML);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
if (rootElement && rootElement !== '#app') {
|
|
111
|
-
let html = `<${rootElement} />`;
|
|
112
|
-
if (rootElement.startsWith('#')) {
|
|
113
|
-
html = `<div id="${rootElement.substring(1)}" />`;
|
|
114
|
-
}
|
|
115
|
-
if (rootElement.startsWith('.')) {
|
|
116
|
-
html = `<div class="${rootElement.substring(1)}" />`;
|
|
117
|
-
}
|
|
118
|
-
if (rootElement.startsWith('<')) {
|
|
119
|
-
html = rootElement;
|
|
120
|
-
}
|
|
121
|
-
bodyInlines.unshift(html);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
inlineJS += headInlines
|
|
125
|
-
.map(
|
|
126
|
-
(inline) =>
|
|
127
|
-
`document.head.innerHTML += \`${inline.replaceAll('`', '\\`')}\`;`
|
|
128
|
-
)
|
|
129
|
-
.join('\n');
|
|
130
|
-
inlineJS += '\n';
|
|
131
|
-
inlineJS += bodyInlines
|
|
132
|
-
.map(
|
|
133
|
-
(inline) =>
|
|
134
|
-
`document.body.innerHTML += \`${inline.replaceAll('`', '\\`')}\`;`
|
|
135
|
-
)
|
|
136
|
-
.join('\n');
|
|
137
|
-
listSyncJS.unshift('inline.js');
|
|
138
|
-
} catch (error) {
|
|
139
|
-
console.error(error.message);
|
|
140
|
-
}
|
|
141
|
-
return { listCSS, listSyncJS, listAsyncJS, inlineJS };
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
module.exports = {
|
|
145
|
-
generateListResourcesFromIndex,
|
|
146
|
-
};
|
|
1
|
+
'use strict';function _0x9e0c(){const _0x213186=['document.head.innerHTML\x20+=\x20`','pipe','unshift','async','3658304AKTpGT','<div\x20id=\x22','script','module.js','createWriteStream','#app','warn','dom-parser','getElementsByTagName','\x0a⚠️\x20Unable\x20to\x20download\x20resource\x20from\x20CDN.\x20Please\x20handle\x20this\x20file\x20manually!','map','72usxHVu','1416382MBJBaK','module','rename','style','startsWith','12081yjRBdW','data','link','finish','text/html','stream','lastIndexOf','href','21RDNUOP','2hulrXT','rel','message','endsWith','includes','get','\x20/>','join','\x22\x20/>','concat','://','inline.js','meta','311465wAEvtk','push','stylesheet','outerHTML','error','substring','cdn.','parseFromString','type','getAttribute','innerHTML','24axslac','../utils/axios','replaceAll','313953qBHVwK','slice','277900UpsQkd','forEach','556242fGtIdL'];_0x9e0c=function(){return _0x213186;};return _0x9e0c();}const _0x4a5e44=_0xf537;(function(_0x3c1e0b,_0x4e4afc){const _0x164e91=_0xf537,_0x24d058=_0x3c1e0b();while(!![]){try{const _0x146ff1=-parseInt(_0x164e91(0xf8))/0x1*(parseInt(_0x164e91(0x11b))/0x2)+parseInt(_0x164e91(0x112))/0x3*(parseInt(_0x164e91(0xf5))/0x4)+-parseInt(_0x164e91(0x128))/0x5+-parseInt(_0x164e91(0xfc))/0x6*(-parseInt(_0x164e91(0x11a))/0x7)+parseInt(_0x164e91(0x101))/0x8+-parseInt(_0x164e91(0x10c))/0x9*(parseInt(_0x164e91(0xfa))/0xa)+parseInt(_0x164e91(0x10d))/0xb;if(_0x146ff1===_0x4e4afc)break;else _0x24d058['push'](_0x24d058['shift']());}catch(_0x42f9e2){_0x24d058['push'](_0x24d058['shift']());}}}(_0x9e0c,0x46be7));function _0xf537(_0x217e92,_0x413c1b){const _0x9e0cb=_0x9e0c();return _0xf537=function(_0xf5376a,_0x16fcf5){_0xf5376a=_0xf5376a-0xf0;let _0x63ad67=_0x9e0cb[_0xf5376a];return _0x63ad67;},_0xf537(_0x217e92,_0x413c1b);}const e=require(_0x4a5e44(0x108)),t=require('fs'),{axiosClient:r}=require(_0x4a5e44(0xf6));async function s(_0xc35c9b,{outputDir:_0x388586,rootElement:_0x37156e}){const _0x473330=_0x4a5e44;let _0x461380=[],_0x4fa3f1=[],_0x2ba799=[],_0x271afb='';try{let _0x1dd358=new e()[_0x473330(0xf1)](_0xc35c9b,_0x473330(0x116)),_0x4420ec=[],_0x492a2d=[];for(let _0x4df7b7 of _0x1dd358[_0x473330(0x109)](_0x473330(0x103))){let _0x167c6e=_0x4df7b7[_0x473330(0xf3)]('src'),_0x38483d=_0x4df7b7[_0x473330(0xf3)](_0x473330(0xf2)),_0x2553cd=_0x4df7b7[_0x473330(0xf3)](_0x473330(0x100)),_0x2e5a3b=_0x4df7b7[_0x473330(0xf4)];try{if(_0x2e5a3b)_0x492a2d[_0x473330(0x129)](_0x4df7b7[_0x473330(0x12b)]);else{let _0x98c4f3=_0x167c6e;if(_0x167c6e[_0x473330(0x11f)](_0x473330(0x125))){let _0x2c3ecb=_0x167c6e[_0x473330(0x12d)](_0x167c6e['lastIndexOf']('/')+0x1);_0x2c3ecb='cdn.'+_0x2c3ecb;let _0xff5126=await r({'method':_0x473330(0x120),'url':_0x167c6e,'responseType':_0x473330(0x117)}),_0x86824f=t[_0x473330(0x105)](_0x388586+'/'+_0x2c3ecb);_0xff5126['data'][_0x473330(0xfe)](_0x86824f),await new Promise((_0x323a2c,_0x242092)=>{const _0x5b52de=_0x473330;_0x86824f['on']('finish',_0x323a2c),_0x86824f['on'](_0x5b52de(0x12c),_0x242092);}),_0x98c4f3=_0x2c3ecb;}if(_0x473330(0x10e)===_0x38483d&&!_0x98c4f3[_0x473330(0x11e)](_0x473330(0x104))){let _0xd01816=_0x167c6e[_0x473330(0xf9)](0x0,-0x3)[_0x473330(0x124)]('.module.js');t[_0x473330(0x10f)](_0x98c4f3,_0xd01816),_0x98c4f3=_0xd01816;}(_0x2553cd?_0x2ba799:_0x4fa3f1)['push'](_0x98c4f3);}}catch(_0xf8467f){console[_0x473330(0x107)](_0x473330(0x10a),_0x167c6e),console[_0x473330(0x12c)](_0xf8467f[_0x473330(0x11d)]);}}for(let _0x13ec20 of(_0x1dd358[_0x473330(0x109)](_0x473330(0x110))[_0x473330(0xfb)](_0xb58e3d=>{const _0x3b2a8c=_0x473330;_0xb58e3d[_0x3b2a8c(0xf4)]&&_0x4420ec['push'](_0xb58e3d[_0x3b2a8c(0x12b)]);}),_0x1dd358[_0x473330(0x109)](_0x473330(0x114)))){let _0x19e4ff=_0x13ec20['getAttribute'](_0x473330(0x11c)),_0x55731b=_0x13ec20[_0x473330(0xf3)](_0x473330(0x119));try{if(_0x473330(0x12a)===_0x19e4ff){let _0x3fbf2c=_0x55731b;if(_0x55731b[_0x473330(0x11f)](_0x473330(0x125))){_0x3fbf2c=_0x55731b[_0x473330(0x12d)](_0x55731b[_0x473330(0x118)]('/')+0x1),_0x3fbf2c=_0x473330(0xf0)+_0x3fbf2c;let _0x279226=await r({'method':_0x473330(0x120),'url':_0x55731b,'responseType':_0x473330(0x117)}),_0x533733=t[_0x473330(0x105)](_0x388586+'/'+_0x3fbf2c);_0x279226[_0x473330(0x113)]['pipe'](_0x533733),await new Promise((_0x243762,_0x127809)=>{const _0x45eb30=_0x473330;_0x533733['on'](_0x45eb30(0x115),_0x243762),_0x533733['on'](_0x45eb30(0x12c),_0x127809);});}_0x461380[_0x473330(0x129)](_0x3fbf2c);}}catch(_0xf76a87){console[_0x473330(0x12c)](_0x473330(0x10a),_0x55731b),console['error'](_0xf76a87[_0x473330(0x11d)]);}}if(_0x1dd358[_0x473330(0x109)](_0x473330(0x127))[_0x473330(0xfb)](_0xa2cc8d=>{const _0x52f122=_0x473330;_0x4420ec[_0x52f122(0x129)](_0xa2cc8d[_0x52f122(0x12b)]);}),_0x37156e&&_0x473330(0x106)!==_0x37156e){let _0x4f25da='<'+_0x37156e+_0x473330(0x121);_0x37156e[_0x473330(0x111)]('#')&&(_0x4f25da=_0x473330(0x102)+_0x37156e[_0x473330(0x12d)](0x1)+_0x473330(0x123)),_0x37156e[_0x473330(0x111)]('.')&&(_0x4f25da='<div\x20class=\x22'+_0x37156e['substring'](0x1)+_0x473330(0x123)),_0x37156e[_0x473330(0x111)]('<')&&(_0x4f25da=_0x37156e),_0x492a2d[_0x473330(0xff)](_0x4f25da);}_0x271afb+=_0x4420ec['map'](_0x3a1703=>_0x473330(0xfd)+_0x3a1703[_0x473330(0xf7)]('`','\x5c`')+'`;')[_0x473330(0x122)]('\x0a')+'\x0a'+_0x492a2d[_0x473330(0x10b)](_0x1e58b2=>'document.body.innerHTML\x20+=\x20`'+_0x1e58b2[_0x473330(0xf7)]('`','\x5c`')+'`;')[_0x473330(0x122)]('\x0a'),_0x4fa3f1[_0x473330(0xff)](_0x473330(0x126));}catch(_0x9eea14){console['error'](_0x9eea14['message']);}return{'listCSS':_0x461380,'listSyncJS':_0x4fa3f1,'listAsyncJS':_0x2ba799,'inlineJS':_0x271afb};}module['exports']={'generateListResourcesFromIndex':s};
|
package/sync/index.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
const path = require('
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const fse = require('../utils/fs-extra');
|
|
4
|
-
const config = require('../config');
|
|
5
|
-
const { generateListResourcesFromIndex } = require('./index-to-app-config');
|
|
6
|
-
|
|
7
|
-
const waitText = chalk.gray('(Please wait, it can take a while)');
|
|
8
|
-
const defaultLogger = {
|
|
9
|
-
statusStart() {},
|
|
10
|
-
statusDone() {},
|
|
11
|
-
statusText() {},
|
|
12
|
-
statusError() {},
|
|
13
|
-
text() {},
|
|
14
|
-
error() {},
|
|
15
|
-
showOnUI() {},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
module.exports = async (options = {}, logger = defaultLogger) => {
|
|
19
|
-
logger.statusStart(`Synchronization configuration ${waitText}`);
|
|
20
|
-
const cwd = process.cwd();
|
|
21
|
-
const { source, rootElement } = options;
|
|
22
|
-
const appConfigFilename = config.filename.appConfig;
|
|
23
|
-
const resolvePath = (dir) => {
|
|
24
|
-
return path.join(cwd, dir);
|
|
25
|
-
};
|
|
26
|
-
function errorExit(err) {
|
|
27
|
-
logger.error(err.stderr || err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
let appConfigJson;
|
|
31
|
-
try {
|
|
32
|
-
appConfigJson = require(resolvePath(appConfigFilename));
|
|
33
|
-
} catch (err) {
|
|
34
|
-
errorExit(new Error(config.error_msg.app_config_not_found));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const html = fse.readFileSync(source).toString();
|
|
38
|
-
const outputDir = path.dirname(source);
|
|
39
|
-
const { listCSS, listSyncJS, listAsyncJS, inlineJS } =
|
|
40
|
-
await generateListResourcesFromIndex(html, { outputDir, rootElement });
|
|
41
|
-
Object.assign(appConfigJson, {
|
|
42
|
-
listCSS,
|
|
43
|
-
listSyncJS,
|
|
44
|
-
listAsyncJS,
|
|
45
|
-
});
|
|
46
|
-
if (inlineJS) {
|
|
47
|
-
fse.writeFileSync(resolvePath(`${outputDir}/inline.js`), inlineJS);
|
|
48
|
-
}
|
|
49
|
-
const output = JSON.stringify(appConfigJson, null, 2);
|
|
50
|
-
fse.writeFileSync(resolvePath(appConfigFilename), output);
|
|
51
|
-
logger.statusDone(
|
|
52
|
-
`${chalk.bold.green('Configuration synchronization completed!')} 💪`
|
|
53
|
-
);
|
|
54
|
-
logger.text({ listCSS, listSyncJS, listAsyncJS });
|
|
55
|
-
};
|
|
1
|
+
'use strict';function _0x3a0b(_0x4eb35c,_0x50ba7a){const _0x3192e3=_0x3192();return _0x3a0b=function(_0x3a0bd6,_0x807d12){_0x3a0bd6=_0x3a0bd6-0x171;let _0x2db96f=_0x3192e3[_0x3a0bd6];return _0x2db96f;},_0x3a0b(_0x4eb35c,_0x50ba7a);}const _0x2ec6bd=_0x3a0b;function _0x3192(){const _0x15a0f4=['\x20💪','readFileSync','cwd','exit','Synchronization\x20configuration\x20','text','statusStart','gray','green','567395KmMAKd','2667819zayOef','dirname','error','error_msg','appConfig','app_config_not_found','7472wDcVUr','filename','toString','Configuration\x20synchronization\x20completed!','stringify','../utils/fs-extra','stderr','1503gtGpgc','1642902rMVWqQ','../config','5HQXldH','chalk','bold','statusDone','4416844XQwMJf','875616uWwIZH','3146458rKNHtU','writeFileSync','path','(Please\x20wait,\x20it\x20can\x20take\x20a\x20while)','exports'];_0x3192=function(){return _0x15a0f4;};return _0x3192();}(function(_0x20311d,_0x4a05b4){const _0x199a98=_0x3a0b,_0x3b79bc=_0x20311d();while(!![]){try{const _0x6d9fd6=-parseInt(_0x199a98(0x17a))/0x1+parseInt(_0x199a98(0x191))/0x2+-parseInt(_0x199a98(0x17b))/0x3+-parseInt(_0x199a98(0x18f))/0x4*(-parseInt(_0x199a98(0x18b))/0x5)+-parseInt(_0x199a98(0x189))/0x6+parseInt(_0x199a98(0x190))/0x7+-parseInt(_0x199a98(0x181))/0x8*(parseInt(_0x199a98(0x188))/0x9);if(_0x6d9fd6===_0x4a05b4)break;else _0x3b79bc['push'](_0x3b79bc['shift']());}catch(_0x5e06eb){_0x3b79bc['push'](_0x3b79bc['shift']());}}}(_0x3192,0xdfa61));const t=require(_0x2ec6bd(0x193)),e=require(_0x2ec6bd(0x18c)),r=require(_0x2ec6bd(0x186)),i=require(_0x2ec6bd(0x18a)),{generateListResourcesFromIndex:n}=require('./index-to-app-config'),a=e[_0x2ec6bd(0x178)](_0x2ec6bd(0x194)),o={'statusStart'(){},'statusDone'(){},'statusText'(){},'statusError'(){},'text'(){},'error'(){},'showOnUI'(){}};module[_0x2ec6bd(0x195)]=async(_0x53e280={},_0x29311f=o)=>{const _0x39c7b=_0x2ec6bd;let _0x2c8a0a;_0x29311f[_0x39c7b(0x177)](_0x39c7b(0x175)+a);let _0x61520b=process[_0x39c7b(0x173)](),{source:_0x13693a,rootElement:_0x41ad5b}=_0x53e280,_0x35bdb6=i[_0x39c7b(0x182)][_0x39c7b(0x17f)],_0x568996=_0x39505e=>t['join'](_0x61520b,_0x39505e);try{_0x2c8a0a=require(_0x568996(_0x35bdb6));}catch(_0x3b0494){var _0x458c47;_0x458c47=Error(i[_0x39c7b(0x17e)][_0x39c7b(0x180)]),_0x29311f[_0x39c7b(0x17d)](_0x458c47[_0x39c7b(0x187)]||_0x458c47),process[_0x39c7b(0x174)](0x1);}let _0x5eb6cf=r[_0x39c7b(0x172)](_0x13693a)[_0x39c7b(0x183)](),_0x33621b=t[_0x39c7b(0x17c)](_0x13693a),{listCSS:_0x472551,listSyncJS:_0x320a9a,listAsyncJS:_0x5c3764,inlineJS:_0x56fc77}=await n(_0x5eb6cf,{'outputDir':_0x33621b,'rootElement':_0x41ad5b});Object['assign'](_0x2c8a0a,{'listCSS':_0x472551,'listSyncJS':_0x320a9a,'listAsyncJS':_0x5c3764}),_0x56fc77&&r[_0x39c7b(0x192)](_0x568996(_0x33621b+'/inline.js'),_0x56fc77);let _0x206a78=JSON[_0x39c7b(0x185)](_0x2c8a0a,null,0x2);r['writeFileSync'](_0x568996(_0x35bdb6),_0x206a78),_0x29311f[_0x39c7b(0x18e)](e[_0x39c7b(0x18d)][_0x39c7b(0x179)](_0x39c7b(0x184))+_0x39c7b(0x171)),_0x29311f[_0x39c7b(0x176)]({'listCSS':_0x472551,'listSyncJS':_0x320a9a,'listAsyncJS':_0x5c3764});};
|
package/utils/axios.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const axios = require('axios');
|
|
3
|
-
|
|
4
|
-
const agent = new ProxyAgent();
|
|
5
|
-
|
|
6
|
-
const axiosClient = axios.create({
|
|
7
|
-
proxy: false,
|
|
8
|
-
httpsAgent: agent,
|
|
9
|
-
httpAgent: agent,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
13
|
-
agent,
|
|
14
|
-
axiosClient,
|
|
15
|
-
};
|
|
1
|
+
'use strict';const _0x37b99d=_0x5f40;(function(_0x2ca7bb,_0x8c9de6){const _0x153c81=_0x5f40,_0x156faf=_0x2ca7bb();while(!![]){try{const _0x4a730b=parseInt(_0x153c81(0x121))/0x1+-parseInt(_0x153c81(0x124))/0x2+parseInt(_0x153c81(0x11b))/0x3+-parseInt(_0x153c81(0x11c))/0x4+-parseInt(_0x153c81(0x11e))/0x5*(-parseInt(_0x153c81(0x11f))/0x6)+-parseInt(_0x153c81(0x122))/0x7*(-parseInt(_0x153c81(0x120))/0x8)+parseInt(_0x153c81(0x125))/0x9;if(_0x4a730b===_0x8c9de6)break;else _0x156faf['push'](_0x156faf['shift']());}catch(_0x1924dc){_0x156faf['push'](_0x156faf['shift']());}}}(_0x4b2d,0xf1654));function _0x5f40(_0x9eaa43,_0x255e8a){const _0x4b2d85=_0x4b2d();return _0x5f40=function(_0x5f4060,_0x4e616a){_0x5f4060=_0x5f4060-0x11a;let _0x55c784=_0x4b2d85[_0x5f4060];return _0x55c784;},_0x5f40(_0x9eaa43,_0x255e8a);}const {ProxyAgent:e}=require('proxy-agent'),t=require(_0x37b99d(0x11a)),r=new e(),o=t[_0x37b99d(0x11d)]({'proxy':!0x1,'httpsAgent':r,'httpAgent':r});function _0x4b2d(){const _0x132ea0=['18iCVnsF','331032mVEvwH','810616yusswN','14Eadyjp','exports','3005194qgfBLb','12967686mcjjrz','axios','1766640VtduCB','5152048jUfjNr','create','1427095ZdnNdG'];_0x4b2d=function(){return _0x132ea0;};return _0x4b2d();}module[_0x37b99d(0x123)]={'agent':r,'axiosClient':o};
|