@rsbuild/core 1.1.0 → 1.1.2

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/chokidar/index.d.ts +318 -189
  2. package/compiled/chokidar/index.js +1069 -4439
  3. package/compiled/chokidar/license +1 -1
  4. package/compiled/chokidar/package.json +1 -1
  5. package/compiled/css-loader/index.js +46 -46
  6. package/compiled/html-rspack-plugin/index.js +14 -14
  7. package/compiled/http-proxy-middleware/index.d.ts +4 -3
  8. package/compiled/postcss/index.js +120 -114
  9. package/compiled/postcss/package.json +1 -1
  10. package/compiled/postcss-load-config/index.js +10 -10
  11. package/compiled/postcss-loader/index.js +11 -11
  12. package/compiled/rsbuild-dev-middleware/index.js +64 -101
  13. package/compiled/rsbuild-dev-middleware/package.json +1 -1
  14. package/compiled/rspack-manifest-plugin/index.js +4 -4
  15. package/compiled/tinyglobby/index.d.ts +25 -0
  16. package/compiled/tinyglobby/index.js +2749 -0
  17. package/compiled/tinyglobby/index1.js +17 -0
  18. package/compiled/tinyglobby/license +21 -0
  19. package/compiled/tinyglobby/package.json +1 -0
  20. package/dist/client/hmr.js +195 -213
  21. package/dist/client/overlay.js +88 -90
  22. package/dist/ignoreCssLoader.cjs +43 -29
  23. package/dist/index.cjs +6931 -13749
  24. package/dist/index.cjs.LICENSE.txt +13 -0
  25. package/dist/index.js +6754 -13826
  26. package/dist/index.js.LICENSE.txt +13 -0
  27. package/dist/transformLoader.cjs +59 -51
  28. package/dist/transformRawLoader.cjs +78 -60
  29. package/dist-types/cli/init.d.ts +2 -1
  30. package/dist-types/config.d.ts +2 -2
  31. package/dist-types/configChain.d.ts +1 -1
  32. package/dist-types/helpers/index.d.ts +3 -1
  33. package/dist-types/index.d.ts +1 -1
  34. package/dist-types/internal.d.ts +1 -13
  35. package/dist-types/logger.d.ts +1 -1
  36. package/dist-types/plugins/css.d.ts +1 -2
  37. package/dist-types/plugins/lazyCompilation.d.ts +1 -1
  38. package/dist-types/provider/createCompiler.d.ts +1 -1
  39. package/dist-types/provider/helpers.d.ts +12 -0
  40. package/dist-types/server/compilerDevMiddleware.d.ts +4 -3
  41. package/dist-types/server/devServer.d.ts +1 -1
  42. package/dist-types/server/helper.d.ts +1 -0
  43. package/dist-types/server/httpServer.d.ts +1 -1
  44. package/dist-types/server/middlewares.d.ts +2 -2
  45. package/dist-types/server/prodServer.d.ts +1 -1
  46. package/dist-types/server/restart.d.ts +4 -0
  47. package/dist-types/server/watchFiles.d.ts +4 -1
  48. package/dist-types/types/config.d.ts +20 -12
  49. package/dist-types/types/hooks.d.ts +1 -1
  50. package/dist-types/types/plugin.d.ts +2 -2
  51. package/dist-types/types/rsbuild.d.ts +3 -1
  52. package/dist-types/types/rspack.d.ts +1 -1
  53. package/dist-types/types/thirdParty.d.ts +1 -1
  54. package/package.json +15 -14
@@ -4417,14 +4417,14 @@
4417
4417
  return a.start - b.start;
4418
4418
  }
4419
4419
  },
