Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single-module transpilation mode #2499

Closed
mhegazy opened this issue Mar 26, 2015 · 6 comments
Closed

Support single-module transpilation mode #2499

mhegazy opened this issue Mar 26, 2015 · 6 comments
Labels
API Relates to the public API for TypeScript Committed The team has roadmapped this issue Suggestion An idea for TypeScript

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Mar 26, 2015

The compiler does not do emit based on semantic information in most cases. this allows us to provide an api for transpiling a module that does not require typecheck or full program information. just single file syntactic transformation.
This can be helpful in multiple scenarios, including: typescript-simple (https://github.com/teppeis/typescript-simple), JSPM (#2233), es6-module-loader and as atom extensions.

A new compiler flag (--singeFileTranspilation or --disableFullProgramOptimizations for instance) that will make cases that break single file-transpilation an error namely: 1.Const enums defined in ambient modules and 2.Re-exporting types-only constructs when targeting ES6

@mhegazy mhegazy added Suggestion An idea for TypeScript In Discussion Not yet reached consensus API Relates to the public API for TypeScript labels Mar 26, 2015
@sophiajt
Copy link
Contributor

👍 though we need a good name for the flag :)

@mhegazy mhegazy added this to the TypeScript 1.5 milestone Mar 31, 2015
@vladima
Copy link
Contributor

vladima commented Mar 31, 2015

Proposed implementation #2550.
Regarding the name of the flag: we've already had a long discussion about possible names but all options were non-ideal, Some names that we've tried are: 'separateCompilation', 'singleFileEmit', 'disablGlobalOptimizations', 'safeForTranspile', 'isolated', 'singleFileScope' - we could not pick one since all of them were equally bad. What about moving from the boolean flag and instead have an enum named 'compilationMode' or 'compilationUnit' or something similar? Enum values will be 'program' and 'file' and 'program' will be default.

tsc a.ts b.ts --compilationUnit: file

@mhegazy mhegazy mentioned this issue Apr 10, 2015
@mhegazy mhegazy modified the milestones: TypeScript 1.5, TypeScript 1.5.1 Apr 23, 2015
@mhegazy mhegazy mentioned this issue Apr 27, 2015
@sophiajt sophiajt changed the title Support single-module transplantation mode Support single-module transpilation mode Apr 28, 2015
@Ciantic
Copy link

Ciantic commented May 3, 2015

Visual Studio Code does not transpile on save. And I suppose it's because TSC does not implement this. It's major pain to transpile and compile all files each time, it causes a lot of file changes and triggers many webpack/browserify processes, time from edit to F5 is really big.

Only tool doing single file transpiling at the moment is atom-typescript, but it's not using TSC for that.

Btw, it probably should be called "--singleModuleTranspile" because single file transpile is not same thing, if I understod this right.

@mhegazy
Copy link
Contributor Author

mhegazy commented May 5, 2015

@vladima we will need another check for reexporting type-only names in ES6 and in singleFile mode. we also need to update the name of the flag after the next desing meeting discussion.

@mhegazy
Copy link
Contributor Author

mhegazy commented May 19, 2015

PR #3208 renames the flag to --isolatedModules

@RyanCavanaugh RyanCavanaugh added Committed The team has roadmapped this issue and removed In Discussion Not yet reached consensus labels May 19, 2015
@mhegazy
Copy link
Contributor Author

mhegazy commented May 22, 2015

The flag has been renamed to --isolatedModules see PR #3208 for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Committed The team has roadmapped this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants