@rspack/test-tools 1.5.4 → 1.5.6

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 (89) hide show
  1. package/dist/case/compiler.d.ts +11 -2
  2. package/dist/case/compiler.js +111 -8
  3. package/dist/case/hot-step.js +1 -1
  4. package/dist/case/normal.d.ts +1 -0
  5. package/dist/case/normal.js +27 -15
  6. package/dist/case/stats-output.js +1 -0
  7. package/dist/compare/format-code.d.ts +1 -1
  8. package/dist/compare/format-code.js +6 -1
  9. package/dist/compiler.d.ts +4 -3
  10. package/dist/compiler.js +7 -2
  11. package/dist/helper/directory.js +1 -1
  12. package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -1
  13. package/dist/helper/legacy/checkArrayExpectation.js +7 -7
  14. package/dist/helper/legacy/deprecationTracking.d.ts +1 -0
  15. package/dist/helper/legacy/deprecationTracking.js +41 -0
  16. package/dist/helper/legacy/supportDefaultAssignment.d.ts +2 -0
  17. package/dist/helper/legacy/supportDefaultAssignment.js +13 -0
  18. package/dist/helper/legacy/supportsClassFields.d.ts +2 -0
  19. package/dist/helper/legacy/supportsClassFields.js +11 -0
  20. package/dist/helper/legacy/supportsES6.d.ts +2 -0
  21. package/dist/helper/legacy/supportsES6.js +11 -0
  22. package/dist/helper/legacy/supportsForOf.d.ts +2 -0
  23. package/dist/helper/legacy/supportsForOf.js +11 -0
  24. package/dist/helper/legacy/supportsIteratorDestructuring.d.ts +2 -0
  25. package/dist/helper/legacy/supportsIteratorDestructuring.js +11 -0
  26. package/dist/helper/legacy/supportsLogicalAssignment.d.ts +2 -0
  27. package/dist/helper/legacy/supportsLogicalAssignment.js +11 -0
  28. package/dist/helper/legacy/supportsObjectDestructuring.d.ts +2 -0
  29. package/dist/helper/legacy/supportsObjectDestructuring.js +11 -0
  30. package/dist/helper/legacy/supportsOptionalCatchBinding.d.ts +2 -0
  31. package/dist/helper/legacy/supportsOptionalCatchBinding.js +11 -0
  32. package/dist/helper/legacy/supportsRequireInModule.d.ts +2 -0
  33. package/dist/helper/legacy/supportsRequireInModule.js +5 -0
  34. package/dist/helper/legacy/supportsSpread.d.ts +2 -0
  35. package/dist/helper/legacy/supportsSpread.js +12 -0
  36. package/dist/helper/legacy/supportsTemplateStrings.d.ts +2 -0
  37. package/dist/helper/legacy/supportsTemplateStrings.js +11 -0
  38. package/dist/helper/legacy/supportsUsing.d.ts +2 -0
  39. package/dist/helper/legacy/supportsUsing.js +26 -0
  40. package/dist/processor/basic.js +3 -2
  41. package/dist/processor/cache.js +3 -1
  42. package/dist/processor/config.js +3 -1
  43. package/dist/processor/diagnostic.js +3 -1
  44. package/dist/processor/hash.js +3 -1
  45. package/dist/processor/hook.js +3 -1
  46. package/dist/processor/hot.js +3 -1
  47. package/dist/processor/normal.js +23 -2
  48. package/dist/processor/simple.d.ts +1 -0
  49. package/dist/processor/simple.js +3 -1
  50. package/dist/processor/stats.d.ts +2 -2
  51. package/dist/processor/stats.js +7 -7
  52. package/dist/processor/watch.js +3 -2
  53. package/dist/runner/basic.js +4 -3
  54. package/dist/runner/cache.js +6 -4
  55. package/dist/runner/hot.js +11 -3
  56. package/dist/runner/index.d.ts +1 -3
  57. package/dist/runner/index.js +1 -3
  58. package/dist/runner/runner/index.d.ts +1 -7
  59. package/dist/runner/runner/index.js +1 -7
  60. package/dist/runner/runner/node/index.d.ts +38 -0
  61. package/dist/runner/runner/node/index.js +396 -0
  62. package/dist/runner/runner/web/fake.d.ts +11 -13
  63. package/dist/runner/runner/web/fake.js +3 -21
  64. package/dist/runner/runner/{web.d.ts → web/index.d.ts} +5 -6
  65. package/dist/runner/runner/{web.js → web/index.js} +3 -3
  66. package/dist/runner/runner/web/jsdom.d.ts +8 -8
  67. package/dist/runner/runner/web/jsdom.js +14 -4
  68. package/dist/runner/type.d.ts +4 -4
  69. package/dist/runner/watch.d.ts +1 -1
  70. package/dist/runner/watch.js +17 -6
  71. package/dist/test/creator.d.ts +1 -1
  72. package/dist/test/creator.js +1 -0
  73. package/dist/test/tester.js +9 -0
  74. package/dist/type.d.ts +9 -7
  75. package/package.json +19 -19
  76. package/dist/runner/hot-step.d.ts +0 -5
  77. package/dist/runner/hot-step.js +0 -87
  78. package/dist/runner/normal.d.ts +0 -5
  79. package/dist/runner/normal.js +0 -20
  80. package/dist/runner/runner/basic.d.ts +0 -30
  81. package/dist/runner/runner/basic.js +0 -119
  82. package/dist/runner/runner/cjs.d.ts +0 -16
  83. package/dist/runner/runner/cjs.js +0 -177
  84. package/dist/runner/runner/esm.d.ts +0 -7
  85. package/dist/runner/runner/esm.js +0 -128
  86. package/dist/runner/runner/normal.d.ts +0 -9
  87. package/dist/runner/runner/normal.js +0 -23
  88. package/dist/runner/runner/watch.d.ts +0 -16
  89. package/dist/runner/runner/watch.js +0 -27
