@tuya-sat/micro-script 3.0.0-beta.26 → 3.0.0-beta.27

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.
@@ -7,7 +7,6 @@ declare const _default: {
7
7
  publicDir: string;
8
8
  spaHtml: string;
9
9
  manifest: string;
10
- saasCache: string;
11
10
  vueTsEntryFile: string;
12
11
  vueJsEntryFile: string;
13
12
  ReactTsEntryFile: string;
@@ -14,7 +14,6 @@ exports.default = {
14
14
  publicDir: path_1.default.resolve(cwd, "public/"),
15
15
  spaHtml: path_1.default.resolve(cwd, "public/index.html"),
16
16
  manifest: path_1.default.resolve(cwd, "manifest.json"),
17
- saasCache: path_1.default.resolve(cwd, ".saas-cache.json"),
18
17
  vueTsEntryFile: path_1.default.resolve(cwd, "src/index.ts"),
19
18
  vueJsEntryFile: path_1.default.resolve(cwd, "src/index.js"),
20
19
  ReactTsEntryFile: path_1.default.resolve(cwd, "src/index.tsx"),
@@ -1,4 +1,4 @@
1
- import { DebuggerConfig } from "./staticMain";
1
+ import { DebuggerConfig } from './staticMain';
2
2
  interface anyObject {
3
3
  [key: string]: any;
4
4
  }
@@ -13,55 +13,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getFakeUser = void 0;
16
- const fs_extra_1 = __importDefault(require("fs-extra"));
17
16
  const axios_1 = __importDefault(require("axios"));
18
17
  const chalk_1 = __importDefault(require("chalk"));
19
- const paths_1 = __importDefault(require("../../config/paths"));
20
18
  function parse_SDF_CONFIG(html) {
21
19
  var _a;
22
20
  const REGEX = /(?<=window._SDF_CONFIG=).*?(?=;)/;
23
- return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || "";
21
+ return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || '';
24
22
  }
25
23
  function parse_SDF(html) {
26
24
  var _a;
27
25
  const REGEX = /(?<=window._SDF=).*?(?=;)/;
28
- return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || "";
26
+ return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || '';
29
27
  }
30
28
  function parse__MAIN_APP_PUBLIC_PATH(html) {
31
29
  var _a;
32
30
  const REGEX = /(?<=window.__MAIN_APP_PUBLIC_PATH=).*?(?=;)/;
33
- return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || "";
31
+ return ((_a = REGEX.exec(html)) === null || _a === void 0 ? void 0 : _a[0]) || '';
34
32
  }
35
33
  function getFakeSaas(config) {
36
34
  return __awaiter(this, void 0, void 0, function* () {
37
- if (!fs_extra_1.default.existsSync(paths_1.default.saasCache) && !config.target) {
38
- console.log(chalk_1.default.red("不存在缓存文件,且没有配置target"));
35
+ if (!config.target) {
36
+ console.log(chalk_1.default.red('没有配置target'));
39
37
  process.exit(1);
40
38
  }
41
- if (!fs_extra_1.default.existsSync(paths_1.default.saasCache)) {
42
- const { data } = yield axios_1.default.get(new URL("/login", config.target).href);
43
- const _SDF_CONFIG = parse_SDF_CONFIG(data);
44
- const _SDF = parse_SDF(data);
45
- const __MAIN_APP_PUBLIC_PATH = parse__MAIN_APP_PUBLIC_PATH(data);
46
- const saas = {
47
- _SDF_CONFIG: JSON.parse(_SDF_CONFIG),
48
- _SDF: JSON.parse(_SDF),
49
- __MAIN_APP_PUBLIC_PATH: JSON.parse(__MAIN_APP_PUBLIC_PATH),
50
- };
51
- fs_extra_1.default.writeJSONSync(paths_1.default.saasCache, saas);
52
- return saas;
53
- }
54
- return fs_extra_1.default.readJSONSync(paths_1.default.saasCache);
39
+ const { data } = yield axios_1.default.get(new URL('/login', config.target).href);
40
+ const _SDF_CONFIG = parse_SDF_CONFIG(data);
41
+ const _SDF = parse_SDF(data);
42
+ const __MAIN_APP_PUBLIC_PATH = parse__MAIN_APP_PUBLIC_PATH(data);
43
+ const saas = {
44
+ _SDF_CONFIG: JSON.parse(_SDF_CONFIG),
45
+ _SDF: JSON.parse(_SDF),
46
+ __MAIN_APP_PUBLIC_PATH: JSON.parse(__MAIN_APP_PUBLIC_PATH),
47
+ };
48
+ return saas;
55
49
  });
56
50
  }
57
51
  exports.default = getFakeSaas;
58
52
  function getFakeUser(config) {
59
53
  return {
60
- user_name: config.username || "admin@tuya.com",
54
+ user_name: config.username || 'admin@tuya.com',
61
55
  roles: [
62
56
  {
63
- role_code: "FAKE_ROLE_CODE",
64
- role_name: "FAKE_ROLE_NAME",
57
+ role_code: 'FAKE_ROLE_CODE',
58
+ role_name: 'FAKE_ROLE_NAME',
65
59
  },
66
60
  ],
67
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.0.0-beta.26",
3
+ "version": "3.0.0-beta.27",
4
4
  "bin": "./dist/bin/cli.js",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "@babel/preset-react": "7.16.7",
21
21
  "@babel/preset-typescript": "7.16.7",
22
22
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
23
- "@tuya-sat/micro-dev-loader": "3.0.0-beta.26",
24
- "@tuya-sat/micro-dev-proxy": "3.0.0-beta.26",
25
- "@tuya-sat/micro-utils": "3.0.0-beta.26",
23
+ "@tuya-sat/micro-dev-loader": "3.0.0-beta.27",
24
+ "@tuya-sat/micro-dev-proxy": "3.0.0-beta.27",
25
+ "@tuya-sat/micro-utils": "3.0.0-beta.27",
26
26
  "@types/kill-port": "^2.0.0",
27
27
  "babel-loader": "8.2.4",
28
28
  "babel-plugin-import": "1.13.3",