@rsbuild/core 0.6.7 → 0.6.9
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/commander/{typings/index.d.ts → index.d.ts} +26 -24
- package/compiled/commander/index.js +3528 -1
- package/compiled/commander/package.json +1 -1
- package/compiled/connect-history-api-fallback/index.js +186 -1
- package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +16 -12
- package/compiled/dotenv/index.js +458 -1
- package/compiled/dotenv/package.json +1 -1
- package/compiled/dotenv-expand/{lib/main.d.ts → index.d.ts} +9 -7
- package/compiled/dotenv-expand/index.js +146 -1
- package/compiled/dotenv-expand/package.json +1 -1
- package/compiled/http-compression/index.js +185 -1
- package/compiled/launch-editor-middleware/index.js +843 -1
- package/compiled/on-finished/index.d.ts +2 -2
- package/compiled/on-finished/index.js +390 -3
- package/compiled/on-finished/package.json +1 -1
- package/compiled/open/index.d.ts +1 -153
- package/compiled/open/index.js +526 -1
- package/compiled/open/package.json +1 -1
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +798 -1
- package/compiled/sirv/package.json +1 -1
- package/compiled/webpack-dev-middleware/index.d.ts +1 -0
- package/compiled/webpack-dev-middleware/index.js +6696 -0
- package/compiled/webpack-dev-middleware/license +20 -0
- package/compiled/webpack-dev-middleware/package.json +1 -0
- package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
- package/compiled/ws/index.d.ts +7 -15
- package/compiled/ws/index.js +4885 -1
- package/compiled/ws/package.json +1 -1
- package/dist/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/client/format.d.ts +5 -0
- package/dist/client/{formatStats.js → format.js} +22 -46
- package/dist/client/hmr.d.ts +5 -0
- package/dist/client/hmr.mjs +201 -474
- package/dist/client/overlay.mjs +208 -237
- package/dist/createContext.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/target.js +19 -16
- package/dist/provider/plugins/swc.js +1 -0
- package/dist/provider/shared.js +2 -2
- package/dist/server/devMiddleware.js +1 -1
- package/dist/server/devServer.js +6 -1
- package/dist/server/getDevMiddlewares.d.ts +3 -0
- package/dist/server/getDevMiddlewares.js +6 -8
- package/dist/server/helper.d.ts +4 -4
- package/dist/server/middlewares.d.ts +5 -2
- package/dist/server/middlewares.js +1 -7
- package/package.json +6 -5
- package/compiled/open/license +0 -9
- package/compiled/sirv/sirv.d.ts +0 -27
- package/dist/client/formatStats.d.ts +0 -12
- package/dist/client/hmr/createSocketUrl.d.ts +0 -12
- package/dist/client/hmr/index.d.ts +0 -4
|
@@ -1 +1,185 @@
|
|
|
1
|
-
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ 241:
|
|
6
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const zlib = __nccwpck_require__(796)
|
|
11
|
+
|
|
12
|
+
const MIMES = /text|javascript|\/json|xml/i
|
|
13
|
+
|
|
14
|
+
const noop = () => {}
|
|
15
|
+
|
|
16
|
+
const getChunkSize = (chunk, enc) => (chunk ? Buffer.byteLength(chunk, enc) : 0)
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {object} [options]
|
|
20
|
+
* @param {number} [options.threshold = 1024] Don't compress responses below this size (in bytes)
|
|
21
|
+
* @param {number} [options.level = -1] Gzip/Brotli compression effort (1-11, or -1 for default)
|
|
22
|
+
* @param {boolean} [options.brotli = true] Generate and serve Brotli-compressed responses
|
|
23
|
+
* @param {boolean} [options.gzip = true] Generate and serve Gzip-compressed responses
|
|
24
|
+
* @param {RegExp} [options.mimes] Regular expression of response MIME types to compress (default: text|javascript|json|xml)
|
|
25
|
+
* @returns {(req: Pick<import('http').IncomingMessage, 'method'|'headers'>, res: import('http').ServerResponse, next?:Function) => void}
|
|
26
|
+
* @return Express style middleware
|
|
27
|
+
*/
|
|
28
|
+
module.exports = ({
|
|
29
|
+
threshold = 1024,
|
|
30
|
+
level = -1,
|
|
31
|
+
brotli = true,
|
|
32
|
+
gzip = true,
|
|
33
|
+
mimes = MIMES
|
|
34
|
+
} = {}) => {
|
|
35
|
+
const brotliOpts = (typeof brotli === 'object' && brotli) || {}
|
|
36
|
+
const gzipOpts = (typeof gzip === 'object' && gzip) || {}
|
|
37
|
+
|
|
38
|
+
if (brotli && !zlib.createBrotliCompress) brotli = false
|
|
39
|
+
|
|
40
|
+
return (req, res, next = noop) => {
|
|
41
|
+
const accept = req.headers['accept-encoding']
|
|
42
|
+
const encoding =
|
|
43
|
+
accept &&
|
|
44
|
+
((brotli && accept.match(/\bbr\b/)) ||
|
|
45
|
+
(gzip && accept.match(/\bgzip\b/)) ||
|
|
46
|
+
[])[0]
|
|
47
|
+
|
|
48
|
+
if (req.method === 'HEAD' || !encoding) return next()
|
|
49
|
+
|
|
50
|
+
let compress
|
|
51
|
+
let pendingStatus
|
|
52
|
+
let pendingListeners = []
|
|
53
|
+
let started = false
|
|
54
|
+
let size = 0
|
|
55
|
+
|
|
56
|
+
function start () {
|
|
57
|
+
started = true
|
|
58
|
+
size = res.getHeader('Content-Length') | 0 || size
|
|
59
|
+
const compressible = mimes.test(
|
|
60
|
+
String(res.getHeader('Content-Type') || 'text/plain')
|
|
61
|
+
)
|
|
62
|
+
const cleartext = !res.getHeader('Content-Encoding')
|
|
63
|
+
const listeners = pendingListeners || []
|
|
64
|
+
if (compressible && cleartext && size >= threshold) {
|
|
65
|
+
res.setHeader('Content-Encoding', encoding)
|
|
66
|
+
res.removeHeader('Content-Length')
|
|
67
|
+
if (encoding === 'br') {
|
|
68
|
+
compress = zlib.createBrotliCompress({
|
|
69
|
+
params: Object.assign({
|
|
70
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]: level === -1 ? 1 : level,
|
|
71
|
+
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: size
|
|
72
|
+
}, brotliOpts)
|
|
73
|
+
})
|
|
74
|
+
} else {
|
|
75
|
+
compress = zlib.createGzip(Object.assign({ level: level === -1 ? 7 : level }, gzipOpts))
|
|
76
|
+
}
|
|
77
|
+
// backpressure
|
|
78
|
+
compress.on(
|
|
79
|
+
'data',
|
|
80
|
+
chunk => write.call(res, chunk) === false && compress.pause()
|
|
81
|
+
)
|
|
82
|
+
on.call(res, 'drain', () => compress.resume())
|
|
83
|
+
compress.on('end', () => end.call(res))
|
|
84
|
+
listeners.forEach(p => compress.on.apply(compress, p))
|
|
85
|
+
} else {
|
|
86
|
+
pendingListeners = null
|
|
87
|
+
listeners.forEach(p => on.apply(res, p))
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
writeHead.call(res, pendingStatus || res.statusCode)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const { end, write, on, writeHead } = res
|
|
94
|
+
|
|
95
|
+
res.writeHead = function (status, reason, headers) {
|
|
96
|
+
if (typeof reason !== 'string') [headers, reason] = [reason, headers]
|
|
97
|
+
if (headers) for (const i in headers) res.setHeader(i, headers[i])
|
|
98
|
+
pendingStatus = status
|
|
99
|
+
return this
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
res.write = function (chunk, enc) {
|
|
103
|
+
size += getChunkSize(chunk, enc)
|
|
104
|
+
if (!started) start()
|
|
105
|
+
if (!compress) return write.apply(this, arguments)
|
|
106
|
+
return compress.write.apply(compress, arguments)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
res.end = function (chunk, enc) {
|
|
110
|
+
if (arguments.length > 0 && typeof chunk !== 'function') {
|
|
111
|
+
size += getChunkSize(chunk, enc)
|
|
112
|
+
}
|
|
113
|
+
if (!started) start()
|
|
114
|
+
if (!compress) return end.apply(this, arguments)
|
|
115
|
+
return compress.end.apply(compress, arguments)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
res.on = function (type, listener) {
|
|
119
|
+
if (!pendingListeners || type !== 'drain') on.call(this, type, listener)
|
|
120
|
+
else if (compress) compress.on(type, listener)
|
|
121
|
+
else pendingListeners.push([type, listener])
|
|
122
|
+
return this
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
next()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/***/ }),
|
|
131
|
+
|
|
132
|
+
/***/ 796:
|
|
133
|
+
/***/ ((module) => {
|
|
134
|
+
|
|
135
|
+
module.exports = require("zlib");
|
|
136
|
+
|
|
137
|
+
/***/ })
|
|
138
|
+
|
|
139
|
+
/******/ });
|
|
140
|
+
/************************************************************************/
|
|
141
|
+
/******/ // The module cache
|
|
142
|
+
/******/ var __webpack_module_cache__ = {};
|
|
143
|
+
/******/
|
|
144
|
+
/******/ // The require function
|
|
145
|
+
/******/ function __nccwpck_require__(moduleId) {
|
|
146
|
+
/******/ // Check if module is in cache
|
|
147
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
148
|
+
/******/ if (cachedModule !== undefined) {
|
|
149
|
+
/******/ return cachedModule.exports;
|
|
150
|
+
/******/ }
|
|
151
|
+
/******/ // Create a new module (and put it into the cache)
|
|
152
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
153
|
+
/******/ // no module.id needed
|
|
154
|
+
/******/ // no module.loaded needed
|
|
155
|
+
/******/ exports: {}
|
|
156
|
+
/******/ };
|
|
157
|
+
/******/
|
|
158
|
+
/******/ // Execute the module function
|
|
159
|
+
/******/ var threw = true;
|
|
160
|
+
/******/ try {
|
|
161
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
162
|
+
/******/ threw = false;
|
|
163
|
+
/******/ } finally {
|
|
164
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
165
|
+
/******/ }
|
|
166
|
+
/******/
|
|
167
|
+
/******/ // Return the exports of the module
|
|
168
|
+
/******/ return module.exports;
|
|
169
|
+
/******/ }
|
|
170
|
+
/******/
|
|
171
|
+
/************************************************************************/
|
|
172
|
+
/******/ /* webpack/runtime/compat */
|
|
173
|
+
/******/
|
|
174
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
175
|
+
/******/
|
|
176
|
+
/************************************************************************/
|
|
177
|
+
/******/
|
|
178
|
+
/******/ // startup
|
|
179
|
+
/******/ // Load entry module and return exports
|
|
180
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
181
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(241);
|
|
182
|
+
/******/ module.exports = __webpack_exports__;
|
|
183
|
+
/******/
|
|
184
|
+
/******/ })()
|
|
185
|
+
;
|