@rsbuild/core 1.3.21 → 1.4.0-beta.0

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 (37) hide show
  1. package/README.md +2 -2
  2. package/compiled/css-loader/index.js +44 -44
  3. package/compiled/html-rspack-plugin/index.js +14 -14
  4. package/compiled/postcss/index.js +189 -144
  5. package/compiled/postcss/lib/input.d.ts +24 -3
  6. package/compiled/postcss/lib/node.d.ts +17 -2
  7. package/compiled/postcss/lib/stringifier.d.ts +2 -2
  8. package/compiled/postcss/package.json +1 -1
  9. package/compiled/postcss-load-config/index.js +10 -10
  10. package/compiled/postcss-loader/index.js +6 -6
  11. package/compiled/rsbuild-dev-middleware/index.js +115 -125
  12. package/compiled/rspack-chain/index.js +67 -67
  13. package/compiled/rspack-chain/package.json +1 -1
  14. package/compiled/rspack-chain/types/index.d.ts +1 -0
  15. package/compiled/rspack-manifest-plugin/index.js +4 -4
  16. package/compiled/sirv/index.js +12 -6
  17. package/compiled/style-loader/index.js +10 -10
  18. package/compiled/tinyglobby/index.d.ts +35 -16
  19. package/compiled/tinyglobby/index.js +517 -531
  20. package/compiled/tinyglobby/package.json +1 -1
  21. package/compiled/webpack-bundle-analyzer/index.js +62 -46
  22. package/dist/index.cjs +274 -236
  23. package/dist/index.js +233 -227
  24. package/dist-types/cli/commands.d.ts +1 -1
  25. package/dist-types/defaultConfig.d.ts +26 -0
  26. package/dist-types/index.d.ts +2 -2
  27. package/dist-types/{config.d.ts → loadConfig.d.ts} +9 -34
  28. package/dist-types/pluginHelper.d.ts +1 -1
  29. package/dist-types/plugins/minimize.d.ts +1 -1
  30. package/dist-types/server/cliShortcuts.d.ts +2 -2
  31. package/dist-types/server/helper.d.ts +2 -2
  32. package/dist-types/server/runner/asModule.d.ts +2 -2
  33. package/dist-types/types/config.d.ts +41 -20
  34. package/dist-types/types/hooks.d.ts +1 -1
  35. package/dist-types/types/plugin.d.ts +18 -18
  36. package/dist-types/types/rsbuild.d.ts +2 -2
  37. package/package.json +11 -10
