@tuya-sat/micro-script 3.1.0 → 3.1.2

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.
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
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.1.0",
27
- "@tuya-sat/micro-dev-proxy": "3.1.0",
28
- "@tuya-sat/micro-utils": "3.1.0",
26
+ "@tuya-sat/micro-dev-loader": "3.1.2",
27
+ "@tuya-sat/micro-dev-proxy": "3.1.2",
28
+ "@tuya-sat/micro-utils": "3.1.2",
29
29
  "@types/kill-port": "^2.0.0",
30
30
  "babel-loader": "8.2.4",
31
31
  "babel-plugin-import": "1.13.3",