@modern-js/core 1.11.2 → 1.12.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,22 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8e1cedd8a: feat(webpack): support addIncludes and addExcludes in tools.tsLoader
8
+
9
+ ### Patch Changes
10
+
11
+ - 9377d2d9d: feat: support addPlugins util in tools.postcss
12
+ - b7a1cea52: feat: support utils in tools.babel
13
+ - 3dfee700c: feat: support addExcludes in tools.less and tools.sass
14
+ - Updated dependencies [9377d2d9d]
15
+ - Updated dependencies [8c9ad1749]
16
+ - Updated dependencies [1ac68424f]
17
+ - @modern-js/utils@1.7.7
18
+ - @modern-js/plugin@1.3.7
19
+
3
20
  ## 1.11.2
4
21
 
5
22
  ### Patch Changes
@@ -2,12 +2,13 @@
2
2
  import type { IncomingMessage, ServerResponse } from 'http';
3
3
  import type { NextFunction, BffProxyOptions } from '@modern-js/types';
4
4
  import type { MetaOptions, ChainIdentifier } from '@modern-js/utils';
5
- import type { TransformOptions } from '@babel/core';
5
+ import type { TransformOptions, PluginItem as BabelPlugin } from '@babel/core';
6
6
  import type webpack from 'webpack';
7
7
  import type { RuleSetRule, Configuration as WebpackConfiguration } from 'webpack';
8
8
  import type WebpackChain from '@modern-js/utils/webpack-chain';
9
9
  import type autoprefixer from 'autoprefixer';
10
10
  import type { BasePluginOptions, TerserOptions as RawTerserOptions } from 'terser-webpack-plugin';
11
+ import type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
11
12
  import type { PluginConfig } from '../../loadPlugins';
12
13
  import type { TestConfig, JestConfig } from './test';
13
14
  import type { SassConfig, SassLoaderOptions } from './sass';
@@ -16,6 +17,7 @@ import type { UnbundleConfig } from './unbundle';
16
17
  import type { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions } from './ssg';
17
18
  import type { ElectronConfig } from './electron';
18
19
  import type { PostCSSLoaderOptions } from './postcss';
20
+ import type { TsLoaderOptions } from './ts-loader';
19
21
  declare type AutoprefixerOptions = autoprefixer.Options;
20
22
  declare type TerserOptions = BasePluginOptions & RawTerserOptions;
21
23
  export type { TestConfig, JestConfig, UnbundleConfig, SassConfig, SassLoaderOptions, LessConfig, LessLoaderOptions, SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions, TransformOptions, AutoprefixerOptions, TerserOptions, };
@@ -150,8 +152,11 @@ export declare type DevServerConfig = {
150
152
  after?: RequestHandler[];
151
153
  [propsName: string]: any;
152
154
  };
153
- export declare type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions) => PostCSSLoaderOptions | void);
154
- export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: {
155
+ export declare type PostCSSConfigUtils = {
156
+ addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
157
+ };
158
+ export declare type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void);
159
+ export declare type WebpackConfigUtils = {
155
160
  env: string;
156
161
  name: string;
157
162
  webpack: typeof webpack;
@@ -163,14 +168,29 @@ export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConf
163
168
  * @deprecated please use `tools.webpackChain` instead.
164
169
  */
165
170
  chain: WebpackChain;
166
- }) => WebpackConfiguration | void);
167
- export declare type WebpackChainConfig = (chain: WebpackChain, utils: {
171
+ };
172
+ export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: WebpackConfigUtils) => WebpackConfiguration | void);
173
+ export declare type WebpackChainConfigUtils = {
168
174
  env: string;
169
175
  name: string;
170
176
  webpack: typeof webpack;
171
177
  CHAIN_ID: ChainIdentifier;
172
- }) => void;
173
- export declare type BabelConfig = TransformOptions | ((config: TransformOptions, utils?: any) => TransformOptions | void);
178
+ };
179
+ export declare type WebpackChainConfig = (chain: WebpackChain, utils: WebpackChainConfigUtils) => void;
180
+ export declare type TsLoaderConfigUtils = {
181
+ addIncludes: (includes: string | RegExp | (string | RegExp)[]) => void;
182
+ addExcludes: (excludes: string | RegExp | (string | RegExp)[]) => void;
183
+ };
184
+ export declare type TsLoaderConfig = TsLoaderOptions | ((config: TsLoaderOptions, utils: TsLoaderConfigUtils) => TsLoaderOptions | void);
185
+ export declare type BabelConfigUtils = {
186
+ addPlugins: (plugins: BabelPlugin[]) => void;
187
+ addPresets: (presets: BabelPlugin[]) => void;
188
+ addIncludes: (includes: string | RegExp | (string | RegExp)[]) => void;
189
+ addExcludes: (excludes: string | RegExp | (string | RegExp)[]) => void;
190
+ removePlugins: (plugins: string | string[]) => void;
191
+ removePresets: (presets: string | string[]) => void;
192
+ };
193
+ export declare type BabelConfig = TransformOptions | ((config: TransformOptions, utils: BabelConfigUtils) => TransformOptions | void);
174
194
  export declare type AutoprefixerConfig = AutoprefixerOptions | ((config: AutoprefixerOptions) => AutoprefixerOptions | void);
