-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rofrischmann
committed
Feb 17, 2017
1 parent
3e3a7a8
commit d407efa
Showing
30 changed files
with
340 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import generateData from './modules/generator' | ||
|
||
const defaultBrowserSupport = { | ||
chrome: 46, | ||
android: 4, | ||
firefox: 40, | ||
ios_saf: 8, | ||
safari: 8, | ||
ie: 11, | ||
ie_mob: 11, | ||
edge: 12, | ||
opera: 16, | ||
op_mini: 12, | ||
and_uc: 9, | ||
and_chr: 46 | ||
} | ||
|
||
generateData(defaultBrowserSupport, { | ||
staticPath: `${__dirname}/modules/static/staticData.js`, | ||
dynamicPath: `${__dirname}/modules/dynamic/dynamicData.js`, | ||
compatibility: false, | ||
prefixData: true, | ||
plugins: false | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* @flow */ | ||
import { getSupport } from 'caniuse-api' | ||
|
||
import propertyMap from './maps/propertyMap' | ||
|
||
const prefixBrowserMap = { | ||
chrome: 'Webkit', | ||
safari: 'Webkit', | ||
firefox: 'Moz', | ||
opera: 'Webkit', | ||
ie: 'ms', | ||
edge: 'ms', | ||
ios_saf: 'Webkit', | ||
android: 'Webkit', | ||
and_chr: 'Webkit', | ||
and_uc: 'Webkit', | ||
op_mini: 'Webkit', | ||
ie_mob: 'ms' | ||
} | ||
|
||
const browsers = Object.keys(prefixBrowserMap) | ||
|
||
// remove flexprops from IE | ||
const flexPropsIE = [ | ||
'alignContent', | ||
'alignSelf', | ||
'alignItems', | ||
'justifyContent', | ||
'order', | ||
'flexGrow', | ||
'flexShrink', | ||
'flexBasis' | ||
] | ||
|
||
function filterAndRemoveIfEmpty(map: Object, property: string, filter: Function): void { | ||
map[property] = map[property].filter(filter) | ||
|
||
if (map[property].length === 0) { | ||
delete map[property] | ||
} | ||
} | ||
|
||
export default function generateDynamicPrefixMap(browserList: Object): Object { | ||
const prefixMap = {} | ||
|
||
for (let i = 0, len = browsers.length; i < len; ++i) { | ||
const browser = browsers[i] | ||
if (!prefixMap[browser]) { | ||
prefixMap[browser] = {} | ||
} | ||
|
||
for (const keyword in propertyMap) { | ||
const keywordProperties = [].concat(propertyMap[keyword]) | ||
const versions = getSupport(keyword) | ||
|
||
for (let j = 0, kLen = keywordProperties.length; j < kLen; ++j) { | ||
if (versions[browser].x >= browserList[browser]) { | ||
prefixMap[browser][keywordProperties[j]] = versions[browser].x | ||
} | ||
} | ||
} | ||
} | ||
|
||
prefixMap.ie = { | ||
...prefixMap.ie, | ||
...prefixMap.ie_mob | ||
} | ||
|
||
delete prefixMap.ie_mob | ||
|
||
// remove flexProps from IE due to alternative syntax | ||
for (let i = 0, len = flexPropsIE.length; i < len; ++i) { | ||
delete prefixMap.ie[flexPropsIE[i]] | ||
} | ||
|
||
return prefixMap | ||
} |
Oops, something went wrong.