4420
- 3280: (module, __unused_webpack_exports, __nccwpck_require__) => {
4420
+ 9146: (module, __unused_webpack_exports, __nccwpck_require__) => {
4421
4421
  "use strict";
4422
- const middleware = __nccwpck_require__(3856);
4423
- const getFilenameFromUrl = __nccwpck_require__(641);
4424
- const setupHooks = __nccwpck_require__(8357);
4425
- const setupWriteToDisk = __nccwpck_require__(4191);
4426
- const setupOutputFileSystem = __nccwpck_require__(7332);
4427
- const ready = __nccwpck_require__(4662);
4422
+ const middleware = __nccwpck_require__(3567);
4423
+ const getFilenameFromUrl = __nccwpck_require__(4578);
4424
+ const setupHooks = __nccwpck_require__(2355);
4425
+ const setupWriteToDisk = __nccwpck_require__(1438);
4426
+ const setupOutputFileSystem = __nccwpck_require__(1793);
4427
+ const ready = __nccwpck_require__(2241);
4428
4428
  const noop = () => {};
4429
4429
  function wdm(compiler, options = {}) {
4430
4430
  const context = {
@@ -4449,15 +4449,15 @@
4449
4449
  }
4450
4450
  };
4451
4451
  if (Array.isArray(context.compiler.compilers)) {
4452
- const compiler = context.compiler;
4453
- const watchOptions = compiler.compilers.map(
4452
+ const multiCompiler = context.compiler;
4453
+ const watchOptions = multiCompiler.compilers.map(
4454
4454
  (childCompiler) => childCompiler.options.watchOptions || {},
4455
4455
  );
4456
- context.watching = compiler.watch(watchOptions, errorHandler);
4456
+ context.watching = multiCompiler.watch(watchOptions, errorHandler);
4457
4457
  } else {
4458
- const compiler = context.compiler;
4459
- const watchOptions = compiler.options.watchOptions || {};
4460
- context.watching = compiler.watch(watchOptions, errorHandler);
4458
+ const singleCompiler = context.compiler;
4459
+ const watchOptions = singleCompiler.options.watchOptions || {};
4460
+ context.watching = singleCompiler.watch(watchOptions, errorHandler);
4461
4461
  }
4462
4462
  }
4463
4463
  const filledContext = context;
@@ -4479,21 +4479,32 @@
4479
4479
  }
4480
4480
  module.exports = wdm;
4481
4481
  },
4482
- 3856: (module, __unused_webpack_exports, __nccwpck_require__) => {
4482
+ 3567: (module, __unused_webpack_exports, __nccwpck_require__) => {
4483
4483
  "use strict";
4484
4484
  const mrmime = __nccwpck_require__(802);
4485
4485
  const onFinishedStream = __nccwpck_require__(8772);
4486
- const getFilenameFromUrl = __nccwpck_require__(641);
4487
- const { setStatusCode, send, pipe, createReadStreamOrReadFileSync } =
4488
- __nccwpck_require__(7833);
4489
- const ready = __nccwpck_require__(4662);
4490
- const parseTokenList = __nccwpck_require__(2518);
4491
- const memorize = __nccwpck_require__(4781);
4486
+ const getFilenameFromUrl = __nccwpck_require__(4578);
4487
+ const ready = __nccwpck_require__(2241);
4488
+ const parseTokenList = __nccwpck_require__(4679);
4489
+ const memorize = __nccwpck_require__(6720);
4492
4490
  async function getEtag(stat) {
4493
4491
  const mtime = stat.mtime.getTime().toString(16);
4494
4492
  const size = stat.size.toString(16);
4495
4493
  return `W/"${size}-${mtime}"`;
4496
4494
  }
4495
+ function createReadStreamOrReadFileSync(
4496
+ filename,
4497
+ outputFileSystem,
4498
+ start,
4499
+ end,
4500
+ ) {
4501
+ const bufferOrStream = outputFileSystem.createReadStream(filename, {
4502
+ start,
4503
+ end,
4504
+ });
4505
+ const byteLength = end === 0 ? 0 : end - start + 1;
4506
+ return { bufferOrStream, byteLength };
4507
+ }
4497
4508
  function getContentType(str) {
4498
4509
  let mime = mrmime.lookup(str);
4499
4510
  if (!mime) {
@@ -4504,7 +4515,7 @@
4504
4515
  mime === "application/json" ||
4505
4516
  mime === "application/manifest+json"
4506
4517
  ) {
4507
- mime += `; charset=utf-8`;
4518
+ mime += "; charset=utf-8";
4508
4519
  }
4509
4520
  return mime;
4510
4521
  }
@@ -4514,7 +4525,7 @@
4514
4525
  }
4515
4526
  function parseHttpDate(date) {
4516
4527
  const timestamp = date && Date.parse(date);
4517
- return typeof timestamp === "number" ? timestamp : NaN;
4528
+ return typeof timestamp === "number" ? timestamp : Number.NaN;
4518
4529
  }
4519
4530
  const CACHE_CONTROL_NO_CACHE_REGEXP = /(?:^|,)\s*?no-cache\s*?(?:,|$)/;
4520
4531
  function destroyStream(stream, suppress) {
@@ -4567,7 +4578,7 @@
4567
4578
  return;
4568
4579
  }
4569
4580
  function sendError(status, options) {
4570
- const escapeHtml = __nccwpck_require__(9896);
4581
+ const escapeHtml = __nccwpck_require__(9703);
4571
4582
  const content = statuses[status] || String(status);
4572
4583
  const document = Buffer.from(
4573
4584
  `<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>${escapeHtml(content)}</pre>\n</body>\n</html>`,
@@ -4587,7 +4598,7 @@
4587
4598
  }
4588
4599
  }
4589
4600
  }
