@rsbuild/core 0.6.8 → 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 (53) 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} +8 -43
  34. package/dist/client/{hmr/index.d.ts → hmr.d.ts} +4 -0
  35. package/dist/client/hmr.mjs +194 -431
  36. package/dist/client/overlay.mjs +205 -227
  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/url.d.ts +0 -6
@@ -1 +1 @@
1
- {"name":"ws","author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","version":"8.16.0","license":"MIT","type":"commonjs"}
1
+ {"name":"ws","author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","version":"8.17.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
39
39
  command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
40
40
  };
41
41
  function runCli() {
42
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.8");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.9");
43
43
  const devCommand = import_commander.program.command("dev");
44
44
  const buildCommand = import_commander.program.command("build");
45
45
  const previewCommand = import_commander.program.command("preview");
@@ -34,7 +34,7 @@ function prepareCli() {
34
34
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
35
35
  console.log();
36
36
  }
37
- import_rslog.logger.greet(` ${`Rsbuild v${"0.6.8"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.6.9"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,5 @@
1
+ import type { StatsCompilation } from '@rspack/core';
2
+ export declare function formatStatsMessages(stats: Pick<StatsCompilation, 'errors' | 'warnings'>): {
3
+ errors: string[];
4
+ warnings: string[];
5
+ };
@@ -16,15 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var formatStats_exports = {};
20
- __export(formatStats_exports, {
19
+ var format_exports = {};
20
+ __export(format_exports, {
21
21
  formatStatsMessages: () => formatStatsMessages
22
22
  });
23
- module.exports = __toCommonJS(formatStats_exports);
24
- const friendlySyntaxErrorLabel = "SyntaxError:";
25
- function isLikelyASyntaxError(message) {
26
- return message.includes(friendlySyntaxErrorLabel);
27
- }
23
+ module.exports = __toCommonJS(format_exports);
28
24
  function resolveFileName(stats) {
29
25
  const regex = /(?:\!|^)([^!]+)$/;
30
26
  const fileName = stats.moduleIdentifier?.match(regex)?.at(-1) ?? "";
@@ -54,30 +50,6 @@ ${stats.stack}` : "";
54
50
  message = stats;
55
51
  }
56
52
  lines = message.split("\n");
57
- lines = lines.map((line) => {
58
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
59
- line
60
- );
61
- if (!parsingError) {
62
- return line;
63
- }
64
- const [, errorLine, errorColumn, errorMessage] = parsingError;
65
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
66
- });
67
- message = lines.join("\n");
68
- message = message.replace(
69
- /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
70
- `${friendlySyntaxErrorLabel} $3 ($1:$2)
71
- `
72
- );
73
- lines = message.split("\n");
74
- if (lines.length > 2 && lines[1].trim() === "") {
75
- lines.splice(1, 1);
76
- }
77
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, "$1");
78
- if (lines[1] && lines[1].indexOf("Module not found:") !== -1) {
79
- lines[1] = lines[1].replace("Error: ", "");
80
- }
81
53
  lines = lines.filter(
82
54
  (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
83
55
  );
@@ -85,19 +57,12 @@ ${stats.stack}` : "";
85
57
  return message.trim();
86
58
  }
87
59
  function formatStatsMessages(stats) {
88
- const formattedErrors = stats.errors?.map(formatMessage);
89
- const formattedWarnings = stats.warnings?.map(formatMessage);
90
- const result = {
91
- errors: formattedErrors || [],
92
- warnings: formattedWarnings || []
60
+ const formattedErrors = stats.errors?.map(formatMessage) || [];
61
+ const formattedWarnings = stats.warnings?.map(formatMessage) || [];
62
+ return {
63
+ errors: formattedErrors,
64
+ warnings: formattedWarnings
93
65
  };
94
- if (result.errors?.some(isLikelyASyntaxError)) {
95
- result.errors = result.errors.filter(isLikelyASyntaxError);
96
- }
97
- if (result.errors.length > 1) {
98
- result.errors.length = 1;
99
- }
100
- return result;
101
66
  }
102
67
  // Annotate the CommonJS export names for ESM import in node:
103
68
  0 && (module.exports = {
@@ -1 +1,5 @@
1
+ /**
2
+ * hmr socket connect path
3
+ */
4
+ export declare const HMR_SOCK_PATH = "/rsbuild-hmr";
1
5
  export declare const registerOverlay: (createFn: (err: string[]) => void, clearFn: () => void) => void;