@rspack-debug/test-tools 1.3.14

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 (262) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +17 -0
  3. package/dist/case/builtin.d.ts +1 -0
  4. package/dist/case/builtin.js +39 -0
  5. package/dist/case/cache.d.ts +2 -0
  6. package/dist/case/cache.js +34 -0
  7. package/dist/case/compiler.d.ts +6 -0
  8. package/dist/case/compiler.js +17 -0
  9. package/dist/case/config.d.ts +3 -0
  10. package/dist/case/config.js +39 -0
  11. package/dist/case/defaults.d.ts +6 -0
  12. package/dist/case/defaults.js +39 -0
  13. package/dist/case/diagnostic.d.ts +1 -0
  14. package/dist/case/diagnostic.js +29 -0
  15. package/dist/case/diff.d.ts +3 -0
  16. package/dist/case/diff.js +126 -0
  17. package/dist/case/error.d.ts +6 -0
  18. package/dist/case/error.js +21 -0
  19. package/dist/case/hash.d.ts +3 -0
  20. package/dist/case/hash.js +30 -0
  21. package/dist/case/hook.d.ts +6 -0
  22. package/dist/case/hook.js +35 -0
  23. package/dist/case/hot-step.d.ts +2 -0
  24. package/dist/case/hot-step.js +32 -0
  25. package/dist/case/hot.d.ts +2 -0
  26. package/dist/case/hot.js +32 -0
  27. package/dist/case/index.d.ts +19 -0
  28. package/dist/case/index.js +35 -0
  29. package/dist/case/new-incremental.d.ts +6 -0
  30. package/dist/case/new-incremental.js +100 -0
  31. package/dist/case/normal.d.ts +1 -0
  32. package/dist/case/normal.js +29 -0
  33. package/dist/case/serial.d.ts +3 -0
  34. package/dist/case/serial.js +34 -0
  35. package/dist/case/stats-api.d.ts +6 -0
  36. package/dist/case/stats-api.js +21 -0
  37. package/dist/case/stats-output.d.ts +1 -0
  38. package/dist/case/stats-output.js +22 -0
  39. package/dist/case/treeshaking.d.ts +1 -0
  40. package/dist/case/treeshaking.js +23 -0
  41. package/dist/case/watch.d.ts +1 -0
  42. package/dist/case/watch.js +53 -0
  43. package/dist/compare/comparator.d.ts +17 -0
  44. package/dist/compare/comparator.js +52 -0
  45. package/dist/compare/compare.d.ts +17 -0
  46. package/dist/compare/compare.js +175 -0
  47. package/dist/compare/format-code.d.ts +16 -0
  48. package/dist/compare/format-code.js +239 -0
  49. package/dist/compare/index.d.ts +5 -0
  50. package/dist/compare/index.js +21 -0
  51. package/dist/compare/replace-module-argument.d.ts +1 -0
  52. package/dist/compare/replace-module-argument.js +8 -0
  53. package/dist/compare/replace-runtime-module-name.d.ts +1 -0
  54. package/dist/compare/replace-runtime-module-name.js +71 -0
  55. package/dist/compiler.d.ts +28 -0
  56. package/dist/compiler.js +111 -0
  57. package/dist/helper/directory.d.ts +12 -0
  58. package/dist/helper/directory.js +81 -0
  59. package/dist/helper/expect/diff.d.ts +3 -0
  60. package/dist/helper/expect/diff.js +21 -0
  61. package/dist/helper/expect/error.d.ts +5 -0
  62. package/dist/helper/expect/error.js +51 -0
  63. package/dist/helper/expect/placeholder.d.ts +1 -0
  64. package/dist/helper/expect/placeholder.js +41 -0
  65. package/dist/helper/expect/rspack.d.ts +3 -0
  66. package/dist/helper/expect/rspack.js +14 -0
  67. package/dist/helper/expect/to-be-typeof.d.ts +4 -0
  68. package/dist/helper/expect/to-be-typeof.js +12 -0
  69. package/dist/helper/expect/to-end-with.d.ts +4 -0
  70. package/dist/helper/expect/to-end-with.js +11 -0
  71. package/dist/helper/expect/to-match-file-snapshot.d.ts +23 -0
  72. package/dist/helper/expect/to-match-file-snapshot.js +108 -0
  73. package/dist/helper/hot-update/index.d.ts +1 -0
  74. package/dist/helper/hot-update/index.js +5 -0
  75. package/dist/helper/hot-update/loader.d.ts +1 -0
  76. package/dist/helper/hot-update/loader.js +32 -0
  77. package/dist/helper/hot-update/plugin.d.ts +17 -0
  78. package/dist/helper/hot-update/plugin.js +133 -0
  79. package/dist/helper/index.d.ts +7 -0
  80. package/dist/helper/index.js +23 -0
  81. package/dist/helper/legacy/EventSourceForNode.d.ts +8 -0
  82. package/dist/helper/legacy/EventSourceForNode.js +40 -0
  83. package/dist/helper/legacy/FakeDocument.d.ts +54 -0
  84. package/dist/helper/legacy/FakeDocument.js +278 -0
  85. package/dist/helper/legacy/asModule.d.ts +3 -0
  86. package/dist/helper/legacy/asModule.js +25 -0
  87. package/dist/helper/legacy/captureStdio.d.ts +8 -0
  88. package/dist/helper/legacy/captureStdio.js +32 -0
  89. package/dist/helper/legacy/checkArrayExpectation.d.ts +2 -0
  90. package/dist/helper/legacy/checkArrayExpectation.js +111 -0
  91. package/dist/helper/legacy/copyDiff.d.ts +2 -0
  92. package/dist/helper/legacy/copyDiff.js +33 -0
  93. package/dist/helper/legacy/createFakeWorker.d.ts +13 -0
  94. package/dist/helper/legacy/createFakeWorker.js +80 -0
  95. package/dist/helper/legacy/createLazyTestEnv.d.ts +10 -0
  96. package/dist/helper/legacy/createLazyTestEnv.js +116 -0
  97. package/dist/helper/legacy/createLogger.d.ts +23 -0
  98. package/dist/helper/legacy/createLogger.js +20 -0
  99. package/dist/helper/legacy/currentScript.d.ts +6 -0
  100. package/dist/helper/legacy/currentScript.js +8 -0
  101. package/dist/helper/legacy/fakeSystem.d.ts +9 -0
  102. package/dist/helper/legacy/fakeSystem.js +124 -0
  103. package/dist/helper/legacy/parseResource.d.ts +6 -0
  104. package/dist/helper/legacy/parseResource.js +15 -0
  105. package/dist/helper/legacy/supportsImportFn.d.ts +1 -0
  106. package/dist/helper/legacy/supportsImportFn.js +15 -0
  107. package/dist/helper/legacy/supportsWorker.d.ts +2 -0
  108. package/dist/helper/legacy/supportsWorker.js +17 -0
  109. package/dist/helper/legacy/urlToRelativePath.d.ts +2 -0
  110. package/dist/helper/legacy/urlToRelativePath.js +7 -0
  111. package/dist/helper/legacy/walkCssTokens.d.ts +40 -0
  112. package/dist/helper/legacy/walkCssTokens.js +761 -0
  113. package/dist/helper/legacy/warmup-webpack.d.ts +1 -0
  114. package/dist/helper/legacy/warmup-webpack.js +26 -0
  115. package/dist/helper/loaders/hot-update.d.ts +1 -0
  116. package/dist/helper/loaders/hot-update.js +40 -0
  117. package/dist/helper/parse-modules.d.ts +7 -0
  118. package/dist/helper/parse-modules.js +73 -0
  119. package/dist/helper/plugins/hot-update.d.ts +7 -0
  120. package/dist/helper/plugins/hot-update.js +40 -0
  121. package/dist/helper/plugins/index.d.ts +1 -0
  122. package/dist/helper/plugins/index.js +17 -0
  123. package/dist/helper/read-config-file.d.ts +2 -0
  124. package/dist/helper/read-config-file.js +13 -0
  125. package/dist/helper/serializers.d.ts +2 -0
  126. package/dist/helper/serializers.js +52 -0
  127. package/dist/helper/setup-env.d.ts +1 -0
  128. package/dist/helper/setup-env.js +80 -0
  129. package/dist/helper/setup-expect.d.ts +1 -0
  130. package/dist/helper/setup-expect.js +16 -0
  131. package/dist/helper/update-snapshot.d.ts +1 -0
  132. package/dist/helper/update-snapshot.js +6 -0
  133. package/dist/helper/util/checkSourceMap.d.ts +1 -0
  134. package/dist/helper/util/checkSourceMap.js +96 -0
  135. package/dist/helper/util/checkStats.d.ts +2 -0
  136. package/dist/helper/util/checkStats.js +43 -0
  137. package/dist/helper/util/currentWatchStep.d.ts +1 -0
  138. package/dist/helper/util/currentWatchStep.js +2 -0
  139. package/dist/helper/util/expectWarningFactory.d.ts +2 -0
  140. package/dist/helper/util/expectWarningFactory.js +21 -0
  141. package/dist/helper/util/filterUtil.d.ts +8 -0
  142. package/dist/helper/util/filterUtil.js +50 -0
  143. package/dist/helper/util/identifier.d.ts +76 -0
  144. package/dist/helper/util/identifier.js +339 -0
  145. package/dist/helper/util/replaceMitteDiagnostic.d.ts +2 -0
  146. package/dist/helper/util/replaceMitteDiagnostic.js +17 -0
  147. package/dist/helper/win.d.ts +1 -0
  148. package/dist/helper/win.js +10 -0
  149. package/dist/index.d.ts +12 -0
  150. package/dist/index.js +28 -0
  151. package/dist/plugin/index.d.ts +4 -0
  152. package/dist/plugin/index.js +20 -0
  153. package/dist/plugin/lazy-compilation-test-plugin.d.ts +4 -0
  154. package/dist/plugin/lazy-compilation-test-plugin.js +67 -0
  155. package/dist/plugin/rspack-diff-config-plugin.d.ts +7 -0
  156. package/dist/plugin/rspack-diff-config-plugin.js +42 -0
  157. package/dist/plugin/webpack-diff-config-plugin.d.ts +7 -0
  158. package/dist/plugin/webpack-diff-config-plugin.js +41 -0
  159. package/dist/plugin/webpack-module-placeholder-plugin.d.ts +3 -0
  160. package/dist/plugin/webpack-module-placeholder-plugin.js +107 -0
  161. package/dist/processor/basic.d.ts +24 -0
  162. package/dist/processor/basic.js +146 -0
  163. package/dist/processor/builtin.d.ts +9 -0
  164. package/dist/processor/builtin.js +171 -0
  165. package/dist/processor/cache.d.ts +20 -0
  166. package/dist/processor/cache.js +127 -0
  167. package/dist/processor/config.d.ts +11 -0
  168. package/dist/processor/config.js +81 -0
  169. package/dist/processor/defaults.d.ts +30 -0
  170. package/dist/processor/defaults.js +72 -0
  171. package/dist/processor/diagnostic.d.ts +15 -0
  172. package/dist/processor/diagnostic.js +102 -0
  173. package/dist/processor/diff.d.ts +30 -0
  174. package/dist/processor/diff.js +140 -0
  175. package/dist/processor/error.d.ts +23 -0
  176. package/dist/processor/error.js +95 -0
  177. package/dist/processor/hash.d.ts +10 -0
  178. package/dist/processor/hash.js +63 -0
  179. package/dist/processor/hook.d.ts +44 -0
  180. package/dist/processor/hook.js +204 -0
  181. package/dist/processor/hot-new-incremental.d.ts +14 -0
  182. package/dist/processor/hot-new-incremental.js +43 -0
  183. package/dist/processor/hot-step.d.ts +18 -0
  184. package/dist/processor/hot-step.js +299 -0
  185. package/dist/processor/hot.d.ts +17 -0
  186. package/dist/processor/hot.js +138 -0
  187. package/dist/processor/index.d.ts +20 -0
  188. package/dist/processor/index.js +36 -0
  189. package/dist/processor/multi.d.ts +17 -0
  190. package/dist/processor/multi.js +73 -0
  191. package/dist/processor/normal.d.ts +12 -0
  192. package/dist/processor/normal.js +150 -0
  193. package/dist/processor/simple.d.ts +23 -0
  194. package/dist/processor/simple.js +49 -0
  195. package/dist/processor/snapshot.d.ts +12 -0
  196. package/dist/processor/snapshot.js +62 -0
  197. package/dist/processor/stats-api.d.ts +18 -0
  198. package/dist/processor/stats-api.js +48 -0
  199. package/dist/processor/stats.d.ts +18 -0
  200. package/dist/processor/stats.js +206 -0
  201. package/dist/processor/treeshaking.d.ts +10 -0
  202. package/dist/processor/treeshaking.js +33 -0
  203. package/dist/processor/watch.d.ts +29 -0
  204. package/dist/processor/watch.js +234 -0
  205. package/dist/reporter/diff-html.d.ts +15 -0
  206. package/dist/reporter/diff-html.js +69 -0
  207. package/dist/reporter/diff-stats.d.ts +24 -0
  208. package/dist/reporter/diff-stats.js +131 -0
  209. package/dist/reporter/index.d.ts +2 -0
  210. package/dist/reporter/index.js +18 -0
  211. package/dist/runner/basic.d.ts +10 -0
  212. package/dist/runner/basic.js +63 -0
  213. package/dist/runner/cache.d.ts +5 -0
  214. package/dist/runner/cache.js +90 -0
  215. package/dist/runner/hot-step.d.ts +5 -0
  216. package/dist/runner/hot-step.js +87 -0
  217. package/dist/runner/hot.d.ts +5 -0
  218. package/dist/runner/hot.js +83 -0
  219. package/dist/runner/index.d.ts +9 -0
  220. package/dist/runner/index.js +25 -0
  221. package/dist/runner/multiple.d.ts +11 -0
  222. package/dist/runner/multiple.js +38 -0
  223. package/dist/runner/normal.d.ts +5 -0
  224. package/dist/runner/normal.js +20 -0
  225. package/dist/runner/runner/basic.d.ts +30 -0
  226. package/dist/runner/runner/basic.js +107 -0
  227. package/dist/runner/runner/cjs.d.ts +14 -0
  228. package/dist/runner/runner/cjs.js +151 -0
  229. package/dist/runner/runner/esm.d.ts +7 -0
  230. package/dist/runner/runner/esm.js +125 -0
  231. package/dist/runner/runner/index.d.ts +8 -0
  232. package/dist/runner/runner/index.js +24 -0
  233. package/dist/runner/runner/normal.d.ts +9 -0
  234. package/dist/runner/runner/normal.js +23 -0
  235. package/dist/runner/runner/watch.d.ts +16 -0
  236. package/dist/runner/runner/watch.js +27 -0
  237. package/dist/runner/runner/web/fake.d.ts +18 -0
  238. package/dist/runner/runner/web/fake.js +143 -0
  239. package/dist/runner/runner/web/jsdom.d.ts +26 -0
  240. package/dist/runner/runner/web/jsdom.js +219 -0
  241. package/dist/runner/runner/web.d.ts +15 -0
  242. package/dist/runner/runner/web.js +32 -0
  243. package/dist/runner/type.d.ts +42 -0
  244. package/dist/runner/type.js +9 -0
  245. package/dist/runner/watch.d.ts +7 -0
  246. package/dist/runner/watch.js +60 -0
  247. package/dist/test/context.d.ts +26 -0
  248. package/dist/test/context.js +108 -0
  249. package/dist/test/creator.d.ts +46 -0
  250. package/dist/test/creator.js +310 -0
  251. package/dist/test/simple.d.ts +5 -0
  252. package/dist/test/simple.js +43 -0
  253. package/dist/test/tester.d.ts +17 -0
  254. package/dist/test/tester.js +88 -0
  255. package/dist/type.d.ts +168 -0
  256. package/dist/type.js +22 -0
  257. package/jest.d.ts +25 -0
  258. package/package.json +116 -0
  259. package/template/diff.bundle.css +1 -0
  260. package/template/diff.bundle.js +144 -0
  261. package/template/diff.html +14 -0
  262. package/template/editor.worker.js +1 -0
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = (globalTimeout = 2000, nameSuffix = "") => {
4
+ const state = global.JEST_STATE_SYMBOL;
5
+ let currentDescribeBlock;
6
+ let currentlyRunningTest;
7
+ let runTests = -1;
8
+ 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;
14
+ 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(() => {
33
+ fn = null;
34
+ });
35
+ return rfn;
36
+ };
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", () => {
40
+ runTests++;
41
+ });
42
+ afterAll(done => {
43
+ for (const dispose of disposables) {
44
+ dispose();
45
+ }
46
+ done();
47
+ });
48
+ currentDescribeBlock = state.currentDescribeBlock;
49
+ currentlyRunningTest = state.currentlyRunningTest;
50
+ });
51
+ let numberOfTests = 0;
52
+ const inSuite = fn => {
53
+ const { currentDescribeBlock: oldCurrentDescribeBlock, currentlyRunningTest: oldCurrentlyRunningTest, hasStarted: oldHasStarted } = state;
54
+ state.currentDescribeBlock = currentDescribeBlock;
55
+ state.currentlyRunningTest = currentlyRunningTest;
56
+ state.hasStarted = false;
57
+ try {
58
+ fn();
59
+ }
60
+ catch (e) {
61
+ // avoid leaking memory
62
+ e.stack;
63
+ throw e;
64
+ }
65
+ state.currentDescribeBlock = oldCurrentDescribeBlock;
66
+ state.currentlyRunningTest = oldCurrentlyRunningTest;
67
+ state.hasStarted = oldHasStarted;
68
+ };
69
+ const fixAsyncError = block => {
70
+ // By default jest leaks memory as it stores asyncError
71
+ // for each "it" call to track the origin test suite
72
+ // We want to evaluate this early here to avoid leaking memory
73
+ block.asyncError = {
74
+ stack: block.asyncError.stack
75
+ };
76
+ };
77
+ return {
78
+ setDefaultTimeout(time) {
79
+ globalTimeout = time;
80
+ },
81
+ getNumberOfTests() {
82
+ return numberOfTests;
83
+ },
84
+ it(...args) {
85
+ numberOfTests++;
86
+ if (runTests >= numberOfTests)
87
+ throw new Error("it called too late");
88
+ args[1] = createDisposableFn(args[1], true);
89
+ args[2] = args[2] || globalTimeout;
90
+ inSuite(() => {
91
+ it(...args);
92
+ fixAsyncError(currentDescribeBlock.tests[currentDescribeBlock.tests.length - 1]);
93
+ });
94
+ },
95
+ beforeEach(...args) {
96
+ if (runTests >= numberOfTests)
97
+ throw new Error("beforeEach called too late");
98
+ args[0] = createDisposableFn(args[0]);
99
+ inSuite(() => {
100
+ beforeEach(...args);
101
+ fixAsyncError(currentDescribeBlock.hooks[currentDescribeBlock.hooks.length - 1]);
102
+ });
103
+ },
104
+ afterEach(...args) {
105
+ if (runTests >= numberOfTests)
106
+ throw new Error("afterEach called too late");
107
+ args[0] = createDisposableFn(args[0]);
108
+ inSuite(() => {
109
+ afterEach(...args);
110
+ fixAsyncError(currentDescribeBlock.hooks[currentDescribeBlock.hooks.length - 1]);
111
+ });
112
+ },
113
+ expect,
114
+ jest
115
+ };
116
+ };
@@ -0,0 +1,23 @@
1
+ declare function _exports(appendTarget: any): {
2
+ log: (l: any) => any;
3
+ debug: (l: any) => any;
4
+ trace: (l: any) => any;
5
+ info: (l: any) => any;
6
+ warn: {
7
+ (...data: any[]): void;
8
+ (message?: any, ...optionalParams: any[]): void;
9
+ };
10
+ error: {
11
+ (...data: any[]): void;
12
+ (message?: any, ...optionalParams: any[]): void;
13
+ };
14
+ logTime: () => void;
15
+ group: () => void;
16
+ groupCollapsed: () => void;
17
+ groupEnd: () => void;
18
+ profile: () => void;
19
+ profileEnd: () => void;
20
+ clear: () => void;
21
+ status: () => void;
22
+ };
23
+ export = _exports;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = appendTarget => {
4
+ return {
5
+ log: l => appendTarget.push(l),
6
+ debug: l => appendTarget.push(l),
7
+ trace: l => appendTarget.push(l),
8
+ info: l => appendTarget.push(l),
9
+ warn: console.warn.bind(console),
10
+ error: console.error.bind(console),
11
+ logTime: () => { },
12
+ group: () => { },
13
+ groupCollapsed: () => { },
14
+ groupEnd: () => { },
15
+ profile: () => { },
16
+ profileEnd: () => { },
17
+ clear: () => { },
18
+ status: () => { }
19
+ };
20
+ };
@@ -0,0 +1,6 @@
1
+ export = CurrentScript;
2
+ declare class CurrentScript {
3
+ constructor(path?: string, type?: string);
4
+ src: string;
5
+ type: string;
6
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ class CurrentScript {
3
+ constructor(path = "", type = "text/javascript") {
4
+ this.src = `https://test.cases/path/${path}index.js`;
5
+ this.type = type;
6
+ }
7
+ }
8
+ module.exports = CurrentScript;
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ 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") {
9
+ fn = deps;
10
+ deps = name;
11
+ name = System._nextName;
12
+ }
13
+ if (!Array.isArray(deps)) {
14
+ fn = deps;
15
+ deps = [];
16
+ }
17
+ const dynamicExport = result => {
18
+ if (System.registry[name] !== entry) {
19
+ throw new Error(`Module ${name} calls dynamicExport too late`);
20
+ }
21
+ entry.exports = result;
22
+ for (const mod of Object.keys(System.registry)) {
23
+ const m = System.registry[mod];
24
+ if (!m.deps)
25
+ continue;
26
+ for (let i = 0; i < m.deps.length; i++) {
27
+ const dep = m.deps[i];
28
+ if (dep !== name)
29
+ continue;
30
+ const setters = m.mod.setters[i];
31
+ setters(result);
32
+ }
33
+ }
34
+ };
35
+ const systemContext = {
36
+ meta: {
37
+ url: `/${name}.js`
38
+ },
39
+ import() {
40
+ return Promise.resolve();
41
+ }
42
+ };
43
+ if (name in System.registry) {
44
+ throw new Error(`Module ${name} is already registered`);
45
+ }
46
+ const mod = fn(dynamicExport, systemContext);
47
+ 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
+ }
54
+ }
55
+ const entry = {
56
+ name,
57
+ deps,
58
+ fn,
59
+ mod,
60
+ executed: false,
61
+ exports: undefined
62
+ };
63
+ System.registry[name] = entry;
64
+ },
65
+ set: (name, exports) => {
66
+ System.registry[name] = {
67
+ name,
68
+ executed: true,
69
+ exports
70
+ };
71
+ },
72
+ registry: undefined,
73
+ _require: undefined,
74
+ _nextName: "(anonym)",
75
+ setRequire: req => {
76
+ System._require = req;
77
+ },
78
+ init: modules => {
79
+ 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
+ }
88
+ },
89
+ execute: name => {
90
+ 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`);
95
+ return System.ensureExecuted(name);
96
+ },
97
+ ensureExecuted: name => {
98
+ let m = System.registry[name];
99
+ if (!m && System._require) {
100
+ const oldName = System._nextName;
101
+ System._nextName = name;
102
+ System._require(name);
103
+ System._nextName = oldName;
104
+ m = System.registry[name];
105
+ }
106
+ if (!m) {
107
+ throw new Error(`Module ${name} not registered`);
108
+ }
109
+ if (!m.executed) {
110
+ m.executed = true;
111
+ for (let i = 0; i < m.deps.length; i++) {
112
+ const dep = m.deps[i];
113
+ const setters = m.mod.setters[i];
114
+ System.ensureExecuted(dep);
115
+ const { exports } = System.registry[dep];
116
+ if (exports !== undefined)
117
+ setters(exports);
118
+ }
119
+ m.mod.execute();
120
+ }
121
+ return m.exports;
122
+ }
123
+ };
124
+ module.exports = System;
@@ -0,0 +1,6 @@
1
+ export function parseResource(str: any): {
2
+ resource: any;
3
+ path: string;
4
+ query: string;
5
+ fragment: string;
6
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.parseResource = void 0;
5
+ const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
6
+ const parseResource = str => {
7
+ const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
8
+ return {
9
+ resource: str,
10
+ path: match[1].replace(/\u200b(.)/g, "$1"),
11
+ query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : "",
12
+ fragment: match[3] || ""
13
+ };
14
+ };
15
+ exports.parseResource = parseResource;
@@ -0,0 +1 @@
1
+ export declare function supportsImportFn(): boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportsImportFn = supportsImportFn;
4
+ // @ts-nocheck
5
+ const nodeVersion = process.versions.node.split(".").map(Number);
6
+ function supportsImportFn() {
7
+ // Segmentation fault in vm with --experimental-vm-modules,
8
+ // which has not been resolved in node 16 yet.
9
+ // https://github.com/nodejs/node/issues/35889
10
+ if (nodeVersion[0] > 16) {
11
+ return true;
12
+ }
13
+ return false;
14
+ }
15
+ ;
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ const nodeVersion = process.versions.node.split(".").map(Number);
4
+ module.exports = function supportsWorker() {
5
+ // Verify that in the current node version new Worker() accepts URL as the first parameter:
6
+ // https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options
7
+ if (nodeVersion[0] >= 14) {
8
+ return true;
9
+ }
10
+ if (nodeVersion[0] === 13 && nodeVersion[1] >= 12) {
11
+ return true;
12
+ }
13
+ if (nodeVersion[0] === 12 && nodeVersion[1] >= 17) {
14
+ return true;
15
+ }
16
+ return false;
17
+ };
@@ -0,0 +1,2 @@
1
+ declare function _exports(url: any): string;
2
+ export = _exports;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = function urlToRelativePath(url) {
4
+ if (url.startsWith("https://test.cases/path/"))
5
+ url = url.slice(24);
6
+ return `./${url}`;
7
+ };
@@ -0,0 +1,40 @@
1
+ declare namespace _exports {
2
+ export { CssTokenCallbacks, CharHandler };
3
+ }
4
+ declare function _exports(input: string, callbacks: CssTokenCallbacks): void;
5
+ declare namespace _exports {
6
+ export { isIdentStartCodePoint };
7
+ export function eatComments(input: string, pos: number): number;
8
+ export function eatWhitespace(input: string, pos: number): number;
9
+ export function eatWhitespaceAndComments(input: string, pos: number): number;
10
+ export function eatWhiteLine(input: string, pos: number): number;
11
+ }
12
+ export = _exports;
13
+ type CssTokenCallbacks = {
14
+ isSelector?: ((arg0: string, arg1: number) => boolean) | undefined;
15
+ url?: ((arg0: string, arg1: number, arg2: number, arg3: number, arg4: number) => number) | undefined;
16
+ string?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
17
+ leftParenthesis?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
18
+ rightParenthesis?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
19
+ pseudoFunction?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
20
+ function?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
21
+ pseudoClass?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
22
+ atKeyword?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
23
+ class?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
24
+ identifier?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
25
+ id?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
26
+ leftCurlyBracket?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
27
+ rightCurlyBracket?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
28
+ semicolon?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
29
+ comma?: ((arg0: string, arg1: number, arg2: number) => number) | undefined;
30
+ };
31
+ type CharHandler = (arg0: string, arg1: number, arg2: CssTokenCallbacks) => number;
32
+ /**
33
+ * ident-start code point
34
+ *
35
+ * A letter, a non-ASCII code point, or U+005F LOW LINE (_).
36
+ *
37
+ * @param {number} cc char code
38
+ * @returns {boolean} true, if cc is a start code point of an identifier
39
+ */
40
+ declare function isIdentStartCodePoint(cc: number): boolean;