4590
- setStatusCode(res, status);
4601
+ res.statusCode = status;
4591
4602
  res.setHeader("Content-Type", "text/html; charset=utf-8");
4592
4603
  res.setHeader("Content-Security-Policy", "default-src 'none'");
4593
4604
  res.setHeader("X-Content-Type-Options", "nosniff");
@@ -4621,11 +4632,13 @@
4621
4632
  const ifUnmodifiedSince = req.headers["if-unmodified-since"];
4622
4633
  if (ifUnmodifiedSince) {
4623
4634
  const unmodifiedSince = parseHttpDate(ifUnmodifiedSince);
4624
- if (!isNaN(unmodifiedSince)) {
4635
+ if (!Number.isNaN(unmodifiedSince)) {
4625
4636
  const lastModified = parseHttpDate(
4626
4637
  res.getHeader("Last-Modified"),
4627
4638
  );
4628
- return isNaN(lastModified) || lastModified > unmodifiedSince;
4639
+ return (
4640
+ Number.isNaN(lastModified) || lastModified > unmodifiedSince
4641
+ );
4629
4642
  }
4630
4643
  }
4631
4644
  return false;
@@ -4766,7 +4779,7 @@
4766
4779
  return;
4767
4780
  }
4768
4781
  if (res.statusCode === 404) {
4769
- setStatusCode(res, 200);
4782
+ res.statusCode = 200;
4770
4783
  }
4771
4784
  if (
4772
4785
  isCachable() &&
@@ -4775,7 +4788,7 @@
4775
4788
  "last-modified": res.getHeader("Last-Modified"),
4776
4789
  })
4777
4790
  ) {
4778
- setStatusCode(res, 304);
4791
+ res.statusCode = 304;
4779
4792
  res.removeHeader("Content-Encoding");
4780
4793
  res.removeHeader("Content-Language");
4781
4794
  res.removeHeader("Content-Length");
@@ -4800,7 +4813,8 @@
4800
4813
  headers: { "Content-Range": res.getHeader("Content-Range") },
4801
4814
  });
4802
4815
  return;
4803
- } else if (parsedRanges === -2) {
4816
+ }
4817
+ if (parsedRanges === -2) {
4804
4818
  context.logger.error(
4805
4819
  "A malformed 'Range' header was provided. A regular response will be sent for this request.",
4806
4820
  );
@@ -4810,7 +4824,7 @@
4810
4824
  );
4811
4825
  }
4812
4826
  if (parsedRanges !== -2 && parsedRanges.length === 1) {
4813
- setStatusCode(res, 206);
4827
+ res.statusCode = 206;
4814
4828
  res.setHeader(
4815
4829
  "Content-Range",
4816
4830
  getValueContentRangeHeader("bytes", size, parsedRanges[0]),
@@ -4835,14 +4849,14 @@
4835
4849
  res.setHeader("Content-Length", byteLength);
4836
4850
  if (req.method === "HEAD") {
4837
4851
  if (res.statusCode === 404) {
4838
- setStatusCode(res, 200);
4852
+ res.statusCode = 200;
4839
4853
  }
4840
4854
  res.end();
4841
4855
  return;
4842
4856
  }
4843
4857
  const isPipeSupports = typeof bufferOrStream.pipe === "function";
4844
4858
  if (!isPipeSupports) {
4845
- send(res, bufferOrStream);
4859
+ res.end(bufferOrStream);
4846
4860
  return;
4847
4861
  }
4848
4862
  const cleanup = () => {
@@ -4861,7 +4875,7 @@
4861
4875
  break;
4862
4876
  }
4863
4877
  });
4864
- pipe(res, bufferOrStream);
4878
+ bufferOrStream.pipe(res);
4865
4879
  onFinishedStream(res, cleanup);
4866
4880
  }
4867
4881
  ready(context, processRequest, req);
@@ -4869,59 +4883,7 @@
4869
4883
  }
4870
4884
  module.exports = wrapper;
4871
4885
  },
