@tuya-sat/micro-script 3.0.18-beta.2 → 3.0.18-beta.3

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.
@@ -14,7 +14,7 @@ const reactConfig = ({ isDev, isBuild, currentFramework, isTs, }) => {
14
14
  rules: [
15
15
  {
16
16
  test: /\.(js|mjs|jsx|ts|tsx)$/,
17
- // exclude: /node_modules/,
17
+ exclude: /node_modules\/[^.micro]/,
18
18
  use: [
19
19
  {
20
20
  loader: require.resolve('babel-loader'),
@@ -111,6 +111,8 @@ function consturctEntry(manifest, oem_micro_app_id, entry_id, baseUrl, lang, dir
111
111
  //@ts-ignore
112
112
  menu.entry_name_en = pickText(menu.entry_name, 'en');
113
113
  //@ts-ignore
114
+ menu.entry_name = pickText(menu.entry_name, lang);
115
+ //@ts-ignore
114
116
  menu.micro_app_name = pickText(menu.micro_app_name, lang);
115
117
  menu.path = `${baseUrl}${menu.path}`;
116
118
  if (menu.sub_entry_list.length) {
@@ -46,6 +46,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
46
46
  !fs.existsSync(microPath) && fs.mkdirSync(microPath, { recursive: true });
47
47
  fs.copyFileSync(path.join(__dirname, './micro-app/index.css'), path.join(microPath, 'index.css'));
48
48
  fs.copyFileSync(path.join(__dirname, './micro-app/public-path.js'), path.join(microPath, 'public-path.js'));
49
+ fs.copyFileSync(path.join(__dirname, './micro-app/interfaces.ts'), path.join(microPath, 'interfaces.ts'));
50
+ fs.copyFileSync(path.join(__dirname, './micro-app/interfaces.ts'), path.join(path.join(process.cwd(), 'node_modules/.micro'), 'interfaces.ts'));
49
51
  let content = fs.readFileSync(path.join(__dirname, './micro-app/index.tsx'), {
50
52
  encoding: 'utf8',
51
53
  });
@@ -3,37 +3,12 @@ import ReactDOM from 'react-dom';
3
3
  import { BrowserRouter } from 'react-router-dom';
4
4
  import { getI18n } from 'react-i18next';
5
5
  import { message } from 'antd';
6
- import { CaptureContext, Event, Severity } from '@sentry/types';
6
+ import { IQiankunProps } from './interfaces';
7
7
  import App from './App';
8
8
  import './lang';
9
9
  import './index.css';
10
10
  import 'theme';
11
11
 
12
- export interface IQiankunProps {
13
- base: string;
14
- container: HTMLElement; // 子应用所在容器
15
- dynamicProps: DynamicProps; // 面包屑
16
- getOwnMenu: () => { entry_name: string }; // 获取当前选中菜单
17
- hasPermission: (permissionCode: string) => boolean;
18
- isSupportMobile: boolean; // 是否支持移动端
19
- mainHistory: mainHistory; // 用于微应用间跳转
20
- modifySelectedMenu: () => void; //
21
- region: 'tx' | 'us' | 'eu' | 'in' | 'ueaz' | 'we' | 'sea';
22
- resourcePrefix: string; // 静态资源地址
23
- sentry: {
24
- captureEvent: (event: Event) => string;
25
- captureMessage: (
26
- message: string,
27
- captureContext?: CaptureContext | Severity
28
- ) => string;
29
- captureException: (
30
- exception: any,
31
- captureContext?: CaptureContext
32
- ) => string;
33
- };
34
- tyLang: 'zh' | 'en'; // 当前语言
35
- langResource: any;
36
- }
37
12
  export let microProps: IQiankunProps;
38
13
 
39
14
  function render(props: IQiankunProps) {
@@ -0,0 +1,61 @@
1
+ import { CaptureContext, Event, Severity } from '@sentry/types';
2
+
3
+ interface mainHistory {
4
+ push: (path, state?) => void;
5
+ replace: (path, state?) => void;
6
+ go: (n: number) => void;
7
+ goBack: () => void;
8
+ goForward: () => void;
9
+ }
10
+
11
+ interface DynamicProps {
12
+ setBreadcrumb: SetBreadcrumb;
13
+ [key: string]: any;
14
+ }
15
+
16
+ interface SetBreadcrumb {
17
+ (breadcrumbInfos?: BreadcrumbInfoInput[]): void;
18
+ }
19
+
20
+ type BreadcrumbInfoInput =
21
+ | {
22
+ type: 'auto' | 'root';
23
+ name?: never;
24
+ path?: never;
25
+ }
26
+ | {
27
+ type: 'menu';
28
+ name?: never;
29
+ path: string;
30
+ }
31
+ | {
32
+ type: 'c';
33
+ name: string;
34
+ path: string;
35
+ };
36
+
37
+ export interface IQiankunProps {
38
+ base: string;
39
+ container: HTMLElement; // 子应用所在容器
40
+ dynamicProps: DynamicProps; // 面包屑
41
+ getOwnMenu: () => { entry_name: string }; // 获取当前选中菜单
42
+ hasPermission: (permissionCode: string) => boolean;
43
+ isSupportMobile: boolean; // 是否支持移动端
44
+ mainHistory: mainHistory; // 用于微应用间跳转
45
+ modifySelectedMenu: () => void; //
46
+ region: 'tx' | 'us' | 'eu' | 'in' | 'ueaz' | 'we' | 'sea';
47
+ resourcePrefix: string; // 静态资源地址
48
+ sentry: {
49
+ captureEvent: (event: Event) => string;
50
+ captureMessage: (
51
+ message: string,
52
+ captureContext?: CaptureContext | Severity
53
+ ) => string;
54
+ captureException: (
55
+ exception: any,
56
+ captureContext?: CaptureContext
57
+ ) => string;
58
+ };
59
+ tyLang: 'zh' | 'en'; // 当前语言
60
+ langResource: any;
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.0.18-beta.2",
3
+ "version": "3.0.18-beta.3",
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.18-beta.2",
27
- "@tuya-sat/micro-dev-proxy": "3.0.18-beta.2",
28
- "@tuya-sat/micro-utils": "3.0.18-beta.2",
26
+ "@tuya-sat/micro-dev-loader": "3.0.18-beta.3",
27
+ "@tuya-sat/micro-dev-proxy": "3.0.18-beta.3",
28
+ "@tuya-sat/micro-utils": "3.0.18-beta.3",
29
29
  "@types/kill-port": "^2.0.0",
30
30
  "babel-loader": "8.2.4",
31
31
  "babel-plugin-import": "1.13.3",