@modern-js/plugin-state 1.2.9 → 2.65.5-alpha.0
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/LICENSE +1 -1
- package/README.md +14 -18
- package/dist/cjs/cli/index.js +70 -0
- package/dist/cjs/cli/types.js +16 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/plugins.js +50 -0
- package/dist/cjs/runtime/index.js +42 -0
- package/dist/cjs/runtime/plugin.js +93 -0
- package/dist/esm/cli/index.js +48 -0
- package/dist/esm/cli/types.js +0 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/plugins.js +19 -0
- package/dist/esm/runtime/index.js +6 -0
- package/dist/esm/runtime/plugin.js +91 -0
- package/dist/esm-node/cli/index.js +46 -0
- package/dist/esm-node/cli/types.js +0 -0
- package/dist/esm-node/index.js +7 -0
- package/dist/esm-node/plugins.js +13 -0
- package/dist/esm-node/runtime/index.js +6 -0
- package/dist/esm-node/runtime/plugin.js +67 -0
- package/dist/types/cli/index.d.ts +3 -5
- package/dist/types/cli/types.d.ts +6 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/plugins.d.ts +1 -1
- package/dist/types/runtime/index.d.ts +1 -2
- package/dist/types/runtime/plugin.d.ts +11 -17
- package/package.json +56 -83
- package/types/index.d.ts +27 -0
- package/CHANGELOG.md +0 -413
- package/dist/js/modern/cli/index.js +0 -110
- package/dist/js/modern/plugins.js +0 -7
- package/dist/js/modern/runtime/index.js +0 -4
- package/dist/js/modern/runtime/plugin.js +0 -70
- package/dist/js/modern/types.js +0 -1
- package/dist/js/node/cli/index.js +0 -127
- package/dist/js/node/plugins.js +0 -35
- package/dist/js/node/runtime/index.js +0 -61
- package/dist/js/node/runtime/plugin.js +0 -99
- package/dist/js/node/types.js +0 -5
- package/dist/js/treeshaking/cli/index.js +0 -100
- package/dist/js/treeshaking/plugins.js +0 -13
- package/dist/js/treeshaking/runtime/index.js +0 -4
- package/dist/js/treeshaking/runtime/plugin.js +0 -62
- package/dist/js/treeshaking/types.js +0 -1
- package/dist/types/types.d.ts +0 -17
- package/type.d.ts +0 -4
package/CHANGELOG.md
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
# @modern-js/plugin-state
|
|
2
|
-
|
|
3
|
-
## 1.2.9
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 37250cb8f: feat: supply `AppConfig` types
|
|
8
|
-
|
|
9
|
-
## 1.2.8
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- f7cbc771: chore(plugin-state): bump @modern-js-reduck/plugin-devtools 1.0.3 to fix the deprecatetion warning
|
|
14
|
-
|
|
15
|
-
## 1.2.7
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
|
|
20
|
-
|
|
21
|
-
## 1.2.6
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- b5943b029: fix: `exports` field in package.json
|
|
26
|
-
|
|
27
|
-
## 1.2.5
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- 6c1438d2: fix: missing peer deps warnings
|
|
32
|
-
- 895fa0ff: chore: using "workspace:\*" in devDependencies
|
|
33
|
-
|
|
34
|
-
## 1.2.4
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- 6cffe99d: chore:
|
|
39
|
-
remove react eslint rules for `modern-js` rule set.
|
|
40
|
-
add .eslintrc for each package to speed up linting
|
|
41
|
-
- 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
|
|
42
|
-
- 60f7d8bf: feat: add tests dir to npmignore
|
|
43
|
-
|
|
44
|
-
## 1.2.3
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- bebb39b6: chore: improve devDependencies and peerDependencies
|
|
49
|
-
|
|
50
|
-
## 1.2.2
|
|
51
|
-
|
|
52
|
-
### Patch Changes
|
|
53
|
-
|
|
54
|
-
- 94d02b35: feat(plugin-runtime): convert to new plugin
|
|
55
|
-
- 681a1ff9: feat: remove unnecessary peerDependencies
|
|
56
|
-
- e8bbc315: feat(plugin-state): convert to new plugin
|
|
57
|
-
|
|
58
|
-
## 1.2.1
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- 83166714: change .npmignore
|
|
63
|
-
- Updated dependencies [83166714]
|
|
64
|
-
- Updated dependencies [c3de9882]
|
|
65
|
-
- Updated dependencies [33ff48af]
|
|
66
|
-
- Updated dependencies [c74597bd]
|
|
67
|
-
- @modern-js/core@1.3.2
|
|
68
|
-
- @modern-js/runtime-core@1.2.1
|
|
69
|
-
|
|
70
|
-
## 1.2.0
|
|
71
|
-
|
|
72
|
-
### Minor Changes
|
|
73
|
-
|
|
74
|
-
- cfe11628: Make Modern.js self bootstraping
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- Updated dependencies [fc71e36f]
|
|
79
|
-
- Updated dependencies [a2cb9abc]
|
|
80
|
-
- Updated dependencies [cfe11628]
|
|
81
|
-
- @modern-js/core@1.3.0
|
|
82
|
-
- @modern-js/runtime-core@1.2.0
|
|
83
|
-
|
|
84
|
-
## 1.1.4
|
|
85
|
-
|
|
86
|
-
### Patch Changes
|
|
87
|
-
|
|
88
|
-
- 4a281912: fix: app init function not work
|
|
89
|
-
- Updated dependencies [4a281912]
|
|
90
|
-
- Updated dependencies [4a281912]
|
|
91
|
-
- Updated dependencies [eb026119]
|
|
92
|
-
- @modern-js/runtime-core@1.1.3
|
|
93
|
-
|
|
94
|
-
## 1.1.3
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- 4406c2db: fix: avoid fetching data again when ssr succeeds
|
|
99
|
-
- Updated dependencies [90eeb72c]
|
|
100
|
-
- Updated dependencies [e04914ce]
|
|
101
|
-
- Updated dependencies [4406c2db]
|
|
102
|
-
- Updated dependencies [5a4c557e]
|
|
103
|
-
- Updated dependencies [e04914ce]
|
|
104
|
-
- Updated dependencies [ecb344dc]
|
|
105
|
-
- @modern-js/core@1.2.0
|
|
106
|
-
- @modern-js/runtime-core@1.1.2
|
|
107
|
-
|
|
108
|
-
## 1.1.2
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- 0fa83663: support more .env files
|
|
113
|
-
- f594fbc8: fix apple icon and favicon support
|
|
114
|
-
- Updated dependencies [6f7fe574]
|
|
115
|
-
- Updated dependencies [0fa83663]
|
|
116
|
-
- @modern-js/core@1.1.2
|
|
117
|
-
- @modern-js/runtime-core@1.1.1
|
|
118
|
-
|
|
119
|
-
## 1.1.1
|
|
120
|
-
|
|
121
|
-
### Patch Changes
|
|
122
|
-
|
|
123
|
-
- 725c4ff0: fix(state): type error when build @modern-js/plugin-state was fixed
|
|
124
|
-
- Updated dependencies [687c92c7]
|
|
125
|
-
- @modern-js/core@1.1.1
|
|
126
|
-
|
|
127
|
-
## 1.1.0
|
|
128
|
-
|
|
129
|
-
### Minor Changes
|
|
130
|
-
|
|
131
|
-
- 96119db2: Relese v1.1.0
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- Updated dependencies [96119db2]
|
|
136
|
-
- @modern-js/core@1.1.0
|
|
137
|
-
- @modern-js/runtime-core@1.1.0
|
|
138
|
-
|
|
139
|
-
## 1.0.0
|
|
140
|
-
|
|
141
|
-
### Patch Changes
|
|
142
|
-
|
|
143
|
-
- 224f7fe: fix server route match
|
|
144
|
-
- 30ac27c: feat: add generator package description
|
|
145
|
-
- 0fd196e: feat: fix bugs
|
|
146
|
-
- 204c626: feat: initial
|
|
147
|
-
- 63be0a5: fix: #118 #104
|
|
148
|
-
- Updated dependencies [224f7fe]
|
|
149
|
-
- Updated dependencies [30ac27c]
|
|
150
|
-
- Updated dependencies [0fd196e]
|
|
151
|
-
- Updated dependencies [204c626]
|
|
152
|
-
- Updated dependencies [63be0a5]
|
|
153
|
-
- @modern-js/core@1.0.0
|
|
154
|
-
- @modern-js/runtime-core@1.0.0
|
|
155
|
-
|
|
156
|
-
## 1.0.0-rc.23
|
|
157
|
-
|
|
158
|
-
### Patch Changes
|
|
159
|
-
|
|
160
|
-
- 224f7fe: fix server route match
|
|
161
|
-
- 30ac27c: feat: add generator package description
|
|
162
|
-
- 0fd196e: feat: fix bugs
|
|
163
|
-
- 204c626: feat: initial
|
|
164
|
-
- 63be0a5: fix: #118 #104
|
|
165
|
-
- Updated dependencies [224f7fe]
|
|
166
|
-
- Updated dependencies [30ac27c]
|
|
167
|
-
- Updated dependencies [0fd196e]
|
|
168
|
-
- Updated dependencies [204c626]
|
|
169
|
-
- Updated dependencies [63be0a5]
|
|
170
|
-
- @modern-js/core@1.0.0-rc.23
|
|
171
|
-
- @modern-js/runtime-core@1.0.0-rc.23
|
|
172
|
-
|
|
173
|
-
## 1.0.0-rc.22
|
|
174
|
-
|
|
175
|
-
### Patch Changes
|
|
176
|
-
|
|
177
|
-
- 224f7fe: fix server route match
|
|
178
|
-
- 30ac27c: feat: add generator package description
|
|
179
|
-
- 0fd196e: feat: fix bugs
|
|
180
|
-
- 204c626: feat: initial
|
|
181
|
-
- 63be0a5: fix: #118 #104
|
|
182
|
-
- Updated dependencies [224f7fe]
|
|
183
|
-
- Updated dependencies [30ac27c]
|
|
184
|
-
- Updated dependencies [0fd196e]
|
|
185
|
-
- Updated dependencies [204c626]
|
|
186
|
-
- Updated dependencies [63be0a5]
|
|
187
|
-
- @modern-js/core@1.0.0-rc.22
|
|
188
|
-
- @modern-js/runtime-core@1.0.0-rc.22
|
|
189
|
-
|
|
190
|
-
## 1.0.0-rc.21
|
|
191
|
-
|
|
192
|
-
### Patch Changes
|
|
193
|
-
|
|
194
|
-
- 224f7fe: fix server route match
|
|
195
|
-
- 30ac27c: feat: add generator package description
|
|
196
|
-
- 0fd196e: feat: fix bugs
|
|
197
|
-
- 204c626: feat: initial
|
|
198
|
-
- 63be0a5: fix: #118 #104
|
|
199
|
-
- Updated dependencies [224f7fe]
|
|
200
|
-
- Updated dependencies [30ac27c]
|
|
201
|
-
- Updated dependencies [0fd196e]
|
|
202
|
-
- Updated dependencies [204c626]
|
|
203
|
-
- Updated dependencies [63be0a5]
|
|
204
|
-
- @modern-js/core@1.0.0-rc.21
|
|
205
|
-
- @modern-js/runtime-core@1.0.0-rc.21
|
|
206
|
-
|
|
207
|
-
## 1.0.0-rc.20
|
|
208
|
-
|
|
209
|
-
### Patch Changes
|
|
210
|
-
|
|
211
|
-
- 224f7fe: fix server route match
|
|
212
|
-
- 30ac27c: feat: add generator package description
|
|
213
|
-
- feat: fix bugs
|
|
214
|
-
- 204c626: feat: initial
|
|
215
|
-
- 63be0a5: fix: #118 #104
|
|
216
|
-
- Updated dependencies [224f7fe]
|
|
217
|
-
- Updated dependencies [30ac27c]
|
|
218
|
-
- Updated dependencies [undefined]
|
|
219
|
-
- Updated dependencies [204c626]
|
|
220
|
-
- Updated dependencies [63be0a5]
|
|
221
|
-
- @modern-js/core@1.0.0-rc.20
|
|
222
|
-
- @modern-js/runtime-core@1.0.0-rc.20
|
|
223
|
-
|
|
224
|
-
## 1.0.0-rc.19
|
|
225
|
-
|
|
226
|
-
### Patch Changes
|
|
227
|
-
|
|
228
|
-
- 224f7fe: fix server route match
|
|
229
|
-
- 30ac27c: feat: add generator package description
|
|
230
|
-
- 204c626: feat: initial
|
|
231
|
-
- 63be0a5: fix: #118 #104
|
|
232
|
-
- Updated dependencies [224f7fe]
|
|
233
|
-
- Updated dependencies [30ac27c]
|
|
234
|
-
- Updated dependencies [204c626]
|
|
235
|
-
- Updated dependencies [63be0a5]
|
|
236
|
-
- @modern-js/core@1.0.0-rc.19
|
|
237
|
-
- @modern-js/runtime-core@1.0.0-rc.19
|
|
238
|
-
|
|
239
|
-
## 1.0.0-rc.18
|
|
240
|
-
|
|
241
|
-
### Patch Changes
|
|
242
|
-
|
|
243
|
-
- 224f7fe: fix server route match
|
|
244
|
-
- 30ac27c: feat: add generator package description
|
|
245
|
-
- 204c626: feat: initial
|
|
246
|
-
- 63be0a5: fix: #118 #104
|
|
247
|
-
- Updated dependencies [224f7fe]
|
|
248
|
-
- Updated dependencies [30ac27c]
|
|
249
|
-
- Updated dependencies [204c626]
|
|
250
|
-
- Updated dependencies [63be0a5]
|
|
251
|
-
- @modern-js/core@1.0.0-rc.18
|
|
252
|
-
- @modern-js/runtime-core@1.0.0-rc.18
|
|
253
|
-
|
|
254
|
-
## 1.0.0-rc.17
|
|
255
|
-
|
|
256
|
-
### Patch Changes
|
|
257
|
-
|
|
258
|
-
- 224f7fe: fix server route match
|
|
259
|
-
- 30ac27c: feat: add generator package description
|
|
260
|
-
- 204c626: feat: initial
|
|
261
|
-
- fix: #118 #104
|
|
262
|
-
- Updated dependencies [224f7fe]
|
|
263
|
-
- Updated dependencies [30ac27c]
|
|
264
|
-
- Updated dependencies [204c626]
|
|
265
|
-
- Updated dependencies [undefined]
|
|
266
|
-
- @modern-js/core@1.0.0-rc.17
|
|
267
|
-
- @modern-js/runtime-core@1.0.0-rc.17
|
|
268
|
-
|
|
269
|
-
## 1.0.0-rc.16
|
|
270
|
-
|
|
271
|
-
### Patch Changes
|
|
272
|
-
|
|
273
|
-
- 224f7fe: fix server route match
|
|
274
|
-
- 30ac27c: feat: add generator package description
|
|
275
|
-
- 204c626: feat: initial
|
|
276
|
-
- Updated dependencies [224f7fe]
|
|
277
|
-
- Updated dependencies [30ac27c]
|
|
278
|
-
- Updated dependencies [204c626]
|
|
279
|
-
- @modern-js/core@1.0.0-rc.16
|
|
280
|
-
- @modern-js/runtime-core@1.0.0-rc.16
|
|
281
|
-
|
|
282
|
-
## 1.0.0-rc.15
|
|
283
|
-
|
|
284
|
-
### Patch Changes
|
|
285
|
-
|
|
286
|
-
- 224f7fe: fix server route match
|
|
287
|
-
- 30ac27c: feat: add generator package description
|
|
288
|
-
- 204c626: feat: initial
|
|
289
|
-
- Updated dependencies [224f7fe]
|
|
290
|
-
- Updated dependencies [30ac27c]
|
|
291
|
-
- Updated dependencies [204c626]
|
|
292
|
-
- @modern-js/core@1.0.0-rc.15
|
|
293
|
-
- @modern-js/runtime-core@1.0.0-rc.15
|
|
294
|
-
|
|
295
|
-
## 1.0.0-rc.14
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- 224f7fe: fix server route match
|
|
300
|
-
- 204c626: feat: initial
|
|
301
|
-
- Updated dependencies [224f7fe]
|
|
302
|
-
- Updated dependencies [204c626]
|
|
303
|
-
- @modern-js/core@1.0.0-rc.14
|
|
304
|
-
- @modern-js/runtime-core@1.0.0-rc.14
|
|
305
|
-
|
|
306
|
-
## 1.0.0-rc.13
|
|
307
|
-
|
|
308
|
-
### Patch Changes
|
|
309
|
-
|
|
310
|
-
- 224f7fe: fix server route match
|
|
311
|
-
- 204c626: feat: initial
|
|
312
|
-
- Updated dependencies [224f7fe]
|
|
313
|
-
- Updated dependencies [204c626]
|
|
314
|
-
- @modern-js/core@1.0.0-rc.13
|
|
315
|
-
- @modern-js/runtime-core@1.0.0-rc.13
|
|
316
|
-
|
|
317
|
-
## 1.0.0-rc.12
|
|
318
|
-
|
|
319
|
-
### Patch Changes
|
|
320
|
-
|
|
321
|
-
- 224f7fe: fix server route match
|
|
322
|
-
- 204c626: feat: initial
|
|
323
|
-
- Updated dependencies [224f7fe]
|
|
324
|
-
- Updated dependencies [204c626]
|
|
325
|
-
- @modern-js/runtime-core@1.0.0-rc.12
|
|
326
|
-
|
|
327
|
-
## 1.0.0-rc.11
|
|
328
|
-
|
|
329
|
-
### Patch Changes
|
|
330
|
-
|
|
331
|
-
- 224f7fe: fix server route match
|
|
332
|
-
- 204c626: feat: initial
|
|
333
|
-
- Updated dependencies [224f7fe]
|
|
334
|
-
- Updated dependencies [204c626]
|
|
335
|
-
- @modern-js/runtime-core@1.0.0-rc.11
|
|
336
|
-
|
|
337
|
-
## 1.0.0-rc.10
|
|
338
|
-
|
|
339
|
-
### Patch Changes
|
|
340
|
-
|
|
341
|
-
- 224f7fe: fix server route match
|
|
342
|
-
- 204c626: feat: initial
|
|
343
|
-
- Updated dependencies [224f7fe]
|
|
344
|
-
- Updated dependencies [204c626]
|
|
345
|
-
- @modern-js/runtime-core@1.0.0-rc.10
|
|
346
|
-
|
|
347
|
-
## 1.0.0-rc.9
|
|
348
|
-
|
|
349
|
-
### Patch Changes
|
|
350
|
-
|
|
351
|
-
- 224f7fe: fix server route match
|
|
352
|
-
- 204c626: feat: initial
|
|
353
|
-
- Updated dependencies [224f7fe]
|
|
354
|
-
- Updated dependencies [204c626]
|
|
355
|
-
- @modern-js/runtime-core@1.0.0-rc.9
|
|
356
|
-
|
|
357
|
-
## 1.0.0-rc.8
|
|
358
|
-
|
|
359
|
-
### Patch Changes
|
|
360
|
-
|
|
361
|
-
- 224f7fe: fix server route match
|
|
362
|
-
- 204c626: feat: initial
|
|
363
|
-
- Updated dependencies [224f7fe]
|
|
364
|
-
- Updated dependencies [204c626]
|
|
365
|
-
- @modern-js/runtime-core@1.0.0-rc.8
|
|
366
|
-
|
|
367
|
-
## 1.0.0-rc.7
|
|
368
|
-
|
|
369
|
-
### Patch Changes
|
|
370
|
-
|
|
371
|
-
- 224f7fe: fix server route match
|
|
372
|
-
- 204c626: feat: initial
|
|
373
|
-
- Updated dependencies [224f7fe]
|
|
374
|
-
- Updated dependencies [204c626]
|
|
375
|
-
- @modern-js/runtime-core@1.0.0-rc.7
|
|
376
|
-
|
|
377
|
-
## 1.0.0-rc.6
|
|
378
|
-
|
|
379
|
-
### Patch Changes
|
|
380
|
-
|
|
381
|
-
- 224f7fe: fix server route match
|
|
382
|
-
- 204c626: feat: initial
|
|
383
|
-
- Updated dependencies [224f7fe]
|
|
384
|
-
- Updated dependencies [204c626]
|
|
385
|
-
- @modern-js/runtime-core@1.0.0-rc.6
|
|
386
|
-
|
|
387
|
-
## 1.0.0-rc.5
|
|
388
|
-
|
|
389
|
-
### Patch Changes
|
|
390
|
-
|
|
391
|
-
- 224f7fe: fix server route match
|
|
392
|
-
- 204c626: feat: initial
|
|
393
|
-
- Updated dependencies [224f7fe]
|
|
394
|
-
- Updated dependencies [204c626]
|
|
395
|
-
- @modern-js/runtime-core@1.0.0-rc.5
|
|
396
|
-
|
|
397
|
-
## 1.0.0-rc.4
|
|
398
|
-
|
|
399
|
-
### Patch Changes
|
|
400
|
-
|
|
401
|
-
- fix server route match
|
|
402
|
-
- 204c626: feat: initial
|
|
403
|
-
- Updated dependencies [undefined]
|
|
404
|
-
- Updated dependencies [204c626]
|
|
405
|
-
- @modern-js/runtime-core@1.0.0-rc.4
|
|
406
|
-
|
|
407
|
-
## 1.0.0-rc.3
|
|
408
|
-
|
|
409
|
-
### Patch Changes
|
|
410
|
-
|
|
411
|
-
- feat: initial
|
|
412
|
-
- Updated dependencies [undefined]
|
|
413
|
-
- @modern-js/runtime-core@1.0.0-rc.3
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
|
|
3
|
-
import "../types";
|
|
4
|
-
const PLUGIN_IDENTIFIER = 'state';
|
|
5
|
-
export default (() => ({
|
|
6
|
-
name: '@modern-js/plugin-state',
|
|
7
|
-
required: ['@modern-js/runtime'],
|
|
8
|
-
setup: api => {
|
|
9
|
-
const stateConfigMap = new Map();
|
|
10
|
-
let pluginsExportsUtils;
|
|
11
|
-
const stateModulePath = path.resolve(__dirname, '../../../../');
|
|
12
|
-
return {
|
|
13
|
-
config() {
|
|
14
|
-
const appContext = api.useAppContext();
|
|
15
|
-
pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'plugins');
|
|
16
|
-
return {
|
|
17
|
-
source: {
|
|
18
|
-
alias: {
|
|
19
|
-
'@modern-js/runtime/plugins': pluginsExportsUtils.getPath()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
modifyEntryImports({
|
|
26
|
-
entrypoint,
|
|
27
|
-
imports
|
|
28
|
-
}) {
|
|
29
|
-
var _getEntryOptions;
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
entryName
|
|
33
|
-
} = entrypoint;
|
|
34
|
-
const userConfig = api.useResolvedConfigContext();
|
|
35
|
-
const {
|
|
36
|
-
packageName
|
|
37
|
-
} = api.useAppContext();
|
|
38
|
-
const stateConfig = (_getEntryOptions = getEntryOptions(entryName, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
|
|
39
|
-
stateConfigMap.set(entryName, stateConfig);
|
|
40
|
-
|
|
41
|
-
const getEnabledPlugins = () => {
|
|
42
|
-
const internalPlugins = ['immer', 'effects', 'autoActions', 'devtools'];
|
|
43
|
-
return internalPlugins.filter(name => stateConfig[name] !== false);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
if (stateConfig) {
|
|
47
|
-
imports.push({
|
|
48
|
-
value: '@modern-js/runtime/plugins',
|
|
49
|
-
specifiers: [{
|
|
50
|
-
imported: PLUGIN_IDENTIFIER
|
|
51
|
-
}]
|
|
52
|
-
});
|
|
53
|
-
imports.push({
|
|
54
|
-
value: '@modern-js/runtime/model',
|
|
55
|
-
specifiers: getEnabledPlugins().map(imported => ({
|
|
56
|
-
imported
|
|
57
|
-
})),
|
|
58
|
-
initialize: `
|
|
59
|
-
const createStatePlugins = (config) => {
|
|
60
|
-
const plugins = [];
|
|
61
|
-
|
|
62
|
-
${getEnabledPlugins().map(name => `
|
|
63
|
-
plugins.push(${name}(config['${name}']));
|
|
64
|
-
`).join('\n')}
|
|
65
|
-
|
|
66
|
-
return plugins;
|
|
67
|
-
}
|
|
68
|
-
`
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
entrypoint,
|
|
74
|
-
imports
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
modifyEntryRuntimePlugins({
|
|
79
|
-
entrypoint,
|
|
80
|
-
plugins
|
|
81
|
-
}) {
|
|
82
|
-
const stateOptions = stateConfigMap.get(entrypoint.entryName);
|
|
83
|
-
|
|
84
|
-
if (stateOptions) {
|
|
85
|
-
const isBoolean = typeof stateOptions === 'boolean';
|
|
86
|
-
let options = isBoolean ? '{}' : JSON.stringify(stateOptions);
|
|
87
|
-
options = `${options.substr(0, options.length - 1)}${isBoolean ? '' : ','}plugins: createStatePlugins(${JSON.stringify(stateConfigMap.get(entrypoint.entryName))})}`;
|
|
88
|
-
plugins.push({
|
|
89
|
-
name: PLUGIN_IDENTIFIER,
|
|
90
|
-
options
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
entrypoint,
|
|
96
|
-
plugins
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
validateSchema() {
|
|
101
|
-
return PLUGIN_SCHEMAS['@modern-js/plugin-state'];
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
addRuntimeExports() {
|
|
105
|
-
pluginsExportsUtils.addExport(`export { default as state } from '${stateModulePath}'`);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { plugin as effectsPlugin } from '@modern-js-reduck/plugin-effects';
|
|
2
|
-
import autoActionsPlugin from '@modern-js-reduck/plugin-auto-actions';
|
|
3
|
-
import immerPlugin from '@modern-js-reduck/plugin-immutable';
|
|
4
|
-
export { default as devtools } from '@modern-js-reduck/plugin-devtools';
|
|
5
|
-
export const effects = () => effectsPlugin;
|
|
6
|
-
export const immer = () => immerPlugin;
|
|
7
|
-
export const autoActions = () => autoActionsPlugin;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import { useContext } from 'react';
|
|
8
|
-
import { RuntimeReactContext } from '@modern-js/runtime-core';
|
|
9
|
-
import { createStore } from '@modern-js-reduck/store';
|
|
10
|
-
import { Provider } from '@modern-js-reduck/react';
|
|
11
|
-
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
const state = config => ({
|
|
15
|
-
name: '@modern-js/plugin-state',
|
|
16
|
-
setup: () => {
|
|
17
|
-
return {
|
|
18
|
-
hoc({
|
|
19
|
-
App
|
|
20
|
-
}, next) {
|
|
21
|
-
const getStateApp = props => {
|
|
22
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
|
-
const context = useContext(RuntimeReactContext);
|
|
24
|
-
return /*#__PURE__*/_jsx(Provider, {
|
|
25
|
-
store: context.store,
|
|
26
|
-
config: config,
|
|
27
|
-
children: /*#__PURE__*/_jsx(App, _objectSpread({}, props))
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return next({
|
|
32
|
-
App: hoistNonReactStatics(getStateApp, App)
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
init({
|
|
37
|
-
context
|
|
38
|
-
}, next) {
|
|
39
|
-
const storeConfig = config || {};
|
|
40
|
-
|
|
41
|
-
if (typeof window !== 'undefined') {
|
|
42
|
-
var _window, _window$_SSR_DATA, _window$_SSR_DATA$dat;
|
|
43
|
-
|
|
44
|
-
storeConfig.initialState = storeConfig.initialState || ((_window = window) === null || _window === void 0 ? void 0 : (_window$_SSR_DATA = _window._SSR_DATA) === null || _window$_SSR_DATA === void 0 ? void 0 : (_window$_SSR_DATA$dat = _window$_SSR_DATA.data) === null || _window$_SSR_DATA$dat === void 0 ? void 0 : _window$_SSR_DATA$dat.storeState) || {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
context.store = createStore(storeConfig);
|
|
48
|
-
next({
|
|
49
|
-
context
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
pickContext({
|
|
54
|
-
context,
|
|
55
|
-
pickedContext
|
|
56
|
-
}, next) {
|
|
57
|
-
return next({
|
|
58
|
-
context,
|
|
59
|
-
pickedContext: _objectSpread(_objectSpread({}, pickedContext), {}, {
|
|
60
|
-
store: context.store
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export default state;
|
|
70
|
-
export * from "../plugins";
|
package/dist/js/modern/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|