File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " style-parser" ,
3- "version" : " 1.0.1 " ,
3+ "version" : " 1.0.0 " ,
44 "description" : " After Effects Expression Library" ,
55 "main" : " dist/style-parser.jsx" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ type ParsedSection = {
66
77function parseStyles (
88 inputText : string ,
9- customParsers : Array < { matcher : RegExp ; stylename : string } >
9+ customParsers : Array < { matcher : RegExp ; stylename : string } > = [ ]
1010) {
1111 /** Split the input text into an array of lines */
1212 const inputLines = inputText . split ( / [ \r \n \3] / g) ;
@@ -42,7 +42,8 @@ function parseStyles(
4242 } ;
4343 }
4444
45- const parsers = customParsers ?? [
45+ const parsers = [
46+ ...customParsers ,
4647 { stylename : 'bold' , matcher : new RegExp ( / \* ( .* ) \* / ) } ,
4748 { stylename : 'italics' , matcher : new RegExp ( / _ ( .* ) _ / ) } ,
4849 ] ;
@@ -63,9 +64,14 @@ function parseStyles(
6364 return parsedStyles . flat ( ) ;
6465}
6566
67+ const defaultFontMap = {
68+ bold : 'Arial-BoldMT' ,
69+ italics : 'Arial-ItalicMT' ,
70+ } ;
71+
6672// '_npmVersion' is replaced with value from package.json
6773// during compilation
6874const version : string = '_npmVersion' ;
6975
7076// Export values to appear in jsx files
71- export { parseStyles , version } ;
77+ export { parseStyles , defaultFontMap , version } ;
You can’t perform that action at this time.
0 commit comments