@rsbuild/core 1.1.13 → 1.2.0-alpha.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.
@@ -1 +1 @@
1
- export declare const registerOverlay: (createFn: (err: string[]) => void, clearFn: () => void) => void;
1
+ export declare const registerOverlay: (createFn: (html: string) => void, clearFn: () => void) => void;
@@ -9,3 +9,5 @@ export declare const getCompiledPath: (packageName: string) => string;
9
9
  */
10
10
  export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
11
11
  export declare const pathnameParse: (publicPath: string) => string;
12
+ /** dedupe and remove nested paths */
13
+ export declare const dedupeNestedPaths: (paths: string[]) => string[];
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import { rspack } from '@rspack/core';
6
6
  import type * as Rspack from '@rspack/core';
7
- import * as __internalHelper from './internal';
8
7
  export { loadEnv } from './loadEnv';
9
8
  export { createRsbuild } from './createRsbuild';
10
9
  export { loadConfig, defineConfig, type LoadConfigOptions, type LoadConfigResult, } from './config';
@@ -18,9 +17,3 @@ export { ensureAssetPrefix } from './helpers';
18
17
  export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
19
18
  export type { AppIcon, AppIconItem, AliasStrategy, Build, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, Charset, ClientConfig, CliShortcut, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlFallback, HtmlTagHandler, HtmlTagDescriptor, HtmlTagContext, InspectConfigOptions, InspectConfigResult, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InternalContext, LegalComments, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, MergedEnvironmentConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSPlugin, PreviewOptions, PreconnectOption, ProxyConfig, ProxyOptions, PrintUrls, PublicDir, PublicDirOptions, ProgressBarConfig, RequestHandler, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, SriOptions, SriAlgorithm, ScriptInject, ScriptLoading, SecurityConfig, SourceMap, SetupMiddlewaresFn, SetupMiddlewaresServer, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
20
19
  export type { ChainIdentifier } from './configChain';
21
- export {
22
- /**
23
- * @private
24
- * TODO: remove this in Rspack v1.2.0
25
- */
26
- __internalHelper, };
@@ -1,3 +1,2 @@
1
1
  import type { RsbuildPlugin } from '../types';
2
- export declare const dedupeCleanPaths: (paths: string[]) => string[];
3
2
  export declare const pluginCleanOutput: () => RsbuildPlugin;
@@ -1,12 +1,5 @@
1
1
  /**
2
- * This module is modified based on `ansi-html-community`
3
- * https://github.com/mahdyar/ansi-html-community
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * https://github.com/mahdyar/ansi-html-community/blob/master/LICENSE
7
- */
8
- /**
9
- * Converts text with ANSI color codes to HTML markup.
2
+ * Converts text with ANSI color codes to HTML markup
10
3
  */
11
4
  export declare function ansiHTML(text: string): string;
12
5
  export default ansiHTML;
@@ -0,0 +1,2 @@
1
+ export declare function convertLinksInHtml(text: string): string;
2
+ export declare function genOverlayHTML(errors: string[]): string;
@@ -1,6 +1,11 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
2
  import type { Socket } from 'node:net';
3
3
  import type { DevConfig, Rspack } from '../types';
4
+ interface SocketMessage {
5
+ type: string;
6
+ compilationId?: string;
7
+ data?: Record<string, any> | string | boolean;
8
+ }
4
9
  export declare class SocketServer {
5
10
  private wsServer;
6
11
  private readonly sockets;
@@ -12,11 +17,7 @@ export declare class SocketServer {
12
17
  upgrade(req: IncomingMessage, sock: Socket, head: any): void;
13
18
  prepare(): Promise<void>;
14
19
  updateStats(stats: Rspack.Stats): void;
15
- sockWrite({ type, compilationId, data, }: {
16
- type: string;
17
- compilationId?: string;
18
- data?: Record<string, any> | string | boolean;
19
- }): void;
20
+ sockWrite({ type, compilationId, data }: SocketMessage): void;
20
21
  private singleWrite;
21
22
  close(): void;
22
23
  private onConnect;
@@ -24,3 +25,4 @@ export declare class SocketServer {
24
25
  private sendStats;
25
26
  private send;
26
27
  }
28
+ export {};
@@ -218,10 +218,13 @@ export type PublicDirOptions = {
218
218
  */
219
219
  name?: string;
220
220
  /**
221
- * Whether to copy files from the publicDir to the distDir on production build
222
- * @default true
221
+ * Whether to copy files from the public directory to the dist directory on production build.
222
+ * - `true`: copy files
223
+ * - `false`: do not copy files
224
+ * - `'auto'`: if `output.target` is not `'node'`, copy files, otherwise do not copy
225
+ * @default 'auto'
223
226
  */
224
- copyOnBuild?: boolean;
227
+ copyOnBuild?: boolean | 'auto';
225
228
  /**
226
229
  * whether to watch the public directory and reload the page when the files change
227
230
  * @default false
@@ -690,6 +693,43 @@ export type InlineChunkConfig = boolean | InlineChunkTest | {
690
693
  enable?: boolean | 'auto';
691
694
  test: InlineChunkTest;
692
695
  };
696
+ export type ManifestByEntry = {
697
+ initial?: {
698
+ js?: string[];
699
+ css?: string[];
700
+ };
701
+ async?: {
702
+ js?: string[];
703
+ css?: string[];
704
+ };
705
+ /** other assets (e.g. png、svg、source map) related to the current entry */
706
+ assets?: string[];
707
+ html?: string[];
708
+ };
709
+ export type ManifestData = {
710
+ entries: {
711
+ /** relate to Rsbuild's source.entry config */
712
+ [entryName: string]: ManifestByEntry;
713
+ };
714
+ /** Flatten all assets */
715
+ allFiles: string[];
716
+ };
717
+ export type ManifestObjectConfig = {
718
+ /**
719
+ * The filename or path of the manifest file.
720
+ * The manifest file will be emitted to the output directory.
721
+ * @default 'manifest.json'
722
+ */
723
+ filename?: string;
724
+ /**
725
+ * A custom function to generate the content of the manifest file.
726
+ */
727
+ generate?: (params: {
728
+ files: import('rspack-manifest-plugin').FileDescriptor[];
729
+ manifestData: ManifestData;
730
+ }) => Record<string, unknown>;
731
+ };
732
+ export type ManifestConfig = string | boolean | ManifestObjectConfig;
693
733
  export interface OutputConfig {
694
734
  /**
695
735
  * Specify build target to run in specified environment.
@@ -759,10 +799,14 @@ export interface OutputConfig {
759
799
  */
760
800
  minify?: Minify;
761
801
  /**
762
- * Whether to generate manifest file.
802
+ * Configure how to generate the manifest file.
803
+ * - `true`: Generate a manifest file named `manifest.json` in the output directory.
804
+ * - `false`: Do not generate the manifest file.
805
+ * - `string`: Generate a manifest file with the specified filename or path.
806
+ * - `object`: Generate a manifest file with the specified options.
763
807
  * @default false
764
808
  */
765
- manifest?: string | boolean;
809
+ manifest?: ManifestConfig;
766
810
  /**
767
811
  * Whether to generate source map files, and which format of source map to generate.
768
812
  *
@@ -834,6 +878,7 @@ export interface NormalizedOutputConfig extends OutputConfig {
834
878
  filenameHash: boolean | string;
835
879
  assetPrefix: string;
836
880
  dataUriLimit: number | NormalizedDataUriLimit;
881
+ manifest: ManifestConfig;
837
882
  minify: Minify;
838
883
  inlineScripts: InlineChunkConfig;
839
884
  inlineStyles: InlineChunkConfig;
@@ -86,6 +86,8 @@ export type CreateRsbuildOptions = {
86
86
  cwd?: string;
87
87
  /**
88
88
  * Only build specified environments.
89
+ * For example, passing `['web']` will only build the `web` environment.
90
+ * If not specified or passing an empty array, all environments will be built.
89
91
  */
90
92
  environment?: string[];
91
93
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.1.13",
3
+ "version": "1.2.0-alpha.0",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,28 +46,28 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.1.8",
49
+ "@rspack/core": "1.2.0-alpha.0",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.15",
52
52
  "core-js": "~3.39.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@rslib/core": "0.2.0",
55
+ "@rslib/core": "0.2.2",
56
56
  "@types/connect": "3.4.38",
57
57
  "@types/node": "^22.10.2",
58
58
  "@types/on-finished": "2.3.4",
59
59
  "@types/webpack-bundle-analyzer": "4.7.0",
60
60
  "@types/ws": "^8.5.13",
61
61
  "browserslist-load-config": "1.0.0",
62
+ "cac": "^6.7.14",
62
63
  "chokidar": "^4.0.3",
63
- "commander": "^12.1.0",
64
64
  "connect": "3.7.0",
65
65
  "connect-history-api-fallback": "^2.0.0",
66
66
  "cors": "^2.8.5",
67
67
  "css-loader": "7.1.2",
68
68
  "deepmerge": "^4.3.1",
69
69
  "dotenv": "16.4.7",
70
- "dotenv-expand": "11.0.7",
70
+ "dotenv-expand": "12.0.1",
71
71
  "html-rspack-plugin": "6.0.2",
72
72
  "http-proxy-middleware": "^2.0.6",
73
73
  "jiti": "^1.21.7",