@rsbuild/core 2.2.9 → 2.2.10
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/dist/1.js +84 -0
- package/dist/cssUrlLoader.mjs +3 -2
- package/dist/helpers/path.d.ts +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/m.js +93 -150
- package/dist/manifest-plugin.js +1 -1
- package/dist/server/assets-middleware/setupWriteToDisk.d.ts +16 -1
- package/dist/server/browserLogs.d.ts +5 -2
- package/dist/server/helper.d.ts +2 -2
- package/dist/trace-mapping.js +16 -14
- package/dist/types/config.d.ts +13 -1
- package/package.json +1 -1
package/dist/1.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isAbsolute, join, relative, sep, win32 } from "node:path";
|
|
2
|
+
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, JS_DIST_DIR = 'static/js', CSS_DIST_DIR = 'static/css', SVG_DIST_DIR = 'static/svg', FONT_DIST_DIR = 'static/font', WASM_DIST_DIR = 'static/wasm', IMAGE_DIST_DIR = 'static/image', MEDIA_DIST_DIR = 'static/media', ASSETS_DIST_DIR = 'static/assets', dirname = import.meta.dirname, LOADER_PATH = dirname, STATIC_PATH = join(dirname, '../static'), CLIENT_PATH = join(dirname, 'client'), COMPILED_PATH = join(dirname, '../compiled'), TS_CONFIG_FILE = 'tsconfig.json', HMR_SOCKET_PATH = '/rsbuild-hmr', RSBUILD_OUTPUTS_PATH = '.rsbuild', LOCALHOST = 'localhost', ALL_INTERFACES_IPV4 = '0.0.0.0', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
|
|
3
|
+
'chrome >= 107',
|
|
4
|
+
'edge >= 107',
|
|
5
|
+
'firefox >= 104',
|
|
6
|
+
'safari >= 16'
|
|
7
|
+
], DEFAULT_BROWSERSLIST = {
|
|
8
|
+
web: DEFAULT_WEB_BROWSERSLIST,
|
|
9
|
+
'web-worker': DEFAULT_WEB_BROWSERSLIST,
|
|
10
|
+
node: [
|
|
11
|
+
'node >= 20'
|
|
12
|
+
]
|
|
13
|
+
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, URL_QUERY_REGEX = /[?&]url(?:&|=|$)/, WORKER_QUERY_REGEX = /[?&]worker(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
14
|
+
'woff',
|
|
15
|
+
'woff2',
|
|
16
|
+
'eot',
|
|
17
|
+
'ttf',
|
|
18
|
+
'otf',
|
|
19
|
+
'ttc'
|
|
20
|
+
], ASSET_EXTENSIONS = [
|
|
21
|
+
'webmanifest',
|
|
22
|
+
'pdf',
|
|
23
|
+
'txt'
|
|
24
|
+
], IMAGE_EXTENSIONS = [
|
|
25
|
+
'png',
|
|
26
|
+
'jpg',
|
|
27
|
+
'jpeg',
|
|
28
|
+
'pjpeg',
|
|
29
|
+
'pjp',
|
|
30
|
+
'gif',
|
|
31
|
+
'bmp',
|
|
32
|
+
'webp',
|
|
33
|
+
'ico',
|
|
34
|
+
'apng',
|
|
35
|
+
'avif',
|
|
36
|
+
'tif',
|
|
37
|
+
'tiff',
|
|
38
|
+
'jfif',
|
|
39
|
+
'cur',
|
|
40
|
+
'jxl'
|
|
41
|
+
], VIDEO_EXTENSIONS = [
|
|
42
|
+
'mp4',
|
|
43
|
+
'webm',
|
|
44
|
+
'ogg',
|
|
45
|
+
'mov'
|
|
46
|
+
], AUDIO_EXTENSIONS = [
|
|
47
|
+
'mp3',
|
|
48
|
+
'wav',
|
|
49
|
+
'flac',
|
|
50
|
+
'aac',
|
|
51
|
+
'm4a',
|
|
52
|
+
'opus'
|
|
53
|
+
], TRACK_EXTENSIONS = [
|
|
54
|
+
'vtt'
|
|
55
|
+
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy', BROWSER_LOG_PREFIX = '[browser]';
|
|
56
|
+
function toRelativePath(base, filepath) {
|
|
57
|
+
let relativePath = relative(base, filepath);
|
|
58
|
+
return '' === relativePath ? `.${sep}` : relativePath.startsWith('.') ? relativePath : `.${sep}${relativePath}`;
|
|
59
|
+
}
|
|
60
|
+
function relativeWithin(parent, target) {
|
|
61
|
+
let relativePath = relative(parent, target);
|
|
62
|
+
if (!('..' === relativePath || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath))) return relativePath;
|
|
63
|
+
}
|
|
64
|
+
function getCommonParentPath(paths) {
|
|
65
|
+
let uniquePaths = [
|
|
66
|
+
...new Set(paths)
|
|
67
|
+
];
|
|
68
|
+
if (1 === uniquePaths.length) return uniquePaths[0];
|
|
69
|
+
let [first, ...rest] = uniquePaths.map((p)=>p.split(sep)), common = [];
|
|
70
|
+
for(let i = 0; i < first.length; i++){
|
|
71
|
+
let segment = first[i];
|
|
72
|
+
if (rest.every((p)=>p[i] === segment)) common.push(segment);
|
|
73
|
+
else break;
|
|
74
|
+
}
|
|
75
|
+
return common.join(sep);
|
|
76
|
+
}
|
|
77
|
+
let getCompiledPath = (packageName)=>join(COMPILED_PATH, packageName, 'index.js'), ensureAbsolutePath = (base, filePath)=>isAbsolute(filePath) ? filePath : join(base, filePath), getPathnameFromUrl = (url)=>{
|
|
78
|
+
try {
|
|
79
|
+
return url ? new URL(url, 'http://localhost').pathname : url;
|
|
80
|
+
} catch {
|
|
81
|
+
return url;
|
|
82
|
+
}
|
|
83
|
+
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.some((p)=>void 0 !== relativeWithin(p, curr)) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath;
|
|
84
|
+
export { ALL_INTERFACES_IPV4, ASSETS_DIST_DIR, ASSET_EXTENSIONS, AUDIO_EXTENSIONS, BROWSER_LOG_PREFIX, CLIENT_PATH, COMPILED_PATH, CSS_DIST_DIR, CSS_REGEX, DEFAULT_BROWSERSLIST, DEFAULT_STACK_TRACE, DEFAULT_WEB_BROWSERSLIST, FONT_DIST_DIR, FONT_EXTENSIONS, HMR_SOCKET_PATH, IMAGE_DIST_DIR, IMAGE_EXTENSIONS, INLINE_QUERY_REGEX, JS_DIST_DIR, JS_REGEX, LAZY_COMPILATION_IDENTIFIER, LOADER_PATH, LOCALHOST, MEDIA_DIST_DIR, NODE_MODULES_REGEX, PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, RAW_QUERY_REGEX, RSBUILD_OUTPUTS_PATH, SCRIPT_REGEX, STATIC_PATH, SVG_DIST_DIR, TRACK_EXTENSIONS, TS_CONFIG_FILE, URL_QUERY_REGEX, VIDEO_EXTENSIONS, WASM_DIST_DIR, WORKER_QUERY_REGEX, dedupeNestedPaths, ensureAbsolutePath, getCommonParentPath, getCompiledPath, getPathnameFromUrl, isDeno, isWindows, normalizeRuleConditionPath, relativeWithin, toPosixPath, toRelativePath };
|
package/dist/cssUrlLoader.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
+
import { relativeWithin } from "./1.js";
|
|
2
3
|
import { isCSSModules } from "./c.js";
|
|
3
4
|
let HASH_PLACEHOLDER_REGEX = /\[(?:[^:\]]+:)?(?:chunkhash|contenthash|hash|fullhash)(?::[^\]]+)?]/i, getRelativePath = (root, resourcePath)=>{
|
|
4
|
-
let relativePath =
|
|
5
|
-
if (relativePath
|
|
5
|
+
let relativePath = relativeWithin(root, resourcePath);
|
|
6
|
+
if (relativePath) return relativePath.replace(/\\/g, '/');
|
|
6
7
|
}, pitch = async function(remainingRequest) {
|
|
7
8
|
let root, resourcePath, nameSource, hash, options = this.getOptions();
|
|
8
9
|
if (isCSSModules(options.modules, this)) throw Error('[rsbuild:css] CSS Modules do not support the ?url query. Use ?inline to import the compiled CSS content as a string.');
|
package/dist/helpers/path.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Rspack } from '../types/index.js';
|
|
2
2
|
export declare function toRelativePath(base: string, filepath: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Returns `target` relative to `parent`, or `undefined` if it is outside `parent`.
|
|
5
|
+
* Returns `''` for the same directory.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* relativeWithin('/project', '/project/src'); // 'src'
|
|
9
|
+
* relativeWithin('/project', '/project'); // ''
|
|
10
|
+
* relativeWithin('/project', '/project-legacy'); // undefined
|
|
11
|
+
*/ export declare function relativeWithin(parent: string, target: string): string | undefined;
|
|
3
12
|
export declare function getCommonParentPath(paths: string[]): string;
|
|
4
13
|
export declare const getCompiledPath: (packageName: string) => string;
|
|
5
14
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export type { HotClient, HotOnConnect, RsbuildDevServer } from './server/devServ
|
|
|
25
25
|
export type { RsbuildServerBase, ServerStartResult, StartDevServerResult, StartPreviewServerResult } from './server/helper.js';
|
|
26
26
|
export type { RsbuildPreviewServer } from './server/previewServer.js';
|
|
27
27
|
// Types
|
|
28
|
-
export type { AliasStrategy, AppIcon, AppIconItem, AutoExternal, AutoExternalExclude, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, FilenameHash, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OnRestartFn, OutputConfig, OverlayOptions, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, ReadonlyRoutes, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RestartContext, RestartFn, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractOptions, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFileEvent, WatchFiles, WebSocketUrlResolver } from './types/index.js';
|
|
28
|
+
export type { AliasStrategy, AppIcon, AppIconItem, AutoExternal, AutoExternalExclude, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, FilenameHash, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OnRestartFn, OutputConfig, OverlayOptions, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, ReadonlyRoutes, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RestartContext, RestartFn, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMiddlewares, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildServerResponse, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractOptions, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFileEvent, WatchFiles, WebSocketUrlResolver } from './types/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME
|
|
1
|
+
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME } from "./1.js";
|
|
2
|
+
export { createLogger, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, version } from "./m.js";
|
package/dist/m.js
CHANGED
|
@@ -3,7 +3,7 @@ let runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
|
|
|
3
3
|
import { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject } from "./rslib-runtime.js";
|
|
4
4
|
import { rspack as core_rspack } from "@rspack/core";
|
|
5
5
|
import node_util, { promisify, stripVTControlCharacters } from "node:util";
|
|
6
|
-
import node_path, { dirname
|
|
6
|
+
import node_path, { dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
7
7
|
import { builtinModules, createRequire, createRequire as __rspack_createRequire } from "node:module";
|
|
8
8
|
import node_fs, { existsSync } from "node:fs";
|
|
9
9
|
import node_os, { constants } from "node:os";
|
|
@@ -13,6 +13,7 @@ import { isPromise, isRegExp } from "node:util/types";
|
|
|
13
13
|
import { readFile } from "node:fs/promises";
|
|
14
14
|
import node_zlib, { constants as external_node_zlib_constants } from "node:zlib";
|
|
15
15
|
import { once } from "node:events";
|
|
16
|
+
import { ALL_INTERFACES_IPV4, IMAGE_EXTENSIONS, ASSETS_DIST_DIR, FONT_DIST_DIR, AUDIO_EXTENSIONS, ensureAbsolutePath, NODE_MODULES_REGEX, FONT_EXTENSIONS, HMR_SOCKET_PATH, WASM_DIST_DIR, VIDEO_EXTENSIONS, BROWSER_LOG_PREFIX, toPosixPath, TRACK_EXTENSIONS, IMAGE_DIST_DIR, RSBUILD_OUTPUTS_PATH, DEFAULT_STACK_TRACE, LOADER_PATH, ASSET_EXTENSIONS, SVG_DIST_DIR, isWindows, COMPILED_PATH, WORKER_QUERY_REGEX, TS_CONFIG_FILE, dedupeNestedPaths, CSS_REGEX, relativeWithin, LAZY_COMPILATION_IDENTIFIER, DEFAULT_BROWSERSLIST, JS_REGEX, MEDIA_DIST_DIR, SCRIPT_REGEX, DEFAULT_WEB_BROWSERSLIST, getCompiledPath, normalizeRuleConditionPath, getPathnameFromUrl, toRelativePath, isDeno, CSS_DIST_DIR, INLINE_QUERY_REGEX, STATIC_PATH, RAW_QUERY_REGEX, PLUGIN_SWC_NAME, CLIENT_PATH, getCommonParentPath, LOCALHOST, JS_DIST_DIR, URL_QUERY_REGEX } from "./1.js";
|
|
16
17
|
import { cachedImport, getTinyglobby } from "./r.js";
|
|
17
18
|
var superClass, superClass1, __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
|
|
18
19
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
@@ -1033,62 +1034,7 @@ var Command = class {
|
|
|
1033
1034
|
arg.variadic ? actionArgs.push(args.slice(index)) : actionArgs.push(args[index]);
|
|
1034
1035
|
}), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
|
|
1035
1036
|
}
|
|
1036
|
-
};
|
|
1037
|
-
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirname = import.meta.dirname, STATIC_PATH = join(dirname, '../static'), CLIENT_PATH = join(dirname, 'client'), COMPILED_PATH = join(dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', LOCALHOST = 'localhost', ALL_INTERFACES_IPV4 = '0.0.0.0', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
|
|
1038
|
-
'chrome >= 107',
|
|
1039
|
-
'edge >= 107',
|
|
1040
|
-
'firefox >= 104',
|
|
1041
|
-
'safari >= 16'
|
|
1042
|
-
], DEFAULT_BROWSERSLIST = {
|
|
1043
|
-
web: DEFAULT_WEB_BROWSERSLIST,
|
|
1044
|
-
'web-worker': DEFAULT_WEB_BROWSERSLIST,
|
|
1045
|
-
node: [
|
|
1046
|
-
'node >= 20'
|
|
1047
|
-
]
|
|
1048
|
-
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, URL_QUERY_REGEX = /[?&]url(?:&|=|$)/, WORKER_QUERY_REGEX = /[?&]worker(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
1049
|
-
'woff',
|
|
1050
|
-
'woff2',
|
|
1051
|
-
'eot',
|
|
1052
|
-
'ttf',
|
|
1053
|
-
'otf',
|
|
1054
|
-
'ttc'
|
|
1055
|
-
], ASSET_EXTENSIONS = [
|
|
1056
|
-
'webmanifest',
|
|
1057
|
-
'pdf',
|
|
1058
|
-
'txt'
|
|
1059
|
-
], IMAGE_EXTENSIONS = [
|
|
1060
|
-
'png',
|
|
1061
|
-
'jpg',
|
|
1062
|
-
'jpeg',
|
|
1063
|
-
'pjpeg',
|
|
1064
|
-
'pjp',
|
|
1065
|
-
'gif',
|
|
1066
|
-
'bmp',
|
|
1067
|
-
'webp',
|
|
1068
|
-
'ico',
|
|
1069
|
-
'apng',
|
|
1070
|
-
'avif',
|
|
1071
|
-
'tif',
|
|
1072
|
-
'tiff',
|
|
1073
|
-
'jfif',
|
|
1074
|
-
'cur',
|
|
1075
|
-
'jxl'
|
|
1076
|
-
], VIDEO_EXTENSIONS = [
|
|
1077
|
-
'mp4',
|
|
1078
|
-
'webm',
|
|
1079
|
-
'ogg',
|
|
1080
|
-
'mov'
|
|
1081
|
-
], AUDIO_EXTENSIONS = [
|
|
1082
|
-
'mp3',
|
|
1083
|
-
'wav',
|
|
1084
|
-
'flac',
|
|
1085
|
-
'aac',
|
|
1086
|
-
'm4a',
|
|
1087
|
-
'opus'
|
|
1088
|
-
], TRACK_EXTENSIONS = [
|
|
1089
|
-
'vtt'
|
|
1090
|
-
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
|
|
1091
|
-
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
1037
|
+
}, __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
1092
1038
|
function dist_webpack_require_(moduleId) {
|
|
1093
1039
|
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1094
1040
|
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
@@ -2509,9 +2455,14 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWa
|
|
|
2509
2455
|
!compilerDone && (compilerDone = !0, doneCompilers++), compilerStats[compilerIndex] = stats;
|
|
2510
2456
|
let lastCompilerDone = doneCompilers === compilers.length;
|
|
2511
2457
|
await onEnvironmentDone(index, stats), lastCompilerDone && await onDone(new MultiStatsCtor(compilerStats));
|
|
2512
|
-
}), compiler.hooks.invalid.tap('rsbuild:done', ()=>{
|
|
2513
|
-
compilerDone && (compilerDone = !1, doneCompilers--);
|
|
2514
2458
|
});
|
|
2459
|
+
let resetDoneState = ()=>{
|
|
2460
|
+
compilerDone && (compilerDone = !1, doneCompilers--);
|
|
2461
|
+
};
|
|
2462
|
+
compiler.hooks.invalid.tap('rsbuild:done', resetDoneState), compiler.hooks.watchRun.tap({
|
|
2463
|
+
name: 'rsbuild:done',
|
|
2464
|
+
stage: -1 / 0
|
|
2465
|
+
}, resetDoneState);
|
|
2515
2466
|
}
|
|
2516
2467
|
} else compiler.hooks.done.tapPromise('rsbuild:done', async (stats)=>{
|
|
2517
2468
|
await onEnvironmentDone(0, stats), await onDone(stats);
|
|
@@ -2619,30 +2570,7 @@ function loadConfig(opts) {
|
|
|
2619
2570
|
return pickEnv(config, opts);
|
|
2620
2571
|
}
|
|
2621
2572
|
}
|
|
2622
|
-
|
|
2623
|
-
let relativePath = relative(base, filepath);
|
|
2624
|
-
return '' === relativePath ? `.${sep}` : relativePath.startsWith('.') ? relativePath : `.${sep}${relativePath}`;
|
|
2625
|
-
}
|
|
2626
|
-
function getCommonParentPath(paths) {
|
|
2627
|
-
let uniquePaths = [
|
|
2628
|
-
...new Set(paths)
|
|
2629
|
-
];
|
|
2630
|
-
if (1 === uniquePaths.length) return uniquePaths[0];
|
|
2631
|
-
let [first, ...rest] = uniquePaths.map((p)=>p.split(sep)), common = [];
|
|
2632
|
-
for(let i = 0; i < first.length; i++){
|
|
2633
|
-
let segment = first[i];
|
|
2634
|
-
if (rest.every((p)=>p[i] === segment)) common.push(segment);
|
|
2635
|
-
else break;
|
|
2636
|
-
}
|
|
2637
|
-
return common.join(sep);
|
|
2638
|
-
}
|
|
2639
|
-
let ensureAbsolutePath = (base, filePath)=>external_node_path_isAbsolute(filePath) ? filePath : join(base, filePath), getPathnameFromUrl = (url)=>{
|
|
2640
|
-
try {
|
|
2641
|
-
return url ? new URL(url, 'http://localhost').pathname : url;
|
|
2642
|
-
} catch {
|
|
2643
|
-
return url;
|
|
2644
|
-
}
|
|
2645
|
-
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.some((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath, isFileSync = (filePath)=>{
|
|
2573
|
+
let isFileSync = (filePath)=>{
|
|
2646
2574
|
try {
|
|
2647
2575
|
return node_fs.statSync(filePath, {
|
|
2648
2576
|
throwIfNoEntry: !1
|
|
@@ -2784,7 +2712,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2784
2712
|
writeToDisk: !1,
|
|
2785
2713
|
cliShortcuts: !1,
|
|
2786
2714
|
client: {
|
|
2787
|
-
path:
|
|
2715
|
+
path: HMR_SOCKET_PATH,
|
|
2788
2716
|
port: '',
|
|
2789
2717
|
host: '',
|
|
2790
2718
|
overlay: !0,
|
|
@@ -2821,7 +2749,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2821
2749
|
scriptLoading: 'defer',
|
|
2822
2750
|
implementation: 'js'
|
|
2823
2751
|
},
|
|
2824
|
-
resolve: (swcHelpersPath || (swcHelpersPath =
|
|
2752
|
+
resolve: (swcHelpersPath || (swcHelpersPath = dirname(vendors_require.resolve('@swc/helpers/package.json'))), {
|
|
2825
2753
|
alias: {
|
|
2826
2754
|
'@swc/helpers': swcHelpersPath
|
|
2827
2755
|
},
|
|
@@ -2847,14 +2775,14 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2847
2775
|
cleanDistPath: 'auto',
|
|
2848
2776
|
distPath: {
|
|
2849
2777
|
root: "dist",
|
|
2850
|
-
css:
|
|
2851
|
-
svg:
|
|
2852
|
-
font:
|
|
2778
|
+
css: CSS_DIST_DIR,
|
|
2779
|
+
svg: SVG_DIST_DIR,
|
|
2780
|
+
font: FONT_DIST_DIR,
|
|
2853
2781
|
html: "./",
|
|
2854
|
-
wasm:
|
|
2855
|
-
image:
|
|
2856
|
-
media:
|
|
2857
|
-
assets:
|
|
2782
|
+
wasm: WASM_DIST_DIR,
|
|
2783
|
+
image: IMAGE_DIST_DIR,
|
|
2784
|
+
media: MEDIA_DIST_DIR,
|
|
2785
|
+
assets: ASSETS_DIST_DIR,
|
|
2858
2786
|
favicon: "./"
|
|
2859
2787
|
},
|
|
2860
2788
|
assetPrefix: "/",
|
|
@@ -2930,7 +2858,7 @@ let withDefaultConfig = async (rootPath, userConfig)=>{
|
|
|
2930
2858
|
imports: !0,
|
|
2931
2859
|
entries: !1
|
|
2932
2860
|
}), !config.source.tsconfigPath) {
|
|
2933
|
-
let tsconfigPath = join(rootPath,
|
|
2861
|
+
let tsconfigPath = join(rootPath, TS_CONFIG_FILE);
|
|
2934
2862
|
await isFileExists(tsconfigPath) && (config.source.tsconfigPath = tsconfigPath);
|
|
2935
2863
|
}
|
|
2936
2864
|
return config;
|
|
@@ -3201,7 +3129,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
3201
3129
|
if (descriptor.targets && !descriptor.targets.includes(target) || descriptor.environments && !descriptor.environments.includes(environmentContext.name)) return;
|
|
3202
3130
|
let rule = chain.module.rule(id);
|
|
3203
3131
|
descriptor.test && rule.test(descriptor.test), descriptor.resourceQuery && rule.resourceQuery(descriptor.resourceQuery), descriptor.layer && rule.layer(descriptor.layer), descriptor.issuerLayer && rule.issuerLayer(descriptor.issuerLayer), descriptor.issuer && rule.issuer(descriptor.issuer), descriptor.with && rule.with(descriptor.with), descriptor.mimetype && rule.mimetype(descriptor.mimetype), descriptor.order && 'default' !== descriptor.order ? rule.enforce(descriptor.order) : descriptor.enforce && rule.enforce(descriptor.enforce);
|
|
3204
|
-
let loaderPath = join(
|
|
3132
|
+
let loaderPath = join(LOADER_PATH, descriptor.raw ? 'transformRawLoader.mjs' : 'transformLoader.mjs');
|
|
3205
3133
|
rule.use(id).loader(loaderPath).options({
|
|
3206
3134
|
id,
|
|
3207
3135
|
getEnvironment: ()=>environmentContext
|
|
@@ -3363,7 +3291,7 @@ function createPublicContext(context) {
|
|
|
3363
3291
|
async function createContext(options, userConfig, logger, loadConfigResult) {
|
|
3364
3292
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, hooks = initHooks();
|
|
3365
3293
|
return {
|
|
3366
|
-
version: "2.2.
|
|
3294
|
+
version: "2.2.10",
|
|
3367
3295
|
rootPath,
|
|
3368
3296
|
configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
|
|
3369
3297
|
configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
|
|
@@ -3902,7 +3830,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3902
3830
|
}, applyEnvironmentDefaultConfig = (config)=>{
|
|
3903
3831
|
config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = (defaultEntry || (defaultEntry = getDefaultEntry(rootPath)), defaultEntry));
|
|
3904
3832
|
let isServer = 'node' === config.output.target;
|
|
3905
|
-
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' :
|
|
3833
|
+
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : JS_DIST_DIR), void 0 === config.output.module && (config.output.module = isServer), void 0 === config.output.minify && (config.output.minify = !isServer), config;
|
|
3906
3834
|
};
|
|
3907
3835
|
if (environments && Object.keys(environments).length > 0) {
|
|
3908
3836
|
let resolvedEnvironments = Object.fromEntries(Object.entries(environments).filter(([name])=>isEnvironmentEnabled(name)).map(([name, config])=>[
|
|
@@ -4047,9 +3975,9 @@ async function createCompiler_createCompiler(options) {
|
|
|
4047
3975
|
if ('LazyCompilation' === name && 'string' == typeof log && log.startsWith(LAZY_COMPILATION_IDENTIFIER)) {
|
|
4048
3976
|
let resource = log.split(' ')[0];
|
|
4049
3977
|
if (!resource) return;
|
|
4050
|
-
let { rootPath } = context, absolutePath = resource.split('!').pop();
|
|
4051
|
-
if (absolutePath?.startsWith(
|
|
4052
|
-
let relativePath = absolutePath.
|
|
3978
|
+
let { rootPath } = context, rootPrefix = rootPath.endsWith(sep) ? rootPath : rootPath + sep, absolutePath = resource.split('!').pop();
|
|
3979
|
+
if (absolutePath?.startsWith(rootPrefix)) {
|
|
3980
|
+
let relativePath = absolutePath.slice(rootPrefix.length);
|
|
4053
3981
|
lazyModules.add(relativePath);
|
|
4054
3982
|
}
|
|
4055
3983
|
}
|
|
@@ -4079,8 +4007,9 @@ async function createCompiler_createCompiler(options) {
|
|
|
4079
4007
|
let digits = seconds >= 0.01 ? 2 : 3;
|
|
4080
4008
|
return format(seconds.toFixed(digits), 's');
|
|
4081
4009
|
}
|
|
4082
|
-
|
|
4083
|
-
|
|
4010
|
+
let roundedSeconds = Math.round(10 * seconds) / 10;
|
|
4011
|
+
if (roundedSeconds < 60) return format(roundedSeconds.toFixed(1), 's');
|
|
4012
|
+
let minutesLabel = format(Math.floor(roundedSeconds / 60).toFixed(0), 'm'), remainingSeconds = roundedSeconds % 60;
|
|
4084
4013
|
if (0 === remainingSeconds) return minutesLabel;
|
|
4085
4014
|
let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
|
|
4086
4015
|
return `${minutesLabel} ${secondsLabel}`;
|
|
@@ -4938,10 +4867,7 @@ async function getBuildDependencies(context, environmentContext, additionalDepen
|
|
|
4938
4867
|
tailwindConfig
|
|
4939
4868
|
]), additionalDependencies && (buildDependencies.additional = additionalDependencies), buildDependencies;
|
|
4940
4869
|
}
|
|
4941
|
-
let
|
|
4942
|
-
let parentDir = addTrailingSep(parent), childDir = addTrailingSep(child);
|
|
4943
|
-
return parentDir !== childDir && childDir.startsWith(parentDir);
|
|
4944
|
-
}, normalizeCleanDistPath = (userOptions)=>{
|
|
4870
|
+
let normalizeCleanDistPath = (userOptions)=>{
|
|
4945
4871
|
let defaultOptions = {
|
|
4946
4872
|
enable: 'auto'
|
|
4947
4873
|
};
|
|
@@ -5045,7 +4971,7 @@ let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
|
|
|
5045
4971
|
let extraPlugins = [], userOptions = await loadUserPostcssrc(root, postcssrcCache);
|
|
5046
4972
|
userOptions.plugins ||= [];
|
|
5047
4973
|
let defaultOptions = {
|
|
5048
|
-
implementation:
|
|
4974
|
+
implementation: getCompiledPath('postcss'),
|
|
5049
4975
|
postcssOptions: userOptions,
|
|
5050
4976
|
sourceMap: getCSSSourceMap(config)
|
|
5051
4977
|
}, finalOptions = await reduceConfigsWithContext({
|
|
@@ -6074,7 +6000,7 @@ function doesChunkBelongToHtml({ chunk, htmlPluginData }) {
|
|
|
6074
6000
|
let { options } = htmlPluginData.plugin;
|
|
6075
6001
|
return recursiveChunkEntryNames(chunk).some((chunkName)=>isChunksFiltered(chunkName, options?.chunks, options?.excludeChunks));
|
|
6076
6002
|
}
|
|
6077
|
-
let getManifestPlugin = cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/
|
|
6003
|
+
let getManifestPlugin = cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/index.js"))), isCSSPath = (filePath)=>filePath.endsWith('.css');
|
|
6078
6004
|
function normalizeManifestObjectConfig(manifest) {
|
|
6079
6005
|
let defaultOptions = {
|
|
6080
6006
|
prefix: !0,
|
|
@@ -6138,7 +6064,7 @@ async function applyAlias({ chain, config, rootPath, logger }) {
|
|
|
6138
6064
|
continue;
|
|
6139
6065
|
}
|
|
6140
6066
|
try {
|
|
6141
|
-
pkgPath =
|
|
6067
|
+
pkgPath = dirname(vendors_require.resolve(`${pkgName}/package.json`, {
|
|
6142
6068
|
paths: [
|
|
6143
6069
|
rootPath
|
|
6144
6070
|
]
|
|
@@ -6154,7 +6080,7 @@ async function applyAlias({ chain, config, rootPath, logger }) {
|
|
|
6154
6080
|
'node_modules',
|
|
6155
6081
|
...pkgName.split('/')
|
|
6156
6082
|
].join(sep);
|
|
6157
|
-
for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath =
|
|
6083
|
+
for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = dirname(pkgPath);
|
|
6158
6084
|
} catch {
|
|
6159
6085
|
logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is not resolved in the project, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
|
|
6160
6086
|
continue;
|
|
@@ -6882,8 +6808,9 @@ async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
|
6882
6808
|
function setupWriteToDisk(compilers, writeToDisk, logger) {
|
|
6883
6809
|
for (let compiler of compilers)compiler.hooks.emit.tap('DevMiddleware', ()=>{
|
|
6884
6810
|
compiler.__hasRsbuildAssetEmittedCallback || (compiler.hooks.assetEmitted.tapAsync('DevMiddleware', (_file, info, callback)=>{
|
|
6811
|
+
if (compiler.outputFileSystem === node_fs) return void callback();
|
|
6885
6812
|
let { targetPath, content, compilation } = info;
|
|
6886
|
-
if (!(
|
|
6813
|
+
if (!('function' != typeof writeToDisk || writeToDisk(targetPath, compilation.name))) return void callback();
|
|
6887
6814
|
let dir = node_path.dirname(targetPath), name = compiler.options.name ? `Child "${compiler.options.name}": ` : '';
|
|
6888
6815
|
node_fs.mkdir(dir, {
|
|
6889
6816
|
recursive: !0
|
|
@@ -7093,15 +7020,17 @@ function parseNode(line) {
|
|
|
7093
7020
|
column: parts[4] ? +parts[4] : null
|
|
7094
7021
|
} : null;
|
|
7095
7022
|
}
|
|
7096
|
-
let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.trace_mapping_namespaceObject)), isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), isRspackRuntimeStack = (value)=>!!value && (value.includes('__webpack_require__') || value.startsWith('webpack/runtime/')), parseFrame = async (frame, fs, context,
|
|
7097
|
-
let { file, column, lineNumber } = frame,
|
|
7098
|
-
|
|
7099
|
-
let
|
|
7023
|
+
let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.trace_mapping_namespaceObject)), isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), isRspackRuntimeStack = (value)=>!!value && (value.includes('__webpack_require__') || value.startsWith('webpack/runtime/')), parseFrame = async (frame, fs, context, cache)=>{
|
|
7024
|
+
let { file, column, lineNumber } = frame, sourceMapUrl = `${file}.map`, sourceMapPathPromise = cache.sourceMapPaths.get(sourceMapUrl);
|
|
7025
|
+
sourceMapPathPromise || (sourceMapPathPromise = getFileFromUrl(sourceMapUrl, fs, context).then((info)=>!info || 'errorCode' in info ? void 0 : info.filename), cache.sourceMapPaths.set(sourceMapUrl, sourceMapPathPromise));
|
|
7026
|
+
let sourceMapPath = await sourceMapPathPromise;
|
|
7027
|
+
if (!sourceMapPath) return;
|
|
7028
|
+
let { TraceMap, originalPositionFor } = await getTraceMapping();
|
|
7100
7029
|
try {
|
|
7101
|
-
let tracer =
|
|
7030
|
+
let tracer = cache.traceMaps.get(sourceMapPath);
|
|
7102
7031
|
if (!tracer) {
|
|
7103
7032
|
let sourceMap = await readFileAsync(fs, sourceMapPath);
|
|
7104
|
-
tracer = new TraceMap(sourceMap.toString()),
|
|
7033
|
+
tracer = new TraceMap(sourceMap.toString()), cache.traceMaps.set(sourceMapPath, tracer);
|
|
7105
7034
|
}
|
|
7106
7035
|
let originalPosition = originalPositionFor(tracer, {
|
|
7107
7036
|
line: lineNumber ?? 0,
|
|
@@ -7114,10 +7043,10 @@ let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.
|
|
|
7114
7043
|
} catch (error) {
|
|
7115
7044
|
error instanceof Error && context.logger.debug('failed to map source map position:', error);
|
|
7116
7045
|
}
|
|
7117
|
-
}, resolveOriginalLocation = async (stackFrames, fs, context,
|
|
7046
|
+
}, resolveOriginalLocation = async (stackFrames, fs, context, cache)=>{
|
|
7118
7047
|
let frame = stackFrames.find((frame)=>null !== frame.file && null !== frame.column && null !== frame.lineNumber && SCRIPT_REGEX.test(frame.file));
|
|
7119
7048
|
if (!frame) return;
|
|
7120
|
-
let parsedFrame = await parseFrame(frame, fs, context,
|
|
7049
|
+
let parsedFrame = await parseFrame(frame, fs, context, cache);
|
|
7121
7050
|
if (!parsedFrame) return;
|
|
7122
7051
|
let { sourceMapPath, originalPosition } = parsedFrame;
|
|
7123
7052
|
return {
|
|
@@ -7136,10 +7065,10 @@ let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.
|
|
|
7136
7065
|
}, formatFrameLocation = (frame)=>{
|
|
7137
7066
|
let { file, lineNumber, column } = frame;
|
|
7138
7067
|
if (file) return null !== lineNumber ? null !== column ? `${file}:${lineNumber}:${column}` : `${file}:${lineNumber}` : file;
|
|
7139
|
-
}, formatFullStack = async (stackFrames, context, fs,
|
|
7068
|
+
}, formatFullStack = async (stackFrames, context, fs, cache)=>{
|
|
7140
7069
|
let formattedFrames = [];
|
|
7141
7070
|
for (let frame of stackFrames){
|
|
7142
|
-
let location, parsedFrame = await parseFrame(frame, fs, context,
|
|
7071
|
+
let location, parsedFrame = await parseFrame(frame, fs, context, cache), { methodName } = frame, parts = [];
|
|
7143
7072
|
isValidMethodName(methodName) && parts.push(methodName);
|
|
7144
7073
|
let parsed = !1;
|
|
7145
7074
|
if (parsedFrame) {
|
|
@@ -7162,13 +7091,13 @@ let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.
|
|
|
7162
7091
|
}
|
|
7163
7092
|
let shouldFilterRspackRuntime = formattedFrames.some((frame)=>!frame.isRspackRuntime && frame.hasLocation);
|
|
7164
7093
|
return formattedFrames.filter((frame)=>!(shouldFilterRspackRuntime && frame.isRspackRuntime)).map((frame)=>frame.text).join('');
|
|
7165
|
-
}, formatBrowserErrorLog = async (message, context, fs, stackTrace, stackFrames,
|
|
7094
|
+
}, formatBrowserErrorLog = async (message, context, fs, stackTrace, stackFrames, cache)=>{
|
|
7166
7095
|
var log;
|
|
7167
7096
|
let log1 = color.red(message);
|
|
7168
7097
|
if (stackFrames?.length) switch(stackTrace){
|
|
7169
7098
|
case 'summary':
|
|
7170
7099
|
{
|
|
7171
|
-
let resolved = await resolveOriginalLocation(stackFrames, fs, context,
|
|
7100
|
+
let resolved = await resolveOriginalLocation(stackFrames, fs, context, cache);
|
|
7172
7101
|
if (!resolved) break;
|
|
7173
7102
|
let { frame, location } = resolved, { methodName } = frame, suffix = '';
|
|
7174
7103
|
isValidMethodName(methodName) && (suffix += ` at ${methodName}`), location && (suffix += ` (${location})`), log1 += suffix ? color.dim(suffix) : '';
|
|
@@ -7176,7 +7105,7 @@ let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.
|
|
|
7176
7105
|
}
|
|
7177
7106
|
case 'full':
|
|
7178
7107
|
{
|
|
7179
|
-
let fullStack = await formatFullStack(stackFrames, context, fs,
|
|
7108
|
+
let fullStack = await formatFullStack(stackFrames, context, fs, cache);
|
|
7180
7109
|
fullStack && (log1 += fullStack);
|
|
7181
7110
|
}
|
|
7182
7111
|
}
|
|
@@ -7356,8 +7285,11 @@ class SocketServer {
|
|
|
7356
7285
|
if (!environment) return;
|
|
7357
7286
|
let { browserLogs, client } = environment.config.dev;
|
|
7358
7287
|
if ('client-error' === payload.type && !context.buildState.hasErrors && browserLogs) {
|
|
7359
|
-
let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null,
|
|
7360
|
-
|
|
7288
|
+
let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null, cache = {
|
|
7289
|
+
sourceMapPaths: new Map(),
|
|
7290
|
+
traceMaps: new Map()
|
|
7291
|
+
}, log = await formatBrowserErrorLog(payload.message, context, outputFs, stackTrace, stackFrames, cache);
|
|
7292
|
+
if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan(BROWSER_LOG_PREFIX)} ${log}`)), ((overlay, payload)=>{
|
|
7361
7293
|
if (!isRuntimeOverlayEnabled(overlay)) return !1;
|
|
7362
7294
|
if ('object' == typeof overlay && 'function' == typeof overlay.runtime) {
|
|
7363
7295
|
let error;
|
|
@@ -7365,7 +7297,7 @@ class SocketServer {
|
|
|
7365
7297
|
}
|
|
7366
7298
|
return !0;
|
|
7367
7299
|
})(client.overlay, payload)) {
|
|
7368
|
-
let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames,
|
|
7300
|
+
let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames, cache);
|
|
7369
7301
|
this.sendMessage({
|
|
7370
7302
|
type: 'resolved-client-error',
|
|
7371
7303
|
data: {
|
|
@@ -7557,7 +7489,11 @@ function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_B
|
|
|
7557
7489
|
if (filter && !filter(req, res)) return void next();
|
|
7558
7490
|
let accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
7559
7491
|
if ('HEAD' === req.method || !encoding) return void next();
|
|
7560
|
-
let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = []
|
|
7492
|
+
let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = [];
|
|
7493
|
+
res.flush = ()=>{
|
|
7494
|
+
gzip?.flush(node_zlib.constants.Z_SYNC_FLUSH);
|
|
7495
|
+
};
|
|
7496
|
+
let start = ()=>{
|
|
7561
7497
|
if (started) return;
|
|
7562
7498
|
if (started = !0, ((res)=>{
|
|
7563
7499
|
if (res.getHeader('Content-Encoding')) return !1;
|
|
@@ -7867,7 +7803,10 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
7867
7803
|
environments: devServer.environments,
|
|
7868
7804
|
logger
|
|
7869
7805
|
})), buildManager && (middlewares.use(buildManager.assetsMiddleware), upgradeEvents.push(buildManager.socketServer.upgrade), middlewares.use(function hotUpdateJsonFallbackMiddleware(req, res, next) {
|
|
7870
|
-
|
|
7806
|
+
let url = req.url;
|
|
7807
|
+
if (!url || 'OPTIONS' === req.method) return void next();
|
|
7808
|
+
let queryIndex = url.indexOf('?'), end = -1 === queryIndex ? url.length : queryIndex;
|
|
7809
|
+
url.endsWith('.hot-update.json', end) || url.endsWith('.hot-update.json.mjs', end) ? notFoundMiddleware(req, res, next) : next();
|
|
7871
7810
|
})), buildManager && middlewares.use(getHtmlCompletionMiddleware({
|
|
7872
7811
|
assetsMiddleware: buildManager.assetsMiddleware,
|
|
7873
7812
|
distPaths: [
|
|
@@ -8065,7 +8004,7 @@ class CommonJsRunner extends BasicRunner {
|
|
|
8065
8004
|
let dynamicImport = cachedDynamicImport ??= Function('specifier', 'return import(specifier)');
|
|
8066
8005
|
return vm.compileFunction(content, args, {
|
|
8067
8006
|
filename: file.path,
|
|
8068
|
-
importModuleDynamically:
|
|
8007
|
+
importModuleDynamically: dynamicImport
|
|
8069
8008
|
}).call(m.exports, ...argValues), this.postExecute(m, file), m.exports;
|
|
8070
8009
|
};
|
|
8071
8010
|
}
|
|
@@ -8318,12 +8257,18 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8318
8257
|
protocol,
|
|
8319
8258
|
clearCache: !0,
|
|
8320
8259
|
logger
|
|
8321
|
-
}), state = {},
|
|
8260
|
+
}), state = {}, webSocketServers = new Set(), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServerResources = ()=>{
|
|
8261
|
+
if (closingPromise) return closingPromise;
|
|
8262
|
+
hotConnectCallbacks = void 0;
|
|
8263
|
+
let onUpgrade = state.devMiddlewares?.onUpgrade;
|
|
8264
|
+
if (onUpgrade && webSocketServers) for (let server of webSocketServers)server.removeListener('upgrade', onUpgrade);
|
|
8265
|
+
return webSocketServers = void 0, unregisterRestart?.(), unregisterRestart = void 0, closingPromise = (async ()=>{
|
|
8322
8266
|
removeCleanup(closeServer), cleanupGracefulShutdown?.(), await context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
8323
8267
|
state.devMiddlewares?.close(),
|
|
8324
8268
|
state.fileWatcher?.close()
|
|
8325
8269
|
]);
|
|
8326
|
-
})()
|
|
8270
|
+
})();
|
|
8271
|
+
}, closeServer = async ()=>{
|
|
8327
8272
|
await state.restartWatcher?.close(), await closeServerResources();
|
|
8328
8273
|
}, restartServer = async ()=>{
|
|
8329
8274
|
let restarted = await requestRestart({
|
|
@@ -8410,7 +8355,9 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8410
8355
|
return httpServer.listen({
|
|
8411
8356
|
host,
|
|
8412
8357
|
port
|
|
8413
|
-
}), await once(httpServer, 'listening'), middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware),
|
|
8358
|
+
}), await once(httpServer, 'listening'), middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devServer.connectWebSocket({
|
|
8359
|
+
server: httpServer
|
|
8360
|
+
}), logger.debug('listen dev server done'), await devServer.afterListen(), {
|
|
8414
8361
|
port,
|
|
8415
8362
|
urls: urls.map((item)=>item.url),
|
|
8416
8363
|
server: devServer
|
|
@@ -8432,7 +8379,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8432
8379
|
});
|
|
8433
8380
|
},
|
|
8434
8381
|
connectWebSocket: ({ server })=>{
|
|
8435
|
-
state.devMiddlewares && server.on('upgrade', state.devMiddlewares.onUpgrade);
|
|
8382
|
+
state.devMiddlewares && webSocketServers && !webSocketServers.has(server) && (server.on('upgrade', state.devMiddlewares.onUpgrade), webSocketServers.add(server));
|
|
8436
8383
|
},
|
|
8437
8384
|
close: closeServer,
|
|
8438
8385
|
printUrls,
|
|
@@ -8757,11 +8704,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8757
8704
|
library: {
|
|
8758
8705
|
type: isESM ? 'module' : 'commonjs2'
|
|
8759
8706
|
}
|
|
8760
|
-
}), isESM) {
|
|
8761
|
-
if ('web-worker' === target) throw Error('[rsbuild:config] `output.module: true` is not supported for web-worker target.');
|
|
8762
|
-
chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
|
|
8763
|
-
}
|
|
8764
|
-
if (config.output.copy) {
|
|
8707
|
+
}), isESM && (chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import')), config.output.copy) {
|
|
8765
8708
|
let { copy } = config.output, options = Array.isArray(copy) ? {
|
|
8766
8709
|
patterns: copy
|
|
8767
8710
|
} : copy;
|
|
@@ -8846,7 +8789,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8846
8789
|
for (let pathInfo of [
|
|
8847
8790
|
...Object.values(params.environments).reduce((result, curr)=>(result.some((item)=>item.distPath === curr.distPath) || result.push(curr), result), []).map((environment)=>((environment, isDev)=>{
|
|
8848
8791
|
let { rootPath } = api.context, { config, distPath } = environment, { enable, keep } = normalizeCleanDistPath(config.output.cleanDistPath);
|
|
8849
|
-
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 :
|
|
8792
|
+
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : relativeWithin(rootPath, distPath) ? {
|
|
8850
8793
|
path: distPath,
|
|
8851
8794
|
keep
|
|
8852
8795
|
} : (api.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), api.logger.warn(`Please set ${color.yellow('`output.cleanDistPath`')} config manually.`), api.logger.warn(`Current root path: ${color.dim(rootPath)}`), void api.logger.warn(`Current dist path: ${color.dim(distPath)}`)) : !0 === enable ? {
|
|
@@ -8856,7 +8799,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8856
8799
|
})(environment, params.isDev)),
|
|
8857
8800
|
(()=>{
|
|
8858
8801
|
let { rootPath, distPath } = api.context, config = api.getNormalizedConfig(), targetPath = join(distPath, RSBUILD_OUTPUTS_PATH), { enable } = normalizeCleanDistPath(config.output.cleanDistPath);
|
|
8859
|
-
if (!0 === enable || 'auto' === enable &&
|
|
8802
|
+
if (!0 === enable || 'auto' === enable && relativeWithin(rootPath, targetPath)) return {
|
|
8860
8803
|
path: targetPath
|
|
8861
8804
|
};
|
|
8862
8805
|
})()
|
|
@@ -9212,7 +9155,7 @@ try {
|
|
|
9212
9155
|
type: 'text'
|
|
9213
9156
|
}).type('asset/source');
|
|
9214
9157
|
let urlRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_URL).resourceQuery(URL_QUERY_REGEX);
|
|
9215
|
-
urlRule.use(CHAIN_ID.USE.CSS_URL).loader(node_path.join(
|
|
9158
|
+
urlRule.use(CHAIN_ID.USE.CSS_URL).loader(node_path.join(LOADER_PATH, 'cssUrlLoader.mjs'));
|
|
9216
9159
|
let inlineRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_INLINE).resourceQuery(INLINE_QUERY_REGEX);
|
|
9217
9160
|
cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
|
|
9218
9161
|
let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN), emitCss = config.output.emitCss ?? 'web' === target;
|
|
@@ -9221,15 +9164,15 @@ try {
|
|
|
9221
9164
|
initial: {},
|
|
9222
9165
|
config: config.tools.styleLoader
|
|
9223
9166
|
});
|
|
9224
|
-
mainRule.use(CHAIN_ID.USE.STYLE).loader(
|
|
9167
|
+
mainRule.use(CHAIN_ID.USE.STYLE).loader(getCompiledPath('style-loader')).options(styleLoaderOptions);
|
|
9225
9168
|
} else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(core_rspack.CssExtractRspackPlugin.loader).options(config.tools.cssExtract.loaderOptions);
|
|
9226
|
-
else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(
|
|
9169
|
+
else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(LOADER_PATH, 'ignoreCssLoader.mjs'));
|
|
9227
9170
|
let importLoaders = {
|
|
9228
9171
|
normal: 0,
|
|
9229
9172
|
inline: 0
|
|
9230
9173
|
}, updateRules = async (callback, options = {})=>{
|
|
9231
9174
|
options.skipMain || await callback(mainRule, 'main'), await callback(inlineRule, 'inline'), await callback(urlRule, 'url');
|
|
9232
|
-
}, cssLoaderPath =
|
|
9175
|
+
}, cssLoaderPath = getCompiledPath('css-loader');
|
|
9233
9176
|
if (await updateRules((rule)=>{
|
|
9234
9177
|
rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
|
|
9235
9178
|
}), !1 !== config.tools.lightningcssLoader) {
|
|
@@ -9253,7 +9196,7 @@ try {
|
|
|
9253
9196
|
});
|
|
9254
9197
|
if ('function' == typeof postcssLoaderOptions.postcssOptions || postcssLoaderOptions.postcssOptions?.plugins?.length) {
|
|
9255
9198
|
emitCss && importLoaders.normal++, importLoaders.inline++;
|
|
9256
|
-
let postcssLoaderPath =
|
|
9199
|
+
let postcssLoaderPath = getCompiledPath('postcss-loader');
|
|
9257
9200
|
await updateRules((rule)=>{
|
|
9258
9201
|
rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
|
|
9259
9202
|
}, {
|
|
@@ -9366,7 +9309,7 @@ try {
|
|
|
9366
9309
|
api.modifyBundlerChain({
|
|
9367
9310
|
order: 'pre',
|
|
9368
9311
|
handler: (chain, { CHAIN_ID })=>{
|
|
9369
|
-
chain.module.rule(CHAIN_ID.RULE.JS).oneOf(CHAIN_ID.ONE_OF.JS_WORKER).resourceQuery(WORKER_QUERY_REGEX).type("javascript/auto").use(CHAIN_ID.USE.WORKER_QUERY).loader(node_path.join(
|
|
9312
|
+
chain.module.rule(CHAIN_ID.RULE.JS).oneOf(CHAIN_ID.ONE_OF.JS_WORKER).resourceQuery(WORKER_QUERY_REGEX).type("javascript/auto").use(CHAIN_ID.USE.WORKER_QUERY).loader(node_path.join(LOADER_PATH, 'workerLoader.mjs'));
|
|
9370
9313
|
}
|
|
9371
9314
|
});
|
|
9372
9315
|
}
|
|
@@ -10257,7 +10200,7 @@ let applyServerOptions = (command)=>{
|
|
|
10257
10200
|
};
|
|
10258
10201
|
function setupCommands(argv) {
|
|
10259
10202
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10260
|
-
cli.version("2.2.
|
|
10203
|
+
cli.version("2.2.10"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
10261
10204
|
default: 'auto'
|
|
10262
10205
|
}).option('--dist-path <dir>', 'Set the root directory of output files').option('--source-map', 'Enable source map').option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
10263
10206
|
type: [
|
|
@@ -10322,7 +10265,7 @@ function setupCommands(argv) {
|
|
|
10322
10265
|
}
|
|
10323
10266
|
function showGreeting() {
|
|
10324
10267
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10325
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.
|
|
10268
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.10\n`);
|
|
10326
10269
|
}
|
|
10327
10270
|
function setupLogLevel(argv) {
|
|
10328
10271
|
if (argv.length <= 3) return;
|
|
@@ -10344,5 +10287,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10344
10287
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10345
10288
|
}
|
|
10346
10289
|
}
|
|
10347
|
-
let src_version = "2.2.
|
|
10348
|
-
export {
|
|
10290
|
+
let src_version = "2.2.10";
|
|
10291
|
+
export { core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
|
package/dist/manifest-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rspackRequire as e,moduleFactories as t}from"./rslib-runtime.js";import{createRequire as s}from"node:module";let r=s(import.meta.url);t.add({"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/helpers.js"(e,t){t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;let s=r("node:path");t.generateManifest=(e,t,{generate:s,seed:r={}})=>s?s(r,t,Array.from(e.entrypoints.entries()).reduce((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()}),{}),{compilation:e}):t.reduce((e,t)=>Object.assign(e,{[t.name]:t.path}),r),t.reduceAssets=(e,t,r)=>{let n;return(r[t.name]?n=r[t.name]:t.info.sourceFilename&&(n=(0,s.join)((0,s.dirname)(t.name),(0,s.basename)(t.info.sourceFilename))),n)?e.concat({isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!0,name:n,path:t.name}):t.chunks&&t.chunks.length>0?e:e.concat({isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!1,name:t.name,path:t.name})},t.reduceChunk=(e,t,r,n)=>(Array.from(t.auxiliaryFiles||[]).forEach(e=>{n[e]={isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!0,name:(0,s.basename)(e),path:e}}),Array.from(t.files).reduce((e,s)=>{let n=t.name?t.name:null;return n=n?r.useEntryKeys&&!s.endsWith(".map")?n:`${n}.${((e,{transformExtensions:t})=>{let s=e.replace(/\?.*/,"").split("."),r=s.pop();return t.test(r)?`${s.pop()}.${r}`:r})(s,r)}`:s,e.concat({chunk:t,isAsset:!1,isChunk:!0,isInitial:t.isOnlyInitial(),isModuleAsset:!1,name:n,path:s})},e));let n=e=>{let t=Object.assign({},e);return t.name=e.name.replace(/\\/g,"/"),t.path=e.path.replace(/\\/g,"/"),t};t.transformFiles=(e,t)=>["filter","map","sort"].filter(e=>!!t[e]).reduce((e,s)=>e[s](t[s]),e).map(n)},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/hooks.js"(t,s){s.getCompilerHooks=s.emitHook=s.beforeRunHook=void 0;let n=r("node:fs"),o=r("node:path"),a=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rspack/lite-tapable/1.1.2/036f06c5b55ea7af7e140dea0a8408dcf1d42b66956fce0edb61b138095cac00/node_modules/@rspack/lite-tapable/dist/index.cjs"),i=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/helpers.js"),l=new WeakMap,c=e=>{let t=l.get(e);return void 0===t&&(t={afterEmit:new a.SyncWaterfallHook(["manifest"]),beforeEmit:new a.SyncWaterfallHook(["manifest"])},l.set(e,t)),t};s.getCompilerHooks=c,s.beforeRunHook=({emitCountMap:e,manifestFileName:t},s,r)=>{let n=e.get(t)||0;e.set(t,n+1),r&&r()},s.emitHook=function({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:r,moduleAssets:a,options:l},p){let h=t.get(r)-1,u=p.getStats().toJson({all:!1,assets:!0,cachedAssets:!0,ids:!0,publicPath:!0}),g=null!==l.publicPath?l.publicPath:u.publicPath,f="auto"===g?"":g,{basePath:d,removeKeyHash:m}=l;t.set(r,h);let k={},y=Array.from(p.chunks).reduce((e,t)=>(0,i.reduceChunk)(e,t,l,k),[]);(y=(y=u.assets.reduce((e,t)=>(0,i.reduceAssets)(e,t,a),y)).filter(({name:s,path:r})=>!r.includes("hot-update")&&void 0===t.get((0,o.join)(e.options.output?.path||"<unknown>",s)))).forEach(e=>{delete k[e.path]}),Object.keys(k).forEach(e=>{y=y.concat(k[e])});let b={};u.assets?.forEach(e=>{e.integrity&&(b[e.name]=e.integrity)}),y=y.map(e=>{let t=e=>e.endsWith("/")?e:`${e}/`,s={name:d?t(d)+e.name:e.name,path:f?t(f)+e.path:e.path};return b[e.path]&&(s.integrity=b[e.path]),s.name=m?s.name.replace(m,""):s.name,Object.assign(e,s)}),y=(0,i.transformFiles)(y,l);let S=(0,i.generateManifest)(p,y,l),_=0===h;if(S=c(e).beforeEmit.call(S),_){let t=l.serialize(S);p.emitAsset(s,new e.webpack.sources.RawSource(t)),l.writeToFileEmit&&((0,n.mkdirSync)((0,o.dirname)(r),{recursive:!0}),(0,n.writeFileSync)(r,t))}c(e).afterEmit.call(S)}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/index.js"(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.RspackManifestPlugin=s.WebpackManifestPlugin=s.getCompilerHooks=void 0;let n=r("node:path"),o=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/hooks.js");Object.defineProperty(s,"getCompilerHooks",{enumerable:!0,get:function(){return o.getCompilerHooks}});let a=new Map,i={assetHookStage:1/0,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize:e=>JSON.stringify(e,null,2),sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:!1,useLegacyEmit:!1,writeToFileEmit:!1};class l{options;constructor(e){this.options=Object.assign({},i,e)}apply(e){let t=(0,n.resolve)(e.options.output?.path||"./",this.options.fileName),s=(0,n.relative)(e.options.output?.path||"./",t),r=o.beforeRunHook.bind(this,{emitCountMap:a,manifestFileName:t}),i=o.emitHook.bind(this,{compiler:e,emitCountMap:a,manifestAssetId:s,manifestFileName:t,moduleAssets:{},options:this.options}),l={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};!0===this.options.useLegacyEmit?e.hooks.emit.tap(l,i):e.hooks.thisCompilation.tap(l,e=>{e.hooks.processAssets.tap(l,()=>i(e))}),e.hooks.run.tapAsync(l,r),e.hooks.watchRun.tapAsync(l,r)}}s.WebpackManifestPlugin=l,s.RspackManifestPlugin=l},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rspack/lite-tapable/1.1.2/036f06c5b55ea7af7e140dea0a8408dcf1d42b66956fce0edb61b138095cac00/node_modules/@rspack/lite-tapable/dist/index.cjs"(e,t){var s={};s.d=(e,t,r)=>{var n=(t,r)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[r]:t[n]})};n(t,"get"),n(r,"value")},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.r(r);class o{intercept(e){if(this.interceptors.push(Object.assign({},e)),e.register)for(let t=0;t<this.taps.length;t++)this.taps[t]=e.register(this.taps[t])}_runRegisterInterceptors(e){return this.interceptors.reduce((e,t)=>t.register?.(e)??e,e)}_runCallInterceptors(...e){for(let t of this.interceptors)t.call&&t.call(...e)}_runErrorInterceptors(e){for(let t of this.interceptors)t.error&&t.error(e)}_runTapInterceptors(e){for(let t of this.interceptors)t.tap&&t.tap(e)}_runDoneInterceptors(){for(let e of this.interceptors)e.done&&e.done()}_runResultInterceptors(e){for(let t of this.interceptors)t.result&&t.result(e)}withOptions(e){let t=t=>Object.assign({},e,"string"==typeof t?{name:t}:t);return{name:this.name,tap:(e,s)=>this.tap(t(e),s),tapAsync:(e,s)=>this.tapAsync(t(e),s),tapPromise:(e,s)=>this.tapPromise(t(e),s),intercept:e=>this.intercept(e),isUsed:()=>this.isUsed(),withOptions:e=>this.withOptions(t(e)),queryStageRange:e=>this.queryStageRange(e)}}isUsed(){return this.taps.length>0||this.interceptors.length>0}queryStageRange(e){return new i(e,this)}callAsyncStageRange(e){throw Error("Hook should implement there own _callAsyncStageRange")}callAsync(...e){return this.callAsyncStageRange(this.queryStageRange(a),...e)}promiseStageRange(e,...t){return new Promise((s,r)=>{this.callAsyncStageRange(e,...t,(e,t)=>e?r(e):s(t))})}promise(...e){return this.promiseStageRange(this.queryStageRange(a),...e)}tap(e,t){this._tap("sync",e,t)}tapAsync(e,t){this._tap("async",e,t)}tapPromise(e,t){this._tap("promise",e,t)}_tap(e,t,s){let r=t;if("string"==typeof t)r={name:t.trim()};else if("object"!=typeof t||null===t)throw Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw Error("Missing name for tap");this._insert(this._runRegisterInterceptors(Object.assign({type:e,fn:s},r)))}_insert(e){let t;"string"==typeof e.before?t=new Set([e.before]):Array.isArray(e.before)&&(t=new Set(e.before));let s=0;"number"==typeof e.stage&&(s=e.stage);let r=this.taps.length;for(;r>0;){r--;let e=this.taps[r];this.taps[r+1]=e;let n=e.stage||0;if(t){if(t.has(e.name)){t.delete(e.name);continue}if(t.size>0)continue}if(!(n>s)){r++;break}}this.taps[r]=e}_prepareArgs(e){let t=this.args.length;return e.length<t?(e.length=t,e.fill(void 0,e.length,t)):(e.length>t&&(e.length=t),e)}constructor(e=[],t){n(this,"args",void 0),n(this,"name",void 0),n(this,"taps",void 0),n(this,"interceptors",void 0),this.args=e,this.name=t,this.taps=[],this.interceptors=[]}}let a=[-1/0,1/0];class i{isUsed(){return!!(this.tapsInRange.length>0||-1/0===this.stageRange[0]&&this.hook.interceptors.some(e=>e.call)||1/0===this.stageRange[1]&&this.hook.interceptors.some(e=>e.done))}call(...e){if("function"!=typeof this.hook.callStageRange)throw Error("hook is not a SyncHook, call methods only exists on SyncHook");return this.hook.callStageRange(this,...e)}callAsync(...e){return this.hook.callAsyncStageRange(this,...e)}promise(...e){return this.hook.promiseStageRange(this,...e)}constructor(e,t){n(this,"stageRange",void 0),n(this,"hook",void 0),n(this,"tapsInRange",void 0);let s=[],[r,o]=e;for(let e of t.taps){let t=e.stage??0;r<=t&&t<o?s.push(e):1/0===o&&1/0===t&&s.push(e)}this.stageRange=e,this.hook=t,this.tapsInRange=s}}class l extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){this._runTapInterceptors(e);try{e.fn(...i)}catch(e){return this._runErrorInterceptors(e),a(e)}}1/0===r&&(this._runDoneInterceptors(),a(null))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncHook")}}class c extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){let t;this._runTapInterceptors(e);try{t=e.fn(...i)}catch(e){return this._runErrorInterceptors(e),a(e)}if(void 0!==t)return this._runResultInterceptors(t),a(null,t)}1/0===r&&(this._runDoneInterceptors(),a(null))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncBailHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncBailHook")}}class p extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){this._runTapInterceptors(e);try{let t=e.fn(...i);void 0!==t&&(i[0]=t)}catch(e){return this._runErrorInterceptors(e),a(e)}}1/0===r&&(this._runDoneInterceptors(),a(null,i[0]))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncWaterfallHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncWaterfallHook")}constructor(e=[],t){if(e.length<1)throw Error("Waterfall hooks must have at least one argument");super(e,t)}}class h extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i();let c=r.length;for(let e of r){if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(()=>{0==(c-=1)&&i()},e=>{c=0,l(e)})}else if("async"===e.type)e.fn(...a,e=>{e?(c=0,l(e)):0==(c-=1)&&i()});else{let t=!1;try{e.fn(...a)}catch(e){t=!0,c=0,l(e)}t||0!=--c||i()}if(c<=0)return}}}class u extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i();let c=0,p=()=>{let e=r[c];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(()=>{(c+=1)===r.length?i():p()},e=>{c=r.length,l(e)})}else if("async"===e.type)e.fn(...a,e=>{e?(c=r.length,l(e)):(c+=1)===r.length?i():p()});else{let t=!1;try{e.fn(...a)}catch(e){t=!0,c=r.length,l(e)}t||((c+=1)===r.length?i():p())}if(c===r.length)return};p()}}class g extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)},c=e=>{this._runResultInterceptors(e),o(null,e)};if(0===r.length)return i();let p=0,h=()=>{let e=r[p];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(e=>{p+=1,void 0!==e?c(e):p===r.length?i():h()},e=>{p=r.length,l(e)})}else if("async"===e.type)e.fn(...a,(e,t)=>{e?(p=r.length,l(e)):(p+=1,void 0!==t?c(t):p===r.length?i():h())});else{let t,s=!1;try{t=e.fn(...a)}catch(e){s=!0,p=r.length,l(e)}s||(p+=1,void 0!==t?c(t):p===r.length?i():h())}if(p===r.length)return};h()}}class f extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=e=>{this._runResultInterceptors(e),o(null,e)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i(a[0]);let c=0,p=()=>{let e=r[c];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(e=>{c+=1,void 0!==e&&(a[0]=e),c===r.length?i(a[0]):p()},e=>{c=r.length,l(e)})}else if("async"===e.type)e.fn(...a,(e,t)=>{e?(c=r.length,l(e)):(c+=1,void 0!==t&&(a[0]=t),c===r.length?i(a[0]):p())});else{let t=!1;try{let t=e.fn(...a);void 0!==t&&(a[0]=t)}catch(e){t=!0,c=r.length,l(e)}t||((c+=1)===r.length?i(a[0]):p())}if(c===r.length)return};p()}constructor(e=[],t){if(e.length<1)throw Error("Waterfall hooks must have at least one argument");super(e,t)}}let d=(e,t)=>t;class m{get(e){return this._map.get(e)}for(e){let t=this.get(e);if(void 0!==t)return t;let s=this._factory(e),r=this._interceptors;for(let t=0;t<r.length;t++){let n=r[t].factory;n&&(s=n(e,s))}return this._map.set(e,s),s}intercept(e){this._interceptors.push(Object.assign({factory:d},e))}isUsed(){for(let e of this._map.keys()){let t=this.get(e);if(t?.isUsed())return!0}return!1}queryStageRange(e){return new k(e,this)}constructor(e,t){n(this,"_map",new Map),n(this,"_factory",void 0),n(this,"name",void 0),n(this,"_interceptors",void 0),this.name=t,this._factory=e,this._interceptors=[]}}class k{get(e){return this.hookMap.get(e)?.queryStageRange(this.stageRange)}for(e){return this.hookMap.for(e).queryStageRange(this.stageRange)}isUsed(){for(let e of this.hookMap._map.keys())if(this.get(e)?.isUsed())return!0;return!1}constructor(e,t){n(this,"stageRange",void 0),n(this,"hookMap",void 0),this.stageRange=e,this.hookMap=t}}class y{tap(e,t){for(let s of this.hooks)s.tap(e,t)}tapAsync(e,t){for(let s of this.hooks)s.tapAsync(e,t)}tapPromise(e,t){for(let s of this.hooks)s.tapPromise(e,t)}isUsed(){for(let e of this.hooks)if(e.isUsed())return!0;return!1}intercept(e){for(let t of this.hooks)t.intercept(e)}withOptions(e){return new y(this.hooks.map(t=>t.withOptions(e)),this.name)}constructor(e,t){n(this,"hooks",void 0),n(this,"name",void 0),this.hooks=e,this.name=t}}for(var b in s.d(r,{AsyncParallelHook:()=>h,AsyncSeriesBailHook:()=>g,AsyncSeriesHook:()=>u,AsyncSeriesWaterfallHook:()=>f,HookBase:()=>o,HookMap:()=>m,MultiHook:()=>y,QueriedHook:()=>i,QueriedHookMap:()=>k,SyncBailHook:()=>c,SyncHook:()=>l,SyncWaterfallHook:()=>p},{maxStage:1/0,minStage:-1/0,safeStage:e=>e<-0x80000000?-0x80000000:e>0x7fffffff?0x7fffffff:e}),t.AsyncParallelHook=r.AsyncParallelHook,t.AsyncSeriesBailHook=r.AsyncSeriesBailHook,t.AsyncSeriesHook=r.AsyncSeriesHook,t.AsyncSeriesWaterfallHook=r.AsyncSeriesWaterfallHook,t.HookBase=r.HookBase,t.HookMap=r.HookMap,t.MultiHook=r.MultiHook,t.QueriedHook=r.QueriedHook,t.QueriedHookMap=r.QueriedHookMap,t.SyncBailHook=r.SyncBailHook,t.SyncHook=r.SyncHook,t.SyncWaterfallHook=r.SyncWaterfallHook,t.maxStage=r.maxStage,t.minStage=r.minStage,t.safeStage=r.safeStage,r)-1===["AsyncParallelHook","AsyncSeriesBailHook","AsyncSeriesHook","AsyncSeriesWaterfallHook","HookBase","HookMap","MultiHook","QueriedHook","QueriedHookMap","SyncBailHook","SyncHook","SyncWaterfallHook","maxStage","minStage","safeStage"].indexOf(b)&&(t[b]=r[b]);Object.defineProperty(t,"__esModule",{value:!0})}});let n=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5acfc0b855cb5cd205a81b2c264b6bdf3a41cbc273715b263f9fdb82cc7ae49c/node_modules/rspack-manifest-plugin/dist/index.js");var o=n.RspackManifestPlugin,a=n.WebpackManifestPlugin,i=n.__esModule,l=n.getCompilerHooks;export{o as RspackManifestPlugin,a as WebpackManifestPlugin,i as __esModule,l as getCompilerHooks};
|
|
1
|
+
import{rspackRequire as e,moduleFactories as t}from"./rslib-runtime.js";import{createRequire as s}from"node:module";let r=s(import.meta.url);t.add({"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/helpers.js"(e,t){t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;let s=r("node:path");t.generateManifest=(e,t,{generate:s,seed:r={}})=>s?s(r,t,Array.from(e.entrypoints.entries()).reduce((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()}),{}),{compilation:e}):t.reduce((e,t)=>Object.assign(e,{[t.name]:t.path}),r),t.reduceAssets=(e,t,r)=>{let n;return(r[t.name]?n=r[t.name]:t.info.sourceFilename&&(n=(0,s.join)((0,s.dirname)(t.name),(0,s.basename)(t.info.sourceFilename))),n)?e.concat({isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!0,name:n,path:t.name}):t.chunks&&t.chunks.length>0?e:e.concat({isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!1,name:t.name,path:t.name})},t.reduceChunk=(e,t,r,n)=>(Array.from(t.auxiliaryFiles||[]).forEach(e=>{n[e]={isAsset:!0,isChunk:!1,isInitial:!1,isModuleAsset:!0,name:(0,s.basename)(e),path:e}}),Array.from(t.files).reduce((e,s)=>{let n=t.name?t.name:null;return n=n?r.useEntryKeys&&!s.endsWith(".map")?n:`${n}.${((e,{transformExtensions:t})=>{let s=e.replace(/\?.*/,"").split("."),r=s.pop();return t.test(r)?`${s.pop()}.${r}`:r})(s,r)}`:s,e.concat({chunk:t,isAsset:!1,isChunk:!0,isInitial:t.isOnlyInitial(),isModuleAsset:!1,name:n,path:s})},e));let n=e=>{let t=Object.assign({},e);return t.name=e.name.replace(/\\/g,"/"),t.path=e.path.replace(/\\/g,"/"),t};t.transformFiles=(e,t)=>["filter","map","sort"].filter(e=>!!t[e]).reduce((e,s)=>e[s](t[s]),e).map(n)},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/hooks.js"(t,s){s.getCompilerHooks=s.emitHook=s.beforeRunHook=void 0;let n=r("node:fs"),o=r("node:path"),a=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rspack/lite-tapable/1.1.5/89f7707af419f049572b368960144ec499672d58192c3b3f77eb1567a07281e3/node_modules/@rspack/lite-tapable/dist/index.cjs"),i=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/helpers.js"),l=new WeakMap,c=e=>{let t=l.get(e);return void 0===t&&(t={afterEmit:new a.SyncWaterfallHook(["manifest"]),beforeEmit:new a.SyncWaterfallHook(["manifest"])},l.set(e,t)),t};s.getCompilerHooks=c,s.beforeRunHook=({emitCountMap:e,manifestFileName:t},s,r)=>{let n=e.get(t)||0;e.set(t,n+1),r&&r()},s.emitHook=function({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:r,moduleAssets:a,options:l},p){let h=t.get(r)-1,u=p.getStats().toJson({all:!1,assets:!0,cachedAssets:!0,ids:!0,publicPath:!0}),g=null!==l.publicPath?l.publicPath:u.publicPath,f="auto"===g?"":g,{basePath:d,removeKeyHash:m}=l;t.set(r,h);let k={},y=Array.from(p.chunks).reduce((e,t)=>(0,i.reduceChunk)(e,t,l,k),[]);(y=(y=u.assets.reduce((e,t)=>(0,i.reduceAssets)(e,t,a),y)).filter(({name:s,path:r})=>!r.includes("hot-update")&&void 0===t.get((0,o.join)(e.options.output?.path||"<unknown>",s)))).forEach(e=>{delete k[e.path]}),Object.keys(k).forEach(e=>{y=y.concat(k[e])});let S={};u.assets?.forEach(e=>{e.integrity&&(S[e.name]=e.integrity)}),y=y.map(e=>{let t=e=>e.endsWith("/")?e:`${e}/`,s={name:d?t(d)+e.name:e.name,path:f?t(f)+e.path:e.path};return S[e.path]&&(s.integrity=S[e.path]),s.name=m?s.name.replace(m,""):s.name,Object.assign(e,s)}),y=(0,i.transformFiles)(y,l);let b=(0,i.generateManifest)(p,y,l),_=0===h;if(b=c(e).beforeEmit.call(b),_){let t=l.serialize(b);p.emitAsset(s,new e.webpack.sources.RawSource(t)),l.writeToFileEmit&&((0,n.mkdirSync)((0,o.dirname)(r),{recursive:!0}),(0,n.writeFileSync)(r,t))}c(e).afterEmit.call(b)}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/index.js"(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.RspackManifestPlugin=s.WebpackManifestPlugin=s.getCompilerHooks=void 0;let n=r("node:path"),o=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/hooks.js");Object.defineProperty(s,"getCompilerHooks",{enumerable:!0,get:function(){return o.getCompilerHooks}});let a=new Map,i={assetHookStage:1/0,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize:e=>JSON.stringify(e,null,2),sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:!1,useLegacyEmit:!1,writeToFileEmit:!1};class l{options;constructor(e){this.options=Object.assign({},i,e)}apply(e){let t=(0,n.resolve)(e.options.output?.path||"./",this.options.fileName),s=(0,n.relative)(e.options.output?.path||"./",t),r=o.beforeRunHook.bind(this,{emitCountMap:a,manifestFileName:t}),i=o.emitHook.bind(this,{compiler:e,emitCountMap:a,manifestAssetId:s,manifestFileName:t,moduleAssets:{},options:this.options}),l={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};!0===this.options.useLegacyEmit?e.hooks.emit.tap(l,i):e.hooks.thisCompilation.tap(l,e=>{e.hooks.processAssets.tap(l,()=>i(e))}),e.hooks.run.tapAsync(l,r),e.hooks.watchRun.tapAsync(l,r)}}s.WebpackManifestPlugin=l,s.RspackManifestPlugin=l},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rspack/lite-tapable/1.1.5/89f7707af419f049572b368960144ec499672d58192c3b3f77eb1567a07281e3/node_modules/@rspack/lite-tapable/dist/index.cjs"(e,t){var s={};s.d=(e,t,r)=>{var n=(t,r)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[r]:t[n]})};n(t,"get"),n(r,"value")},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.r(r);class o{intercept(e){if(this.interceptors.push(Object.assign({},e)),e.register)for(let t=0;t<this.taps.length;t++)this.taps[t]=e.register(this.taps[t])}_runRegisterInterceptors(e){return this.interceptors.reduce((e,t)=>t.register?.(e)??e,e)}_runCallInterceptors(...e){for(let t of this.interceptors)t.call&&t.call(...e)}_runErrorInterceptors(e){for(let t of this.interceptors)t.error&&t.error(e)}_runTapInterceptors(e){for(let t of this.interceptors)t.tap&&t.tap(e)}_runDoneInterceptors(){for(let e of this.interceptors)e.done&&e.done()}_runResultInterceptors(e){for(let t of this.interceptors)t.result&&t.result(e)}withOptions(e){let t=t=>Object.assign({},e,"string"==typeof t?{name:t}:t);return{name:this.name,tap:(e,s)=>this.tap(t(e),s),tapAsync:(e,s)=>this.tapAsync(t(e),s),tapPromise:(e,s)=>this.tapPromise(t(e),s),intercept:e=>this.intercept(e),isUsed:()=>this.isUsed(),withOptions:e=>this.withOptions(t(e)),queryStageRange:e=>this.queryStageRange(e)}}isUsed(){return this.taps.length>0||this.interceptors.length>0}queryStageRange(e){return new i(e,this)}callAsyncStageRange(e){throw Error("Hook should implement there own _callAsyncStageRange")}callAsync(...e){return this.callAsyncStageRange(this.queryStageRange(a),...e)}promiseStageRange(e,...t){return new Promise((s,r)=>{this.callAsyncStageRange(e,...t,(e,t)=>e?r(e):s(t))})}promise(...e){return this.promiseStageRange(this.queryStageRange(a),...e)}tap(e,t){this._tap("sync",e,t)}tapAsync(e,t){this._tap("async",e,t)}tapPromise(e,t){this._tap("promise",e,t)}_tap(e,t,s){let r=t;if("string"==typeof t)r={name:t.trim()};else if("object"!=typeof t||null===t)throw Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw Error("Missing name for tap");this._insert(this._runRegisterInterceptors(Object.assign({type:e,fn:s},r)))}_insert(e){let t;"string"==typeof e.before?t=new Set([e.before]):Array.isArray(e.before)&&(t=new Set(e.before));let s=0;"number"==typeof e.stage&&(s=e.stage);let r=this.taps.length;for(;r>0;){r--;let e=this.taps[r];this.taps[r+1]=e;let n=e.stage||0;if(t){if(t.has(e.name)){t.delete(e.name);continue}if(t.size>0)continue}if(!(n>s)){r++;break}}this.taps[r]=e}_prepareArgs(e){let t=this.args.length;return e.length<t?(e.length=t,e.fill(void 0,e.length,t)):(e.length>t&&(e.length=t),e)}constructor(e=[],t){n(this,"args",void 0),n(this,"name",void 0),n(this,"taps",void 0),n(this,"interceptors",void 0),this.args=e,this.name=t,this.taps=[],this.interceptors=[]}}let a=[-1/0,1/0];class i{isUsed(){return!!(this.tapsInRange.length>0||-1/0===this.stageRange[0]&&this.hook.interceptors.some(e=>e.call)||1/0===this.stageRange[1]&&this.hook.interceptors.some(e=>e.done))}call(...e){if("function"!=typeof this.hook.callStageRange)throw Error("hook is not a SyncHook, call methods only exists on SyncHook");return this.hook.callStageRange(this,...e)}callAsync(...e){return this.hook.callAsyncStageRange(this,...e)}promise(...e){return this.hook.promiseStageRange(this,...e)}constructor(e,t){n(this,"stageRange",void 0),n(this,"hook",void 0),n(this,"tapsInRange",void 0);let s=[],[r,o]=e;for(let e of t.taps){let t=e.stage??0;r<=t&&t<o?s.push(e):1/0===o&&1/0===t&&s.push(e)}this.stageRange=e,this.hook=t,this.tapsInRange=s}}class l extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){this._runTapInterceptors(e);try{e.fn(...i)}catch(e){return this._runErrorInterceptors(e),a(e)}}1/0===r&&(this._runDoneInterceptors(),a(null))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncHook")}}class c extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){let t;this._runTapInterceptors(e);try{t=e.fn(...i)}catch(e){return this._runErrorInterceptors(e),a(e)}if(void 0!==t)return this._runResultInterceptors(t),a(null,t)}1/0===r&&(this._runDoneInterceptors(),a(null))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncBailHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncBailHook")}}class p extends o{callAsyncStageRange(e,...t){let{stageRange:[s,r],tapsInRange:n}=e,o=t.slice(0,t.length-1),a=t[t.length-1],i=this._prepareArgs(o);for(let e of(-1/0===s&&this._runCallInterceptors(...i),n)){this._runTapInterceptors(e);try{let t=e.fn(...i);void 0!==t&&(i[0]=t)}catch(e){return this._runErrorInterceptors(e),a(e)}}1/0===r&&(this._runDoneInterceptors(),a(null,i[0]))}call(...e){return this.callStageRange(this.queryStageRange(a),...e)}callStageRange(e,...t){let s,r;if(this.callAsyncStageRange(e,...t,(e,t)=>{r=e,s=t}),r)throw r;return s}tapAsync(){throw Error("tapAsync is not supported on a SyncWaterfallHook")}tapPromise(){throw Error("tapPromise is not supported on a SyncWaterfallHook")}constructor(e=[],t){if(e.length<1)throw Error("Waterfall hooks must have at least one argument");super(e,t)}}class h extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i();let c=r.length;for(let e of r){if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(()=>{0==(c-=1)&&i()},e=>{c=0,l(e)})}else if("async"===e.type)e.fn(...a,e=>{e?(c=0,l(e)):0==(c-=1)&&i()});else{let t=!1;try{e.fn(...a)}catch(e){t=!0,c=0,l(e)}t||0!=--c||i()}if(c<=0)return}}}class u extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i();let c=0,p=()=>{let e=r[c];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(()=>{(c+=1)===r.length?i():p()},e=>{c=r.length,l(e)})}else if("async"===e.type)e.fn(...a,e=>{e?(c=r.length,l(e)):(c+=1)===r.length?i():p()});else{let t=!1;try{e.fn(...a)}catch(e){t=!0,c=r.length,l(e)}t||((c+=1)===r.length?i():p())}if(c===r.length)return};p()}}class g extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=()=>{this._runDoneInterceptors(),o(null)},l=e=>{this._runErrorInterceptors(e),o(e)},c=e=>{this._runResultInterceptors(e),o(null,e)};if(0===r.length)return i();let p=0,h=()=>{let e=r[p];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(e=>{p+=1,void 0!==e?c(e):p===r.length?i():h()},e=>{p=r.length,l(e)})}else if("async"===e.type)e.fn(...a,(e,t)=>{e?(p=r.length,l(e)):(p+=1,void 0!==t?c(t):p===r.length?i():h())});else{let t,s=!1;try{t=e.fn(...a)}catch(e){s=!0,p=r.length,l(e)}s||(p+=1,void 0!==t?c(t):p===r.length?i():h())}if(p===r.length)return};h()}}class f extends o{callAsyncStageRange(e,...t){let{stageRange:[s],tapsInRange:r}=e,n=t.slice(0,t.length-1),o=t[t.length-1],a=this._prepareArgs(n);-1/0===s&&this._runCallInterceptors(...a);let i=e=>{this._runResultInterceptors(e),o(null,e)},l=e=>{this._runErrorInterceptors(e),o(e)};if(0===r.length)return i(a[0]);let c=0,p=()=>{let e=r[c];if(this._runTapInterceptors(e),"promise"===e.type){let t=e.fn(...a);if(!t||!t.then)throw Error(`Tap function (tapPromise) did not return promise (returned ${t})`);t.then(e=>{c+=1,void 0!==e&&(a[0]=e),c===r.length?i(a[0]):p()},e=>{c=r.length,l(e)})}else if("async"===e.type)e.fn(...a,(e,t)=>{e?(c=r.length,l(e)):(c+=1,void 0!==t&&(a[0]=t),c===r.length?i(a[0]):p())});else{let t=!1;try{let t=e.fn(...a);void 0!==t&&(a[0]=t)}catch(e){t=!0,c=r.length,l(e)}t||((c+=1)===r.length?i(a[0]):p())}if(c===r.length)return};p()}constructor(e=[],t){if(e.length<1)throw Error("Waterfall hooks must have at least one argument");super(e,t)}}let d=(e,t)=>t;class m{get(e){return this._map.get(e)}for(e){let t=this.get(e);if(void 0!==t)return t;let s=this._factory(e),r=this._interceptors;for(let t=0;t<r.length;t++){let n=r[t].factory;n&&(s=n(e,s))}return this._map.set(e,s),s}intercept(e){this._interceptors.push(Object.assign({factory:d},e))}isUsed(){for(let e of this._map.keys()){let t=this.get(e);if(t?.isUsed())return!0}return!1}queryStageRange(e){return new k(e,this)}constructor(e,t){n(this,"_map",new Map),n(this,"_factory",void 0),n(this,"name",void 0),n(this,"_interceptors",void 0),this.name=t,this._factory=e,this._interceptors=[]}}class k{get(e){return this.hookMap.get(e)?.queryStageRange(this.stageRange)}for(e){return this.hookMap.for(e).queryStageRange(this.stageRange)}isUsed(){for(let e of this.hookMap._map.keys())if(this.get(e)?.isUsed())return!0;return!1}constructor(e,t){n(this,"stageRange",void 0),n(this,"hookMap",void 0),this.stageRange=e,this.hookMap=t}}class y{tap(e,t){for(let s of this.hooks)s.tap(e,t)}tapAsync(e,t){for(let s of this.hooks)s.tapAsync(e,t)}tapPromise(e,t){for(let s of this.hooks)s.tapPromise(e,t)}isUsed(){for(let e of this.hooks)if(e.isUsed())return!0;return!1}intercept(e){for(let t of this.hooks)t.intercept(e)}withOptions(e){return new y(this.hooks.map(t=>t.withOptions(e)),this.name)}constructor(e,t){n(this,"hooks",void 0),n(this,"name",void 0),this.hooks=e,this.name=t}}for(var S in s.d(r,{AsyncParallelHook:()=>h,AsyncSeriesBailHook:()=>g,AsyncSeriesHook:()=>u,AsyncSeriesWaterfallHook:()=>f,HookBase:()=>o,HookMap:()=>m,MultiHook:()=>y,QueriedHook:()=>i,QueriedHookMap:()=>k,SyncBailHook:()=>c,SyncHook:()=>l,SyncWaterfallHook:()=>p},{maxStage:1/0,minStage:-1/0,safeStage:e=>e<-0x80000000?-0x80000000:e>0x7fffffff?0x7fffffff:e}),t.AsyncParallelHook=r.AsyncParallelHook,t.AsyncSeriesBailHook=r.AsyncSeriesBailHook,t.AsyncSeriesHook=r.AsyncSeriesHook,t.AsyncSeriesWaterfallHook=r.AsyncSeriesWaterfallHook,t.HookBase=r.HookBase,t.HookMap=r.HookMap,t.MultiHook=r.MultiHook,t.QueriedHook=r.QueriedHook,t.QueriedHookMap=r.QueriedHookMap,t.SyncBailHook=r.SyncBailHook,t.SyncHook=r.SyncHook,t.SyncWaterfallHook=r.SyncWaterfallHook,t.maxStage=r.maxStage,t.minStage=r.minStage,t.safeStage=r.safeStage,r)-1===["AsyncParallelHook","AsyncSeriesBailHook","AsyncSeriesHook","AsyncSeriesWaterfallHook","HookBase","HookMap","MultiHook","QueriedHook","QueriedHookMap","SyncBailHook","SyncHook","SyncWaterfallHook","maxStage","minStage","safeStage"].indexOf(S)&&(t[S]=r[S]);Object.defineProperty(t,"__esModule",{value:!0})}});let n=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/index.js");var o=n.RspackManifestPlugin,a=n.WebpackManifestPlugin,i=n.__esModule,l=n.getCompilerHooks;export{o as RspackManifestPlugin,a as WebpackManifestPlugin,i as __esModule,l as getCompilerHooks};
|
|
@@ -12,4 +12,19 @@ export type ResolvedWriteToDisk = boolean | ((filePath: string, name?: string) =
|
|
|
12
12
|
* Returns the unified config if all environments have the same value,
|
|
13
13
|
* otherwise returns a function that resolves config based on compilation.
|
|
14
14
|
*/ export declare const resolveWriteToDiskConfig: (config: NormalizedDevConfig, environments: Record<string, EnvironmentContext>, environmentList: EnvironmentContext[]) => ResolvedWriteToDisk;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Copy selected assets from the compiler's output file system to disk.
|
|
17
|
+
* Rspack always writes to compiler.outputFileSystem; this hook handles any
|
|
18
|
+
* additional disk writes requested by dev.writeToDisk:
|
|
19
|
+
*
|
|
20
|
+
* - With `true` and the native Node.js fs, Rspack already writes to disk,
|
|
21
|
+
* so no extra write is needed.
|
|
22
|
+
* - With a predicate, Rspack writes to memory and this hook copies only
|
|
23
|
+
* the files accepted by the predicate to disk.
|
|
24
|
+
* - With different settings across environments, Rspack writes to memory
|
|
25
|
+
* and the resolved predicate selects files using each environment's setting.
|
|
26
|
+
* - With `true` and a custom output file system, keep copying to disk because
|
|
27
|
+
* the custom file system may store assets somewhere else, such as memory.
|
|
28
|
+
*
|
|
29
|
+
* When all environments disable writeToDisk, the caller skips this setup.
|
|
30
|
+
*/ export declare function setupWriteToDisk(compilers: Compiler[], writeToDisk: ResolvedWriteToDisk, logger: Logger): void;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { TraceMap } from '@jridgewell/trace-mapping';
|
|
2
2
|
import type { StackFrame } from 'stacktrace-parser';
|
|
3
3
|
import type { BrowserLogsStackTrace, InternalContext, Rspack } from '../types/index.js';
|
|
4
|
-
export type
|
|
4
|
+
export type BrowserLogsCache = {
|
|
5
|
+
sourceMapPaths: Map<string, Promise<string | undefined>>;
|
|
6
|
+
traceMaps: Map<string, TraceMap>;
|
|
7
|
+
};
|
|
5
8
|
/**
|
|
6
9
|
* Formats error messages received from the browser into a log string with
|
|
7
10
|
* source location information.
|
|
8
|
-
*/ export declare const formatBrowserErrorLog: (message: string, context: InternalContext, fs: Rspack.OutputFileSystem, stackTrace: BrowserLogsStackTrace, stackFrames: StackFrame[] | null,
|
|
11
|
+
*/ export declare const formatBrowserErrorLog: (message: string, context: InternalContext, fs: Rspack.OutputFileSystem, stackTrace: BrowserLogsStackTrace, stackFrames: StackFrame[] | null, cache: BrowserLogsCache) => Promise<string>;
|
package/dist/server/helper.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { IncomingMessage, Server } from 'node:http';
|
|
|
2
2
|
import type { Http2SecureServer } from 'node:http2';
|
|
3
3
|
import type { Socket } from 'node:net';
|
|
4
4
|
import type { Logger } from '../logger.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { InternalContext, NormalizedConfig, OutputStructure, PrintUrls, Routes, RsbuildConfig, RsbuildEntry, RsbuildMiddlewares } from '../types/index.js';
|
|
6
6
|
import type { RsbuildDevServer } from './devServer.js';
|
|
7
7
|
import type { RsbuildPreviewServer } from './previewServer.js';
|
|
8
8
|
/**
|
|
@@ -102,7 +102,7 @@ export declare const HttpCode: {
|
|
|
102
102
|
/**
|
|
103
103
|
* The `connect` app instance.
|
|
104
104
|
* Can be used to attach custom middlewares to the server.
|
|
105
|
-
*/ middlewares:
|
|
105
|
+
*/ middlewares: RsbuildMiddlewares;
|
|
106
106
|
/**
|
|
107
107
|
* Open URL in the browser after starting the server.
|
|
108
108
|
*/ open: () => Promise<void>;
|
package/dist/trace-mapping.js
CHANGED
|
@@ -24,21 +24,23 @@ for(let i = 0; i < chars.length; i++){
|
|
|
24
24
|
let c = chars.charCodeAt(i);
|
|
25
25
|
intToChar[i] = c, charToInt[c] = i;
|
|
26
26
|
}
|
|
27
|
-
function decodeInteger(reader
|
|
27
|
+
function decodeInteger(reader) {
|
|
28
28
|
let value = 0, shift = 0, integer = 0;
|
|
29
29
|
do value |= (31 & (integer = charToInt[reader.next()])) << shift, shift += 5;
|
|
30
30
|
while (32 & integer);
|
|
31
|
-
|
|
32
|
-
return value >>>= 1, shouldNegate && (value = -2147483648 | -value), relative + value;
|
|
31
|
+
return value;
|
|
33
32
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
function decodeSign(num) {
|
|
34
|
+
return 1 & num ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
35
|
+
}
|
|
36
|
+
function encodeInteger(builder, num) {
|
|
37
37
|
do {
|
|
38
|
-
let clamped = 31 &
|
|
39
|
-
(
|
|
40
|
-
}while (
|
|
41
|
-
|
|
38
|
+
let clamped = 31 & num;
|
|
39
|
+
(num >>>= 5) > 0 && (clamped |= 32), builder.write(intToChar[clamped]);
|
|
40
|
+
}while (num > 0);
|
|
41
|
+
}
|
|
42
|
+
function encodeSign(num) {
|
|
43
|
+
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
42
44
|
}
|
|
43
45
|
function hasMoreVlq(reader, max) {
|
|
44
46
|
return !(reader.pos >= max) && 44 !== reader.peek();
|
|
@@ -84,13 +86,13 @@ function decode(mappings) {
|
|
|
84
86
|
let semi = reader.indexOf(";"), line = [], sorted = !0, lastCol = 0;
|
|
85
87
|
for(genColumn = 0; reader.pos < semi;){
|
|
86
88
|
let seg;
|
|
87
|
-
(genColumn
|
|
89
|
+
(genColumn += decodeSign(decodeInteger(reader))) < lastCol && (sorted = !1), lastCol = genColumn, hasMoreVlq(reader, semi) ? (sourcesIndex += decodeSign(decodeInteger(reader)), sourceLine += decodeSign(decodeInteger(reader)), sourceColumn += decodeSign(decodeInteger(reader)), hasMoreVlq(reader, semi) ? (namesIndex += decodeSign(decodeInteger(reader)), seg = [
|
|
88
90
|
genColumn,
|
|
89
91
|
sourcesIndex,
|
|
90
92
|
sourceLine,
|
|
91
93
|
sourceColumn,
|
|
92
|
-
namesIndex
|
|
93
|
-
] : [
|
|
94
|
+
namesIndex
|
|
95
|
+
]) : seg = [
|
|
94
96
|
genColumn,
|
|
95
97
|
sourcesIndex,
|
|
96
98
|
sourceLine,
|
|
@@ -117,7 +119,7 @@ function encode(decoded) {
|
|
|
117
119
|
let genColumn = 0;
|
|
118
120
|
for(let j = 0; j < line.length; j++){
|
|
119
121
|
let segment = line[j];
|
|
120
|
-
j > 0 && writer.write(44),
|
|
122
|
+
j > 0 && writer.write(44), encodeInteger(writer, encodeSign(segment[0] - genColumn)), genColumn = segment[0], 1 !== segment.length && (encodeInteger(writer, encodeSign(segment[1] - sourcesIndex)), encodeInteger(writer, encodeSign(segment[2] - sourceLine)), encodeInteger(writer, encodeSign(segment[3] - sourceColumn)), sourcesIndex = segment[1], sourceLine = segment[2], sourceColumn = segment[3], 4 !== segment.length && (encodeInteger(writer, encodeSign(segment[4] - namesIndex)), namesIndex = segment[4]));
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
return writer.flush();
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1429,7 +1429,19 @@ export type NormalizedHtmlConfig = HtmlConfig & {
|
|
|
1429
1429
|
export type ProgressBarConfig = {
|
|
1430
1430
|
id?: string;
|
|
1431
1431
|
};
|
|
1432
|
-
export
|
|
1432
|
+
export interface RsbuildServerResponse extends ServerResponse {
|
|
1433
|
+
/**
|
|
1434
|
+
* Flush buffered gzip data without ending the response.
|
|
1435
|
+
* May be absent when compression is disabled or the middleware has not run.
|
|
1436
|
+
*/ flush?: () => void;
|
|
1437
|
+
}
|
|
1438
|
+
export type RequestHandler = (req: Connect.IncomingMessage, res: RsbuildServerResponse, next: Connect.NextFunction) => unknown;
|
|
1439
|
+
export interface RsbuildMiddlewares extends Connect.Server {
|
|
1440
|
+
use(fn: RequestHandler): this;
|
|
1441
|
+
use(fn: Connect.ServerHandle): this;
|
|
1442
|
+
use(route: string, fn: RequestHandler): this;
|
|
1443
|
+
use(route: string, fn: Connect.ServerHandle): this;
|
|
1444
|
+
}
|
|
1433
1445
|
export type EnvironmentAPI = Record<string, {
|
|
1434
1446
|
/**
|
|
1435
1447
|
* Get stats info about current environment.
|