4872
- 7833: (module) => {
4873
- "use strict";
4874
- function setStatusCode(res, code) {
4875
- if (typeof res.status === "function") {
4876
- res.status(code);
4877
- return;
4878
- }
4879
- res.statusCode = code;
4880
- }
4881
- function pipe(res, bufferOrStream) {
4882
- if (typeof res.pipeInto === "function") {
4883
- res.pipeInto(bufferOrStream);
4884
- return;
4885
- }
4886
- bufferOrStream.pipe(res);
4887
- }
4888
- function send(res, bufferOrStream) {
4889
- if (typeof res.send === "function") {
4890
- res.send(bufferOrStream);
4891
- return;
4892
- }
4893
- res.end(bufferOrStream);
4894
- }
4895
- function createReadStreamOrReadFileSync(
4896
- filename,
4897
- outputFileSystem,
4898
- start,
4899
- end,
4900
- ) {
4901
- let bufferOrStream;
4902
- let byteLength;
4903
- const isFsSupportsStream =
4904
- typeof outputFileSystem.createReadStream === "function";
4905
- if (isFsSupportsStream) {
4906
- bufferOrStream = outputFileSystem.createReadStream(filename, {
4907
- start,
4908
- end,
4909
- });
4910
- byteLength = end === 0 ? 0 : end - start + 1;
4911
- } else {
4912
- bufferOrStream = outputFileSystem.readFileSync(filename);
4913
- ({ byteLength } = bufferOrStream);
4914
- }
4915
- return { bufferOrStream, byteLength };
4916
- }
4917
- module.exports = {
4918
- setStatusCode,
4919
- send,
4920
- pipe,
4921
- createReadStreamOrReadFileSync,
4922
- };
4923
- },
4924
- 9896: (module) => {
4886
+ 9703: (module) => {
4925
4887
  "use strict";
4926
4888
  const matchHtmlRegExp = /["'&<>]/;
4927
4889
  function escapeHtml(string) {
@@ -4966,13 +4928,13 @@
4966
4928
  }
4967
4929
  module.exports = escapeHtml;
4968
4930
  },
4969
- 641: (module, __unused_webpack_exports, __nccwpck_require__) => {
4931
+ 4578: (module, __unused_webpack_exports, __nccwpck_require__) => {
4970
4932
  "use strict";
4971
4933
  const path = __nccwpck_require__(1017);
4972
4934
  const { parse } = __nccwpck_require__(7310);
4973
4935
  const querystring = __nccwpck_require__(3477);
4974
- const getPaths = __nccwpck_require__(8318);
4975
- const memorize = __nccwpck_require__(4781);
4936
+ const getPaths = __nccwpck_require__(3531);
4937
+ const memorize = __nccwpck_require__(6720);
4976
4938
  const memoizedParse = memorize(parse, undefined, (value) => {
4977
4939
  if (value.pathname) {
4978
4940
  value.pathname = decode(value.pathname);
@@ -5028,7 +4990,8 @@
5028
4990
  if (extra.stats.isFile()) {
5029
4991
  foundFilename = filename;
5030
4992
  break;
5031
- } else if (
4993
+ }
4994
+ if (
5032
4995
  extra.stats.isDirectory() &&
5033
4996
  (typeof options.index === "undefined" || options.index)
5034
4997
  ) {
@@ -5054,7 +5017,7 @@
5054
5017
  }
5055
5018
  module.exports = getFilenameFromUrl;
5056
5019
  },
5057
- 8318: (module) => {
5020
+ 3531: (module) => {
5058
5021
  "use strict";
5059
5022
  function getPaths(context) {
5060
5023
  const { stats, options } = context;
@@ -5075,7 +5038,7 @@
5075
5038
  }
5076
5039
  module.exports = getPaths;
5077
5040
  },
5078
- 4781: (module) => {
5041
+ 6720: (module) => {
5079
5042
  "use strict";
5080
5043
  const cacheStore = new WeakMap();
5081
5044
  function memorize(fn, { cache = new Map() } = {}, callback) {
@@ -5097,7 +5060,7 @@
5097
5060
  }
5098
5061
  module.exports = memorize;
5099
5062
  },
5100
- 2518: (module) => {
5063
+ 4679: (module) => {
5101
5064
  "use strict";
5102
5065
  function parseTokenList(str) {
5103
5066
  let end = 0;
@@ -5130,7 +5093,7 @@
5130
5093
  }
5131
5094
  module.exports = parseTokenList;
5132
5095
  },
5133
- 4662: (module) => {
5096
+ 2241: (module) => {
5134
5097
  "use strict";
5135
5098
  function ready(context, callback, req) {
5136
5099
  if (context.state) {
@@ -5145,7 +5108,7 @@
5145
5108
  }
5146
5109
  module.exports = ready;
5147
5110
  },
5148
- 8357: (module) => {
5111
+ 2355: (module) => {
5149
5112
  "use strict";
5150
5113
  function setupHooks(context) {
5151
5114
  function invalid() {
@@ -5177,7 +5140,7 @@
5177
5140
  }
5178
5141
  module.exports = setupHooks;
5179
5142
  },
5180
- 7332: (module, __unused_webpack_exports, __nccwpck_require__) => {
5143
+ 1793: (module, __unused_webpack_exports, __nccwpck_require__) => {
5181
5144
  "use strict";
5182
5145
  const memfs = __nccwpck_require__(5953);
5183
5146
  function setupOutputFileSystem(context) {
@@ -5204,7 +5167,7 @@
5204
5167
  }
5205
5168
  module.exports = setupOutputFileSystem;
5206
5169
  },
5207
- 4191: (module, __unused_webpack_exports, __nccwpck_require__) => {
5170
+ 1438: (module, __unused_webpack_exports, __nccwpck_require__) => {
5208
5171
  "use strict";
5209
5172
  const fs = __nccwpck_require__(7147);
5210
5173
  const path = __nccwpck_require__(1017);
@@ -5217,12 +5180,12 @@
5217
5180
  }
5218
5181
  compiler.hooks.assetEmitted.tapAsync(
5219
5182
  "DevMiddleware",
5220
- (file, info, callback) => {
5221
- const { targetPath, content } = info;
5183
+ (_file, info, callback) => {
5184
+ const { targetPath, content, compilation } = info;
5222
5185
  const { writeToDisk: filter } = context.options;
5223
5186
  const allowWrite =
5224
5187
  filter && typeof filter === "function"
5225
- ? filter(targetPath)
5188
+ ? filter(targetPath, compilation.name)
5226
5189
  : true;
5227
5190
  if (!allowWrite) {
5228
5191
  return callback();
@@ -6190,6 +6153,6 @@
6190
6153
  }
6191
6154
  if (typeof __nccwpck_require__ !== "undefined")
6192
6155
  __nccwpck_require__.ab = __dirname + "/";
6193
- var __webpack_exports__ = __nccwpck_require__(3280);
6156
+ var __webpack_exports__ = __nccwpck_require__(9146);
6194
6157
  module.exports = __webpack_exports__;
6195
6158
  })();
@@ -1 +1 @@
1
- {"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.1.1","funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rsbuild-dev-middleware","author":"Tobias Koppers @sokra","version":"0.1.2","funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 463: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 377: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
7
7
  exports.reduceChunk =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 213: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 370: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const fs_1 = __nccwpck_require__(147);
131
131
  const path_1 = __nccwpck_require__(17);
132
132
  const lite_tapable_1 = __nccwpck_require__(348);
133
- const helpers_1 = __nccwpck_require__(463);
133
+ const helpers_1 = __nccwpck_require__(377);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(17);
315
- const hooks_1 = __nccwpck_require__(213);
315
+ const hooks_1 = __nccwpck_require__(370);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
@@ -0,0 +1,25 @@
1
+ declare const convertPathToPattern: (path: string) => string;
2
+ declare const escapePath: (path: string) => string;
3
+ declare function isDynamicPattern(pattern: string, options?: {
4
+ caseSensitiveMatch: boolean;
5
+ }): boolean;
6
+
7
+ interface GlobOptions {
8
+ absolute?: boolean;
9
+ cwd?: string;
10
+ patterns?: string | string[];
11
+ ignore?: string | string[];
12
+ dot?: boolean;
13
+ deep?: number;
14
+ followSymbolicLinks?: boolean;
15
+ caseSensitiveMatch?: boolean;
16
+ expandDirectories?: boolean;
17
+ onlyDirectories?: boolean;
18
+ onlyFiles?: boolean;
19
+ }
20
+ declare function glob(patterns: string | string[], options?: Omit<GlobOptions, 'patterns'>): Promise<string[]>;
21
+ declare function glob(options: GlobOptions): Promise<string[]>;
22
+ declare function globSync(patterns: string | string[], options?: Omit<GlobOptions, 'patterns'>): string[];
23
+ declare function globSync(options: GlobOptions): string[];
24
+
25
+ export { type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };