Skip to content

Commit d09c9ba

Browse files
committed
Only import properties that are used to reduce bundle size in browser
1 parent 04b2112 commit d09c9ba

File tree

2 files changed

+918
-6696
lines changed

2 files changed

+918
-6696
lines changed

build/mdn-data-importer.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function buildPropertiesWithMDNData(vscProperties) {
3030
if (allMDNProperties[p.name]) {
3131
propertyMap[p.name] = {
3232
...p,
33-
...allMDNProperties[p.name]
33+
...extractMDNProperties(allMDNProperties[p.name])
3434
}
3535
} else {
3636
propertyMap[p.name] = p
@@ -47,14 +47,24 @@ function buildPropertiesWithMDNData(vscProperties) {
4747
name: pn,
4848
description: '',
4949
restriction: 'none',
50-
...allMDNProperties[pn]
50+
...extractMDNProperties(allMDNProperties[pn])
5151
}
5252
}
5353
}
5454

5555
return Object.values(propertyMap)
5656
}
5757

58+
/**
59+
* Extract only the MDN data that we use
60+
*/
61+
function extractMDNProperties(mdnEntry) {
62+
return {
63+
status: mdnEntry.status,
64+
syntax: mdnEntry.syntax
65+
}
66+
}
67+
5868
module.exports = {
5969
buildPropertiesWithMDNData
6070
}

0 commit comments

Comments
 (0)