@rsmax/framework-shared 1.3.12 → 1.3.14
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/CHANGELOG.md +10 -0
- package/cjs/AppInstanceContext.d.ts +1 -1
- package/cjs/RuntimeOptions.d.ts +1 -1
- package/cjs/RuntimeOptions.js +2 -2
- package/cjs/createPageWrapper.d.ts +1 -1
- package/cjs/createPageWrapper.js +2 -2
- package/cjs/hooks.d.ts +1 -1
- package/cjs/hooks.js +3 -3
- package/cjs/lifecycle.js +1 -1
- package/cjs/promisify.js +0 -1
- package/cjs/utils/isClassComponent.d.ts +1 -1
- package/esm/AppInstanceContext.d.ts +1 -1
- package/esm/RuntimeOptions.d.ts +1 -1
- package/esm/RuntimeOptions.js +2 -2
- package/esm/createPageWrapper.d.ts +1 -1
- package/esm/createPageWrapper.js +2 -2
- package/esm/hooks.d.ts +1 -1
- package/esm/hooks.js +4 -4
- package/esm/lifecycle.js +1 -1
- package/esm/promisify.js +0 -1
- package/esm/utils/isClassComponent.d.ts +1 -1
- package/package.json +11 -11
- package/rstest.config.js +5 -0
- package/vitest.config.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.14](https://github.com/watsonhaw5566/rsmax/compare/v1.3.13...v1.3.14) (2025-09-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsmax/framework-shared
|
|
9
|
+
|
|
10
|
+
## [1.3.13](https://github.com/watsonhaw5566/rsmax/compare/v1.3.12...v1.3.13) (2025-06-16)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **framework-shared:** 修复 promisify 的返回类型定义 ([#25](https://github.com/watsonhaw5566/rsmax/issues/25)) ([9a7d38d](https://github.com/watsonhaw5566/rsmax/commit/9a7d38d2a6f40eb6994903730bec4456e504159a))
|
|
15
|
+
|
|
6
16
|
## [1.3.12](https://github.com/remaxjs/remax/compare/v1.3.11...v1.3.12) (2025-06-08)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @rsmax/framework-shared
|
package/cjs/RuntimeOptions.d.ts
CHANGED
package/cjs/RuntimeOptions.js
CHANGED
|
@@ -12,7 +12,7 @@ const defaultRuntimeOptions = {
|
|
|
12
12
|
appEvents: [],
|
|
13
13
|
pageEvents: {},
|
|
14
14
|
pluginDriver: new PluginDriver_1.default([]),
|
|
15
|
-
|
|
15
|
+
navigate: {},
|
|
16
16
|
mpa: false,
|
|
17
17
|
};
|
|
18
18
|
let runtimeOptions = defaultRuntimeOptions;
|
|
@@ -21,7 +21,7 @@ function merge(...options) {
|
|
|
21
21
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22
22
|
acc.appEvents = (_a = option.appEvents) !== null && _a !== void 0 ? _a : acc.appEvents;
|
|
23
23
|
acc.debug = (_b = option.debug) !== null && _b !== void 0 ? _b : acc.debug;
|
|
24
|
-
acc.
|
|
24
|
+
acc.navigate = (_c = option.navigate) !== null && _c !== void 0 ? _c : acc.navigate;
|
|
25
25
|
Object.keys((_d = option.hostComponents) !== null && _d !== void 0 ? _d : {}).forEach(k => {
|
|
26
26
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
27
27
|
const inputHostComponent = (_a = option.hostComponents) === null || _a === void 0 ? void 0 : _a[k];
|
package/cjs/createPageWrapper.js
CHANGED
|
@@ -28,10 +28,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const React = __importStar(require("react"));
|
|
30
30
|
const react_is_1 = require("react-is");
|
|
31
|
-
const isClassComponent_1 = __importDefault(require("./utils/isClassComponent"));
|
|
32
|
-
const lifecycle_1 = require("./lifecycle");
|
|
33
31
|
const PageInstanceContext_1 = __importDefault(require("./PageInstanceContext"));
|
|
34
32
|
const RuntimeOptions = __importStar(require("./RuntimeOptions"));
|
|
33
|
+
const lifecycle_1 = require("./lifecycle");
|
|
34
|
+
const isClassComponent_1 = __importDefault(require("./utils/isClassComponent"));
|
|
35
35
|
function createPageWrapper(Page, name) {
|
|
36
36
|
const WrappedPage = RuntimeOptions.get('pluginDriver').onPageComponent({ component: Page, page: name });
|
|
37
37
|
return class PageWrapper extends React.Component {
|
package/cjs/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback } from './lifecycle';
|
|
1
|
+
import { type Callback } from './lifecycle';
|
|
2
2
|
export declare function usePageEvent(eventName: string, callback: Callback): void;
|
|
3
3
|
export declare function useComponentInstance(): any;
|
|
4
4
|
export declare function usePageInstance(): any;
|
package/cjs/hooks.js
CHANGED
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useAppEvent = exports.usePageInstance = exports.useComponentInstance = exports.usePageEvent = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const lifecycle_1 = require("./lifecycle");
|
|
9
|
-
const PageInstanceContext_1 = __importDefault(require("./PageInstanceContext"));
|
|
10
|
-
const ComponentInstanceContext_1 = __importDefault(require("./ComponentInstanceContext"));
|
|
11
8
|
const AppInstanceContext_1 = __importDefault(require("./AppInstanceContext"));
|
|
9
|
+
const ComponentInstanceContext_1 = __importDefault(require("./ComponentInstanceContext"));
|
|
10
|
+
const PageInstanceContext_1 = __importDefault(require("./PageInstanceContext"));
|
|
11
|
+
const lifecycle_1 = require("./lifecycle");
|
|
12
12
|
function usePageEvent(eventName, callback) {
|
|
13
13
|
const pageInstance = (0, react_1.useContext)(PageInstanceContext_1.default);
|
|
14
14
|
const lifeCycle = (0, lifecycle_1.lifeCycleName)(eventName);
|
package/cjs/lifecycle.js
CHANGED
|
@@ -50,7 +50,7 @@ function callbackName(name) {
|
|
|
50
50
|
if (name.startsWith('before')) {
|
|
51
51
|
return name;
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return `on${(0, capitalize_1.default)(name)}`;
|
|
54
54
|
}
|
|
55
55
|
exports.callbackName = callbackName;
|
|
56
56
|
function registerLifecycle(instance, method, callback) {
|
package/cjs/promisify.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentClass } from 'react';
|
|
1
|
+
import type { ComponentClass } from 'react';
|
|
2
2
|
export default function isClassComponent(Component: any): Component is ComponentClass;
|
package/esm/RuntimeOptions.d.ts
CHANGED
package/esm/RuntimeOptions.js
CHANGED
|
@@ -6,7 +6,7 @@ const defaultRuntimeOptions = {
|
|
|
6
6
|
appEvents: [],
|
|
7
7
|
pageEvents: {},
|
|
8
8
|
pluginDriver: new PluginDriver([]),
|
|
9
|
-
|
|
9
|
+
navigate: {},
|
|
10
10
|
mpa: false,
|
|
11
11
|
};
|
|
12
12
|
let runtimeOptions = defaultRuntimeOptions;
|
|
@@ -15,7 +15,7 @@ function merge(...options) {
|
|
|
15
15
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16
16
|
acc.appEvents = (_a = option.appEvents) !== null && _a !== void 0 ? _a : acc.appEvents;
|
|
17
17
|
acc.debug = (_b = option.debug) !== null && _b !== void 0 ? _b : acc.debug;
|
|
18
|
-
acc.
|
|
18
|
+
acc.navigate = (_c = option.navigate) !== null && _c !== void 0 ? _c : acc.navigate;
|
|
19
19
|
Object.keys((_d = option.hostComponents) !== null && _d !== void 0 ? _d : {}).forEach(k => {
|
|
20
20
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
21
|
const inputHostComponent = (_a = option.hostComponents) === null || _a === void 0 ? void 0 : _a[k];
|
package/esm/createPageWrapper.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ForwardRef } from 'react-is';
|
|
3
|
-
import isClassComponent from './utils/isClassComponent';
|
|
4
|
-
import { Lifecycle, callbackName } from './lifecycle';
|
|
5
3
|
import PageInstanceContext from './PageInstanceContext';
|
|
6
4
|
import * as RuntimeOptions from './RuntimeOptions';
|
|
5
|
+
import { Lifecycle, callbackName } from './lifecycle';
|
|
6
|
+
import isClassComponent from './utils/isClassComponent';
|
|
7
7
|
export default function createPageWrapper(Page, name) {
|
|
8
8
|
const WrappedPage = RuntimeOptions.get('pluginDriver').onPageComponent({ component: Page, page: name });
|
|
9
9
|
return class PageWrapper extends React.Component {
|
package/esm/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback } from './lifecycle';
|
|
1
|
+
import { type Callback } from './lifecycle';
|
|
2
2
|
export declare function usePageEvent(eventName: string, callback: Callback): void;
|
|
3
3
|
export declare function useComponentInstance(): any;
|
|
4
4
|
export declare function usePageInstance(): any;
|
package/esm/hooks.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { lifeCycleName, registerLifecycle } from './lifecycle';
|
|
3
|
-
import PageInstanceContext from './PageInstanceContext';
|
|
4
|
-
import ComponentInstanceContext from './ComponentInstanceContext';
|
|
1
|
+
import { useContext, useLayoutEffect } from 'react';
|
|
5
2
|
import AppInstanceContext from './AppInstanceContext';
|
|
3
|
+
import ComponentInstanceContext from './ComponentInstanceContext';
|
|
4
|
+
import PageInstanceContext from './PageInstanceContext';
|
|
5
|
+
import { lifeCycleName, registerLifecycle } from './lifecycle';
|
|
6
6
|
export function usePageEvent(eventName, callback) {
|
|
7
7
|
const pageInstance = useContext(PageInstanceContext);
|
|
8
8
|
const lifeCycle = lifeCycleName(eventName);
|
package/esm/lifecycle.js
CHANGED
|
@@ -43,7 +43,7 @@ export function callbackName(name) {
|
|
|
43
43
|
if (name.startsWith('before')) {
|
|
44
44
|
return name;
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return `on${capitalize(name)}`;
|
|
47
47
|
}
|
|
48
48
|
export function registerLifecycle(instance, method, callback) {
|
|
49
49
|
return instance.registerLifecycle(method, callback);
|
package/esm/promisify.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentClass } from 'react';
|
|
1
|
+
import type { ComponentClass } from 'react';
|
|
2
2
|
export default function isClassComponent(Component: any): Component is ComponentClass;
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsmax/framework-shared",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14",
|
|
4
4
|
"description": "使用真正的 React 构建跨平台小程序",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"homepage": "https://remax.wdchiphop.cn",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@github.com:watsonhaw5566/rsmax.git"
|
|
9
|
+
},
|
|
7
10
|
"license": "MIT",
|
|
11
|
+
"author": "Wei Zhu <yesmeck@gmail.com>",
|
|
8
12
|
"main": "cjs/index.js",
|
|
9
13
|
"module": "esm/index.js",
|
|
10
14
|
"types": "esm/index.d.ts",
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git@github.com:remaxjs/remax.git"
|
|
14
|
-
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"clean": "rimraf esm cjs tsconfig.tsbuildinfo",
|
|
17
16
|
"prebuild": "npm run clean",
|
|
18
17
|
"build": "tsc",
|
|
19
18
|
"build:cjs": "tsc --module CommonJS --outDir cjs",
|
|
20
|
-
"
|
|
19
|
+
"clean": "rimraf esm cjs tsconfig.tsbuildinfo",
|
|
20
|
+
"test": "rstest run"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"react-is": "^18.3.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@rsmax/types": "1.3.
|
|
26
|
+
"@rsmax/types": "1.3.14",
|
|
27
27
|
"@types/react": "^18.3.0",
|
|
28
28
|
"@types/react-is": "^18.3.0",
|
|
29
29
|
"@types/react-test-renderer": "^18.3.0",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a542ee33a167f862ec9db0f7466a33f1cef31106"
|
|
36
36
|
}
|
package/rstest.config.js
ADDED