@@ -1,6 +1,15 @@
1
1
  import { type ISimpleProcessorOptions } from "../processor";
2
- import { ECompilerType } from "../type";
3
- export type TCompilerCaseConfig = Omit<ISimpleProcessorOptions<ECompilerType.Rspack>, "name" | "compilerType"> & {
2
+ import { ECompilerType, type ITestContext, type TCompilation, type TCompiler, type TCompilerStatsCompilation } from "../type";
3
+ export type TCompilerCaseConfig = Omit<ISimpleProcessorOptions<ECompilerType.Rspack>, "name" | "compilerType" | "check"> & {
4
4
  description: string;
5
+ error?: boolean;
6
+ skip?: boolean;
7
+ check?: ({ context, stats, files, compiler, compilation }: {
8
+ context: ITestContext;
9
+ stats?: TCompilerStatsCompilation<ECompilerType.Rspack>;
10
+ files?: Record<string, string>;
11
+ compiler: TCompiler<ECompilerType.Rspack>;
12
+ compilation?: TCompilation<ECompilerType.Rspack>;
13
+ }) => Promise<void>;
5
14
  };
6
15
  export declare function createCompilerCase(name: string, src: string, dist: string, testConfig: string): void;
@@ -5,13 +5,116 @@ const processor_1 = require("../processor");
5
5
  const simple_1 = require("../test/simple");
6
6
  const type_1 = require("../type");
7
7
  function createCompilerCase(name, src, dist, testConfig) {
8
- const caseConfig = require(testConfig);
8
+ let caseConfigList = require(testConfig);
9
+ if (!Array.isArray(caseConfigList)) {
10
+ caseConfigList = [caseConfigList];
11
+ }
9
12
  const runner = (0, simple_1.getSimpleProcessorRunner)(src, dist);
10
- it(caseConfig.description, async () => {
11
- await runner(name, new processor_1.SimpleTaskProcessor({
12
- name: name,
13
- compilerType: type_1.ECompilerType.Rspack,
14
- ...caseConfig
15
- }));
16
- });
13
+ for (const caseConfig of caseConfigList) {
14
+ const testFn = caseConfig.skip ? it.skip : it;
15
+ testFn(caseConfig.description, async () => {
16
+ const logs = {
17
+ mkdir: [],
18
+ writeFile: []
19
+ };
20
+ const files = {};
21
+ await runner(name, new processor_1.SimpleTaskProcessor({
22
+ name: name,
23
+ compilerType: type_1.ECompilerType.Rspack,
24
+ compilerCallback: caseConfig.compilerCallback,
25
+ build: caseConfig.build,
26
+ options: context => {
27
+ const options = caseConfig.options?.(context) || {};
28
+ options.mode ??= "production";
29
+ options.context ??= context.getSource();
30
+ options.entry ??= "./a.js";
31
+ options.output ??= {};
32
+ options.output.path ??= "/";
33
+ options.output.pathinfo ??= true;
34
+ options.optimization ??= {};
35
+ options.optimization.minimize ??= false;
36
+ return options;
37
+ },
38
+ async compiler(context, compiler) {
39
+ compiler.outputFileSystem = {
40
+ // CHANGE: Added support for the `options` parameter to enable recursive directory creation,
41
+ // accommodating Rspack's requirement that differs from webpack's usage
42
+ mkdir(path, callback) {
43
+ const recursive = false;
44
+ // if (typeof options === "function") {
45
+ // callback = options;
46
+ // } else if (options) {
47
+ // if (options.recursive !== undefined) recursive = options.recursive;
48
+ // }
49
+ logs.mkdir.push(path);
50
+ if (recursive) {
51
+ callback();
52
+ }
53
+ else {
54
+ const err = new Error();
55
+ err.code = "EEXIST";
56
+ callback(err);
57
+ }
58
+ },
59
+ writeFile(name, content, callback) {
60
+ logs.writeFile.push(name, content);
61
+ files[name] = content.toString("utf-8");
62
+ callback();
63
+ },
64
+ stat(path, callback) {
65
+ callback(new Error("ENOENT"));
66
+ }
67
+ };
68
+ compiler.hooks.compilation.tap("CompilerTest", compilation => (compilation.bail = true));
69
+ await caseConfig.compiler?.(context, compiler);
70
+ },
71
+ async check(context, compiler, stats) {
72
+ if (caseConfig.error) {
73
+ const statsJson = stats?.toJson({
74
+ modules: true,
75
+ reasons: true
76
+ });
77
+ const compilation = stats?.compilation;
78
+ await caseConfig.check?.({
79
+ context,
80
+ compiler,
81
+ stats: statsJson,
82
+ compilation,
83
+ files
84
+ });
85
+ }
86
+ else if (stats) {
87
+ expect(typeof stats).toBe("object");
88
+ const compilation = stats.compilation;
89
+ const statsJson = stats.toJson({
90
+ modules: true,
91
+ reasons: true
92
+ });
93
+ expect(typeof statsJson).toBe("object");
94
+ expect(statsJson).toHaveProperty("errors");
95
+ expect(Array.isArray(statsJson.errors)).toBe(true);
96
+ if (statsJson.errors.length > 0) {
97
+ expect(statsJson.errors[0]).toBeInstanceOf(Object);
98
+ throw statsJson.errors[0];
99
+ }
100
+ statsJson.logs = logs;
101
+ await caseConfig.check?.({
102
+ context,
103
+ stats: statsJson,
104
+ files,
105
+ compiler,
106
+ compilation
107
+ });
108
+ }
109
+ else {
110
+ await caseConfig.check?.({
111
+ context,
112
+ files,
113
+ compiler
114
+ });
115
+ }
116
+ }
117
+ }));
118
+ });
119
+ }
17
120
  }
@@ -20,7 +20,7 @@ function getCreator(target) {
20
20
  configFiles: ["rspack.config.js", "webpack.config.js"]
21
21
  })
