@modern-js/plugin-state 1.1.4 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @modern-js/plugin-state
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfe11628: Make Modern.js self bootstraping
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [fc71e36f]
12
+ - Updated dependencies [a2cb9abc]
13
+ - Updated dependencies [cfe11628]
14
+ - @modern-js/core@1.3.0
15
+ - @modern-js/runtime-core@1.2.0
16
+
3
17
  ## 1.1.4
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,4 @@
1
- // eslint-disable-next-line filenames/match-exported
2
- import statePlugin from "./plugin";
3
1
  export * from '@modern-js-reduck/react';
4
2
  export { model, createStore } from '@modern-js-reduck/store';
5
- export * from "./plugin";
6
- export default statePlugin;
3
+ export { default } from "./plugin";
4
+ export * from "./plugin";
@@ -13,7 +13,12 @@ Object.defineProperty(exports, "createStore", {
13
13
  return _store.createStore;
14
14
  }
15
15
  });
16
- exports.default = void 0;
16
+ Object.defineProperty(exports, "default", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _plugin.default;
20
+ }
21
+ });
17
22
  Object.defineProperty(exports, "model", {
18
23
  enumerable: true,
19
24
  get: function () {
@@ -21,40 +26,36 @@ Object.defineProperty(exports, "model", {
21
26
  }
22
27
  });
23
28
 
24
- var _plugin = _interopRequireWildcard(require("./plugin"));
29
+ var _react = require("@modern-js-reduck/react");
25
30
 
26
- Object.keys(_plugin).forEach(function (key) {
31
+ Object.keys(_react).forEach(function (key) {
27
32
  if (key === "default" || key === "__esModule") return;
28
33
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
- if (key in exports && exports[key] === _plugin[key]) return;
34
+ if (key in exports && exports[key] === _react[key]) return;
30
35
  Object.defineProperty(exports, key, {
31
36
  enumerable: true,
32
37
  get: function () {
33
- return _plugin[key];
38
+ return _react[key];
34
39
  }
35
40
  });
36
41
  });
37
42
 
38
- var _react = require("@modern-js-reduck/react");
43
+ var _store = require("@modern-js-reduck/store");
39
44
 
40
- Object.keys(_react).forEach(function (key) {
45
+ var _plugin = _interopRequireWildcard(require("./plugin"));
46
+
47
+ Object.keys(_plugin).forEach(function (key) {
41
48
  if (key === "default" || key === "__esModule") return;
42
49
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
43
- if (key in exports && exports[key] === _react[key]) return;
50
+ if (key in exports && exports[key] === _plugin[key]) return;
44
51
  Object.defineProperty(exports, key, {
45
52
  enumerable: true,
46
53
  get: function () {
47
- return _react[key];
54
+ return _plugin[key];
48
55
  }
49
56
  });
50
57
  });
51
58
 
52
- var _store = require("@modern-js-reduck/store");
53
-
54
59
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
55
60
 
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
-
58
- // eslint-disable-next-line filenames/match-exported
59
- var _default = _plugin.default;
60
- exports.default = _default;
61
+ 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; }
@@ -1,6 +1,4 @@
1
- // eslint-disable-next-line filenames/match-exported
2
- import statePlugin from "./plugin";
3
1
  export * from '@modern-js-reduck/react';
4
2
  export { model, createStore } from '@modern-js-reduck/store';
5
- export * from "./plugin";
6
- export default statePlugin;
3
+ export { default } from "./plugin";
4
+ export * from "./plugin";
@@ -1,5 +1,4 @@
1
- import statePlugin from './plugin';
2
1
  export * from '@modern-js-reduck/react';
3
2
  export { model, createStore } from '@modern-js-reduck/store';
4
- export * from './plugin';
5
- export default statePlugin;
3
+ export { default } from './plugin';
4
+ export * from './plugin';
@@ -12,23 +12,23 @@ declare module '@modern-js/runtime-core' {
12
12
  }
13
13
  }
14
14
  declare type PluginProps = Parameters<typeof createStore>[0];
15
- declare const state: (config: PluginProps) => import("@modern-js/plugin").Plugin<Partial<import("@modern-js/runtime-core").Progresses2Threads<{
15
+ declare const state: (config: PluginProps) => import("@modern-js/core").Plugin<Partial<import("@modern-js/runtime-core").Progresses2Threads<{
16
16
  hoc: import("@modern-js/runtime-core").Pipeline<{
17
17
  App: import("react").ComponentType<any>;
18
18
  }, import("react").ComponentType<any>>;
19
19
  provide: import("@modern-js/runtime-core").Pipeline<{
20
20
  element: JSX.Element;
21
- props: import("@modern-js/runtime-core/dist/types/plugin").AppProps;
22
- context: import("@modern-js/runtime-core").RuntimeContext;
21
+ readonly props: import("@modern-js/runtime-core/src/plugin").AppProps;
22
+ readonly context: import("@modern-js/runtime-core").RuntimeContext;
23
23
  }, JSX.Element>;
24
24
  client: import("@modern-js/runtime-core").AsyncPipeline<{
25
25
  App: import("react").ComponentType<any>;
26
- context?: import("@modern-js/runtime-core").RuntimeContext | undefined;
26
+ readonly context?: import("@modern-js/runtime-core").RuntimeContext | undefined;
27
27
  rootElement: HTMLElement;
28
28
  }, void>;
29
29
  server: import("@modern-js/runtime-core").AsyncPipeline<{
30
30
  App: import("react").ComponentType<any>;
31
- context?: import("@modern-js/runtime-core").RuntimeContext | undefined;
31
+ readonly context?: import("@modern-js/runtime-core").RuntimeContext | undefined;
32
32
  }, string>;
33
33
  init: import("@modern-js/runtime-core").AsyncPipeline<{
34
34
  context: import("@modern-js/runtime-core").RuntimeContext;
package/jest.config.js ADDED
@@ -0,0 +1,8 @@
1
+ const sharedConfig = require('@scripts/jest-config');
2
+
3
+ /** @type {import('@jest/types').Config.InitialOptions} */
4
+ module.exports = {
5
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
+ ...sharedConfig,
7
+ rootDir: __dirname,
8
+ };
package/package.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.4",
15
- "jsnext:source": "./src/index.ts",
14
+ "version": "1.2.0",
15
+ "jsnext:source": "./src/runtime/index.tsx",
16
16
  "types": "./dist/types/runtime/index.d.ts",
17
17
  "main": "./dist/js/node/runtime/index.js",
18
18
  "module": "./dist/js/treeshaking/runtime/index.js",
@@ -20,13 +20,18 @@
20
20
  "exports": {
21
21
  ".": {
22
22
  "node": {
23
+ "jsnext:source": "./src/runtime/index.tsx",
23
24
  "import": "./dist/js/modern/runtime/index.js",
24
25
  "require": "./dist/js/node/runtime/index.js"
25
26
  },
26
27
  "default": "./dist/js/treeshaking/runtime/index.js"
27
28
  },
28
- "./cli": "./dist/js/node/cli/index.js",
29
+ "./cli": {
30
+ "jsnext:source": "./src/cli/index.ts",
31
+ "default": "./dist/js/node/cli/index.js"
32
+ },
29
33
  "./plugins": {
34
+ "jsnext:source": "./src/plugins.ts",
30
35
  "node": {
31
36
  "import": "./dist/js/node/plugins.js",
32
37
  "require": "./dist/js/node/plugins.js"
@@ -57,10 +62,10 @@
57
62
  "hoist-non-react-statics": "^3.3.2"
58
63
  },
59
64
  "devDependencies": {
60
- "@modern-js/core": "^1.2.0",
61
- "@modern-js/plugin": "^1.1.2",
62
- "@modern-js/runtime-core": "^1.1.3",
63
- "@modern-js/utils": "^1.1.6",
65
+ "@modern-js/core": "^1.3.0",
66
+ "@modern-js/plugin": "^1.2.0",
67
+ "@modern-js/runtime-core": "^1.2.0",
68
+ "@modern-js/utils": "^1.2.0",
64
69
  "@types/hoist-non-react-statics": "^3.3.1",
65
70
  "@types/jest": "^26",
66
71
  "@types/node": "^14",
@@ -68,24 +73,26 @@
68
73
  "@types/react-dom": "^17",
69
74
  "react": "^17.0.2",
70
75
  "typescript": "^4",
71
- "@modern-js/plugin-testing": "^1.2.2",
72
- "@modern-js/module-tools": "^1.1.4"
76
+ "@scripts/build": "0.0.0",
77
+ "jest": "^27",
78
+ "@scripts/jest-config": "0.0.0"
73
79
  },
74
80
  "sideEffects": false,
75
81
  "peerDependencies": {
76
- "@modern-js/core": "^1.2.0",
77
- "@modern-js/runtime-core": "^1.1.3",
82
+ "@modern-js/core": "^1.3.0",
83
+ "@modern-js/runtime-core": "^1.2.0",
78
84
  "react": "^17.0.2"
79
85
  },
80
86
  "modernConfig": {},
81
87
  "publishConfig": {
82
88
  "registry": "https://registry.npmjs.org/",
83
- "access": "public"
89
+ "access": "public",
90
+ "types": "./dist/types/runtime/index.d.ts"
84
91
  },
85
92
  "scripts": {
86
93
  "new": "modern new",
87
94
  "build": "modern build",
88
- "test": "modern test --passWithNoTests"
95
+ "test": "jest --passWithNoTests"
89
96
  },
90
97
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> 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.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
91
98
  }
@@ -1,9 +1,4 @@
1
- // eslint-disable-next-line filenames/match-exported
2
- import statePlugin from './plugin';
3
-
4
1
  export * from '@modern-js-reduck/react';
5
2
  export { model, createStore } from '@modern-js-reduck/store';
6
-
3
+ export { default } from './plugin';
7
4
  export * from './plugin';
8
-
9
- export default statePlugin;
@@ -0,0 +1,9 @@
1
+ import plugin from '../src/runtime';
2
+ import cliPlugin from '../src/cli';
3
+
4
+ describe('plugin-state', () => {
5
+ it('default', () => {
6
+ expect(plugin).toBeDefined();
7
+ expect(cliPlugin).toBeDefined();
8
+ });
9
+ });
package/tsconfig.json CHANGED
@@ -5,10 +5,7 @@
5
5
  "jsx": "preserve",
6
6
  "skipLibCheck": true,
7
7
  "baseUrl": "./",
8
- "paths": {
9
- "@/*": ["./src/*"],
10
- "@modern-js/plugin": ["node_modules/@modern-js/plugin"]
11
- }
8
+ "paths": {}
12
9
  },
13
10
  "include": ["src"]
14
11
  }