@moneko/react 1.4.6 → 1.4.8

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/env.d.ts CHANGED
@@ -53,8 +53,10 @@ declare module '*.mdx' {
53
53
  }
54
54
 
55
55
  declare module '@app/docs' {
56
+ import { JSX } from 'react';
57
+
56
58
  interface ApiEntry {
57
- [key: string]: (() => React.ReactNode)[];
59
+ [key: string]: (() => JSX.Element)[];
58
60
  }
59
61
  const entry: ApiEntry;
60
62
 
@@ -89,18 +91,12 @@ declare module '@app/info' {
89
91
  prefixCls?: string;
90
92
  theme?: string;
91
93
  projectName: string;
94
+ ssr: boolean;
92
95
  }
93
96
  const app: App;
94
97
 
95
98
  export default app;
96
99
  }
97
- declare const layoutSider:
98
- | false
99
- | {
100
- theme?: 'light' | 'dark';
101
- breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
102
- };
103
-
104
100
  declare module '@app/routes' {
105
101
  export interface RouteConfig {
106
102
  /** 菜单id */
@@ -119,15 +115,13 @@ declare module '@app/routes' {
119
115
  parentId?: string;
120
116
  /** 可否关闭标签 */
121
117
  closable?: boolean;
118
+ /** 子菜单 */
119
+ children?: RouteConfig[];
122
120
  props?: {
123
121
  path: string;
124
122
  [key: string]: Any;
125
123
  };
126
124
  metadata?: Record<string, string | number | boolean>;
127
- /** 子菜单 */
128
- children?: RouteConfig[];
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- [key: string]: any;
131
125
  }
132
126
  const routes: RouteConfig[];
133
127
 
@@ -214,8 +208,7 @@ declare module '@app/locales' {
214
208
  }
215
209
  /** 获取当前项目的语言列表 */
216
210
  export const locales: Pick<Locale, 'language' | 'icon' | 'title'>[] = [];
217
- const resources: Partial<LocaleConfigMap> = {};
218
-
211
+ export const resources: Partial<LocaleConfigMap> = {};
219
212
  /**
220
213
  * 插值字符串; 替换字符串中的占位符 `${}` 为对应的值
221
214
  * @param {string} str 包含占位符的字符串
@@ -235,6 +228,10 @@ declare module '@app/locales' {
235
228
  * ```
236
229
  */
237
230
  export function setLang(localeName: string): void;
231
+ /** 使用的语言 */
232
+ export const lang: Omit<Locale, 'translation'>;
233
+ /** 映射 */
234
+ export const t: Record<string, string>;
238
235
  /** 设置 */
239
236
  const localizable: SSO<{
240
237
  lang: Omit<Locale, 'translation'>;
@@ -264,7 +261,6 @@ interface Window {
264
261
  __POWERED_BY_QIANKUN__?: boolean;
265
262
  mainApp?: {
266
263
  container?: HTMLElement;
267
- currentTarget?: Record<string, unknown>;
268
264
  [key: string]: unknown;
269
265
  };
270
266
  H5RemoteRuntime: {
package/jest-preset.js CHANGED
@@ -1,3 +1,7 @@
1
+ import { createRequire } from 'module';
2
+
3
+ const require = createRequire(import.meta.url);
4
+ const transformImports = require.resolve('@moneko/transform-imports');
1
5
  const name = process.env.npm_package_name;
2
6
  const programPath = process.cwd();
3
7
  const nodeModules = `${programPath}/node_modules`;
@@ -45,7 +49,7 @@ export default {
45
49
  legacyDecorator: true,
46
50
  decoratorMetadata: true,
47
51
  react: {
48
- refresh: true
52
+ refresh: true,
49
53
  },
50
54
  },
51
55
  experimental: {
@@ -53,15 +57,15 @@ export default {
53
57
  cacheRoot: `${nodeModules}/.swc`,
54
58
  plugins: [
55
59
  [
56
- "@moneko/transform-imports",
60
+ transformImports,
57
61
  {
58
- "@moneko/common": {
59
- "transform": "@moneko/common/lib/${member}"
62
+ '@moneko/common': {
63
+ transform: '@moneko/common/lib/${member}',
64
+ },
65
+ lodash: {
66
+ transform: 'lodash/${member}',
60
67
  },
61
- "lodash": {
62
- "transform": "lodash/${member}"
63
- }
64
- }
68
+ },
65
69
  ],
66
70
  ],
67
71
  },
package/lib/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ /// <reference types="react" />
1
2
  export * from 'react-router-dom';
2
3
  export { default as LinkWithMenuId } from './link.js';
3
4
  export { default as useNavigateWithMenuId } from './use-navgate.js';
5
+ export { default as renderApp, App } from './entry.js';
6
+ export type RenderAppProps = {
7
+ container?: HTMLElement;
8
+ basename?: string;
9
+ fallback?: JSX.Element;
10
+ language?: string;
11
+ };
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export*from"react-router-dom";export{default as LinkWithMenuId}from"./link.js";export{default as useNavigateWithMenuId}from"./use-navgate.js";
1
+ export*from"react-router-dom";export{default as LinkWithMenuId}from"./link.js";export{default as useNavigateWithMenuId}from"./use-navgate.js";export{default as renderApp,App}from"./entry.js";
package/mdx.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  export interface MDXComponents {
3
3
  [k: string]: (props: Record<string, any>) => JSX.Element;
4
4
  }
package/mdx.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import t from"react";let n={},o=t.createContext(n);export function useMDXComponents(e){let n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}export function MDXProvider(t){let r;return r=t.disableParentContext?"function"==typeof t.components?t.components(n):t.components||n:useMDXComponents(t.components),e(o.Provider,{value:r,children:t.children})}
1
+ import{jsx as e}from"react/jsx-runtime";import*as t from"react";let n={},o=t.createContext(n);export function useMDXComponents(e){let n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}export function MDXProvider(t){let r;return r=t.disableParentContext?"function"==typeof t.components?t.components(n):t.components||n:useMDXComponents(t.components),e(o.Provider,{value:r,children:t.children})}
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@moneko/react",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "react",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "prebuild": "rm -rf ./lib",
8
- "postbuild": "tsc && tsc --jsx react mdx.tsx --declaration --emitDeclarationOnly --esModuleInterop",
8
+ "postbuild": "tsc && tsc mdx.tsx --jsx react --lib es2015 --declaration --emitDeclarationOnly",
9
9
  "build": "swc src -d lib --strip-leading-paths -D && swc mdx.tsx -o mdx.js"
10
10
  },
11
11
  "author": "moneko",
12
12
  "type": "module",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@pmmmwh/react-refresh-webpack-plugin": "0.5.13",
15
+ "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
16
16
  "react-refresh": "0.14.2",
17
17
  "react-refresh-typescript": "2.0.9",
18
- "react-router": "6.23.0",
19
- "react-router-dom": "6.23.0",
20
- "shared-store-object": "1.1.0"
18
+ "react-router": "6.23.1",
19
+ "react-router-dom": "6.23.1",
20
+ "shared-store-object": "1.1.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@moneko/transform-imports": "0.5.1",
24
24
  "@swc/cli": "0.3.12",
25
- "@swc/core": "1.5.0",
26
- "@types/react": "18.3.1",
25
+ "@swc/core": "1.5.29",
26
+ "@types/react": "18.3.3",
27
27
  "@types/react-dom": "18.3.0",
28
- "eslint-config-neko": "2.7.1",
28
+ "eslint-config-neko": "2.7.6",
29
29
  "react": "18.3.1",
30
30
  "react-dom": "18.3.1",
31
31
  "typescript": "5.4.5"