@modern-js/plugin-state 2.65.5-alpha.1 → 2.65.5-alpha.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.
|
@@ -19,7 +19,6 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var plugin_exports = {};
|
|
21
21
|
__export(plugin_exports, {
|
|
22
|
-
Provider: () => import_react.Provider,
|
|
23
22
|
default: () => plugin_default,
|
|
24
23
|
statePlugin: () => statePlugin
|
|
25
24
|
});
|
|
@@ -29,6 +28,7 @@ var import_react = require("@modern-js-reduck/react");
|
|
|
29
28
|
var import_store = require("@modern-js-reduck/store");
|
|
30
29
|
var import_runtime = require("@modern-js/runtime");
|
|
31
30
|
var import_merge = require("@modern-js/runtime-utils/merge");
|
|
31
|
+
var import_react2 = require("react");
|
|
32
32
|
var import_plugins = require("../plugins");
|
|
33
33
|
__reExport(plugin_exports, require("../plugins"), module.exports);
|
|
34
34
|
const StatePluginHandleMap = {
|
|
@@ -62,7 +62,7 @@ const statePlugin = (userConfig = {}) => ({
|
|
|
62
62
|
return {
|
|
63
63
|
wrapRoot(App) {
|
|
64
64
|
const getStateApp = (props) => {
|
|
65
|
-
const context = (0,
|
|
65
|
+
const context = (0, import_react2.useContext)(import_runtime.RuntimeReactContext);
|
|
66
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Provider, {
|
|
67
67
|
store: context.store,
|
|
68
68
|
config: storeConfig,
|
|
@@ -89,7 +89,6 @@ const statePlugin = (userConfig = {}) => ({
|
|
|
89
89
|
var plugin_default = statePlugin;
|
|
90
90
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
91
|
0 && (module.exports = {
|
|
92
|
-
Provider,
|
|
93
92
|
statePlugin,
|
|
94
93
|
...require("../plugins")
|
|
95
94
|
});
|
|
@@ -3,8 +3,9 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Provider } from "@modern-js-reduck/react";
|
|
5
5
|
import { createStore } from "@modern-js-reduck/store";
|
|
6
|
-
import {
|
|
6
|
+
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
|
7
7
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
8
|
+
import { useContext } from "react";
|
|
8
9
|
import { autoActions, devtools, effects, immer } from "../plugins";
|
|
9
10
|
var StatePluginHandleMap = {
|
|
10
11
|
immer,
|
|
@@ -60,7 +61,7 @@ var statePlugin = function() {
|
|
|
60
61
|
return {
|
|
61
62
|
wrapRoot: function wrapRoot(App) {
|
|
62
63
|
var getStateApp = function(props) {
|
|
63
|
-
var context =
|
|
64
|
+
var context = useContext(RuntimeReactContext);
|
|
64
65
|
return /* @__PURE__ */ _jsx(Provider, {
|
|
65
66
|
store: context.store,
|
|
66
67
|
config: storeConfig,
|
|
@@ -86,7 +87,6 @@ var statePlugin = function() {
|
|
|
86
87
|
var plugin_default = statePlugin;
|
|
87
88
|
export * from "../plugins";
|
|
88
89
|
export {
|
|
89
|
-
Provider,
|
|
90
90
|
plugin_default as default,
|
|
91
91
|
statePlugin
|
|
92
92
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Provider } from "@modern-js-reduck/react";
|
|
3
3
|
import { createStore } from "@modern-js-reduck/store";
|
|
4
|
-
import {
|
|
4
|
+
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
|
5
5
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
6
|
+
import { useContext } from "react";
|
|
6
7
|
import { autoActions, devtools, effects, immer } from "../plugins";
|
|
7
8
|
const StatePluginHandleMap = {
|
|
8
9
|
immer,
|
|
@@ -35,7 +36,7 @@ const statePlugin = (userConfig = {}) => ({
|
|
|
35
36
|
return {
|
|
36
37
|
wrapRoot(App) {
|
|
37
38
|
const getStateApp = (props) => {
|
|
38
|
-
const context =
|
|
39
|
+
const context = useContext(RuntimeReactContext);
|
|
39
40
|
return /* @__PURE__ */ _jsx(Provider, {
|
|
40
41
|
store: context.store,
|
|
41
42
|
config: storeConfig,
|
|
@@ -62,7 +63,6 @@ const statePlugin = (userConfig = {}) => ({
|
|
|
62
63
|
var plugin_default = statePlugin;
|
|
63
64
|
export * from "../plugins";
|
|
64
65
|
export {
|
|
65
|
-
Provider,
|
|
66
66
|
plugin_default as default,
|
|
67
67
|
statePlugin
|
|
68
68
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Provider } from '@modern-js-reduck/react';
|
|
2
1
|
import { type Model } from '@modern-js-reduck/store';
|
|
3
2
|
import type { Plugin } from '@modern-js/runtime';
|
|
4
|
-
export { Provider };
|
|
5
3
|
type StatePluginType = 'immer' | 'effects' | 'autoActions' | 'devtools';
|
|
6
4
|
type StateExtraType = {
|
|
7
5
|
initialState: any;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.65.5-alpha.
|
|
18
|
+
"version": "2.65.5-alpha.3",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"@modern-js-reduck/react": "^1.1.10",
|
|
59
59
|
"@modern-js-reduck/store": "^1.1.10",
|
|
60
60
|
"@swc/helpers": "0.5.13",
|
|
61
|
-
"@modern-js/
|
|
61
|
+
"@modern-js/utils": "2.65.4",
|
|
62
62
|
"@modern-js/runtime-utils": "2.65.4",
|
|
63
|
-
"@modern-js/
|
|
63
|
+
"@modern-js/types": "2.65.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": ">=17",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"react-dom": "^18.3.1",
|
|
79
79
|
"ts-jest": "^29.1.0",
|
|
80
80
|
"typescript": "^5",
|
|
81
|
-
"@modern-js/runtime": "2.65.4",
|
|
82
|
-
"@scripts/build": "2.65.4",
|
|
83
81
|
"@modern-js/app-tools": "2.65.4",
|
|
82
|
+
"@scripts/build": "2.65.4",
|
|
83
|
+
"@modern-js/runtime": "2.65.4",
|
|
84
84
|
"@scripts/jest-config": "2.65.4"
|
|
85
85
|
},
|
|
86
86
|
"sideEffects": false,
|