@rsbuild/core 1.2.10 → 1.2.12
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/chokidar/index.d.ts +61 -23
- package/compiled/chokidar/index.js +71 -56
- package/compiled/css-loader/index.js +309 -195
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +1 -1
- package/compiled/launch-editor-middleware/index.js +9 -6
- package/compiled/mrmime/index.js +4 -0
- package/compiled/mrmime/package.json +1 -1
- package/compiled/postcss/index.js +194 -194
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +11 -11
- package/compiled/postcss-loader/index.js +9 -9
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/sirv/index.js +8 -4
- package/compiled/sirv/package.json +1 -1
- package/compiled/style-loader/index.js +10 -10
- package/compiled/tinyglobby/index.d.ts +1 -0
- package/compiled/tinyglobby/index.js +266 -142
- package/compiled/tinyglobby/package.json +1 -1
- package/compiled/webpack-bundle-analyzer/index.js +6 -2
- package/compiled/ws/index.js +50 -49
- package/compiled/ws/package.json +1 -1
- package/dist/client/hmr.js +2 -2
- package/dist/index.cjs +95 -60
- package/dist/index.js +91 -56
- package/dist-types/helpers/index.d.ts +3 -3
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loadEnv.d.ts +16 -4
- package/dist-types/logger.d.ts +14 -0
- package/dist-types/server/devServer.d.ts +2 -1
- package/dist-types/server/socketServer.d.ts +4 -2
- package/dist-types/types/config.d.ts +79 -43
- package/dist-types/types/rspack.d.ts +1 -1
- package/package.json +11 -11
- package/compiled/jiti/index.d.ts +0 -1
- package/compiled/jiti/index.js +0 -416
- package/compiled/jiti/license +0 -21
- package/compiled/jiti/package.json +0 -1
package/dist/index.js
CHANGED
|
@@ -438,7 +438,7 @@ async function emptyDir(dir, keep = [], checkExists = !0) {
|
|
|
438
438
|
!keep.some((reg)=>reg.test(toPosixPath(fullPath))) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.rmdir(fullPath)) : await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.unlink(fullPath));
|
|
439
439
|
}));
|
|
440
440
|
} catch (err) {
|
|
441
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`
|
|
441
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`failed to empty dir: ${dir}`), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(err);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
let hintNodePolyfill = (message)=>{
|
|
@@ -688,7 +688,7 @@ let camelCase = (input)=>input.replace(/[-_](\w)/g, (_, c)=>c.toUpperCase()), pr
|
|
|
688
688
|
}, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
689
689
|
function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
690
690
|
'PUBLIC_'
|
|
691
|
-
] } = {}) {
|
|
691
|
+
], processEnv = process.env } = {}) {
|
|
692
692
|
if ('local' === mode) throw Error("[rsbuild:loadEnv] 'local' cannot be used as a value for env mode, because \".env.local\" represents a temporary local file. Please use another value.");
|
|
693
693
|
let filePaths = [
|
|
694
694
|
'.env',
|
|
@@ -696,13 +696,14 @@ function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
|
696
696
|
`.env.${mode}`,
|
|
697
697
|
`.env.${mode}.local`
|
|
698
698
|
].map((filename)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, filename)).filter(isFileSync), parsed = {};
|
|
699
|
-
for (let envPath of filePaths)Object.assign(parsed, (0, main.parse)(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.readFileSync(envPath)));
|
|
700
|
-
parsed.NODE_ENV && (
|
|
701
|
-
parsed
|
|
699
|
+
for (let envPath of filePaths)Object.assign(parsed, (0, main.parse)(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.readFileSync(envPath))), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('loaded env file:', envPath);
|
|
700
|
+
parsed.NODE_ENV && (processEnv.NODE_ENV = parsed.NODE_ENV), (0, lib_main.expand)({
|
|
701
|
+
parsed,
|
|
702
|
+
processEnv
|
|
702
703
|
});
|
|
703
704
|
let publicVars = {}, rawPublicVars = {};
|
|
704
|
-
for (let key of Object.keys(
|
|
705
|
-
let val =
|
|
705
|
+
for (let key of Object.keys(processEnv))if (prefixes.some((prefix)=>key.startsWith(prefix))) {
|
|
706
|
+
let val = processEnv[key];
|
|
706
707
|
publicVars[`import.meta.env.${key}`] = JSON.stringify(val), publicVars[`process.env.${key}`] = JSON.stringify(val), rawPublicVars[key] = val;
|
|
707
708
|
}
|
|
708
709
|
let cleaned = !1;
|
|
@@ -710,7 +711,7 @@ function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
|
710
711
|
parsed,
|
|
711
712
|
cleanup: ()=>{
|
|
712
713
|
if (!cleaned) {
|
|
713
|
-
for (let key of Object.keys(parsed))'NODE_ENV' !== key &&
|
|
714
|
+
for (let key of Object.keys(parsed))'NODE_ENV' !== key && processEnv[key] === parsed[key] && delete processEnv[key];
|
|
714
715
|
cleaned = !0;
|
|
715
716
|
}
|
|
716
717
|
},
|
|
@@ -881,8 +882,8 @@ let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
|
881
882
|
}, beforeRestart = async ({ filePath, clear = !0, id })=>{
|
|
882
883
|
if (clear && clearConsole(), filePath) {
|
|
883
884
|
let filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(filePath);
|
|
884
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`
|
|
885
|
-
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`
|
|
885
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id} because ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(filename)} has changed\n`);
|
|
886
|
+
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id}...\n`);
|
|
886
887
|
for (let cleaner of cleaners)await cleaner();
|
|
887
888
|
cleaners = [];
|
|
888
889
|
}, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
|
|
@@ -989,7 +990,8 @@ let config_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.create
|
|
|
989
990
|
compress: !0,
|
|
990
991
|
printUrls: !0,
|
|
991
992
|
strictPort: !1,
|
|
992
|
-
cors: !1
|
|
993
|
+
cors: !1,
|
|
994
|
+
middlewareMode: !1
|
|
993
995
|
}), getDefaultSourceConfig = ()=>({
|
|
994
996
|
alias: {},
|
|
995
997
|
define: {},
|
|
@@ -1159,7 +1161,7 @@ async function watchFilesForRestart(files, root, isBuildWatch, watchOptions) {
|
|
|
1159
1161
|
async function config_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'jiti' } = {}) {
|
|
1160
1162
|
let configExport;
|
|
1161
1163
|
let configFilePath = resolveConfigPath(cwd, path);
|
|
1162
|
-
if (!configFilePath) return {
|
|
1164
|
+
if (!configFilePath) return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('no config file found.'), {
|
|
1163
1165
|
content: {},
|
|
1164
1166
|
filePath: configFilePath
|
|
1165
1167
|
};
|
|
@@ -1171,16 +1173,17 @@ async function config_loadConfig({ cwd = process.cwd(), path, envMode, meta, loa
|
|
|
1171
1173
|
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
1172
1174
|
} catch (err) {
|
|
1173
1175
|
if ('native' === loader) throw __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(`Failed to load file with native loader: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(configFilePath)}`), err;
|
|
1174
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`
|
|
1176
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`failed to load file with dynamic import: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(configFilePath)}`);
|
|
1175
1177
|
}
|
|
1176
1178
|
try {
|
|
1177
1179
|
if (void 0 === configExport) {
|
|
1178
|
-
let {
|
|
1179
|
-
|
|
1180
|
-
esmResolve: !0,
|
|
1181
|
-
requireCache: !1,
|
|
1180
|
+
let { createJiti } = await import("jiti"), jiti = createJiti(constants_filename, {
|
|
1181
|
+
moduleCache: !1,
|
|
1182
1182
|
interopDefault: !0
|
|
1183
|
-
})
|
|
1183
|
+
});
|
|
1184
|
+
configExport = await jiti.import(configFilePath, {
|
|
1185
|
+
default: !0
|
|
1186
|
+
});
|
|
1184
1187
|
}
|
|
1185
1188
|
} catch (err) {
|
|
1186
1189
|
throw __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(`Failed to load file with jiti: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(configFilePath)}`), err;
|
|
@@ -1199,7 +1202,7 @@ async function config_loadConfig({ cwd = process.cwd(), path, envMode, meta, loa
|
|
|
1199
1202
|
};
|
|
1200
1203
|
}
|
|
1201
1204
|
if (!isObject(configExport)) throw Error(`[rsbuild:loadConfig] The config must be an object or a function that returns an object, get ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(configExport)}`);
|
|
1202
|
-
return {
|
|
1205
|
+
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('loaded config file:', configFilePath), {
|
|
1203
1206
|
content: applyMetaInfo(configExport),
|
|
1204
1207
|
filePath: configFilePath
|
|
1205
1208
|
};
|
|
@@ -1239,13 +1242,13 @@ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfi
|
|
|
1239
1242
|
...rawEnvironmentConfigs.map(({ name, content })=>{
|
|
1240
1243
|
if (1 === rawEnvironmentConfigs.length) return {
|
|
1241
1244
|
path: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(outputPath, 'rsbuild.config.mjs'),
|
|
1242
|
-
label: 'Rsbuild
|
|
1245
|
+
label: 'Rsbuild config',
|
|
1243
1246
|
content
|
|
1244
1247
|
};
|
|
1245
1248
|
let outputFile = `rsbuild.config.${name}.mjs`;
|
|
1246
1249
|
return {
|
|
1247
1250
|
path: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(outputPath, outputFile),
|
|
1248
|
-
label: `Rsbuild
|
|
1251
|
+
label: `Rsbuild config (${name})`,
|
|
1249
1252
|
content
|
|
1250
1253
|
};
|
|
1251
1254
|
}),
|
|
@@ -1262,7 +1265,7 @@ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfi
|
|
|
1262
1265
|
recursive: !0
|
|
1263
1266
|
}), await Promise.all(files.map(async (item)=>__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.writeFile(item.path, `export default ${item.content}`)));
|
|
1264
1267
|
let fileInfos = files.map((item)=>` - ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.bold(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(item.label))}: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.underline(item.path)}`).join('\n');
|
|
1265
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.success(`
|
|
1268
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
|
|
1266
1269
|
}
|
|
1267
1270
|
function stringifyConfig(config, verbose) {
|
|
1268
1271
|
return (0, __WEBPACK_EXTERNAL_MODULE__compiled_rspack_chain_index_js_b67fefbd__.default.toString)(config, {
|
|
@@ -1648,7 +1651,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
1648
1651
|
async function createContext(options, userConfig, bundlerType) {
|
|
1649
1652
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
1650
1653
|
return {
|
|
1651
|
-
version: "1.2.
|
|
1654
|
+
version: "1.2.12",
|
|
1652
1655
|
rootPath,
|
|
1653
1656
|
distPath: '',
|
|
1654
1657
|
cachePath,
|
|
@@ -1879,7 +1882,10 @@ let configChain_CHAIN_ID = {
|
|
|
1879
1882
|
api.modifyBundlerChain((chain, { isProd, environment })=>{
|
|
1880
1883
|
let { config } = environment, getMergedFilename = (assetType)=>{
|
|
1881
1884
|
let distDir = config.output.distPath[assetType], filename = getFilename(config, assetType, isProd);
|
|
1882
|
-
return
|
|
1885
|
+
return 'function' == typeof filename ? (...args)=>{
|
|
1886
|
+
let name = filename(...args);
|
|
1887
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.posix.join(distDir, name);
|
|
1888
|
+
} : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.posix.join(distDir, filename);
|
|
1883
1889
|
}, createAssetRule = (assetType, exts, emit)=>{
|
|
1884
1890
|
let regExp = function(exts) {
|
|
1885
1891
|
let matcher = exts.map((ext)=>ext.trim()).map((ext)=>ext.startsWith('.') ? ext.slice(1) : ext).join('|');
|
|
@@ -1963,7 +1969,7 @@ async function validateWebpackCache(cacheDirectory, buildDependencies) {
|
|
|
1963
1969
|
try {
|
|
1964
1970
|
prevBuildDependencies = JSON.parse(rawConfigFile);
|
|
1965
1971
|
} catch (e) {
|
|
1966
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('
|
|
1972
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('failed to parse the previous buildDependencies.json', e);
|
|
1967
1973
|
}
|
|
1968
1974
|
if (JSON.stringify(prevBuildDependencies) === JSON.stringify(buildDependencies)) return;
|
|
1969
1975
|
await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.rm(cacheDirectory, {
|
|
@@ -2148,7 +2154,7 @@ let pluginHelper_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.
|
|
|
2148
2154
|
};
|
|
2149
2155
|
}
|
|
2150
2156
|
return options;
|
|
2151
|
-
},
|
|
2157
|
+
}, clonePostCSSConfig = (config)=>({
|
|
2152
2158
|
...config,
|
|
2153
2159
|
plugins: config.plugins ? [
|
|
2154
2160
|
...config.plugins
|
|
@@ -2157,18 +2163,18 @@ let pluginHelper_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.
|
|
|
2157
2163
|
let { sourceMap } = config.output;
|
|
2158
2164
|
return 'boolean' == typeof sourceMap ? sourceMap : sourceMap.css;
|
|
2159
2165
|
};
|
|
2160
|
-
async function loadUserPostcssrc(root) {
|
|
2161
|
-
let cached =
|
|
2166
|
+
async function loadUserPostcssrc(root, postcssrcCache) {
|
|
2167
|
+
let cached = postcssrcCache.get(root);
|
|
2162
2168
|
if (cached) return clonePostCSSConfig(await cached);
|
|
2163
2169
|
let { default: postcssrc } = await import("../compiled/postcss-load-config/index.js"), promise = postcssrc({}, root).catch((err)=>{
|
|
2164
2170
|
var _err_message;
|
|
2165
2171
|
if (null === (_err_message = err.message) || void 0 === _err_message ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
|
|
2166
2172
|
throw err;
|
|
2167
2173
|
});
|
|
2168
|
-
return
|
|
2174
|
+
return postcssrcCache.set(root, promise), promise.then((config)=>(postcssrcCache.set(root, config), clonePostCSSConfig(config)));
|
|
2169
2175
|
}
|
|
2170
|
-
let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plugin.postcss, getPostcssLoaderOptions = async ({ config, root })=>{
|
|
2171
|
-
let extraPlugins = [], userOptions = await loadUserPostcssrc(root);
|
|
2176
|
+
let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plugin.postcss, getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
|
|
2177
|
+
let extraPlugins = [], userOptions = await loadUserPostcssrc(root, postcssrcCache);
|
|
2172
2178
|
userOptions.plugins ||= [];
|
|
2173
2179
|
let finalOptions = reduceConfigsWithContext({
|
|
2174
2180
|
initial: {
|
|
@@ -2221,6 +2227,7 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2221
2227
|
}, pluginCss = ()=>({
|
|
2222
2228
|
name: 'rsbuild:css',
|
|
2223
2229
|
setup (api) {
|
|
2230
|
+
let postcssrcCache = new Map();
|
|
2224
2231
|
api.modifyBundlerChain({
|
|
2225
2232
|
order: 'pre',
|
|
2226
2233
|
handler: async (chain, { target, isProd, CHAIN_ID, environment })=>{
|
|
@@ -2248,7 +2255,8 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2248
2255
|
}
|
|
2249
2256
|
let postcssLoaderOptions = await getPostcssLoaderOptions({
|
|
2250
2257
|
config,
|
|
2251
|
-
root: api.context.rootPath
|
|
2258
|
+
root: api.context.rootPath,
|
|
2259
|
+
postcssrcCache
|
|
2252
2260
|
});
|
|
2253
2261
|
('function' == typeof postcssLoaderOptions.postcssOptions || (null === (_postcssLoaderOptions_postcssOptions = postcssLoaderOptions.postcssOptions) || void 0 === _postcssLoaderOptions_postcssOptions ? void 0 : null === (_postcssLoaderOptions_postcssOptions_plugins = _postcssLoaderOptions_postcssOptions.plugins) || void 0 === _postcssLoaderOptions_postcssOptions_plugins ? void 0 : _postcssLoaderOptions_postcssOptions_plugins.length)) && (importLoaders++, rule.use(CHAIN_ID.USE.POSTCSS).loader(getCompiledPath('postcss-loader')).options(postcssLoaderOptions));
|
|
2254
2262
|
}
|
|
@@ -3164,7 +3172,7 @@ let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
|
3164
3172
|
host,
|
|
3165
3173
|
port: originalPort,
|
|
3166
3174
|
strictPort: config.server.strictPort || !1
|
|
3167
|
-
}), https = !!config.server.https, portTip = port !== originalPort ? `
|
|
3175
|
+
}), https = !!config.server.https, portTip = port !== originalPort ? `port ${originalPort} is in use, ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(`using port ${port}.`)}` : void 0;
|
|
3168
3176
|
return {
|
|
3169
3177
|
port,
|
|
3170
3178
|
host,
|
|
@@ -3265,9 +3273,9 @@ async function openBrowser(url) {
|
|
|
3265
3273
|
if (targetBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${targetBrowser}"`, {
|
|
3266
3274
|
cwd: STATIC_PATH
|
|
3267
3275
|
}), !0;
|
|
3268
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('
|
|
3276
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('failed to find the target browser.');
|
|
3269
3277
|
} catch (err) {
|
|
3270
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug("
|
|
3278
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug("failed to open start URL with apple script."), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(err);
|
|
3271
3279
|
}
|
|
3272
3280
|
try {
|
|
3273
3281
|
let { default: open } = await import("../compiled/open/index.js");
|
|
@@ -3552,7 +3560,7 @@ class HtmlPreloadOrPrefetchPlugin {
|
|
|
3552
3560
|
}({
|
|
3553
3561
|
href,
|
|
3554
3562
|
file
|
|
3555
|
-
}), 'font' === attributes.as && (attributes.crossorigin = ''), ("script" === attributes.as || 'style' === attributes.as) && crossOriginLoading &&
|
|
3563
|
+
}), 'font' === attributes.as && (attributes.crossorigin = ''), ("script" === attributes.as || 'style' === attributes.as) && crossOriginLoading && ('use-credentials' === crossOriginLoading || '/' !== publicPath) && (attributes.crossorigin = 'anonymous' === crossOriginLoading ? '' : crossOriginLoading)), links.push({
|
|
3556
3564
|
tagName: 'link',
|
|
3557
3565
|
attributes,
|
|
3558
3566
|
voidTag: !0,
|
|
@@ -3696,7 +3704,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
3696
3704
|
}), api.onExit(()=>{
|
|
3697
3705
|
enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.cleanup();
|
|
3698
3706
|
let profileDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.distPath, profileDirName);
|
|
3699
|
-
stopProfiler(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'jscpuprofile.json'), profileSession), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`
|
|
3707
|
+
stopProfiler(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'jscpuprofile.json'), profileSession), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`saved Rspack profile file to ${profileDir}`);
|
|
3700
3708
|
});
|
|
3701
3709
|
}
|
|
3702
3710
|
}), pluginServer = ()=>({
|
|
@@ -4515,17 +4523,19 @@ class SocketServer {
|
|
|
4515
4523
|
this.wsServer.emit('connection', connection, req);
|
|
4516
4524
|
});
|
|
4517
4525
|
}
|
|
4526
|
+
clearHeartbeatTimer() {
|
|
4527
|
+
this.heartbeatTimer && (clearInterval(this.heartbeatTimer), this.heartbeatTimer = null);
|
|
4528
|
+
}
|
|
4518
4529
|
async prepare() {
|
|
4519
4530
|
var _this_options_client;
|
|
4531
|
+
this.clearHeartbeatTimer();
|
|
4520
4532
|
let { default: ws } = await import("../compiled/ws/index.js");
|
|
4521
4533
|
this.wsServer = new ws.Server({
|
|
4522
4534
|
noServer: !0,
|
|
4523
4535
|
path: null === (_this_options_client = this.options.client) || void 0 === _this_options_client ? void 0 : _this_options_client.path
|
|
4524
4536
|
}), this.wsServer.on('error', (err)=>{
|
|
4525
4537
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
4526
|
-
}), this.
|
|
4527
|
-
for (let socket of this.wsServer.clients)socket.isAlive ? (socket.isAlive = !1, socket.ping(()=>{})) : socket.terminate();
|
|
4528
|
-
}, 30000), this.wsServer.on('connection', (socket, req)=>{
|
|
4538
|
+
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000), this.wsServer.on('connection', (socket, req)=>{
|
|
4529
4539
|
let queryStr = req.url ? req.url.split('?')[1] : '';
|
|
4530
4540
|
this.onConnect(socket, queryStr ? (0, __WEBPACK_EXTERNAL_MODULE_node_querystring_aeb3c0b4__.parse)(queryStr) : {});
|
|
4531
4541
|
});
|
|
@@ -4550,23 +4560,28 @@ class SocketServer {
|
|
|
4550
4560
|
compilationId
|
|
4551
4561
|
}));
|
|
4552
4562
|
}
|
|
4553
|
-
close() {
|
|
4563
|
+
async close() {
|
|
4564
|
+
for (let socket of (this.clearHeartbeatTimer(), this.wsServer.removeAllListeners(), this.wsServer.clients))socket.terminate();
|
|
4554
4565
|
for (let socket of this.sockets)socket.close();
|
|
4555
|
-
this.
|
|
4566
|
+
return this.stats = {}, this.initialChunks = {}, this.sockets.length = 0, new Promise((resolve, reject)=>{
|
|
4567
|
+
this.wsServer.close((err)=>{
|
|
4568
|
+
err ? reject(err) : resolve();
|
|
4569
|
+
});
|
|
4570
|
+
});
|
|
4556
4571
|
}
|
|
4557
4572
|
onConnect(socket, params) {
|
|
4558
4573
|
socket.isAlive = !0, socket.on('pong', ()=>{
|
|
4559
4574
|
socket.isAlive = !0;
|
|
4560
|
-
}),
|
|
4561
|
-
let
|
|
4562
|
-
|
|
4575
|
+
}), this.sockets.push(socket), socket.on('close', ()=>{
|
|
4576
|
+
let index = this.sockets.indexOf(socket);
|
|
4577
|
+
index >= 0 && this.sockets.splice(index, 1);
|
|
4563
4578
|
}), (this.options.hmr || this.options.liveReload) && this.singleWrite(socket, {
|
|
4564
4579
|
type: 'hot',
|
|
4565
4580
|
compilationId: params.compilationId
|
|
4566
4581
|
}), this.stats && this.sendStats({
|
|
4567
4582
|
force: !0,
|
|
4568
4583
|
compilationId: params.compilationId
|
|
4569
|
-
})
|
|
4584
|
+
});
|
|
4570
4585
|
}
|
|
4571
4586
|
getStats(name) {
|
|
4572
4587
|
let curStats = this.stats[name];
|
|
@@ -4771,7 +4786,10 @@ class SocketServer {
|
|
|
4771
4786
|
1 === connection.readyState && connection.send(message);
|
|
4772
4787
|
}
|
|
4773
4788
|
constructor(options){
|
|
4774
|
-
socketServer_define_property(this, "wsServer", void 0), socketServer_define_property(this, "sockets", []), socketServer_define_property(this, "options", void 0), socketServer_define_property(this, "stats", void 0), socketServer_define_property(this, "initialChunks", void 0), socketServer_define_property(this, "
|
|
4789
|
+
socketServer_define_property(this, "wsServer", void 0), socketServer_define_property(this, "sockets", []), socketServer_define_property(this, "options", void 0), socketServer_define_property(this, "stats", void 0), socketServer_define_property(this, "initialChunks", void 0), socketServer_define_property(this, "heartbeatTimer", null), socketServer_define_property(this, "checkSockets", ()=>{
|
|
4790
|
+
for (let socket of this.wsServer.clients)socket.isAlive ? (socket.isAlive = !1, socket.ping(()=>{})) : socket.terminate();
|
|
4791
|
+
null !== this.heartbeatTimer && (this.heartbeatTimer = setTimeout(this.checkSockets, 30000));
|
|
4792
|
+
}), this.options = options, this.stats = {}, this.initialChunks = {};
|
|
4775
4793
|
}
|
|
4776
4794
|
}
|
|
4777
4795
|
function compilerDevMiddleware_define_property(obj, key, value) {
|
|
@@ -4804,7 +4822,7 @@ class CompilerDevMiddleware {
|
|
|
4804
4822
|
this.socketServer.upgrade(req, sock, head);
|
|
4805
4823
|
}
|
|
4806
4824
|
async close() {
|
|
4807
|
-
this.socketServer.close(), this.middleware && await new Promise((resolve)=>{
|
|
4825
|
+
await this.socketServer.close(), this.middleware && await new Promise((resolve)=>{
|
|
4808
4826
|
this.middleware.close(()=>{
|
|
4809
4827
|
resolve();
|
|
4810
4828
|
});
|
|
@@ -5494,7 +5512,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5494
5512
|
environment
|
|
5495
5513
|
}))
|
|
5496
5514
|
}
|
|
5497
|
-
])), { default: connect } = await import("../compiled/connect/index.js"), middlewares = connect(), httpServer = await createHttpServer({
|
|
5515
|
+
])), { default: connect } = await import("../compiled/connect/index.js"), middlewares = connect(), httpServer = config.server.middlewareMode ? null : await createHttpServer({
|
|
5498
5516
|
serverConfig: config.server,
|
|
5499
5517
|
middlewares
|
|
5500
5518
|
}), devServerAPI = {
|
|
@@ -5503,6 +5521,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5503
5521
|
environments: environmentAPI,
|
|
5504
5522
|
httpServer,
|
|
5505
5523
|
listen: async ()=>{
|
|
5524
|
+
if (!httpServer) throw Error('[rsbuild:server] Can not listen dev server as `server.middlewareMode` is enabled.');
|
|
5506
5525
|
let serverTerminator = getServerTerminator(httpServer);
|
|
5507
5526
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('listen dev server'), options.context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
|
|
5508
5527
|
httpServer.listen({
|
|
@@ -5558,6 +5577,12 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
|
|
|
5558
5577
|
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5559
5578
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create dev server done'), devServerAPI;
|
|
5560
5579
|
}
|
|
5580
|
+
function cutPath(filePath, root) {
|
|
5581
|
+
let prefix = root.endsWith(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) ? root : root + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep;
|
|
5582
|
+
if (filePath.startsWith(prefix)) return filePath.slice(prefix.length);
|
|
5583
|
+
let parts = filePath.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep).filter(Boolean);
|
|
5584
|
+
return parts.length > 3 ? parts.slice(-3).join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep) : parts.join(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep);
|
|
5585
|
+
}
|
|
5561
5586
|
async function createCompiler_createCompiler(options) {
|
|
5562
5587
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('create compiler');
|
|
5563
5588
|
let { context } = options, { rspackConfigs } = await initConfigs(options);
|
|
@@ -5566,10 +5591,20 @@ async function createCompiler_createCompiler(options) {
|
|
|
5566
5591
|
environments: context.environments
|
|
5567
5592
|
}), !await isSatisfyRspackVersion(__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.rspackVersion)) throw Error(`[rsbuild] The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.green(rspackMinVersion)}`);
|
|
5568
5593
|
let compiler = 1 === rspackConfigs.length ? (0, __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack)(rspackConfigs[0]) : (0, __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack)(rspackConfigs), isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
|
|
5569
|
-
isVersionLogged || (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`
|
|
5594
|
+
isVersionLogged || (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`use Rspack v${__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.rspackVersion}`), isVersionLogged = !0);
|
|
5570
5595
|
};
|
|
5571
|
-
compiler.hooks.watchRun.tap('rsbuild:compiling', ()=>{
|
|
5572
|
-
logRspackVersion(), isCompiling
|
|
5596
|
+
compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
5597
|
+
if (logRspackVersion(), !isCompiling) {
|
|
5598
|
+
let changedFiles = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles) : [], removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : [];
|
|
5599
|
+
if (changedFiles.length) {
|
|
5600
|
+
let fileInfo = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(changedFiles.map((file)=>cutPath(file, context.rootPath)).join(', '));
|
|
5601
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${fileInfo}`);
|
|
5602
|
+
} else if (removedFiles.length) {
|
|
5603
|
+
let fileInfo = removedFiles.map((file)=>cutPath(file, context.rootPath)).join(', ');
|
|
5604
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start(`building ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(`removed ${fileInfo}`)}`);
|
|
5605
|
+
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
|
|
5606
|
+
}
|
|
5607
|
+
isCompiling = !0;
|
|
5573
5608
|
}), 'build' === context.command && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
5574
5609
|
let done = (stats)=>{
|
|
5575
5610
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
@@ -5581,7 +5616,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
5581
5616
|
}), printTime = (c, index)=>{
|
|
5582
5617
|
if (c.time) {
|
|
5583
5618
|
let time = prettyTime(c.time / 1000), { name } = rspackConfigs[index], suffix = name ? __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.gray(` (${name})`) : '';
|
|
5584
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.ready(`
|
|
5619
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.ready(`built in ${time}${suffix}`);
|
|
5585
5620
|
}
|
|
5586
5621
|
}, hasErrors = stats.hasErrors();
|
|
5587
5622
|
if (!hasErrors) {
|
|
@@ -6576,12 +6611,12 @@ async function runCLI() {
|
|
|
6576
6611
|
}
|
|
6577
6612
|
}(), process.title = 'rsbuild-node';
|
|
6578
6613
|
let { npm_execpath } = process.env;
|
|
6579
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.
|
|
6614
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.12\n`);
|
|
6580
6615
|
}();
|
|
6581
6616
|
try {
|
|
6582
6617
|
!function() {
|
|
6583
6618
|
let cli = dist('rsbuild');
|
|
6584
|
-
cli.help(), cli.version("1.2.
|
|
6619
|
+
cli.help(), cli.version("1.2.12"), applyCommonOptions(cli);
|
|
6585
6620
|
let devCommand = cli.command('dev', 'starting the dev server'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
6586
6621
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6587
6622
|
try {
|
|
@@ -6632,6 +6667,6 @@ async function runCLI() {
|
|
|
6632
6667
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
6633
6668
|
}
|
|
6634
6669
|
}
|
|
6635
|
-
let src_version = "1.2.
|
|
6670
|
+
let src_version = "1.2.12";
|
|
6636
6671
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
6637
6672
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -27,9 +27,9 @@ export declare const urlJoin: (base: string, path: string) => string;
|
|
|
27
27
|
export declare const canParse: (url: string) => boolean;
|
|
28
28
|
export declare const parseUrl: (url: string) => URL | null;
|
|
29
29
|
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
30
|
-
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean):
|
|
31
|
-
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean):
|
|
32
|
-
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js' | 'css'>, isProd: boolean, isServer?: boolean):
|
|
30
|
+
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): Rspack.Filename;
|
|
31
|
+
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean): Rspack.CssFilename;
|
|
32
|
+
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js' | 'css'>, isProd: boolean, isServer?: boolean): Rspack.AssetModuleFilename;
|
|
33
33
|
export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
|
|
34
34
|
export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
|
|
35
35
|
export declare const upperFirst: (str: string) => string;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { rspack } from '@rspack/core';
|
|
|
6
6
|
import type * as Rspack from '@rspack/core';
|
|
7
7
|
export { loadEnv } from './loadEnv';
|
|
8
8
|
export { createRsbuild } from './createRsbuild';
|
|
9
|
-
export { loadConfig, defineConfig, type LoadConfigOptions, type LoadConfigResult, } from './config';
|
|
9
|
+
export { loadConfig, defineConfig, type ConfigParams, type LoadConfigOptions, type LoadConfigResult, } from './config';
|
|
10
10
|
export { runCLI } from './cli';
|
|
11
11
|
export declare const version: string;
|
|
12
12
|
export { rspack };
|
package/dist-types/loadEnv.d.ts
CHANGED
|
@@ -14,11 +14,21 @@ export type LoadEnvOptions = {
|
|
|
14
14
|
* @default ['PUBLIC_']
|
|
15
15
|
*/
|
|
16
16
|
prefixes?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Specify a target object to store environment variables.
|
|
19
|
+
* If not provided, variables will be written to `process.env`.
|
|
20
|
+
* @default process.env
|
|
21
|
+
*/
|
|
22
|
+
processEnv?: Record<string, string>;
|
|
17
23
|
};
|
|
18
|
-
export declare function loadEnv({ cwd, mode, prefixes, }?: LoadEnvOptions): {
|
|
19
|
-
/**
|
|
24
|
+
export declare function loadEnv({ cwd, mode, prefixes, processEnv, }?: LoadEnvOptions): {
|
|
25
|
+
/**
|
|
26
|
+
* All env variables in the .env file
|
|
27
|
+
*/
|
|
20
28
|
parsed: Record<string, string>;
|
|
21
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The absolute paths to all env files
|
|
31
|
+
*/
|
|
22
32
|
filePaths: string[];
|
|
23
33
|
/**
|
|
24
34
|
* Env variables that start with prefixes.
|
|
@@ -45,6 +55,8 @@ export declare function loadEnv({ cwd, mode, prefixes, }?: LoadEnvOptions): {
|
|
|
45
55
|
* ```
|
|
46
56
|
**/
|
|
47
57
|
publicVars: Record<string, string>;
|
|
48
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Clear the env variables mounted on `process.env`
|
|
60
|
+
*/
|
|
49
61
|
cleanup: () => void;
|
|
50
62
|
};
|
package/dist-types/logger.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging message case convention:
|
|
3
|
+
*
|
|
4
|
+
* Info, ready, success and debug messages:
|
|
5
|
+
* - Start with lowercase
|
|
6
|
+
* - Example: "info build started..."
|
|
7
|
+
*
|
|
8
|
+
* Errors and warnings:
|
|
9
|
+
* - Start with uppercase
|
|
10
|
+
* - Example: "error Failed to build"
|
|
11
|
+
*
|
|
12
|
+
* This convention helps distinguish between normal operations
|
|
13
|
+
* and important alerts that require attention.
|
|
14
|
+
*/
|
|
1
15
|
import { type Logger, logger } from '../compiled/rslog/index.js';
|
|
2
16
|
export declare const isDebug: () => boolean;
|
|
3
17
|
export { logger };
|
|
@@ -11,7 +11,8 @@ export type RsbuildDevServer = {
|
|
|
11
11
|
middlewares: Connect.Server;
|
|
12
12
|
/**
|
|
13
13
|
* The Node.js HTTP server instance.
|
|
14
|
-
* Will be `Http2SecureServer` if `server.https` config is used.
|
|
14
|
+
* - Will be `Http2SecureServer` if `server.https` config is used.
|
|
15
|
+
* - Will be `null` if `server.middlewareMode` is enabled.
|
|
15
16
|
*/
|
|
16
17
|
httpServer: import('node:http').Server | import('node:http2').Http2SecureServer | null;
|
|
17
18
|
/**
|
|
@@ -12,14 +12,16 @@ export declare class SocketServer {
|
|
|
12
12
|
private readonly options;
|
|
13
13
|
private stats;
|
|
14
14
|
private initialChunks;
|
|
15
|
-
private
|
|
15
|
+
private heartbeatTimer;
|
|
16
16
|
constructor(options: DevConfig);
|
|
17
17
|
upgrade(req: IncomingMessage, sock: Socket, head: any): void;
|
|
18
|
+
private checkSockets;
|
|
19
|
+
private clearHeartbeatTimer;
|
|
18
20
|
prepare(): Promise<void>;
|
|
19
21
|
updateStats(stats: Rspack.Stats): void;
|
|
20
22
|
sockWrite({ type, compilationId, data }: SocketMessage): void;
|
|
21
23
|
private singleWrite;
|
|
22
|
-
close(): void
|
|
24
|
+
close(): Promise<void>;
|
|
23
25
|
private onConnect;
|
|
24
26
|
private getStats;
|
|
25
27
|
private sendStats;
|