@rsbuild/core 1.0.1-beta.13 → 1.0.1-beta.15
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/compiled/css-loader/index.js +20 -20
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +640 -90
- package/dist/index.js +636 -85
- package/dist-types/helpers/fs.d.ts +2 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/server/devServer.d.ts +8 -3
- package/dist-types/types/config/html.d.ts +44 -2
- package/dist-types/types/config/output.d.ts +5 -4
- package/dist-types/types/rsbuild.d.ts +18 -8
- package/package.json +3 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Rspack } from '../types';
|
|
1
2
|
export declare const isFileSync: (filePath: string) => boolean | undefined;
|
|
2
3
|
export declare function isEmptyDir(path: string): boolean;
|
|
3
4
|
/**
|
|
@@ -8,4 +9,5 @@ export declare function isEmptyDir(path: string): boolean;
|
|
|
8
9
|
export declare const findExists: (files: string[]) => string | false;
|
|
9
10
|
export declare function pathExists(path: string): Promise<boolean>;
|
|
10
11
|
export declare function isFileExists(file: string): Promise<boolean>;
|
|
12
|
+
export declare function fileExistsByCompilation(compilation: Rspack.Compilation, filePath: string): Promise<boolean>;
|
|
11
13
|
export declare function emptyDir(dir: string): Promise<void>;
|
|
@@ -19,7 +19,7 @@ export declare const removeTailingSlash: (s: string) => string;
|
|
|
19
19
|
export declare const addTrailingSlash: (s: string) => string;
|
|
20
20
|
export declare const formatPublicPath: (publicPath: string, withSlash?: boolean) => string;
|
|
21
21
|
export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: boolean) => string;
|
|
22
|
-
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler) => string;
|
|
22
|
+
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
23
23
|
export declare const canParse: (url: string) => boolean;
|
|
24
24
|
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
25
25
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): NonNullable<FilenameConfig['js']>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { logger } from './logger';
|
|
|
15
15
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
16
16
|
export { ensureAssetPrefix } from './helpers';
|
|
17
17
|
export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
|
|
18
|
-
export type { AliasStrategy, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, ClientConfig, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateCompilerOptions, CreateRsbuildOptions, ResolvedCreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlTagHandler, HtmlTagDescriptor, InspectConfigOptions, InspectConfigResult, LegalComments, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, 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, PreconnectOption, PrintUrls, PublicDir, PublicDirOptions, RequestHandler, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerAPIs, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
18
|
+
export type { AppIcon, AppIconItem, AliasStrategy, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, ClientConfig, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateCompilerOptions, CreateRsbuildOptions, ResolvedCreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlTagHandler, HtmlTagDescriptor, InspectConfigOptions, InspectConfigResult, LegalComments, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, 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, PreconnectOption, PrintUrls, PublicDir, PublicDirOptions, RequestHandler, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerAPIs, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
19
19
|
export type { ChainIdentifier } from './configChain';
|
|
20
20
|
export {
|
|
21
21
|
/**
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Server } from 'node:http';
|
|
2
|
+
import type { Http2SecureServer } from 'node:http2';
|
|
1
3
|
import type Connect from '../../compiled/connect';
|
|
2
4
|
import type { CreateDevMiddlewareReturns } from '../provider/createCompiler';
|
|
3
5
|
import type { CreateDevServerOptions, EnvironmentAPI, InternalContext, NormalizedConfig, StartDevServerOptions } from '../types';
|
|
4
|
-
|
|
6
|
+
type HTTPServer = Server | Http2SecureServer;
|
|
5
7
|
export type RsbuildDevServer = {
|
|
6
8
|
/**
|
|
7
9
|
* Use rsbuild inner server to listen
|
|
@@ -35,11 +37,13 @@ export type RsbuildDevServer = {
|
|
|
35
37
|
*/
|
|
36
38
|
afterListen: () => Promise<void>;
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
40
|
+
* Activate socket connection
|
|
39
41
|
*
|
|
40
42
|
* It will used when you use custom server
|
|
41
43
|
*/
|
|
42
|
-
|
|
44
|
+
connectWebSocket: (options: {
|
|
45
|
+
server: HTTPServer;
|
|
46
|
+
}) => void;
|
|
43
47
|
/**
|
|
44
48
|
* Close the Rsbuild server.
|
|
45
49
|
*/
|
|
@@ -48,3 +52,4 @@ export type RsbuildDevServer = {
|
|
|
48
52
|
export declare function createDevServer<Options extends {
|
|
49
53
|
context: InternalContext;
|
|
50
54
|
}>(options: Options, createDevMiddleware: (options: Options, compiler: StartDevServerOptions['compiler']) => Promise<CreateDevMiddlewareReturns>, config: NormalizedConfig, { compiler: customCompiler, getPortSilently, runCompile, }?: CreateDevServerOptions): Promise<RsbuildDevServer>;
|
|
55
|
+
export {};
|
|
@@ -40,6 +40,39 @@ export type HtmlTagDescriptor = HtmlTag | HtmlTagHandler;
|
|
|
40
40
|
type ChainedHtmlOption<O> = ConfigChainMergeContext<O, {
|
|
41
41
|
entryName: string;
|
|
42
42
|
}>;
|
|
43
|
+
export type AppIconItem = {
|
|
44
|
+
/**
|
|
45
|
+
* The path to the icon, can be a URL, an absolute file path,
|
|
46
|
+
* or a relative path to the project root.
|
|
47
|
+
*/
|
|
48
|
+
src: string;
|
|
49
|
+
/**
|
|
50
|
+
* The size of the icon.
|
|
51
|
+
*/
|
|
52
|
+
size: number;
|
|
53
|
+
/**
|
|
54
|
+
* Specifies the intended target for which the icon should be generated.
|
|
55
|
+
* - `apple-touch-icon` for iOS system.
|
|
56
|
+
* - `web-app-manifest` for web application manifest.
|
|
57
|
+
*/
|
|
58
|
+
target?: 'apple-touch-icon' | 'web-app-manifest';
|
|
59
|
+
};
|
|
60
|
+
export type AppIcon = {
|
|
61
|
+
/**
|
|
62
|
+
* The name of the application.
|
|
63
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/name
|
|
64
|
+
*/
|
|
65
|
+
name?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The list of icons.
|
|
68
|
+
*/
|
|
69
|
+
icons: AppIconItem[];
|
|
70
|
+
/**
|
|
71
|
+
* The filename of the manifest file.
|
|
72
|
+
* @default 'manifest.webmanifest'
|
|
73
|
+
*/
|
|
74
|
+
filename?: string;
|
|
75
|
+
};
|
|
43
76
|
export interface HtmlConfig {
|
|
44
77
|
/**
|
|
45
78
|
* Configure the `<meta>` tag of the HTML.
|
|
@@ -62,9 +95,18 @@ export interface HtmlConfig {
|
|
|
62
95
|
*/
|
|
63
96
|
favicon?: ChainedHtmlOption<string>;
|
|
64
97
|
/**
|
|
65
|
-
* Set the
|
|
98
|
+
* Set the web application icons to display when added to the home screen of a mobile device.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* appIcon: {
|
|
102
|
+
* name: 'My Website',
|
|
103
|
+
* icons: [
|
|
104
|
+
* { src: './icon-192.png', size: 192 },
|
|
105
|
+
* { src: './icon-512.png', size: 512 },
|
|
106
|
+
* ]
|
|
107
|
+
* }
|
|
66
108
|
*/
|
|
67
|
-
appIcon?:
|
|
109
|
+
appIcon?: AppIcon;
|
|
68
110
|
/**
|
|
69
111
|
* Set the id of root element.
|
|
70
112
|
*/
|
|
@@ -193,9 +193,9 @@ export interface OutputConfig {
|
|
|
193
193
|
*/
|
|
194
194
|
filename?: FilenameConfig;
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
196
|
+
* Specify the character encoding format for output files.
|
|
197
|
+
* Can be `ascii` or `utf8`.
|
|
198
|
+
* @default 'utf8'
|
|
199
199
|
*/
|
|
200
200
|
charset?: Charset;
|
|
201
201
|
/**
|
|
@@ -223,8 +223,9 @@ export interface OutputConfig {
|
|
|
223
223
|
legalComments?: LegalComments;
|
|
224
224
|
/**
|
|
225
225
|
* Whether to clean all files in the dist path before starting compilation.
|
|
226
|
+
* @default 'auto'
|
|
226
227
|
*/
|
|
227
|
-
cleanDistPath?: boolean;
|
|
228
|
+
cleanDistPath?: boolean | 'auto';
|
|
228
229
|
/**
|
|
229
230
|
* Allow to custom CSS Modules options.
|
|
230
231
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { EntryDescription } from '@rspack/core';
|
|
2
1
|
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
3
2
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
4
3
|
import type { StartServerResult } from '../server/helper';
|
|
@@ -61,17 +60,20 @@ export type CreateRsbuildOptions = {
|
|
|
61
60
|
environment?: string[];
|
|
62
61
|
};
|
|
63
62
|
export type ResolvedCreateRsbuildOptions = CreateRsbuildOptions & Required<Omit<CreateRsbuildOptions, 'environment'>>;
|
|
63
|
+
export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
|
|
64
|
+
export type StartDevServer = (options?: StartDevServerOptions) => Promise<StartServerResult>;
|
|
65
|
+
export type Build = (options?: BuildOptions) => Promise<void | {
|
|
66
|
+
close: () => Promise<void>;
|
|
67
|
+
}>;
|
|
64
68
|
export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = {
|
|
65
69
|
readonly bundler: Bundler;
|
|
66
70
|
createCompiler: CreateCompiler;
|
|
67
71
|
/**
|
|
68
|
-
* It is designed for
|
|
72
|
+
* It is designed for upper-level frameworks that require a custom server
|
|
69
73
|
*/
|
|
70
|
-
createDevServer:
|
|
71
|
-
startDevServer:
|
|
72
|
-
build:
|
|
73
|
-
close: () => Promise<void>;
|
|
74
|
-
}>;
|
|
74
|
+
createDevServer: CreateDevServer;
|
|
75
|
+
startDevServer: StartDevServer;
|
|
76
|
+
build: Build;
|
|
75
77
|
initConfigs: () => Promise<B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[]>;
|
|
76
78
|
inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult<B>>;
|
|
77
79
|
};
|
|
@@ -109,5 +111,13 @@ export type RsbuildInstance = {
|
|
|
109
111
|
onExit: RsbuildPluginAPI['onExit'];
|
|
110
112
|
};
|
|
111
113
|
export type RsbuildTarget = 'web' | 'node' | 'web-worker';
|
|
112
|
-
export type
|
|
114
|
+
export type RsbuildEntryDescription = Rspack.EntryDescription & {
|
|
115
|
+
/**
|
|
116
|
+
* Whether to generate an HTML file for the entry.
|
|
117
|
+
*
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
html?: boolean;
|
|
121
|
+
};
|
|
122
|
+
export type RsbuildEntry = Record<string, string | string[] | RsbuildEntryDescription>;
|
|
113
123
|
export type RsbuildMode = 'development' | 'production' | 'none';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.15",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.0.0-beta.
|
|
49
|
+
"@rspack/core": "1.0.0-beta.5",
|
|
50
50
|
"@rspack/lite-tapable": "1.0.0",
|
|
51
51
|
"@swc/helpers": "0.5.11",
|
|
52
52
|
"caniuse-lite": "^1.0.30001651",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"http-proxy-middleware": "^2.0.6",
|
|
75
75
|
"jiti": "^1.21.6",
|
|
76
76
|
"launch-editor-middleware": "^2.8.1",
|
|
77
|
+
"mrmime": "^2.0.0",
|
|
77
78
|
"on-finished": "2.4.1",
|
|
78
79
|
"open": "^8.4.0",
|
|
79
80
|
"picocolors": "^1.0.1",
|