cssstyle 1.1.1 → 1.3.0

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.
Files changed (527) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.js +55 -0
  3. package/.travis.yml +17 -0
  4. package/AUTHORS +31 -0
  5. package/{MIT-LICENSE.txt → LICENSE} +0 -0
  6. package/README.md +7 -19
  7. package/coverage/clover.xml +2150 -0
  8. package/coverage/coverage-final.json +86 -0
  9. package/coverage/lcov-report/base.css +224 -0
  10. package/coverage/lcov-report/block-navigation.js +79 -0
  11. package/coverage/lcov-report/index.html +123 -0
  12. package/coverage/lcov-report/lib/CSSStyleDeclaration.js.html +834 -0
  13. package/coverage/lcov-report/lib/allExtraProperties.js.html +813 -0
  14. package/coverage/lcov-report/lib/allProperties.js.html +1560 -0
  15. package/coverage/lcov-report/lib/constants.js.html +87 -0
  16. package/coverage/lcov-report/lib/index.html +149 -0
  17. package/coverage/lcov-report/lib/parsers.js.html +2193 -0
  18. package/coverage/lcov-report/lib/properties/azimuth.js.html +270 -0
  19. package/coverage/lcov-report/lib/properties/background.js.html +126 -0
  20. package/coverage/lcov-report/lib/properties/backgroundAttachment.js.html +141 -0
  21. package/coverage/lcov-report/lib/properties/backgroundColor.js.html +177 -0
  22. package/coverage/lcov-report/lib/properties/backgroundImage.js.html +165 -0
  23. package/coverage/lcov-report/lib/properties/backgroundPosition.js.html +243 -0
  24. package/coverage/lcov-report/lib/properties/backgroundRepeat.js.html +165 -0
  25. package/coverage/lcov-report/lib/properties/border.js.html +168 -0
  26. package/coverage/lcov-report/lib/properties/borderBottom.js.html +120 -0
  27. package/coverage/lcov-report/lib/properties/borderBottomColor.js.html +117 -0
  28. package/coverage/lcov-report/lib/properties/borderBottomStyle.js.html +132 -0
  29. package/coverage/lcov-report/lib/properties/borderBottomWidth.js.html +117 -0
  30. package/coverage/lcov-report/lib/properties/borderCollapse.js.html +147 -0
  31. package/coverage/lcov-report/lib/properties/borderColor.js.html +159 -0
  32. package/coverage/lcov-report/lib/properties/borderLeft.js.html +120 -0
  33. package/coverage/lcov-report/lib/properties/borderLeftColor.js.html +117 -0
  34. package/coverage/lcov-report/lib/properties/borderLeftStyle.js.html +132 -0
  35. package/coverage/lcov-report/lib/properties/borderLeftWidth.js.html +117 -0
  36. package/coverage/lcov-report/lib/properties/borderRight.js.html +120 -0
  37. package/coverage/lcov-report/lib/properties/borderRightColor.js.html +117 -0
  38. package/coverage/lcov-report/lib/properties/borderRightStyle.js.html +132 -0
  39. package/coverage/lcov-report/lib/properties/borderRightWidth.js.html +117 -0
  40. package/coverage/lcov-report/lib/properties/borderSpacing.js.html +192 -0
  41. package/coverage/lcov-report/lib/properties/borderStyle.js.html +183 -0
  42. package/coverage/lcov-report/lib/properties/borderTop.js.html +120 -0
  43. package/coverage/lcov-report/lib/properties/borderTopColor.js.html +117 -0
  44. package/coverage/lcov-report/lib/properties/borderTopStyle.js.html +132 -0
  45. package/coverage/lcov-report/lib/properties/borderTopWidth.js.html +120 -0
  46. package/coverage/lcov-report/lib/properties/borderWidth.js.html +207 -0
  47. package/coverage/lcov-report/lib/properties/bottom.js.html +111 -0
  48. package/coverage/lcov-report/lib/properties/clear.js.html +117 -0
  49. package/coverage/lcov-report/lib/properties/clip.js.html +210 -0
  50. package/coverage/lcov-report/lib/properties/color.js.html +111 -0
  51. package/coverage/lcov-report/lib/properties/cssFloat.js.html +105 -0
  52. package/coverage/lcov-report/lib/properties/flex.js.html +204 -0
  53. package/coverage/lcov-report/lib/properties/flexBasis.js.html +153 -0
  54. package/coverage/lcov-report/lib/properties/flexGrow.js.html +126 -0
  55. package/coverage/lcov-report/lib/properties/flexShrink.js.html +126 -0
  56. package/coverage/lcov-report/lib/properties/float.js.html +105 -0
  57. package/coverage/lcov-report/lib/properties/floodColor.js.html +111 -0
  58. package/coverage/lcov-report/lib/properties/font.js.html +198 -0
  59. package/coverage/lcov-report/lib/properties/fontFamily.js.html +168 -0
  60. package/coverage/lcov-report/lib/properties/fontSize.js.html +183 -0
  61. package/coverage/lcov-report/lib/properties/fontStyle.js.html +123 -0
  62. package/coverage/lcov-report/lib/properties/fontVariant.js.html +123 -0
  63. package/coverage/lcov-report/lib/properties/fontWeight.js.html +168 -0
  64. package/coverage/lcov-report/lib/properties/height.js.html +141 -0
  65. package/coverage/lcov-report/lib/properties/index.html +1111 -0
  66. package/coverage/lcov-report/lib/properties/left.js.html +111 -0
  67. package/coverage/lcov-report/lib/properties/lightingColor.js.html +111 -0
  68. package/coverage/lcov-report/lib/properties/lineHeight.js.html +147 -0
  69. package/coverage/lcov-report/lib/properties/margin.js.html +273 -0
  70. package/coverage/lcov-report/lib/properties/marginBottom.js.html +108 -0
  71. package/coverage/lcov-report/lib/properties/marginLeft.js.html +108 -0
  72. package/coverage/lcov-report/lib/properties/marginRight.js.html +108 -0
  73. package/coverage/lcov-report/lib/properties/marginTop.js.html +108 -0
  74. package/coverage/lcov-report/lib/properties/opacity.js.html +111 -0
  75. package/coverage/lcov-report/lib/properties/outlineColor.js.html +111 -0
  76. package/coverage/lcov-report/lib/properties/padding.js.html +252 -0
  77. package/coverage/lcov-report/lib/properties/paddingBottom.js.html +108 -0
  78. package/coverage/lcov-report/lib/properties/paddingLeft.js.html +108 -0
  79. package/coverage/lcov-report/lib/properties/paddingRight.js.html +108 -0
  80. package/coverage/lcov-report/lib/properties/paddingTop.js.html +108 -0
  81. package/coverage/lcov-report/lib/properties/right.js.html +111 -0
  82. package/coverage/lcov-report/lib/properties/stopColor.js.html +111 -0
  83. package/coverage/lcov-report/lib/properties/textLineThroughColor.js.html +111 -0
  84. package/coverage/lcov-report/lib/properties/textOverlineColor.js.html +111 -0
  85. package/coverage/lcov-report/lib/properties/textUnderlineColor.js.html +111 -0
  86. package/coverage/lcov-report/lib/properties/top.js.html +111 -0
  87. package/coverage/lcov-report/lib/properties/webkitBorderAfterColor.js.html +111 -0
  88. package/coverage/lcov-report/lib/properties/webkitBorderBeforeColor.js.html +111 -0
  89. package/coverage/lcov-report/lib/properties/webkitBorderEndColor.js.html +111 -0
  90. package/coverage/lcov-report/lib/properties/webkitBorderStartColor.js.html +111 -0
  91. package/coverage/lcov-report/lib/properties/webkitColumnRuleColor.js.html +111 -0
  92. package/coverage/lcov-report/lib/properties/webkitMatchNearestMailBlockquoteColor.js.html +111 -0
  93. package/coverage/lcov-report/lib/properties/webkitTapHighlightColor.js.html +111 -0
  94. package/coverage/lcov-report/lib/properties/webkitTextEmphasisColor.js.html +111 -0
  95. package/coverage/lcov-report/lib/properties/webkitTextFillColor.js.html +111 -0
  96. package/coverage/lcov-report/lib/properties/webkitTextStrokeColor.js.html +111 -0
  97. package/coverage/lcov-report/lib/properties/width.js.html +141 -0
  98. package/coverage/lcov-report/lib/utils/getBasicPropertyDescriptor.js.html +111 -0
  99. package/coverage/lcov-report/lib/utils/index.html +97 -0
  100. package/coverage/lcov-report/prettify.css +1 -0
  101. package/coverage/lcov-report/prettify.js +2 -0
  102. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  103. package/coverage/lcov-report/sorter.js +170 -0
  104. package/coverage/lcov.info +3711 -0
  105. package/jest.config.js +10 -0
  106. package/lib/CSSStyleDeclaration.js +224 -202
  107. package/lib/CSSStyleDeclaration.test.js +521 -0
  108. package/lib/allExtraProperties.js +248 -0
  109. package/lib/allProperties.js +497 -0
  110. package/lib/constants.js +6 -0
  111. package/lib/implementedProperties.js +90 -0
  112. package/lib/named_colors.json +152 -0
  113. package/lib/parsers.js +572 -534
  114. package/lib/parsers.test.js +98 -0
  115. package/lib/properties/azimuth.js +59 -57
  116. package/lib/properties/background.js +9 -14
  117. package/lib/properties/backgroundAttachment.js +17 -15
  118. package/lib/properties/backgroundColor.js +24 -21
  119. package/lib/properties/backgroundImage.js +20 -17
  120. package/lib/properties/backgroundPosition.js +40 -38
  121. package/lib/properties/backgroundRepeat.js +20 -13
  122. package/lib/properties/border.js +20 -36
  123. package/lib/properties/borderBottom.js +7 -13
  124. package/lib/properties/borderBottomColor.js +11 -11
  125. package/lib/properties/borderBottomStyle.js +14 -14
  126. package/lib/properties/borderBottomWidth.js +11 -11
  127. package/lib/properties/borderCollapse.js +17 -16
  128. package/lib/properties/borderColor.js +17 -15
  129. package/lib/properties/borderLeft.js +7 -13
  130. package/lib/properties/borderLeftColor.js +11 -11
  131. package/lib/properties/borderLeftStyle.js +14 -14
  132. package/lib/properties/borderLeftWidth.js +11 -11
  133. package/lib/properties/borderRight.js +7 -13
  134. package/lib/properties/borderRightColor.js +11 -11
  135. package/lib/properties/borderRightStyle.js +14 -14
  136. package/lib/properties/borderRightWidth.js +11 -11
  137. package/lib/properties/borderSpacing.js +26 -30
  138. package/lib/properties/borderStyle.js +24 -13
  139. package/lib/properties/borderTop.js +7 -12
  140. package/lib/properties/borderTopColor.js +11 -11
  141. package/lib/properties/borderTopStyle.js +14 -14
  142. package/lib/properties/borderTopWidth.js +10 -10
  143. package/lib/properties/borderWidth.js +29 -30
  144. package/lib/properties/bottom.js +8 -8
  145. package/lib/properties/clear.js +9 -9
  146. package/lib/properties/clip.js +37 -39
  147. package/lib/properties/color.js +8 -8
  148. package/lib/properties/cssFloat.js +8 -8
  149. package/lib/properties/flex.js +45 -0
  150. package/lib/properties/flexBasis.js +28 -0
  151. package/lib/properties/flexGrow.js +19 -0
  152. package/lib/properties/flexShrink.js +19 -0
  153. package/lib/properties/float.js +12 -0
  154. package/lib/properties/floodColor.js +8 -8
  155. package/lib/properties/font.js +27 -24
  156. package/lib/properties/fontFamily.js +21 -21
  157. package/lib/properties/fontSize.js +26 -13
  158. package/lib/properties/fontStyle.js +10 -10
  159. package/lib/properties/fontVariant.js +9 -9
  160. package/lib/properties/fontWeight.js +25 -10
  161. package/lib/properties/height.js +15 -15
  162. package/lib/properties/left.js +8 -8
  163. package/lib/properties/lightingColor.js +8 -8
  164. package/lib/properties/lineHeight.js +16 -11
  165. package/lib/properties/margin.js +49 -40
  166. package/lib/properties/marginBottom.js +6 -6
  167. package/lib/properties/marginLeft.js +6 -6
  168. package/lib/properties/marginRight.js +6 -6
  169. package/lib/properties/marginTop.js +6 -6
  170. package/lib/properties/opacity.js +8 -8
  171. package/lib/properties/outlineColor.js +8 -8
  172. package/lib/properties/padding.js +42 -33
  173. package/lib/properties/paddingBottom.js +6 -6
  174. package/lib/properties/paddingLeft.js +6 -6
  175. package/lib/properties/paddingRight.js +6 -6
  176. package/lib/properties/paddingTop.js +6 -6
  177. package/lib/properties/right.js +8 -8
  178. package/lib/properties/stopColor.js +8 -8
  179. package/lib/properties/textLineThroughColor.js +8 -8
  180. package/lib/properties/textOverlineColor.js +8 -8
  181. package/lib/properties/textUnderlineColor.js +8 -8
  182. package/lib/properties/top.js +8 -8
  183. package/lib/properties/webkitBorderAfterColor.js +8 -8
  184. package/lib/properties/webkitBorderBeforeColor.js +8 -8
  185. package/lib/properties/webkitBorderEndColor.js +8 -8
  186. package/lib/properties/webkitBorderStartColor.js +8 -8
  187. package/lib/properties/webkitColumnRuleColor.js +8 -8
  188. package/lib/properties/webkitMatchNearestMailBlockquoteColor.js +8 -8
  189. package/lib/properties/webkitTapHighlightColor.js +8 -8
  190. package/lib/properties/webkitTextEmphasisColor.js +8 -8
  191. package/lib/properties/webkitTextFillColor.js +8 -8
  192. package/lib/properties/webkitTextStrokeColor.js +8 -8
  193. package/lib/properties/width.js +15 -15
  194. package/lib/properties.js +224 -4343
  195. package/lib/utils/getBasicPropertyDescriptor.js +14 -0
  196. package/package.json +34 -22
  197. package/scripts/download_latest_properties.js +88 -0
  198. package/scripts/generate_implemented_properties.js +61 -0
  199. package/scripts/generate_properties.js +107 -117
  200. package/lib/properties/alignContent.js +0 -12
  201. package/lib/properties/alignItems.js +0 -12
  202. package/lib/properties/alignmentBaseline.js +0 -12
  203. package/lib/properties/backgroundClip.js +0 -12
  204. package/lib/properties/backgroundOrigin.js +0 -12
  205. package/lib/properties/backgroundPositionX.js +0 -12
  206. package/lib/properties/backgroundPositionY.js +0 -12
  207. package/lib/properties/backgroundRepeatX.js +0 -12
  208. package/lib/properties/backgroundRepeatY.js +0 -12
  209. package/lib/properties/backgroundSize.js +0 -12
  210. package/lib/properties/baselineShift.js +0 -12
  211. package/lib/properties/borderBottomLeftRadius.js +0 -12
  212. package/lib/properties/borderBottomRightRadius.js +0 -12
  213. package/lib/properties/borderImage.js +0 -12
  214. package/lib/properties/borderImageOutset.js +0 -12
  215. package/lib/properties/borderImageRepeat.js +0 -12
  216. package/lib/properties/borderImageSlice.js +0 -12
  217. package/lib/properties/borderImageSource.js +0 -12
  218. package/lib/properties/borderImageWidth.js +0 -12
  219. package/lib/properties/borderRadius.js +0 -12
  220. package/lib/properties/borderTopLeftRadius.js +0 -12
  221. package/lib/properties/borderTopRightRadius.js +0 -12
  222. package/lib/properties/boxShadow.js +0 -12
  223. package/lib/properties/boxSizing.js +0 -12
  224. package/lib/properties/captionSide.js +0 -12
  225. package/lib/properties/colorInterpolation.js +0 -12
  226. package/lib/properties/colorInterpolationFilters.js +0 -12
  227. package/lib/properties/colorProfile.js +0 -12
  228. package/lib/properties/colorRendering.js +0 -12
  229. package/lib/properties/content.js +0 -12
  230. package/lib/properties/counterIncrement.js +0 -12
  231. package/lib/properties/counterReset.js +0 -12
  232. package/lib/properties/cue.js +0 -12
  233. package/lib/properties/cueAfter.js +0 -12
  234. package/lib/properties/cueBefore.js +0 -12
  235. package/lib/properties/cursor.js +0 -12
  236. package/lib/properties/direction.js +0 -12
  237. package/lib/properties/display.js +0 -12
  238. package/lib/properties/dominantBaseline.js +0 -12
  239. package/lib/properties/elevation.js +0 -12
  240. package/lib/properties/emptyCells.js +0 -12
  241. package/lib/properties/enableBackground.js +0 -12
  242. package/lib/properties/fill.js +0 -12
  243. package/lib/properties/fillOpacity.js +0 -12
  244. package/lib/properties/fillRule.js +0 -12
  245. package/lib/properties/filter.js +0 -12
  246. package/lib/properties/flexDirection.js +0 -12
  247. package/lib/properties/flexFlow.js +0 -12
  248. package/lib/properties/flexWrap.js +0 -12
  249. package/lib/properties/floodOpacity.js +0 -12
  250. package/lib/properties/fontSizeAdjust.js +0 -12
  251. package/lib/properties/fontStretch.js +0 -12
  252. package/lib/properties/glyphOrientationHorizontal.js +0 -12
  253. package/lib/properties/glyphOrientationVertical.js +0 -12
  254. package/lib/properties/imageRendering.js +0 -12
  255. package/lib/properties/justifyContent.js +0 -12
  256. package/lib/properties/kerning.js +0 -12
  257. package/lib/properties/letterSpacing.js +0 -12
  258. package/lib/properties/listStyle.js +0 -12
  259. package/lib/properties/listStyleImage.js +0 -12
  260. package/lib/properties/listStylePosition.js +0 -12
  261. package/lib/properties/listStyleType.js +0 -12
  262. package/lib/properties/marker.js +0 -12
  263. package/lib/properties/markerEnd.js +0 -12
  264. package/lib/properties/markerMid.js +0 -12
  265. package/lib/properties/markerOffset.js +0 -12
  266. package/lib/properties/markerStart.js +0 -12
  267. package/lib/properties/marks.js +0 -12
  268. package/lib/properties/mask.js +0 -12
  269. package/lib/properties/maxHeight.js +0 -12
  270. package/lib/properties/maxWidth.js +0 -12
  271. package/lib/properties/minHeight.js +0 -12
  272. package/lib/properties/minWidth.js +0 -12
  273. package/lib/properties/orphans.js +0 -12
  274. package/lib/properties/outline.js +0 -12
  275. package/lib/properties/outlineOffset.js +0 -12
  276. package/lib/properties/outlineStyle.js +0 -12
  277. package/lib/properties/outlineWidth.js +0 -12
  278. package/lib/properties/overflow.js +0 -12
  279. package/lib/properties/overflowX.js +0 -12
  280. package/lib/properties/overflowY.js +0 -12
  281. package/lib/properties/page.js +0 -12
  282. package/lib/properties/pageBreakAfter.js +0 -12
  283. package/lib/properties/pageBreakBefore.js +0 -12
  284. package/lib/properties/pageBreakInside.js +0 -12
  285. package/lib/properties/pause.js +0 -12
  286. package/lib/properties/pauseAfter.js +0 -12
  287. package/lib/properties/pauseBefore.js +0 -12
  288. package/lib/properties/pitch.js +0 -12
  289. package/lib/properties/pitchRange.js +0 -12
  290. package/lib/properties/playDuring.js +0 -12
  291. package/lib/properties/pointerEvents.js +0 -12
  292. package/lib/properties/position.js +0 -12
  293. package/lib/properties/quotes.js +0 -12
  294. package/lib/properties/resize.js +0 -12
  295. package/lib/properties/richness.js +0 -12
  296. package/lib/properties/shapeRendering.js +0 -12
  297. package/lib/properties/size.js +0 -12
  298. package/lib/properties/speak.js +0 -12
  299. package/lib/properties/speakHeader.js +0 -12
  300. package/lib/properties/speakNumeral.js +0 -12
  301. package/lib/properties/speakPunctuation.js +0 -12
  302. package/lib/properties/speechRate.js +0 -12
  303. package/lib/properties/src.js +0 -12
  304. package/lib/properties/stopOpacity.js +0 -12
  305. package/lib/properties/stress.js +0 -12
  306. package/lib/properties/stroke.js +0 -12
  307. package/lib/properties/strokeDasharray.js +0 -12
  308. package/lib/properties/strokeDashoffset.js +0 -12
  309. package/lib/properties/strokeLinecap.js +0 -12
  310. package/lib/properties/strokeLinejoin.js +0 -12
  311. package/lib/properties/strokeMiterlimit.js +0 -12
  312. package/lib/properties/strokeOpacity.js +0 -12
  313. package/lib/properties/strokeWidth.js +0 -12
  314. package/lib/properties/tableLayout.js +0 -12
  315. package/lib/properties/textAlign.js +0 -12
  316. package/lib/properties/textAnchor.js +0 -12
  317. package/lib/properties/textDecoration.js +0 -12
  318. package/lib/properties/textIndent.js +0 -12
  319. package/lib/properties/textLineThrough.js +0 -12
  320. package/lib/properties/textLineThroughMode.js +0 -12
  321. package/lib/properties/textLineThroughStyle.js +0 -12
  322. package/lib/properties/textLineThroughWidth.js +0 -12
  323. package/lib/properties/textOverflow.js +0 -12
  324. package/lib/properties/textOverline.js +0 -12
  325. package/lib/properties/textOverlineMode.js +0 -12
  326. package/lib/properties/textOverlineStyle.js +0 -12
  327. package/lib/properties/textOverlineWidth.js +0 -12
  328. package/lib/properties/textRendering.js +0 -12
  329. package/lib/properties/textShadow.js +0 -12
  330. package/lib/properties/textTransform.js +0 -12
  331. package/lib/properties/textUnderline.js +0 -12
  332. package/lib/properties/textUnderlineMode.js +0 -12
  333. package/lib/properties/textUnderlineStyle.js +0 -12
  334. package/lib/properties/textUnderlineWidth.js +0 -12
  335. package/lib/properties/transform.js +0 -12
  336. package/lib/properties/unicodeBidi.js +0 -12
  337. package/lib/properties/unicodeRange.js +0 -12
  338. package/lib/properties/vectorEffect.js +0 -12
  339. package/lib/properties/verticalAlign.js +0 -12
  340. package/lib/properties/visibility.js +0 -12
  341. package/lib/properties/voiceFamily.js +0 -12
  342. package/lib/properties/volume.js +0 -12
  343. package/lib/properties/webkitAnimation.js +0 -12
  344. package/lib/properties/webkitAnimationDelay.js +0 -12
  345. package/lib/properties/webkitAnimationDirection.js +0 -12
  346. package/lib/properties/webkitAnimationDuration.js +0 -12
  347. package/lib/properties/webkitAnimationFillMode.js +0 -12
  348. package/lib/properties/webkitAnimationIterationCount.js +0 -12
  349. package/lib/properties/webkitAnimationName.js +0 -12
  350. package/lib/properties/webkitAnimationPlayState.js +0 -12
  351. package/lib/properties/webkitAnimationTimingFunction.js +0 -12
  352. package/lib/properties/webkitAppearance.js +0 -12
  353. package/lib/properties/webkitAspectRatio.js +0 -12
  354. package/lib/properties/webkitBackfaceVisibility.js +0 -12
  355. package/lib/properties/webkitBackgroundClip.js +0 -12
  356. package/lib/properties/webkitBackgroundComposite.js +0 -12
  357. package/lib/properties/webkitBackgroundOrigin.js +0 -12
  358. package/lib/properties/webkitBackgroundSize.js +0 -12
  359. package/lib/properties/webkitBorderAfter.js +0 -12
  360. package/lib/properties/webkitBorderAfterStyle.js +0 -12
  361. package/lib/properties/webkitBorderAfterWidth.js +0 -12
  362. package/lib/properties/webkitBorderBefore.js +0 -12
  363. package/lib/properties/webkitBorderBeforeStyle.js +0 -12
  364. package/lib/properties/webkitBorderBeforeWidth.js +0 -12
  365. package/lib/properties/webkitBorderEnd.js +0 -12
  366. package/lib/properties/webkitBorderEndStyle.js +0 -12
  367. package/lib/properties/webkitBorderEndWidth.js +0 -12
  368. package/lib/properties/webkitBorderFit.js +0 -12
  369. package/lib/properties/webkitBorderHorizontalSpacing.js +0 -12
  370. package/lib/properties/webkitBorderImage.js +0 -12
  371. package/lib/properties/webkitBorderRadius.js +0 -12
  372. package/lib/properties/webkitBorderStart.js +0 -12
  373. package/lib/properties/webkitBorderStartStyle.js +0 -12
  374. package/lib/properties/webkitBorderStartWidth.js +0 -12
  375. package/lib/properties/webkitBorderVerticalSpacing.js +0 -12
  376. package/lib/properties/webkitBoxAlign.js +0 -12
  377. package/lib/properties/webkitBoxDirection.js +0 -12
  378. package/lib/properties/webkitBoxFlex.js +0 -12
  379. package/lib/properties/webkitBoxFlexGroup.js +0 -12
  380. package/lib/properties/webkitBoxLines.js +0 -12
  381. package/lib/properties/webkitBoxOrdinalGroup.js +0 -12
  382. package/lib/properties/webkitBoxOrient.js +0 -12
  383. package/lib/properties/webkitBoxPack.js +0 -12
  384. package/lib/properties/webkitBoxReflect.js +0 -12
  385. package/lib/properties/webkitBoxShadow.js +0 -12
  386. package/lib/properties/webkitColorCorrection.js +0 -12
  387. package/lib/properties/webkitColumnAxis.js +0 -12
  388. package/lib/properties/webkitColumnBreakAfter.js +0 -12
  389. package/lib/properties/webkitColumnBreakBefore.js +0 -12
  390. package/lib/properties/webkitColumnBreakInside.js +0 -12
  391. package/lib/properties/webkitColumnCount.js +0 -12
  392. package/lib/properties/webkitColumnGap.js +0 -12
  393. package/lib/properties/webkitColumnRule.js +0 -12
  394. package/lib/properties/webkitColumnRuleStyle.js +0 -12
  395. package/lib/properties/webkitColumnRuleWidth.js +0 -12
  396. package/lib/properties/webkitColumnSpan.js +0 -12
  397. package/lib/properties/webkitColumnWidth.js +0 -12
  398. package/lib/properties/webkitColumns.js +0 -12
  399. package/lib/properties/webkitFilter.js +0 -12
  400. package/lib/properties/webkitFlexAlign.js +0 -12
  401. package/lib/properties/webkitFlexDirection.js +0 -12
  402. package/lib/properties/webkitFlexFlow.js +0 -12
  403. package/lib/properties/webkitFlexItemAlign.js +0 -12
  404. package/lib/properties/webkitFlexLinePack.js +0 -12
  405. package/lib/properties/webkitFlexOrder.js +0 -12
  406. package/lib/properties/webkitFlexPack.js +0 -12
  407. package/lib/properties/webkitFlexWrap.js +0 -12
  408. package/lib/properties/webkitFlowFrom.js +0 -12
  409. package/lib/properties/webkitFlowInto.js +0 -12
  410. package/lib/properties/webkitFontFeatureSettings.js +0 -12
  411. package/lib/properties/webkitFontKerning.js +0 -12
  412. package/lib/properties/webkitFontSizeDelta.js +0 -12
  413. package/lib/properties/webkitFontSmoothing.js +0 -12
  414. package/lib/properties/webkitFontVariantLigatures.js +0 -12
  415. package/lib/properties/webkitHighlight.js +0 -12
  416. package/lib/properties/webkitHyphenateCharacter.js +0 -12
  417. package/lib/properties/webkitHyphenateLimitAfter.js +0 -12
  418. package/lib/properties/webkitHyphenateLimitBefore.js +0 -12
  419. package/lib/properties/webkitHyphenateLimitLines.js +0 -12
  420. package/lib/properties/webkitHyphens.js +0 -12
  421. package/lib/properties/webkitLineAlign.js +0 -12
  422. package/lib/properties/webkitLineBoxContain.js +0 -12
  423. package/lib/properties/webkitLineBreak.js +0 -12
  424. package/lib/properties/webkitLineClamp.js +0 -12
  425. package/lib/properties/webkitLineGrid.js +0 -12
  426. package/lib/properties/webkitLineSnap.js +0 -12
  427. package/lib/properties/webkitLocale.js +0 -12
  428. package/lib/properties/webkitLogicalHeight.js +0 -12
  429. package/lib/properties/webkitLogicalWidth.js +0 -12
  430. package/lib/properties/webkitMarginAfter.js +0 -12
  431. package/lib/properties/webkitMarginAfterCollapse.js +0 -12
  432. package/lib/properties/webkitMarginBefore.js +0 -12
  433. package/lib/properties/webkitMarginBeforeCollapse.js +0 -12
  434. package/lib/properties/webkitMarginBottomCollapse.js +0 -12
  435. package/lib/properties/webkitMarginCollapse.js +0 -12
  436. package/lib/properties/webkitMarginEnd.js +0 -12
  437. package/lib/properties/webkitMarginStart.js +0 -12
  438. package/lib/properties/webkitMarginTopCollapse.js +0 -12
  439. package/lib/properties/webkitMarquee.js +0 -12
  440. package/lib/properties/webkitMarqueeDirection.js +0 -12
  441. package/lib/properties/webkitMarqueeIncrement.js +0 -12
  442. package/lib/properties/webkitMarqueeRepetition.js +0 -12
  443. package/lib/properties/webkitMarqueeSpeed.js +0 -12
  444. package/lib/properties/webkitMarqueeStyle.js +0 -12
  445. package/lib/properties/webkitMask.js +0 -12
  446. package/lib/properties/webkitMaskAttachment.js +0 -12
  447. package/lib/properties/webkitMaskBoxImage.js +0 -12
  448. package/lib/properties/webkitMaskBoxImageOutset.js +0 -12
  449. package/lib/properties/webkitMaskBoxImageRepeat.js +0 -12
  450. package/lib/properties/webkitMaskBoxImageSlice.js +0 -12
  451. package/lib/properties/webkitMaskBoxImageSource.js +0 -12
  452. package/lib/properties/webkitMaskBoxImageWidth.js +0 -12
  453. package/lib/properties/webkitMaskClip.js +0 -12
  454. package/lib/properties/webkitMaskComposite.js +0 -12
  455. package/lib/properties/webkitMaskImage.js +0 -12
  456. package/lib/properties/webkitMaskOrigin.js +0 -12
  457. package/lib/properties/webkitMaskPosition.js +0 -12
  458. package/lib/properties/webkitMaskPositionX.js +0 -12
  459. package/lib/properties/webkitMaskPositionY.js +0 -12
  460. package/lib/properties/webkitMaskRepeat.js +0 -12
  461. package/lib/properties/webkitMaskRepeatX.js +0 -12
  462. package/lib/properties/webkitMaskRepeatY.js +0 -12
  463. package/lib/properties/webkitMaskSize.js +0 -12
  464. package/lib/properties/webkitMaxLogicalHeight.js +0 -12
  465. package/lib/properties/webkitMaxLogicalWidth.js +0 -12
  466. package/lib/properties/webkitMinLogicalHeight.js +0 -12
  467. package/lib/properties/webkitMinLogicalWidth.js +0 -12
  468. package/lib/properties/webkitNbspMode.js +0 -12
  469. package/lib/properties/webkitOverflowScrolling.js +0 -12
  470. package/lib/properties/webkitPaddingAfter.js +0 -12
  471. package/lib/properties/webkitPaddingBefore.js +0 -12
  472. package/lib/properties/webkitPaddingEnd.js +0 -12
  473. package/lib/properties/webkitPaddingStart.js +0 -12
  474. package/lib/properties/webkitPerspective.js +0 -12
  475. package/lib/properties/webkitPerspectiveOrigin.js +0 -12
  476. package/lib/properties/webkitPerspectiveOriginX.js +0 -12
  477. package/lib/properties/webkitPerspectiveOriginY.js +0 -12
  478. package/lib/properties/webkitPrintColorAdjust.js +0 -12
  479. package/lib/properties/webkitRegionBreakAfter.js +0 -12
  480. package/lib/properties/webkitRegionBreakBefore.js +0 -12
  481. package/lib/properties/webkitRegionBreakInside.js +0 -12
  482. package/lib/properties/webkitRegionOverflow.js +0 -12
  483. package/lib/properties/webkitRtlOrdering.js +0 -12
  484. package/lib/properties/webkitSvgShadow.js +0 -12
  485. package/lib/properties/webkitTextCombine.js +0 -12
  486. package/lib/properties/webkitTextDecorationsInEffect.js +0 -12
  487. package/lib/properties/webkitTextEmphasis.js +0 -12
  488. package/lib/properties/webkitTextEmphasisPosition.js +0 -12
  489. package/lib/properties/webkitTextEmphasisStyle.js +0 -12
  490. package/lib/properties/webkitTextOrientation.js +0 -12
  491. package/lib/properties/webkitTextSecurity.js +0 -12
  492. package/lib/properties/webkitTextSizeAdjust.js +0 -12
  493. package/lib/properties/webkitTextStroke.js +0 -12
  494. package/lib/properties/webkitTextStrokeWidth.js +0 -12
  495. package/lib/properties/webkitTransform.js +0 -12
  496. package/lib/properties/webkitTransformOrigin.js +0 -12
  497. package/lib/properties/webkitTransformOriginX.js +0 -12
  498. package/lib/properties/webkitTransformOriginY.js +0 -12
  499. package/lib/properties/webkitTransformOriginZ.js +0 -12
  500. package/lib/properties/webkitTransformStyle.js +0 -12
  501. package/lib/properties/webkitTransition.js +0 -12
  502. package/lib/properties/webkitTransitionDelay.js +0 -12
  503. package/lib/properties/webkitTransitionDuration.js +0 -12
  504. package/lib/properties/webkitTransitionProperty.js +0 -12
  505. package/lib/properties/webkitTransitionTimingFunction.js +0 -12
  506. package/lib/properties/webkitUserDrag.js +0 -12
  507. package/lib/properties/webkitUserModify.js +0 -12
  508. package/lib/properties/webkitUserSelect.js +0 -12
  509. package/lib/properties/webkitWrap.js +0 -12
  510. package/lib/properties/webkitWrapFlow.js +0 -12
  511. package/lib/properties/webkitWrapMargin.js +0 -12
  512. package/lib/properties/webkitWrapPadding.js +0 -12
  513. package/lib/properties/webkitWrapShapeInside.js +0 -12
  514. package/lib/properties/webkitWrapShapeOutside.js +0 -12
  515. package/lib/properties/webkitWrapThrough.js +0 -12
  516. package/lib/properties/webkitWritingMode.js +0 -12
  517. package/lib/properties/whiteSpace.js +0 -12
  518. package/lib/properties/widows.js +0 -12
  519. package/lib/properties/wordBreak.js +0 -12
  520. package/lib/properties/wordSpacing.js +0 -12
  521. package/lib/properties/wordWrap.js +0 -12
  522. package/lib/properties/writingMode.js +0 -12
  523. package/lib/properties/zIndex.js +0 -12
  524. package/lib/properties/zoom.js +0 -12
  525. package/lib/validProperties.js +0 -410
  526. package/scripts/generate_valid_properties.js +0 -62
  527. package/tests/tests.js +0 -450
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ module.exports = function getBasicPropertyDescriptor(name) {
4
+ return {
5
+ set: function(v) {
6
+ this._setProperty(name, v);
7
+ },
8
+ get: function() {
9
+ return this.getPropertyValue(name);
10
+ },
11
+ enumerable: true,
12
+ configurable: true,
13
+ };
14
+ };
package/package.json CHANGED
@@ -6,13 +6,18 @@
6
6
  "CSSStyleDeclaration",
