@modern-js/core 1.21.5 → 1.22.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 +8 -0
- package/dist/config/types/electron.d.ts +2 -2
- package/dist/config/types/index.d.ts +15 -15
- package/dist/config/types/less.d.ts +2 -2
- package/dist/config/types/postcss.d.ts +2 -2
- package/dist/config/types/sass.d.ts +1 -1
- package/dist/config/types/ssg.d.ts +4 -4
- package/dist/config/types/test.d.ts +1 -1
- package/dist/config/types/ts-loader.d.ts +1 -1
- package/dist/config/types/unbundle.d.ts +1 -1
- package/dist/loadPlugins.d.ts +6 -6
- package/dist/manager.d.ts +4 -4
- package/dist/pluginAPI.d.ts +1 -1
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TransformOptions } from '@babel/core';
|
|
2
2
|
import { Configuration } from 'electron-builder';
|
|
3
|
-
export
|
|
3
|
+
export type BuildConfig = {
|
|
4
4
|
baseConfig: Configuration;
|
|
5
5
|
macConfig?: Configuration;
|
|
6
6
|
winConfig?: Configuration;
|
|
7
7
|
win64Config?: Configuration;
|
|
8
8
|
linuxConfig?: Configuration;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type ElectronConfig = {
|
|
11
11
|
builder?: BuildConfig;
|
|
12
12
|
babel?: TransformOptions | ((defaultBabelConfig: TransformOptions) => TransformOptions);
|
|
13
13
|
};
|
|
@@ -17,8 +17,8 @@ import type { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOp
|
|
|
17
17
|
import type { ElectronConfig } from './electron';
|
|
18
18
|
import type { PostCSSLoaderOptions } from './postcss';
|
|
19
19
|
import type { TsLoaderOptions } from './ts-loader';
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
type AutoprefixerOptions = autoprefixer.Options;
|
|
21
|
+
type TerserOptions = BasePluginOptions & {
|
|
22
22
|
terserOptions?: Partial<RawTerserOptions>;
|
|
23
23
|
};
|
|
24
24
|
export type { TestConfig, JestConfig, BabelConfig, UnbundleConfig, SassConfig, SassLoaderOptions, LessConfig, LessLoaderOptions, SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions, TransformOptions, AutoprefixerOptions, TerserOptions, };
|
|
@@ -120,7 +120,7 @@ export interface ServerConfig {
|
|
|
120
120
|
watchOptions?: WatchOptions;
|
|
121
121
|
compiler?: 'babel' | 'typescript';
|
|
122
122
|
}
|
|
123
|
-
export
|
|
123
|
+
export type DevProxyOptions = string | Record<string, string>;
|
|
124
124
|
export interface DevConfig {
|
|
125
125
|
assetPrefix?: string | boolean;
|
|
126
126
|
https?: DevServerHttpsOptions;
|
|
@@ -147,12 +147,12 @@ export interface DeployConfig {
|
|
|
147
147
|
domain?: string | Array<string>;
|
|
148
148
|
domainByEntries?: Record<string, string | Array<string>>;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
export
|
|
150
|
+
type ConfigFunction = Record<string, unknown> | ((config: Record<string, unknown>, utils?: any) => Record<string, unknown> | void);
|
|
151
|
+
export type PostCSSConfigUtils = {
|
|
152
152
|
addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
|
|
153
153
|
};
|
|
154
|
-
export
|
|
155
|
-
export
|
|
154
|
+
export type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void);
|
|
155
|
+
export type WebpackConfigUtils = {
|
|
156
156
|
env: string;
|
|
157
157
|
name: string;
|
|
158
158
|
webpack: typeof webpack;
|
|
@@ -166,22 +166,22 @@ export declare type WebpackConfigUtils = {
|
|
|
166
166
|
*/
|
|
167
167
|
chain: WebpackChain;
|
|
168
168
|
};
|
|
169
|
-
export
|
|
170
|
-
export
|
|
169
|
+
export type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: WebpackConfigUtils) => WebpackConfiguration | void);
|
|
170
|
+
export type WebpackChainConfigUtils = {
|
|
171
171
|
env: string;
|
|
172
172
|
name: string;
|
|
173
173
|
webpack: typeof webpack;
|
|
174
174
|
CHAIN_ID: ChainIdentifier;
|
|
175
175
|
HtmlWebpackPlugin: typeof import('html-webpack-plugin');
|
|
176
176
|
};
|
|
177
|
-
export
|
|
178
|
-
export
|
|
177
|
+
export type WebpackChainConfig = (chain: WebpackChain, utils: WebpackChainConfigUtils) => void;
|
|
178
|
+
export type TsLoaderConfigUtils = {
|
|
179
179
|
addIncludes: (includes: string | RegExp | (string | RegExp)[]) => void;
|
|
180
180
|
addExcludes: (excludes: string | RegExp | (string | RegExp)[]) => void;
|
|
181
181
|
};
|
|
182
|
-
export
|
|
183
|
-
export
|
|
184
|
-
export
|
|
182
|
+
export type TsLoaderConfig = TsLoaderOptions | ((config: TsLoaderOptions, utils: TsLoaderConfigUtils) => TsLoaderOptions | void);
|
|
183
|
+
export type AutoprefixerConfig = AutoprefixerOptions | ((config: AutoprefixerOptions) => AutoprefixerOptions | void);
|
|
184
|
+
export type TerserConfig = TerserOptions | ((config: TerserOptions) => TerserOptions | void);
|
|
185
185
|
export interface ToolsConfig {
|
|
186
186
|
webpack?: WebpackConfig;
|
|
187
187
|
webpackChain?: WebpackChainConfig;
|
|
@@ -261,7 +261,7 @@ export interface UserConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
electron?: ElectronConfig;
|
|
263
263
|
}
|
|
264
|
-
export
|
|
264
|
+
export type ConfigParam = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Promise<UserConfig>);
|
|
265
265
|
export interface LoadedConfig {
|
|
266
266
|
config: UserConfig;
|
|
267
267
|
filePath: string | false;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="less" />
|
|
2
2
|
import type { LoaderContext } from 'webpack';
|
|
3
|
-
export
|
|
3
|
+
export type LessLoaderOptions = {
|
|
4
4
|
lessOptions?: Less.Options;
|
|
5
5
|
additionalData?: string | ((content: string, loaderContext: LoaderContext<LessLoaderOptions>) => string);
|
|
6
6
|
sourceMap?: boolean;
|
|
7
7
|
webpackImporter?: boolean;
|
|
8
8
|
implementation?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type LessConfig = LessLoaderOptions | ((options: LessLoaderOptions, utils: {
|
|
11
11
|
addExcludes: (excludes: RegExp | RegExp[]) => void;
|
|
12
12
|
}) => LessLoaderOptions | void);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Syntax, Parser, Stringifier, AcceptedPlugin, SourceMapOptions } from 'postcss';
|
|
2
|
-
export
|
|
2
|
+
export type PostCSSOptions = {
|
|
3
3
|
to?: string;
|
|
4
4
|
from?: string;
|
|
5
5
|
map?: boolean | SourceMapOptions;
|
|
@@ -8,7 +8,7 @@ export declare type PostCSSOptions = {
|
|
|
8
8
|
plugins?: AcceptedPlugin[];
|
|
9
9
|
stringifier?: Stringifier | Syntax;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type PostCSSLoaderOptions = {
|
|
12
12
|
/**
|
|
13
13
|
* Enable PostCSS Parser support in CSS-in-JS. If you use JS styles the postcss-js parser, add the execute option.
|
|
14
14
|
*/
|
|
@@ -5,6 +5,6 @@ export interface SassLoaderOptions {
|
|
|
5
5
|
implementation?: string;
|
|
6
6
|
additionalData?: string | ((content: string, filename: string) => string);
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type SassConfig = SassLoaderOptions | ((options: SassLoaderOptions, utils: {
|
|
9
9
|
addExcludes: (excludes: RegExp | RegExp[]) => void;
|
|
10
10
|
}) => SassLoaderOptions | void);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type SSGRouteOptions = string | {
|
|
2
2
|
url: string;
|
|
3
3
|
output?: string;
|
|
4
4
|
params?: Record<string, any>[];
|
|
5
5
|
headers?: Record<string, any>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type SSGSingleEntryOptions = boolean | {
|
|
8
8
|
preventDefault?: string[];
|
|
9
9
|
headers?: Record<string, any>;
|
|
10
10
|
routes?: SSGRouteOptions[];
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export type SSGMultiEntryOptions = Record<string, SSGSingleEntryOptions>;
|
|
13
|
+
export type SSGConfig = boolean | SSGSingleEntryOptions | SSGMultiEntryOptions | ((entryName: string, payload: {
|
|
14
14
|
baseUrl?: string;
|
|
15
15
|
}) => SSGSingleEntryOptions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config as JestConfigTypes } from '@jest/types';
|
|
2
|
-
export
|
|
2
|
+
export type JestConfig = JestConfigTypes.InitialOptions;
|
|
3
3
|
export interface TestConfig {
|
|
4
4
|
/**
|
|
5
5
|
* Decide which transformer will be used to compile file
|
package/dist/loadPlugins.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { INTERNAL_PLUGINS } from '@modern-js/utils';
|
|
2
2
|
import type { UserConfig } from './config';
|
|
3
3
|
import { CliPlugin } from './manager';
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
type PluginItem = string | [string, any];
|
|
5
|
+
export type LoadedPlugin = {
|
|
6
6
|
cli?: CliPlugin;
|
|
7
7
|
server?: string;
|
|
8
8
|
serverPkg?: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type TransformPlugin = (plugin: PluginConfig, resolvedConfig: UserConfig, pluginOptions?: any) => PluginConfig;
|
|
11
11
|
/**
|
|
12
12
|
* @deprecated
|
|
13
13
|
* Using NewPluginConfig instead.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
type OldPluginConfig = Array<PluginItem | {
|
|
16
16
|
cli?: PluginItem;
|
|
17
17
|
server?: PluginItem;
|
|
18
18
|
}>;
|
|
19
|
-
|
|
19
|
+
type NewPluginConfig = CliPlugin[] | {
|
|
20
20
|
cli?: CliPlugin[];
|
|
21
21
|
/** Custom server plugin is not supported yet. */
|
|
22
22
|
server?: never;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type PluginConfig = OldPluginConfig | NewPluginConfig;
|
|
25
25
|
export declare function getAppPlugins(appDirectory: string, oldPluginConfig: OldPluginConfig, internalPlugins?: typeof INTERNAL_PLUGINS): (PluginItem | {
|
|
26
26
|
cli?: PluginItem | undefined;
|
|
27
27
|
server?: PluginItem | undefined;
|
package/dist/manager.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Command } from './utils/commander';
|
|
|
4
4
|
import type { NormalizedConfig } from './config/mergeConfig';
|
|
5
5
|
import type { UserConfig } from './config';
|
|
6
6
|
import { pluginAPI } from './pluginAPI';
|
|
7
|
-
export
|
|
7
|
+
export type HooksRunner = ToRunners<{
|
|
8
8
|
config: ParallelWorkflow<void, UserConfig>;
|
|
9
9
|
resolvedConfig: AsyncWaterfall<{
|
|
10
10
|
resolved: NormalizedConfig;
|
|
@@ -41,9 +41,9 @@ declare const baseHooks: {
|
|
|
41
41
|
beforeRestart: AsyncWorkflow<void, void>;
|
|
42
42
|
};
|
|
43
43
|
/** All hooks of cli plugin. */
|
|
44
|
-
export
|
|
44
|
+
export type CliHooks = typeof baseHooks & Hooks;
|
|
45
45
|
/** All hook callbacks of cli plugin. */
|
|
46
|
-
export
|
|
46
|
+
export type CliHookCallbacks = ToThreads<CliHooks>;
|
|
47
47
|
export declare const manager: import("@modern-js/plugin").AsyncManager<CliHooks, {
|
|
48
48
|
setAppContext: (value: import("@modern-js/types/cli").IAppContext) => void;
|
|
49
49
|
useAppContext: () => import("@modern-js/types/cli").IAppContext;
|
|
@@ -51,7 +51,7 @@ export declare const manager: import("@modern-js/plugin").AsyncManager<CliHooks,
|
|
|
51
51
|
useResolvedConfigContext: () => NormalizedConfig;
|
|
52
52
|
}>;
|
|
53
53
|
/** Plugin options of a cli plugin. */
|
|
54
|
-
export
|
|
54
|
+
export type CliPlugin = PluginOptions<CliHooks, AsyncSetup<CliHooks, typeof pluginAPI>>;
|
|
55
55
|
export declare const createPlugin: (setup?: AsyncSetup<CliHooks, {
|
|
56
56
|
setAppContext: (value: import("@modern-js/types/cli").IAppContext) => void;
|
|
57
57
|
useAppContext: () => import("@modern-js/types/cli").IAppContext;
|
package/dist/pluginAPI.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare const pluginAPI: {
|
|
|
9
9
|
};
|
|
10
10
|
export type { IAppContext } from '@modern-js/types';
|
|
11
11
|
/** all apis for cli plugin */
|
|
12
|
-
export
|
|
12
|
+
export type PluginAPI = typeof pluginAPI & CommonAPI<CliHooks>;
|
|
13
13
|
export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, };
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"modern",
|
|
11
11
|
"modern.js"
|
|
12
12
|
],
|
|
13
|
-
"version": "1.
|
|
13
|
+
"version": "1.22.0",
|
|
14
14
|
"jsnext:source": "./src/index.ts",
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
@@ -38,31 +38,31 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@modern-js/node-bundle-require": "1.21.
|
|
42
|
-
"@modern-js/plugin": "1.21.
|
|
43
|
-
"@modern-js/utils": "1.21.
|
|
41
|
+
"@modern-js/node-bundle-require": "1.21.6",
|
|
42
|
+
"@modern-js/plugin": "1.21.6",
|
|
43
|
+
"@modern-js/utils": "1.21.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@jest/types": "^27.
|
|
46
|
+
"@jest/types": "^27.5.1",
|
|
47
47
|
"@types/babel__code-frame": "^7.0.3",
|
|
48
|
-
"@types/babel__core": "^7.1.
|
|
49
|
-
"@types/jest": "^27",
|
|
48
|
+
"@types/babel__core": "^7.1.20",
|
|
49
|
+
"@types/jest": "^27.5.2",
|
|
50
50
|
"@types/less": "^3.0.3",
|
|
51
|
-
"@types/node": "^14",
|
|
52
|
-
"autoprefixer": "^10.
|
|
51
|
+
"@types/node": "^14.18.34",
|
|
52
|
+
"autoprefixer": "^10.4.13",
|
|
53
53
|
"btsm": "2.2.2",
|
|
54
54
|
"electron-builder": "22.7.0",
|
|
55
55
|
"html-webpack-plugin": "5.5.0",
|
|
56
|
-
"jest": "^27",
|
|
57
|
-
"postcss": "^8.4.
|
|
58
|
-
"sass": "^1.
|
|
59
|
-
"terser-webpack-plugin": "^5.
|
|
60
|
-
"typescript": "^4",
|
|
61
|
-
"webpack": "^5.
|
|
62
|
-
"@modern-js/babel-preset-app": "1.21.
|
|
63
|
-
"@modern-js/types": "1.21.
|
|
64
|
-
"@scripts/build": "1.21.
|
|
65
|
-
"@scripts/jest-config": "1.21.
|
|
56
|
+
"jest": "^27.5.1",
|
|
57
|
+
"postcss": "^8.4.20",
|
|
58
|
+
"sass": "^1.56.2",
|
|
59
|
+
"terser-webpack-plugin": "^5.3.6",
|
|
60
|
+
"typescript": "^4.9.4",
|
|
61
|
+
"webpack": "^5.75.0",
|
|
62
|
+
"@modern-js/babel-preset-app": "1.21.6",
|
|
63
|
+
"@modern-js/types": "1.21.6",
|
|
64
|
+
"@scripts/build": "1.21.6",
|
|
65
|
+
"@scripts/jest-config": "1.21.6"
|
|
66
66
|
},
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"publishConfig": {
|