single-file-core 1.5.2 → 1.5.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.
|
@@ -507,24 +507,28 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
507
507
|
new Promise(resolve => timeout = globalThis.setTimeout(() => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
|
|
508
508
|
]);
|
|
509
509
|
} catch (error) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
510
|
+
if (error.name == "NetworkError") {
|
|
511
|
+
source.valid = true;
|
|
512
|
+
} else {
|
|
513
|
+
const urlNodes = cssTree.findAll(srcDeclaration.data, node => node.type == "Url");
|
|
514
|
+
const declarationFontURLs = Array.from(fontDeclarations).find(([node]) => urlNodes.includes(node) && node.value == source.fontUrl);
|
|
515
|
+
if (declarationFontURLs && declarationFontURLs[1].length) {
|
|
516
|
+
const fontURL = declarationFontURLs[1][0];
|
|
517
|
+
if (fontURL) {
|
|
518
|
+
const fontFace = new FontFace("test-font", "url(" + fontURL + ")");
|
|
519
|
+
try {
|
|
520
|
+
let timeout;
|
|
521
|
+
await Promise.race([
|
|
522
|
+
fontFace.load().then(() => fontFace.loaded).then(() => { source.valid = true; globalThis.clearTimeout(timeout); }),
|
|
523
|
+
new Promise(resolve => timeout = globalThis.setTimeout(() => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
|
|
524
|
+
]);
|
|
525
|
+
} catch (error) {
|
|
526
|
+
// ignored
|
|
527
|
+
}
|
|
524
528
|
}
|
|
529
|
+
} else {
|
|
530
|
+
source.valid = true;
|
|
525
531
|
}
|
|
526
|
-
} else {
|
|
527
|
-
source.valid = true;
|
|
528
532
|
}
|
|
529
533
|
}
|
|
530
534
|
} else {
|
|
@@ -418,15 +418,19 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
418
418
|
new Promise(resolve => timeout = globalThis.setTimeout(() => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
|
|
419
419
|
]);
|
|
420
420
|
} catch (error) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
421
|
+
if (error.name == "NetworkError") {
|
|
422
|
+
source.valid = true;
|
|
423
|
+
} else {
|
|
424
|
+
const fontFace = new FontFace("test-font", "url(" + resource.url + ")");
|
|
425
|
+
try {
|
|
426
|
+
let timeout;
|
|
427
|
+
await Promise.race([
|
|
428
|
+
fontFace.load().then(() => fontFace.loaded).then(() => { source.valid = true; globalThis.clearTimeout(timeout); }),
|
|
429
|
+
new Promise(resolve => timeout = globalThis.setTimeout(() => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
|
|
430
|
+
]);
|
|
431
|
+
} catch (error) {
|
|
432
|
+
// ignored
|
|
433
|
+
}
|
|
430
434
|
}
|
|
431
435
|
}
|
|
432
436
|
} else {
|