@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.
Files changed (54) hide show
  1. package/compiled/commander/{typings/index.d.ts → index.d.ts} +26 -24
  2. package/compiled/commander/index.js +3528 -1
  3. package/compiled/commander/package.json +1 -1
  4. package/compiled/connect-history-api-fallback/index.js +186 -1
  5. package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +16 -12
  6. package/compiled/dotenv/index.js +458 -1
  7. package/compiled/dotenv/package.json +1 -1
  8. package/compiled/dotenv-expand/{lib/main.d.ts → index.d.ts} +9 -7
  9. package/compiled/dotenv-expand/index.js +146 -1
  10. package/compiled/dotenv-expand/package.json +1 -1
  11. package/compiled/http-compression/index.js +185 -1
  12. package/compiled/launch-editor-middleware/index.js +843 -1
  13. package/compiled/on-finished/index.d.ts +2 -2
  14. package/compiled/on-finished/index.js +390 -3
  15. package/compiled/on-finished/package.json +1 -1
  16. package/compiled/open/index.d.ts +1 -153
  17. package/compiled/open/index.js +526 -1
  18. package/compiled/open/package.json +1 -1
  19. package/compiled/sirv/index.d.ts +1 -0
  20. package/compiled/sirv/index.js +798 -1
  21. package/compiled/sirv/package.json +1 -1
  22. package/compiled/webpack-dev-middleware/index.d.ts +1 -0
  23. package/compiled/webpack-dev-middleware/index.js +6696 -0
  24. package/compiled/webpack-dev-middleware/license +20 -0
  25. package/compiled/webpack-dev-middleware/package.json +1 -0
  26. package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
  27. package/compiled/ws/index.d.ts +7 -15
  28. package/compiled/ws/index.js +4885 -1
  29. package/compiled/ws/package.json +1 -1
  30. package/dist/cli/commands.js +1 -1
  31. package/dist/cli/prepare.js +1 -1
  32. package/dist/client/format.d.ts +5 -0
  33. package/dist/client/{formatStats.js → format.js} +22 -46
  34. package/dist/client/hmr.d.ts +5 -0
  35. package/dist/client/hmr.mjs +201 -474
  36. package/dist/client/overlay.mjs +208 -237
  37. package/dist/createContext.js +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/plugins/target.js +19 -16
  40. package/dist/provider/plugins/swc.js +1 -0
  41. package/dist/provider/shared.js +2 -2
  42. package/dist/server/devMiddleware.js +1 -1
  43. package/dist/server/devServer.js +6 -1
  44. package/dist/server/getDevMiddlewares.d.ts +3 -0
  45. package/dist/server/getDevMiddlewares.js +6 -8
  46. package/dist/server/helper.d.ts +4 -4
  47. package/dist/server/middlewares.d.ts +5 -2
  48. package/dist/server/middlewares.js +1 -7
  49. package/package.json +6 -5
  50. package/compiled/open/license +0 -9
  51. package/compiled/sirv/sirv.d.ts +0 -27
  52. package/dist/client/formatStats.d.ts +0 -12
  53. package/dist/client/hmr/createSocketUrl.d.ts +0 -12
  54. package/dist/client/hmr/index.d.ts +0 -4