7
7
  "StyleSheet"
8
8
  ],
9
- "version": "1.1.1",
9
+ "version": "1.3.0",
10
10
  "homepage": "https://github.com/jsakas/CSSStyleDeclaration",
11
11
  "maintainers": [
12
12
  {
13
13
  "name": "Jon Sakas",
14
14
  "email": "jon.sakas@gmail.com",
15
- "url": "http://jon.sakas.co/"
15
+ "url": "https://jon.sakas.co/"
16
+ },
17
+ {
18
+ "name": "Rafał Ruciński",
19
+ "email": "fatfisz@gmail.com",
20
+ "url": "https://fatfisz.com"
16
21
  }
17
22
  ],
18
23
  "contributors": [
@@ -20,16 +25,6 @@
20
25
  "name": "Chad Walker",
21
26
  "email": "chad@chad-cat-lore-eddie.com",
22
27
  "url": "https://github.com/chad3814"
23
- },
24
- {
25
- "name": "Nikita Vasilyev",
26
- "email": "me@elv1s.ru"
27
- },
28
- {
29
- "name": "Davide P. Cervone"
30
- },
31
- {
32
- "name": "Forbes Lindesay"
33
28
  }
34
29
  ],
35
30
  "repository": "jsakas/CSSStyleDeclaration",