@@ -18,6 +18,11 @@ declare namespace Input {
18
18
  */
19
19
  endLine?: number
20
20
 
21
+ /**
22
+ * Offset of exclusive end position in source file.
23
+ */
24
+ endOffset?: number
25
+
21
26
  /**
22
27
  * Absolute path to the source file.
23
28
  */
@@ -28,6 +33,11 @@ declare namespace Input {
28
33
  */
29
34
  line: number
30
35
 
36
+ /**
37
+ * Offset of inclusive start position in source file.
38
+ */
39
+ offset: number
40
+
31
41
  /**
32
42
  * Source code.
33
43
  */
@@ -131,6 +141,9 @@ declare class Input_ {
131
141
  */
132
142
  constructor(css: string, opts?: ProcessOptions)
133
143
 
144
+ /**
145
+ * Returns `CssSyntaxError` with information about the error and its position.
146
+ */
134
147
  error(
135
148
  message: string,
136
149
  start:
@@ -151,9 +164,6 @@ declare class Input_ {
151
164
  },
152
165
  opts?: { plugin?: CssSyntaxError['plugin'] }
153
166
  ): CssSyntaxError
154
- /**
155
- * Returns `CssSyntaxError` with information about the error and its position.
156
- */
157
167
  error(
158
168
  message: string,
159
169
  line: number,
@@ -165,12 +175,23 @@ declare class Input_ {
165
175
  offset: number,
166
176
  opts?: { plugin?: CssSyntaxError['plugin'] }
167
177
  ): CssSyntaxError
178
+
179
+ /**
180
+ * Converts source line and column to offset.
181
+ *
182
+ * @param line Source line.
183
+ * @param column Source column.
184
+ * @return Source offset.
185
+ */
186
+ fromLineAndColumn(line: number, column: number): number
187
+
168
188
  /**
169
189
  * Converts source offset to line and column.
170
190
  *
171
191
  * @param offset Source offset.
172
192
  */
173
193
  fromOffset(offset: number): { col: number; line: number } | null
194
+
174
195
  /**
175
196
  * Reads the input source map and returns a symbol position
176
197
  * in the input source (e.g., in a Sass file that was compiled
@@ -1,5 +1,4 @@
1
1
  import AtRule = require('./at-rule.js')
2
-
3
2
  import { AtRuleProps } from './at-rule.js'
4
3
  import Comment, { CommentProps } from './comment.js'
5
4
  import Container, { NewChild } from './container.js'
@@ -66,6 +65,22 @@ declare namespace Node {
66
65
  /**
67
66
  * The inclusive ending position for the source
68
67
  * code of a node.
68
+ *
69
+ * However, `end.offset` of a non `Root` node is the exclusive position.
70
+ * See https://github.com/postcss/postcss/pull/1879 for details.
71
+ *
72
+ * ```js
73
+ * const root = postcss.parse('a { color: black }')
74
+ * const a = root.first
75
+ * const color = a.first
76
+ *
77
+ * // The offset of `Root` node is the inclusive position
78
+ * css.source.end // { line: 1, column: 19, offset: 18 }
79
+ *
80
+ * // The offset of non `Root` node is the exclusive position
81
+ * a.source.end // { line: 1, column: 18, offset: 18 }
82
+ * color.source.end // { line: 1, column: 16, offset: 16 }
83
+ * ```
69
84
  */
70
85
  end?: Position
71
86
 
@@ -424,7 +439,7 @@ declare abstract class Node_ {
424
439
  * @return Range.
425
440
  */
426
441
  rangeBy(
427
- opts?: Pick<WarningOptions, 'endIndex' | 'index' | 'word'>
442
+ opts?: Pick<WarningOptions, 'end' | 'endIndex' | 'index' | 'start' | 'word'>
428
443
  ): Node.Range
429
444
 
430
445
  /**
@@ -25,7 +25,7 @@ declare class Stringifier_ {
25
25
  comment(node: Comment): void
26
26
  decl(node: Declaration, semicolon?: boolean): void
27
27
  document(node: Document): void
28
- raw(node: AnyNode, own: null | string, detect?: string): string
28
+ raw(node: AnyNode, own: null | string, detect?: string): boolean | string
29
29
  rawBeforeClose(root: Root): string | undefined
30
30
  rawBeforeComment(root: Root, node: Comment): string | undefined
31
31
  rawBeforeDecl(root: Root, node: Declaration): string | undefined
@@ -35,7 +35,7 @@ declare class Stringifier_ {
35
35
  rawEmptyBody(root: Root): string | undefined
36
36
  rawIndent(root: Root): string | undefined
37
37
  rawSemicolon(root: Root): boolean | undefined
38
- rawValue(node: AnyNode, prop: string): string
38
+ rawValue(node: AnyNode, prop: string): number | string
39
39
  root(node: Root): void
40
40
  rule(node: Rule): void
41
41
  stringify(node: AnyNode, semicolon?: boolean): void
@@ -1 +1 @@
1
- {"name":"postcss","author":"Andrey Sitnik <andrey@sitnik.ru>","version":"8.5.3","funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"./lib/postcss.d.ts","type":"commonjs"}
1
+ {"name":"postcss","author":"Andrey Sitnik <andrey@sitnik.ru>","version":"8.5.4","funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"./lib/postcss.d.ts","type":"commonjs"}
@@ -370,12 +370,12 @@
370
370
  };
371
371
  };
372
372
  },
373
- 838: (module, __unused_webpack_exports, __nccwpck_require__) => {
373
+ 500: (module, __unused_webpack_exports, __nccwpck_require__) => {
374
374
  const { resolve } = __nccwpck_require__(760);
375
375
  const config = __nccwpck_require__(920);
376
- const loadOptions = __nccwpck_require__(672);
377
- const loadPlugins = __nccwpck_require__(934);
378
- const req = __nccwpck_require__(606);
376
+ const loadOptions = __nccwpck_require__(178);
377
+ const loadPlugins = __nccwpck_require__(252);
378
+ const req = __nccwpck_require__(804);
379
379
  const interopRequireDefault = (obj) =>
380
380
  obj && obj.__esModule ? obj : { default: obj };
381
381
  async function processResult(ctx, result) {
@@ -489,8 +489,8 @@
489
489
  * @requires ./plugins
490
490
  */ module.exports = rc;
491
491
  },
492
- 672: (module, __unused_webpack_exports, __nccwpck_require__) => {
493
- const req = __nccwpck_require__(606);
492
+ 178: (module, __unused_webpack_exports, __nccwpck_require__) => {
493
+ const req = __nccwpck_require__(804);
494
494
  async function options(config, file) {
495
495
  if (config.parser && typeof config.parser === "string") {
496
496
  try {
@@ -523,8 +523,8 @@
523
523
  }
524
524
  module.exports = options;
525
525
  },
526
- 934: (module, __unused_webpack_exports, __nccwpck_require__) => {
527
- const req = __nccwpck_require__(606);
526
+ 252: (module, __unused_webpack_exports, __nccwpck_require__) => {
527
+ const req = __nccwpck_require__(804);
528
528
  async function load(plugin, options, file) {
529
529
  try {
530
530
  if (
@@ -579,7 +579,7 @@
579
579
  }
580
580
  module.exports = plugins;
581
581
  },
582
- 606: (module, __unused_webpack_exports, __nccwpck_require__) => {
582
+ 804: (module, __unused_webpack_exports, __nccwpck_require__) => {
583
583
  const { createRequire } = __nccwpck_require__(995);
584
584
  const { pathToFileURL } = __nccwpck_require__(136);
585
585
  const TS_EXT_RE = /\.[mc]?ts$/;
@@ -740,6 +740,6 @@
740
740
  })();
741
741
  if (typeof __nccwpck_require__ !== "undefined")
742
742
  __nccwpck_require__.ab = __dirname + "/";
743
- var __webpack_exports__ = __nccwpck_require__(838);
743
+ var __webpack_exports__ = __nccwpck_require__(500);
744
744
  module.exports = __webpack_exports__;
745
745
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 374: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(52)["default"];
4
+ 139: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(501)["default"];
6
6
  },
7
- 52: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 501: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(949);
12
+ var _utils = __nccwpck_require__(184);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 949: (module, exports, __nccwpck_require__) => {
182
+ 184: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(374);
719
+ var __webpack_exports__ = __nccwpck_require__(139);
720
720
  module.exports = __webpack_exports__;
721
721
  })();