@rsmax/framework-shared 1.3.12 → 1.3.13

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 CHANGED
@@ -3,6 +3,12 @@
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.13](https://github.com/watsonhaw5566/rsmax/compare/v1.3.12...v1.3.13) (2025-06-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **framework-shared:** 修复 promisify 的返回类型定义 ([#25](https://github.com/watsonhaw5566/rsmax/issues/25)) ([9a7d38d](https://github.com/watsonhaw5566/rsmax/commit/9a7d38d2a6f40eb6994903730bec4456e504159a))
11
+
6
12
  ## [1.3.12](https://github.com/remaxjs/remax/compare/v1.3.11...v1.3.12) (2025-06-08)
7
13
 
8
14
  **Note:** Version bump only for package @rsmax/framework-shared
@@ -1,4 +1,4 @@
1
- import { AppLifecycle } from './lifecycle';
1
+ import type { AppLifecycle } from './lifecycle';
2
2
  declare const AppInstanceContext: {
3
3
  lifecycleCallback: any;
4
4
  registerLifecycle(lifecycle: AppLifecycle, callback: () => any): () => void;
@@ -8,7 +8,7 @@ interface RuntimeOptions {
8
8
  pluginDriver: PluginDriver;
9
9
  pageEvents: Record<string, string[]>;
10
10
  appEvents: string[];
11
- history: any;
11
+ navigate: any;
12
12
  mpa: boolean;
13
13
  }
14
14
  export declare function apply(options: Partial<RuntimeOptions>): void;
@@ -12,7 +12,7 @@ const defaultRuntimeOptions = {
12
12
  appEvents: [],
13
13
  pageEvents: {},
14
14
  pluginDriver: new PluginDriver_1.default([]),
15
- history: {},
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.history = (_c = option.history) !== null && _c !== void 0 ? _c : acc.history;
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];
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Callback } from './lifecycle';
2
+ import { type Callback } from './lifecycle';
3
3
  export interface PageProps<Q = Record<string, string | undefined>> {
4
4
  location: {
5
5
  query: Q;
@@ -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 'on' + (0, capitalize_1.default)(name);
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
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.promisify = void 0;
4
4
  function promisify(api) {
5
- // todo 补充类型注释
6
5
  // @ts-ignore
7
6
  return (arg = {}) => {
8
7
  return new Promise((resolve, reject) => {
@@ -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;
@@ -1,4 +1,4 @@
1
- import { AppLifecycle } from './lifecycle';
1
+ import type { AppLifecycle } from './lifecycle';
2
2
  declare const AppInstanceContext: {
3
3
  lifecycleCallback: any;
4
4
  registerLifecycle(lifecycle: AppLifecycle, callback: () => any): () => void;
@@ -8,7 +8,7 @@ interface RuntimeOptions {
8
8
  pluginDriver: PluginDriver;
9
9
  pageEvents: Record<string, string[]>;
10
10
  appEvents: string[];
11
- history: any;
11
+ navigate: any;
12
12
  mpa: boolean;
13
13
  }
14
14
  export declare function apply(options: Partial<RuntimeOptions>): void;
@@ -6,7 +6,7 @@ const defaultRuntimeOptions = {
6
6
  appEvents: [],
7
7
  pageEvents: {},
8
8
  pluginDriver: new PluginDriver([]),
9
- history: {},
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.history = (_c = option.history) !== null && _c !== void 0 ? _c : acc.history;
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];
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Callback } from './lifecycle';
2
+ import { type Callback } from './lifecycle';
3
3
  export interface PageProps<Q = Record<string, string | undefined>> {
4
4
  location: {
5
5
  query: Q;
@@ -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 { useLayoutEffect, useContext } from 'react';
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 'on' + capitalize(name);
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,5 +1,4 @@
1
1
  export function promisify(api) {
2
- // todo 补充类型注释
3
2
  // @ts-ignore
4
3
  return (arg = {}) => {
5
4
  return new Promise((resolve, reject) => {
@@ -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.12",
3
+ "version": "1.3.13",
4
4
  "description": "使用真正的 React 构建跨平台小程序",
5
- "author": "Wei Zhu <yesmeck@gmail.com>",
6
- "homepage": "https://remaxjs.org",
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",
19
+ "clean": "rimraf esm cjs tsconfig.tsbuildinfo",
20
20
  "test": "vitest run"
21
21
  },
22
22
  "dependencies": {
23
23
  "react-is": "^18.3.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@rsmax/types": "1.3.12",
26
+ "@rsmax/types": "1.3.13",
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": "74826f663163c25ebec0017a0e9d5cacea0ca6fc"
35
+ "gitHead": "ff3656307036567c5b9d9b62dcaa599f539d56b7"
36
36
  }