@tuya-sat/micro-script 3.2.4 → 3.2.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.
|
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.getFakeUser = void 0;
|
|
39
|
-
const axios_1 = __importDefault(require("axios"));
|
|
40
39
|
const chalk_1 = __importDefault(require("chalk"));
|
|
40
|
+
const micro_dev_proxy_1 = require("@tuya-sat/micro-dev-proxy");
|
|
41
41
|
const fs = __importStar(require("fs-extra"));
|
|
42
42
|
const path = __importStar(require("path"));
|
|
43
43
|
function parse_SDF_CONFIG(html) {
|
|
@@ -57,10 +57,10 @@ function parse__MAIN_APP_PUBLIC_PATH(html) {
|
|
|
57
57
|
}
|
|
58
58
|
const grabSaasPage = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
59
|
try {
|
|
60
|
-
return yield
|
|
60
|
+
return yield micro_dev_proxy_1.globalAxios.get(target);
|
|
61
61
|
}
|
|
62
62
|
catch (e) {
|
|
63
|
-
return
|
|
63
|
+
return micro_dev_proxy_1.globalAxios.get(new URL('/login?disable_third_login=true', target).href);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
function getFakeSaas(config) {
|
|
@@ -36,13 +36,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
const micro_utils_1 = require("@tuya-sat/micro-utils");
|
|
39
|
+
const micro_dev_proxy_1 = require("@tuya-sat/micro-dev-proxy");
|
|
39
40
|
const uuid_1 = require("uuid");
|
|
40
41
|
const paths_1 = __importDefault(require("../../config/paths"));
|
|
41
42
|
const uid_1 = require("uid");
|
|
42
43
|
const path = __importStar(require("path"));
|
|
43
44
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
44
45
|
const utils_1 = require("../../utils");
|
|
45
|
-
const axios_1 = __importDefault(require("axios"));
|
|
46
46
|
function mockSaasInfo(app, microPort) {
|
|
47
47
|
let { multiApps, microApps, debuggerConfig: { isMainApp, target }, } = require(paths_1.default.microConfig);
|
|
48
48
|
const idsMap = new Map();
|
|
@@ -208,7 +208,7 @@ function refactorConstructApp(config, localApps) {
|
|
|
208
208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
209
209
|
const saasAppsMap = {};
|
|
210
210
|
try {
|
|
211
|
-
const res = yield
|
|
211
|
+
const res = yield micro_dev_proxy_1.globalAxios.get(new URL('/api/saas-info', config.url).href, {
|
|
212
212
|
headers: config.headers,
|
|
213
213
|
});
|
|
214
214
|
(_a = res.data.result.apps) === null || _a === void 0 ? void 0 : _a.forEach((app) => {
|
|
@@ -36,11 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
const cheerio_1 = __importDefault(require("cheerio"));
|
|
39
|
-
const
|
|
39
|
+
const micro_dev_proxy_1 = require("@tuya-sat/micro-dev-proxy");
|
|
40
40
|
const fakeSaas_1 = __importStar(require("./fakeSaas"));
|
|
41
41
|
const paths_1 = __importDefault(require("../../config/paths"));
|
|
42
42
|
const webpack_common_1 = require("../../config/webpack.common");
|
|
43
|
-
const undici_1 = require("undici");
|
|
44
43
|
const fs = __importStar(require("fs-extra"));
|
|
45
44
|
const path = __importStar(require("path"));
|
|
46
45
|
function parse_SDF(html) {
|
|
@@ -52,9 +51,8 @@ function staticMain(app, debuggerConfig, microPort) {
|
|
|
52
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
52
|
//获取当前SaaS版本
|
|
54
53
|
let SDF;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
SDF = JSON.parse(parse_SDF(data));
|
|
54
|
+
const { data: pageHtml } = yield micro_dev_proxy_1.globalAxios.get(new URL('/login?disable_third_login=true', debuggerConfig.target).href);
|
|
55
|
+
SDF = JSON.parse(parse_SDF(pageHtml));
|
|
58
56
|
app.get([
|
|
59
57
|
'/',
|
|
60
58
|
'/apps/:appId',
|
|
@@ -73,7 +71,7 @@ function staticMain(app, debuggerConfig, microPort) {
|
|
|
73
71
|
if (!/^https?:\/\//.test(base)) {
|
|
74
72
|
base = new URL(base, debuggerConfig.target).href;
|
|
75
73
|
}
|
|
76
|
-
const { data } = yield
|
|
74
|
+
const { data } = yield micro_dev_proxy_1.globalAxios.get(new URL('index.html', base).href);
|
|
77
75
|
const $ = cheerio_1.default.load(data);
|
|
78
76
|
modifySrcAttr($, base);
|
|
79
77
|
yield insertScript($, debuggerConfig);
|
package/dist/module/proxy.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"bin": "./dist/bin/cli.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@babel/preset-typescript": "7.16.7",
|
|
24
24
|
"@babel/traverse": "^7.20.13",
|
|
25
25
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
26
|
-
"@tuya-sat/micro-dev-loader": "3.2.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.2.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.2.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.2.6",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.2.6",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.2.6",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"svg-url-loader": "7.1.1",
|
|
64
64
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
65
65
|
"uid": "^2.0.1",
|
|
66
|
-
"undici": "^5.20.0",
|
|
67
66
|
"update-notifier": "5.1.0",
|
|
68
67
|
"url-loader": "4.1.1",
|
|
69
68
|
"uuid": "8.3.2",
|