@modern-js/core 1.22.0 → 1.22.1
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 type BuildConfig = {
|
|
3
|
+
export declare 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 type ElectronConfig = {
|
|
10
|
+
export declare 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
|
-
type AutoprefixerOptions = autoprefixer.Options;
|
|
21
|
-
type TerserOptions = BasePluginOptions & {
|
|
20
|
+
declare type AutoprefixerOptions = autoprefixer.Options;
|
|
21
|
+
declare 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 type DevProxyOptions = string | Record<string, string>;
|
|
123
|
+
export declare 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
|
-
type ConfigFunction = Record<string, unknown> | ((config: Record<string, unknown>, utils?: any) => Record<string, unknown> | void);
|
|
151
|
-
export type PostCSSConfigUtils = {
|
|
150
|
+
declare type ConfigFunction = Record<string, unknown> | ((config: Record<string, unknown>, utils?: any) => Record<string, unknown> | void);
|
|
151
|
+
export declare type PostCSSConfigUtils = {
|
|
152
152
|
addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
|
|
153
153
|
};
|
|
154
|
-
export type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void);
|
|
155
|
-
export type WebpackConfigUtils = {
|
|
154
|
+
export declare type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void);
|
|
155
|
+
export declare type WebpackConfigUtils = {
|
|
156
156
|
env: string;
|
|
157
157
|
name: string;
|
|
158
158
|
webpack: typeof webpack;
|
|
@@ -166,22 +166,22 @@ export type WebpackConfigUtils = {
|
|
|
166
166
|
*/
|
|
167
167
|
chain: WebpackChain;
|
|
168
168
|
};
|
|
169
|
-
export type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: WebpackConfigUtils) => WebpackConfiguration | void);
|
|
170
|
-
export type WebpackChainConfigUtils = {
|
|
169
|
+
export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: WebpackConfigUtils) => WebpackConfiguration | void);
|
|
170
|
+
export declare 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 type WebpackChainConfig = (chain: WebpackChain, utils: WebpackChainConfigUtils) => void;
|
|
178
|
-
export type TsLoaderConfigUtils = {
|
|
177
|
+
export declare type WebpackChainConfig = (chain: WebpackChain, utils: WebpackChainConfigUtils) => void;
|
|
178
|
+
export declare type TsLoaderConfigUtils = {
|
|
179
179
|
addIncludes: (includes: string | RegExp | (string | RegExp)[]) => void;
|
|
180
180
|
addExcludes: (excludes: string | RegExp | (string | RegExp)[]) => void;
|
|
181
181
|
};
|
|
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);
|
|
182
|
+
export declare type TsLoaderConfig = TsLoaderOptions | ((config: TsLoaderOptions, utils: TsLoaderConfigUtils) => TsLoaderOptions | void);
|
|
183
|
+
export declare type AutoprefixerConfig = AutoprefixerOptions | ((config: AutoprefixerOptions) => AutoprefixerOptions | void);
|
|
184
|
+
export declare 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 type ConfigParam = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Promise<UserConfig>);
|
|
264
|
+
export declare 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 type LessLoaderOptions = {
|
|
3
|
+
export declare 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 type LessConfig = LessLoaderOptions | ((options: LessLoaderOptions, utils: {
|
|
10
|
+
export declare 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 type PostCSSOptions = {
|
|
2
|
+
export declare type PostCSSOptions = {
|
|
3
3
|
to?: string;
|
|
4
4
|
from?: string;
|
|
5
5
|
map?: boolean | SourceMapOptions;
|
|
@@ -8,7 +8,7 @@ export type PostCSSOptions = {
|
|
|
8
8
|
plugins?: AcceptedPlugin[];
|
|
9
9
|
stringifier?: Stringifier | Syntax;
|
|
10
10
|
};
|
|
11
|
-
export type PostCSSLoaderOptions = {
|
|
11
|
+
export declare 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 type SassConfig = SassLoaderOptions | ((options: SassLoaderOptions, utils: {
|
|
8
|
+
export declare type SassConfig = SassLoaderOptions | ((options: SassLoaderOptions, utils: {
|
|
9
9
|
addExcludes: (excludes: RegExp | RegExp[]) => void;
|
|
10
10
|
}) => SassLoaderOptions | void);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type SSGRouteOptions = string | {
|
|
1
|
+
export declare 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 type SSGSingleEntryOptions = boolean | {
|
|
7
|
+
export declare type SSGSingleEntryOptions = boolean | {
|
|
8
8
|
preventDefault?: string[];
|
|
9
9
|
headers?: Record<string, any>;
|
|
10
10
|
routes?: SSGRouteOptions[];
|
|
11
11
|
};
|
|
12
|
-
export type SSGMultiEntryOptions = Record<string, SSGSingleEntryOptions>;
|
|
13
|
-
export type SSGConfig = boolean | SSGSingleEntryOptions | SSGMultiEntryOptions | ((entryName: string, payload: {
|
|
12
|
+
export declare type SSGMultiEntryOptions = Record<string, SSGSingleEntryOptions>;
|
|
13
|
+
export declare 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 type JestConfig = JestConfigTypes.InitialOptions;
|
|
2
|
+
export declare 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
|
-
type PluginItem = string | [string, any];
|
|
5
|
-
export type LoadedPlugin = {
|
|
4
|
+
declare type PluginItem = string | [string, any];
|
|
5
|
+
export declare type LoadedPlugin = {
|
|
6
6
|
cli?: CliPlugin;
|
|
7
7
|
server?: string;
|
|
8
8
|
serverPkg?: string;
|
|
9
9
|
};
|
|
10
|
-
export type TransformPlugin = (plugin: PluginConfig, resolvedConfig: UserConfig, pluginOptions?: any) => PluginConfig;
|
|
10
|
+
export declare type TransformPlugin = (plugin: PluginConfig, resolvedConfig: UserConfig, pluginOptions?: any) => PluginConfig;
|
|
11
11
|
/**
|
|
12
12
|
* @deprecated
|
|
13
13
|
* Using NewPluginConfig instead.
|
|
14
14
|
*/
|
|
15
|
-
type OldPluginConfig = Array<PluginItem | {
|
|
15
|
+
declare type OldPluginConfig = Array<PluginItem | {
|
|
16
16
|
cli?: PluginItem;
|
|
17
17
|
server?: PluginItem;
|
|
18
18
|
}>;
|
|
19
|
-
type NewPluginConfig = CliPlugin[] | {
|
|
19
|
+
declare type NewPluginConfig = CliPlugin[] | {
|
|
20
20
|
cli?: CliPlugin[];
|
|
21
21
|
/** Custom server plugin is not supported yet. */
|
|
22
22
|
server?: never;
|
|
23
23
|
};
|
|
24
|
-
export type PluginConfig = OldPluginConfig | NewPluginConfig;
|
|
24
|
+
export declare 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 type HooksRunner = ToRunners<{
|
|
7
|
+
export declare 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 type CliHooks = typeof baseHooks & Hooks;
|
|
44
|
+
export declare type CliHooks = typeof baseHooks & Hooks;
|
|
45
45
|
/** All hook callbacks of cli plugin. */
|
|
46
|
-
export type CliHookCallbacks = ToThreads<CliHooks>;
|
|
46
|
+
export declare 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 type CliPlugin = PluginOptions<CliHooks, AsyncSetup<CliHooks, typeof pluginAPI>>;
|
|
54
|
+
export declare 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 type PluginAPI = typeof pluginAPI & CommonAPI<CliHooks>;
|
|
12
|
+
export declare 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.22.
|
|
13
|
+
"version": "1.22.1",
|
|
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.
|
|
42
|
-
"@modern-js/plugin": "1.
|
|
43
|
-
"@modern-js/utils": "1.
|
|
41
|
+
"@modern-js/node-bundle-require": "1.22.1",
|
|
42
|
+
"@modern-js/plugin": "1.22.1",
|
|
43
|
+
"@modern-js/utils": "1.22.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@jest/types": "^27.
|
|
46
|
+
"@jest/types": "^27.0.6",
|
|
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.16",
|
|
49
|
+
"@types/jest": "^27",
|
|
50
50
|
"@types/less": "^3.0.3",
|
|
51
|
-
"@types/node": "^14
|
|
52
|
-
"autoprefixer": "^10.
|
|
51
|
+
"@types/node": "^14",
|
|
52
|
+
"autoprefixer": "^10.3.1",
|
|
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.
|
|
63
|
-
"@modern-js/types": "1.
|
|
64
|
-
"@scripts/build": "1.
|
|
65
|
-
"@scripts/jest-config": "1.
|
|
56
|
+
"jest": "^27",
|
|
57
|
+
"postcss": "^8.4.14",
|
|
58
|
+
"sass": "^1.45.0",
|
|
59
|
+
"terser-webpack-plugin": "^5.1.4",
|
|
60
|
+
"typescript": "^4",
|
|
61
|
+
"webpack": "^5.74.0",
|
|
62
|
+
"@modern-js/babel-preset-app": "1.22.1",
|
|
63
|
+
"@modern-js/types": "1.22.1",
|
|
64
|
+
"@scripts/build": "1.22.1",
|
|
65
|
+
"@scripts/jest-config": "1.22.1"
|
|
66
66
|
},
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"publishConfig": {
|