@@ -1 +1 @@
1
- {"name":"commander","author":"TJ Holowaychuk <tj@vision-media.ca>","version":"12.0.0","license":"MIT","types":"typings/index.d.ts","type":"commonjs"}
1
+ {"name":"commander","author":"TJ Holowaychuk <tj@vision-media.ca>","version":"12.0.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1 +1,186 @@
1
- (()=>{"use strict";var e={945:(e,r,t)=>{var n=t(310);r=e.exports=function historyApiFallback(e){e=e||{};var r=getLogger(e);return function(t,i,a){var o=t.headers;if(t.method!=="GET"&&t.method!=="HEAD"){r("Not rewriting",t.method,t.url,"because the method is not GET or HEAD.");return a()}else if(!o||typeof o.accept!=="string"){r("Not rewriting",t.method,t.url,"because the client did not send an HTTP accept header.");return a()}else if(o.accept.indexOf("application/json")===0){r("Not rewriting",t.method,t.url,"because the client prefers JSON.");return a()}else if(!acceptsHtml(o.accept,e)){r("Not rewriting",t.method,t.url,"because the client does not accept HTML.");return a()}var u=n.parse(t.url);var l;e.rewrites=e.rewrites||[];for(var c=0;c<e.rewrites.length;c++){var s=e.rewrites[c];var f=u.pathname.match(s.from);if(f!==null){l=evaluateRewriteRule(u,f,s.to,t);if(l.charAt(0)!=="/"){r("We recommend using an absolute path for the rewrite target.","Received a non-absolute rewrite target",l,"for URL",t.url)}r("Rewriting",t.method,t.url,"to",l);t.url=l;return a()}}var d=u.pathname;if(d.lastIndexOf(".")>d.lastIndexOf("/")&&e.disableDotRule!==true){r("Not rewriting",t.method,t.url,"because the path includes a dot (.) character.");return a()}l=e.index||"/index.html";r("Rewriting",t.method,t.url,"to",l);t.url=l;a()}};function evaluateRewriteRule(e,r,t,n){if(typeof t==="string"){return t}else if(typeof t!=="function"){throw new Error("Rewrite rule can only be of type string or function.")}return t({parsedUrl:e,match:r,request:n})}function acceptsHtml(e,r){r.htmlAcceptHeaders=r.htmlAcceptHeaders||["text/html","*/*"];for(var t=0;t<r.htmlAcceptHeaders.length;t++){if(e.indexOf(r.htmlAcceptHeaders[t])!==-1){return true}}return false}function getLogger(e){if(e&&e.logger){return e.logger}else if(e&&e.verbose){return console.log.bind(console)}return function(){}}},310:e=>{e.exports=require("url")}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var i=r[t]={exports:{}};var a=true;try{e[t](i,i.exports,__nccwpck_require__);a=false}finally{if(a)delete r[t]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(945);module.exports=t})();
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ 945:
6
+ /***/ ((module, exports, __nccwpck_require__) => {
7
+
8
+
9
+
10
+ var url = __nccwpck_require__(310);
11
+
12
+ exports = module.exports = function historyApiFallback(options) {
13
+ options = options || {};
14
+ var logger = getLogger(options);
15
+
16
+ return function(req, res, next) {
17
+ var headers = req.headers;
18
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
19
+ logger(
20
+ 'Not rewriting',
21
+ req.method,
22
+ req.url,
23
+ 'because the method is not GET or HEAD.'
24
+ );
25
+ return next();
26
+ } else if (!headers || typeof headers.accept !== 'string') {
27
+ logger(
28
+ 'Not rewriting',
29
+ req.method,
30
+ req.url,
31
+ 'because the client did not send an HTTP accept header.'
32
+ );
33
+ return next();
34
+ } else if (headers.accept.indexOf('application/json') === 0) {
35
+ logger(
36
+ 'Not rewriting',
37
+ req.method,
38
+ req.url,
39
+ 'because the client prefers JSON.'
40
+ );
41
+ return next();
42
+ } else if (!acceptsHtml(headers.accept, options)) {
43
+ logger(
44
+ 'Not rewriting',
45
+ req.method,
46
+ req.url,
47
+ 'because the client does not accept HTML.'
48
+ );
49
+ return next();
50
+ }
51
+
52
+ var parsedUrl = url.parse(req.url);
53
+ var rewriteTarget;
54
+ options.rewrites = options.rewrites || [];
55
+ for (var i = 0; i < options.rewrites.length; i++) {
56
+ var rewrite = options.rewrites[i];
57
+ var match = parsedUrl.pathname.match(rewrite.from);
58
+ if (match !== null) {
59
+ rewriteTarget = evaluateRewriteRule(parsedUrl, match, rewrite.to, req);
60
+
61
+ if(rewriteTarget.charAt(0) !== '/') {
62
+ logger(
63
+ 'We recommend using an absolute path for the rewrite target.',
64
+ 'Received a non-absolute rewrite target',
65
+ rewriteTarget,
66
+ 'for URL',
67
+ req.url
68
+ );
69
+ }
70
+
71
+ logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
72
+ req.url = rewriteTarget;
73
+ return next();
74
+ }
75
+ }
76
+
77
+ var pathname = parsedUrl.pathname;
78
+ if (pathname.lastIndexOf('.') > pathname.lastIndexOf('/') &&
79
+ options.disableDotRule !== true) {
80
+ logger(
81
+ 'Not rewriting',
82
+ req.method,
83
+ req.url,
84
+ 'because the path includes a dot (.) character.'
85
+ );
86
+ return next();
87
+ }
88
+
89
+ rewriteTarget = options.index || '/index.html';
90
+ logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
91
+ req.url = rewriteTarget;
92
+ next();
93
+ };
94
+ };
95
+
96
+ function evaluateRewriteRule(parsedUrl, match, rule, req) {
97
+ if (typeof rule === 'string') {
98
+ return rule;
99
+ } else if (typeof rule !== 'function') {
100
+ throw new Error('Rewrite rule can only be of type string or function.');
101
+ }
102
+
103
+ return rule({
104
+ parsedUrl: parsedUrl,
105
+ match: match,
106
+ request: req
107
+ });
108
+ }
109
+
110
+ function acceptsHtml(header, options) {
111
+ options.htmlAcceptHeaders = options.htmlAcceptHeaders || ['text/html', '*/*'];
112
+ for (var i = 0; i < options.htmlAcceptHeaders.length; i++) {
113
+ if (header.indexOf(options.htmlAcceptHeaders[i]) !== -1) {
114
+ return true;
115
+ }
116
+ }
117
+ return false;
118
+ }
119
+
120
+ function getLogger(options) {
121
+ if (options && options.logger) {
122
+ return options.logger;
123
+ } else if (options && options.verbose) {
124
+ // eslint-disable-next-line no-console
125
+ return console.log.bind(console);
126
+ }
127
+ return function(){};
128
+ }
129
+
130
+
131
+ /***/ }),
132
+
133
+ /***/ 310:
134
+ /***/ ((module) => {
135
+
136
+ module.exports = require("url");
137
+
138
+ /***/ })
139
+
140
+ /******/ });
141
+ /************************************************************************/
142
+ /******/ // The module cache
143
+ /******/ var __webpack_module_cache__ = {};
144
+ /******/
145
+ /******/ // The require function
146
+ /******/ function __nccwpck_require__(moduleId) {
147
+ /******/ // Check if module is in cache
148
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
149
+ /******/ if (cachedModule !== undefined) {
150
+ /******/ return cachedModule.exports;
151
+ /******/ }
152
+ /******/ // Create a new module (and put it into the cache)
153
+ /******/ var module = __webpack_module_cache__[moduleId] = {
154
+ /******/ // no module.id needed
155
+ /******/ // no module.loaded needed
156
+ /******/ exports: {}
157
+ /******/ };
158
+ /******/
159
+ /******/ // Execute the module function
160
+ /******/ var threw = true;
161
+ /******/ try {
162
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
163
+ /******/ threw = false;
164
+ /******/ } finally {
165
+ /******/ if(threw) delete __webpack_module_cache__[moduleId];
166
+ /******/ }
167
+ /******/
168
+ /******/ // Return the exports of the module
169
+ /******/ return module.exports;
170
+ /******/ }
171
+ /******/
172
+ /************************************************************************/
173
+ /******/ /* webpack/runtime/compat */
174
+ /******/
175
+ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
176
+ /******/
177
+ /************************************************************************/
178
+ /******/
179
+ /******/ // startup
180
+ /******/ // Load entry module and return exports
181
+ /******/ // This entry module is referenced by other modules so it can't be inlined
182
+ /******/ var __webpack_exports__ = __nccwpck_require__(945);
183
+ /******/ module.exports = __webpack_exports__;
184
+ /******/
185
+ /******/ })()
186
+ ;
@@ -1,8 +1,10 @@
1
- // TypeScript Version: 3.0
2
1
  /// <reference types="node" />
