@rspack/test-tools 2.0.1 → 2.0.3

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 (118) hide show
  1. package/dist/case/builtin.js +106 -66
  2. package/dist/case/cache.js +152 -132
  3. package/dist/case/common.d.ts +4 -4
  4. package/dist/case/common.js +162 -157
  5. package/dist/case/compiler.d.ts +4 -4
  6. package/dist/case/compiler.js +75 -64
  7. package/dist/case/config.js +112 -74
  8. package/dist/case/defaults.js +136 -83
  9. package/dist/case/diagnostic.js +112 -84
  10. package/dist/case/error.d.ts +4 -4
  11. package/dist/case/error.js +105 -89
  12. package/dist/case/esm-output.js +118 -87
  13. package/dist/case/example.js +73 -35
  14. package/dist/case/hash.js +74 -59
  15. package/dist/case/hook.js +151 -138
  16. package/dist/case/hot-step.js +130 -161
  17. package/dist/case/hot.js +148 -134
  18. package/dist/case/incremental.js +91 -58
  19. package/dist/case/index.js +134 -51
  20. package/dist/case/multi-compiler.d.ts +4 -4
  21. package/dist/case/multi-compiler.js +81 -56
  22. package/dist/case/native-watcher.js +62 -30
  23. package/dist/case/normal.js +253 -185
  24. package/dist/case/runner.js +80 -51
  25. package/dist/case/serial.js +47 -16
  26. package/dist/case/stats-api.d.ts +4 -4
  27. package/dist/case/stats-api.js +63 -43
  28. package/dist/case/stats-output.d.ts +3 -3
  29. package/dist/case/stats-output.js +147 -152
  30. package/dist/case/treeshaking.js +66 -35
  31. package/dist/case/watch.d.ts +3 -19
  32. package/dist/case/watch.js +204 -224
  33. package/dist/compiler.js +222 -195
  34. package/dist/helper/directory.js +83 -71
  35. package/dist/helper/disable-iconv-lite-warning.js +35 -9
  36. package/dist/helper/expect/diff.js +39 -10
  37. package/dist/helper/expect/error.js +62 -30
  38. package/dist/helper/expect/placeholder.js +47 -21
  39. package/dist/helper/expect/rspack.js +35 -13
  40. package/dist/helper/expect/to-be-typeof.js +39 -7
  41. package/dist/helper/expect/to-end-with.js +40 -8
  42. package/dist/helper/expect/to-match-file-snapshot.js +103 -80
  43. package/dist/helper/hot-update/index.js +35 -4
  44. package/dist/helper/hot-update/loader.d.ts +1 -0
  45. package/dist/helper/hot-update/loader.js +39 -4
  46. package/dist/helper/hot-update/plugin.d.ts +1 -1
  47. package/dist/helper/hot-update/plugin.js +87 -74
  48. package/dist/helper/index.js +138 -24
  49. package/dist/helper/is.js +51 -10
  50. package/dist/helper/legacy/EventSourceForNode.d.ts +11 -3
  51. package/dist/helper/legacy/EventSourceForNode.js +83 -37
  52. package/dist/helper/legacy/LogTestPlugin.d.ts +2 -3
  53. package/dist/helper/legacy/LogTestPlugin.js +39 -6
  54. package/dist/helper/legacy/asModule.d.ts +3 -3
  55. package/dist/helper/legacy/asModule.js +68 -19
  56. package/dist/helper/legacy/captureStdio.d.ts +1 -2
  57. package/dist/helper/legacy/captureStdio.js +69 -29
  58. package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -2
  59. package/dist/helper/legacy/checkArrayExpectation.js +132 -121
  60. package/dist/helper/legacy/copyDiff.d.ts +1 -2
  61. package/dist/helper/legacy/copyDiff.js +86 -42
  62. package/dist/helper/legacy/createFakeWorker.d.ts +2 -3
  63. package/dist/helper/legacy/createFakeWorker.js +90 -47
  64. package/dist/helper/legacy/createLazyTestEnv.d.ts +2 -3
  65. package/dist/helper/legacy/createLazyTestEnv.js +70 -59
  66. package/dist/helper/legacy/currentScript.d.ts +2 -2
  67. package/dist/helper/legacy/currentScript.js +35 -2
  68. package/dist/helper/legacy/deprecationTracking.d.ts +1 -1
  69. package/dist/helper/legacy/deprecationTracking.js +53 -28
  70. package/dist/helper/legacy/expectSource.d.ts +3 -2
  71. package/dist/helper/legacy/expectSource.js +42 -18
  72. package/dist/helper/legacy/fakeSystem.d.ts +12 -9
  73. package/dist/helper/legacy/fakeSystem.js +68 -58
  74. package/dist/helper/legacy/findOutputFiles.d.ts +7 -2
  75. package/dist/helper/legacy/findOutputFiles.js +60 -13
  76. package/dist/helper/legacy/parseResource.d.ts +1 -1
  77. package/dist/helper/legacy/parseResource.js +36 -6
  78. package/dist/helper/legacy/regexEscape.d.ts +1 -2
  79. package/dist/helper/legacy/regexEscape.js +39 -5
  80. package/dist/helper/legacy/supportDefaultAssignment.d.ts +1 -2
  81. package/dist/helper/legacy/supportDefaultAssignment.js +40 -7
  82. package/dist/helper/legacy/supportsTextDecoder.d.ts +1 -2
  83. package/dist/helper/legacy/supportsTextDecoder.js +40 -6
  84. package/dist/helper/legacy/supportsUsing.d.ts +1 -2
  85. package/dist/helper/legacy/supportsUsing.js +40 -7
  86. package/dist/helper/legacy/urlToRelativePath.d.ts +2 -2
  87. package/dist/helper/legacy/urlToRelativePath.js +56 -7
  88. package/dist/helper/parse-modules.js +52 -42
  89. package/dist/helper/read-config-file.js +60 -18
  90. package/dist/helper/serializers.js +62 -33
  91. package/dist/helper/setup-env.js +81 -91
  92. package/dist/helper/setup-expect.js +13 -13
  93. package/dist/helper/setup-wasm.js +18 -9
  94. package/dist/helper/stringify-config.js +44 -26
  95. package/dist/helper/update-snapshot.js +35 -3
  96. package/dist/helper/util/checkSourceMap.js +119 -80
  97. package/dist/helper/util/checkStats.d.ts +1 -1
  98. package/dist/helper/util/checkStats.js +42 -17
  99. package/dist/helper/util/expectWarningFactory.d.ts +1 -2
  100. package/dist/helper/util/expectWarningFactory.js +41 -8
  101. package/dist/helper/util/filterUtil.d.ts +9 -8
  102. package/dist/helper/util/filterUtil.js +63 -23
  103. package/dist/helper/win.js +46 -7
  104. package/dist/index.js +115 -23
  105. package/dist/plugin/index.js +55 -14
  106. package/dist/plugin/lazy-compilation-test-plugin.js +55 -41
  107. package/dist/reporter/index.js +55 -14
  108. package/dist/reporter/streamed-events-reporter.js +51 -77
  109. package/dist/runner/index.js +62 -15
  110. package/dist/runner/node/index.js +365 -431
  111. package/dist/runner/web/index.js +278 -263
  112. package/dist/test/context.js +67 -41
  113. package/dist/test/creator.js +135 -167
  114. package/dist/test/debug.js +89 -58
  115. package/dist/test/tester.js +94 -74
  116. package/dist/type.d.ts +10 -9
  117. package/dist/type.js +43 -9
  118. package/package.json +24 -23
