@modern-js/plugin-state 1.0.0 → 1.1.2

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
@@ -1,5 +1,36 @@
1
1
  # @modern-js/plugin-state
2
2
 
3
+ ## 1.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0fa83663: support more .env files
8
+ - f594fbc8: fix apple icon and favicon support
9
+ - Updated dependencies [6f7fe574]
10
+ - Updated dependencies [0fa83663]
11
+ - @modern-js/core@1.1.2
12
+ - @modern-js/runtime-core@1.1.1
13
+
14
+ ## 1.1.1
15
+
16
+ ### Patch Changes
17
+
18
+ - 725c4ff0: fix(state): type error when build @modern-js/plugin-state was fixed
19
+ - Updated dependencies [687c92c7]
20
+ - @modern-js/core@1.1.1
21
+
22
+ ## 1.1.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 96119db2: Relese v1.1.0
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [96119db2]
31
+ - @modern-js/core@1.1.0
32
+ - @modern-js/runtime-core@1.1.0
33
+
3
34
  ## 1.0.0
4
35
 
5
36
  ### Patch Changes
package/README.md CHANGED
@@ -17,10 +17,7 @@
17
17
 
18
18
  > The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
19
19
 
20
- - 介绍 Modern.js (即将上线)
21
- - [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
22
- - [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
23
- - [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
20
+ - [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
24
21
 
25
22
  ## Getting Started
26
23
 
@@ -1,4 +1,5 @@
1
- import { path, getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
2
3
  import { createPlugin, useAppContext, useResolvedConfigContext } from '@modern-js/core';
3
4
  import "../types";
4
5
  const PLUGIN_IDENTIFIER = 'state';
@@ -30,8 +31,12 @@ const index = createPlugin(() => {
30
31
  entryName
31
32
  } = entrypoint; // eslint-disable-next-line react-hooks/rules-of-hooks
32
33
 
33
- const userConfig = useResolvedConfigContext();
34
- const stateConfig = (_getEntryOptions = getEntryOptions(entryName, userConfig.runtime, userConfig.runtimeByEntries)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
34
+ const userConfig = useResolvedConfigContext(); // eslint-disable-next-line react-hooks/rules-of-hooks
35
+
36
+ const {
37
+ packageName
38
+ } = useAppContext();
39
+ const stateConfig = (_getEntryOptions = getEntryOptions(entryName, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
35
40
  stateConfigMap.set(entryName, stateConfig);
36
41
 
37
42
  const getEnabledPlugins = () => {
@@ -1,7 +1,3 @@
1
- /// <reference types="@modern-js-reduck/plugin-auto-actions" />
2
- /// <reference types="@modern-js-reduck/plugin-devtools" />
3
- /// <reference types="@modern-js-reduck/plugin-effects" />
4
- /// <reference types="@modern-js-reduck/plugin-immutable" />
5
1
  // eslint-disable-next-line filenames/match-exported
6
2
  import statePlugin from "./plugin";
7
3
  export * from '@modern-js-reduck/react';
@@ -1 +1,2 @@
1
+ export {};
1
2
  export {};
@@ -5,18 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _utils = require("@modern-js/utils");
9
11
 
10
12
  var _core = require("@modern-js/core");
11
13
 
12
14
  require("../types");
13
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
14
18
  const PLUGIN_IDENTIFIER = 'state';
15
19
  const index = (0, _core.createPlugin)(() => {
16
20
  const stateConfigMap = new Map();
17
21
  let pluginsExportsUtils;
18
22
 
19
- const stateModulePath = _utils.path.resolve(__dirname, '../../../../');
23
+ const stateModulePath = _path.default.resolve(__dirname, '../../../../');
20
24
 
21
25
  return {
22
26
  config() {
@@ -42,8 +46,12 @@ const index = (0, _core.createPlugin)(() => {
42
46
  entryName
43
47
  } = entrypoint; // eslint-disable-next-line react-hooks/rules-of-hooks
44
48
 
45
- const userConfig = (0, _core.useResolvedConfigContext)();
46
- const stateConfig = (_getEntryOptions = (0, _utils.getEntryOptions)(entryName, userConfig.runtime, userConfig.runtimeByEntries)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
49
+ const userConfig = (0, _core.useResolvedConfigContext)(); // eslint-disable-next-line react-hooks/rules-of-hooks
50
+
51
+ const {
52
+ packageName
53
+ } = (0, _core.useAppContext)();
54
+ const stateConfig = (_getEntryOptions = (0, _utils.getEntryOptions)(entryName, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
47
55
  stateConfigMap.set(entryName, stateConfig);
48
56
 
49
57
  const getEnabledPlugins = () => {
@@ -55,10 +55,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
55
55
 
56
56
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
57
57
 
58
- /// <reference types="@modern-js-reduck/plugin-auto-actions" />
59
- /// <reference types="@modern-js-reduck/plugin-devtools" />
60
- /// <reference types="@modern-js-reduck/plugin-effects" />
61
- /// <reference types="@modern-js-reduck/plugin-immutable" />
62
58
  // eslint-disable-next-line filenames/match-exported
63
59
  var _default = _plugin.default;
64
60
  exports.default = _default;
@@ -1,4 +1,5 @@
1
- import { path, getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
2
3
  import { createPlugin, useAppContext, useResolvedConfigContext } from '@modern-js/core';
3
4
  import "../types";
4
5
  var PLUGIN_IDENTIFIER = 'state';
@@ -26,8 +27,12 @@ var index = createPlugin(function () {
26
27
  imports = _ref.imports;
27
28
  var entryName = entrypoint.entryName; // eslint-disable-next-line react-hooks/rules-of-hooks
28
29
 
29
- var userConfig = useResolvedConfigContext();
30
- var stateConfig = (_getEntryOptions = getEntryOptions(entryName, userConfig.runtime, userConfig.runtimeByEntries)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
30
+ var userConfig = useResolvedConfigContext(); // eslint-disable-next-line react-hooks/rules-of-hooks
31
+
32
+ var _useAppContext = useAppContext(),
33
+ packageName = _useAppContext.packageName;
34
+
35
+ var stateConfig = (_getEntryOptions = getEntryOptions(entryName, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
31
36
  stateConfigMap.set(entryName, stateConfig);
32
37
 
33
38
  var getEnabledPlugins = function getEnabledPlugins() {
@@ -1,7 +1,3 @@
1
- /// <reference types="@modern-js-reduck/plugin-auto-actions" />
2
- /// <reference types="@modern-js-reduck/plugin-devtools" />
3
- /// <reference types="@modern-js-reduck/plugin-effects" />
4
- /// <reference types="@modern-js-reduck/plugin-immutable" />
5
1
  // eslint-disable-next-line filenames/match-exported
6
2
  import statePlugin from "./plugin";
7
3
  export * from '@modern-js-reduck/react';
@@ -1 +1,2 @@
1
+ export {};
1
2
  export {};
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.0.0",
14
+ "version": "1.1.2",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/runtime/index.d.ts",
17
17
  "main": "./dist/js/node/runtime/index.js",
@@ -56,23 +56,23 @@
56
56
  "redux-logger": "^3.0.6"
57
57
  },
58
58
  "devDependencies": {
59
- "@modern-js/core": "^1.0.0",
60
- "@modern-js/plugin": "^1.0.0",
61
- "@modern-js/runtime-core": "^1.0.0",
62
- "@modern-js/utils": "^1.0.0",
59
+ "@modern-js/core": "^1.1.2",
60
+ "@modern-js/plugin": "^1.1.2",
61
+ "@modern-js/runtime-core": "^1.1.1",
62
+ "@modern-js/utils": "^1.1.2",
63
63
  "@types/jest": "^26",
64
64
  "@types/node": "^14",
65
65
  "@types/react": "^17",
66
66
  "@types/react-dom": "^17",
67
67
  "react": "^17.0.2",
68
68
  "typescript": "^4",
69
- "@modern-js/plugin-testing": "^1.0.0",
70
- "@modern-js/module-tools": "^1.0.0"
69
+ "@modern-js/plugin-testing": "^1.1.0",
70
+ "@modern-js/module-tools": "^1.1.0"
71
71
  },
72
72
  "sideEffects": false,
73
73
  "peerDependencies": {
74
- "@modern-js/core": "^1.0.0",
75
- "@modern-js/runtime-core": "^1.0.0",
74
+ "@modern-js/core": "^1.1.2",
75
+ "@modern-js/runtime-core": "^1.1.1",
76
76
  "react": "^17.0.2"
77
77
  },
78
78
  "modernConfig": {},
package/src/cli/index.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import path from 'path';
1
2
  import {
2
- path,
3
3
  getEntryOptions,
4
4
  createRuntimeExportsUtils,
5
5
  PLUGIN_SCHEMAS,
@@ -42,11 +42,14 @@ const index = createPlugin(
42
42
  const { entryName } = entrypoint;
43
43
  // eslint-disable-next-line react-hooks/rules-of-hooks
44
44
  const userConfig = useResolvedConfigContext();
45
+ // eslint-disable-next-line react-hooks/rules-of-hooks
46
+ const { packageName } = useAppContext();
45
47
 
46
48
  const stateConfig = getEntryOptions(
47
49
  entryName,
48
50
  userConfig.runtime,
49
51
  userConfig.runtimeByEntries,
52
+ packageName,
50
53
  )?.state;
51
54
 
52
55
  stateConfigMap.set(entryName, stateConfig);
@@ -1,8 +1,3 @@
1
- /// <reference types="@modern-js-reduck/plugin-auto-actions" />
2
- /// <reference types="@modern-js-reduck/plugin-devtools" />
3
- /// <reference types="@modern-js-reduck/plugin-effects" />
4
- /// <reference types="@modern-js-reduck/plugin-immutable" />
5
-
6
1
  // eslint-disable-next-line filenames/match-exported
7
2
  import statePlugin from './plugin';
8
3