@@ -8,28 +8,30 @@ const { dirname } = import.meta;
88const list = fs
99 . readdirSync ( path . resolve ( dirname , "../lib/properties" ) )
1010 . map ( ( file ) => [ file . replace ( / \. j s $ / , "" ) , file ] ) ;
11- const camelCasedProperties = new Map ( list ) ;
11+ const implementedProperties = new Map ( list ) ;
1212
1313const requires = [ ] ;
1414const descriptors = [ ] ;
15- for ( const [ canonicalPropertyName , { styleDeclaration } ] of propertyDefinitions ) {
15+ for ( const [ canonicalPropertyName , { legacyAliasOf , styleDeclaration } ] of propertyDefinitions ) {
1616 const camel = dashedToCamelCase ( canonicalPropertyName ) ;
17- if ( camelCasedProperties . has ( camel ) ) {
18- requires . push ( `const ${ camel } = require("../properties/${ camelCasedProperties . get ( camel ) } ");` ) ;
17+ const aliasCamel = legacyAliasOf ? dashedToCamelCase ( legacyAliasOf ) : "" ;
18+ if ( implementedProperties . has ( camel ) ) {
19+ requires . push ( `const ${ camel } = require("../properties/${ implementedProperties . get ( camel ) } ");` ) ;
1920 for ( const property of styleDeclaration ) {
2021 descriptors . push ( `"${ property } ": ${ camel } .definition` ) ;
2122 }
23+ } else if ( implementedProperties . has ( aliasCamel ) ) {
24+ for ( const property of styleDeclaration ) {
25+ descriptors . push ( `"${ property } ": ${ aliasCamel } .definition` ) ;
26+ }
2227 } else {
2328 for ( const property of styleDeclaration ) {
2429 descriptors . push ( `"${ property } ": getPropertyDescriptor("${ canonicalPropertyName } ")` ) ;
2530 }
2631 }
2732}
2833
29- const outputFile = path . resolve ( dirname , "../lib/generated/propertyDescriptors.js" ) ;
30-
31- const dateToday = new Date ( ) ;
32- const [ dateTodayFormatted ] = dateToday . toISOString ( ) . split ( "T" ) ;
34+ const [ dateTodayFormatted ] = new Date ( ) . toISOString ( ) . split ( "T" ) ;
3335const output = `"use strict";
3436// autogenerated - ${ dateTodayFormatted }
3537
@@ -41,4 +43,4 @@ module.exports = {
4143};
4244` ;
4345
44- fs . writeFileSync ( outputFile , output ) ;
46+ fs . writeFileSync ( path . resolve ( dirname , "../lib/generated/propertyDescriptors.js" ) , output ) ;
0 commit comments