Skip to content

Commit

Permalink
Only import properties that are used to reduce bundle size in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
octref committed Apr 23, 2018
1 parent 595ed08 commit eaf4f7d
Show file tree
Hide file tree
Showing 2 changed files with 918 additions and 6,696 deletions.
14 changes: 12 additions & 2 deletions build/mdn-data-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function buildPropertiesWithMDNData(vscProperties) {
if (allMDNProperties[p.name]) {
propertyMap[p.name] = {
...p,
...allMDNProperties[p.name]
...extractMDNProperties(allMDNProperties[p.name])
}
} else {
propertyMap[p.name] = p
Expand All @@ -47,14 +47,24 @@ function buildPropertiesWithMDNData(vscProperties) {
name: pn,
description: '',
restriction: 'none',
...allMDNProperties[pn]
...extractMDNProperties(allMDNProperties[pn])
}
}
}

return Object.values(propertyMap)
}

/**
* Extract only the MDN data that we use
*/
function extractMDNProperties(mdnEntry) {
return {
status: mdnEntry.status,
syntax: mdnEntry.syntax
}
}

module.exports = {
buildPropertiesWithMDNData
}
Loading

0 comments on commit eaf4f7d

Please sign in to comment.