3
- import type { URL } from 'url';
2
+ import { URL } from 'url';
3
+
4
+ // TypeScript Version: 3.0
4
5
 
5
- export interface DotenvParseOutput {
6
+
7
+ interface DotenvParseOutput {
6
8
  [name: string]: string;
7
9
  }
8
10
 
@@ -14,11 +16,11 @@ export interface DotenvParseOutput {
14
16
  * @param src - contents to be parsed. example: `'DB_HOST=localhost'`
15
17
  * @returns an object with keys and values based on `src`. example: `{ DB_HOST : 'localhost' }`
16
18
  */
17
- export function parse<T extends DotenvParseOutput = DotenvParseOutput>(
19
+ declare function parse<T extends DotenvParseOutput = DotenvParseOutput>(
18
20
  src: string | Buffer
19
21
  ): T;
20
22
 
21
- export interface DotenvConfigOptions {
23
+ interface DotenvConfigOptions {
22
24
  /**
23
25
  * Default: `path.resolve(process.cwd(), '.env')`
24
26
  *
@@ -76,12 +78,12 @@ export interface DotenvConfigOptions {
76
78
  DOTENV_KEY?: string;
77
79
  }
78
80
 
79
- export interface DotenvConfigOutput {
81
+ interface DotenvConfigOutput {
80
82
  error?: Error;
81
83
  parsed?: DotenvParseOutput;
82
84
  }
83
85
 
84
- export interface DotenvPopulateOptions {
86
+ interface DotenvPopulateOptions {
85
87
  /**
86
88
  * Default: `false`
87
89
  *
@@ -101,7 +103,7 @@ export interface DotenvPopulateOptions {
101
103
  override?: boolean;
102
104
  }
103
105
 
104
- export interface DotenvPopulateInput {
106
+ interface DotenvPopulateInput {
105
107
  [name: string]: string;
106
108
  }
107
109
 
@@ -114,7 +116,7 @@ export interface DotenvPopulateInput {
114
116
  * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
115
117
  *
116
118
  */
117
- export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
119
+ declare function config(options?: DotenvConfigOptions): DotenvConfigOutput;
118
120
 
119
121
  /**
120
122
  * Loads `.env` file contents into process.env.
@@ -125,7 +127,7 @@ export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
125
127
  * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
126
128
  *
127
129
  */
128
- export function configDotenv(options?: DotenvConfigOptions): DotenvConfigOutput;
130
+ declare function configDotenv(options?: DotenvConfigOptions): DotenvConfigOutput;
129
131
 
130
132
  /**
131
133
  * Loads `source` json contents into `target` like process.env.
@@ -138,7 +140,7 @@ export function configDotenv(options?: DotenvConfigOptions): DotenvConfigOutput;
138
140
  * @returns {void}
139
141
  *
140
142
  */
141
- export function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulateInput, options?: DotenvConfigOptions): void;
143
+ declare function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulateInput, options?: DotenvConfigOptions): void;
142
144
 
143
145
  /**
144
146
  * Decrypt ciphertext
@@ -150,4 +152,6 @@ export function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulate
150
152
  * @returns {string}
151
153
  *
152
154
  */
153
- export function decrypt(encrypted: string, keyStr: string): string;
155
+ declare function decrypt(encrypted: string, keyStr: string): string;
156
+
157
+ export { type DotenvConfigOptions, type DotenvConfigOutput, type DotenvParseOutput, type DotenvPopulateInput, type DotenvPopulateOptions, config, configDotenv, decrypt, parse, populate };