22
22
  ],
23
- runner: runner_1.HotStepRunnerFactory,
23
+ runner: runner_1.HotRunnerFactory,
24
24
  concurrent: true
25
25
  }));
26
26
  }
@@ -1 +1,2 @@
1
1
  export declare function createNormalCase(name: string, src: string, dist: string): void;
2
+ export declare function createHotNormalCase(name: string, src: string, dist: string): void;
@@ -4,26 +4,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createNormalCase = createNormalCase;
7
+ exports.createHotNormalCase = createHotNormalCase;
7
8
  const node_path_1 = __importDefault(require("node:path"));
9
+ const core_1 = require("@rspack/core");
8
10
  const normal_1 = require("../processor/normal");
9
11
  const runner_1 = require("../runner");
10
12
  const creator_1 = require("../test/creator");
11
13
  const type_1 = require("../type");
12
- const creator = new creator_1.BasicCaseCreator({
13
- clean: true,
14
- describe: false,
15
- steps: ({ name }) => [
16
- new normal_1.NormalProcessor({
17
- name,
18
- root: node_path_1.default.resolve(__dirname, "../../../../tests/rspack-test/normalCases"),
19
- compilerOptions: {}, // do not used in rspack
20
- runable: true,
21
- compilerType: type_1.ECompilerType.Rspack
22
- })
23
- ],
24
- runner: runner_1.NormalRunnerFactory,
25
- concurrent: true
26
- });
14
+ const NORMAL_CASES_ROOT = node_path_1.default.resolve(__dirname, "../../../../tests/rspack-test/normalCases");
15
+ const createCaseOptions = (hot) => {
16
+ return {
17
+ clean: true,
18
+ describe: false,
19
+ steps: ({ name }) => [
20
+ new normal_1.NormalProcessor({
21
+ name,
22
+ root: NORMAL_CASES_ROOT,
23
+ compilerOptions: {
24
+ plugins: hot ? [new core_1.HotModuleReplacementPlugin()] : []
25
+ },
26
+ runable: true,
27
+ compilerType: type_1.ECompilerType.Rspack
28
+ })
29
+ ],
30
+ runner: runner_1.BasicRunnerFactory,
31
+ concurrent: true
32
+ };
33
+ };
34
+ const creator = new creator_1.BasicCaseCreator(createCaseOptions(false));
27
35
  function createNormalCase(name, src, dist) {
28
36
  creator.create(name, src, dist);
29
37
  }
