@modern-js/app-tools 1.6.7 → 1.6.10-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/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # @modern-js/app-tools
2
2
 
3
+ ## 1.6.10-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - eeedc8005: feat: add plugin-jarvis to dependencies of solutions
8
+ - f29e9bacf: feat: simplify context usage, no longer depend on containers
9
+ - Updated dependencies [77a8e9e1b]
10
+ - Updated dependencies [9cd364e06]
11
+ - Updated dependencies [550e2bd18]
12
+ - Updated dependencies [9cd364e06]
13
+ - Updated dependencies [3050accbe]
14
+ - Updated dependencies [2b06fe3f3]
15
+ - Updated dependencies [3050accbe]
16
+ - Updated dependencies [f29e9bacf]
17
+ - Updated dependencies [1a5759578]
18
+ - Updated dependencies [2dacc8929]
19
+ - Updated dependencies [338496c6b]
20
+ - Updated dependencies [f29e9bacf]
21
+ - Updated dependencies [a90bc96bd]
22
+ - @modern-js/server@1.5.0-alpha.0
23
+ - @modern-js/utils@1.7.9-alpha.0
24
+ - @modern-js/webpack@1.11.3-alpha.0
25
+ - @modern-js/core@1.12.2-alpha.0
26
+ - @modern-js/node-bundle-require@1.3.7-alpha.0
27
+ - @modern-js/plugin-analyze@1.4.7-alpha.0
28
+ - @modern-js/prod-server@1.1.9-alpha.0
29
+ - @modern-js/plugin-jarvis@1.2.14-alpha.0
30
+ - @modern-js/types@1.5.5-alpha.0
31
+ - @modern-js/plugin@1.4.0-alpha.0
32
+ - @modern-js/plugin-i18n@1.2.8-alpha.0
33
+ - @modern-js/new-action@1.3.11-alpha.0
34
+
35
+ ## 1.6.9
36
+
37
+ ### Patch Changes
38
+
39
+ - change getOutputFile from sync function to async function
40
+
41
+ ## 1.6.8
42
+
43
+ ### Patch Changes
44
+
45
+ - e0e708f83: perf(app-tools): speed up modern start command
46
+ - Updated dependencies [06b411dc3]
47
+ - Updated dependencies [5d4806f86]
48
+ - Updated dependencies [b255072f2]
49
+ - Updated dependencies [63c354ad5]
50
+ - Updated dependencies [4165e50c7]
51
+ - Updated dependencies [073e9ad78]
52
+ - Updated dependencies [cda99c441]
53
+ - Updated dependencies [7975bfa68]
54
+ - Updated dependencies [b7302f781]
55
+ - Updated dependencies [b96dcf364]
56
+ - Updated dependencies [f4a7d49e1]
57
+ - Updated dependencies [9e36d3a01]
58
+ - Updated dependencies [3172e1ee1]
59
+ - Updated dependencies [e0e708f83]
60
+ - @modern-js/webpack@1.11.1
61
+ - @modern-js/core@1.12.1
62
+ - @modern-js/utils@1.7.8
63
+ - @modern-js/plugin@1.3.8
64
+ - @modern-js/server@1.4.21
65
+ - @modern-js/plugin-analyze@1.4.6
66
+ - @modern-js/prod-server@1.1.8
67
+
3
68
  ## 1.6.7
4
69
 
5
70
  ### Patch Changes
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { webpack, getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
8
- import { manager, ResolvedConfigContext } from '@modern-js/core';
8
+ import { ResolvedConfigContext } from '@modern-js/core';
9
9
  import { formatWebpackMessages, measureFileSizesBeforeBuild, printFileSizesAfterBuild, printBuildError, logger, isUseSSRBundle, emptyDir } from '@modern-js/utils';
10
10
  import { generateRoutes } from "../utils/routes";
11
11
  import { buildServerConfig, emitResolvedConfig } from "../utils/config";
@@ -91,12 +91,10 @@ export const build = async (api, options) => {
91
91
  });
92
92
  };
93
93
 
94
- manager.run(() => {
95
- resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
96
- cliOptions: options
97
- });
98
- ResolvedConfigContext.set(resolvedConfig);
94
+ resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
95
+ cliOptions: options
99
96
  });
