@modern-js/module-tools 1.7.0 → 1.16.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,62 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1100dd58c: chore: support react 18
8
+
9
+ chore: 支持 React 18
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [641592f52]
14
+ - Updated dependencies [3904b30a5]
15
+ - Updated dependencies [1100dd58c]
16
+ - Updated dependencies [e04e6e76a]
17
+ - Updated dependencies [81c66e4a4]
18
+ - Updated dependencies [2c305b6f5]
19
+ - Updated dependencies [9d9bbfd05]
20
+ - @modern-js/utils@1.16.0
21
+ - @modern-js/css-config@1.16.0
22
+ - @modern-js/style-compiler@1.16.0
23
+ - @modern-js/new-action@1.16.0
24
+ - @modern-js/babel-preset-module@1.16.0
25
+ - @modern-js/core@1.16.0
26
+ - @modern-js/plugin-changeset@1.16.0
27
+ - @modern-js/plugin-i18n@1.16.0
28
+ - @modern-js/plugin-jarvis@1.16.0
29
+ - @modern-js/babel-compiler@1.16.0
30
+ - @modern-js/plugin@1.16.0
31
+
32
+ ## 1.15.0
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [8658a78]
37
+ - Updated dependencies [05d4a4f]
38
+ - Updated dependencies [ad05af9]
39
+ - Updated dependencies [5d53d1c]
40
+ - Updated dependencies [37cd159]
41
+ - @modern-js/utils@1.15.0
42
+ - @modern-js/new-action@1.15.0
43
+ - @modern-js/babel-preset-module@1.15.0
44
+ - @modern-js/core@1.15.0
45
+ - @modern-js/css-config@1.15.0
46
+ - @modern-js/plugin-changeset@1.15.0
47
+ - @modern-js/plugin-i18n@1.15.0
48
+ - @modern-js/plugin-jarvis@1.15.0
49
+ - @modern-js/babel-compiler@1.15.0
50
+ - @modern-js/style-compiler@1.15.0
51
+ - @modern-js/plugin@1.15.0
52
+
53
+ ## 1.7.1
54
+
55
+ ### Patch Changes
56
+
57
+ - b2f90f8: feat: add addRuntimeExports hooks for module-tools
58
+ feat: 为 module-tools 添加 addRuntimeExports 钩子
59
+
3
60
  ## 1.7.0
4
61
 
5
62
  ### Minor Changes
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
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
6
 
7
+ import { createAsyncWaterfall } from '@modern-js/plugin';
7
8
  import { buildHooks, lifecycle as buildLifeCycle } from "./build";
8
9
  import { devHooks, lifecycle as devLifeCycle } from "./dev";
9
10
  export { buildLifeCycle, devLifeCycle };
@@ -11,4 +12,7 @@ export const lifecycle = () => {
11
12
  devLifeCycle();
12
13
  buildLifeCycle();
13
14
  };
14
- export const hooks = _objectSpread(_objectSpread({}, buildHooks), devHooks);
15
+ export const addRuntimeExports = createAsyncWaterfall();
16
+ export const hooks = _objectSpread(_objectSpread(_objectSpread({}, buildHooks), devHooks), {}, {
17
+ addRuntimeExports
18
+ });
@@ -1,4 +1,4 @@
1
- import { Import } from '@modern-js/utils';
1
+ import { Import, fs } from '@modern-js/utils';
2
2
  import ChangesetPlugin from '@modern-js/plugin-changeset';
3
3
  import LintPlugin from '@modern-js/plugin-jarvis';
4
4
  import { hooks } from "./hooks";
@@ -11,7 +11,7 @@ export { defineConfig } from '@modern-js/core';
11
11
  const isBuildMode = process.argv.slice(2)[0] === 'build';
