@rsbuild/core 2.2.13 → 2.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/@rstackjs/load-config/index.d.ts +10 -1
- package/compiled/@rstackjs/load-config/package.json +1 -1
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/client/hmr.js +5 -1
- package/dist/helpers/workspace.d.ts +1 -0
- package/dist/hooks.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/m.js +94 -151
- package/dist/m.js.LICENSE.txt +0 -13
- package/dist/manifest-plugin.js +1 -1
- package/dist/server/helper.d.ts +2 -1
- package/dist/server/watchFiles.d.ts +3 -1
- package/dist/types/config.d.ts +5 -2
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/plugin.d.ts +5 -1
- package/dist/types/rsbuild.d.ts +1 -1
- package/package.json +7 -9
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnExitFn, OnRestartFn, Rspack } from './types/index.js';
|
|
1
|
+
import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnClosePreviewServerFn, OnExitFn, OnRestartFn, Rspack } from './types/index.js';
|
|
2
2
|
export declare function createEnvironmentAsyncHook<Callback extends (...args: any[]) => any>(): EnvironmentAsyncHook<Callback>;
|
|
3
3
|
export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
|
|
4
4
|
export declare function initHooks(): {
|
|
@@ -10,6 +10,7 @@ export declare function initHooks(): {
|
|
|
10
10
|
onBeforeDevCompile: AsyncHook<OnBeforeDevCompileFn>;
|
|
11
11
|
onAfterDevCompile: AsyncHook<OnAfterDevCompileFn>;
|
|
12
12
|
onCloseDevServer: AsyncHook<OnCloseDevServerFn>;
|
|
13
|
+
onClosePreviewServer: AsyncHook<OnClosePreviewServerFn>;
|
|
13
14
|
onAfterStartDevServer: AsyncHook<OnAfterStartDevServerFn>;
|
|
14
15
|
onBeforeStartDevServer: AsyncHook<OnBeforeStartDevServerFn>;
|
|
15
16
|
onAfterStartPreviewServer: AsyncHook<OnAfterStartPreviewServerFn>;
|
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, 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';
|
|
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, OnClosePreviewServerFn, 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/m.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! LICENSE: m.js.LICENSE.txt */
|
|
2
|
-
let
|
|
2
|
+
let 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, { format as external_node_util_format, promisify, stripVTControlCharacters } from "node:util";
|
|
6
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
|
-
import node_fs, { existsSync } from "node:fs";
|
|
8
|
+
import node_fs, { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import node_os, { constants } from "node:os";
|
|
10
10
|
import node_process from "node:process";
|
|
11
11
|
import { URL as external_node_url_URL, pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
@@ -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 as external_node_events_once } from "node:events";
|
|
16
|
+
import { finished } from "node:stream";
|
|
16
17
|
import { isIP } from "node:net";
|
|
17
18
|
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";
|
|
18
19
|
import { cachedImport as cachedImport_cachedImport, getTinyglobby } from "./r.js";
|
|
@@ -121,39 +122,6 @@ moduleFactories.add({
|
|
|
121
122
|
}
|
|
122
123
|
module.exports.f = expand;
|
|
123
124
|
},
|
|
124
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ee-first/1.1.1/7d7aff2abffb03f454b885edc2f03bd078376c8cde75af0c324753fee26268de/node_modules/ee-first/index.js" (module) {
|
|
125
|
-
function listener(event, done) {
|
|
126
|
-
return function onevent(arg1) {
|
|
127
|
-
for(var args = Array(arguments.length), i = 0; i < args.length; i++)args[i] = arguments[i];
|
|
128
|
-
done('error' === event ? arg1 : null, this, event, args);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
module.exports = function first(stuff, done) {
|
|
132
|
-
if (!Array.isArray(stuff)) throw TypeError('arg must be an array of [ee, events...] arrays');
|
|
133
|
-
for(var cleanups = [], i = 0; i < stuff.length; i++){
|
|
134
|
-
var arr = stuff[i];
|
|
135
|
-
if (!Array.isArray(arr) || arr.length < 2) throw TypeError('each array member must be [ee, events...]');
|
|
136
|
-
for(var ee = arr[0], j = 1; j < arr.length; j++){
|
|
137
|
-
var event = arr[j], fn = listener(event, callback);
|
|
138
|
-
ee.on(event, fn), cleanups.push({
|
|
139
|
-
ee: ee,
|
|
140
|
-
event: event,
|
|
141
|
-
fn: fn
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function callback() {
|
|
146
|
-
cleanup(), done.apply(null, arguments);
|
|
147
|
-
}
|
|
148
|
-
function cleanup() {
|
|
149
|
-
for(var x, i = 0; i < cleanups.length; i++)(x = cleanups[i]).ee.removeListener(x.event, x.fn);
|
|
150
|
-
}
|
|
151
|
-
function thunk(fn) {
|
|
152
|
-
done = fn;
|
|
153
|
-
}
|
|
154
|
-
return thunk.cancel = cleanup, thunk;
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
125
|
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js" (module) {
|
|
158
126
|
let path = __rspack_createRequire_require("path"), fs = __rspack_createRequire_require("fs"), os = __rspack_createRequire_require("os"), url = __rspack_createRequire_require("url"), fsReadFileAsync = fs.promises.readFile;
|
|
159
127
|
function getDefaultSearchPlaces(name, sync) {
|
|
@@ -324,74 +292,8 @@ moduleFactories.add({
|
|
|
324
292
|
};
|
|
325
293
|
};
|
|
326
294
|
},
|
|
327
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/
|
|
328
|
-
|
|
329
|
-
var asyncHooks = tryRequireAsyncHooks(), first = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ee-first/1.1.1/7d7aff2abffb03f454b885edc2f03bd078376c8cde75af0c324753fee26268de/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
|
|
330
|
-
process.nextTick(fn.bind.apply(fn, arguments));
|
|
331
|
-
};
|
|
332
|
-
function onFinished(msg, listener) {
|
|
333
|
-
return !1 !== isFinished(msg) ? defer(listener, null, msg) : attachListener(msg, wrap(listener)), msg;
|
|
334
|
-
}
|
|
335
|
-
function isFinished(msg) {
|
|
336
|
-
var socket = msg.socket;
|
|
337
|
-
return 'boolean' == typeof msg.finished ? !!(msg.finished || socket && !socket.writable) : 'boolean' == typeof msg.complete ? !!(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable) : void 0;
|
|
338
|
-
}
|
|
339
|
-
function attachFinishedListener(msg, callback) {
|
|
340
|
-
var eeMsg, eeSocket, finished = !1;
|
|
341
|
-
function onFinish(error) {
|
|
342
|
-
eeMsg.cancel(), eeSocket.cancel(), finished = !0, callback(error);
|
|
343
|
-
}
|
|
344
|
-
function onSocket(socket) {
|
|
345
|
-
msg.removeListener('socket', onSocket), finished || eeMsg === eeSocket && (eeSocket = first([
|
|
346
|
-
[
|
|
347
|
-
socket,
|
|
348
|
-
'error',
|
|
349
|
-
'close'
|
|
350
|
-
]
|
|
351
|
-
], onFinish));
|
|
352
|
-
}
|
|
353
|
-
(eeMsg = eeSocket = first([
|
|
354
|
-
[
|
|
355
|
-
msg,
|
|
356
|
-
'end',
|
|
357
|
-
'finish'
|
|
358
|
-
]
|
|
359
|
-
], onFinish), msg.socket) ? onSocket(msg.socket) : (msg.on('socket', onSocket), void 0 === msg.socket && patchAssignSocket(msg, onSocket));
|
|
360
|
-
}
|
|
361
|
-
function attachListener(msg, listener) {
|
|
362
|
-
var attached = msg.__onFinished;
|
|
363
|
-
attached && attached.queue || (attached = msg.__onFinished = createListener(msg), attachFinishedListener(msg, attached)), attached.queue.push(listener);
|
|
364
|
-
}
|
|
365
|
-
function createListener(msg) {
|
|
366
|
-
function listener(err) {
|
|
367
|
-
if (msg.__onFinished === listener && (msg.__onFinished = null), listener.queue) {
|
|
368
|
-
var queue = listener.queue;
|
|
369
|
-
listener.queue = null;
|
|
370
|
-
for(var i = 0; i < queue.length; i++)queue[i](err, msg);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return listener.queue = [], listener;
|
|
374
|
-
}
|
|
375
|
-
function patchAssignSocket(res, callback) {
|
|
376
|
-
var assignSocket = res.assignSocket;
|
|
377
|
-
'function' == typeof assignSocket && (res.assignSocket = function _assignSocket(socket) {
|
|
378
|
-
assignSocket.call(this, socket), callback(socket);
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
function tryRequireAsyncHooks() {
|
|
382
|
-
try {
|
|
383
|
-
return rspackRequire("async_hooks");
|
|
384
|
-
} catch (e) {
|
|
385
|
-
return {};
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function wrap(fn) {
|
|
389
|
-
var res;
|
|
390
|
-
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/index.js" (module) {
|
|
394
|
-
let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/req.js");
|
|
295
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/index.js" (module) {
|
|
296
|
+
let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
|
|
395
297
|
async function processResult(ctx, result) {
|
|
396
298
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
397
299
|
default: obj
|
|
@@ -464,8 +366,8 @@ moduleFactories.add({
|
|
|
464
366
|
});
|
|
465
367
|
};
|
|
466
368
|
},
|
|
467
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
468
|
-
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
369
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/options.js" (module) {
|
|
370
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
|
|
469
371
|
module.exports = async function options(config, file) {
|
|
470
372
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
471
373
|
config.parser = await req(config.parser, file);
|
|
@@ -485,8 +387,8 @@ moduleFactories.add({
|
|
|
485
387
|
return config;
|
|
486
388
|
};
|
|
487
389
|
},
|
|
488
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
489
|
-
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
390
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/plugins.js" (module) {
|
|
391
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
|
|
490
392
|
async function load(plugin, options, file) {
|
|
491
393
|
try {
|
|
492
394
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -502,7 +404,7 @@ moduleFactories.add({
|
|
|
502
404
|
}), list;
|
|
503
405
|
};
|
|
504
406
|
},
|
|
505
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
407
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js" (module) {
|
|
506
408
|
let tsx, jiti, { createRequire } = __rspack_createRequire_require("node:module"), { pathToFileURL } = __rspack_createRequire_require("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
507
409
|
module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
|
|
508
410
|
let url = createRequire(rootFile).resolve(name);
|
|
@@ -531,9 +433,6 @@ moduleFactories.add({
|
|
|
531
433
|
throw Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.map((error)=>error.message).join('\n')}`);
|
|
532
434
|
};
|
|
533
435
|
},
|
|
534
|
-
async_hooks (module) {
|
|
535
|
-
module.exports = __rspack_createRequire_require("async_hooks");
|
|
536
|
-
},
|
|
537
436
|
process (module) {
|
|
538
437
|
module.exports = __rspack_createRequire_require("process");
|
|
539
438
|
},
|
|
@@ -758,7 +657,7 @@ function setDotProp(obj, keys, val) {
|
|
|
758
657
|
}
|
|
759
658
|
}
|
|
760
659
|
function setByType(obj, transforms) {
|
|
761
|
-
for (let [key, transform] of Object.entries(transforms))transform.shouldTransform && (obj[key] = [
|
|
660
|
+
for (let [key, transform] of Object.entries(transforms))transform.shouldTransform && key in obj && (obj[key] = [
|
|
762
661
|
obj[key]
|
|
763
662
|
].flat(), "function" == typeof transform.transformFunction && (obj[key] = obj[key].map(transform.transformFunction)));
|
|
764
663
|
}
|
|
@@ -791,8 +690,11 @@ var CACError = class extends Error {
|
|
|
791
690
|
};
|
|
792
691
|
if ("u" > typeof process) {
|
|
793
692
|
let runtimeName;
|
|
794
|
-
runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node", runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}
|
|
693
|
+
runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node", runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
|
795
694
|
} else runtimeInfo = "u" < typeof navigator ? "unknown" : `${navigator.platform} ${navigator.userAgent}`;
|
|
695
|
+
function getRuntimeProcessArgs() {
|
|
696
|
+
return "u" < typeof process ? void 0 : process.argv;
|
|
697
|
+
}
|
|
796
698
|
var Command = class {
|
|
797
699
|
rawName;
|
|
798
700
|
description;
|
|
@@ -965,6 +867,7 @@ var Command = class {
|
|
|
965
867
|
}
|
|
966
868
|
parse(argv, { run = !0 } = {}) {
|
|
967
869
|
if (!argv) {
|
|
870
|
+
let runtimeProcessArgs = getRuntimeProcessArgs();
|
|
968
871
|
if (!runtimeProcessArgs) throw Error("No argv provided and runtime process argv is not available.");
|
|
969
872
|
argv = runtimeProcessArgs;
|
|
970
873
|
}
|
|
@@ -2425,6 +2328,7 @@ function initHooks() {
|
|
|
2425
2328
|
onBeforeDevCompile: createAsyncHook(),
|
|
2426
2329
|
onAfterDevCompile: createAsyncHook(),
|
|
2427
2330
|
onCloseDevServer: createAsyncHook(),
|
|
2331
|
+
onClosePreviewServer: createAsyncHook(),
|
|
2428
2332
|
onAfterStartDevServer: createAsyncHook(),
|
|
2429
2333
|
onBeforeStartDevServer: createAsyncHook(),
|
|
2430
2334
|
onAfterStartPreviewServer: createAsyncHook(),
|
|
@@ -2495,8 +2399,14 @@ class BrowserslistError extends Error {
|
|
|
2495
2399
|
let isFileCache = {};
|
|
2496
2400
|
function isFile(file) {
|
|
2497
2401
|
if (file in isFileCache) return isFileCache[file];
|
|
2498
|
-
|
|
2499
|
-
|
|
2402
|
+
try {
|
|
2403
|
+
let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
|
|
2404
|
+
return isFileCache[file] = result, result;
|
|
2405
|
+
} catch (error) {
|
|
2406
|
+
let { code } = error;
|
|
2407
|
+
if ('ENOENT' === code || 'EACCES' === code || 'ERR_ACCESS_DENIED' === code) return !1;
|
|
2408
|
+
throw error;
|
|
2409
|
+
}
|
|
2500
2410
|
}
|
|
2501
2411
|
function dist_check(section) {
|
|
2502
2412
|
let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
|
|
@@ -2510,7 +2420,7 @@ function parsePackage(file) {
|
|
|
2510
2420
|
let list = config.browserslist;
|
|
2511
2421
|
for(let i in Array.isArray(list) && (list = {
|
|
2512
2422
|
defaults: list
|
|
2513
|
-
}), 'string' == typeof list && (list = parseConfig(list)), list)dist_check(list[i]);
|
|
2423
|
+
}), 'string' == typeof list && (list = parseConfig(list)), list)dist_check(list[i]), 'string' == typeof list[i] && (list[i] = parseConfig(list[i]).defaults);
|
|
2514
2424
|
return list;
|
|
2515
2425
|
}
|
|
2516
2426
|
let IS_SECTION = /^\s*\[(.+)]\s*$/;
|
|
@@ -3175,6 +3085,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
3175
3085
|
onCloseBuild: hooks.onCloseBuild.tap,
|
|
3176
3086
|
onBeforeBuild: hooks.onBeforeBuild.tap,
|
|
3177
3087
|
onCloseDevServer: hooks.onCloseDevServer.tap,
|
|
3088
|
+
onClosePreviewServer: hooks.onClosePreviewServer.tap,
|
|
3178
3089
|
onBeforeDevCompile: hooks.onBeforeDevCompile.tap,
|
|
3179
3090
|
onAfterDevCompile: hooks.onAfterDevCompile.tap,
|
|
3180
3091
|
onDevCompileDone: hooks.onAfterDevCompile.tap,
|
|
@@ -3303,7 +3214,7 @@ function createPublicContext(context) {
|
|
|
3303
3214
|
async function createContext(options, userConfig, logger, loadConfigResult) {
|
|
3304
3215
|
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();
|
|
3305
3216
|
return {
|
|
3306
|
-
version: "2.
|
|
3217
|
+
version: "2.3.0-beta.0",
|
|
3307
3218
|
rootPath,
|
|
3308
3219
|
configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
|
|
3309
3220
|
configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
|
|
@@ -4114,9 +4025,9 @@ let getChokidar = cachedImport_cachedImport(()=>import("./chokidar.js").then((m)
|
|
|
4114
4025
|
'unlink'
|
|
4115
4026
|
];
|
|
4116
4027
|
async function setupWatchFiles(options) {
|
|
4117
|
-
let { config, root, buildManager } = options, { hmr, liveReload } = config.dev;
|
|
4028
|
+
let { config, root, logger, buildManager } = options, { hmr, liveReload } = config.dev;
|
|
4118
4029
|
if (!hmr && !liveReload || !buildManager) return;
|
|
4119
|
-
let closeDevFilesWatcher = await watchDevFiles(config.dev, buildManager, root), serverFilesWatcher = await watchServerFiles(config.server, buildManager, root);
|
|
4030
|
+
let closeDevFilesWatcher = await watchDevFiles(config.dev, buildManager, root, logger), serverFilesWatcher = await watchServerFiles(config.server, buildManager, root, logger);
|
|
4120
4031
|
return {
|
|
4121
4032
|
async close () {
|
|
4122
4033
|
await Promise.all([
|
|
@@ -4126,22 +4037,22 @@ async function setupWatchFiles(options) {
|
|
|
4126
4037
|
}
|
|
4127
4038
|
};
|
|
4128
4039
|
}
|
|
4129
|
-
async function watchDevFiles(devConfig, buildManager, root) {
|
|
4040
|
+
async function watchDevFiles(devConfig, buildManager, root, logger) {
|
|
4130
4041
|
let { watchFiles } = devConfig;
|
|
4131
4042
|
if (!watchFiles) return;
|
|
4132
4043
|
let watchers = [];
|
|
4133
4044
|
for (let { paths, events, options, type } of helpers_castArray(watchFiles)){
|
|
4134
|
-
let watchOptions = prepareWatchOptions(paths, options, type, events), watcher = await startWatchFiles(watchOptions, buildManager, root);
|
|
4045
|
+
let watchOptions = prepareWatchOptions(paths, options, type, events), watcher = await startWatchFiles(watchOptions, buildManager, root, logger);
|
|
4135
4046
|
watcher && watchers.push(watcher);
|
|
4136
4047
|
}
|
|
4137
4048
|
return async ()=>{
|
|
4138
4049
|
for (let watcher of watchers)await watcher.close();
|
|
4139
4050
|
};
|
|
4140
4051
|
}
|
|
4141
|
-
function watchServerFiles({ publicDir }, buildManager, root) {
|
|
4052
|
+
function watchServerFiles({ publicDir }, buildManager, root, logger) {
|
|
4142
4053
|
if (!publicDir.length) return;
|
|
4143
4054
|
let watchPaths = publicDir.filter((item)=>item.watch).map((item)=>item.name);
|
|
4144
|
-
if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), buildManager, root);
|
|
4055
|
+
if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), buildManager, root, logger);
|
|
4145
4056
|
}
|
|
4146
4057
|
function prepareWatchOptions(paths, options = {}, type, events) {
|
|
4147
4058
|
return {
|
|
@@ -4154,7 +4065,7 @@ function prepareWatchOptions(paths, options = {}, type, events) {
|
|
|
4154
4065
|
};
|
|
4155
4066
|
}
|
|
4156
4067
|
let GLOB_REGEX = /[*?{}[\]()!+|]/;
|
|
4157
|
-
async function createChokidar(pathOrGlobs, root, options) {
|
|
4068
|
+
async function createChokidar(pathOrGlobs, root, options, logger) {
|
|
4158
4069
|
let { default: chokidar } = await getChokidar(), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
4159
4070
|
if (globPatterns.length) {
|
|
4160
4071
|
let { glob } = await getTinyglobby();
|
|
@@ -4163,14 +4074,17 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
4163
4074
|
absolute: !0
|
|
4164
4075
|
})))watchFiles.add(file);
|
|
4165
4076
|
}
|
|
4166
|
-
|
|
4077
|
+
let watcher = chokidar.watch(Array.from(watchFiles), options);
|
|
4078
|
+
return watcher.on('error', (error)=>{
|
|
4079
|
+
logger.error('File watcher error:', error);
|
|
4080
|
+
}), watcher;
|
|
4167
4081
|
}
|
|
4168
|
-
async function startWatchFiles({ paths, events, options, type = 'reload-page' }, buildManager, root) {
|
|
4082
|
+
async function startWatchFiles({ paths, events, options, type = 'reload-page' }, buildManager, root, logger) {
|
|
4169
4083
|
if ('reload-page' !== type || events?.length === 0) return;
|
|
4170
4084
|
let watcher = await createChokidar(paths, root, {
|
|
4171
4085
|
ignoreInitial: !0,
|
|
4172
4086
|
...options
|
|
4173
|
-
}), reloadPage = ()=>{
|
|
4087
|
+
}, logger), reloadPage = ()=>{
|
|
4174
4088
|
buildManager.socketServer.sendMessage({
|
|
4175
4089
|
type: 'full-reload'
|
|
4176
4090
|
});
|
|
@@ -4234,7 +4148,7 @@ function watchFilesForRestart({ watchFiles, context, restartContext }) {
|
|
|
4234
4148
|
ignoreInitial: !0,
|
|
4235
4149
|
ignorePermissionErrors: !0,
|
|
4236
4150
|
...options
|
|
4237
|
-
}), cwd = options?.cwd ?? root;
|
|
4151
|
+
}, logger), cwd = options?.cwd ?? root;
|
|
4238
4152
|
for (let event of events ? new Set(events) : DEFAULT_WATCH_FILE_EVENTS)watcher.on(event, (filePath)=>onWatchEvent(event, filePath, cwd));
|
|
4239
4153
|
return watcher;
|
|
4240
4154
|
} catch (error) {
|
|
@@ -4890,7 +4804,25 @@ let normalizeCleanDistPath = (userOptions)=>{
|
|
|
4890
4804
|
...defaultOptions,
|
|
4891
4805
|
...userOptions
|
|
4892
4806
|
};
|
|
4893
|
-
}
|
|
4807
|
+
};
|
|
4808
|
+
function findWorkspaceRoot(root) {
|
|
4809
|
+
let packageRoot, current = root;
|
|
4810
|
+
for(;;){
|
|
4811
|
+
if (isFileSync(join(current, 'pnpm-workspace.yaml')) || isFileSync(join(current, 'lerna.json'))) return current;
|
|
4812
|
+
let packageJson = join(current, 'package.json');
|
|
4813
|
+
if (isFileSync(packageJson)) {
|
|
4814
|
+
packageRoot ??= current;
|
|
4815
|
+
try {
|
|
4816
|
+
let pkg = JSON.parse(readFileSync(packageJson, 'utf8'));
|
|
4817
|
+
if (pkg?.workspaces) return current;
|
|
4818
|
+
} catch {}
|
|
4819
|
+
}
|
|
4820
|
+
let parent = dirname(current);
|
|
4821
|
+
if (parent === current) return packageRoot ?? root;
|
|
4822
|
+
current = parent;
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
let getConsolePureFuncs = (methods)=>methods.map((method)=>`console.${method}`), ALL_CONSOLE_PURE_FUNCS = getConsolePureFuncs([
|
|
4894
4826
|
'assert',
|
|
4895
4827
|
'clear',
|
|
4896
4828
|
'count',
|
|
@@ -4950,7 +4882,7 @@ function parseMinifyOptions(config) {
|
|
|
4950
4882
|
cssOptions: minify.cssOptions
|
|
4951
4883
|
};
|
|
4952
4884
|
}
|
|
4953
|
-
var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
4885
|
+
var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/index.js"));
|
|
4954
4886
|
async function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4955
4887
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
4956
4888
|
targets,
|
|
@@ -4973,7 +4905,9 @@ let clonePostCSSConfig = (config)=>({
|
|
|
4973
4905
|
async function loadUserPostcssrc(root, postcssrcCache) {
|
|
4974
4906
|
let cached = postcssrcCache.get(root);
|
|
4975
4907
|
if (cached) return clonePostCSSConfig(await cached);
|
|
4976
|
-
let promise = postcss_load_config_src_default()({}, root
|
|
4908
|
+
let promise = postcss_load_config_src_default()({}, root, {
|
|
4909
|
+
stopDir: findWorkspaceRoot(root)
|
|
4910
|
+
}).catch((err)=>{
|
|
4977
4911
|
if (err.message?.includes('No PostCSS Config found')) return {};
|
|
4978
4912
|
throw err;
|
|
4979
4913
|
});
|
|
@@ -5242,7 +5176,7 @@ let calcFileSize = (len)=>{
|
|
|
5242
5176
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
5243
5177
|
}, COMPRESSIBLE_REGEX = /\.(?:js|mjs|cjs|jsx|ts|tsx|mts|cts|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i;
|
|
5244
5178
|
async function getFileSizes(options, compilation, processAssets) {
|
|
5245
|
-
if (!1 === options.detail && !1 === options.total) return [];
|
|
5179
|
+
if ((!1 === options.detail || 0 === options.detail) && !1 === options.total) return [];
|
|
5246
5180
|
let { exclude, include } = options, compression = getCompression(options.compressed), fileSizes = [], compilationAssets = compilation.assets, names = Object.getOwnPropertyNames(compilationAssets);
|
|
5247
5181
|
return await processAssets(names, async (assetName, index)=>{
|
|
5248
5182
|
let queryIndex, filePath = -1 === (queryIndex = assetName.indexOf('?')) ? assetName : assetName.slice(0, queryIndex);
|
|
@@ -5264,7 +5198,7 @@ async function getFileSizes(options, compilation, processAssets) {
|
|
|
5264
5198
|
}), fileSizes.filter(Boolean);
|
|
5265
5199
|
}
|
|
5266
5200
|
function printFileSizes(options, fileSizes, rootPath, distPath, environmentName, previousSizes, saveSnapshot) {
|
|
5267
|
-
let logs = [], compression = getCompression(options.compressed), prev = previousSizes?.[environmentName], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, prevType = prev?.compressionType ?? (!!prev?.totalGzipSize && 'gzip'), showCompressedDiff = showDiff && prevType === compression.type, showTotal = !1 !== options.total;
|
|
5201
|
+
let logs = [], compression = getCompression(options.compressed), prev = previousSizes?.[environmentName], detailLimit = 'number' == typeof options.detail ? Math.max(0, Math.floor(options.detail)) : 1 / 0, showDetail = !1 !== options.detail && detailLimit > 0, showDiff = !1 !== options.diff && null !== previousSizes, prevType = prev?.compressionType ?? (!!prev?.totalGzipSize && 'gzip'), showCompressedDiff = showDiff && prevType === compression.type, showTotal = !1 !== options.total;
|
|
5268
5202
|
if (!showTotal && !showDetail) return {
|
|
5269
5203
|
logs
|
|
5270
5204
|
};
|
|
@@ -5360,16 +5294,17 @@ function printFileSizes(options, fileSizes, rootPath, distPath, environmentName,
|
|
|
5360
5294
|
totalBrotliSize: options.compressed && 'brotli' === compression.type ? totalCompressedSize : void 0
|
|
5361
5295
|
}) : null;
|
|
5362
5296
|
if (showDetail) {
|
|
5363
|
-
let maxFileLength = Math.max(showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = totalSizeLabelLength
|
|
5364
|
-
for (let asset of
|
|
5365
|
-
let showCompressedHeader = !!(options.compressed &&
|
|
5366
|
-
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showCompressedHeader && compression.header)),
|
|
5297
|
+
let displayedAssets = assets.slice(Math.max(0, assets.length - detailLimit)), maxFileLength = Math.max(showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = totalSizeLabelLength;
|
|
5298
|
+
for (let asset of displayedAssets)asset.filenameLength > maxFileLength && (maxFileLength = asset.filenameLength), asset.sizeLabelLength > maxSizeLength && (maxSizeLength = asset.sizeLabelLength);
|
|
5299
|
+
let showCompressedHeader = !!(options.compressed && (showTotal ? assets : displayedAssets).some((asset)=>null !== asset.compressedSize));
|
|
5300
|
+
for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showCompressedHeader && compression.header)), displayedAssets)){
|
|
5367
5301
|
let { sizeLabel, filenameLabel } = asset, { sizeLabelLength, compressedSizeLabel, filenameLength } = asset;
|
|
5368
5302
|
sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
|
|
5369
5303
|
let log = `${filenameLabel} ${sizeLabel}`;
|
|
5370
5304
|
compressedSizeLabel && (log += ` ${compressedSizeLabel}`), logs.push(log);
|
|
5371
5305
|
}
|
|
5372
|
-
|
|
5306
|
+
let hiddenCount = assets.length - displayedAssets.length;
|
|
5307
|
+
if (hiddenCount > 0 && logs.push(color.dim(`... ${hiddenCount} more ${1 === hiddenCount ? 'file' : 'files'} not shown`)), showTotal) {
|
|
5373
5308
|
logs.push('');
|
|
5374
5309
|
let customTotal = getCustomTotal();
|
|
5375
5310
|
if (customTotal) logs.push(customTotal);
|
|
@@ -5691,7 +5626,7 @@ async function getMetaTags(entryName, config, templateContent) {
|
|
|
5691
5626
|
entryName
|
|
5692
5627
|
}
|
|
5693
5628
|
});
|
|
5694
|
-
return templateContent && metaTags.charset && /<meta[^>]
|
|
5629
|
+
return templateContent && metaTags.charset && /<meta\b(?:[^>"']|"[^"]*"|'[^']*')*?\scharset\s*=/i.test(templateContent) && delete metaTags.charset, metaTags;
|
|
5695
5630
|
}
|
|
5696
5631
|
function getTemplateParameters(entryName, config, assetPrefix) {
|
|
5697
5632
|
return async (compilation, assets, assetTags, pluginOptions)=>{
|
|
@@ -6058,7 +5993,7 @@ function doesChunkBelongToHtml({ chunk, htmlPluginData }) {
|
|
|
6058
5993
|
let { options } = htmlPluginData.plugin;
|
|
6059
5994
|
return recursiveChunkEntryNames(chunk).some((chunkName)=>isChunksFiltered(chunkName, options?.chunks, options?.excludeChunks));
|
|
6060
5995
|
}
|
|
6061
|
-
let getManifestPlugin = cachedImport_cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/
|
|
5996
|
+
let getManifestPlugin = cachedImport_cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/5e5a5791f2423171b25b8669ed999592c8e86d6947ab7c911dfb27037dbbb5ae/node_modules/rspack-manifest-plugin/dist/index.js"))), isCSSPath = (filePath)=>filePath.endsWith('.css');
|
|
6062
5997
|
function normalizeManifestObjectConfig(manifest) {
|
|
6063
5998
|
let defaultOptions = {
|
|
6064
5999
|
prefix: !0,
|
|
@@ -6636,7 +6571,6 @@ function parseTokenList(str) {
|
|
|
6636
6571
|
}
|
|
6637
6572
|
return start !== end && list.push(str.substring(start, end)), list;
|
|
6638
6573
|
}
|
|
6639
|
-
var on_finished_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js"));
|
|
6640
6574
|
function getEtag(stat) {
|
|
6641
6575
|
let mtime = stat.mtime.getTime().toString(16), size = stat.size.toString(16);
|
|
6642
6576
|
return `W/"${size}-${mtime}"`;
|
|
@@ -6852,7 +6786,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
|
6852
6786
|
default:
|
|
6853
6787
|
sendError(res, 500);
|
|
6854
6788
|
}
|
|
6855
|
-
}), readStream.pipe(res),
|
|
6789
|
+
}), readStream.pipe(res), finished(res, cleanup);
|
|
6856
6790
|
});
|
|
6857
6791
|
};
|
|
6858
6792
|
}
|
|
@@ -7661,7 +7595,7 @@ let faviconFallbackMiddleware = (req, res, next)=>{
|
|
|
7661
7595
|
'/favicon.ico' === req.url ? (res.statusCode = 204, res.end()) : next();
|
|
7662
7596
|
}, getRequestLoggerMiddleware = (logger)=>(req, res, next)=>{
|
|
7663
7597
|
let _startAt = process.hrtime();
|
|
7664
|
-
|
|
7598
|
+
finished(res, ()=>{
|
|
7665
7599
|
let method = req.method, url = req.originalUrl || req.url, status = Number(res.statusCode), statusColor = status >= 500 ? color.red : status >= 400 ? color.yellow : status >= 300 ? color.cyan : status >= 200 ? color.green : (res)=>res, endAt = process.hrtime(), totalTime = (endAt[0] - _startAt[0]) * 1e3 + (endAt[1] - _startAt[1]) * 1e-6;
|
|
7666
7600
|
logger.debug(`${statusColor(status)} ${method} ${url} ${color.dim(`${totalTime.toFixed(3)} ms`)}`);
|
|
7667
7601
|
}), next();
|
|
@@ -7897,7 +7831,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
7897
7831
|
dev: !0
|
|
7898
7832
|
});
|
|
7899
7833
|
middlewares.use(function publicDirMiddleware(req, res, next) {
|
|
7900
|
-
sirvMiddleware(req, res, next);
|
|
7834
|
+
req.method && 'GET' !== req.method && 'HEAD' !== req.method ? next() : sirvMiddleware(req, res, next);
|
|
7901
7835
|
});
|
|
7902
7836
|
}
|
|
7903
7837
|
}
|
|
@@ -8513,6 +8447,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8513
8447
|
];
|
|
8514
8448
|
return runCompile ? context.hooks.onBeforeCreateCompiler.tapOnce(beforeCreateCompiler) : await beforeCreateCompiler(), state.buildManager = runCompile ? await startCompile() : void 0, state.fileWatcher = await setupWatchFiles({
|
|
8515
8449
|
config,
|
|
8450
|
+
logger,
|
|
8516
8451
|
buildManager: state.buildManager,
|
|
8517
8452
|
root: context.rootPath
|
|
8518
8453
|
}), state.devMiddlewares = await getDevMiddlewares({
|
|
@@ -8543,7 +8478,7 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
|
8543
8478
|
serverConfig,
|
|
8544
8479
|
middlewares
|
|
8545
8480
|
}), cleanupGracefulShutdown = setupGracefulShutdown(), serverTerminator = getServerTerminator(httpServer), closingPromise = null, closeServer = async ()=>(closingPromise || (closingPromise = (async ()=>{
|
|
8546
|
-
removeCleanup(closeServer), cleanupGracefulShutdown(), cleanupCliShortcuts?.(), await serverTerminator();
|
|
8481
|
+
removeCleanup(closeServer), cleanupGracefulShutdown(), cleanupCliShortcuts?.(), await serverTerminator(), await context.hooks.onClosePreviewServer.callBatch();
|
|
8547
8482
|
})()), closingPromise), printUrls = (options)=>printServerURLs({
|
|
8548
8483
|
urls,
|
|
8549
8484
|
port,
|
|
@@ -9245,7 +9180,13 @@ try {
|
|
|
9245
9180
|
name: 'rsbuild:define',
|
|
9246
9181
|
setup (api) {
|
|
9247
9182
|
api.modifyBundlerChain((chain, { CHAIN_ID, rspack, environment })=>{
|
|
9248
|
-
let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)),
|
|
9183
|
+
let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)), envPrefix = 'import.meta.env.', userEnv = Object.create(null);
|
|
9184
|
+
for (let [key, value] of Object.entries(config.source.define)){
|
|
9185
|
+
if (!key.startsWith(envPrefix)) continue;
|
|
9186
|
+
let name = key.slice(envPrefix.length);
|
|
9187
|
+
'' === name || name.includes('.') || (userEnv[name] = value);
|
|
9188
|
+
}
|
|
9189
|
+
let mergedDefine = {
|
|
9249
9190
|
...{
|
|
9250
9191
|
'import.meta.env': {
|
|
9251
9192
|
MODE: JSON.stringify(config.mode),
|
|
@@ -9253,7 +9194,8 @@ try {
|
|
|
9253
9194
|
PROD: 'production' === config.mode,
|
|
9254
9195
|
SSR: 'node' === config.output.target,
|
|
9255
9196
|
BASE_URL: baseUrl,
|
|
9256
|
-
ASSET_PREFIX: assetPrefix
|
|
9197
|
+
ASSET_PREFIX: assetPrefix,
|
|
9198
|
+
...userEnv
|
|
9257
9199
|
},
|
|
9258
9200
|
'process.env.BASE_URL': baseUrl,
|
|
9259
9201
|
'process.env.ASSET_PREFIX': assetPrefix
|
|
@@ -9674,7 +9616,7 @@ try {
|
|
|
9674
9616
|
return;
|
|
9675
9617
|
}
|
|
9676
9618
|
}
|
|
9677
|
-
api.logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow('@rsdoctor/
|
|
9619
|
+
api.logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow('@rsdoctor/core@latest'))} package.`);
|
|
9678
9620
|
});
|
|
9679
9621
|
}
|
|
9680
9622
|
},
|
|
@@ -10126,6 +10068,7 @@ async function createRsbuild(options = {}) {
|
|
|
10126
10068
|
'onBeforeStartPreviewServer',
|
|
10127
10069
|
'onCloseBuild',
|
|
10128
10070
|
'onCloseDevServer',
|
|
10071
|
+
'onClosePreviewServer',
|
|
10129
10072
|
'onDevCompileDone',
|
|
10130
10073
|
'onExit',
|
|
10131
10074
|
'onRestart'
|
|
@@ -10350,7 +10293,7 @@ let applyServerOptions = (command)=>{
|
|
|
10350
10293
|
};
|
|
10351
10294
|
function setupCommands(argv) {
|
|
10352
10295
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10353
|
-
cli.version("2.
|
|
10296
|
+
cli.version("2.3.0-beta.0"), 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)', {
|
|
10354
10297
|
default: 'auto'
|
|
10355
10298
|
}).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', {
|
|
10356
10299
|
type: [
|
|
@@ -10415,7 +10358,7 @@ function setupCommands(argv) {
|
|
|
10415
10358
|
}
|
|
10416
10359
|
function showGreeting() {
|
|
10417
10360
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10418
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.
|
|
10361
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.3.0-beta.0\n`);
|
|
10419
10362
|
}
|
|
10420
10363
|
function setupLogLevel(argv) {
|
|
10421
10364
|
if (argv.length <= 3) return;
|
|
@@ -10437,5 +10380,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10437
10380
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10438
10381
|
}
|
|
10439
10382
|
}
|
|
10440
|
-
let src_version = "2.
|
|
10383
|
+
let src_version = "2.3.0-beta.0";
|
|
10441
10384
|
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/m.js.LICENSE.txt
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ee-first
|
|
3
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/*!
|
|
8
|
-
* on-finished
|
|
9
|
-
* Copyright(c) 2013 Jonathan Ong
|
|
10
|
-
* Copyright(c) 2014 Douglas Christopher Wilson
|
|
11
|
-
* MIT Licensed
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
1
|
/**
|
|
15
2
|
* Autoload Config for PostCSS
|
|
16
3
|
*
|