@rspack-debug/test-tools 1.4.11 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/case/builtin.d.ts +3 -0
- package/dist/case/builtin.js +152 -14
- package/dist/case/cache.d.ts +2 -2
- package/dist/case/cache.js +214 -12
- package/dist/case/common.d.ts +11 -0
- package/dist/case/common.js +249 -0
- package/dist/case/compiler.d.ts +17 -4
- package/dist/case/compiler.js +149 -12
- package/dist/case/config.d.ts +7 -2
- package/dist/case/config.js +106 -18
- package/dist/case/defaults.d.ts +13 -4
- package/dist/case/defaults.js +73 -18
- package/dist/case/diagnostic.d.ts +6 -0
- package/dist/case/diagnostic.js +121 -14
- package/dist/case/error.d.ts +15 -4
- package/dist/case/error.js +137 -12
- package/dist/case/esm-output.d.ts +1 -0
- package/dist/case/esm-output.js +117 -0
- package/dist/case/example.d.ts +1 -0
- package/dist/case/example.js +57 -0
- package/dist/case/hash.d.ts +2 -2
- package/dist/case/hash.js +72 -9
- package/dist/case/hook.d.ts +36 -4
- package/dist/case/hook.js +209 -20
- package/dist/case/hot-step.d.ts +2 -2
- package/dist/case/hot-step.js +309 -13
- package/dist/case/hot.d.ts +11 -2
- package/dist/case/hot.js +217 -12
- package/dist/case/incremental.d.ts +2 -2
- package/dist/case/incremental.js +24 -45
- package/dist/case/index.d.ts +31 -20
- package/dist/case/index.js +50 -34
- package/dist/case/multi-compiler.d.ts +19 -0
- package/dist/case/multi-compiler.js +97 -0
- package/dist/case/{nativeWatcher.js → native-watcher.js} +11 -23
- package/dist/case/normal.d.ts +3 -0
- package/dist/case/normal.js +202 -18
- package/dist/case/runner.d.ts +19 -0
- package/dist/case/runner.js +113 -0
- package/dist/case/serial.d.ts +2 -2
- package/dist/case/serial.js +10 -14
- package/dist/case/stats-api.d.ts +8 -3
- package/dist/case/stats-api.js +69 -10
- package/dist/case/stats-output.d.ts +11 -0
- package/dist/case/stats-output.js +199 -8
- package/dist/case/treeshaking.js +34 -7
- package/dist/case/watch.d.ts +27 -0
- package/dist/case/watch.js +318 -22
- package/dist/compiler.d.ts +16 -16
- package/dist/compiler.js +120 -15
- package/dist/helper/directory.d.ts +1 -1
- package/dist/helper/directory.js +6 -2
- package/dist/helper/disable-iconv-lite-warning.d.ts +1 -0
- package/dist/helper/disable-iconv-lite-warning.js +12 -0
- package/dist/helper/expect/error.js +1 -1
- package/dist/helper/expect/placeholder.js +7 -7
- package/dist/helper/expect/to-match-file-snapshot.d.ts +1 -2
- package/dist/helper/expect/to-match-file-snapshot.js +3 -3
- package/dist/helper/hot-update/loader.d.ts +2 -1
- package/dist/helper/hot-update/loader.js +5 -30
- package/dist/helper/hot-update/plugin.d.ts +1 -1
- package/dist/helper/hot-update/plugin.js +14 -13
- package/dist/helper/index.d.ts +2 -1
- package/dist/helper/index.js +2 -1
- package/dist/helper/is.d.ts +2 -0
- package/dist/helper/is.js +15 -0
- package/dist/helper/legacy/LogTestPlugin.d.ts +6 -0
- package/dist/helper/legacy/LogTestPlugin.js +35 -0
- package/dist/helper/legacy/asModule.js +0 -2
- package/dist/helper/legacy/checkArrayExpectation.d.ts +1 -1
- package/dist/helper/legacy/checkArrayExpectation.js +8 -8
- package/dist/helper/legacy/createFakeWorker.d.ts +2 -2
- package/dist/helper/legacy/createFakeWorker.js +44 -20
- package/dist/helper/legacy/createLazyTestEnv.d.ts +3 -2
- package/dist/helper/legacy/createLazyTestEnv.js +3 -3
- package/dist/helper/legacy/deprecationTracking.d.ts +1 -0
- package/dist/helper/legacy/deprecationTracking.js +41 -0
- package/dist/helper/legacy/expectSource.d.ts +10 -0
- package/dist/helper/legacy/expectSource.js +23 -0
- package/dist/helper/legacy/findOutputFiles.d.ts +6 -0
- package/dist/helper/legacy/findOutputFiles.js +14 -0
- package/dist/helper/legacy/regexEscape.d.ts +2 -0
- package/dist/helper/legacy/regexEscape.js +5 -0
- package/dist/helper/legacy/supportDefaultAssignment.js +13 -0
- package/dist/helper/legacy/supportsTextDecoder.d.ts +2 -0
- package/dist/helper/legacy/supportsTextDecoder.js +9 -0
- package/dist/helper/legacy/supportsUsing.d.ts +2 -0
- package/dist/helper/legacy/supportsUsing.js +26 -0
- package/dist/helper/legacy/urlToRelativePath.js +5 -2
- package/dist/helper/read-config-file.d.ts +3 -2
- package/dist/helper/read-config-file.js +12 -2
- package/dist/helper/setup-env.js +26 -4
- package/dist/helper/setup-expect.js +2 -2
- package/dist/helper/setup-wasm.js +2 -2
- package/dist/helper/stringify-config.d.ts +2 -0
- package/dist/helper/stringify-config.js +43 -0
- package/dist/helper/util/checkStats.d.ts +0 -1
- package/dist/helper/util/checkStats.js +0 -18
- package/dist/helper/util/expectWarningFactory.js +2 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +1 -4
- package/dist/plugin/index.d.ts +0 -3
- package/dist/plugin/index.js +0 -3
- package/dist/plugin/lazy-compilation-test-plugin.js +4 -4
- package/dist/runner/index.d.ts +2 -9
- package/dist/runner/index.js +2 -9
- package/dist/runner/node/index.d.ts +41 -0
- package/dist/runner/node/index.js +450 -0
- package/dist/runner/web/index.d.ts +30 -0
- package/dist/runner/web/index.js +343 -0
- package/dist/test/context.d.ts +15 -18
- package/dist/test/context.js +52 -57
- package/dist/test/creator.d.ts +20 -19
- package/dist/test/creator.js +69 -57
- package/dist/test/debug.d.ts +15 -0
- package/dist/test/debug.js +205 -0
- package/dist/test/tester.d.ts +1 -0
- package/dist/test/tester.js +44 -6
- package/dist/type.d.ts +94 -64
- package/dist/type.js +8 -12
- package/package.json +22 -61
- package/rstest.d.ts +24 -0
- package/dist/case/diff.d.ts +0 -3
- package/dist/case/diff.js +0 -126
- package/dist/compare/comparator.d.ts +0 -17
- package/dist/compare/comparator.js +0 -52
- package/dist/compare/compare.d.ts +0 -17
- package/dist/compare/compare.js +0 -175
- package/dist/compare/format-code.d.ts +0 -16
- package/dist/compare/format-code.js +0 -239
- package/dist/compare/index.d.ts +0 -5
- package/dist/compare/index.js +0 -21
- package/dist/compare/replace-module-argument.d.ts +0 -1
- package/dist/compare/replace-module-argument.js +0 -8
- package/dist/compare/replace-runtime-module-name.d.ts +0 -1
- package/dist/compare/replace-runtime-module-name.js +0 -71
- package/dist/helper/legacy/FakeDocument.d.ts +0 -54
- package/dist/helper/legacy/FakeDocument.js +0 -278
- package/dist/helper/legacy/createLogger.d.ts +0 -23
- package/dist/helper/legacy/createLogger.js +0 -20
- package/dist/helper/legacy/supportsImportFn.d.ts +0 -1
- package/dist/helper/legacy/supportsImportFn.js +0 -15
- package/dist/helper/legacy/supportsWorker.js +0 -17
- package/dist/helper/legacy/walkCssTokens.d.ts +0 -40
- package/dist/helper/legacy/walkCssTokens.js +0 -761
- package/dist/helper/legacy/warmup-webpack.d.ts +0 -1
- package/dist/helper/legacy/warmup-webpack.js +0 -26
- package/dist/helper/loaders/hot-update.d.ts +0 -1
- package/dist/helper/loaders/hot-update.js +0 -40
- package/dist/helper/plugins/hot-update.d.ts +0 -7
- package/dist/helper/plugins/hot-update.js +0 -40
- package/dist/helper/plugins/index.d.ts +0 -1
- package/dist/helper/plugins/index.js +0 -17
- package/dist/helper/util/currentWatchStep.d.ts +0 -1
- package/dist/helper/util/currentWatchStep.js +0 -2
- package/dist/helper/util/identifier.d.ts +0 -76
- package/dist/helper/util/identifier.js +0 -339
- package/dist/helper/util/replaceMitteDiagnostic.d.ts +0 -2
- package/dist/helper/util/replaceMitteDiagnostic.js +0 -17
- package/dist/plugin/rspack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/rspack-diff-config-plugin.js +0 -42
- package/dist/plugin/webpack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/webpack-diff-config-plugin.js +0 -41
- package/dist/plugin/webpack-module-placeholder-plugin.d.ts +0 -3
- package/dist/plugin/webpack-module-placeholder-plugin.js +0 -106
- package/dist/processor/basic.d.ts +0 -24
- package/dist/processor/basic.js +0 -146
- package/dist/processor/builtin.d.ts +0 -9
- package/dist/processor/builtin.js +0 -171
- package/dist/processor/cache.d.ts +0 -20
- package/dist/processor/cache.js +0 -128
- package/dist/processor/config.d.ts +0 -11
- package/dist/processor/config.js +0 -81
- package/dist/processor/defaults.d.ts +0 -30
- package/dist/processor/defaults.js +0 -72
- package/dist/processor/diagnostic.d.ts +0 -15
- package/dist/processor/diagnostic.js +0 -102
- package/dist/processor/diff.d.ts +0 -30
- package/dist/processor/diff.js +0 -140
- package/dist/processor/error.d.ts +0 -23
- package/dist/processor/error.js +0 -95
- package/dist/processor/hash.d.ts +0 -10
- package/dist/processor/hash.js +0 -63
- package/dist/processor/hook.d.ts +0 -44
- package/dist/processor/hook.js +0 -204
- package/dist/processor/hot-incremental.d.ts +0 -14
- package/dist/processor/hot-incremental.js +0 -43
- package/dist/processor/hot-step.d.ts +0 -18
- package/dist/processor/hot-step.js +0 -304
- package/dist/processor/hot.d.ts +0 -17
- package/dist/processor/hot.js +0 -140
- package/dist/processor/index.d.ts +0 -20
- package/dist/processor/index.js +0 -36
- package/dist/processor/multi.d.ts +0 -17
- package/dist/processor/multi.js +0 -73
- package/dist/processor/normal.d.ts +0 -12
- package/dist/processor/normal.js +0 -150
- package/dist/processor/simple.d.ts +0 -23
- package/dist/processor/simple.js +0 -49
- package/dist/processor/snapshot.d.ts +0 -12
- package/dist/processor/snapshot.js +0 -66
- package/dist/processor/stats-api.d.ts +0 -18
- package/dist/processor/stats-api.js +0 -48
- package/dist/processor/stats.d.ts +0 -18
- package/dist/processor/stats.js +0 -206
- package/dist/processor/treeshaking.d.ts +0 -10
- package/dist/processor/treeshaking.js +0 -33
- package/dist/processor/watch.d.ts +0 -30
- package/dist/processor/watch.js +0 -241
- package/dist/reporter/diff-html.d.ts +0 -15
- package/dist/reporter/diff-html.js +0 -69
- package/dist/reporter/diff-stats.d.ts +0 -24
- package/dist/reporter/diff-stats.js +0 -131
- package/dist/reporter/index.d.ts +0 -2
- package/dist/reporter/index.js +0 -18
- package/dist/runner/basic.d.ts +0 -10
- package/dist/runner/basic.js +0 -63
- package/dist/runner/cache.d.ts +0 -5
- package/dist/runner/cache.js +0 -90
- package/dist/runner/hot-step.d.ts +0 -5
- package/dist/runner/hot-step.js +0 -87
- package/dist/runner/hot.d.ts +0 -5
- package/dist/runner/hot.js +0 -83
- package/dist/runner/multiple.d.ts +0 -11
- package/dist/runner/multiple.js +0 -38
- package/dist/runner/normal.d.ts +0 -5
- package/dist/runner/normal.js +0 -20
- package/dist/runner/runner/basic.d.ts +0 -30
- package/dist/runner/runner/basic.js +0 -107
- package/dist/runner/runner/cjs.d.ts +0 -14
- package/dist/runner/runner/cjs.js +0 -151
- package/dist/runner/runner/esm.d.ts +0 -7
- package/dist/runner/runner/esm.js +0 -125
- package/dist/runner/runner/index.d.ts +0 -8
- package/dist/runner/runner/index.js +0 -24
- package/dist/runner/runner/normal.d.ts +0 -9
- package/dist/runner/runner/normal.js +0 -23
- package/dist/runner/runner/watch.d.ts +0 -16
- package/dist/runner/runner/watch.js +0 -27
- package/dist/runner/runner/web/fake.d.ts +0 -18
- package/dist/runner/runner/web/fake.js +0 -143
- package/dist/runner/runner/web/jsdom.d.ts +0 -26
- package/dist/runner/runner/web/jsdom.js +0 -219
- package/dist/runner/runner/web.d.ts +0 -15
- package/dist/runner/runner/web.js +0 -32
- package/dist/runner/type.d.ts +0 -42
- package/dist/runner/type.js +0 -9
- package/dist/runner/watch.d.ts +0 -7
- package/dist/runner/watch.js +0 -60
- package/dist/test/simple.d.ts +0 -5
- package/dist/test/simple.js +0 -43
- package/jest.d.ts +0 -25
- package/template/diff.bundle.css +0 -1
- package/template/diff.bundle.js +0 -144
- package/template/diff.html +0 -14
- package/template/editor.worker.js +0 -1
- /package/dist/case/{nativeWatcher.d.ts → native-watcher.d.ts} +0 -0
- /package/dist/helper/legacy/{supportsWorker.d.ts → supportDefaultAssignment.d.ts} +0 -0
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FakeSheet = exports.FakeElement = void 0;
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
const fs = require("node:fs");
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
const getPropertyValue = function (property) {
|
|
8
|
-
return this[property];
|
|
9
|
-
};
|
|
10
|
-
class FakeDocument {
|
|
11
|
-
constructor(basePath, options = {}) {
|
|
12
|
-
this.head = this.createElement("head");
|
|
13
|
-
this.body = this.createElement("body");
|
|
14
|
-
this.baseURI = "https://test.cases/path/index.html";
|
|
15
|
-
this._elementsByTagName = new Map([
|
|
16
|
-
["head", [this.head]],
|
|
17
|
-
["body", [this.body]]
|
|
18
|
-
]);
|
|
19
|
-
this._basePath = basePath;
|
|
20
|
-
this.currentScript = undefined;
|
|
21
|
-
this._options = options || {};
|
|
22
|
-
}
|
|
23
|
-
createElement(type) {
|
|
24
|
-
return new FakeElement(this, type, this._basePath);
|
|
25
|
-
}
|
|
26
|
-
_onElementAttached(element) {
|
|
27
|
-
const type = element._type;
|
|
28
|
-
let list = this._elementsByTagName.get(type);
|
|
29
|
-
if (list === undefined) {
|
|
30
|
-
list = [];
|
|
31
|
-
this._elementsByTagName.set(type, list);
|
|
32
|
-
}
|
|
33
|
-
list.push(element);
|
|
34
|
-
}
|
|
35
|
-
_onElementRemoved(element) {
|
|
36
|
-
const type = element._type;
|
|
37
|
-
const list = this._elementsByTagName.get(type);
|
|
38
|
-
const idx = list.indexOf(element);
|
|
39
|
-
list.splice(idx, 1);
|
|
40
|
-
}
|
|
41
|
-
getElementsByTagName(name) {
|
|
42
|
-
return this._elementsByTagName.get(name) || [];
|
|
43
|
-
}
|
|
44
|
-
querySelectorAll(name) {
|
|
45
|
-
return this._elementsByTagName.get(name) || [];
|
|
46
|
-
}
|
|
47
|
-
getComputedStyle(element) {
|
|
48
|
-
const style = { getPropertyValue };
|
|
49
|
-
const links = this.getElementsByTagName("link");
|
|
50
|
-
for (const link of links) {
|
|
51
|
-
for (const rule of link.sheet.cssRules) {
|
|
52
|
-
if (rule.selectorText === element._type) {
|
|
53
|
-
Object.assign(style, rule.style);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return style;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.default = FakeDocument;
|
|
61
|
-
class FakeElement {
|
|
62
|
-
constructor(document, type, basePath) {
|
|
63
|
-
this._document = document;
|
|
64
|
-
this._type = type;
|
|
65
|
-
this._basePath = basePath;
|
|
66
|
-
this._children = [];
|
|
67
|
-
this._attributes = Object.create(null);
|
|
68
|
-
this._src = undefined;
|
|
69
|
-
this._href = undefined;
|
|
70
|
-
this.rel = undefined;
|
|
71
|
-
this.parentNode = undefined;
|
|
72
|
-
this.sheet = type === "link" ? new FakeSheet(this, basePath) : undefined;
|
|
73
|
-
}
|
|
74
|
-
cloneNode() {
|
|
75
|
-
return new FakeElement(this._document, this._type, this._basePath);
|
|
76
|
-
}
|
|
77
|
-
addEventListener() { }
|
|
78
|
-
insertBefore(node, before) {
|
|
79
|
-
this._document._onElementAttached(node);
|
|
80
|
-
node.parentNode = this;
|
|
81
|
-
this._children.unshift(node);
|
|
82
|
-
Promise.resolve().then(() => {
|
|
83
|
-
if (node.onload) {
|
|
84
|
-
node.onload({ type: "load", target: node });
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
appendChild(node) {
|
|
89
|
-
this._document._onElementAttached(node);
|
|
90
|
-
this._children.push(node);
|
|
91
|
-
node.parentNode = this;
|
|
92
|
-
if (node._type === "link") {
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
if (node.onload)
|
|
95
|
-
node.onload({ type: "load", target: node });
|
|
96
|
-
}, 100);
|
|
97
|
-
}
|
|
98
|
-
else if (node._type === "script") {
|
|
99
|
-
Promise.resolve().then(() => {
|
|
100
|
-
if (typeof this._document._options.onScript === "function") {
|
|
101
|
-
this._document._options.onScript(node);
|
|
102
|
-
}
|
|
103
|
-
if (node.onload) {
|
|
104
|
-
node.onload({
|
|
105
|
-
type: "load",
|
|
106
|
-
target: node
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
if (node.onload) {
|
|
113
|
-
node.onload({ type: "load", target: node });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
removeChild(node) {
|
|
118
|
-
const idx = this._children.indexOf(node);
|
|
119
|
-
if (idx >= 0) {
|
|
120
|
-
this._children.splice(idx, 1);
|
|
121
|
-
this._document._onElementRemoved(node);
|
|
122
|
-
node.parentNode = undefined;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
setAttribute(name, value) {
|
|
126
|
-
if (this._type === "link" && name === "href") {
|
|
127
|
-
this.href(value);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this._attributes[name] = value;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
removeAttribute(name) {
|
|
134
|
-
delete this._attributes[name];
|
|
135
|
-
}
|
|
136
|
-
getAttribute(name) {
|
|
137
|
-
if (this._type === "link" && name === "href") {
|
|
138
|
-
return this.href;
|
|
139
|
-
}
|
|
140
|
-
return this._attributes[name];
|
|
141
|
-
}
|
|
142
|
-
_toRealUrl(value) {
|
|
143
|
-
if (/^\//.test(value)) {
|
|
144
|
-
return `https://test.cases${value}`;
|
|
145
|
-
}
|
|
146
|
-
else if (/^\.\.\//.test(value)) {
|
|
147
|
-
return `https://test.cases${value.slice(2)}`;
|
|
148
|
-
}
|
|
149
|
-
else if (/^\.\//.test(value)) {
|
|
150
|
-
return `https://test.cases/path${value.slice(1)}`;
|
|
151
|
-
}
|
|
152
|
-
else if (/^\w+:\/\//.test(value)) {
|
|
153
|
-
return value;
|
|
154
|
-
}
|
|
155
|
-
else if (/^\/\//.test(value)) {
|
|
156
|
-
return `https:${value}`;
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
return `https://test.cases/path/${value}`;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
set src(value) {
|
|
163
|
-
if (this._type === "script") {
|
|
164
|
-
this._src = this._toRealUrl(value);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
get children() {
|
|
168
|
-
return this._children;
|
|
169
|
-
}
|
|
170
|
-
get src() {
|
|
171
|
-
return this._src;
|
|
172
|
-
}
|
|
173
|
-
set href(value) {
|
|
174
|
-
if (this._type === "link") {
|
|
175
|
-
this._href = this._toRealUrl(value);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
get href() {
|
|
179
|
-
return this._href;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
exports.FakeElement = FakeElement;
|
|
183
|
-
class FakeSheet {
|
|
184
|
-
constructor(element, basePath) {
|
|
185
|
-
this._element = element;
|
|
186
|
-
this._basePath = basePath;
|
|
187
|
-
this.cachedCss = undefined;
|
|
188
|
-
this.cachedCssRules = undefined;
|
|
189
|
-
}
|
|
190
|
-
get css() {
|
|
191
|
-
if (this.cachedCss) {
|
|
192
|
-
return this.cachedCss;
|
|
193
|
-
}
|
|
194
|
-
let css = fs.readFileSync(path.resolve(this._basePath, this._element.href
|
|
195
|
-
.replace(/^https:\/\/test\.cases\/path\//, "")
|
|
196
|
-
.replace(/^https:\/\/example\.com\//, "")), "utf-8");
|
|
197
|
-
css = css.replace(/@import url\("([^"]+)"\);/g, (match, url) => {
|
|
198
|
-
if (!/^https:\/\/test\.cases\/path\//.test(url)) {
|
|
199
|
-
return `@import url("${url}");`;
|
|
200
|
-
}
|
|
201
|
-
if (url.startsWith("#")) {
|
|
202
|
-
return url;
|
|
203
|
-
}
|
|
204
|
-
return fs.readFileSync(path.resolve(this._basePath, url.replace(/^https:\/\/test\.cases\/path\//, "")), "utf-8");
|
|
205
|
-
});
|
|
206
|
-
this.cachedCss = css;
|
|
207
|
-
return css;
|
|
208
|
-
}
|
|
209
|
-
get cssRules() {
|
|
210
|
-
if (this.cachedCssRules) {
|
|
211
|
-
return this.cachedCssRules;
|
|
212
|
-
}
|
|
213
|
-
const walkCssTokens = require("./walkCssTokens");
|
|
214
|
-
const rules = [];
|
|
215
|
-
let currentRule = { getPropertyValue };
|
|
216
|
-
let selector = undefined;
|
|
217
|
-
let last = 0;
|
|
218
|
-
const processDeclaration = str => {
|
|
219
|
-
const colon = str.indexOf(":");
|
|
220
|
-
if (colon > 0) {
|
|
221
|
-
const property = str.slice(0, colon).trim();
|
|
222
|
-
const value = str.slice(colon + 1);
|
|
223
|
-
currentRule[property] = value;
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
const filepath = /file:\/\//.test(this._element.href)
|
|
227
|
-
? new URL(this._element.href)
|
|
228
|
-
: path.resolve(this._basePath, this._element.href
|
|
229
|
-
.replace(/^https:\/\/test\.cases\/path\//, "")
|
|
230
|
-
.replace(/^https:\/\/example\.com\/public\/path\//, "")
|
|
231
|
-
.replace(/^https:\/\/example\.com\//, ""));
|
|
232
|
-
let css = fs.readFileSync(filepath.replace(/\?hmr=\d*/, ""), "utf-8");
|
|
233
|
-
css = css.replace(/@import url\("([^"]+)"\);/g, (match, url) => {
|
|
234
|
-
if (!/^https:\/\/test\.cases\/path\//.test(url)) {
|
|
235
|
-
return url;
|
|
236
|
-
}
|
|
237
|
-
if (url.startsWith("#")) {
|
|
238
|
-
return url;
|
|
239
|
-
}
|
|
240
|
-
return fs.readFileSync(path.resolve(this._basePath, url.replace(/^https:\/\/test\.cases\/path\//, "")), "utf-8");
|
|
241
|
-
})
|
|
242
|
-
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
243
|
-
.replace("//", "");
|
|
244
|
-
walkCssTokens(css, {
|
|
245
|
-
isSelector() {
|
|
246
|
-
return selector === undefined;
|
|
247
|
-
},
|
|
248
|
-
leftCurlyBracket(source, start, end) {
|
|
249
|
-
if (selector === undefined) {
|
|
250
|
-
selector = source.slice(last, start).trim();
|
|
251
|
-
last = end;
|
|
252
|
-
}
|
|
253
|
-
return end;
|
|
254
|
-
},
|
|
255
|
-
rightCurlyBracket(source, start, end) {
|
|
256
|
-
processDeclaration(source.slice(last, start));
|
|
257
|
-
rules.push({
|
|
258
|
-
selectorText: selector,
|
|
259
|
-
style: currentRule,
|
|
260
|
-
// hack cssText, css hmr needs this fields to detect changes
|
|
261
|
-
cssText: css
|
|
262
|
-
});
|
|
263
|
-
last = end;
|
|
264
|
-
selector = undefined;
|
|
265
|
-
currentRule = { getPropertyValue };
|
|
266
|
-
return end;
|
|
267
|
-
},
|
|
268
|
-
semicolon(source, start, end) {
|
|
269
|
-
processDeclaration(source.slice(last, start));
|
|
270
|
-
last = end;
|
|
271
|
-
return end;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
this.cachedCssRules = rules;
|
|
275
|
-
return rules;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
exports.FakeSheet = FakeSheet;
|
|
@@ -1,23 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function supportsImportFn(): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
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;
|