12
12
  export default (() => ({
13
13
  name: '@modern-js/module-tools',
14
- post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
14
+ post: ['@modern-js/plugin-changeset'],
15
15
  registerHook: hooks,
16
16
  usePlugins: isBuildMode ? [] : [ChangesetPlugin(), LintPlugin()],
17
17
  setup: api => {
@@ -20,6 +20,19 @@ export default (() => ({
20
20
  locale
21
21
  });
22
22
  return {
23
+ // copy from @modern-js/app-tools/src/analyze/index.ts
24
+ async prepare() {
25
+ const appContext = api.useAppContext();
26
+ const hookRunners = api.useHookRunners();
27
+
28
+ try {
29
+ fs.emptydirSync(appContext.internalDirectory);
30
+ } catch (_unused) {// FIXME:
31
+ }
32
+
33
+ await hookRunners.addRuntimeExports();
34
+ },
35
+
23
36
  validateSchema() {
24
37
  return schema.addSchema();
25
38
  },
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addRuntimeExports = void 0;
6
7
  Object.defineProperty(exports, "buildLifeCycle", {
7
8
  enumerable: true,
8
9
  get: function () {
@@ -17,6 +18,8 @@ Object.defineProperty(exports, "devLifeCycle", {
17
18
  });
18
19
  exports.lifecycle = exports.hooks = void 0;
19
20
 
21
+ var _plugin = require("@modern-js/plugin");
22
+
20
23
  var _build = require("./build");
21
24
 
22
25
  var _dev = require("./dev");
@@ -33,7 +36,11 @@ const lifecycle = () => {
33
36
  };
34
37
 
35
38
  exports.lifecycle = lifecycle;
39
+ const addRuntimeExports = (0, _plugin.createAsyncWaterfall)();
40
+ exports.addRuntimeExports = addRuntimeExports;
36
41
 
37
- const hooks = _objectSpread(_objectSpread({}, _build.buildHooks), _dev.devHooks);
42
+ const hooks = _objectSpread(_objectSpread(_objectSpread({}, _build.buildHooks), _dev.devHooks), {}, {
43
+ addRuntimeExports
44
+ });
38
45
 
39
46
  exports.hooks = hooks;
@@ -52,7 +52,7 @@ const isBuildMode = process.argv.slice(2)[0] === 'build';
52
52
 
53
53
  var _default = () => ({
54
54
  name: '@modern-js/module-tools',
55
- post: ['@modern-js/plugin-analyze', '@modern-js/plugin-changeset'],
55
+ post: ['@modern-js/plugin-changeset'],
56
56
  registerHook: _hooks.hooks,
57
57
  usePlugins: isBuildMode ? [] : [(0, _pluginChangeset.default)(), (0, _pluginJarvis.default)()],
58
58
  setup: api => {
@@ -61,6 +61,19 @@ var _default = () => ({
61
61
  locale
62
62
  });
63
63
  return {
64
+ // copy from @modern-js/app-tools/src/analyze/index.ts
65
+ async prepare() {
66
+ const appContext = api.useAppContext();
67
+ const hookRunners = api.useHookRunners();
68
+
69
+ try {
70
+ _utils.fs.emptydirSync(appContext.internalDirectory);
71
+ } catch (_unused) {// FIXME:
72
+ }
73
+
74
+ await hookRunners.addRuntimeExports();
75
+ },
76
+
64
77
  validateSchema() {
65
78
  return schema.addSchema();
66
79
  },
@@ -2,7 +2,9 @@ import { lifecycle as buildLifeCycle } from './build';
2
2
  import { lifecycle as devLifeCycle } from './dev';
3
3
  export { buildLifeCycle, devLifeCycle };
4
4
  export declare const lifecycle: () => void;
5
+ export declare const addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
5
6
  export declare const hooks: {
7
+ addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
6
8
  moduleToolsMenu: import("@modern-js/plugin").ParallelWorkflow<undefined, {
7
9
  name: string;
8
10
  value: string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.7.0",
14
+ "version": "1.16.0",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -54,17 +54,17 @@
54
54
  "@babel/runtime": "^7.18.0",
55
55
  "@babel/traverse": "^7.18.0",
56
56
  "@babel/types": "^7.18.0",
57
- "@modern-js/babel-compiler": "^1.2.6",
58
- "@modern-js/babel-preset-module": "^1.4.0",
59
- "@modern-js/core": "^1.13.0",
60
- "@modern-js/css-config": "^1.2.8",
61
- "@modern-js/new-action": "^1.3.12",
62
- "@modern-js/plugin": "^1.4.2",
63
- "@modern-js/plugin-changeset": "^1.4.0",
64
- "@modern-js/plugin-i18n": "^1.3.0",
65
- "@modern-js/plugin-jarvis": "^1.2.14",
66
- "@modern-js/style-compiler": "^1.2.13",
67
- "@modern-js/utils": "^1.7.12",
57
+ "@modern-js/babel-compiler": "1.16.0",
58
+ "@modern-js/babel-preset-module": "1.16.0",
59
+ "@modern-js/core": "1.16.0",
60
+ "@modern-js/css-config": "1.16.0",
61
+ "@modern-js/new-action": "1.16.0",
62
+ "@modern-js/plugin": "1.16.0",
63
+ "@modern-js/plugin-changeset": "1.16.0",
64
+ "@modern-js/plugin-i18n": "1.16.0",
65
+ "@modern-js/plugin-jarvis": "1.16.0",
66
+ "@modern-js/style-compiler": "1.16.0",
67
+ "@modern-js/utils": "1.16.0",
68
68
  "@rollup/plugin-json": "~4.1.0",
69
69
  "@speedy-js/speedy-types": "0.13.2-alpha.3",
70
70
  "@speedy-js/speedy-core": "0.13.2-alpha.3",
@@ -78,8 +78,8 @@
78
78
  "signal-exit": "^3.0.7"
79
79
  },
80
80
  "devDependencies": {
81
- "@scripts/build": "0.0.0",
82
- "@scripts/jest-config": "0.0.0",
81
+ "@scripts/build": "1.15.0",
82
+ "@scripts/jest-config": "1.15.0",
83
83
  "@speedy-js/speedy-types": "0.13.2-alpha.3",
84
84
  "@types/babel__core": "^7.1.15",
85
85
  "@types/babel__generator": "^7.6.3",
@@ -88,8 +88,6 @@
88
88
  "@types/jest": "^27",
89
89
  "@types/node": "^14",
90
90
  "@types/normalize-path": "^3.0.0",
91
- "@types/react": "^17",
92
- "@types/react-dom": "^17",
93
91
  "@types/signal-exit": "^3.0.1",
94
92
  "jest": "^27",
95
93
  "typescript": "^4",