@rsbuild/core 1.2.15 → 1.2.17

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.
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
3
+ *
4
+ * Copyright (c) 2014-2017, Jon Schlinkert.
5
+ * Released under the MIT License.
6
+ */
7
+
8
+ /*!
9
+ * isobject <https://github.com/jonschlinkert/isobject>
10
+ *
11
+ * Copyright (c) 2014-2017, Jon Schlinkert.
12
+ * Released under the MIT License.
13
+ */
14
+
15
+ /*!
16
+ * shallow-clone <https://github.com/jonschlinkert/shallow-clone>
17
+ *
18
+ * Copyright (c) 2015-present, Jon Schlinkert.
19
+ * Released under the MIT License.
20
+ */
@@ -1,6 +1,5 @@
1
1
  import RspackChain from '../compiled/rspack-chain/index.js';
2
2
  import type { InternalContext, ModifyBundlerChainUtils } from './types';
3
- export declare function getBundlerChain(): RspackChain;
4
3
  export declare function modifyBundlerChain(context: InternalContext, utils: ModifyBundlerChainUtils): Promise<RspackChain>;
5
4
  export declare const CHAIN_ID: {
6
5
  /** Predefined rules */
@@ -1,4 +1,5 @@
1
1
  export declare function getAbsolutePath(base: string, filepath: string): string;
2
+ export declare function getRelativePath(base: string, filepath: string): string;
2
3
  export declare function getCommonParentPath(paths: string[]): string;
3
4
  export declare const getCompiledPath: (packageName: string) => string;
4
5
  /**
@@ -1,2 +1,2 @@
1
- export declare function convertLinksInHtml(text: string): string;
2
- export declare function genOverlayHTML(errors: string[]): string;
1
+ export declare function convertLinksInHtml(text: string, root?: string): string;
2
+ export declare function genOverlayHTML(errors: string[], root?: string): string;
@@ -25,13 +25,14 @@ export type ToolsHtmlPluginConfig = ConfigChainWithContext<HtmlRspackPlugin.Opti
25
25
  entryName: string;
26
26
  entryValue: (string | string[] | Rspack.EntryDescription)[];
27
27
  }>;
28
+ export type WebpackMerge = <Configuration extends object>(firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]) => Configuration;
28
29
  export type ModifyRspackConfigUtils = ModifyChainUtils & {
29
30
  addRules: (rules: RspackRule | RspackRule[]) => void;
30
31
  appendRules: (rules: RspackRule | RspackRule[]) => void;
31
32
  prependPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
32
33
  appendPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
33
34
  removePlugin: (pluginName: string) => void;
34
- mergeConfig: typeof import('../../compiled/webpack-merge/index.js').merge;
35
+ mergeConfig: WebpackMerge;
35
36
  rspack: typeof rspack;
36
37
  };
37
38
  export type ToolsRspackConfig = ConfigChainAsyncWithContext<Rspack.Configuration, ModifyRspackConfigUtils>;
@@ -457,7 +458,7 @@ export interface PerformanceConfig {
457
458
  /**
458
459
  * Configure the chunk splitting strategy.
459
460
  */
460
- chunkSplit?: RsbuildChunkSplit;
461
+ chunkSplit?: ChunkSplit;
461
462
  /**
462
463
  * Analyze the size of output files.
463
464
  */
@@ -497,7 +498,7 @@ export interface PerformanceConfig {
497
498
  }
498
499
  export interface NormalizedPerformanceConfig extends PerformanceConfig {
499
500
  printFileSize: PrintFileSizeOptions | boolean;
500
- chunkSplit: RsbuildChunkSplit;
501
+ chunkSplit: ChunkSplit;
501
502
  }
502
503
  export type SplitChunks = Configuration extends {
503
504
  optimization?: {
@@ -522,7 +523,7 @@ export interface SplitCustom extends BaseSplitRules {
522
523
  strategy: 'custom';
523
524
  splitChunks?: SplitChunks;
524
525
  }
525
- export type RsbuildChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
526
+ export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
526
527
  export type DistPathConfig = {
527
528
  /**
528
529
  * The root directory of all files.
@@ -111,12 +111,38 @@ export type ModifyRsbuildConfigFn = (config: RsbuildConfig, utils: ModifyRsbuild
111
111
  export type ModifyEnvironmentConfigFn = (config: MergedEnvironmentConfig, utils: ModifyEnvironmentConfigUtils) => MaybePromise<MergedEnvironmentConfig | void>;
112
112
  export type EnvironmentContext = {
113
113
  index: number;
114
+ /**
115
+ * The unique name of the current environment is used to distinguish and locate the
116
+ * environment, corresponds to the key in the `environments` configuration.
117
+ */
114
118
  name: string;
119
+ /**
120
+ * The entry object from the `source.entry` option.
121
+ */
115
122
  entry: RsbuildEntry;
123
+ /**
124
+ * The path information for all HTML assets.
125
+ * This value is an object, the key is the entry name and the value is the relative
126
+ * path of the HTML file in the dist directory.
127
+ */
116
128
  htmlPaths: Record<string, string>;
129
+ /**
130
+ * The absolute path of the output directory, corresponding to the `output.distPath.root`
131
+ * config of Rsbuild.
132
+ */
117
133
  distPath: string;
134
+ /**
135
+ * The browserslist configuration of the current environment.
136
+ */
118
137
  browserslist: string[];
138
+ /**
139
+ * The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json file
140
+ * does not exist in current project.
141
+ */
119
142
  tsconfigPath?: string;
143
+ /**
144
+ * The normalized Rsbuild config for the current environment.
145
+ */
120
146
  config: NormalizedEnvironmentConfig;
121
147
  };
122
148
  export type ModifyChainUtils = {
@@ -1,7 +1,7 @@
1
1
  import type { RuleSetRule, Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack';
2
2
  import type RspackChain from '../../compiled/rspack-chain/index.js';
3
3
  import type { ChainIdentifier } from '../configChain';
4
- import type { ModifyRspackConfigUtils, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
4
+ import type { ModifyRspackConfigUtils, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig, WebpackMerge } from './config';
5
5
  import type { RsbuildContext } from './context';
6
6
  import type { EnvironmentContext, ModifyBundlerChainFn, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './hooks';
7
7
  import type { RsbuildInstance, RsbuildTarget } from './rsbuild';
@@ -110,7 +110,7 @@ export type ModifyWebpackConfigUtils = ModifyWebpackChainUtils & {
110
110
  prependPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
111
111
  appendPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
112
112
  removePlugin: (pluginName: string) => void;
113
- mergeConfig: typeof import('../../compiled/webpack-merge/index.js').merge;
113
+ mergeConfig: WebpackMerge;
114
114
  };
115
115
  export type ModifyWebpackChainFn = (chain: RspackChain, utils: ModifyWebpackChainUtils) => Promise<void> | void;
116
116
  export type ModifyWebpackConfigFn = (config: WebpackConfig, utils: ModifyWebpackConfigUtils) => Promise<WebpackConfig | void> | WebpackConfig | void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -53,12 +53,12 @@
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@rslib/core": "0.5.2",
56
+ "@rslib/core": "0.5.3",
57
57
  "@types/connect": "3.4.38",
58
- "@types/node": "^22.13.8",
58
+ "@types/node": "^22.13.10",
59
59
  "@types/on-finished": "2.3.4",
60
60
  "@types/webpack-bundle-analyzer": "4.7.0",
61
- "@types/ws": "^8.5.14",
61
+ "@types/ws": "^8.18.0",
62
62
  "browserslist-load-config": "1.0.0",
63
63
  "cac": "^6.7.14",
64
64
  "chokidar": "^4.0.3",
@@ -1,31 +0,0 @@
1
- declare function mergeUnique(key: string, uniques: string[], getter: (a: object) => string): (a: [], b: [], k: string) => false | any[];
2
-
3
- type Key = string;
4
- type Customize = (a: any, b: any, key: Key) => any;
5
- interface ICustomizeOptions {
6
- customizeArray?: Customize;
7
- customizeObject?: Customize;
8
- }
9
- declare enum CustomizeRule {
10
- Match = "match",
11
- Merge = "merge",
12
- Append = "append",
13
- Prepend = "prepend",
14
- Replace = "replace"
15
- }
16
- type CustomizeRuleString = "match" | "merge" | "append" | "prepend" | "replace";
17
-
18
- declare function merge<Configuration extends object>(firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]): Configuration;
19
- declare function mergeWithCustomize<Configuration extends object>(options: ICustomizeOptions): (firstConfiguration: Configuration | Configuration[], ...configurations: Configuration[]) => Configuration;
20
- declare function customizeArray(rules: {
21
- [s: string]: CustomizeRule | CustomizeRuleString;
22
- }): (a: any, b: any, key: Key) => any;
23
- type Rules = {
24
- [s: string]: CustomizeRule | CustomizeRuleString | Rules;
25
- };
26
- declare function mergeWithRules(rules: Rules): (firstConfiguration: object | object[], ...configurations: object[]) => object;
27
- declare function customizeObject(rules: {
28
- [s: string]: CustomizeRule | CustomizeRuleString;
29
- }): (a: any, b: any, key: Key) => any;
30
-
31
- export { CustomizeRule, customizeArray, customizeObject, merge as default, merge, mergeWithCustomize, mergeWithRules, mergeUnique as unique };