97
+ ResolvedConfigContext.set(resolvedConfig);
100
98
  const {
101
99
  distDirectory,
102
100
  appDirectory,
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { fs, logger, chalk, isSSR } from '@modern-js/utils';
8
- import { manager, ResolvedConfigContext } from '@modern-js/core';
8
+ import { ResolvedConfigContext } from '@modern-js/core';
9
9
  import { createCompiler } from "../utils/createCompiler";
10
10
  import { createServer } from "../utils/createServer";
11
11
  import { generateRoutes } from "../utils/routes";
@@ -16,12 +16,10 @@ export const dev = async (api, options) => {
16
16
  let userConfig = api.useResolvedConfigContext();
17
17
  const appContext = api.useAppContext();
18
18
  const hookRunners = api.useHookRunners();
19
- manager.run(() => {
20
- userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
21
- cliOptions: options
22
- });
23
- ResolvedConfigContext.set(userConfig);
19
+ userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
20
+ cliOptions: options
24
21
  });
22
+ ResolvedConfigContext.set(userConfig);
25
23
  const {
26
24
  appDirectory,
27
25
  distDirectory,
@@ -4,22 +4,20 @@ 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 * as path from 'path';
7
+ import path from 'path';
8
8
  import { defineConfig, cli } from '@modern-js/core';
9
9
  import AnalyzePlugin from '@modern-js/plugin-analyze';
10
+ import LintPlugin from '@modern-js/plugin-jarvis';
10
11
  import { cleanRequireCache } from '@modern-js/utils';
11
12
  import { hooks } from "./hooks";
12
13
  import { i18n, localeKeys } from "./locale";
13
14
  import { getLocaleLanguage } from "./utils/language";
14
- import { start } from "./commands/start";
15
- import { dev } from "./commands/dev";
16
- import { closeServer } from "./utils/createServer";
17
15
  export { defineConfig };
18
16
  export default (() => ({
19
17
  name: '@modern-js/app-tools',
20
18
  post: ['@modern-js/plugin-analyze', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-router', '@modern-js/plugin-polyfill'],
21
19
  registerHook: hooks,
22
- usePlugins: [AnalyzePlugin()],
20
+ usePlugins: [AnalyzePlugin(), LintPlugin()],
23
21
  setup: api => {
24
22
  const locale = getLocaleLanguage();
25
23
  i18n.changeLanguage({
@@ -30,6 +28,9 @@ export default (() => ({
30
28
  program
31
29
  }) {
32
30
  program.command('dev').usage('[options]').description(i18n.t(localeKeys.command.dev.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-e --entry [entry...]', i18n.t(localeKeys.command.dev.entry)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('--api-only', i18n.t(localeKeys.command.dev.apiOnly)).action(async options => {
31
+ const {
32
+ dev
33
+ } = await import("./commands/dev");
33
34
  await dev(api, options);
34
35
  });
35
36
  program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).action(async options => {
@@ -42,6 +43,9 @@ export default (() => ({
42
43
  process.exit(0);
43
44
  });
44
45
  program.command('start').usage('[options]').description(i18n.t(localeKeys.command.start.describe)).option('--api-only', i18n.t(localeKeys.command.dev.apiOnly)).action(async () => {
46
+ const {
47
+ start
48
+ } = await import("./commands/start");
45
49
  await start(api);
46
50
  });
47
51
  program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).description(i18n.t(localeKeys.command.deploy.describe)).action(async options => {
@@ -86,6 +90,9 @@ export default (() => ({
86
90
  const absolutePath = path.resolve(appDirectory, filename);
87
91
 
88
92
  if (!absolutePath.includes(srcDirectory) && (eventType === 'change' || eventType === 'unlink')) {
93
+ const {
94
+ closeServer
95
+ } = await import("./utils/createServer");
89
96
  await closeServer();
90
97
  await cli.restart();
91
98
  }
@@ -16,7 +16,7 @@ export const buildServerConfig = async ({
16
16
  }) => {
17
17
  const configFilePath = await getServerConfig(appDirectory, configFile);
18
18
 
19
- const getOutputFile = filepath => path.resolve(distDirectory, `${filepath.replace(new RegExp(CONFIG_FILE_EXTENSIONS.join('|')), '')}.js`);
19
+ const getOutputFile = async filepath => path.resolve(distDirectory, `${filepath.replace(new RegExp(CONFIG_FILE_EXTENSIONS.join('|')), '')}.js`);
20
20
 
21
21
  if (configFilePath) {
22
22
  const configHelperFilePath = path.normalize(path.join(distDirectory, './config-helper.js'));
@@ -107,14 +107,12 @@ const build = async (api, options) => {
107
107
  });
108
108
  };
109
109
 
110
- _core.manager.run(() => {
111
- resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
112
- cliOptions: options
113
- });
114
-
115
- _core.ResolvedConfigContext.set(resolvedConfig);
110
+ resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
111
+ cliOptions: options
116
112
  });
117
113
 
114
+ _core.ResolvedConfigContext.set(resolvedConfig);
115
+
118
116
  const {
119
117
  distDirectory,
120
118
  appDirectory,
@@ -35,15 +35,12 @@ const dev = async (api, options) => {
35
35
  let userConfig = api.useResolvedConfigContext();
36
36
  const appContext = api.useAppContext();
37
37
  const hookRunners = api.useHookRunners();
38
-
39
- _core.manager.run(() => {
40
- userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
41
- cliOptions: options
42
- });
43
-
44
- _core.ResolvedConfigContext.set(userConfig);
38
+ userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
39
+ cliOptions: options
45
40
  });
46
41
 
42
+ _core.ResolvedConfigContext.set(userConfig);
43
+
47
44
  const {
48
45
  appDirectory,
49
46
  distDirectory,
@@ -11,12 +11,14 @@ Object.defineProperty(exports, "defineConfig", {
11
11
  }
12
12
  });
13
13
 
14
- var path = _interopRequireWildcard(require("path"));
14
+ var _path = _interopRequireDefault(require("path"));
15
15
 
16
16
  var _core = require("@modern-js/core");
17
17
 
18
18
  var _pluginAnalyze = _interopRequireDefault(require("@modern-js/plugin-analyze"));
19
19
 
20
+ var _pluginJarvis = _interopRequireDefault(require("@modern-js/plugin-jarvis"));
21
+
20
22
  var _utils = require("@modern-js/utils");
21
23
 
22
24
  var _hooks = require("./hooks");
@@ -25,12 +27,6 @@ var _locale = require("./locale");
25
27
 
26
28
  var _language = require("./utils/language");
27
29
 
28
- var _start = require("./commands/start");
29
-
30
- var _dev = require("./commands/dev");
31
-
32
- var _createServer = require("./utils/createServer");
33
-
34
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
31
 
36
32
  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; }
@@ -47,7 +43,7 @@ var _default = () => ({
47
43
  name: '@modern-js/app-tools',
48
44
  post: ['@modern-js/plugin-analyze', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-router', '@modern-js/plugin-polyfill'],
49
45
  registerHook: _hooks.hooks,
50
- usePlugins: [(0, _pluginAnalyze.default)()],
46
+ usePlugins: [(0, _pluginAnalyze.default)(), (0, _pluginJarvis.default)()],
51
47
  setup: api => {
52
48
  const locale = (0, _language.getLocaleLanguage)();
53
49
 
@@ -60,7 +56,10 @@ var _default = () => ({
60
56
  program
61
57
  }) {
62
58
  program.command('dev').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.dev.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('-e --entry [entry...]', _locale.i18n.t(_locale.localeKeys.command.dev.entry)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).action(async options => {
63
- await (0, _dev.dev)(api, options);
59
+ const {
60
+ dev
61
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/dev")));
62
+ await dev(api, options);
64
63
  });
65
64
  program.command('build').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.build.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).action(async options => {
66
65
  const {
@@ -72,7 +71,10 @@ var _default = () => ({
72
71
  process.exit(0);
73
72
  });
74
73
  program.command('start').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.start.describe)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).action(async () => {
75
- await (0, _start.start)(api);
74
+ const {
75
+ start
76
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/start")));
77
+ await start(api);
76
78
  });
77
79
  program.command('deploy').usage('[options]').option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async options => {
78
80
  const {
@@ -113,10 +115,14 @@ var _default = () => ({
113
115
  appDirectory,
114
116
  srcDirectory
115
117
  } = appContext;
116
- const absolutePath = path.resolve(appDirectory, filename);
118
+
119
+ const absolutePath = _path.default.resolve(appDirectory, filename);
117
120
 
118
121
  if (!absolutePath.includes(srcDirectory) && (eventType === 'change' || eventType === 'unlink')) {
119
- await (0, _createServer.closeServer)();
122
+ const {
123
+ closeServer
124
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./utils/createServer")));
125
+ await closeServer();
120
126
  await _core.cli.restart();
121
127
  }
122
128
  },
@@ -33,7 +33,7 @@ const buildServerConfig = async ({
33
33
  }) => {
34
34
  const configFilePath = await (0, _utils.getServerConfig)(appDirectory, configFile);
35
35
 
36
- const getOutputFile = filepath => path.resolve(distDirectory, `${filepath.replace(new RegExp(_utils.CONFIG_FILE_EXTENSIONS.join('|')), '')}.js`);
36
+ const getOutputFile = async filepath => path.resolve(distDirectory, `${filepath.replace(new RegExp(_utils.CONFIG_FILE_EXTENSIONS.join('|')), '')}.js`);
37
37
 
38
38
  if (configFilePath) {
39
39
  const configHelperFilePath = path.normalize(path.join(distDirectory, './config-helper.js'));
@@ -1,3 +1,3 @@
1
1
  import { PluginAPI } from '@modern-js/core';
2
2
  import type { BuildOptions } from '../utils/types';
3
- export declare const build: (api: PluginAPI, options?: BuildOptions | undefined) => Promise<void>;
3
+ export declare const build: (api: PluginAPI, options?: BuildOptions) => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { Configuration, WebpackConfigTarget } from '@modern-js/webpack';
2
2
  import type { PluginAPI, NormalizedConfig, IAppContext } from '@modern-js/core';
3
3
  import type { InspectOptions } from '../utils/types';
4
- export declare const formatWebpackConfig: (config: Configuration, verbose?: boolean | undefined) => string;
4
+ export declare const formatWebpackConfig: (config: Configuration, verbose?: boolean) => string;
5
5
  export declare const inspect: (api: PluginAPI, options: InspectOptions) => void;
6
6
  export declare const getTagByWebpackTarget: (webpackTarget: WebpackConfigTarget) => "modern" | "client" | "ssr";
7
7
  export declare const printInspectResult: (webpackTarget: WebpackConfigTarget, appContext: IAppContext, resolvedConfig: NormalizedConfig, options: InspectOptions) => string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.6.7",
14
+ "version": "1.6.10-alpha.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -57,21 +57,22 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@babel/runtime": "^7.18.0",
60
- "@modern-js/core": "^1.12.0",
60
+ "@modern-js/core": "^1.12.2-alpha.0",
61
61
  "@modern-js/i18n-cli-language-detector": "^1.2.4",
62
- "@modern-js/new-action": "^1.3.10",
63
- "@modern-js/node-bundle-require": "^1.3.5",
64
- "@modern-js/plugin": "^1.3.7",
65
- "@modern-js/plugin-analyze": "^1.4.6",
66
- "@modern-js/plugin-i18n": "^1.2.7",
67
- "@modern-js/prod-server": "^1.1.8",
68
- "@modern-js/server": "^1.4.20",
69
- "@modern-js/types": "^1.5.4",
70
- "@modern-js/utils": "^1.7.7",
71
- "@modern-js/webpack": "^1.11.0"
62
+ "@modern-js/new-action": "^1.3.11-alpha.0",
63
+ "@modern-js/node-bundle-require": "^1.3.7-alpha.0",
64
+ "@modern-js/plugin": "^1.4.0-alpha.0",
65
+ "@modern-js/plugin-analyze": "^1.4.7-alpha.0",
66
+ "@modern-js/plugin-i18n": "^1.2.8-alpha.0",
67
+ "@modern-js/plugin-jarvis": "^1.2.14-alpha.0",
68
+ "@modern-js/prod-server": "^1.1.9-alpha.0",
69
+ "@modern-js/server": "^1.5.0-alpha.0",
70
+ "@modern-js/types": "^1.5.5-alpha.0",
71
+ "@modern-js/utils": "^1.7.9-alpha.0",
72
+ "@modern-js/webpack": "^1.11.3-alpha.0"
72
73
  },
73
74
  "devDependencies": {
74
- "@modern-js/server-core": "1.3.5",
75
+ "@modern-js/server-core": "1.4.0-alpha.0",
75
76
  "@scripts/build": "0.0.0",
76
77
  "@scripts/jest-config": "0.0.0",
77
78
  "@types/jest": "^27",