subfont 6.12.1 → 6.12.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.
- package/CHANGELOG.md +15 -7
- package/lib/subsetFonts.js +28 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### v6.12.3 (2023-01-06)
|
|
2
|
+
|
|
3
|
+
- [Update @hookun\/parse-animation-shorthand to ^0.1.5, fixes \#168](https://github.com/Munter/subfont/commit/ec19b28392e02c2a4cc42e0124cca5fce4c2ba32) ([Andreas Lind](mailto:andreas.lind@workday.com))
|
|
4
|
+
|
|
5
|
+
### v6.12.2 (2022-11-02)
|
|
6
|
+
|
|
7
|
+
- [Be resilient when an insertion point cannot be found for subfont's preloads and stylesheets Fixes assetgraph\/assetgraph\#1251](https://github.com/Munter/subfont/commit/75beca70fb6cf696cf958326d8ea65b31d125b71) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
8
|
+
|
|
1
9
|
### v6.12.1 (2022-09-11)
|
|
2
10
|
|
|
3
11
|
- [Map font-style: oblique to font-variation-settings: slnt -14](https://github.com/Munter/subfont/commit/ea96284729e0d100fcb87d09c63979641439b169) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
@@ -46,13 +54,9 @@
|
|
|
46
54
|
- [Update subset-font to ^1.5.0](https://github.com/Munter/subfont/commit/ba79ef6db81cedfd0e52672b530ca3afddd68a94) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
47
55
|
- [Fix warning about missing glyphs for BMP chars](https://github.com/Munter/subfont/commit/5ba0168f35bfef33f9bb9cc8a6d64de8fa1d5585) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
48
56
|
- [Fix CHANGELOG generation in preversion script](https://github.com/Munter/subfont/commit/3ea696f8c336c6072411c9817c0c2f5b8d8d61b9) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
49
|
-
|
|
50
|
-
### v6.6.1 (2022-07-09)
|
|
51
|
-
|
|
52
|
-
- [ugrvw](https://github.com/Munter/subfont/commit/5ccb873025f9790faf65641551df1a7e65fbfdbf) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
53
57
|
- [Fix CHANGELOG https:\/\/github.com\/Munter\/subfont\/commit\/5365689a5a925304a158fddef2b6af702857371c\#r78084394](https://github.com/Munter/subfont/commit/d42c7a2cffd33662d42d4532c45cb8b90080f128) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
54
58
|
- [Expect browserslist to only prescribe woff I guess the browser features + usage statistics finally changed so woff isn't needed](https://github.com/Munter/subfont/commit/b70db9b769955cabbda2f2a76f2e7758f9968ec7) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
55
|
-
- [
|
|
59
|
+
- [+1 more](https://github.com/Munter/subfont/compare/v6.6.0...v6.7.0)
|
|
56
60
|
|
|
57
61
|
### v6.6.0 (2022-07-09)
|
|
58
62
|
|
|
@@ -339,13 +343,16 @@
|
|
|
339
343
|
#### Pull requests
|
|
340
344
|
|
|
341
345
|
- [#76](https://github.com/Munter/subfont/pull/76) Fix the prettier setup ([Andreas Lind](mailto:andreas.lind@peakon.com))
|
|
342
|
-
- [#75](https://github.com/Munter/subfont/pull/75) Fix omitFallbacks with Google Web Fonts ([Andreas Lind](mailto:andreas.lind@peakon.com))
|
|
343
346
|
|
|
344
347
|
#### Commits to master
|
|
345
348
|
|
|
346
349
|
- [Switch to the official css-font-parser now that bramstein\/css-font-parser\#7 has been merged and released](https://github.com/Munter/subfont/commit/457c7f0e4cef0a8c1bd8f816c23ace64c9987424) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
347
350
|
- [Don't populate source map relations](https://github.com/Munter/subfont/commit/5c07218b6f1dcc6fad88702a3bcb7b33bf9df54e) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
348
351
|
|
|
352
|
+
### v4.1.2 (2020-01-09)
|
|
353
|
+
|
|
354
|
+
- [#75](https://github.com/Munter/subfont/pull/75) Fix omitFallbacks with Google Web Fonts ([Andreas Lind](mailto:andreas.lind@peakon.com))
|
|
355
|
+
|
|
349
356
|
### v4.1.1 (2020-01-04)
|
|
350
357
|
|
|
351
358
|
- [Add regression test](https://github.com/Munter/subfont/commit/46eddce9c09268dbde459b1f98fe5cec9e4c98f5) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
@@ -376,7 +383,8 @@
|
|
|
376
383
|
- [Add vscode debugger launch configuration for the test suite](https://github.com/Munter/subfont/commit/f8f9abc42909c556765555cc49f44eb40a9194db) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
377
384
|
- [Guard against an already detached relation when cleaning up](https://github.com/Munter/subfont/commit/6392fc359222772c9033a58a9020e3b35487d019) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
378
385
|
|
|
379
|
-
### v4.0.3
|
|
386
|
+
### v4.0.3 (2019-11-02)
|
|
387
|
+
|
|
380
388
|
#### Pull requests
|
|
381
389
|
|
|
382
390
|
- [#67](https://github.com/Munter/subfont/pull/67) Only warn about missing fonttools install if we are actually trying t… ([Peter Müller](mailto:munter@fumle.dk))
|
package/lib/subsetFonts.js
CHANGED
|
@@ -1251,10 +1251,27 @@ async function subsetFonts(
|
|
|
1251
1251
|
fontUsages,
|
|
1252
1252
|
accumulatedFontFaceDeclarations,
|
|
1253
1253
|
} of htmlOrSvgAssetTextsWithProps) {
|
|
1254
|
-
|
|
1254
|
+
let insertionPoint = assetGraph.findRelations({
|
|
1255
1255
|
type: `${htmlOrSvgAsset.type}Style`,
|
|
1256
1256
|
from: htmlOrSvgAsset,
|
|
1257
1257
|
})[0];
|
|
1258
|
+
|
|
1259
|
+
// Hackingly deal with the original stylesheet being located inside <noscript>
|
|
1260
|
+
// https://github.com/assetgraph/assetgraph/issues/1251
|
|
1261
|
+
if (!insertionPoint && htmlOrSvgAsset.type === 'Html') {
|
|
1262
|
+
for (const htmlNoScript of assetGraph.findRelations({
|
|
1263
|
+
type: 'HtmlNoscript',
|
|
1264
|
+
from: htmlOrSvgAsset,
|
|
1265
|
+
})) {
|
|
1266
|
+
if (
|
|
1267
|
+
assetGraph.findRelations({ from: htmlNoScript.to, type: 'HtmlStyle' })
|
|
1268
|
+
.length > 0
|
|
1269
|
+
) {
|
|
1270
|
+
insertionPoint = htmlNoScript;
|
|
1271
|
+
break;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1258
1275
|
const subsetFontUsages = fontUsages.filter(
|
|
1259
1276
|
(fontUsage) => fontUsage.subsets
|
|
1260
1277
|
);
|
|
@@ -1291,19 +1308,20 @@ async function subsetFonts(
|
|
|
1291
1308
|
|
|
1292
1309
|
if (unsubsettedFontUsagesToPreload.length > 0) {
|
|
1293
1310
|
// Insert <link rel="preload">
|
|
1294
|
-
|
|
1311
|
+
for (const fontUsage of unsubsettedFontUsagesToPreload) {
|
|
1295
1312
|
// Always preload unsubsetted font files, they might be any format, so can't be clever here
|
|
1296
|
-
|
|
1313
|
+
const preloadRelation = htmlOrSvgAsset.addRelation(
|
|
1297
1314
|
{
|
|
1298
1315
|
type: 'HtmlPreloadLink',
|
|
1299
1316
|
hrefType,
|
|
1300
1317
|
to: fontUsage.fontUrl,
|
|
1301
1318
|
as: 'font',
|
|
1302
1319
|
},
|
|
1303
|
-
'before',
|
|
1320
|
+
insertionPoint ? 'before' : 'firstInHead',
|
|
1304
1321
|
insertionPoint
|
|
1305
1322
|
);
|
|
1306
|
-
|
|
1323
|
+
insertionPoint = insertionPoint || preloadRelation;
|
|
1324
|
+
}
|
|
1307
1325
|
}
|
|
1308
1326
|
|
|
1309
1327
|
if (subsetFontUsages.length === 0) {
|
|
@@ -1433,16 +1451,17 @@ async function subsetFonts(
|
|
|
1433
1451
|
// - https://caniuse.com/#search=preload
|
|
1434
1452
|
|
|
1435
1453
|
if (htmlOrSvgAsset.type === 'Html') {
|
|
1436
|
-
htmlOrSvgAsset.addRelation(
|
|
1454
|
+
const htmlPreloadLink = htmlOrSvgAsset.addRelation(
|
|
1437
1455
|
{
|
|
1438
1456
|
type: 'HtmlPreloadLink',
|
|
1439
1457
|
hrefType,
|
|
1440
1458
|
to: fontAsset,
|
|
1441
1459
|
as: 'font',
|
|
1442
1460
|
},
|
|
1443
|
-
'before',
|
|
1461
|
+
insertionPoint ? 'before' : 'firstInHead',
|
|
1444
1462
|
insertionPoint
|
|
1445
1463
|
);
|
|
1464
|
+
insertionPoint = insertionPoint || htmlPreloadLink;
|
|
1446
1465
|
}
|
|
1447
1466
|
}
|
|
1448
1467
|
}
|
|
@@ -1453,9 +1472,10 @@ async function subsetFonts(
|
|
|
1453
1472
|
inlineCss || htmlOrSvgAsset.type === 'Svg' ? 'inline' : hrefType,
|
|
1454
1473
|
to: cssAsset,
|
|
1455
1474
|
},
|
|
1456
|
-
'before',
|
|
1475
|
+
insertionPoint ? 'before' : 'firstInHead',
|
|
1457
1476
|
insertionPoint
|
|
1458
1477
|
);
|
|
1478
|
+
insertionPoint = insertionPoint || cssRelation;
|
|
1459
1479
|
|
|
1460
1480
|
if (!omitFallbacks && inlineCss && unusedVariantsCss) {
|
|
1461
1481
|
// The fallback CSS for unused variants needs to go into its own stylesheet after the crude version of the JS-based preload "polyfill"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subfont",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.3",
|
|
4
4
|
"description": "Speeds up your pages initial paint by automatically subsetting local or Google fonts and loading them optimally",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=10.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"homepage": "https://github.com/Munter/subfont#readme",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@gustavnikolaj/async-main-wrap": "^3.0.1",
|
|
50
|
-
"@hookun/parse-animation-shorthand": "^0.1.
|
|
50
|
+
"@hookun/parse-animation-shorthand": "^0.1.5",
|
|
51
51
|
"assetgraph": "^7.8.1",
|
|
52
52
|
"browserslist": "^4.13.0",
|
|
53
53
|
"css-font-parser": "^2.0.0",
|