@@ -1,52 +1,81 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializers = void 0;
4
- const diff_1 = require("./expect/diff");
5
- const error_1 = require("./expect/error");
6
- const placeholder_1 = require("./expect/placeholder");
7
- const rspack_1 = require("./expect/rspack");
8
- exports.serializers = [
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ serializers: ()=>serializers
28
+ });
29
+ const diff_js_namespaceObject = require("./expect/diff.js");
30
+ const error_js_namespaceObject = require("./expect/error.js");
31
+ const placeholder_js_namespaceObject = require("./expect/placeholder.js");
32
+ const rspack_js_namespaceObject = require("./expect/rspack.js");
33
+ const serializers = [
9
34
  {
10
- test(received) {
11
- return typeof received === 'string';
12
- },
13
- print(received) {
14
- return (0, placeholder_1.normalizePlaceholder)(received.trim());
35
+ test (received) {
36
+ return 'string' == typeof received;
15
37
  },
38
+ print (received) {
39
+ return (0, placeholder_js_namespaceObject.normalizePlaceholder)(received.trim());
40
+ }
16
41
  },
17
- // for diff
18
42
  {
19
- test(received) {
43
+ test (received) {
20
44
  return received?.constructor?.name === 'RspackTestDiff';
21
45
  },
22
- print(received, next) {
23
- return next((0, diff_1.normalizeDiff)(received));
24
- },
46
+ print (received, next) {
47
+ return next((0, diff_js_namespaceObject.normalizeDiff)(received));
48
+ }
25
49
  },
26
- // for errors
27
50
  {
28
- test(received) {
51
+ test (received) {
29
52
  return received?.constructor?.name === 'RspackStatsDiagnostics';
30
53
  },
31
- print(received, next) {
32
- return next((0, error_1.normalizeDignostics)(received));
33
- },
54
+ print (received, next) {
55
+ return next((0, error_js_namespaceObject.normalizeDignostics)(received));
56
+ }
34
57
  },
35
58
  {
36
- test(received) {
37
- return typeof received?.message === 'string';
38
- },
39
- print(received, next) {
40
- return next((0, error_1.normalizeError)(received));
59
+ test (received) {
60
+ return 'string' == typeof received?.message;
41
61
  },
62
+ print (received, next) {
63
+ return next((0, error_js_namespaceObject.normalizeError)(received));
64
+ }
42
65
  },
43
- // for stats
44
66
  {
45
- test(received) {
67
+ test (received) {
46
68
  return received?.constructor?.name === 'RspackStats';
47
69
  },
48
- print(received, next) {
49
- return next((0, rspack_1.normalizeStats)(received));
50
- },
51
- },
70
+ print (received, next) {
71
+ return next((0, rspack_js_namespaceObject.normalizeStats)(received));
72
+ }
73
+ }
52
74
  ];
75
+ exports.serializers = __webpack_exports__.serializers;
76
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
77
+ "serializers"
78
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
79
+ Object.defineProperty(exports, '__esModule', {
80
+ value: true
81
+ });
@@ -1,37 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-nocheck
4
- const path = require('node:path');
5
- // Setup environment variable for binding testing
6
- if (process.env.RSPACK_BINDING_BUILDER_TESTING) {
7
- process.env.RSPACK_BINDING = path.resolve(__dirname, '../../node_modules/@rspack/binding-testing');
8
- }
9
- if (process.env.RSTEST) {
10
- global.printLogger ??= process.env.printLogger === 'true';
11
- global.__TEST_FIXTURES_PATH__ ??= process.env.__TEST_FIXTURES_PATH__;
12
- global.updateSnapshot ??= process.env.updateSnapshot === 'true';
13
- global.testFilter ??= process.env.testFilter;
14
- global.__TEST_PATH__ ??= process.env.__TEST_PATH__;
15
- global.__TEST_DIST_PATH__ ??= process.env.__TEST_DIST_PATH__;
16
- global.__ROOT_PATH__ ??= process.env.__ROOT_PATH__;
17
- global.__RSPACK_PATH__ ??= process.env.__RSPACK_PATH__;
18
- global.__RSPACK_TEST_TOOLS_PATH__ ??= process.env.__RSPACK_TEST_TOOLS_PATH__;
19
- global.__DEBUG__ ??= process.env.DEBUG === 'test';
1
+ var __webpack_modules__ = {
2
+ "node:path" (module) {
3
+ "use strict";
4
+ module.exports = require("node:path");
5
+ },
6
+ "wast-loader" (module) {
7
+ "use strict";
8
+ module.exports = require("wast-loader");
9
+ }
10
+ };
11
+ var __webpack_module_cache__ = {};
12
+ function __webpack_require__(moduleId) {
13
+ var cachedModule = __webpack_module_cache__[moduleId];
14
+ if (void 0 !== cachedModule) return cachedModule.exports;
15
+ var module = __webpack_module_cache__[moduleId] = {
16
+ exports: {}
17
+ };
18
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
19
+ return module.exports;
20
20
  }
21
- if (process.env.ALTERNATIVE_SORT) {
22
- const oldSort = Array.prototype.sort;
23
- Array.prototype.sort = function (cmp) {
24
- oldSort.call(this, cmp);
25
- if (cmp) {
26
- for (let i = 1; i < this.length; i++) {
27
- if (cmp(this[i - 1], this[i]) === 0) {
21
+ var __webpack_exports__ = {};
22
+ (()=>{
23
+ const path = __webpack_require__("node:path");
24
+ if (process.env.RSPACK_BINDING_BUILDER_TESTING) process.env.RSPACK_BINDING = path.resolve(__dirname, '../../node_modules/@rspack/binding-testing');
25
+ if (process.env.RSTEST) {
26
+ global.printLogger ??= 'true' === process.env.printLogger;
27
+ global.__TEST_FIXTURES_PATH__ ??= process.env.__TEST_FIXTURES_PATH__;
28
+ global.updateSnapshot ??= 'true' === process.env.updateSnapshot;
29
+ global.testFilter ??= process.env.testFilter;
30
+ global.__TEST_PATH__ ??= process.env.__TEST_PATH__;
31
+ global.__TEST_DIST_PATH__ ??= process.env.__TEST_DIST_PATH__;
32
+ global.__ROOT_PATH__ ??= process.env.__ROOT_PATH__;
33
+ global.__RSPACK_PATH__ ??= process.env.__RSPACK_PATH__;
34
+ global.__RSPACK_TEST_TOOLS_PATH__ ??= process.env.__RSPACK_TEST_TOOLS_PATH__;
35
+ global.__DEBUG__ ??= 'test' === process.env.DEBUG;
36
+ }
37
+ if (process.env.ALTERNATIVE_SORT) {
38
+ const oldSort = Array.prototype.sort;
39
+ Array.prototype.sort = function(cmp) {
40
+ oldSort.call(this, cmp);
41
+ if (cmp) {
42
+ for(let i = 1; i < this.length; i++)if (0 === cmp(this[i - 1], this[i])) {
28
43
  let j = i + 1;
29
- for (; j < this.length; j++) {
30
- if (cmp(this[j - 1], this[j]) !== 0) {
31
- break;
32
- }
33
- }
34
- for (let x = i - 1, y = j - 1; x < y; x++, y--) {
44
+ for(; j < this.length && 0 === cmp(this[j - 1], this[j]); j++);
45
+ for(let x = i - 1, y = j - 1; x < y; x++, y--){
35
46
  const temp = this[x];
36
47
  this[x] = this[y];
37
48
  this[y] = temp;
@@ -39,69 +50,48 @@ if (process.env.ALTERNATIVE_SORT) {
39
50
  i = j;
40
51
  }
41
52
  }
42
- }
43
- return this;
44
- };
45
- }
46
- // Setup debugging info for tests
47
- if (process.env.DEBUG_INFO) {
48
- const addDebugInfo = (it) => {
49
- return (name, fn, timeout) => {
50
- if (fn.length === 0) {
51
- it(name, () => {
53
+ return this;
54
+ };
55
+ }
56
+ if (process.env.DEBUG_INFO) {
57
+ const addDebugInfo = (it1)=>(name, fn, timeout)=>{
58
+ 0 === fn.length ? it1(name, ()=>{
52
59
  process.stdout.write(`START1 ${name}\n`);
53
60
  try {
54
61
  const promise = fn();
55
- if (promise?.then) {
56
- return promise.then((r) => {
57
- process.stdout.write(`DONE OK ${name}\n`);
58
- return r;
59
- }, (e) => {
60
- process.stdout.write(`DONE FAIL ${name}\n`);
61
- throw e;
62
- });
63
- }
62
+ if (promise?.then) return promise.then((r)=>{
63
+ process.stdout.write(`DONE OK ${name}\n`);
64
+ return r;
65
+ }, (e)=>{
66
+ process.stdout.write(`DONE FAIL ${name}\n`);
67
+ throw e;
68
+ });
64
69
  process.stdout.write(`DONE OK ${name}\n`);
65
- }
66
- catch (e) {
70
+ } catch (e) {
67
71
  process.stdout.write(`DONE FAIL ${name}\n`);
68
72
  throw e;
69
73
  }
70
- }, timeout);
71
- }
72
- else {
73
- it(name, () => new Promise((resolve, reject) => {
74
- const done = (err) => (err ? reject(err) : resolve());
75
- process.stdout.write(`START2 ${name}\n`);
76
- return fn((err) => {
77
- if (err) {
78
- process.stdout.write(`DONE FAIL ${name}\n`);
79
- }
80
- else {
81
- process.stdout.write(`DONE OK ${name}\n`);
82
- }
83
- return done(err);
84
- });
85
- }), timeout);
86
- }
87
- };
88
- };
89
- // eslint-disable-next-line no-global-assign
90
- it = addDebugInfo(it);
91
- }
92
- const uncaughtExceptionListenersLength = process.listeners('uncaughtException').length;
93
- const unhandledRejectionListenersLength = process.listeners('unhandledRejection').length;
94
- // cspell:word wabt
95
- // Workaround for a memory leak in wabt
96
- // It leaks an Error object on construction
97
- // so it leaks the whole stack trace
98
- require('wast-loader');
99
- // remove the last uncaughtException / unhandledRejection listener added by wast-loader
100
- const listeners = process.listeners('uncaughtException');
101
- if (listeners.length > uncaughtExceptionListenersLength) {
102
- process.off('uncaughtException', listeners[listeners.length - 1]);
103
- }
104
- const listeners1 = process.listeners('unhandledRejection');
105
- if (listeners1.length > unhandledRejectionListenersLength) {
106
- process.off('unhandledRejection', listeners1[listeners1.length - 1]);
107
- }
74
+ }, timeout) : it1(name, ()=>new Promise((resolve, reject)=>{
75
+ const done = (err)=>err ? reject(err) : resolve();
76
+ process.stdout.write(`START2 ${name}\n`);
77
+ return fn((err)=>{
78
+ if (err) process.stdout.write(`DONE FAIL ${name}\n`);
79
+ else process.stdout.write(`DONE OK ${name}\n`);
80
+ return done(err);
81
+ });
82
+ }), timeout);
83
+ };
84
+ it = addDebugInfo(it);
85
+ }
86
+ const uncaughtExceptionListenersLength = process.listeners('uncaughtException').length;
87
+ const unhandledRejectionListenersLength = process.listeners('unhandledRejection').length;
88
+ __webpack_require__("wast-loader");
89
+ const listeners = process.listeners('uncaughtException');
90
+ if (listeners.length > uncaughtExceptionListenersLength) process.off('uncaughtException', listeners[listeners.length - 1]);
91
+ const listeners1 = process.listeners('unhandledRejection');
92
+ if (listeners1.length > unhandledRejectionListenersLength) process.off('unhandledRejection', listeners1[listeners1.length - 1]);
93
+ })();
94
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
95
+ Object.defineProperty(exports, '__esModule', {
96
+ value: true
97
+ });
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const to_be_typeof_1 = require("./expect/to-be-typeof");
4
- const to_end_with_1 = require("./expect/to-end-with");
5
- const to_match_file_snapshot_1 = require("./expect/to-match-file-snapshot");
6
- const serializers_1 = require("./serializers");
2
+ var __webpack_exports__ = {};
3
+ const to_be_typeof_js_namespaceObject = require("./expect/to-be-typeof.js");
4
+ const to_end_with_js_namespaceObject = require("./expect/to-end-with.js");
5
+ const to_match_file_snapshot_js_namespaceObject = require("./expect/to-match-file-snapshot.js");
6
+ const external_serializers_js_namespaceObject = require("./serializers.js");
7
7
  expect.extend({
8
- // CHANGE: new test matcher for `rspack-test-tools`
9
- // @ts-expect-error
10
- toMatchFileSnapshotSync: to_match_file_snapshot_1.toMatchFileSnapshotSync,
11
- toBeTypeOf: to_be_typeof_1.toBeTypeOf,
12
- toEndWith: to_end_with_1.toEndWith,
8
+ toMatchFileSnapshotSync: to_match_file_snapshot_js_namespaceObject.toMatchFileSnapshotSync,
9
+ toBeTypeOf: to_be_typeof_js_namespaceObject.toBeTypeOf,
10
+ toEndWith: to_end_with_js_namespaceObject.toEndWith
11
+ });
12
+ for (const serializer of external_serializers_js_namespaceObject.serializers)expect.addSnapshotSerializer(serializer);
13
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
14
+ Object.defineProperty(exports, '__esModule', {
15
+ value: true
13
16
  });
14
- for (const serializer of serializers_1.serializers) {
15
- expect.addSnapshotSerializer(serializer);
16
- }
@@ -1,19 +1,28 @@
1
- "use strict";
2
- // Skip all snapshot tests for wasm because:
3
- // 1. The wasm error backtrace bypasses emnapi.
4
- // 2. Wasm target is a 32-bit platform, where all hash results are diffeference from the native targets.
5
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ var __webpack_exports__ = {};
6
2
  function toMatchSnapshot() {
7
- return { pass: true, message: () => '' };
3
+ return {
4
+ pass: true,
5
+ message: ()=>''
6
+ };
8
7
  }
9
8
  function toMatchInlineSnapshot() {
10
- return { pass: true, message: () => '' };
9
+ return {
10
+ pass: true,
11
+ message: ()=>''
12
+ };
11
13
  }
12
14
  function toMatchFileSnapshotSync() {
13
- return { pass: true, message: () => '' };
15
+ return {
16
+ pass: true,
17
+ message: ()=>''
18
+ };
14
19
  }
15
20
  expect.extend({
16
21
  toMatchSnapshot,
17
22
  toMatchInlineSnapshot,
18
- toMatchFileSnapshotSync,
23
+ toMatchFileSnapshotSync
24
+ });
25
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
26
+ Object.defineProperty(exports, '__esModule', {
27
+ value: true
19
28
  });
@@ -1,43 +1,61 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = stringifyConfig;
4
- const javascript_stringify_1 = require("javascript-stringify");
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ default: ()=>stringifyConfig
28
+ });
29
+ const external_javascript_stringify_namespaceObject = require("javascript-stringify");
5
30
  function stringifyConfig(config, verbose = false) {
6
- return (0, javascript_stringify_1.stringify)(config, (value, indent, stringify) => {
7
- // improve plugin output
31
+ return (0, external_javascript_stringify_namespaceObject.stringify)(config, (value, indent, stringify)=>{
8
32
  if (value?.__pluginName) {
9
33
  const prefix = `/* config.${value.__pluginType}('${value.__pluginName}') */\n`;
10
- const constructorExpression = value.__pluginPath
11
- ? // The path is stringified to ensure special characters are escaped
12
- // (such as the backslashes in Windows-style paths).
13
- `(require(${stringify(value.__pluginPath)}))`
14
- : value.__pluginConstructorName;
34
+ const constructorExpression = value.__pluginPath ? `(require(${stringify(value.__pluginPath)}))` : value.__pluginConstructorName;
15
35
  if (constructorExpression) {
16
- // get correct indentation for args by stringifying the args array and
17
- // discarding the square brackets.
18
36
  const args = stringify(value.__pluginArgs)?.slice(1, -1);
19
37
  return `${prefix}new ${constructorExpression}(${args})`;
20
38
  }
21
- return (prefix +
22
- stringify(value.__pluginArgs?.length ? { args: value.__pluginArgs } : {}));
39
+ return prefix + stringify(value.__pluginArgs?.length ? {
40
+ args: value.__pluginArgs
41
+ } : {});
23
42
  }
24
- // improve rule/use output
25
43
  if (value?.__ruleNames) {
26
44
  const ruleTypes = value.__ruleTypes;
27
- const prefix = `/* config.module${value.__ruleNames
28
- .map((r, index) => `.${ruleTypes ? ruleTypes[index] : 'rule'}('${r}')`)
29
- .join('')}${value.__useName ? `.use('${value.__useName}')` : ``} */\n`;
45
+ const prefix = `/* config.module${value.__ruleNames.map((r, index)=>`.${ruleTypes ? ruleTypes[index] : 'rule'}('${r}')`).join('')}${value.__useName ? `.use('${value.__useName}')` : ""} */\n`;
30
46
  return prefix + stringify(value);
31
47
  }
32
- if (value?.__expression) {
33
- return value.__expression;
34
- }
35
- // shorten long functions
36
- if (typeof value === 'function') {
37
- if (!verbose && value.toString().length > 100) {
38
- return `function () { /* omitted long function */ }`;
39
- }
48
+ if (value?.__expression) return value.__expression;
49
+ if ('function' == typeof value) {
50
+ if (!verbose && value.toString().length > 100) return "function () { /* omitted long function */ }";
40
51
  }
41
52
  return stringify(value);
42
53
  }, 2);
43
54
  }
55
+ exports["default"] = __webpack_exports__["default"];
56
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
57
+ "default"
58
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
59
+ Object.defineProperty(exports, '__esModule', {
60
+ value: true
61
+ });
@@ -1,6 +1,38 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUpdateSnapshot = isUpdateSnapshot;
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ isUpdateSnapshot: ()=>isUpdateSnapshot
28
+ });
4
29
  function isUpdateSnapshot() {
5
- return global.updateSnapshot || process.env.UPDATE_SNAPSHOT === 'true';
30
+ return global.updateSnapshot || 'true' === process.env.UPDATE_SNAPSHOT;
6
31
  }
32
+ exports.isUpdateSnapshot = __webpack_exports__.isUpdateSnapshot;
33
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
34
+ "isUpdateSnapshot"
35
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
36
+ Object.defineProperty(exports, '__esModule', {
37
+ value: true
38
+ });