@rsbuild/core 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +2 -1
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/jiti/dist/babel.cjs +49 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/{756.js → 711.js} +49 -32
- package/dist/chokidar.js +33 -33
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +3 -3
- package/dist/cssUrlLoader.mjs +1 -1
- package/dist/http-proxy-middleware.js +29 -10
- package/dist/ignoreCssLoader.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +7 -7
- package/dist/memfs.js +1 -1
- package/dist/sirv.js +7 -7
- package/dist/ws.js +1 -1
- package/dist-types/configChain.d.ts +1 -0
- package/dist-types/constants.d.ts +2 -0
- package/dist-types/types/config.d.ts +7 -5
- package/package.json +5 -5
- package/types.d.ts +24 -0
- /package/dist/{349.js → 252.js} +0 -0
- /package/dist/{756.js.LICENSE.txt → 711.js.LICENSE.txt} +0 -0
- /package/dist/client/{60.js → 307.js} +0 -0
package/dist/{756.js → 711.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! LICENSE:
|
|
1
|
+
/*! LICENSE: 711.js.LICENSE.txt */
|
|
2
2
|
let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
|
|
3
3
|
import { rspack as core_rspack } from "@rspack/core";
|
|
4
4
|
import node_util, { stripVTControlCharacters } from "node:util";
|
|
@@ -387,8 +387,8 @@ __webpack_require__.add({
|
|
|
387
387
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
388
388
|
}
|
|
389
389
|
},
|
|
390
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
391
|
-
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
390
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
391
|
+
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/req.js");
|
|
392
392
|
async function processResult(ctx, result) {
|
|
393
393
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
394
394
|
default: obj
|
|
@@ -461,8 +461,8 @@ __webpack_require__.add({
|
|
|
461
461
|
});
|
|
462
462
|
};
|
|
463
463
|
},
|
|
464
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
465
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
464
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
465
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/req.js");
|
|
466
466
|
module.exports = async function options(config, file) {
|
|
467
467
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
468
468
|
config.parser = await req(config.parser, file);
|
|
@@ -482,8 +482,8 @@ __webpack_require__.add({
|
|
|
482
482
|
return config;
|
|
483
483
|
};
|
|
484
484
|
},
|
|
485
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
486
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
485
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
486
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/req.js");
|
|
487
487
|
async function load(plugin, options, file) {
|
|
488
488
|
try {
|
|
489
489
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -499,7 +499,7 @@ __webpack_require__.add({
|
|
|
499
499
|
}), list;
|
|
500
500
|
};
|
|
501
501
|
},
|
|
502
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
502
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
503
503
|
let tsx, jiti, { createRequire } = __webpack_require__("node:module?1bcb"), { pathToFileURL } = __webpack_require__("node:url?b4ec"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
504
504
|
module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
|
|
505
505
|
let url = createRequire(rootFile).resolve(name);
|
|
@@ -1222,6 +1222,10 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirnam
|
|
|
1222
1222
|
'ttf',
|
|
1223
1223
|
'otf',
|
|
1224
1224
|
'ttc'
|
|
1225
|
+
], ASSET_EXTENSIONS = [
|
|
1226
|
+
'webmanifest',
|
|
1227
|
+
'pdf',
|
|
1228
|
+
'txt'
|
|
1225
1229
|
], IMAGE_EXTENSIONS = [
|
|
1226
1230
|
'png',
|
|
1227
1231
|
'jpg',
|
|
@@ -1237,7 +1241,8 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirnam
|
|
|
1237
1241
|
'tif',
|
|
1238
1242
|
'tiff',
|
|
1239
1243
|
'jfif',
|
|
1240
|
-
'cur'
|
|
1244
|
+
'cur',
|
|
1245
|
+
'jxl'
|
|
1241
1246
|
], VIDEO_EXTENSIONS = [
|
|
1242
1247
|
'mp4',
|
|
1243
1248
|
'webm',
|
|
@@ -1250,6 +1255,8 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirnam
|
|
|
1250
1255
|
'aac',
|
|
1251
1256
|
'm4a',
|
|
1252
1257
|
'opus'
|
|
1258
|
+
], TRACK_EXTENSIONS = [
|
|
1259
|
+
'vtt'
|
|
1253
1260
|
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
|
|
1254
1261
|
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
1255
1262
|
function __nested_rspack_require_65__(moduleId) {
|
|
@@ -3445,7 +3452,9 @@ function getBrowserslist(path) {
|
|
|
3445
3452
|
}
|
|
3446
3453
|
function getBrowserslistByEnvironment(path, config) {
|
|
3447
3454
|
let { target, overrideBrowserslist } = config.output;
|
|
3448
|
-
if (Array.isArray(overrideBrowserslist)) return
|
|
3455
|
+
if (Array.isArray(overrideBrowserslist)) return [
|
|
3456
|
+
...overrideBrowserslist
|
|
3457
|
+
];
|
|
3449
3458
|
if ('web' === target || 'web-worker' === target) {
|
|
3450
3459
|
let browserslistrc = getBrowserslist(path);
|
|
3451
3460
|
if (browserslistrc) return browserslistrc;
|
|
@@ -3500,7 +3509,7 @@ function createPublicContext(context) {
|
|
|
3500
3509
|
async function createContext(options, userConfig, logger) {
|
|
3501
3510
|
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;
|
|
3502
3511
|
return {
|
|
3503
|
-
version: "2.1.
|
|
3512
|
+
version: "2.1.5",
|
|
3504
3513
|
rootPath,
|
|
3505
3514
|
distPath: '',
|
|
3506
3515
|
cachePath,
|
|
@@ -3762,6 +3771,7 @@ let configChain_CHAIN_ID = {
|
|
|
3762
3771
|
JSON: 'json',
|
|
3763
3772
|
IMAGE: 'image',
|
|
3764
3773
|
MEDIA: 'media',
|
|
3774
|
+
ASSETS: 'assets',
|
|
3765
3775
|
ADDITIONAL_ASSETS: 'additional-assets',
|
|
3766
3776
|
JS: 'js',
|
|
3767
3777
|
JS_DATA_URI: 'js-data-uri',
|
|
@@ -4338,10 +4348,16 @@ function loadEnv_parse(src) {
|
|
|
4338
4348
|
}
|
|
4339
4349
|
return obj;
|
|
4340
4350
|
}
|
|
4351
|
+
function validatePrefixes(prefixes) {
|
|
4352
|
+
let invalidIndex = prefixes.findIndex((prefix)=>'' === prefix.trim());
|
|
4353
|
+
if (-1 === invalidIndex) return;
|
|
4354
|
+
let prefix = prefixes[invalidIndex];
|
|
4355
|
+
throw Error(`${color.dim('[rsbuild:loadEnv]')} Invalid ${color.yellow('prefixes')} option: received ${color.yellow(JSON.stringify(prefix))}. ${'' === prefix ? 'An empty string matches every key in processEnv, so every environment variable would be treated as public and could be inlined into client-side code through process.env.* and import.meta.env.* replacements.' : 'A whitespace-only string is not a valid public environment variable prefix because it does not contain any non-whitespace characters.'} Use a prefix with at least one non-whitespace character, such as ${color.yellow('"PUBLIC_"')}.`);
|
|
4356
|
+
}
|
|
4341
4357
|
function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV || '', prefixes = [
|
|
4342
4358
|
'PUBLIC_'
|
|
4343
4359
|
], processEnv = process.env } = {}) {
|
|
4344
|
-
if ('local' === mode) throw Error(`${color.dim('[rsbuild:loadEnv]')} ${color.yellow('local')} cannot be used as a value for env mode, because ${color.yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
4360
|
+
if (validatePrefixes(prefixes), 'local' === mode) throw Error(`${color.dim('[rsbuild:loadEnv]')} ${color.yellow('local')} cannot be used as a value for env mode, because ${color.yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
4345
4361
|
let filePaths = [
|
|
4346
4362
|
'.env',
|
|
4347
4363
|
'.env.local',
|
|
@@ -4937,7 +4953,7 @@ function parseMinifyOptions(config) {
|
|
|
4937
4953
|
cssOptions: minify.cssOptions
|
|
4938
4954
|
};
|
|
4939
4955
|
}
|
|
4940
|
-
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
4956
|
+
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16/node_modules/postcss-load-config/src/index.js");
|
|
4941
4957
|
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
4942
4958
|
async function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4943
4959
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
@@ -6038,9 +6054,7 @@ function getResourceType({ href, file }) {
|
|
|
6038
6054
|
let url = new external_node_url_URL(file || href, 'https://example.com'), extension = node_path.extname(url.pathname).slice(1);
|
|
6039
6055
|
return [
|
|
6040
6056
|
'css'
|
|
6041
|
-
].includes(extension) ? 'style' : IMAGE_EXTENSIONS.includes(extension) ? 'image' : VIDEO_EXTENSIONS.includes(extension) ? 'video' : AUDIO_EXTENSIONS.includes(extension) ? 'audio' : FONT_EXTENSIONS.includes(extension) ? 'font' :
|
|
6042
|
-
'vtt'
|
|
6043
|
-
].includes(extension) ? 'track' : "script";
|
|
6057
|
+
].includes(extension) ? 'style' : IMAGE_EXTENSIONS.includes(extension) ? 'image' : VIDEO_EXTENSIONS.includes(extension) ? 'video' : AUDIO_EXTENSIONS.includes(extension) ? 'audio' : FONT_EXTENSIONS.includes(extension) ? 'font' : TRACK_EXTENSIONS.includes(extension) ? 'track' : "script";
|
|
6044
6058
|
}
|
|
6045
6059
|
let HtmlResourceHintsPlugin_defaultOptions = {
|
|
6046
6060
|
type: 'async-chunks',
|
|
@@ -6135,15 +6149,17 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
6135
6149
|
rel,
|
|
6136
6150
|
...option
|
|
6137
6151
|
}
|
|
6138
|
-
})),
|
|
6139
|
-
|
|
6140
|
-
|
|
6152
|
+
})), applyExcludes = (options, defaultExclude, excludes)=>{
|
|
6153
|
+
let optionsList = helpers_castArray(options).map((option)=>{
|
|
6154
|
+
let exclude = option.exclude ?? defaultExclude;
|
|
6155
|
+
return excludes.length || void 0 === option.exclude ? {
|
|
6141
6156
|
...option,
|
|
6142
|
-
exclude:
|
|
6143
|
-
...helpers_castArray(
|
|
6157
|
+
exclude: excludes.length ? [
|
|
6158
|
+
...helpers_castArray(exclude),
|
|
6144
6159
|
...excludes
|
|
6145
|
-
] :
|
|
6146
|
-
}
|
|
6160
|
+
] : exclude
|
|
6161
|
+
} : option;
|
|
6162
|
+
});
|
|
6147
6163
|
return Array.isArray(options) ? optionsList : optionsList[0];
|
|
6148
6164
|
};
|
|
6149
6165
|
function isTerminalTraceOutput(output) {
|
|
@@ -8741,8 +8757,9 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8741
8757
|
'svg'
|
|
8742
8758
|
], emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.MEDIA, [
|
|
8743
8759
|
...VIDEO_EXTENSIONS,
|
|
8744
|
-
...AUDIO_EXTENSIONS
|
|
8745
|
-
|
|
8760
|
+
...AUDIO_EXTENSIONS,
|
|
8761
|
+
...TRACK_EXTENSIONS
|
|
8762
|
+
], emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.FONT, FONT_EXTENSIONS, emitAssets), createAssetRule(configChain_CHAIN_ID.RULE.ASSETS, ASSET_EXTENSIONS, emitAssets);
|
|
8746
8763
|
let rule = chain.module.rule(configChain_CHAIN_ID.RULE.JSON).test(/\.json$/i);
|
|
8747
8764
|
rule.oneOf('json-asset-text').type('asset/source').with({
|
|
8748
8765
|
type: 'text'
|
|
@@ -9425,9 +9442,9 @@ try {
|
|
|
9425
9442
|
...scriptTests,
|
|
9426
9443
|
...styleTests
|
|
9427
9444
|
].filter((item)=>isRegExp(item));
|
|
9428
|
-
})(config);
|
|
9445
|
+
})(config), assetExclude = getRegExpForExts(ASSET_EXTENSIONS);
|
|
9429
9446
|
if (prefetch) {
|
|
9430
|
-
let options =
|
|
9447
|
+
let options = applyExcludes(!0 === prefetch ? {} : prefetch, assetExclude, excludes);
|
|
9431
9448
|
chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlResourceHintsPlugin, [
|
|
9432
9449
|
options,
|
|
9433
9450
|
'prefetch',
|
|
@@ -9437,7 +9454,7 @@ try {
|
|
|
9437
9454
|
]);
|
|
9438
9455
|
}
|
|
9439
9456
|
if (preload) {
|
|
9440
|
-
let options =
|
|
9457
|
+
let options = applyExcludes(!0 === preload ? {} : preload, assetExclude, excludes);
|
|
9441
9458
|
chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlResourceHintsPlugin, [
|
|
9442
9459
|
options,
|
|
9443
9460
|
'preload',
|
|
@@ -9510,7 +9527,7 @@ try {
|
|
|
9510
9527
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
9511
9528
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
9512
9529
|
if (!1 === manifest) return;
|
|
9513
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.
|
|
9530
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.3/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
9514
9531
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
9515
9532
|
let pluginOptions = {
|
|
9516
9533
|
fileName: manifestOptions.filename,
|
|
@@ -10107,7 +10124,7 @@ let applyServerOptions = (command)=>{
|
|
|
10107
10124
|
};
|
|
10108
10125
|
function setupCommands(argv) {
|
|
10109
10126
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10110
|
-
cli.version("2.1.
|
|
10127
|
+
cli.version("2.1.5"), 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)', {
|
|
10111
10128
|
default: 'auto'
|
|
10112
10129
|
}).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', {
|
|
10113
10130
|
type: [
|
|
@@ -10171,7 +10188,7 @@ function setupCommands(argv) {
|
|
|
10171
10188
|
}
|
|
10172
10189
|
function showGreeting() {
|
|
10173
10190
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10174
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.
|
|
10191
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.5\n`);
|
|
10175
10192
|
}
|
|
10176
10193
|
function setupLogLevel(argv) {
|
|
10177
10194
|
if (argv.length <= 3) return;
|
|
@@ -10193,5 +10210,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10193
10210
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10194
10211
|
}
|
|
10195
10212
|
}
|
|
10196
|
-
let src_version = "2.1.
|
|
10213
|
+
let src_version = "2.1.5";
|
|
10197
10214
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, 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/chokidar.js
CHANGED
|
@@ -5,7 +5,7 @@ import { lstat, open as promises_open, readdir, realpath as promises_realpath, s
|
|
|
5
5
|
import { join, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
7
|
import { type as external_node_os_type } from "node:os";
|
|
8
|
-
import * as
|
|
8
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
9
9
|
let EntryTypes_FILE_TYPE = 'files', EntryTypes_DIR_TYPE = 'directories', EntryTypes_FILE_DIR_TYPE = 'files_directories', defaultOptions = {
|
|
10
10
|
root: '.',
|
|
11
11
|
fileFilter: (_entryInfo)=>!0,
|
|
@@ -469,7 +469,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
469
469
|
}, (rawEvent, evPath)=>{
|
|
470
470
|
listener(path), emitRaw(rawEvent, evPath, {
|
|
471
471
|
watchedPath: path
|
|
472
|
-
}), evPath && path !== evPath && fsWatchBroadcast(
|
|
472
|
+
}), evPath && path !== evPath && fsWatchBroadcast(__rspack_external_node_path_806ed179.resolve(path, evPath), KEY_LISTENERS, __rspack_external_node_path_806ed179.join(path, evPath));
|
|
473
473
|
});
|
|
474
474
|
} catch (error) {
|
|
475
475
|
errHandler(error);
|
|
@@ -489,12 +489,12 @@ class NodeFsHandler {
|
|
|
489
489
|
this.fsw = fsW, this._boundHandleError = (error)=>fsW._handleError(error);
|
|
490
490
|
}
|
|
491
491
|
_watchWithNodeFs(path, listener) {
|
|
492
|
-
let closer, opts = this.fsw.options, directory =
|
|
492
|
+
let closer, opts = this.fsw.options, directory = __rspack_external_node_path_806ed179.dirname(path), basename = __rspack_external_node_path_806ed179.basename(path);
|
|
493
493
|
this.fsw._getWatchedDir(directory).add(basename);
|
|
494
|
-
let absolutePath =
|
|
494
|
+
let absolutePath = __rspack_external_node_path_806ed179.resolve(path), options = {
|
|
495
495
|
persistent: opts.persistent
|
|
496
496
|
};
|
|
497
|
-
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(
|
|
497
|
+
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(__rspack_external_node_path_806ed179.extname(basename).slice(1).toLowerCase()) ? opts.binaryInterval : opts.interval, closer = ((path, fullPath, options, handlers)=>{
|
|
498
498
|
let { listener, rawEmitter } = handlers, cont = FsWatchFileInstances.get(fullPath), copts = cont && cont.options;
|
|
499
499
|
return copts && (copts.persistent < options.persistent || copts.interval > options.interval) && (unwatchFile(fullPath), cont = void 0), cont ? (addAndConvert(cont, KEY_LISTENERS, listener), addAndConvert(cont, KEY_RAW, rawEmitter)) : (cont = {
|
|
500
500
|
listeners: listener,
|
|
@@ -558,7 +558,7 @@ class NodeFsHandler {
|
|
|
558
558
|
}
|
|
559
559
|
_handleFile(file, stats, initialAdd) {
|
|
560
560
|
if (this.fsw.closed) return;
|
|
561
|
-
let dirname =
|
|
561
|
+
let dirname = __rspack_external_node_path_806ed179.dirname(file), basename = __rspack_external_node_path_806ed179.basename(file), parent = this.fsw._getWatchedDir(dirname), prevStats = stats;
|
|
562
562
|
if (parent.has(basename)) return;
|
|
563
563
|
let listener = async (path, newStats)=>{
|
|
564
564
|
if (this.fsw._throttle('watch', file, 5)) if (newStats && 0 !== newStats.mtimeMs) {
|
|
@@ -603,7 +603,7 @@ class NodeFsHandler {
|
|
|
603
603
|
this.fsw._symlinkPaths.set(full, !0);
|
|
604
604
|
}
|
|
605
605
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
606
|
-
directory =
|
|
606
|
+
directory = __rspack_external_node_path_806ed179.join(directory, '');
|
|
607
607
|
let throttleKey = target ? `${directory}:${target}` : directory;
|
|
608
608
|
if (!(throttler = this.fsw._throttle('readdir', throttleKey, 1000))) return;
|
|
609
609
|
let previous = this.fsw._getWatchedDir(wh.path), current = new Set(), stream = this.fsw._readdirp(directory, {
|
|
@@ -615,13 +615,13 @@ class NodeFsHandler {
|
|
|
615
615
|
stream = void 0;
|
|
616
616
|
return;
|
|
617
617
|
}
|
|
618
|
-
let item = entry.path, path =
|
|
618
|
+
let item = entry.path, path = __rspack_external_node_path_806ed179.join(directory, item);
|
|
619
619
|
if (current.add(item), !(entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item))) {
|
|
620
620
|
if (this.fsw.closed) {
|
|
621
621
|
stream = void 0;
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
|
-
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path =
|
|
624
|
+
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path = __rspack_external_node_path_806ed179.join(dir, __rspack_external_node_path_806ed179.relative(dir, path)), this._addToNodeFs(path, initialAdd, wh, depth + 1));
|
|
625
625
|
}
|
|
626
626
|
}).on(EVENTS_ERROR, this._boundHandleError), new Promise((resolve, reject)=>{
|
|
627
627
|
if (!stream) return reject();
|
|
@@ -638,8 +638,8 @@ class NodeFsHandler {
|
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
641
|
-
let throttler, closer, parentDir = this.fsw._getWatchedDir(
|
|
642
|
-
initialAdd && this.fsw.options.ignoreInitial || target || tracked || this.fsw._emit(EVENTS_ADD_DIR, dir, stats), parentDir.add(
|
|
641
|
+
let throttler, closer, parentDir = this.fsw._getWatchedDir(__rspack_external_node_path_806ed179.dirname(dir)), tracked = parentDir.has(__rspack_external_node_path_806ed179.basename(dir));
|
|
642
|
+
initialAdd && this.fsw.options.ignoreInitial || target || tracked || this.fsw._emit(EVENTS_ADD_DIR, dir, stats), parentDir.add(__rspack_external_node_path_806ed179.basename(dir)), this.fsw._getWatchedDir(dir);
|
|
643
643
|
let oDepth = this.fsw.options.depth;
|
|
644
644
|
if ((null == oDepth || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
|
645
645
|
if (!target && (await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler), this.fsw.closed)) return;
|
|
@@ -660,15 +660,15 @@ class NodeFsHandler {
|
|
|
660
660
|
if (this.fsw._isIgnored(wh.watchPath, stats)) return ready(), !1;
|
|
661
661
|
let follow = this.fsw.options.followSymlinks;
|
|
662
662
|
if (stats.isDirectory()) {
|
|
663
|
-
let absPath =
|
|
663
|
+
let absPath = __rspack_external_node_path_806ed179.resolve(path), targetPath = follow ? await promises_realpath(path) : path;
|
|
664
664
|
if (this.fsw.closed || (closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath), this.fsw.closed)) return;
|
|
665
665
|
absPath !== targetPath && void 0 !== targetPath && this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
666
666
|
} else if (stats.isSymbolicLink()) {
|
|
667
667
|
let targetPath = follow ? await promises_realpath(path) : path;
|
|
668
668
|
if (this.fsw.closed) return;
|
|
669
|
-
let parent =
|
|
669
|
+
let parent = __rspack_external_node_path_806ed179.dirname(wh.watchPath);
|
|
670
670
|
if (this.fsw._getWatchedDir(parent).add(wh.watchPath), this.fsw._emit(EVENTS_ADD, wh.watchPath, stats), closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath), this.fsw.closed) return;
|
|
671
|
-
void 0 !== targetPath && this.fsw._symlinkPaths.set(
|
|
671
|
+
void 0 !== targetPath && this.fsw._symlinkPaths.set(__rspack_external_node_path_806ed179.resolve(path), targetPath);
|
|
672
672
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
673
673
|
return ready(), closer && this.fsw._addPathCloser(path, closer), !1;
|
|
674
674
|
} catch (error) {
|
|
@@ -687,15 +687,15 @@ function createPattern(matcher) {
|
|
|
687
687
|
return 'function' == typeof matcher ? matcher : 'string' == typeof matcher ? (string)=>matcher === string : matcher instanceof RegExp ? (string)=>matcher.test(string) : 'object' == typeof matcher && null !== matcher ? (string)=>{
|
|
688
688
|
if (matcher.path === string) return !0;
|
|
689
689
|
if (matcher.recursive) {
|
|
690
|
-
let relative =
|
|
691
|
-
return !!relative && !relative.startsWith('..') && !
|
|
690
|
+
let relative = __rspack_external_node_path_806ed179.relative(matcher.path, string);
|
|
691
|
+
return !!relative && !relative.startsWith('..') && !__rspack_external_node_path_806ed179.isAbsolute(relative);
|
|
692
692
|
}
|
|
693
693
|
return !1;
|
|
694
694
|
} : ()=>!1;
|
|
695
695
|
}
|
|
696
696
|
function normalizePath(path) {
|
|
697
697
|
if ('string' != typeof path) throw Error('string expected');
|
|
698
|
-
path = (path =
|
|
698
|
+
path = (path = __rspack_external_node_path_806ed179.normalize(path)).replace(/\\/g, '/');
|
|
699
699
|
let prepend = !1;
|
|
700
700
|
return path.startsWith('//') && (prepend = !0), path = path.replace(DOUBLE_SLASH_RE, '/'), prepend && (path = '/' + path), path;
|
|
701
701
|
}
|
|
@@ -716,7 +716,7 @@ let unifyPaths = (paths_)=>{
|
|
|
716
716
|
}, toUnix = (string)=>{
|
|
717
717
|
let str = string.replace(BACK_SLASH_RE, '/'), prepend = !1;
|
|
718
718
|
return str.startsWith('//') && (prepend = !0), str = str.replace(DOUBLE_SLASH_RE, '/'), prepend && (str = '/' + str), str;
|
|
719
|
-
}, normalizePathToUnix = (path)=>toUnix(
|
|
719
|
+
}, normalizePathToUnix = (path)=>toUnix(__rspack_external_node_path_806ed179.normalize(toUnix(path))), normalizeIgnored = (cwd = '')=>(path)=>'string' == typeof path ? normalizePathToUnix(__rspack_external_node_path_806ed179.isAbsolute(path) ? path : __rspack_external_node_path_806ed179.join(cwd, path)) : path, EMPTY_SET = Object.freeze(new Set());
|
|
720
720
|
class DirEntry {
|
|
721
721
|
path;
|
|
722
722
|
_removeWatcher;
|
|
@@ -735,7 +735,7 @@ class DirEntry {
|
|
|
735
735
|
try {
|
|
736
736
|
await readdir(dir);
|
|
737
737
|
} catch (err) {
|
|
738
|
-
this._removeWatcher && this._removeWatcher(
|
|
738
|
+
this._removeWatcher && this._removeWatcher(__rspack_external_node_path_806ed179.dirname(dir), __rspack_external_node_path_806ed179.basename(dir));
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
has(item) {
|
|
@@ -763,12 +763,12 @@ class WatchHelper {
|
|
|
763
763
|
constructor(path, follow, fsw){
|
|
764
764
|
this.fsw = fsw;
|
|
765
765
|
let watchPath = path;
|
|
766
|
-
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath =
|
|
766
|
+
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath = __rspack_external_node_path_806ed179.resolve(watchPath), this.dirParts = [], this.dirParts.forEach((parts)=>{
|
|
767
767
|
parts.length > 1 && parts.pop();
|
|
768
768
|
}), this.followSymlinks = follow, this.statMethod = follow ? 'stat' : 'lstat';
|
|
769
769
|
}
|
|
770
770
|
entryPath(entry) {
|
|
771
|
-
return
|
|
771
|
+
return __rspack_external_node_path_806ed179.join(this.watchPath, __rspack_external_node_path_806ed179.relative(this.watchPath, entry.fullPath));
|
|
772
772
|
}
|
|
773
773
|
filterPath(entry) {
|
|
774
774
|
let { stats } = entry;
|
|
@@ -846,14 +846,14 @@ class FSWatcher extends EventEmitter {
|
|
|
846
846
|
let { cwd } = this.options;
|
|
847
847
|
this.closed = !1, this._closePromise = void 0;
|
|
848
848
|
let paths = unifyPaths(paths_);
|
|
849
|
-
return cwd && (paths = paths.map((path)=>
|
|
849
|
+
return cwd && (paths = paths.map((path)=>__rspack_external_node_path_806ed179.isAbsolute(path) ? path : __rspack_external_node_path_806ed179.join(cwd, path))), paths.forEach((path)=>{
|
|
850
850
|
this._removeIgnoredPath(path);
|
|
851
851
|
}), this._userIgnored = void 0, this._readyCount || (this._readyCount = 0), this._readyCount += paths.length, Promise.all(paths.map(async (path)=>{
|
|
852
852
|
let res = await this._nodeFsHandler._addToNodeFs(path, !_internal, void 0, 0, _origAdd);
|
|
853
853
|
return res && this._emitReady(), res;
|
|
854
854
|
})).then((results)=>{
|
|
855
855
|
this.closed || results.forEach((item)=>{
|
|
856
|
-
item && this.add(
|
|
856
|
+
item && this.add(__rspack_external_node_path_806ed179.dirname(item), __rspack_external_node_path_806ed179.basename(_origAdd || item));
|
|
857
857
|
});
|
|
858
858
|
}), this;
|
|
859
859
|
}
|
|
@@ -861,7 +861,7 @@ class FSWatcher extends EventEmitter {
|
|
|
861
861
|
if (this.closed) return this;
|
|
862
862
|
let paths = unifyPaths(paths_), { cwd } = this.options;
|
|
863
863
|
return paths.forEach((path)=>{
|
|
864
|
-
|
|
864
|
+
__rspack_external_node_path_806ed179.isAbsolute(path) || this._closers.has(path) || (cwd && (path = __rspack_external_node_path_806ed179.join(cwd, path)), path = __rspack_external_node_path_806ed179.resolve(path)), this._closePath(path), this._addIgnoredPath(path), this._watched.has(path) && this._addIgnoredPath({
|
|
865
865
|
path,
|
|
866
866
|
recursive: !0
|
|
867
867
|
}), this._userIgnored = void 0;
|
|
@@ -879,7 +879,7 @@ class FSWatcher extends EventEmitter {
|
|
|
879
879
|
getWatched() {
|
|
880
880
|
let watchList = {};
|
|
881
881
|
return this._watched.forEach((entry, dir)=>{
|
|
882
|
-
watchList[(this.options.cwd ?
|
|
882
|
+
watchList[(this.options.cwd ? __rspack_external_node_path_806ed179.relative(this.options.cwd, dir) : dir) || '.'] = entry.getChildren().sort();
|
|
883
883
|
}), watchList;
|
|
884
884
|
}
|
|
885
885
|
emitWithAll(event, args) {
|
|
@@ -889,7 +889,7 @@ class FSWatcher extends EventEmitter {
|
|
|
889
889
|
let pw;
|
|
890
890
|
if (this.closed) return;
|
|
891
891
|
let opts = this.options;
|
|
892
|
-
isWindows && (path =
|
|
892
|
+
isWindows && (path = __rspack_external_node_path_806ed179.normalize(path)), opts.cwd && (path = __rspack_external_node_path_806ed179.relative(opts.cwd, path));
|
|
893
893
|
let args = [
|
|
894
894
|
path
|
|
895
895
|
];
|
|
@@ -915,7 +915,7 @@ class FSWatcher extends EventEmitter {
|
|
|
915
915
|
}
|
|
916
916
|
if (event === EVENTS_CHANGE && !this._throttle(EVENTS_CHANGE, path, 50)) return this;
|
|
917
917
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS_ADD || event === EVENTS_ADD_DIR || event === EVENTS_CHANGE)) {
|
|
918
|
-
let stats, fullPath = opts.cwd ?
|
|
918
|
+
let stats, fullPath = opts.cwd ? __rspack_external_node_path_806ed179.join(opts.cwd, path) : path;
|
|
919
919
|
try {
|
|
920
920
|
stats = await promises_stat(fullPath);
|
|
921
921
|
} catch (err) {}
|
|
@@ -952,7 +952,7 @@ class FSWatcher extends EventEmitter {
|
|
|
952
952
|
let timeoutHandler, awf = this.options.awaitWriteFinish;
|
|
953
953
|
if ('object' != typeof awf) return;
|
|
954
954
|
let pollInterval = awf.pollInterval, fullPath = path;
|
|
955
|
-
this.options.cwd && !
|
|
955
|
+
this.options.cwd && !__rspack_external_node_path_806ed179.isAbsolute(path) && (fullPath = __rspack_external_node_path_806ed179.join(this.options.cwd, path));
|
|
956
956
|
let now = new Date(), writes = this._pendingWrites;
|
|
957
957
|
function awaitWriteFinishFn(prevStat) {
|
|
958
958
|
external_node_fs_stat(fullPath, (err, curStat)=>{
|
|
@@ -989,28 +989,28 @@ class FSWatcher extends EventEmitter {
|
|
|
989
989
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
990
990
|
}
|
|
991
991
|
_getWatchedDir(directory) {
|
|
992
|
-
let dir =
|
|
992
|
+
let dir = __rspack_external_node_path_806ed179.resolve(directory);
|
|
993
993
|
return this._watched.has(dir) || this._watched.set(dir, new DirEntry(dir, this._boundRemove)), this._watched.get(dir);
|
|
994
994
|
}
|
|
995
995
|
_hasReadPermissions(stats) {
|
|
996
996
|
return !!this.options.ignorePermissionErrors || !!(256 & Number(stats.mode));
|
|
997
997
|
}
|
|
998
998
|
_remove(directory, item, isDirectory) {
|
|
999
|
-
let path =
|
|
999
|
+
let path = __rspack_external_node_path_806ed179.join(directory, item), fullPath = __rspack_external_node_path_806ed179.resolve(path);
|
|
1000
1000
|
if (isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath), !this._throttle('remove', path, 100)) return;
|
|
1001
1001
|
isDirectory || 1 !== this._watched.size || this.add(directory, item, !0), this._getWatchedDir(path).getChildren().forEach((nested)=>this._remove(path, nested));
|
|
1002
1002
|
let parent = this._getWatchedDir(directory), wasTracked = parent.has(item);
|
|
1003
1003
|
parent.remove(item), this._symlinkPaths.has(fullPath) && this._symlinkPaths.delete(fullPath);
|
|
1004
1004
|
let relPath = path;
|
|
1005
|
-
if (this.options.cwd && (relPath =
|
|
1005
|
+
if (this.options.cwd && (relPath = __rspack_external_node_path_806ed179.relative(this.options.cwd, path)), this.options.awaitWriteFinish && this._pendingWrites.has(relPath) && this._pendingWrites.get(relPath).cancelWait() === EVENTS_ADD) return;
|
|
1006
1006
|
this._watched.delete(path), this._watched.delete(fullPath);
|
|
1007
1007
|
let eventName = isDirectory ? EVENTS_UNLINK_DIR : EVENTS_UNLINK;
|
|
1008
1008
|
wasTracked && !this._isIgnored(path) && this._emit(eventName, path), this._closePath(path);
|
|
1009
1009
|
}
|
|
1010
1010
|
_closePath(path) {
|
|
1011
1011
|
this._closeFile(path);
|
|
1012
|
-
let dir =
|
|
1013
|
-
this._getWatchedDir(dir).remove(
|
|
1012
|
+
let dir = __rspack_external_node_path_806ed179.dirname(path);
|
|
1013
|
+
this._getWatchedDir(dir).remove(__rspack_external_node_path_806ed179.basename(path));
|
|
1014
1014
|
}
|
|
1015
1015
|
_closeFile(path) {
|
|
1016
1016
|
let closers = this._closers.get(path);
|
package/dist/client/hmr.js
CHANGED
package/dist/client/overlay.js
CHANGED
package/dist/connect-next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! LICENSE: connect-next.js.LICENSE.txt */
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import * as
|
|
4
|
+
import * as __rspack_external_node_http_e245b239 from "node:http";
|
|
5
5
|
let __rspack_createRequire_require = createRequire(import.meta.url);
|
|
6
6
|
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
7
7
|
function __nested_rspack_require_364__(moduleId) {
|
|
@@ -840,7 +840,7 @@ let proto = {
|
|
|
840
840
|
req.originalUrl = req.originalUrl || req.url, next();
|
|
841
841
|
},
|
|
842
842
|
listen (...args) {
|
|
843
|
-
return
|
|
843
|
+
return __rspack_external_node_http_e245b239.createServer(this).listen(...args);
|
|
844
844
|
}
|
|
845
845
|
};
|
|
846
846
|
function call(handle, route, err, req, res, next) {
|
|
@@ -872,6 +872,6 @@ function isConnectServer(value) {
|
|
|
872
872
|
return 'function' == typeof value && 'handle' in value && 'function' == typeof value.handle;
|
|
873
873
|
}
|
|
874
874
|
function isHttpServer(value) {
|
|
875
|
-
return value instanceof
|
|
875
|
+
return value instanceof __rspack_external_node_http_e245b239.Server;
|
|
876
876
|
}
|
|
877
877
|
export { connect };
|
package/dist/cssUrlLoader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
-
import { isCSSModules } from "./
|
|
2
|
+
import { isCSSModules } from "./252.js";
|
|
3
3
|
let HASH_PLACEHOLDER_REGEX = /\[(?:[^:\]]+:)?(?:chunkhash|contenthash|hash|fullhash)(?::[^\]]+)?]/i, getRelativePath = (root, resourcePath)=>{
|
|
4
4
|
let relativePath = node_path.relative(root, resourcePath);
|
|
5
5
|
if (relativePath && !('..' === relativePath || relativePath.startsWith(`..${node_path.sep}`)) && !node_path.isAbsolute(relativePath)) return relativePath.replace(/\\/g, '/');
|
|
@@ -5,12 +5,13 @@ import node_http2 from "node:http2";
|
|
|
5
5
|
import { EventEmitter } from "node:events";
|
|
6
6
|
import "node:net";
|
|
7
7
|
import "node:stream";
|
|
8
|
+
import { styleText } from "node:util";
|
|
8
9
|
import { URL as external_node_url_URL } from "node:url";
|
|
9
10
|
import { URL as external_url_URL } from "url";
|
|
10
11
|
import "node:zlib";
|
|
11
12
|
import "node:querystring";
|
|
12
13
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
13
|
-
import "./
|
|
14
|
+
import "./711.js";
|
|
14
15
|
__webpack_require__.add({
|
|
15
16
|
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16
17
|
let stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), compile = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"), expand = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"), parse = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"), braces = (input, options = {})=>{
|
|
@@ -2398,7 +2399,7 @@ let redirectStatuses = new Set([
|
|
|
2398
2399
|
308
|
|
2399
2400
|
]), webIncomingMiddleware = [
|
|
2400
2401
|
(req)=>{
|
|
2401
|
-
"DELETE" !== req.method && "OPTIONS" !== req.method || req.headers["content-length"] ||
|
|
2402
|
+
"DELETE" !== req.method && "OPTIONS" !== req.method || req.headers["content-length"] || req.headers["transfer-encoding"] || (req.headers["content-length"] = "0");
|
|
2402
2403
|
},
|
|
2403
2404
|
(req, res, options)=>{
|
|
2404
2405
|
options.timeout && req.socket.setTimeout(options.timeout, ()=>{
|
|
@@ -2551,7 +2552,7 @@ let redirectStatuses = new Set([
|
|
|
2551
2552
|
}), proxyReq.end();
|
|
2552
2553
|
}
|
|
2553
2554
|
];
|
|
2554
|
-
var
|
|
2555
|
+
var ProxyServer = class extends EventEmitter {
|
|
2555
2556
|
_server;
|
|
2556
2557
|
_webPasses = [
|
|
2557
2558
|
...webIncomingMiddleware
|
|
@@ -2640,13 +2641,31 @@ function _createProxyFn(type, server) {
|
|
|
2640
2641
|
return callbackPromise;
|
|
2641
2642
|
};
|
|
2642
2643
|
}
|
|
2644
|
+
class errors_HttpProxyMiddlewareError extends Error {
|
|
2645
|
+
code;
|
|
2646
|
+
constructor(message, code){
|
|
2647
|
+
super(message), this.code = code, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2643
2650
|
function verifyConfig(options) {
|
|
2644
|
-
if (!options.target && !options.router) throw
|
|
2651
|
+
if (!options.target && !options.router) throw new errors_HttpProxyMiddlewareError('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}', 'ERR_CONFIG_FACTORY_TARGET_MISSING');
|
|
2652
|
+
}
|
|
2653
|
+
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), BODY_PARSER_ERROR_MESSAGE = `[HPM] Connection reset (ECONNRESET) detected with non-empty "req.body" [ERR_HPM.GH40].
|
|
2654
|
+
|
|
2655
|
+
This usually means that the POST request body (req.body) was already parsed before reaching the proxy.
|
|
2656
|
+
When bodyParser runs first, it consumes the request stream, leaving the proxy unable to forward the body data to the target server.
|
|
2657
|
+
|
|
2658
|
+
How to fix this issue:
|
|
2659
|
+
- Option 1: Place the proxy middleware before the bodyParser middleware.
|
|
2660
|
+
- Option 2: Use 'fixRequestBody()' helper to fix this issue.
|
|
2661
|
+
|
|
2662
|
+
For more details, see: https://github.com/chimurai/http-proxy-middleware/issues/40\n`;
|
|
2663
|
+
function hasParsedBody(req) {
|
|
2664
|
+
return !!(req && 'POST' === req.method && 'body' in req && req.body);
|
|
2645
2665
|
}
|
|
2646
|
-
|
|
2647
|
-
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), debugProxyErrorsPlugin = (proxyServer, options)=>{
|
|
2666
|
+
let debugProxyErrorsPlugin = (proxyServer, options)=>{
|
|
2648
2667
|
proxyServer.on('error', (error, req, res, target)=>{
|
|
2649
|
-
debug(`httpxy error event: \n%O`, error);
|
|
2668
|
+
debug(`httpxy error event: \n%O`, error), 'ECONNRESET' === error.code && hasParsedBody(req) && console.error(styleText('red', BODY_PARSER_ERROR_MESSAGE));
|
|
2650
2669
|
}), proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
|
|
2651
2670
|
socket.on('error', (error)=>{
|
|
2652
2671
|
debug('Socket error in proxyReq event: \n%O', error);
|
|
@@ -2780,10 +2799,10 @@ function matchPathFilter(pathFilter = '/', uri, req) {
|
|
|
2780
2799
|
if (Array.isArray(pathFilter)) {
|
|
2781
2800
|
if (pathFilter.every(isStringPath)) return matchMultiPath(pathFilter, uri);
|
|
2782
2801
|
if (pathFilter.every(isGlobPath)) return matchMultiGlobPath(pathFilter, uri);
|
|
2783
|
-
throw
|
|
2802
|
+
throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathFilter. Plain paths (e.g. "/api") can not be mixed with globs (e.g. "/api/**"). Expecting something like: ["/api", "/ajax"] or ["/api/**", "!**.html"].', 'HPM_INVALID_PATH_FILTER_ARRAY_CONFIG');
|
|
2784
2803
|
}
|
|
2785
2804
|
if ('function' == typeof pathFilter) return !!pathFilter(getUrlPathName(uri), req);
|
|
2786
|
-
throw
|
|
2805
|
+
throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathFilter. Expecting something like: "/api" or ["/api", "/ajax"]', 'HPM_INVALID_PATH_FILTER_CONFIG');
|
|
2787
2806
|
}
|
|
2788
2807
|
function matchSingleStringPath(pathFilter, uri) {
|
|
2789
2808
|
let pathname = getUrlPathName(uri);
|
|
@@ -2838,7 +2857,7 @@ function isValidRewriteConfig(rewriteConfig) {
|
|
|
2838
2857
|
if ('function' == typeof rewriteConfig) return !0;
|
|
2839
2858
|
if (isPlainObject(rewriteConfig)) return 0 !== Object.keys(rewriteConfig).length;
|
|
2840
2859
|
if (null == rewriteConfig) return !1;
|
|
2841
|
-
throw
|
|
2860
|
+
throw new errors_HttpProxyMiddlewareError('[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function', 'HPM_INVALID_PATH_REWRITER_CONFIG');
|
|
2842
2861
|
}
|
|
2843
2862
|
function parsePathRewriteRules(rewriteConfig) {
|
|
2844
2863
|
let rules = [];
|