175
195
  export declare type TerserConfig = TerserOptions | ((config: TerserOptions) => TerserOptions | void);
176
196
  export interface ToolsConfig {
@@ -182,7 +202,7 @@ export interface ToolsConfig {
182
202
  styledComponents?: ConfigFunction;
183
203
  lodash?: ConfigFunction;
184
204
  devServer?: DevServerConfig;
185
- tsLoader?: ConfigFunction;
205
+ tsLoader?: TsLoaderConfig;
186
206
  terser?: TerserConfig;
187
207
  minifyCss?: ConfigFunction;
188
208
  esbuild?: Record<string, unknown>;
@@ -7,4 +7,6 @@ export declare type LessLoaderOptions = {
7
7
  webpackImporter?: boolean;
8
8
  implementation?: boolean;
9
9
  };
10
- export declare type LessConfig = LessLoaderOptions | ((options: LessLoaderOptions, utils?: any) => LessLoaderOptions | void);
10
+ export declare type LessConfig = LessLoaderOptions | ((options: LessLoaderOptions, utils: {
11
+ addExcludes: (excludes: RegExp | RegExp[]) => void;
12
+ }) => LessLoaderOptions | void);
@@ -5,4 +5,6 @@ export interface SassLoaderOptions {
5
5
  implementation?: string;
6
6
  additionalData?: string | ((content: string, filename: string) => string);
7
7
  }
8
- export declare type SassConfig = SassLoaderOptions | ((options: SassLoaderOptions, utils?: any) => SassLoaderOptions | void);
8
+ export declare type SassConfig = SassLoaderOptions | ((options: SassLoaderOptions, utils: {
9
+ addExcludes: (excludes: RegExp | RegExp[]) => void;
10
+ }) => SassLoaderOptions | void);
@@ -0,0 +1,23 @@
1
+ export declare type TsLoaderOptions = {
2
+ colors?: boolean;
3
+ silent?: boolean;
4
+ context?: string;
5
+ instance?: string;
6
+ logLevel?: string;
7
+ compiler?: string;
8
+ configFile?: string;
9
+ reportFiles?: string[];
10
+ transpileOnly?: boolean;
11
+ happyPackMode?: boolean;
12
+ errorFormatter?: (message: Record<string, unknown>, colors: boolean) => string;
13
+ logInfoToStdOut?: boolean;
14
+ compilerOptions?: Record<string, unknown>;
15
+ appendTsSuffixTo?: (RegExp | string)[];
16
+ appendTsxSuffixTo?: (RegExp | string)[];
17
+ projectReferences?: boolean;
18
+ ignoreDiagnostics?: number[];
19
+ allowTsInNodeModules?: boolean;
20
+ experimentalFileCaching?: boolean;
21
+ onlyCompileBundledFiles?: boolean;
22
+ useCaseSensitiveFileNames?: boolean;
23
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.11.2",
14
+ "version": "1.12.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@modern-js/load-config": "^1.3.4",
43
- "@modern-js/plugin": "^1.3.6",
44
- "@modern-js/utils": "^1.7.6"
43
+ "@modern-js/plugin": "^1.3.7",
44
+ "@modern-js/utils": "^1.7.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jest/types": "^27.0.6",
@@ -58,7 +58,7 @@
58
58
  "autoprefixer": "^10.3.1",
59
59
  "btsm": "2.2.2",
60
60
  "jest": "^27",
61
- "postcss": "^8",
61
+ "postcss": "^8.4.14",
62
62
  "sass": "^1.45.0",
63
63
  "electron-builder": "22.7.0",
64
64
  "terser-webpack-plugin": "^5.1.4",