@tuya-sat/micro-script 3.0.29 → 3.1.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/dist/bin/cli.d.ts CHANGED
@@ -1,5 +1,2 @@
1
1
  #!/usr/bin/env node
2
- declare const PORXY_SIGN = "--proxy";
3
- declare const IS_MAIN = "--main";
4
- declare const params: string[];
5
- declare const action: string, rest: string[];
2
+ export {};
package/dist/bin/cli.js CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const checkVersion_1 = require("../utils/checkVersion");
5
+ (0, checkVersion_1.checkVersion)();
2
6
  const PORXY_SIGN = "--proxy";
3
7
  const IS_MAIN = "--main";
4
8
  const params = process.argv.slice(2);
@@ -70,6 +70,7 @@ function getCommonConfig({ isDev, isBuild, }) {
70
70
  const enableThemeCompile = isDev
71
71
  ? !!devMicroTheme
72
72
  : (0, utils_2.getAnnotations)()['sdf.feat:colorTheme'];
73
+ const isReactTsMicroApp = (0, utils_2.getAnnotations)()['sdf.feat:colorTheme'] === 'REACT_TS';
73
74
  //获取style处理的loader
74
75
  const getStyleLoaders = (extraLoader = []) => {
75
76
  extraLoader = toArray(extraLoader);
@@ -267,7 +268,7 @@ function getCommonConfig({ isDev, isBuild, }) {
267
268
  entry: multiAppsWebpackConfig.entry,
268
269
  });
269
270
  }
270
- if (isMainApp || !fs.existsSync(path_1.default.join(process.cwd(), 'src/index.tsx'))) {
271
+ if (isMainApp || (isReactTsMicroApp && !fs.existsSync(path_1.default.join(process.cwd(), 'src/index.tsx')))) {
271
272
  return (0, webpack_merge_1.merge)(getWebpackConfig([]), {
272
273
  entry: `${path_1.default.join(process.cwd(), 'node_modules/.micro')}/index.tsx`,
273
274
  });
@@ -70,6 +70,9 @@ function staticMain(app, debuggerConfig, microPort) {
70
70
  if (debuggerConfig.isMainApp) {
71
71
  base = `http://localhost:${microPort}`;
72
72
  }
73
+ if (!/^https?:\/\//.test(base)) {
74
+ base = new URL(base, debuggerConfig.target).href;
75
+ }
73
76
  const { data } = yield axios_1.default.get(new URL('index.html', base).href);
74
77
  const $ = cheerio_1.default.load(data);
75
78
  modifySrcAttr($, base);
@@ -0,0 +1 @@
1
+ export declare function checkVersion(): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkVersion = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ // @ts-ignore
10
+ const update_notifier_1 = __importDefault(require("update-notifier"));
11
+ function checkVersion() {
12
+ const pkg = fs_extra_1.default.readJSONSync(path_1.default.resolve(__dirname, '../../package.json'));
13
+ (0, update_notifier_1.default)({
14
+ pkg,
15
+ updateCheckInterval: 0,
16
+ shouldNotifyInNpmScript: true,
17
+ }).notify({
18
+ defer: false,
19
+ });
20
+ }
21
+ exports.checkVersion = checkVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.0.29",
3
+ "version": "3.1.1",
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.29",
27
- "@tuya-sat/micro-dev-proxy": "3.0.29",
28
- "@tuya-sat/micro-utils": "3.0.29",
26
+ "@tuya-sat/micro-dev-loader": "3.1.1",
27
+ "@tuya-sat/micro-dev-proxy": "3.1.1",
28
+ "@tuya-sat/micro-utils": "3.1.1",
29
29
  "@types/kill-port": "^2.0.0",
30
30
  "babel-loader": "8.2.4",
31
31
  "babel-plugin-import": "1.13.3",
@@ -64,6 +64,7 @@
64
64
  "tsconfig-paths-webpack-plugin": "^4.0.0",
65
65
  "uid": "^2.0.1",
66
66
  "undici": "^5.20.0",
67
+ "update-notifier": "5.1.0",
67
68
  "url-loader": "4.1.1",
68
69
  "uuid": "8.3.2",
69
70
  "vue-loader": "17.0.0",