@tuya-sat/micro-script 3.0.27-beta.14 → 3.0.27-beta.16
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/dist/module/proxy.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Application } from
|
|
1
|
+
import { Application } from 'express';
|
|
2
2
|
export default function useProxy(app: Application): void;
|
package/dist/module/proxy.js
CHANGED
|
@@ -4,12 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const paths_1 = __importDefault(require("../config/paths"));
|
|
7
|
+
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
7
8
|
function useProxy(app) {
|
|
8
|
-
const isProxy = process.env.MICRO_PROXY ===
|
|
9
|
+
const isProxy = process.env.MICRO_PROXY === 'true';
|
|
10
|
+
const { debuggerConfig } = require(paths_1.default.microConfig);
|
|
9
11
|
if (isProxy) {
|
|
10
|
-
const createProxy = require(
|
|
11
|
-
const { debuggerConfig } = require(paths_1.default.microConfig);
|
|
12
|
+
const createProxy = require('@tuya-sat/micro-dev-proxy').default;
|
|
12
13
|
createProxy(debuggerConfig)(app);
|
|
13
14
|
}
|
|
15
|
+
const customApi = debuggerConfig === null || debuggerConfig === void 0 ? void 0 : debuggerConfig.customApi;
|
|
16
|
+
if (customApi) {
|
|
17
|
+
app.use(['custom-api'], (0, http_proxy_middleware_1.createProxyMiddleware)({
|
|
18
|
+
target: customApi,
|
|
19
|
+
changeOrigin: true,
|
|
20
|
+
selfHandleResponse: true,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
exports.default = useProxy;
|
package/dist/scripts/build.js
CHANGED
|
@@ -17,7 +17,6 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
17
17
|
const ora_1 = __importDefault(require("ora"));
|
|
18
18
|
const webpack_config_1 = __importDefault(require("../config/webpack.config"));
|
|
19
19
|
const template_1 = __importDefault(require("../template"));
|
|
20
|
-
const apis_1 = __importDefault(require("../apis"));
|
|
21
20
|
const paths_1 = __importDefault(require("../config/paths"));
|
|
22
21
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
23
22
|
const path_1 = __importDefault(require("path"));
|
|
@@ -27,7 +26,7 @@ let { debuggerConfig: { isMainApp }, } = require(paths_1.default.microConfig);
|
|
|
27
26
|
const config = (0, webpack_config_1.default)();
|
|
28
27
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
28
|
yield (0, template_1.default)();
|
|
30
|
-
|
|
29
|
+
// await apis();
|
|
31
30
|
(0, webpack_1.default)(config).run((err, stats) => {
|
|
32
31
|
if (err) {
|
|
33
32
|
spinner.fail();
|
package/dist/scripts/start.js
CHANGED
|
@@ -18,10 +18,9 @@ const mock_1 = __importDefault(require("../module/mock"));
|
|
|
18
18
|
const bundleServer_1 = require("../module/bundleServer");
|
|
19
19
|
const proxy_1 = __importDefault(require("../module/proxy"));
|
|
20
20
|
const template_1 = __importDefault(require("../template"));
|
|
21
|
-
const apis_1 = __importDefault(require("../apis"));
|
|
22
21
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
22
|
yield (0, template_1.default)();
|
|
24
|
-
|
|
23
|
+
// await apis();
|
|
25
24
|
let defaultPort = 9000;
|
|
26
25
|
console.log(chalk_1.default.yellow('如果是pc端的微应用调试,请勿使用该命令,考虑使用`start --main`或`start --main --proxy`'));
|
|
27
26
|
//检测端口占用情况
|
|
@@ -18,10 +18,9 @@ const mainServer_1 = __importDefault(require("../module/mainServer"));
|
|
|
18
18
|
const bundleServer_1 = require("../module/bundleServer");
|
|
19
19
|
const kill_port_1 = __importDefault(require("kill-port"));
|
|
20
20
|
const template_1 = __importDefault(require("../template"));
|
|
21
|
-
const apis_1 = __importDefault(require("../apis"));
|
|
22
21
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
22
|
yield (0, template_1.default)();
|
|
24
|
-
|
|
23
|
+
// await apis();
|
|
25
24
|
let defaultPort = 9000;
|
|
26
25
|
//检测端口占用情况
|
|
27
26
|
const bundledServerPort = yield portfinder_1.default.getPortPromise({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.0.27-beta.
|
|
3
|
+
"version": "3.0.27-beta.16",
|
|
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.0.27-beta.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.0.27-beta.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.0.27-beta.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.0.27-beta.16",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.0.27-beta.16",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.0.27-beta.16",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|