@@ -12,11 +12,12 @@ extendscriptr
1212 . option ( '-s, --script <path>' , 'The input file to compile into an executable extendscript' )
1313 . option ( '-o, --output <path>' , 'The path to the wished compiled output file' )
1414 . option ( '-t, --target [targetApp]' , 'The Adobe Application the script is intended for. i.e. InDesign [targetApp]' )
15+ . option ( '-ts, --typescript' , 'typescript mode' )
1516 . parse ( process . argv ) ;
1617
1718console . log ( 'Running extendscriptr with following options:' ) ;
1819extendscriptr . options . forEach ( function ( opt ) {
19- if ( opt . long === '--version' ) return ;
20+ if ( opt . long === '--version' ) return ;
2021 var optionName = opt . long . replace ( '--' , '' ) ;
2122 console . log (
2223 opt . long + ': ' +
@@ -25,31 +26,36 @@ extendscriptr.options.forEach(function(opt) {
2526 ) ;
2627} ) ;
2728
28- var prototypePolyfills = fs . readFileSync ( require . resolve ( 'extendscript.prototypes' ) , 'utf8' ) ;
29- var browserifyPlugins = [ [ prependify , prototypePolyfills ] ] ;
30-
3129var adobeTarget = String ( extendscriptr . target ) . toLowerCase ( ) ;
3230if ( adobeTarget &&
33- ( adobeTarget . indexOf ( 'indesign' ) >= 0 ||
34- adobeTarget . indexOf ( 'photoshop' ) >= 0 ||
35- adobeTarget . indexOf ( 'illustrator' ) >= 0 ||
36- adobeTarget . indexOf ( 'aftereffects' ) >= 0 ) ) {
37- browserifyPlugins . push ( [ prependify , '#target ' + extendscriptr . target + '\n' ] ) ;
31+ ( adobeTarget . indexOf ( 'indesign' ) >= 0 ||
32+ adobeTarget . indexOf ( 'photoshop' ) >= 0 ||
33+ adobeTarget . indexOf ( 'illustrator' ) >= 0 ||
34+ adobeTarget . indexOf ( 'aftereffects' ) >= 0 ) ) {
35+ browserifyPlugins . push ( [ prependify , '#target ' + extendscriptr . target + '\n' ] ) ;
3836}
3937
40- var b = browserify ( {
41- entries : [ extendscriptr . script ] ,
42- transform : [ [ 'babelify' , {
43- presets : [
44- 'es2015'
45- ] ,
46- plugins : [
47- 'babel-plugin-transform-es3-member-expression-literals' ,
48- 'babel-plugin-transform-es3-property-literals' ,
49- 'babel-plugin-transform-es5-property-mutators'
50- ]
51- } ] ] ,
52- plugin : browserifyPlugins
53- } ) ;
38+ if ( extendscriptr . typescript ) {
39+ console . log ( 'Typescript mode is currently under development.' ) ;
40+ return ;
41+ } else {
42+ var prototypePolyfills = fs . readFileSync ( require . resolve ( 'extendscript.prototypes' ) , 'utf8' ) ;
43+ var browserifyPlugins = [ [ prependify , prototypePolyfills ] ] ;
5444
55- b . bundle ( ) . pipe ( fs . createWriteStream ( extendscriptr . output ) ) ;
45+ var b = browserify ( {
46+ entries : [ extendscriptr . script ] ,
47+ transform : [ [ 'babelify' , {
48+ presets : [
49+ 'es2015'
50+ ] ,
51+ plugins : [
52+ 'babel-plugin-transform-es3-member-expression-literals' ,
53+ 'babel-plugin-transform-es3-property-literals' ,
54+ 'babel-plugin-transform-es5-property-mutators'
55+ ]
56+ } ] ] ,
57+ plugin : browserifyPlugins
58+ } ) ;
59+
60+ b . bundle ( ) . pipe ( fs . createWriteStream ( extendscriptr . output ) ) ;
61+ }
0 commit comments