@rsbuild/core 2.0.0-beta.6 → 2.0.0-beta.8
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/bin/rsbuild.js +13 -0
- package/compiled/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +60 -60
- package/compiled/jiti/dist/jiti.cjs +2 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/postcss/lib/comment.d.ts +1 -1
- package/compiled/postcss/lib/container.d.ts +1 -1
- package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
- package/compiled/postcss/lib/declaration.d.ts +1 -1
- package/compiled/postcss/lib/document.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +1 -1
- package/compiled/postcss/lib/lazy-result.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +1 -1
- package/compiled/postcss/lib/node.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/processor.d.ts +1 -1
- package/compiled/postcss/lib/result.d.ts +1 -1
- package/compiled/postcss/lib/root.d.ts +1 -1
- package/compiled/postcss/lib/rule.d.ts +1 -1
- package/compiled/postcss/lib/stringifier.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +17 -1
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +0 -2
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.js +37 -94
- package/compiled/style-loader/package.json +1 -1
- package/dist/{131.js → 958.js} +1125 -1083
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +2 -2
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +57 -552
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +31 -15
- package/dist/manifest-plugin.js +18 -18
- package/dist/memfs.js +217 -756
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +36 -34
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +3 -3
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +114 -69
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1541 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/vendors.d.ts +0 -1
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/config.d.ts +4 -4
- package/dist-types/types/thirdParty.d.ts +14 -5
- package/package.json +13 -14
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/712.js +0 -15
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -570
- package/dist-types/helpers/color.d.ts +0 -4
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/open.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import { constants
|
|
7
|
-
|
|
2
|
+
import node_process from "node:process";
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import node_child_process, { execFile as external_node_child_process_execFile } from "node:child_process";
|
|
6
|
+
import promises, { constants } from "node:fs/promises";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
import node_os from "node:os";
|
|
9
|
+
import node_fs from "node:fs";
|
|
10
|
+
import { Buffer } from "node:buffer";
|
|
8
11
|
function hasDockerEnv() {
|
|
9
12
|
try {
|
|
10
|
-
return
|
|
13
|
+
return node_fs.statSync('/.dockerenv'), !0;
|
|
11
14
|
} catch {
|
|
12
15
|
return !1;
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
function hasDockerCGroup() {
|
|
16
19
|
try {
|
|
17
|
-
return
|
|
20
|
+
return node_fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
18
21
|
} catch {
|
|
19
22
|
return !1;
|
|
20
23
|
}
|
|
@@ -25,23 +28,22 @@ function isDocker() {
|
|
|
25
28
|
function isInsideContainer() {
|
|
26
29
|
return void 0 === cachedResult && (cachedResult = (()=>{
|
|
27
30
|
try {
|
|
28
|
-
return
|
|
31
|
+
return node_fs.statSync('/run/.containerenv'), !0;
|
|
29
32
|
} catch {
|
|
30
33
|
return !1;
|
|
31
34
|
}
|
|
32
35
|
})() || isDocker()), cachedResult;
|
|
33
36
|
}
|
|
34
|
-
let
|
|
35
|
-
if ('linux' !==
|
|
36
|
-
if (
|
|
37
|
+
let isWsl = ()=>{
|
|
38
|
+
if ('linux' !== node_process.platform) return !1;
|
|
39
|
+
if (node_os.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
|
|
37
40
|
try {
|
|
38
|
-
|
|
39
|
-
} catch {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, is_wsl = external_node_process_.default.env.__IS_WSL_TEST__ ? isWsl : isWsl(), external_node_buffer_ = __webpack_require__("node:buffer"), powershell_utils_execFile = external_node_util_promisify(node_child_process.execFile), powerShellPath = ()=>`${external_node_process_.default.env.SYSTEMROOT || external_node_process_.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
|
|
41
|
+
if (node_fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
|
|
42
|
+
} catch {}
|
|
43
|
+
return !!(node_fs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop') || node_fs.existsSync('/run/WSL')) && !isInsideContainer();
|
|
44
|
+
}, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), execFile = promisify(node_child_process.execFile), powerShellPath = ()=>`${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
|
|
43
45
|
let { powerShellPath: psPath, ...execFileOptions } = options, encodedCommand = executePowerShell.encodeCommand(command);
|
|
44
|
-
return
|
|
46
|
+
return execFile(psPath ?? powerShellPath(), [
|
|
45
47
|
...executePowerShell.argumentsPrefix,
|
|
46
48
|
encodedCommand
|
|
47
49
|
], {
|
|
@@ -62,8 +64,8 @@ executePowerShell.argumentsPrefix = [
|
|
|
62
64
|
'-ExecutionPolicy',
|
|
63
65
|
'Bypass',
|
|
64
66
|
'-EncodedCommand'
|
|
65
|
-
], executePowerShell.encodeCommand = (command)=>
|
|
66
|
-
let wsl_utils_execFile =
|
|
67
|
+
], executePowerShell.encodeCommand = (command)=>Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
|
|
68
|
+
let wsl_utils_execFile = promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
|
|
67
69
|
if (mountPoint) return mountPoint;
|
|
68
70
|
let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
|
|
69
71
|
try {
|
|
@@ -121,9 +123,9 @@ function defineLazyProperty(object, propertyName, valueGetter) {
|
|
|
121
123
|
}
|
|
122
124
|
}), object;
|
|
123
125
|
}
|
|
124
|
-
let execFileAsync =
|
|
126
|
+
let execFileAsync = promisify(external_node_child_process_execFile);
|
|
125
127
|
async function defaultBrowserId() {
|
|
126
|
-
if ('darwin' !==
|
|
128
|
+
if ('darwin' !== node_process.platform) throw Error('macOS only');
|
|
127
129
|
let { stdout } = await execFileAsync('defaults', [
|
|
128
130
|
'read',
|
|
129
131
|
'com.apple.LaunchServices/com.apple.launchservices.secure',
|
|
@@ -131,9 +133,9 @@ async function defaultBrowserId() {
|
|
|
131
133
|
]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout), browserId = match?.groups.id ?? 'com.apple.Safari';
|
|
132
134
|
return 'com.apple.safari' === browserId ? 'com.apple.Safari' : browserId;
|
|
133
135
|
}
|
|
134
|
-
let run_applescript_execFileAsync =
|
|
136
|
+
let run_applescript_execFileAsync = promisify(external_node_child_process_execFile);
|
|
135
137
|
async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
|
|
136
|
-
if ('darwin' !==
|
|
138
|
+
if ('darwin' !== node_process.platform) throw Error('macOS only');
|
|
137
139
|
let execOptions = {};
|
|
138
140
|
signal && (execOptions.signal = signal);
|
|
139
141
|
let { stdout } = await run_applescript_execFileAsync("osascript", [
|
|
@@ -148,7 +150,7 @@ async function runAppleScript(script, { humanReadableOutput = !0, signal } = {})
|
|
|
148
150
|
async function bundleName(bundleId) {
|
|
149
151
|
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
150
152
|
}
|
|
151
|
-
let windows_execFileAsync =
|
|
153
|
+
let windows_execFileAsync = promisify(external_node_child_process_execFile), windowsBrowserProgIds = {
|
|
152
154
|
MSEdgeHTM: {
|
|
153
155
|
name: 'Edge',
|
|
154
156
|
id: 'com.microsoft.edge'
|
|
@@ -230,16 +232,16 @@ async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
|
|
|
230
232
|
id
|
|
231
233
|
};
|
|
232
234
|
}
|
|
233
|
-
let default_browser_execFileAsync =
|
|
235
|
+
let default_browser_execFileAsync = promisify(external_node_child_process_execFile);
|
|
234
236
|
async function default_browser_defaultBrowser() {
|
|
235
|
-
if ('darwin' ===
|
|
237
|
+
if ('darwin' === node_process.platform) {
|
|
236
238
|
let id = await defaultBrowserId();
|
|
237
239
|
return {
|
|
238
240
|
name: await bundleName(id),
|
|
239
241
|
id
|
|
240
242
|
};
|
|
241
243
|
}
|
|
242
|
-
if ('linux' ===
|
|
244
|
+
if ('linux' === node_process.platform) {
|
|
243
245
|
let { stdout } = await default_browser_execFileAsync('xdg-mime', [
|
|
244
246
|
'query',
|
|
245
247
|
'default',
|
|
@@ -250,10 +252,10 @@ async function default_browser_defaultBrowser() {
|
|
|
250
252
|
id
|
|
251
253
|
};
|
|
252
254
|
}
|
|
253
|
-
if ('win32' ===
|
|
255
|
+
if ('win32' === node_process.platform) return defaultBrowser();
|
|
254
256
|
throw Error('Only macOS, Linux, and Windows are supported');
|
|
255
257
|
}
|
|
256
|
-
let isInSsh = !!(
|
|
258
|
+
let isInSsh = !!(node_process.env.SSH_CONNECTION || node_process.env.SSH_CLIENT || node_process.env.SSH_TTY), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? node_path.dirname(fileURLToPath(import.meta.url)) : '', localXdgOpenPath = node_path.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = node_process, tryEachApp = async (apps, opener)=>{
|
|
257
259
|
if (0 === apps.length) return;
|
|
258
260
|
let errors = [];
|
|
259
261
|
for (let app of apps)try {
|
|
@@ -340,7 +342,7 @@ let isInSsh = !!(external_node_process_.default.env.SSH_CONNECTION || external_n
|
|
|
340
342
|
try {
|
|
341
343
|
await promises.access(localXdgOpenPath, constants.X_OK), exeLocalXdgOpen = !0;
|
|
342
344
|
} catch {}
|
|
343
|
-
command =
|
|
345
|
+
command = node_process.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
|
|
344
346
|
}
|
|
345
347
|
appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
|
|
346
348
|
}
|
|
@@ -427,11 +429,11 @@ defineLazyProperty(open_apps, 'chrome', ()=>detectPlatformBinary({
|
|
|
427
429
|
})), defineLazyProperty(open_apps, 'safari', ()=>detectPlatformBinary({
|
|
428
430
|
darwin: 'Safari'
|
|
429
431
|
}));
|
|
430
|
-
|
|
432
|
+
export default ((target, options)=>{
|
|
431
433
|
if ('string' != typeof target) throw TypeError('Expected a `target`');
|
|
432
434
|
return baseOpen({
|
|
433
435
|
...options,
|
|
434
436
|
target
|
|
435
437
|
});
|
|
436
|
-
};
|
|
437
|
-
export {
|
|
438
|
+
});
|
|
439
|
+
export { open_apps as apps };
|
package/dist/range-parser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*!
|
|
1
|
+
/*! LICENSE: range-parser.js.LICENSE.txt */
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
4
|
"../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js" (module) {
|
|
@@ -46,4 +46,4 @@ __webpack_require__.add({
|
|
|
46
46
|
return ranges.length < 1 ? -1 : options && options.combine ? combineRanges(ranges) : ranges;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
});
|
|
49
|
+
}), __webpack_require__("../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js");
|
package/dist/remapping.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./
|
|
1
|
+
import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./trace-mapping.js";
|
|
2
2
|
var SetArray = class {
|
|
3
3
|
constructor(){
|
|
4
4
|
this._indexes = {
|
|
@@ -193,4 +193,4 @@ function remapping(input, loader, options) {
|
|
|
193
193
|
decodedMappings: !1
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
export
|
|
196
|
+
export default remapping;
|
package/dist/rslib-runtime.js
CHANGED
|
@@ -7,9 +7,7 @@ function __webpack_require__(moduleId) {
|
|
|
7
7
|
};
|
|
8
8
|
return __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.exports;
|
|
9
9
|
}
|
|
10
|
-
__webpack_require__.m = __webpack_modules__, __webpack_require__.
|
|
11
|
-
Object.assign(__webpack_require__.m, modules);
|
|
12
|
-
}, __webpack_require__.n = (module)=>{
|
|
10
|
+
__webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
13
11
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
14
12
|
return __webpack_require__.d(getter, {
|
|
15
13
|
a: getter
|
|
@@ -34,6 +32,8 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.add = function
|
|
|
34
32
|
enumerable: !0,
|
|
35
33
|
get: definition[key]
|
|
36
34
|
});
|
|
35
|
+
}, __webpack_require__.add = function registerModules(modules) {
|
|
36
|
+
Object.assign(__webpack_require__.m, modules);
|
|
37
37
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
|
|
38
38
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
|
39
39
|
value: 'Module'
|
package/dist/sirv.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createReadStream, existsSync, statSync } from "node:fs";
|
|
2
|
+
import { join, normalize, resolve, sep } from "node:path";
|
|
3
|
+
import { join as external_path_join, resolve as external_path_resolve } from "path";
|
|
4
|
+
import { readdirSync, statSync as external_fs_statSync } from "fs";
|
|
2
5
|
import { parse } from "node:querystring";
|
|
3
|
-
import "./
|
|
4
|
-
import { lookup as mrmime_lookup } from "./710.js";
|
|
5
|
-
let external_path_ = __webpack_require__("path"), external_fs_ = __webpack_require__("fs");
|
|
6
|
+
import { lookup as mrmime_lookup } from "./mrmime.js";
|
|
6
7
|
function totalist(dir, callback, pre = '') {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for(; i < arr.length; i++)abs = (0, external_path_.join)(dir, arr[i]), (stats = (0, external_fs_.statSync)(abs)).isDirectory() ? totalist(abs, callback, (0, external_path_.join)(pre, arr[i])) : callback((0, external_path_.join)(pre, arr[i]), abs, stats);
|
|
8
|
+
let arr = readdirSync(dir = external_path_resolve('.', dir)), i = 0, abs, stats;
|
|
9
|
+
for(; i < arr.length; i++)(stats = external_fs_statSync(abs = external_path_join(dir, arr[i]))).isDirectory() ? totalist(abs, callback, external_path_join(pre, arr[i])) : callback(external_path_join(pre, arr[i]), abs, stats);
|
|
10
10
|
}
|
|
11
11
|
function build_parse(req) {
|
|
12
12
|
let raw = req.url;
|
|
@@ -26,7 +26,7 @@ function build_parse(req) {
|
|
|
26
26
|
raw
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
let
|
|
29
|
+
let noop = ()=>{};
|
|
30
30
|
function isMatch(uri, arr) {
|
|
31
31
|
for(let i = 0; i < arr.length; i++)if (arr[i].test(uri)) return !0;
|
|
32
32
|
}
|
|
@@ -43,8 +43,8 @@ function viaCache(cache, uri, extns) {
|
|
|
43
43
|
}
|
|
44
44
|
function viaLocal(dir, isEtag, uri, extns) {
|
|
45
45
|
let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
|
|
46
|
-
for(; i < arr.length; i++)if ((abs =
|
|
47
|
-
if ((stats =
|
|
46
|
+
for(; i < arr.length; i++)if ((abs = normalize(join(dir, name = arr[i]))).startsWith(dir) && existsSync(abs)) {
|
|
47
|
+
if ((stats = statSync(abs)).isDirectory()) continue;
|
|
48
48
|
return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
|
|
49
49
|
abs,
|
|
50
50
|
stats,
|
|
@@ -66,7 +66,7 @@ function send(req, res, file, stats, headers) {
|
|
|
66
66
|
if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
|
|
67
67
|
headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
|
|
68
68
|
}
|
|
69
|
-
res.writeHead(code, headers),
|
|
69
|
+
res.writeHead(code, headers), createReadStream(file, opts).pipe(res);
|
|
70
70
|
}
|
|
71
71
|
let ENCODING = {
|
|
72
72
|
'.br': 'br',
|
|
@@ -83,7 +83,7 @@ function toHeaders(name, stats, isEtag) {
|
|
|
83
83
|
return enc && (headers['Content-Encoding'] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
|
|
84
84
|
}
|
|
85
85
|
function build(dir, opts = {}) {
|
|
86
|
-
dir =
|
|
86
|
+
dir = resolve(dir || '.');
|
|
87
87
|
let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || [
|
|
88
88
|
'html',
|
|
89
89
|
'htm'
|
|
@@ -107,7 +107,7 @@ function build(dir, opts = {}) {
|
|
|
107
107
|
headers
|
|
108
108
|
};
|
|
109
109
|
});
|
|
110
|
-
let lookup = opts.dev ? viaLocal.bind(0, dir +
|
|
110
|
+
let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
|
|
111
111
|
return function(req, res, next) {
|
|
112
112
|
let extns = [
|
|
113
113
|
''
|
|
@@ -119,4 +119,4 @@ function build(dir, opts = {}) {
|
|
|
119
119
|
return data ? isEtag && req.headers['if-none-match'] === data.headers.ETag ? (res.writeHead(304), res.end()) : void ((gzips || brots) && res.setHeader('Vary', 'Accept-Encoding'), setHeaders(res, pathname, data.stats), send(req, res, data.abs, data.stats, data.headers)) : next ? next() : isNotFound(req, res);
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
export
|
|
122
|
+
export default build;
|