@modern-js/core 1.10.3 → 1.11.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,19 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f66fa0e98: feat: support tools.webpackChain config
8
+
9
+ ### Patch Changes
10
+
11
+ - 1dfe08fcd: feat(webpack): add CHAIN_ID constants for webpack chain
12
+ - Updated dependencies [54fa1dbd6]
13
+ - Updated dependencies [33de0f7ec]
14
+ - @modern-js/plugin@1.3.5
15
+ - @modern-js/utils@1.7.5
16
+
3
17
  ## 1.10.3
4
18
 
5
19
  ### Patch Changes
@@ -3,8 +3,9 @@ export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'mo
3
3
  alias: SourceConfig['alias'] | Array<SourceConfig['alias']>;
4
4
  moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
5
5
  }
6
- export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
6
+ export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'webpackChain' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
7
7
  webpack: ToolsConfig['webpack'] | Array<NonNullable<ToolsConfig['webpack']>>;
8
+ webpackChain: ToolsConfig['webpackChain'] | Array<NonNullable<ToolsConfig['webpackChain']>>;
8
9
  babel: ToolsConfig['babel'] | Array<NonNullable<ToolsConfig['babel']>>;
9
10
  postcss: ToolsConfig['postcss'] | Array<NonNullable<ToolsConfig['postcss']>>;
10
11
  styledComponents: ToolsConfig['styledComponents'] | Array<NonNullable<ToolsConfig['styledComponents']>>;
@@ -432,6 +432,9 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
432
432
  webpack: {
433
433
  typeof: string[];
434
434
  };
435
+ webpackChain: {
436
+ typeof: string[];
437
+ };
435
438
  babel: {
436
439
  typeof: string[];
437
440
  };
@@ -5,6 +5,9 @@ export declare const tools: {
5
5
  webpack: {
6
6
  typeof: string[];
7
7
  };
8
+ webpackChain: {
9
+ typeof: string[];
10
+ };
8
11
  babel: {
9
12
  typeof: string[];
10
13
  };
@@ -6,6 +6,7 @@ exports.tools = {
6
6
  additionalProperties: false,
7
7
  properties: {
8
8
  webpack: { typeof: ['object', 'function'] },
9
+ webpackChain: { typeof: ['function'] },
9
10
  babel: { typeof: ['object', 'function'] },
10
11
  postcss: { typeof: ['object', 'function'] },
11
12
  lodash: { typeof: ['object', 'function'] },
@@ -5,6 +5,7 @@ import type { MetaOptions } from '@modern-js/utils';
5
5
  import type { TransformOptions } from '@babel/core';
6
6
  import type webpack from 'webpack';
7
7
  import type { Configuration as WebpackConfiguration } from 'webpack';
8
+ import type { ChainIdentifier, WebpackChain } from '@modern-js/webpack';
8
9
  import type autoprefixer from 'autoprefixer';
9
10
  import type { BasePluginOptions, TerserOptions as RawTerserOptions } from 'terser-webpack-plugin';
10
11
  import type { PluginConfig } from '../../loadPlugins';
@@ -148,14 +149,26 @@ export declare type DevServerConfig = {
148
149
  };
149
150
  export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: {
150
151
  env: string;
152
+ name: string;
151
153
  webpack: typeof webpack;
154
+ /**
155
+ * @deprecated please use `tools.webpackChain` instead.
156
+ */
157
+ chain: WebpackChain;
152
158
  [key: string]: any;
153
159
  }) => WebpackConfiguration | void);
160
+ export declare type WebpackChainConfig = (chain: WebpackChain, utils: {
161
+ env: string;
162
+ name: string;
163
+ webpack: typeof webpack;
164
+ CHAIN_ID: ChainIdentifier;
165
+ }) => void;
154
166
  export declare type BabelConfig = TransformOptions | ((config: TransformOptions, utils?: any) => TransformOptions | void);
155
167
  export declare type AutoprefixerConfig = AutoprefixerOptions | ((config: AutoprefixerOptions) => AutoprefixerOptions | void);
156
168
  export declare type TerserConfig = TerserOptions | ((config: TerserOptions) => TerserOptions | void);
157
169
  export interface ToolsConfig {
158
170
  webpack?: WebpackConfig;
171
+ webpackChain?: WebpackChainConfig;
159
172
  babel?: BabelConfig;
160
173
  autoprefixer?: AutoprefixerConfig;
161
174
  postcss?: ConfigFunction;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.10.3",
14
+ "version": "1.11.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -41,12 +41,13 @@
41
41
  "bin": "./bin/modern-js.js",
42
42
  "dependencies": {
43
43
  "@modern-js/load-config": "^1.3.3",
44
- "@modern-js/plugin": "^1.3.4",
45
- "@modern-js/utils": "^1.7.4"
44
+ "@modern-js/plugin": "^1.3.5",
45
+ "@modern-js/utils": "^1.7.5"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@jest/types": "^27.0.6",
49
49
  "@modern-js/types": "1.5.3",
50
+ "@modern-js/webpack": "1.8.0",
50
51
  "@scripts/build": "0.0.0",
51
52
  "@scripts/jest-config": "0.0.0",
52
53
  "@types/babel__code-frame": "^7.0.3",