38
+ const hotCreator = new creator_1.BasicCaseCreator(createCaseOptions(true));
39
+ function createHotNormalCase(name, src, dist) {
40
+ hotCreator.create(name, src, dist);
41
+ }
@@ -10,6 +10,7 @@ const creator = new creator_1.BasicCaseCreator({
10
10
  steps: ({ name }) => [
11
11
  new stats_1.StatsProcessor({
12
12
  name,
13
+ snapshotName: "stats.txt",
13
14
  writeStatsOuptut: false,
14
15
  compilerType: type_1.ECompilerType.Rspack,
15
16
  configFiles: ["rspack.config.js", "webpack.config.js"]
@@ -11,6 +11,6 @@ export interface IFormatCodeOptions {
11
11
  }
12
12
  export interface IFormatCodeReplacement {
13
13
  from: string | RegExp;
14
- to: string;
14
+ to: string | ((substring: string, ...args: any[]) => string);
15
15
  }
16
16
  export declare function formatCode(name: string, raw: string, options: IFormatCodeOptions): string;
@@ -221,7 +221,12 @@ function formatCode(name, raw, options) {
221
221
  }
222
222
  if (options.replacements) {
223
223
  for (const { from, to } of options.replacements) {
224
- result = result.replaceAll(from, to);
224
+ if (typeof to === "string") {
225
+ result = result.replaceAll(from, to);
226
+ }
227
+ else {
228
+ result = result.replaceAll(from, to);
229
+ }
225
230
  }
226
231
  }
227
232
  // result of generate() is not stable with comments sometimes
@@ -6,20 +6,21 @@ export declare enum ECompilerEvent {
6
6
  Create = "create",
7
7
  Close = "close"
8
8
  }
9
- export declare const COMPILER_FACTORIES: TCompilerFactories;
9
+ export declare const COMPILER_FACTORIES: TCompilerFactories<ECompilerType>;
10
10
  export declare class TestCompilerManager<T extends ECompilerType> implements ITestCompilerManager<T> {
11
11
  protected type: T;
12
- protected factories: TCompilerFactories;
12
+ protected factories: TCompilerFactories<T>;
13
13
  protected compilerOptions: TCompilerOptions<T>;
14
14
  protected compilerInstance: TCompiler<T> | null;
15
15
  protected compilerStats: TCompilerStats<T> | null;
16
16
  protected emitter: EventEmitter;
17
- constructor(type: T, factories?: TCompilerFactories);
17
+ constructor(type: T, factories?: TCompilerFactories<T>);
18
18
  getOptions(): TCompilerOptions<T>;
19
19
  setOptions(newOptions: TCompilerOptions<T>): TCompilerOptions<T>;
20
20
  mergeOptions(newOptions: TCompilerOptions<T>): TCompilerOptions<T>;
21
21
  getCompiler(): TCompiler<T> | null;
22
22
  createCompiler(): TCompiler<T>;
23
+ createCompilerWithCallback(callback: (error: Error | null, stats: TCompilerStats<T> | null) => void): TCompiler<T>;
23
24
  build(): Promise<TCompilerStats<T>>;
24
25
  watch(timeout?: number): void;
25
26
  getStats(): TCompilerStats<T> | null;
package/dist/compiler.js CHANGED
@@ -15,8 +15,8 @@ var ECompilerEvent;
15
15
  ECompilerEvent["Close"] = "close";
16
16
  })(ECompilerEvent || (exports.ECompilerEvent = ECompilerEvent = {}));
17
17
  exports.COMPILER_FACTORIES = {
18
- [type_1.ECompilerType.Rspack]: ((options) => require("@rspack/core")(options)),
19
- [type_1.ECompilerType.Webpack]: ((options) => require("webpack")(options))
18
+ [type_1.ECompilerType.Rspack]: ((options, callback) => require("@rspack/core")(options, callback)),
19
+ [type_1.ECompilerType.Webpack]: ((options, callback) => require("webpack")(options, callback))
20
20
  };
21
21
  class TestCompilerManager {
22
22
  constructor(type, factories = exports.COMPILER_FACTORIES) {
@@ -48,6 +48,11 @@ class TestCompilerManager {
48
48
  this.emitter.emit(ECompilerEvent.Create, this.compilerInstance);
49
49
  return this.compilerInstance;
50
50
  }
51
+ createCompilerWithCallback(callback) {
52
+ this.compilerInstance = this.factories[this.type](this.compilerOptions, callback);
53
+ this.emitter.emit(ECompilerEvent.Create, this.compilerInstance);
54
+ return this.compilerInstance;
55
+ }
51
56
  build() {
52
57
  if (!this.compilerInstance)
53
58
  throw new Error("Compiler should be created before build");
@@ -54,7 +54,7 @@ function describeByWalk(testFile, createCase, options = {}) {
54
54
  describeDirectory(caseName, currentLevel - 1);
55
55
  }
56
56
  else {
57
- const name = (0, _1.escapeSep)(node_path_1.default.join(testId, caseName).split(".").shift());
57
+ const name = (0, _1.escapeSep)(node_path_1.default.join(`${testId}Cases`, caseName).split(".").shift());
58
58
  describeFn(name, () => {
59
59
  const source = node_path_1.default.join(sourceBase, caseName);
60
60
  let dist = "";
@@ -1,2 +1,2 @@
1
- declare function _exports(testDirectory: any, object: any, kind: any, filename: any, upperCaseKind: any, done: any): Promise<true | undefined>;
1
+ declare function _exports(testDirectory: any, object: any, kind: any, filename: any, upperCaseKind: any, options: any, done: any): Promise<true | undefined>;
2
2
  export = _exports;
@@ -59,16 +59,13 @@ ${tooMuch.map(item => `${explain(item)}`).join("\n\n")}`);
59
59
  }
60
60
  return diff.join("\n\n");
61
61
  };
62
- module.exports = async function checkArrayExpectation(testDirectory, object, kind, filename, upperCaseKind, done) {
63
- const usePromise = typeof done === "function";
62
+ module.exports = async function checkArrayExpectation(testDirectory, object, kind, filename, upperCaseKind, options, done) {
64
63
  done = typeof done === "function" ? done : error => {
65
64
  throw error;
66
65
  };
67
66
  let array = object[`${kind}s`];
68
- if (Array.isArray(array)) {
69
- if (kind === "warning") {
70
- array = array.filter(item => !/from Terser/.test(item));
71
- }
67
+ if (Array.isArray(array) && kind === "warning") {
68
+ array = array.filter(item => !/from Terser/.test(item));
72
69
  }
73
70
  if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) {
74
71
  // CHANGE: added file for sorting messages in multi-thread environment
@@ -77,7 +74,10 @@ module.exports = async function checkArrayExpectation(testDirectory, object, kin
77
74
  array = sorter(array);
78
75
  }
79
76
  const expectedFilename = path.join(testDirectory, `${filename}.js`);
80
- const expected = require(expectedFilename);
77
+ let expected = require(expectedFilename);
78
+ if (typeof expected === "function") {
79
+ expected = expected(options);
80
+ }
81
81
  const diff = diffItems(array, expected, kind);
82
82
  if (expected.length < array.length) {
83
83
  done(new Error(`More ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
@@ -0,0 +1 @@
1
+ export function start(handler: any): () => any[];
@@ -0,0 +1,41 @@
1
+ // @ts-nocheck
2
+ /*
3
+ MIT License http://www.opensource.org/licenses/mit-license.php
4
+ Author Tobias Koppers @sokra
5
+ */
6
+ "use strict";
7
+ const util = require("util");
8
+ let interception = undefined;
9
+ const originalDeprecate = util.deprecate;
10
+ util.deprecate = (fn, message, code) => {
11
+ const original = originalDeprecate(fn, message, code);
12
+ return function (...args) {
13
+ if (interception) {
14
+ interception.set(`${code}: ${message}`, {
15
+ code,
16
+ message,
17
+ stack: new Error(message).stack
18
+ });
19
+ return fn.apply(this, args);
20
+ }
21
+ else {
22
+ return original.apply(this, args);
23
+ }
24
+ };
25
+ };
26
+ exports.start = handler => {
27
+ interception = new Map();
28
+ return () => {
29
+ const map = interception;
30
+ interception = undefined;
31
+ return Array.from(map || [])
32
+ .sort(([a], [b]) => {
33
+ if (a < b)
34
+ return -1;
35
+ if (a > b)
36
+ return 1;
37
+ return 0;
38
+ })
39
+ .map(([key, data]) => data);
40
+ };
41
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportDefaultAssignment() {
4
+ try {
5
+ // eslint-disable-next-line no-unused-vars
6
+ var E = eval("class E { toString() { return 'default' } }");
7
+ var f1 = eval("(function f1({a, b = E}) {return new b().toString();})");
8
+ return f1({ a: "test" }) === "default";
9
+ }
10
+ catch (e) {
11
+ return false;
12
+ }
13
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsES6() {
4
+ try {
5
+ eval("class A { #field = 1 }");
6
+ return true;
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsES6() {
4
+ try {
5
+ eval("class A {}");
6
+ return true;
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportDefaultAssignment() {
4
+ try {
5
+ var f = eval("(function f() { for(var x of ['ok', 'fail']) return x; })");
6
+ return f() === "ok";
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsIteratorDestructuring() {
4
+ try {
5
+ var f = eval("(function f([, x, ...y]) { return x; })");
6
+ return f([1, 2]) === 2;
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): any;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsLogicalAssignment() {
4
+ try {
5
+ var f = eval("(function f() { var x = null; x ??= true; x &&= true; return x ||= false; })");
6
+ return f();
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsObjectDestructuring() {
4
+ try {
5
+ var f = eval("(function f({x, y}) { return x + y; })");
6
+ return f({ x: 1, y: 2 }) === 3;
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsOptionalCatchBinding() {
4
+ try {
5
+ eval("try {} catch {}");
6
+ return true;
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsRequireInModule() {
4
+ return !!require("module").createRequire;
5
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): any;
2
+ export = _exports;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsSpread() {
4
+ try {
5
+ var x = { a: true }, y; // eslint-disable-line no-unused-vars
6
+ eval("y = { ...x }");
7
+ return y !== x && y.a;
8
+ }
9
+ catch (e) {
10
+ return false;
11
+ }
12
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function supportsTemplateStrings() {
4
+ try {
5
+ var f = eval("(function f() { return String.raw`a\\b`; })");
6
+ return f() === "a\\b";
7
+ }
8
+ catch (e) {
9
+ return false;
10
+ }
11
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,26 @@
1
+ // @ts-nocheck
2
+ "use strict";
3
+ module.exports = function supportsUsing() {
4
+ try {
5
+ const f = eval(`(function f() {
6
+ let disposed = false;
7
+
8
+ {
9
+ const getResource = () => {
10
+ return {
11
+ [Symbol.dispose]: () => {
12
+ disposed = true;
13
+ }
14
+ }
15
+ }
16
+ using resource = getResource();
17
+ }
18
+
19
+ return disposed;
20
+ })`);
21
+ return f() === true;
22
+ }
23
+ catch (_err) {
24
+ return false;
25
+ }
26
+ };
@@ -97,6 +97,7 @@ class BasicProcessor {
97
97
  const warnings = [];
98
98
  const compiler = this.getCompiler(context);
99
99
  const stats = compiler.getStats();
100
+ const options = compiler.getOptions();
100
101
  if (stats) {
101
102
  if (testConfig.writeStatsOuptut) {
102
103
  node_fs_1.default.writeFileSync(node_path_1.default.join(context.getDist(), "stats.txt"), stats.toString({
@@ -125,8 +126,8 @@ class BasicProcessor {
125
126
  }
126
127
  }
127
128
  }
128
- await (0, checkArrayExpectation_1.default)(context.getSource(), { errors }, "error", "errors", "Error");
129
- await (0, checkArrayExpectation_1.default)(context.getSource(), { warnings }, "warning", "warnings", "Warning");
129
+ await (0, checkArrayExpectation_1.default)(context.getSource(), { errors }, "error", "errors", "Error", options);
130
+ await (0, checkArrayExpectation_1.default)(context.getSource(), { warnings }, "warning", "warnings", "Warning", options);
130
131
  // clear error if checked
131
132
  if (node_fs_1.default.existsSync(context.getSource("errors.js"))) {
132
133
  context.clearError(this._options.name);
@@ -93,7 +93,9 @@ class CacheProcessor extends basic_1.BasicProcessor {
93
93
  bundlerInfo: {
94
94
  force: false
95
95
  }
96
- }
96
+ },
97
+ inlineConst: true,
98
+ lazyBarrel: true
97
99
  }
98
100
  };
99
101
  if (this._cacheOptions.compilerType === type_1.ECompilerType.Rspack) {
@@ -58,7 +58,9 @@ class ConfigProcessor extends multi_1.MultiTaskProcessor {
58
58
  bundlerInfo: {
59
59
  force: false
60
60
  }
61
- }
61
+ },
62
+ inlineConst: true,
63
+ lazyBarrel: true
62
64
  }
63
65
  };
64
66
  }