0.1.7 • Published 7 years ago

ts-module-opt v0.1.7

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

compile multi-files based ts module into same scope

first it generate a index ts file that contains all the reference file paths of this module

the it compile a js from the generated ts file

install

npm install -g ts-module-opt

compile a module directory

ts-module-opt -r typings/index.d.ts src

compile multiple module directories, generate a js file for each module

ts-module-opt -r typings/index.d.ts modulePath1 modulePath2

parameters

  • --reference {path}: add a reference file path to the tsc compiler
    • or -r {path}
  • --target es5: change the tsc targert to es5, default is es6
    • or -t es5
  • --declaration: generate the typescript declaration file (.d.ts)
    • or -d
  • --sourceMap: generate the source map

benifits

  • a main ts file is generate for the directory to maintain all the reference paths
  • all module files are compiled into same scope
  • exported types are compiled into same scope in the declaration
  • reference to ModuleName.TypeName is optimited to just TypeName when they are in same module

limitations

  • require tsc to be in system path
  • all typescript files in directory need to be in same module
  • if a type need to be used in a different file, that type must be exported even these files are in same module
  • resolving dependency might not be 100% correct, and it requires the ts source code to use 4 spaces padding
0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago