@lynx-js/config-rsbuild-plugin 0.0.2 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @lynx-js/config-rsbuild-plugin
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **BREAKING CHANGE** ([#2803](https://github.com/lynx-family/lynx-stack/pull/2803))
8
+
9
+ Drop webpack support — the plugins now target Rspack only. All public types come from `@rspack/core` instead of `webpack` (e.g. `Compiler`, `Compilation`, `LoaderContext`), and the `webpack` dependency is removed.
10
+
11
+ ### Patch Changes
12
+
13
+ - Widen the `@lynx-js/rspeedy` peer dependency range to include `^0.15.0`. ([#2701](https://github.com/lynx-family/lynx-stack/pull/2701))
14
+
15
+ - Add @lynx-js/rspeedy@0.15.0 to peer dependencies. ([#2603](https://github.com/lynx-family/lynx-stack/pull/2603))
16
+
17
+ - Widen peer ranges to admit the new minor versions of `@lynx-js/template-webpack-plugin` (^0.12.0) and `@lynx-js/rspeedy` (^0.15.0) shipping with the unified `debug-metadata.json` feature. ([#2642](https://github.com/lynx-family/lynx-stack/pull/2642))
18
+
3
19
  ## 0.0.2
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,9 +1,49 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- import * as __rspack_external_os from "os";
3
- import * as __rspack_external_tty from "tty";
4
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ /*! LICENSE: index.js.LICENSE.txt */
5
2
  import node_process from "node:process";
6
3
  import { compilerOptionsKeys as type_config_compilerOptionsKeys, configKeys as type_config_configKeys } from "@lynx-js/type-config";
4
+ import { createRequire as __rspack_createRequire } from "node:module";
5
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
6
+ var __webpack_modules__ = {};
7
+ var __webpack_module_cache__ = {};
8
+ function __webpack_require__(moduleId) {
9
+ var cachedModule = __webpack_module_cache__[moduleId];
10
+ if (void 0 !== cachedModule) return cachedModule.exports;
11
+ var module = __webpack_module_cache__[moduleId] = {
12
+ exports: {}
13
+ };
14
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
+ return module.exports;
16
+ }
17
+ __webpack_require__.m = __webpack_modules__;
18
+ (()=>{
19
+ __webpack_require__.n = (module)=>{
20
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
21
+ __webpack_require__.d(getter, {
22
+ a: getter
23
+ });
24
+ return getter;
25
+ };
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.d = (exports, getters, values)=>{
29
+ var define = (defs, kind)=>{
30
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
31
+ enumerable: true,
32
+ [kind]: defs[key]
33
+ });
34
+ };
35
+ define(getters, "get");
36
+ define(values, "value");
37
+ };
38
+ })();
39
+ (()=>{
40
+ __webpack_require__.add = function(modules) {
41
+ Object.assign(__webpack_require__.m, modules);
42
+ };
43
+ })();
44
+ (()=>{
45
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
46
+ })();
7
47
  __webpack_require__.add({
8
48
  "../../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js" (module) {
9
49
  module.exports = (flag, argv = process.argv)=>{
@@ -241,162 +281,11 @@ __webpack_require__.add({
241
281
  stderr: supportsHyperlink(process.stderr)
242
282
  };
243
283
  },
244
- "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js" (__unused_rspack_module, exports) {
245
- exports._accessExpressionAsString = void 0;
246
- const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
247
- exports._accessExpressionAsString = _accessExpressionAsString;
248
- const variable = (str)=>false === reserved(str) && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
249
- const reserved = (str)=>RESERVED.has(str);
250
- const RESERVED = new Set([
251
- "break",
252
- "case",
253
- "catch",
254
- "class",
255
- "const",
256
- "continue",
257
- "debugger",
258
- "default",
259
- "delete",
260
- "do",
261
- "else",
262
- "enum",
263
- "export",
264
- "extends",
265
- "false",
266
- "finally",
267
- "for",
268
- "function",
269
- "if",
270
- "import",
271
- "in",
272
- "instanceof",
273
- "new",
274
- "null",
275
- "return",
276
- "super",
277
- "switch",
278
- "this",
279
- "throw",
280
- "true",
281
- "try",
282
- "typeof",
283
- "var",
284
- "void",
285
- "while",
286
- "with"
287
- ]);
288
- },
289
- "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_createStandardSchema.js" (__unused_rspack_module, exports) {
290
- exports._createStandardSchema = void 0;
291
- const _createStandardSchema = (fn)=>Object.assign(fn, {
292
- "~standard": {
293
- version: 1,
294
- vendor: "typia",
295
- validate: (input)=>{
296
- const result = fn(input);
297
- if (result.success) return {
298
- value: result.data
299
- };
300
- return {
301
- issues: result.errors.map((error)=>({
302
- message: `expected ${error.expected}, got ${error.value}`,
303
- path: typiaPathToStandardSchemaPath(error.path)
304
- }))
305
- };
306
- }
307
- }
308
- });
309
- exports._createStandardSchema = _createStandardSchema;
310
- var PathParserState;
311
- (function(PathParserState) {
312
- PathParserState[PathParserState["Start"] = 0] = "Start";
313
- PathParserState[PathParserState["Property"] = 1] = "Property";
314
- PathParserState[PathParserState["StringKey"] = 2] = "StringKey";
315
- PathParserState[PathParserState["NumberKey"] = 3] = "NumberKey";
316
- })(PathParserState || (PathParserState = {}));
317
- const typiaPathToStandardSchemaPath = (path)=>{
318
- if (!path.startsWith("$input")) throw new Error(`Invalid path: ${JSON.stringify(path)}`);
319
- const segments = [];
320
- let currentSegment = "";
321
- let state = PathParserState.Start;
322
- let index = 5;
323
- while(index < path.length - 1){
324
- index++;
325
- const char = path[index];
326
- if (state === PathParserState.Property) if ("." === char || "[" === char) {
327
- segments.push({
328
- key: currentSegment
329
- });
330
- state = PathParserState.Start;
331
- } else if (index === path.length - 1) {
332
- currentSegment += char;
333
- segments.push({
334
- key: currentSegment
335
- });
336
- index++;
337
- state = PathParserState.Start;
338
- } else currentSegment += char;
339
- else if (state === PathParserState.StringKey) if ('"' === char) {
340
- segments.push({
341
- key: JSON.parse(currentSegment + char)
342
- });
343
- index += 2;
344
- state = PathParserState.Start;
345
- } else if ("\\" === char) {
346
- currentSegment += path[index];
347
- index++;
348
- currentSegment += path[index];
349
- } else currentSegment += char;
350
- else if (state === PathParserState.NumberKey) if ("]" === char) {
351
- segments.push({
352
- key: Number.parseInt(currentSegment)
353
- });
354
- index++;
355
- state = PathParserState.Start;
356
- } else currentSegment += char;
357
- if (state === PathParserState.Start && index < path.length - 1) {
358
- const newChar = path[index];
359
- currentSegment = "";
360
- if ("[" === newChar) if ('"' === path[index + 1]) {
361
- state = PathParserState.StringKey;
362
- index++;
363
- currentSegment = '"';
364
- } else state = PathParserState.NumberKey;
365
- else if ("." === newChar) state = PathParserState.Property;
366
- else throw new Error("Unreachable: pointer points invalid character");
367
- }
368
- }
369
- if (state !== PathParserState.Start) throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);
370
- return segments;
371
- };
372
- },
373
- "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_validateReport.js" (__unused_rspack_module, exports) {
374
- exports._validateReport = void 0;
375
- const _validateReport = (array)=>{
376
- const reportable = (path)=>{
377
- if (0 === array.length) return true;
378
- const last = array[array.length - 1].path;
379
- return path.length > last.length || last.substring(0, path.length) !== path;
380
- };
381
- return (exceptable, error)=>{
382
- if (exceptable && reportable(error.path)) {
383
- if (void 0 === error.value) null != error.description || (error.description = [
384
- "The value at this path is `undefined`.",
385
- "",
386
- `Please fill the \`${error.expected}\` typed value next time.`
387
- ].join("\n"));
388
- array.push(error);
389
- }
390
- return false;
391
- };
392
- };
393
- exports._validateReport = _validateReport;
394
- },
395
284
  os (module) {
396
- module.exports = __rspack_external_os;
285
+ module.exports = __rspack_createRequire_require("os");
397
286
  },
398
287
  tty (module) {
399
- module.exports = __rspack_external_tty;
288
+ module.exports = __rspack_createRequire_require("tty");
400
289
  }
401
290
  });
402
291
  const isBrowser = globalThis.window?.document !== void 0;
@@ -474,9 +363,145 @@ class LynxConfigWebpackPlugin {
474
363
  });
475
364
  }
476
365
  }
477
- const _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
478
- const _createStandardSchema = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_createStandardSchema.js");
479
- const _validateReport = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_validateReport.js");
366
+ const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
367
+ const variable = (str)=>false === reserved(str) && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
368
+ const reserved = (str)=>RESERVED.has(str);
369
+ const RESERVED = new Set([
370
+ "break",
371
+ "case",
372
+ "catch",
373
+ "class",
374
+ "const",
375
+ "continue",
376
+ "debugger",
377
+ "default",
378
+ "delete",
379
+ "do",
380
+ "else",
381
+ "enum",
382
+ "export",
383
+ "extends",
384
+ "false",
385
+ "finally",
386
+ "for",
387
+ "function",
388
+ "if",
389
+ "import",
390
+ "in",
391
+ "instanceof",
392
+ "new",
393
+ "null",
394
+ "return",
395
+ "super",
396
+ "switch",
397
+ "this",
398
+ "throw",
399
+ "true",
400
+ "try",
401
+ "typeof",
402
+ "var",
403
+ "void",
404
+ "while",
405
+ "with"
406
+ ]);
407
+ const _validateReport = (array)=>{
408
+ const reportable = (path)=>{
409
+ if (0 === array.length) return true;
410
+ const last = array[array.length - 1].path;
411
+ return path.length > last.length || last.substring(0, path.length) !== path;
412
+ };
413
+ return (exceptable, error)=>{
414
+ if (exceptable && reportable(error.path)) {
415
+ if (void 0 === error.value) error.description ??= [
416
+ "The value at this path is `undefined`.",
417
+ "",
418
+ `Please fill the \`${error.expected}\` typed value next time.`
419
+ ].join("\n");
420
+ array.push(error);
421
+ }
422
+ return false;
423
+ };
424
+ };
425
+ const _createStandardSchema = (fn)=>Object.assign(fn, {
426
+ "~standard": {
427
+ version: 1,
428
+ vendor: "typia",
429
+ validate: (input)=>{
430
+ const result = fn(input);
431
+ if (result.success) return {
432
+ value: result.data
433
+ };
434
+ return {
435
+ issues: result.errors.map((error)=>({
436
+ message: `expected ${error.expected}, got ${error.value}`,
437
+ path: typiaPathToStandardSchemaPath(error.path)
438
+ }))
439
+ };
440
+ }
441
+ }
442
+ });
443
+ var _createStandardSchema_PathParserState;
444
+ (function(PathParserState) {
445
+ PathParserState[PathParserState["Start"] = 0] = "Start";
446
+ PathParserState[PathParserState["Property"] = 1] = "Property";
447
+ PathParserState[PathParserState["StringKey"] = 2] = "StringKey";
448
+ PathParserState[PathParserState["NumberKey"] = 3] = "NumberKey";
449
+ })(_createStandardSchema_PathParserState || (_createStandardSchema_PathParserState = {}));
450
+ const typiaPathToStandardSchemaPath = (path)=>{
451
+ if (!path.startsWith("$input")) throw new Error(`Invalid path: ${JSON.stringify(path)}`);
452
+ const segments = [];
453
+ let currentSegment = "";
454
+ let state = _createStandardSchema_PathParserState.Start;
455
+ let index = 5;
456
+ while(index < path.length - 1){
457
+ index++;
458
+ const char = path[index];
459
+ if (state === _createStandardSchema_PathParserState.Property) if ("." === char || "[" === char) {
460
+ segments.push({
461
+ key: currentSegment
462
+ });
463
+ state = _createStandardSchema_PathParserState.Start;
464
+ } else if (index === path.length - 1) {
465
+ currentSegment += char;
466
+ segments.push({
467
+ key: currentSegment
468
+ });
469
+ index++;
470
+ state = _createStandardSchema_PathParserState.Start;
471
+ } else currentSegment += char;
472
+ else if (state === _createStandardSchema_PathParserState.StringKey) if ('"' === char) {
473
+ segments.push({
474
+ key: JSON.parse(currentSegment + char)
475
+ });
476
+ index += 2;
477
+ state = _createStandardSchema_PathParserState.Start;
478
+ } else if ("\\" === char) {
479
+ currentSegment += path[index];
480
+ index++;
481
+ currentSegment += path[index];
482
+ } else currentSegment += char;
483
+ else if (state === _createStandardSchema_PathParserState.NumberKey) if ("]" === char) {
484
+ segments.push({
485
+ key: Number.parseInt(currentSegment)
486
+ });
487
+ index++;
488
+ state = _createStandardSchema_PathParserState.Start;
489
+ } else currentSegment += char;
490
+ if (state === _createStandardSchema_PathParserState.Start && index < path.length - 1) {
491
+ const newChar = path[index];
492
+ currentSegment = "";
493
+ if ("[" === newChar) if ('"' === path[index + 1]) {
494
+ state = _createStandardSchema_PathParserState.StringKey;
495
+ index++;
496
+ currentSegment = '"';
497
+ } else state = _createStandardSchema_PathParserState.NumberKey;
498
+ else if ("." === newChar) state = _createStandardSchema_PathParserState.Property;
499
+ else throw new Error("Unreachable: pointer points invalid character");
500
+ }
501
+ }
502
+ if (state !== _createStandardSchema_PathParserState.Start) throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);
503
+ return segments;
504
+ };
480
505
  const picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
481
506
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
482
507
  const validateConfig = (()=>{
@@ -1525,7 +1550,7 @@ const validateConfig = (()=>{
1525
1550
  const value = input[key];
1526
1551
  if (void 0 === value) return true;
1527
1552
  return _report(_exceptionable, {
1528
- path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1553
+ path: _path + _accessExpressionAsString(key),
1529
1554
  expected: "undefined",
1530
1555
  value: value,
1531
1556
  description: [
@@ -1545,10 +1570,10 @@ const validateConfig = (()=>{
1545
1570
  const __is = (input, _exceptionable = true)=>"object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);
1546
1571
  let errors;
1547
1572
  let _report;
1548
- return _createStandardSchema._createStandardSchema((input)=>{
1573
+ return _createStandardSchema((input)=>{
1549
1574
  if (false === __is(input)) {
1550
1575
  errors = [];
1551
- _report = _validateReport._validateReport(errors);
1576
+ _report = _validateReport(errors);
1552
1577
  ((input, _path, _exceptionable = true)=>("object" == typeof input && null !== input && false === Array.isArray(input) || _report(true, {
1553
1578
  path: _path + "",
1554
1579
  expected: "Config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/config-rsbuild-plugin",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "An rsbuild plugin for config Lynx Config defined by @lynx-js/type-config.",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -35,21 +35,22 @@
35
35
  "@lynx-js/type-config": "3.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@rollup/plugin-typescript": "^12.3.0",
39
- "@rsbuild/core": "1.7.5",
38
+ "@rsbuild/core": "2.0.11",
39
+ "@rspack/core": "2.0.8",
40
+ "@rstest/core": "0.10.5",
40
41
  "@types/object.pick": "^1.3.4",
42
+ "expect-type": "^1.2.1",
41
43
  "object.pick": "^1.3.0",
42
44
  "picocolors": "^1.1.1",
43
45
  "terminal-link": "^4.0.0",
44
- "typia": "10.1.0",
45
- "typia-rspack-plugin": "2.2.2",
46
- "webpack": "^5.105.2",
47
- "@lynx-js/rspeedy": "0.14.1",
48
- "@lynx-js/template-webpack-plugin": "0.10.8",
46
+ "typia": "12.1.1",
47
+ "typia-rspack-plugin": "3.0.1",
48
+ "@lynx-js/rspeedy": "0.15.0",
49
+ "@lynx-js/template-webpack-plugin": "0.12.0",
49
50
  "@lynx-js/test-tools": "0.0.0"
50
51
  },
51
52
  "peerDependencies": {
52
- "@lynx-js/rspeedy": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0"
53
+ "@lynx-js/rspeedy": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0"
53
54
  },
54
55
  "engines": {
55
56
  "node": ">=18"
@@ -57,6 +58,7 @@
57
58
  "scripts": {
58
59
  "api-extractor": "api-extractor run --verbose",
59
60
  "build": "rslib build",
60
- "test": "vitest"
61
+ "test": "rstest",
62
+ "test:type": "tsc --noEmit"
61
63
  }
62
64
  }
@@ -1,38 +0,0 @@
1
- var __webpack_modules__ = {};
2
- var __webpack_module_cache__ = {};
3
- function __webpack_require__(moduleId) {
4
- var cachedModule = __webpack_module_cache__[moduleId];
5
- if (void 0 !== cachedModule) return cachedModule.exports;
6
- var module = __webpack_module_cache__[moduleId] = {
7
- exports: {}
8
- };
9
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
- return module.exports;
11
- }
12
- __webpack_require__.m = __webpack_modules__;
13
- (()=>{
14
- __webpack_require__.add = function(modules) {
15
- Object.assign(__webpack_require__.m, modules);
16
- };
17
- })();
18
- (()=>{
19
- __webpack_require__.n = (module)=>{
20
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
21
- __webpack_require__.d(getter, {
22
- a: getter
23
- });
24
- return getter;
25
- };
26
- })();
27
- (()=>{
28
- __webpack_require__.d = (exports, definition)=>{
29
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
30
- enumerable: true,
31
- get: definition[key]
32
- });
33
- };
34
- })();
35
- (()=>{
36
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
37
- })();
38
- export { __webpack_require__ };