@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,63 +1,74 @@
1
1
  "use strict";
2
- // @ts-nocheck
3
- module.exports = (globalTimeout = 2000, nameSuffix = '') => {
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
+ createLazyTestEnv: ()=>createLazyTestEnv
28
+ });
29
+ function createLazyTestEnv(globalTimeout = 2000, nameSuffix = '') {
4
30
  const state = global.JEST_STATE_SYMBOL;
5
31
  let currentDescribeBlock;
6
32
  let currentlyRunningTest;
7
33
  let runTests = -1;
8
34
  const disposables = [];
9
- // this function allows to release memory in fn context
10
- // manually, usually after the suite has been run.
11
- const createDisposableFn = (fn, isTest) => {
12
- if (!fn)
13
- return null;
35
+ const createDisposableFn = (fn, isTest)=>{
36
+ if (!fn) return null;
14
37
  let rfn;
15
- if (fn.length >= 1) {
16
- rfn = (done) => {
17
- fn((...args) => {
18
- if (isTest)
19
- runTests++;
20
- done(...args);
21
- });
22
- };
23
- }
24
- else {
25
- rfn = () => {
26
- const r = fn();
27
- if (isTest)
28
- runTests++;
29
- return r;
30
- };
31
- }
32
- disposables.push(() => {
38
+ rfn = fn.length >= 1 ? (done)=>{
39
+ fn((...args)=>{
40
+ if (isTest) runTests++;
41
+ done(...args);
42
+ });
43
+ } : ()=>{
44
+ const r = fn();
45
+ if (isTest) runTests++;
46
+ return r;
47
+ };
48
+ disposables.push(()=>{
33
49
  fn = null;
34
50
  });
35
51
  return rfn;
36
52
  };
37
- describe(nameSuffix ? `exported tests ${nameSuffix}` : 'exported tests', () => {
38
- // this must have a child to be handled correctly
39
- it('should run the exported tests', () => {
53
+ describe(nameSuffix ? `exported tests ${nameSuffix}` : 'exported tests', ()=>{
54
+ it('should run the exported tests', ()=>{
40
55
  runTests++;
41
56
  });
42
- afterAll(() => {
43
- for (const dispose of disposables) {
44
- dispose();
45
- }
57
+ afterAll(()=>{
58
+ for (const dispose of disposables)dispose();
46
59
  });
47
60
  currentDescribeBlock = state.currentDescribeBlock;
48
61
  currentlyRunningTest = state.currentlyRunningTest;
49
62
  });
50
63
  let numberOfTests = 0;
51
- const inSuite = (fn) => {
52
- const { currentDescribeBlock: oldCurrentDescribeBlock, currentlyRunningTest: oldCurrentlyRunningTest, hasStarted: oldHasStarted, } = state;
64
+ const inSuite = (fn)=>{
65
+ const { currentDescribeBlock: oldCurrentDescribeBlock, currentlyRunningTest: oldCurrentlyRunningTest, hasStarted: oldHasStarted } = state;
53
66
  state.currentDescribeBlock = currentDescribeBlock;
54
67
  state.currentlyRunningTest = currentlyRunningTest;
55
68
  state.hasStarted = false;
56
69
  try {
57
70
  fn();
58
- }
59
- catch (e) {
60
- // avoid leaking memory
71
+ } catch (e) {
61
72
  e.stack;
62
73
  throw e;
63
74
  }
@@ -65,52 +76,52 @@ module.exports = (globalTimeout = 2000, nameSuffix = '') => {
65
76
  state.currentlyRunningTest = oldCurrentlyRunningTest;
66
77
  state.hasStarted = oldHasStarted;
67
78
  };
68
- const fixAsyncError = (block) => {
69
- // By default jest leaks memory as it stores asyncError
70
- // for each "it" call to track the origin test suite
71
- // We want to evaluate this early here to avoid leaking memory
79
+ const fixAsyncError = (block)=>{
72
80
  block.asyncError = {
73
- stack: block.asyncError.stack,
81
+ stack: block.asyncError.stack
74
82
  };
75
83
  };
76
84
  return {
77
- setDefaultTimeout(time) {
85
+ setDefaultTimeout (time) {
78
86
  globalTimeout = time;
79
87
  },
80
- getNumberOfTests() {
88
+ getNumberOfTests () {
81
89
  return numberOfTests;
82
90
  },
83
- it(...args) {
91
+ it (...args) {
84
92
  numberOfTests++;
85
- if (runTests >= numberOfTests)
86
- throw new Error('it called too late');
93
+ if (runTests >= numberOfTests) throw new Error('it called too late');
87
94
  args[1] = createDisposableFn(args[1], true);
88
95
  args[2] = args[2] || globalTimeout;
89
- inSuite(() => {
96
+ inSuite(()=>{
90
97
  it(...args);
91
98
  fixAsyncError(currentDescribeBlock.tests[currentDescribeBlock.tests.length - 1]);
92
99
  });
93
100
  },
94
- beforeEach(...args) {
95
- if (runTests >= numberOfTests)
96
- throw new Error('beforeEach called too late');
101
+ beforeEach (...args) {
102
+ if (runTests >= numberOfTests) throw new Error('beforeEach called too late');
97
103
  args[0] = createDisposableFn(args[0]);
98
- inSuite(() => {
104
+ inSuite(()=>{
99
105
  beforeEach(...args);
100
106
  fixAsyncError(currentDescribeBlock.hooks[currentDescribeBlock.hooks.length - 1]);
101
107
  });
102
108
  },
103
- afterEach(...args) {
104
- if (runTests >= numberOfTests)
105
- throw new Error('afterEach called too late');
109
+ afterEach (...args) {
110
+ if (runTests >= numberOfTests) throw new Error('afterEach called too late');
106
111
  args[0] = createDisposableFn(args[0]);
107
- inSuite(() => {
112
+ inSuite(()=>{
108
113
  afterEach(...args);
109
114
  fixAsyncError(currentDescribeBlock.hooks[currentDescribeBlock.hooks.length - 1]);
110
115
  });
111
116
  },
112
- /** @type {import('@rstest/core').Expect} */
113
117
  expect,
114
- rstest,
118
+ rstest
115
119
  };
116
- };
120
+ }
121
+ exports.createLazyTestEnv = __webpack_exports__.createLazyTestEnv;
122
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
123
+ "createLazyTestEnv"
124
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
125
+ Object.defineProperty(exports, '__esModule', {
126
+ value: true
127
+ });
@@ -1,6 +1,6 @@
1
- export = CurrentScript;
2
1
  declare class CurrentScript {
3
- constructor(path?: string, type?: string);
4
2
  src: string;
5
3
  type: string;
4
+ constructor(path?: string, type?: string);
6
5
  }
6
+ export { CurrentScript };
@@ -1,8 +1,41 @@
1
1
  "use strict";
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
+ CurrentScript: ()=>CurrentScript
28
+ });
2
29
  class CurrentScript {
3
- constructor(path = '', type = 'text/javascript') {
30
+ constructor(path = '', type = "text/javascript"){
4
31
  this.src = `https://test.cases/path/${path}index.js`;
5
32
  this.type = type;
6
33
  }
7
34
  }
8
- module.exports = CurrentScript;
35
+ exports.CurrentScript = __webpack_exports__.CurrentScript;
36
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
37
+ "CurrentScript"
38
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
39
+ Object.defineProperty(exports, '__esModule', {
40
+ value: true
41
+ });
@@ -1 +1 @@
1
- export function start(handler: any): () => any[];
1
+ export declare const start: (handler: any) => () => any[];
@@ -1,35 +1,60 @@
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
- let interception = undefined;
8
- const originalWarn = console.warn;
9
- console.warn = (message, ...args) => {
10
- if (interception &&
11
- typeof message === 'string' &&
12
- message.includes('[Rspack Deprecation]')) {
13
- interception.set(message, {
14
- message,
15
- stack: new Error(message).stack,
1
+ "use strict";
2
+ "use strict";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
16
19
  });
17
- }
18
- return originalWarn.apply(console, [message, ...args]);
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ start: ()=>start
29
+ });
30
+ let interception;
31
+ const originalWarn = console.warn;
32
+ console.warn = (message, ...args)=>{
33
+ if (interception && 'string' == typeof message && message.includes('[Rspack Deprecation]')) interception.set(message, {
34
+ message,
35
+ stack: new Error(message).stack
36
+ });
37
+ return originalWarn.apply(console, [
38
+ message,
39
+ ...args
40
+ ]);
19
41
  };
20
- exports.start = (handler) => {
42
+ const start = (handler)=>{
21
43
  interception = new Map();
22
- return () => {
44
+ return ()=>{
23
45
  const map = interception;
24
- interception = undefined;
25
- return Array.from(map || [])
26
- .sort(([a], [b]) => {
27
- if (a < b)
28
- return -1;
29
- if (a > b)
30
- return 1;
46
+ interception = void 0;
47
+ return Array.from(map || []).sort(([a], [b])=>{
48
+ if (a < b) return -1;
49
+ if (a > b) return 1;
31
50
  return 0;
32
- })
33
- .map(([key, data]) => data);
51
+ }).map(([key, data])=>data);
34
52
  };
35
53
  };
54
+ exports.start = __webpack_exports__.start;
55
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
56
+ "start"
57
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
58
+ Object.defineProperty(exports, '__esModule', {
59
+ value: true
60
+ });
@@ -2,9 +2,10 @@
2
2
  * @param {string} source value
3
3
  * @param {string} str string for searching
4
4
  */
5
- export function expectSourceToContain(source: string, str: string): void;
5
+ declare function expectSourceToContain(source: string, str: string): void;
6
6
  /**
7
7
  * @param {string} source value
8
8
  * @param {RegExp} regexStr regexp
9
9
  */
10
- export function expectSourceToMatch(source: string, regexStr: RegExp): void;
10
+ declare function expectSourceToMatch(source: string, regexStr: RegExp): void;
11
+ export { expectSourceToContain, expectSourceToMatch };
@@ -1,23 +1,47 @@
1
- // @ts-nocheck
2
- 'use strict';
3
- const regexEscape = require('./regexEscape');
4
- // These expect* methods are necessary because 'source' contains the code for this test file, which will always contain the string
5
- // being tested for, so we have to use the "DO NOT MATCH BELOW..." technique to exclude the actual testing code from the test.
6
- // Place your jest 'expect' calls below a line containing the DO NOT MATCH BELOW... string constructed below. See other tests for examples.
7
- // Break up the match string so we don't match it in these expect* functions either.
8
- const doNotMatch = ['DO', 'NOT', 'MATCH', 'BELOW', 'THIS', 'LINE'].join(' ');
9
- /**
10
- * @param {string} source value
11
- * @param {string} str string for searching
12
- */
1
+ "use strict";
2
+ "use strict";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
19
+ });
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ expectSourceToContain: ()=>expectSourceToContain,
29
+ expectSourceToMatch: ()=>expectSourceToMatch
30
+ });
31
+ const external_regexEscape_js_namespaceObject = require("./regexEscape.js");
32
+ const doNotMatch = "DO NOT MATCH BELOW THIS LINE";
13
33
  function expectSourceToContain(source, str) {
14
- expect(source).toMatch(new RegExp(`${regexEscape(str)}.*${doNotMatch}`, 's'));
34
+ expect(source).toMatch(new RegExp(`${(0, external_regexEscape_js_namespaceObject.regexEscape)(str)}.*${doNotMatch}`, 's'));
15
35
  }
16
- /**
17
- * @param {string} source value
18
- * @param {RegExp} regexStr regexp
19
- */
20
36
  function expectSourceToMatch(source, regexStr) {
21
37
  expect(source).toMatch(new RegExp(`${regexStr}.*${doNotMatch}`, 's'));
22
38
  }
23
- module.exports = { expectSourceToContain, expectSourceToMatch };
39
+ exports.expectSourceToContain = __webpack_exports__.expectSourceToContain;
40
+ exports.expectSourceToMatch = __webpack_exports__.expectSourceToMatch;
41
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
42
+ "expectSourceToContain",
43
+ "expectSourceToMatch"
44
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
45
+ Object.defineProperty(exports, '__esModule', {
46
+ value: true
47
+ });
@@ -1,9 +1,12 @@
1
- export function register(name: any, deps: any, fn: any): void;
2
- export function set(name: any, exports: any): void;
3
- export let registry: undefined;
4
- export let _require: undefined;
5
- export let _nextName: string;
6
- export function setRequire(req: any): void;
7
- export function init(modules: any): void;
8
- export function execute(name: any): any;
9
- export function ensureExecuted(name: any): any;
1
+ declare const System: {
2
+ register: (name: any, deps: any, fn: any) => void;
3
+ set: (name: any, exports: any) => void;
4
+ registry: undefined;
5
+ _require: undefined;
6
+ _nextName: string;
7
+ setRequire: (req: any) => void;
8
+ init: (modules: any) => void;
9
+ execute: (name: any) => any;
10
+ ensureExecuted: (name: any) => any;
11
+ };
12
+ export { System };
@@ -1,11 +1,35 @@
1
1
  "use strict";
2
- // @ts-nocheck
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
+ System: ()=>System
28
+ });
3
29
  const System = {
4
- register: (name, deps, fn) => {
5
- if (!System.registry) {
6
- throw new Error('System is no initialized');
7
- }
8
- if (typeof name !== 'string') {
30
+ register: (name, deps, fn)=>{
31
+ if (!System.registry) throw new Error('System is no initialized');
32
+ if ('string' != typeof name) {
9
33
  fn = deps;
10
34
  deps = name;
11
35
  name = System._nextName;
@@ -14,19 +38,14 @@ const System = {
14
38
  fn = deps;
15
39
  deps = [];
16
40
  }
17
- const dynamicExport = (result) => {
18
- if (System.registry[name] !== entry) {
19
- throw new Error(`Module ${name} calls dynamicExport too late`);
20
- }
41
+ const dynamicExport = (result)=>{
42
+ if (System.registry[name] !== entry) throw new Error(`Module ${name} calls dynamicExport too late`);
21
43
  entry.exports = result;
22
- for (const mod of Object.keys(System.registry)) {
44
+ for (const mod of Object.keys(System.registry)){
23
45
  const m = System.registry[mod];
24
- if (!m.deps)
25
- continue;
26
- for (let i = 0; i < m.deps.length; i++) {
46
+ if (m.deps) for(let i = 0; i < m.deps.length; i++){
27
47
  const dep = m.deps[i];
28
- if (dep !== name)
29
- continue;
48
+ if (dep !== name) continue;
30
49
  const setters = m.mod.setters[i];
31
50
  setters(result);
32
51
  }
@@ -34,23 +53,17 @@ const System = {
34
53
  };
35
54
  const systemContext = {
36
55
  meta: {
37
- url: `/${name}.js`,
56
+ url: `/${name}.js`
38
57
  },
39
- import() {
58
+ import () {
40
59
  return Promise.resolve();
41
- },
60
+ }
42
61
  };
43
- if (name in System.registry) {
44
- throw new Error(`Module ${name} is already registered`);
45
- }
62
+ if (name in System.registry) throw new Error(`Module ${name} is already registered`);
46
63
  const mod = fn(dynamicExport, systemContext);
47
64
  if (deps.length > 0) {
48
- if (!Array.isArray(mod.setters)) {
49
- throw new Error(`Module ${name} must have setters, because it has dependencies`);
50
- }
51
- if (mod.setters.length !== deps.length) {
52
- throw new Error(`Module ${name} has incorrect number of setters for the dependencies`);
53
- }
65
+ if (!Array.isArray(mod.setters)) throw new Error(`Module ${name} must have setters, because it has dependencies`);
66
+ if (mod.setters.length !== deps.length) throw new Error(`Module ${name} has incorrect number of setters for the dependencies`);
54
67
  }
55
68
  const entry = {
56
69
  name,
@@ -58,43 +71,37 @@ const System = {
58
71
  fn,
59
72
  mod,
60
73
  executed: false,
61
- exports: undefined,
74
+ exports: void 0
62
75
  };
63
76
  System.registry[name] = entry;
64
77
  },
65
- set: (name, exports) => {
78
+ set: (name, exports1)=>{
66
79
  System.registry[name] = {
67
80
  name,
68
81
  executed: true,
69
- exports,
82
+ exports: exports1
70
83
  };
71
84
  },
72
- registry: undefined,
73
- _require: undefined,
85
+ registry: void 0,
86
+ _require: void 0,
74
87
  _nextName: '(anonym)',
75
- setRequire: (req) => {
88
+ setRequire: (req)=>{
76
89
  System._require = req;
77
90
  },
78
- init: (modules) => {
91
+ init: (modules)=>{
79
92
  System.registry = {};
80
- if (modules) {
81
- for (const name of Object.keys(modules)) {
82
- System.registry[name] = {
83
- executed: true,
84
- exports: modules[name],
85
- };
86
- }
87
- }
93
+ if (modules) for (const name of Object.keys(modules))System.registry[name] = {
94
+ executed: true,
95
+ exports: modules[name]
96
+ };
88
97
  },
89
- execute: (name) => {
98
+ execute: (name)=>{
90
99
  const m = System.registry[name];
91
- if (!m)
92
- throw new Error(`Module ${name} not registered`);
93
- if (m.executed)
94
- throw new Error(`Module ${name} was already executed`);
100
+ if (!m) throw new Error(`Module ${name} not registered`);
101
+ if (m.executed) throw new Error(`Module ${name} was already executed`);
95
102
  return System.ensureExecuted(name);
96
103
  },
97
- ensureExecuted: (name) => {
104
+ ensureExecuted: (name)=>{
98
105
  let m = System.registry[name];
99
106
  if (!m && System._require) {
100
107
  const oldName = System._nextName;
@@ -103,22 +110,25 @@ const System = {
103
110
  System._nextName = oldName;
104
111
  m = System.registry[name];
105
112
  }
106
- if (!m) {
107
- throw new Error(`Module ${name} not registered`);
108
- }
113
+ if (!m) throw new Error(`Module ${name} not registered`);
109
114
  if (!m.executed) {
110
115
  m.executed = true;
111
- for (let i = 0; i < m.deps.length; i++) {
116
+ for(let i = 0; i < m.deps.length; i++){
112
117
  const dep = m.deps[i];
113
118
  const setters = m.mod.setters[i];
114
119
  System.ensureExecuted(dep);
115
- const { exports } = System.registry[dep];
116
- if (exports !== undefined)
117
- setters(exports);
120
+ const { exports: exports1 } = System.registry[dep];
121
+ if (void 0 !== exports1) setters(exports1);
118
122
  }
119
123
  m.mod.execute();
120
124
  }
121
125
  return m.exports;
122
- },
126
+ }
123
127
  };
124
- module.exports = System;
128
+ exports.System = __webpack_exports__.System;
129
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
130
+ "System"
131
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
132
+ Object.defineProperty(exports, '__esModule', {
133
+ value: true
134
+ });
@@ -1,6 +1,11 @@
1
- declare function _exports(options: {
1
+ /**
2
+ * @param {{output: {path: string}}} options options
3
+ * @param {RegExp} regexp regexp
4
+ * @param {string=} subpath path in output directory
5
+ * @returns {string[]} files
6
+ */
7
+ export declare function findOutputFiles(options: {
2
8
  output: {
3
9
  path: string;
4
10
  };
5
11
  }, regexp: RegExp, subpath?: string | undefined): string[];
6
- export = _exports;