@rsbuild/core 2.1.3 → 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} +95 -57
- 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/loadConfig.d.ts +8 -3
- 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,
|
|
@@ -9874,7 +9891,12 @@ let DEFAULT_CONFIG_FILE_NAMES = [
|
|
|
9874
9891
|
'rsbuild.config.mjs',
|
|
9875
9892
|
'rsbuild.config.cts',
|
|
9876
9893
|
'rsbuild.config.cjs'
|
|
9877
|
-
],
|
|
9894
|
+
], canReadExport = (module)=>null !== module && ('object' == typeof module || 'function' == typeof module), getConfigExport = (configModule, exportName, configFilePath)=>{
|
|
9895
|
+
if (!1 === exportName) return {};
|
|
9896
|
+
if ('default' === exportName) return canReadExport(configModule) && 'default' in configModule ? configModule.default : configModule;
|
|
9897
|
+
if (canReadExport(configModule) && Object.hasOwn(configModule, exportName)) return configModule[exportName];
|
|
9898
|
+
throw Error(`Cannot find export ${color.yellow(exportName)} in config file: ${color.dim(configFilePath)}`);
|
|
9899
|
+
}, tryFreshImport = async (configFileURL)=>{
|
|
9878
9900
|
try {
|
|
9879
9901
|
let { freshImport } = await import("./fresh-import.js");
|
|
9880
9902
|
return await freshImport(configFileURL);
|
|
@@ -9884,15 +9906,32 @@ let DEFAULT_CONFIG_FILE_NAMES = [
|
|
|
9884
9906
|
}, loadConfigWithNative = async (configFilePath)=>{
|
|
9885
9907
|
let configFileURL = pathToFileURL(configFilePath).href, freshImportResult = await tryFreshImport(configFileURL);
|
|
9886
9908
|
return freshImportResult ? {
|
|
9887
|
-
|
|
9909
|
+
configModule: freshImportResult.result,
|
|
9888
9910
|
dependencies: freshImportResult.dependencies.sort()
|
|
9889
9911
|
} : {
|
|
9890
|
-
|
|
9912
|
+
configModule: await import(`${configFileURL}?t=${Date.now()}`),
|
|
9913
|
+
dependencies: []
|
|
9914
|
+
};
|
|
9915
|
+
}, loadConfigWithJiti = async (configFilePath, exportName)=>{
|
|
9916
|
+
let { createJiti } = await import("../compiled/jiti/lib/jiti.mjs"), jiti = createJiti(import.meta.filename, {
|
|
9917
|
+
moduleCache: !1,
|
|
9918
|
+
interopDefault: !0,
|
|
9919
|
+
nativeModules: [
|
|
9920
|
+
"typescript"
|
|
9921
|
+
]
|
|
9922
|
+
});
|
|
9923
|
+
return 'default' === exportName ? {
|
|
9924
|
+
configExport: await jiti.import(configFilePath, {
|
|
9925
|
+
default: !0
|
|
9926
|
+
}),
|
|
9927
|
+
dependencies: []
|
|
9928
|
+
} : {
|
|
9929
|
+
configExport: getConfigExport(await jiti.import(configFilePath), exportName, configFilePath),
|
|
9891
9930
|
dependencies: []
|
|
9892
9931
|
};
|
|
9893
9932
|
};
|
|
9894
|
-
async function loadConfig_loadConfig({ cwd = process.cwd(), path, configFileNames, envMode, meta, loader = 'auto', command } = {}) {
|
|
9895
|
-
let
|
|
9933
|
+
async function loadConfig_loadConfig({ cwd = process.cwd(), path, configFileNames, envMode, meta, loader = 'auto', command, exportName = 'default' } = {}) {
|
|
9934
|
+
let loadedConfig, configFilePath = ((root, customConfig, configFileNames = DEFAULT_CONFIG_FILE_NAMES)=>{
|
|
9896
9935
|
if (customConfig) {
|
|
9897
9936
|
let customConfigPath = external_node_path_isAbsolute(customConfig) ? customConfig : join(root, customConfig);
|
|
9898
9937
|
if (node_fs.existsSync(customConfigPath)) return customConfigPath;
|
|
@@ -9909,30 +9948,29 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, configFileName
|
|
|
9909
9948
|
filePath: configFilePath,
|
|
9910
9949
|
dependencies: []
|
|
9911
9950
|
};
|
|
9912
|
-
let
|
|
9951
|
+
let applyMetaInfo = (config)=>(config._privateMeta = {
|
|
9913
9952
|
configFilePath
|
|
9914
9953
|
}, config);
|
|
9915
|
-
if ('native' === loader || 'auto' === loader && (process.features.typescript || process.versions.bun || process.versions.deno) || /\.(?:js|mjs|cjs)$/.test(configFilePath))
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
"typescript"
|
|
9928
|
-
]
|
|
9929
|
-
});
|
|
9930
|
-
configExport = await jiti.import(configFilePath, {
|
|
9931
|
-
default: !0
|
|
9954
|
+
if ('native' === loader || 'auto' === loader && (process.features.typescript || process.versions.bun || process.versions.deno) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
|
|
9955
|
+
let result;
|
|
9956
|
+
try {
|
|
9957
|
+
result = await loadConfigWithNative(configFilePath);
|
|
9958
|
+
} catch (err) {
|
|
9959
|
+
let errorMessage = `Failed to load file with native loader: ${color.dim(configFilePath)}`;
|
|
9960
|
+
if ('native' === loader) throw src_logger.error(errorMessage), err;
|
|
9961
|
+
src_logger.debug(`${errorMessage}, fallback to jiti.`), src_logger.debug(err);
|
|
9962
|
+
}
|
|
9963
|
+
result && (loadedConfig = {
|
|
9964
|
+
configExport: getConfigExport(result.configModule, exportName, configFilePath),
|
|
9965
|
+
dependencies: result.dependencies
|
|
9932
9966
|
});
|
|
9967
|
+
}
|
|
9968
|
+
if (!loadedConfig) try {
|
|
9969
|
+
loadedConfig = await loadConfigWithJiti(configFilePath, exportName);
|
|
9933
9970
|
} catch (err) {
|
|
9934
9971
|
throw src_logger.error(`Failed to load file with jiti: ${color.dim(configFilePath)}`), err;
|
|
9935
9972
|
}
|
|
9973
|
+
let { configExport, dependencies } = loadedConfig;
|
|
9936
9974
|
if ('function' == typeof configExport) {
|
|
9937
9975
|
let nodeEnv = process.env.NODE_ENV || '', configParams = {
|
|
9938
9976
|
env: nodeEnv,
|
|
@@ -9940,14 +9978,14 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, configFileName
|
|
|
9940
9978
|
envMode: envMode || nodeEnv,
|
|
9941
9979
|
meta
|
|
9942
9980
|
}, result = await configExport(configParams);
|
|
9943
|
-
if (void 0 === result) throw Error(
|
|
9981
|
+
if (void 0 === result) throw Error('The config function must return a config object.');
|
|
9944
9982
|
return {
|
|
9945
9983
|
content: applyMetaInfo(result),
|
|
9946
9984
|
filePath: configFilePath,
|
|
9947
9985
|
dependencies
|
|
9948
9986
|
};
|
|
9949
9987
|
}
|
|
9950
|
-
if (!isObject(configExport)) throw Error(
|
|
9988
|
+
if (!isObject(configExport)) throw Error(`The config must be an object or a function that returns an object, get ${color.yellow(String(configExport))}`);
|
|
9951
9989
|
return src_logger.debug('configuration loaded from:', configFilePath), {
|
|
9952
9990
|
content: applyMetaInfo(configExport),
|
|
9953
9991
|
filePath: configFilePath,
|
|
@@ -10086,7 +10124,7 @@ let applyServerOptions = (command)=>{
|
|
|
10086
10124
|
};
|
|
10087
10125
|
function setupCommands(argv) {
|
|
10088
10126
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10089
|
-
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)', {
|
|
10090
10128
|
default: 'auto'
|
|
10091
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', {
|
|
10092
10130
|
type: [
|
|
@@ -10150,7 +10188,7 @@ function setupCommands(argv) {
|
|
|
10150
10188
|
}
|
|
10151
10189
|
function showGreeting() {
|
|
10152
10190
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10153
|
-
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`);
|
|
10154
10192
|
}
|
|
10155
10193
|
function setupLogLevel(argv) {
|
|
10156
10194
|
if (argv.length <= 3) return;
|
|
@@ -10172,5 +10210,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10172
10210
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10173
10211
|
}
|
|
10174
10212
|
}
|
|
10175
|
-
let src_version = "2.1.
|
|
10213
|
+
let src_version = "2.1.5";
|
|
10176
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