@modern-js/app-tools 1.4.1 → 1.4.4
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 +77 -0
- package/dist/js/modern/commands/build.js +15 -9
- package/dist/js/modern/commands/dev.js +5 -1
- package/dist/js/modern/commands/start.js +1 -1
- package/dist/js/modern/locale/zh.js +1 -1
- package/dist/js/node/commands/build.js +11 -8
- package/dist/js/node/commands/dev.js +10 -3
- package/dist/js/node/commands/start.js +2 -2
- package/dist/js/node/locale/zh.js +1 -1
- package/dist/types/commands/build.d.ts +2 -5
- package/dist/types/index.d.ts +6 -18
- package/dist/types/utils/createServer.d.ts +2 -2
- package/dist/types/utils/types.d.ts +4 -1
- package/lib/types.d.ts +92 -0
- package/package.json +10 -9
- package/tests/commands/build.test.ts +17 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 1.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d5bf095a: fix: disable load webpack when apiOnly mode
|
|
8
|
+
- Updated dependencies [5bf5868d]
|
|
9
|
+
- Updated dependencies [80d3cfb7]
|
|
10
|
+
- Updated dependencies [42c6b136]
|
|
11
|
+
- Updated dependencies [80d8ddfe]
|
|
12
|
+
- Updated dependencies [4e7dcbd5]
|
|
13
|
+
- Updated dependencies [d95f28c3]
|
|
14
|
+
- Updated dependencies [d95f28c3]
|
|
15
|
+
- Updated dependencies [d5bf095a]
|
|
16
|
+
- Updated dependencies [9e8bc4ab]
|
|
17
|
+
- Updated dependencies [0923c182]
|
|
18
|
+
- Updated dependencies [0c556e59]
|
|
19
|
+
- Updated dependencies [80d8ddfe]
|
|
20
|
+
- Updated dependencies [491145e3]
|
|
21
|
+
- Updated dependencies [2008fdbd]
|
|
22
|
+
- Updated dependencies [ca0bcf13]
|
|
23
|
+
- Updated dependencies [9229dfd1]
|
|
24
|
+
- @modern-js/utils@1.3.5
|
|
25
|
+
- @modern-js/core@1.5.0
|
|
26
|
+
- @modern-js/plugin@1.3.0
|
|
27
|
+
- @modern-js/prod-server@1.0.4
|
|
28
|
+
- @modern-js/types@1.3.5
|
|
29
|
+
- @modern-js/server@1.4.7
|
|
30
|
+
|
|
31
|
+
## 1.4.3
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 4b5d4bf4: feat: add img resource's inline and url type declaration
|
|
36
|
+
- bdcf0865: fix: empty distDirectory for api service
|
|
37
|
+
- 02fb4146: support product server
|
|
38
|
+
- edc3bd3d: fix: @modern-js/core package not found
|
|
39
|
+
- Updated dependencies [969f172f]
|
|
40
|
+
- Updated dependencies [0ad75faa]
|
|
41
|
+
- Updated dependencies [4c792f68]
|
|
42
|
+
- Updated dependencies [83059b93]
|
|
43
|
+
- Updated dependencies [4b5d4bf4]
|
|
44
|
+
- Updated dependencies [0ad75faa]
|
|
45
|
+
- Updated dependencies [62f5b8c8]
|
|
46
|
+
- Updated dependencies [55e18278]
|
|
47
|
+
- Updated dependencies [4499a674]
|
|
48
|
+
- Updated dependencies [0ad75faa]
|
|
49
|
+
- Updated dependencies [02fb4146]
|
|
50
|
+
- Updated dependencies [403f5169]
|
|
51
|
+
- Updated dependencies [e37ea5b2]
|
|
52
|
+
- Updated dependencies [a7f42f48]
|
|
53
|
+
- Updated dependencies [83059b93]
|
|
54
|
+
- @modern-js/core@1.4.4
|
|
55
|
+
- @modern-js/webpack@1.4.1
|
|
56
|
+
- @modern-js/utils@1.3.3
|
|
57
|
+
- @modern-js/new-action@1.3.3
|
|
58
|
+
- @modern-js/server@1.4.4
|
|
59
|
+
- @modern-js/types@1.3.4
|
|
60
|
+
- @modern-js/prod-server@1.0.1
|
|
61
|
+
|
|
62
|
+
## 1.4.2
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- fab92861: fix: @modern-js/core phantom dep
|
|
67
|
+
- Updated dependencies [deeaa602]
|
|
68
|
+
- Updated dependencies [54786e58]
|
|
69
|
+
- Updated dependencies [6668a1bf]
|
|
70
|
+
- Updated dependencies [fab92861]
|
|
71
|
+
- Updated dependencies [3da3bf48]
|
|
72
|
+
- @modern-js/plugin-analyze@1.3.3
|
|
73
|
+
- @modern-js/server@1.4.3
|
|
74
|
+
- @modern-js/types@1.3.3
|
|
75
|
+
- @modern-js/utils@1.3.2
|
|
76
|
+
- @modern-js/webpack@1.4.0
|
|
77
|
+
- @modern-js/core@1.4.3
|
|
78
|
+
- @modern-js/new-action@1.3.2
|
|
79
|
+
|
|
3
80
|
## 1.4.1
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
|
@@ -7,12 +7,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import { webpack } from 'webpack';
|
|
8
8
|
import { WebpackConfigTarget, getWebpackConfig } from '@modern-js/webpack';
|
|
9
9
|
import { useAppContext, useResolvedConfigContext, mountHook, ResolvedConfigContext, manager } from '@modern-js/core';
|
|
10
|
-
import {
|
|
11
|
-
import { generateRoutes } from "../utils/routes";
|
|
12
|
-
|
|
10
|
+
import { formatWebpackMessages, measureFileSizesBeforeBuild, printFileSizesAfterBuild, printBuildError, logger, isUseSSRBundle, emptyDir } from '@modern-js/utils';
|
|
11
|
+
import { generateRoutes } from "../utils/routes";
|
|
12
|
+
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
13
13
|
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
14
|
-
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
15
|
-
|
|
14
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; // eslint-disable-next-line max-statements
|
|
15
|
+
|
|
16
16
|
export const build = async options => {
|
|
17
17
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
18
18
|
const resolvedConfig = useResolvedConfigContext();
|
|
@@ -23,6 +23,10 @@ export const build = async options => {
|
|
|
23
23
|
/* eslint-enable react-hooks/rules-of-hooks */
|
|
24
24
|
|
|
25
25
|
if (!existSrc) {
|
|
26
|
+
const {
|
|
27
|
+
distDirectory
|
|
28
|
+
} = appContext;
|
|
29
|
+
await emptyDir(distDirectory);
|
|
26
30
|
await mountHook().beforeBuild({
|
|
27
31
|
webpackConfigs: []
|
|
28
32
|
});
|
|
@@ -53,7 +57,7 @@ export const build = async options => {
|
|
|
53
57
|
|
|
54
58
|
if (messages.errors.length === 0) {
|
|
55
59
|
logger.info(`File sizes after ${label} build:\n`);
|
|
56
|
-
printFileSizesAfterBuild(stats, previousFileSizes,
|
|
60
|
+
printFileSizesAfterBuild(stats, previousFileSizes, distDirectory, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
|
|
57
61
|
logger.log();
|
|
58
62
|
}
|
|
59
63
|
} // When using run or watch, call close and wait for it to finish before calling run or watch again.
|
|
@@ -87,9 +91,11 @@ export const build = async options => {
|
|
|
87
91
|
cliOptions: options
|
|
88
92
|
}));
|
|
89
93
|
});
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
const {
|
|
95
|
+
distDirectory
|
|
96
|
+
} = appContext;
|
|
97
|
+
const previousFileSizes = await measureFileSizesBeforeBuild(distDirectory);
|
|
98
|
+
await emptyDir(distDirectory);
|
|
93
99
|
const buildConfigs = [];
|
|
94
100
|
buildConfigs.push({
|
|
95
101
|
type: 'legacy',
|
|
@@ -4,7 +4,6 @@ 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 { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
|
8
7
|
import { fs, logger, HMR_SOCK_PATH, clearConsole, chalk, isSSR } from '@modern-js/utils';
|
|
9
8
|
import { useAppContext, useResolvedConfigContext, mountHook, AppContext } from '@modern-js/core';
|
|
10
9
|
import { createCompiler } from "../utils/createCompiler";
|
|
@@ -35,6 +34,10 @@ export const dev = async options => {
|
|
|
35
34
|
let compiler = null;
|
|
36
35
|
|
|
37
36
|
if (existSrc) {
|
|
37
|
+
const {
|
|
38
|
+
getWebpackConfig,
|
|
39
|
+
WebpackConfigTarget
|
|
40
|
+
} = await import('@modern-js/webpack');
|
|
38
41
|
const webpackConfigs = [isSSR(userConfig) && getWebpackConfig(WebpackConfigTarget.NODE), getWebpackConfig(WebpackConfigTarget.CLIENT)].filter(Boolean);
|
|
39
42
|
compiler = await createCompiler({
|
|
40
43
|
webpackConfigs,
|
|
@@ -47,6 +50,7 @@ export const dev = async options => {
|
|
|
47
50
|
const app = await createServer({
|
|
48
51
|
dev: _objectSpread(_objectSpread({}, {
|
|
49
52
|
client: {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
50
54
|
port: port.toString(),
|
|
51
55
|
overlay: false,
|
|
52
56
|
logging: 'none',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logger, chalk } from '@modern-js/utils';
|
|
2
2
|
import { useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
|
3
|
-
import server from '@modern-js/server';
|
|
3
|
+
import server from '@modern-js/prod-server';
|
|
4
4
|
import { printInstructions } from "../utils/printInstructions";
|
|
5
5
|
export const start = async () => {
|
|
6
6
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
@@ -23,9 +23,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
23
23
|
|
|
24
24
|
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
25
25
|
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
26
|
-
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
26
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; // eslint-disable-next-line max-statements
|
|
27
27
|
|
|
28
|
-
// eslint-disable-next-line max-statements
|
|
29
28
|
const build = async options => {
|
|
30
29
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
31
30
|
const resolvedConfig = (0, _core.useResolvedConfigContext)();
|
|
@@ -36,6 +35,10 @@ const build = async options => {
|
|
|
36
35
|
/* eslint-enable react-hooks/rules-of-hooks */
|
|
37
36
|
|
|
38
37
|
if (!existSrc) {
|
|
38
|
+
const {
|
|
39
|
+
distDirectory
|
|
40
|
+
} = appContext;
|
|
41
|
+
await (0, _utils.emptyDir)(distDirectory);
|
|
39
42
|
await (0, _core.mountHook)().beforeBuild({
|
|
40
43
|
webpackConfigs: []
|
|
41
44
|
});
|
|
@@ -68,7 +71,7 @@ const build = async options => {
|
|
|
68
71
|
if (messages.errors.length === 0) {
|
|
69
72
|
_utils.logger.info(`File sizes after ${label} build:\n`);
|
|
70
73
|
|
|
71
|
-
(0, _utils.printFileSizesAfterBuild)(stats, previousFileSizes,
|
|
74
|
+
(0, _utils.printFileSizesAfterBuild)(stats, previousFileSizes, distDirectory, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
|
|
72
75
|
|
|
73
76
|
_utils.logger.log();
|
|
74
77
|
}
|
|
@@ -104,11 +107,11 @@ const build = async options => {
|
|
|
104
107
|
}));
|
|
105
108
|
});
|
|
106
109
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
_utils.
|
|
111
|
-
|
|
110
|
+
const {
|
|
111
|
+
distDirectory
|
|
112
|
+
} = appContext;
|
|
113
|
+
const previousFileSizes = await (0, _utils.measureFileSizesBeforeBuild)(distDirectory);
|
|
114
|
+
await (0, _utils.emptyDir)(distDirectory);
|
|
112
115
|
const buildConfigs = [];
|
|
113
116
|
buildConfigs.push({
|
|
114
117
|
type: 'legacy',
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dev = void 0;
|
|
7
7
|
|
|
8
|
-
var _webpack = require("@modern-js/webpack");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@modern-js/utils");
|
|
11
9
|
|
|
12
10
|
var _core = require("@modern-js/core");
|
|
@@ -21,6 +19,10 @@ var _printInstructions = require("../utils/printInstructions");
|
|
|
21
19
|
|
|
22
20
|
var _getSpecifiedEntries = require("../utils/getSpecifiedEntries");
|
|
23
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
24
26
|
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; }
|
|
25
27
|
|
|
26
28
|
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; }
|
|
@@ -54,7 +56,11 @@ const dev = async options => {
|
|
|
54
56
|
let compiler = null;
|
|
55
57
|
|
|
56
58
|
if (existSrc) {
|
|
57
|
-
const
|
|
59
|
+
const {
|
|
60
|
+
getWebpackConfig,
|
|
61
|
+
WebpackConfigTarget
|
|
62
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require('@modern-js/webpack')));
|
|
63
|
+
const webpackConfigs = [(0, _utils.isSSR)(userConfig) && getWebpackConfig(WebpackConfigTarget.NODE), getWebpackConfig(WebpackConfigTarget.CLIENT)].filter(Boolean);
|
|
58
64
|
compiler = await (0, _createCompiler.createCompiler)({
|
|
59
65
|
webpackConfigs,
|
|
60
66
|
userConfig,
|
|
@@ -66,6 +72,7 @@ const dev = async options => {
|
|
|
66
72
|
const app = await (0, _createServer.createServer)({
|
|
67
73
|
dev: _objectSpread(_objectSpread({}, {
|
|
68
74
|
client: {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
69
76
|
port: port.toString(),
|
|
70
77
|
overlay: false,
|
|
71
78
|
logging: 'none',
|
|
@@ -9,7 +9,7 @@ var _utils = require("@modern-js/utils");
|
|
|
9
9
|
|
|
10
10
|
var _core = require("@modern-js/core");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _prodServer = _interopRequireDefault(require("@modern-js/prod-server"));
|
|
13
13
|
|
|
14
14
|
var _printInstructions = require("../utils/printInstructions");
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ const start = async () => {
|
|
|
28
28
|
|
|
29
29
|
_utils.logger.log(_utils.chalk.cyan(`Starting the modern server...`));
|
|
30
30
|
|
|
31
|
-
const app = await (0,
|
|
31
|
+
const app = await (0, _prodServer.default)({
|
|
32
32
|
pwd: appDirectory,
|
|
33
33
|
config: userConfig,
|
|
34
34
|
plugins: appContext.plugins.filter(p => p.server).map(p => p.server)
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export declare const build: (options?: CliOptions | undefined) => Promise<void>;
|
|
5
|
-
export {};
|
|
1
|
+
import type { BuildOptions } from '../utils/types';
|
|
2
|
+
export declare const build: (options?: BuildOptions | undefined) => Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import { defineConfig } from '@modern-js/core';
|
|
2
2
|
export { defineConfig };
|
|
3
3
|
|
|
4
|
-
declare const _default: import("@modern-js/core").AsyncPlugin<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
prepare: import("@modern-js/core").AsyncWorkflow<void, void>;
|
|
11
|
-
commands: import("@modern-js/core").AsyncWorkflow<{
|
|
12
|
-
program: import("commander").Command;
|
|
13
|
-
}, void>;
|
|
14
|
-
watchFiles: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
|
15
|
-
fileChange: import("@modern-js/core").AsyncWorkflow<{
|
|
16
|
-
filename: string;
|
|
17
|
-
eventType: "add" | "unlink" | "change";
|
|
18
|
-
}, void>;
|
|
19
|
-
beforeExit: import("@modern-js/core").AsyncWorkflow<void, void>;
|
|
20
|
-
beforeRestart: import("@modern-js/core").AsyncWorkflow<void, void>;
|
|
21
|
-
} & import("@modern-js/core").ClearDraftProgress<import("@modern-js/core").Hooks>>>>;
|
|
4
|
+
declare const _default: import("@modern-js/core").AsyncPlugin<import("@modern-js/core").CliHooks, {
|
|
5
|
+
setAppContext: (value: import("@modern-js/core").IAppContext) => void;
|
|
6
|
+
useAppContext: () => import("@modern-js/core").IAppContext;
|
|
7
|
+
useConfigContext: () => import("@modern-js/core/src/config").UserConfig;
|
|
8
|
+
useResolvedConfigContext: () => import("@modern-js/core").NormalizedConfig;
|
|
9
|
+
}>;
|
|
22
10
|
|
|
23
11
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Server,
|
|
1
|
+
import { Server, ModernDevServerOptions } from '@modern-js/server';
|
|
2
2
|
export declare const getServer: () => Server | null;
|
|
3
3
|
export declare const closeServer: () => Promise<void>;
|
|
4
|
-
export declare const createServer: (options:
|
|
4
|
+
export declare const createServer: (options: ModernDevServerOptions) => Promise<Server>;
|
package/lib/types.d.ts
CHANGED
|
@@ -56,6 +56,98 @@ declare module '*.svg' {
|
|
|
56
56
|
export default src;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
declare module '*.bmp?inline' {
|
|
60
|
+
const src: string;
|
|
61
|
+
export default src;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module '*.gif?inline' {
|
|
65
|
+
const src: string;
|
|
66
|
+
export default src;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare module '*.jpg?inline' {
|
|
70
|
+
const src: string;
|
|
71
|
+
export default src;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module '*.jpeg?inline' {
|
|
75
|
+
const src: string;
|
|
76
|
+
export default src;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare module '*.png?inline' {
|
|
80
|
+
const src: string;
|
|
81
|
+
export default src;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare module '*.ico?inline' {
|
|
85
|
+
const src: string;
|
|
86
|
+
export default src;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare module '*.webp?inline' {
|
|
90
|
+
const src: string;
|
|
91
|
+
export default src;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare module '*.svg?inline' {
|
|
95
|
+
import * as React from 'react';
|
|
96
|
+
|
|
97
|
+
export const ReactComponent: React.FunctionComponent<
|
|
98
|
+
React.SVGProps<SVGSVGElement>
|
|
99
|
+
>;
|
|
100
|
+
|
|
101
|
+
const src: string;
|
|
102
|
+
export default src;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare module '*.bmp?url' {
|
|
106
|
+
const src: string;
|
|
107
|
+
export default src;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare module '*.gif?url' {
|
|
111
|
+
const src: string;
|
|
112
|
+
export default src;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare module '*.jpg?url' {
|
|
116
|
+
const src: string;
|
|
117
|
+
export default src;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
declare module '*.jpeg?url' {
|
|
121
|
+
const src: string;
|
|
122
|
+
export default src;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
declare module '*.png?url' {
|
|
126
|
+
const src: string;
|
|
127
|
+
export default src;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare module '*.ico?url' {
|
|
131
|
+
const src: string;
|
|
132
|
+
export default src;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare module '*.webp?url' {
|
|
136
|
+
const src: string;
|
|
137
|
+
export default src;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare module '*.svg?url' {
|
|
141
|
+
import * as React from 'react';
|
|
142
|
+
|
|
143
|
+
export const ReactComponent: React.FunctionComponent<
|
|
144
|
+
React.SVGProps<SVGSVGElement>
|
|
145
|
+
>;
|
|
146
|
+
|
|
147
|
+
const src: string;
|
|
148
|
+
export default src;
|
|
149
|
+
}
|
|
150
|
+
|
|
59
151
|
declare module '*.css' {
|
|
60
152
|
const classes: { readonly [key: string]: string };
|
|
61
153
|
export default classes;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.4.
|
|
14
|
+
"version": "1.4.4",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -49,18 +49,19 @@
|
|
|
49
49
|
"modern": "./bin/modern.js"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@modern-js/core": "^1.5.0",
|
|
52
53
|
"@babel/runtime": "^7",
|
|
53
|
-
"@modern-js/
|
|
54
|
-
"@modern-js/types": "^1.3.1",
|
|
54
|
+
"@modern-js/types": "^1.3.5",
|
|
55
55
|
"@modern-js/i18n-cli-language-detector": "^1.2.1",
|
|
56
|
-
"@modern-js/new-action": "^1.3.
|
|
57
|
-
"@modern-js/plugin": "^1.
|
|
58
|
-
"@modern-js/plugin-analyze": "^1.3.
|
|
56
|
+
"@modern-js/new-action": "^1.3.3",
|
|
57
|
+
"@modern-js/plugin": "^1.3.0",
|
|
58
|
+
"@modern-js/plugin-analyze": "^1.3.3",
|
|
59
59
|
"@modern-js/plugin-fast-refresh": "^1.2.1",
|
|
60
60
|
"@modern-js/plugin-i18n": "^1.2.1",
|
|
61
|
-
"@modern-js/server": "^1.4.
|
|
62
|
-
"@modern-js/
|
|
63
|
-
"@modern-js/
|
|
61
|
+
"@modern-js/server": "^1.4.7",
|
|
62
|
+
"@modern-js/prod-server": "^1.0.4",
|
|
63
|
+
"@modern-js/utils": "^1.3.5",
|
|
64
|
+
"@modern-js/webpack": "^1.4.1",
|
|
64
65
|
"inquirer": "^8.2.0",
|
|
65
66
|
"webpack": "^5.54.0"
|
|
66
67
|
},
|
|
@@ -4,19 +4,23 @@ const mockBeforeBuild = jest.fn();
|
|
|
4
4
|
const mockAfterBuild = jest.fn();
|
|
5
5
|
const mockGenerateRoutes = jest.fn();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
// eslint-disable-next-line arrow-body-style
|
|
8
|
+
jest.mock('@modern-js/core', () => {
|
|
9
|
+
return {
|
|
10
|
+
__esModule: true,
|
|
11
|
+
mountHook() {
|
|
12
|
+
return {
|
|
13
|
+
beforeBuild: mockBeforeBuild,
|
|
14
|
+
afterBuild: mockAfterBuild,
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
useAppContext: jest.fn(() => ({
|
|
18
|
+
existSrc: false,
|
|
19
|
+
distDirectory: '',
|
|
20
|
+
})),
|
|
21
|
+
useResolvedConfigContext: jest.fn(),
|
|
22
|
+
};
|
|
23
|
+
});
|
|
20
24
|
|
|
21
25
|
jest.mock('../../src/utils/routes', () => ({
|
|
22
26
|
__esModule: true,
|