@@ -39,19 +34,36 @@
39
34
  },
40
35
  "main": "./lib/CSSStyleDeclaration.js",
41
36
  "dependencies": {
42
- "cssom": "0.3.x"
37
+ "cssom": "~0.3.6"
43
38
  },
44
39
  "devDependencies": {
45
- "babel-generator": "~6.11.4",
46
- "babel-traverse": "~6.13.0",
47
- "babel-types": "~6.13.0",
48
- "babylon": "~6.8.4",
49
- "nodeunit": "~0.8.0",
50
- "resolve": "~1.1.7"
40
+ "babel-generator": "~6.26.1",
41
+ "babel-traverse": "~6.26.0",
42
+ "babel-types": "~6.26.0",
43
+ "babylon": "~6.18.0",
44
+ "eslint": "~6.0.0",
45
+ "eslint-config-prettier": "~6.0.0",
46
+ "eslint-plugin-prettier": "~3.1.0",
47
+ "jest": "^24.8.0",
48
+ "npm-run-all": "^4.1.5",
49
+ "prettier": "~1.18.0",
50
+ "request": "^2.88.0",
51
+ "resolve": "~1.11.1"
51
52
  },
52
53
  "scripts": {
53
- "test": "node ./scripts/generate_properties.js && node ./scripts/generate_valid_properties.js && nodeunit tests",
54
- "prepare": "node ./scripts/generate_properties.js && node ./scripts/generate_valid_properties.js"
54
+ "download": "node ./scripts/download_latest_properties.js && eslint lib/allProperties.js --fix",
55
+ "generate": "run-p generate:*",
56
+ "generate:implemented_properties": "node ./scripts/generate_implemented_properties.js",
57
+ "generate:properties": "node ./scripts/generate_properties.js",
58
+ "lint": "npm run generate && eslint . --max-warnings 0",
59
+ "lint:fix": "eslint . --fix --max-warnings 0",
60
+ "prepublishOnly": "npm run lint && npm run test",
61
+ "test": "npm run generate && jest",
62
+ "test-ci": "npm run lint && npm run test && codecov",
63
+ "update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS"
55
64
  },
56
- "license": "MIT"
65
+ "license": "MIT",
66
+ "engines": {
67
+ "node": ">=8"
68
+ }
57
69
  }
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * W3C provides JSON list of all CSS properties and their status in the standard
5
+ *
6
+ * documentation: https://www.w3.org/Style/CSS/all-properties.en.html
7
+ * JSON url: ( https://www.w3.org/Style/CSS/all-properties.en.json )
8
+ *
9
+ * Download that file, filter out duplicates and filter the properties based on the wanted standard level
10
+ *
11
+ * ED - Editors' Draft (not a W3C Technical Report)
12
+ * FPWD - First Public Working Draft
13
+ * WD - Working Draft
14
+ * LC - Last Call Working Draft
15
+ * CR - Candidate Recommendation
16
+ * PR - Proposed Recommendation
17
+ * REC - Recommendation
18
+ * NOTE - Working Group Note
19
+ */
20
+
21
+ var fs = require('fs');
22
+ var path = require('path');
23
+
24
+ var request = require('request');
25
+
26
+ const { camelToDashed } = require('../lib/parsers');
27
+
28
+ var url = 'https://www.w3.org/Style/CSS/all-properties.en.json';
29
+
30
+ console.log('Downloading CSS properties...');
31
+
32
+ function toCamelCase(propName) {
33
+ return propName.replace(/-([a-z])/g, function(g) {
34
+ return g[1].toUpperCase();
35
+ });
36
+ }
37
+
38
+ request(url, function(error, response, body) {
39
+ if (!error && response.statusCode === 200) {
40
+ var allCSSProperties = JSON.parse(body);
41
+
42
+ // Filter out all properties newer than Working Draft
43
+ var workingDraftAndOlderProperties = allCSSProperties.filter(function(cssProp) {
44
+ // TODO: --* css Needs additional logic to this module, so filter it out for now
45
+ return cssProp.status !== 'ED' && cssProp.status !== 'FPWD' && cssProp.property !== '--*';
46
+ });
47
+
48
+ // Remove duplicates, there can be many properties in different states of standard
49
+ // and add only property names to the list
50
+ var CSSpropertyNames = [];
51
+ workingDraftAndOlderProperties.forEach(function(cssProp) {
52
+ const camelCaseName = toCamelCase(cssProp.property);
53
+
54
+ if (CSSpropertyNames.indexOf(camelCaseName) === -1) {
55
+ CSSpropertyNames.push(camelCaseName);
56
+ }
57
+ });
58
+
59
+ var out_file = fs.createWriteStream(path.resolve(__dirname, './../lib/allProperties.js'), {
60
+ encoding: 'utf-8',
61
+ });
62
+
63
+ var date_today = new Date();
64
+ out_file.write(
65
+ "'use strict';\n\n// autogenerated - " +
66
+ (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
67
+ '\n\n'
68
+ );
69
+ out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
70
+
71
+ out_file.write('var allProperties = new Set();\n');
72
+ out_file.write('module.exports = allProperties;\n');
73
+
74
+ CSSpropertyNames.forEach(function(property) {
75
+ out_file.write('allProperties.add(' + JSON.stringify(camelToDashed(property)) + ');\n');
76
+ });
77
+
78
+ out_file.end(function(err) {
79
+ if (err) {
80
+ throw err;
81
+ }
82
+
83
+ console.log('Generated ' + Object.keys(CSSpropertyNames).length + ' properties.');
84
+ });
85
+ } else {
86
+ throw error;
87
+ }
88
+ });
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const t = require('babel-types');
6
+ const generate = require('babel-generator').default;
7
+ const camelToDashed = require('../lib/parsers').camelToDashed;
8
+
9
+ const dashedProperties = fs
10
+ .readdirSync(path.resolve(__dirname, '../lib/properties'))
11
+ .filter(propertyFile => propertyFile.substr(-3) === '.js')
12
+ .map(propertyFile => camelToDashed(propertyFile.replace('.js', '')));
13
+
14
+ const out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/implementedProperties.js'), {
15
+ encoding: 'utf-8',
16
+ });
17
+ var date_today = new Date();
18
+ out_file.write(
19
+ "'use strict';\n\n// autogenerated - " +
20
+ (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
21
+ '\n\n'
22
+ );
23
+ out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
24
+
25
+ const statements = [];
26
+ statements.push(
27
+ t.variableDeclaration('var', [
28
+ t.variableDeclarator(
29
+ t.identifier('implementedProperties'),
30
+ t.newExpression(t.identifier('Set'), [])
31
+ ),
32
+ ])
33
+ );
34
+
35
+ dashedProperties.forEach(property => {
36
+ statements.push(
37
+ t.expressionStatement(
38
+ t.callExpression(
39
+ t.memberExpression(t.identifier('implementedProperties'), t.identifier('add')),
40
+ [t.stringLiteral(property)]
41
+ )
42
+ )
43
+ );
44
+ });
45
+
46
+ statements.push(
47
+ t.expressionStatement(
48
+ t.assignmentExpression(
49
+ '=',
50
+ t.memberExpression(t.identifier('module'), t.identifier('exports')),
51
+ t.identifier('implementedProperties')
52
+ )
53
+ )
54
+ );
55
+
56
+ out_file.write(generate(t.program(statements)).code + '\n');
57
+ out_file.end(function(err) {
58
+ if (err) {
59
+ throw err;
60
+ }
61
+ });
@@ -18,31 +18,39 @@ function getUniqueIndex() {
18
18
  return uniqueIndex++;
19
19
  }
20
20
 
21
- var property_files = fs.readdirSync(path.resolve(__dirname, '../lib/properties')).filter(function (property) {
21
+ var property_files = fs
22
+ .readdirSync(path.resolve(__dirname, '../lib/properties'))
23
+ .filter(function(property) {
22
24
  return property.substr(-3) === '.js';
25
+ });
26
+ var out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/properties.js'), {
27
+ encoding: 'utf-8',
23
28
  });
24
- var out_file = fs.createWriteStream(path.resolve(__dirname, '../lib/properties.js'), {encoding: 'utf-8'});
25
-
26
- out_file.write('\'use strict\';\n\n// autogenerated\n\n');
27
- out_file.write('/*\n *\n * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties\n */\n\n');
29
+ var date_today = new Date();
30
+ out_file.write(
31
+ "'use strict';\n\n// autogenerated - " +
32
+ (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
33
+ '\n\n'
34
+ );
35
+ out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
28
36
 
29
37
  function isModuleDotExports(node) {
30
38
  return (
31
- t.isMemberExpression(node, {computed: false}) &&
32
- t.isIdentifier(node.object, {name: 'module'}) &&
33
- t.isIdentifier(node.property, {name: 'exports'})
39
+ t.isMemberExpression(node, { computed: false }) &&
40
+ t.isIdentifier(node.object, { name: 'module' }) &&
41
+ t.isIdentifier(node.property, { name: 'exports' })
34
42
  );
35
43
  }
36
44
  function isRequire(node, filename) {
37
45
  if (
38
46
  t.isCallExpression(node) &&
39
- t.isIdentifier(node.callee, {name: 'require'}) &&
47
+ t.isIdentifier(node.callee, { name: 'require' }) &&
40
48
  node.arguments.length === 1 &&
41
49
  t.isStringLiteral(node.arguments[0])
42
50
  ) {
43
51
  var relative = node.arguments[0].value;
44
- var fullPath = resolve.sync(relative, {basedir: dirname(filename)});
45
- return {relative: relative, fullPath: fullPath};
52
+ var fullPath = resolve.sync(relative, { basedir: dirname(filename) });
53
+ return { relative: relative, fullPath: fullPath };
46
54
  } else {
47
55
  return false;
48
56
  }
@@ -50,26 +58,26 @@ function isRequire(node, filename) {
50
58
 
51
59
  // step 1: parse all files and figure out their dependencies
52
60
  var parsedFilesByPath = {};
53
- property_files.map(function (property) {
54
- var filename = path.resolve(__dirname, '../lib/properties/' + property);
55
- var src = fs.readFileSync(filename, 'utf8');
56
- property = basename(property, '.js');
57
- var ast = babylon.parse(src);
58
- var dependencies = [];
59
- traverse(ast, {
60
- enter(path) {
61
- var r;
62
- if (r = isRequire(path.node, filename)) {
63
- dependencies.push(r.fullPath);
64
- }
61
+ property_files.map(function(property) {
62
+ var filename = path.resolve(__dirname, '../lib/properties/' + property);
63
+ var src = fs.readFileSync(filename, 'utf8');
64
+ property = basename(property, '.js');
65
+ var ast = babylon.parse(src);
66
+ var dependencies = [];
67
+ traverse(ast, {
68
+ enter(path) {
69
+ var r;
70
+ if ((r = isRequire(path.node, filename))) {
71
+ dependencies.push(r.fullPath);
65
72
  }
66
- });
67
- parsedFilesByPath[filename] = {
68
- filename: filename,
69
- property: property,
70
- ast: ast,
71
- dependencies: dependencies,
72
- };
73
+ },
74
+ });
75
+ parsedFilesByPath[filename] = {
76
+ filename: filename,
77
+ property: property,
78
+ ast: ast,
79
+ dependencies: dependencies,
80
+ };
73
81
  });
74
82
 
75
83
  // step 2: serialize the files in an order where dependencies are always above
@@ -81,7 +89,10 @@ function addFile(filename, dependencyPath) {
81
89
  if (dependencyPath.indexOf(filename) !== -1) {
82
90
  throw new Error(
83
91
  'Circular dependency: ' +
84
- dependencyPath.slice(dependencyPath.indexOf(filename)).concat([filename]).join(' -> ')
92
+ dependencyPath
93
+ .slice(dependencyPath.indexOf(filename))
94
+ .concat([filename])
95
+ .join(' -> ')
85
96
  );
86
97
  }
87
98
  var file = parsedFilesByPath[filename];
@@ -91,14 +102,14 @@ function addFile(filename, dependencyPath) {
91
102
  if (!file) {
92
103
  externalDependencies.push(filename);
93
104
  } else {
94
- file.dependencies.forEach(function (dependency) {
105
+ file.dependencies.forEach(function(dependency) {
95
106
  addFile(dependency, dependencyPath.concat([filename]));
96
107
  });
97
108
  parsedFiles.push(parsedFilesByPath[filename]);
98
109
  }
99
110
  addedFiles[filename] = true;
100
111
  }
101
- Object.keys(parsedFilesByPath).forEach(function (filename) {
112
+ Object.keys(parsedFilesByPath).forEach(function(filename) {
102
113
  addFile(filename, []);
103
114
  });
104
115
  // Step 3: add files to output
@@ -106,50 +117,37 @@ Object.keys(parsedFilesByPath).forEach(function (filename) {
106
117
  // and updating require calls as appropriate
107
118
  var moduleExportsByPath = {};
108
119
  var statements = [];
109
- externalDependencies.forEach(function (filename, i) {
120
+ externalDependencies.forEach(function(filename, i) {
110
121
  var id = t.identifier(
111
- 'external_dependency_' +
112
- basename(filename, '.js').replace(/[^A-Za-z]/g, '') +
113
- '_' + i
122
+ 'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i
114
123
  );
115
- moduleExportsByPath[filename] = {defaultExports: id};
124
+ moduleExportsByPath[filename] = { defaultExports: id };
116
125
  var relativePath = path.relative(path.resolve(__dirname + '/../lib'), filename);
117
126
  if (relativePath[0] !== '.') {
118
127
  relativePath = './' + relativePath;
119
128
  }
120
- statements.push(t.variableDeclaration(
121
- 'var',
122
- [
129
+ statements.push(
130
+ t.variableDeclaration('var', [
123
131
  t.variableDeclarator(
124
132
  id,
125
- t.callExpression(
126
- t.identifier('require'),
127
- [
128
- t.stringLiteral(
129
- relativePath
130
- )
131
- ]
132
- )
133
- )
134
- ]
135
- ));
133
+ t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)])
134
+ ),
135
+ ])
136
+ );
136
137
  });
137
138
  function getRequireValue(node, file) {
138
- var r;
139
+ var r, e;
139
140
  // replace require("./foo").bar with the named export from foo
140
141
  if (
141
- t.isMemberExpression(node, {computed: false}) &&
142
+ t.isMemberExpression(node, { computed: false }) &&
142
143
  (r = isRequire(node.object, file.filename))
143
144
  ) {
144
- var e = moduleExportsByPath[r.fullPath];
145
+ e = moduleExportsByPath[r.fullPath];
145
146
  if (!e) {
146
147
  return;
147
148
  }
148
149
  if (!e.namedExports) {
149
- return t.memberExpression(
150
- e.defaultExports,
151
- node.property
152
- );
150
+ return t.memberExpression(e.defaultExports, node.property);
153
151
  }
154
152
  if (!e.namedExports[node.property.name]) {
155
153
  throw new Error(r.relative + ' does not export ' + node.property.name);
@@ -157,8 +155,8 @@ function getRequireValue(node, file) {
157
155
  return e.namedExports[node.property.name];
158
156
 
159
157
  // replace require("./foo") with the default export of foo
160
- } else if (r = isRequire(node, file.filename)) {
161
- var e = moduleExportsByPath[r.fullPath];
158
+ } else if ((r = isRequire(node, file.filename))) {
159
+ e = moduleExportsByPath[r.fullPath];
162
160
  if (!e) {
163
161
  if (/^\.\.\//.test(r.relative)) {
164
162
  node.arguments[0].value = r.relative.substr(1);
@@ -168,7 +166,7 @@ function getRequireValue(node, file) {
168
166
  return e.defaultExports;
169
167
  }
170
168
  }
171
- parsedFiles.forEach(function (file) {
169
+ parsedFiles.forEach(function(file) {
172
170
  var namedExports = {};
173
171
  var localVariableMap = {};
174
172
 
@@ -176,7 +174,7 @@ parsedFiles.forEach(function (file) {
176
174
  enter(path) {
177
175
  // replace require calls with the corresponding value
178
176
  var r;
179
- if (r = getRequireValue(path.node, file)) {
177
+ if ((r = getRequireValue(path.node, file))) {
180
178
  path.replaceWith(r);
181
179
  return;
182
180
  }
@@ -190,21 +188,21 @@ parsedFiles.forEach(function (file) {
190
188
  (r = getRequireValue(path.node.declarations[0].init, file))
191
189
  ) {
192
190
  var newName = 'compiled_local_variable_reference_' + getUniqueIndex();
193
- path.scope.rename(
194
- path.node.declarations[0].id.name,
195
- newName
196
- );
191
+ path.scope.rename(path.node.declarations[0].id.name, newName);
197
192
  localVariableMap[newName] = r;
198
193
  path.remove();
199
194
  return;
200
195
  }
201
196
 
197
+ // rename all top level functions to keep them local to the module
198
+ if (t.isFunctionDeclaration(path.node) && t.isProgram(path.parent)) {
199
+ path.scope.rename(path.node.id.name, file.property + '_local_fn_' + path.node.id.name);
200
+ return;
201
+ }
202
+
202
203
  // rename all top level variables to keep them local to the module
203
- if (
204
- t.isVariableDeclaration(path.node) &&
205
- t.isProgram(path.parent)
206
- ) {
207
- path.node.declarations.forEach(function (declaration) {
204
+ if (t.isVariableDeclaration(path.node) && t.isProgram(path.parent)) {
205
+ path.node.declarations.forEach(function(declaration) {
208
206
  path.scope.rename(
209
207
  declaration.id.name,
210
208
  file.property + '_local_var_' + declaration.id.name
@@ -215,7 +213,7 @@ parsedFiles.forEach(function (file) {
215
213
 
216
214
  // replace module.exports.bar with a variable for the named export
217
215
  if (
218
- t.isMemberExpression(path.node, {computed: false}) &&
216
+ t.isMemberExpression(path.node, { computed: false }) &&
219
217
  isModuleDotExports(path.node.object)
220
218
  ) {
221
219
  var name = path.node.property.name;
@@ -223,7 +221,7 @@ parsedFiles.forEach(function (file) {
223
221
  path.replaceWith(identifier);
224
222
  namedExports[name] = identifier;
225
223
  }
226
- }
224
+ },
227
225
  });
228
226
  traverse(file.ast, {
229
227
  enter(path) {
@@ -233,25 +231,29 @@ parsedFiles.forEach(function (file) {
233
231
  ) {
234
232
  path.replaceWith(localVariableMap[path.node.name]);
235
233
  }
236
- }
234
+ },
237
235
  });
238
- var defaultExports = t.objectExpression(Object.keys(namedExports).map(function (name) {
239
- return t.objectProperty(t.identifier(name), namedExports[name]);
240
- }));
236
+ var defaultExports = t.objectExpression(
237
+ Object.keys(namedExports).map(function(name) {
238
+ return t.objectProperty(t.identifier(name), namedExports[name]);
239
+ })
240
+ );
241
241
  moduleExportsByPath[file.filename] = {
242
242
  namedExports: namedExports,
243
- defaultExports: defaultExports
243
+ defaultExports: defaultExports,
244
244
  };
245
- statements.push(t.variableDeclaration(
246
- 'var',
247
- Object.keys(namedExports).map(function (name) {
248
- return t.variableDeclarator(namedExports[name]);
249
- })
250
- ))
245
+ statements.push(
246
+ t.variableDeclaration(
247
+ 'var',
248
+ Object.keys(namedExports).map(function(name) {
249
+ return t.variableDeclarator(namedExports[name]);
250
+ })
251
+ )
252
+ );
251
253
  statements.push.apply(statements, file.ast.program.body);
252
254
  });
253
255
  var propertyDefinitions = [];
254
- parsedFiles.forEach(function (file) {
256
+ parsedFiles.forEach(function(file) {
255
257
  var dashed = camelToDashed(file.property);
256
258
  propertyDefinitions.push(
257
259
  t.objectProperty(
@@ -261,42 +263,30 @@ parsedFiles.forEach(function (file) {
261
263
  );
262
264
  if (file.property !== dashed) {
263
265
  propertyDefinitions.push(
264
- t.objectProperty(
265
- t.stringLiteral(dashed),
266
- t.identifier(file.property + '_export_definition')
267
- )
266
+ t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition'))
268
267
  );
269
268
  }
270
269
  });
271
270
  var definePropertiesCall = t.callExpression(
272
- t.memberExpression(
273
- t.identifier('Object'),
274
- t.identifier('defineProperties')
275
- ),
276
- [
277
- t.identifier('prototype'),
278
- t.objectExpression(
279
- propertyDefinitions
280
- )
281
- ]
271
+ t.memberExpression(t.identifier('Object'), t.identifier('defineProperties')),
272
+ [t.identifier('prototype'), t.objectExpression(propertyDefinitions)]
282
273
  );
283
- statements.push(t.expressionStatement(
284
- t.assignmentExpression(
285
- '=',
286
- t.memberExpression(
287
- t.identifier('module'),
288
- t.identifier('exports')
289
- ),
290
- t.functionExpression(
291
- null,
292
- [t.identifier('prototype')],
293
- t.blockStatement([t.expressionStatement(definePropertiesCall)])
274
+ statements.push(
275
+ t.expressionStatement(
276
+ t.assignmentExpression(
277
+ '=',
278
+ t.memberExpression(t.identifier('module'), t.identifier('exports')),
279
+ t.functionExpression(
280
+ null,
281
+ [t.identifier('prototype')],
282
+ t.blockStatement([t.expressionStatement(definePropertiesCall)])
283
+ )
294
284
  )
295
285
  )
296
- ));
297
- out_file.write(generate(t.program(statements)).code + '\n')
298
- out_file.end(function (err) {
299
- if (err) {
300
- throw err;
301
- }
286
+ );
287
+ out_file.write(generate(t.program(statements)).code + '\n');
288
+ out_file.end(function(err) {
289
+ if (err) {
290
+ throw err;
291
+ }
302
292
  });
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.definition = {
4
- set: function (v) {
5
- this._setProperty('align-content', v);
6
- },
7
- get: function () {
8
- return this.getPropertyValue('align-content');
9
- },
10
- enumerable: true,
11
- configurable: true
12
- };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.definition = {
4
- set: function (v) {
5
- this._setProperty('align-items', v);
6
- },
7
- get: function () {
8
- return this.getPropertyValue('align-items');
9
- },
10
- enumerable: true,
11
- configurable: true
12
- };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.definition = {
4
- set: function (v) {
5
- this._setProperty('alignment-baseline', v);
6
- },
7
- get: function () {
8
- return this.getPropertyValue('alignment-baseline');
9
- },
10
- enumerable: true,
11
- configurable: true
12
- };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.definition = {
4
- set: function (v) {
5
- this._setProperty('background-clip', v);
6
- },
7
- get: function () {
8
- return this.getPropertyValue('background-clip');
9
- },
10
- enumerable: true,
11
- configurable: true
12
- };