-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Async Functions #1781
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
Async Functions #1781
Changes from 109 commits
0a889c6
def7460
96c44b3
d51b8bd
bf28560
a60cd3a
1f190ba
f8bbe78
ead809b
4fad214
7c8fd3d
4dac41a
389962b
d2bdf6e
a8c8918
dc2e6bd
938e0cd
868cf6d
6c3eace
1488944
cb4bc4f
faaf778
cfdb9ac
4ade643
155b9a5
38d2218
1de7be3
18c2d50
26c6b80
a097c2b
b4f21c4
be9653b
f330910
de210f0
701b19d
0b0703b
28799ab
8f3dd8c
c533514
a0adf6f
ae6a2af
ecfbd97
dc2a8d0
7b39c80
bad02ab
aba2aed
ecb8f9e
98378d1
0221763
53c5d26
6185092
c88dce4
e4a808c
a1b29e5
a62ea04
b042658
69c16b4
bd98edb
b4d5e0d
1aafc40
38a95f1
3e30ed1
70023dc
c21918c
20aab8e
0a7270e
4101450
efc2809
f100bfc
8a90e27
75e1de6
5b005f6
20a9a6c
cefeaf0
1d1f784
525b7d2
fa1f495
7491a72
a46fa3c
8d60e54
276ce4f
1aca763
e5a5886
b5e1efc
d8b2373
d059142
95de399
635edca
0450937
4c855df
04b19a0
5340f0c
4ac9c35
2b14c43
195c64e
0560e77
866fba7
86021eb
2e4a614
22eda41
5a34605
aaa122b
c8ec582
dd6bc44
e1bc0bd
7f6ea09
763edc6
ab3f342
aece9ae
4c132c9
60a0a49
d57fe72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,11 +38,15 @@ var compilerSources = [ | |
| "utilities.ts", | ||
| "binder.ts", | ||
| "checker.ts", | ||
| "factory.ts", | ||
| "generator.ts", | ||
| "rewriter.ts", | ||
| "emitter.ts", | ||
| "program.ts", | ||
| "commandLineParser.ts", | ||
| "tsc.ts", | ||
| "diagnosticInformationMap.generated.ts" | ||
| "diagnosticInformationMap.generated.ts", | ||
| "factory.generated.ts" | ||
| ].map(function (f) { | ||
| return path.join(compilerDirectory, f); | ||
| }); | ||
|
|
@@ -56,10 +60,14 @@ var servicesSources = [ | |
| "utilities.ts", | ||
| "binder.ts", | ||
| "checker.ts", | ||
| "factory.ts", | ||
| "generator.ts", | ||
| "rewriter.ts", | ||
| "emitter.ts", | ||
| "program.ts", | ||
| "commandLineParser.ts", | ||
| "diagnosticInformationMap.generated.ts" | ||
| "diagnosticInformationMap.generated.ts", | ||
| "factory.generated.ts" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation |
||
| ].map(function (f) { | ||
| return path.join(compilerDirectory, f); | ||
| }).concat([ | ||
|
|
@@ -140,6 +148,7 @@ var librarySourceMap = [ | |
| { target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, | ||
| { target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]}, | ||
| { target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"]}, | ||
| { target: "tslib.d.ts", sources: ["tslib.d.ts"]} | ||
| ]; | ||
|
|
||
| var libraryTargets = librarySourceMap.map(function (f) { | ||
|
|
@@ -280,10 +289,43 @@ for (var i in libraryTargets) { | |
| })(i); | ||
| } | ||
|
|
||
| // tslib | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's tslib?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An experimental feature we are adding to support async functions in ES5 and earlier. Instead of emitting the tslib.js uses a UMD (Universal Module Dependency) -like approach that makes those functions available on the global when loaded via This is an advanced feature and currently experiemental. If a developer choses to use tslib.js, they may pass the For example: import { __extends, __awaiter, __generator } from 'tslib';
class B extends A {
}Or: import { install } from 'tslib';
install();
class B extends A {
} |
||
| var tslibSource = path.join(libraryDirectory, "tslib.js"); | ||
| var tslibTarget = path.join(builtLocalDirectory, "tslib.js"); | ||
| file(tslibTarget, [builtLocalDirectory, copyright, tslibSource], function() { | ||
| concatenateFiles(tslibTarget, [copyright, tslibSource]); | ||
| }) | ||
|
|
||
| // Lib target to build the library files | ||
| desc("Builds the library targets"); | ||
| task("lib", libraryTargets); | ||
| task("lib", [tslibTarget].concat(libraryTargets)); | ||
|
|
||
| // Generate factory | ||
| var processFactoryJs = path.join(scriptsDirectory, "processFactory.js"); | ||
| var processFactoryTs = path.join(scriptsDirectory, "processFactory.ts"); | ||
| var factoryJson = path.join(compilerDirectory, "factory.json"); | ||
| var factoryGeneratedTs = path.join(compilerDirectory, "factory.generated.ts"); | ||
| file(processFactoryTs); | ||
| compileFile(processFactoryJs, [processFactoryTs], [processFactoryTs], [], /*useBuiltCompile*/ false); | ||
| file(factoryGeneratedTs, [processFactoryJs, factoryJson], function() { | ||
| var cmd = "node " + processFactoryJs + " " + factoryJson; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually I think we use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copied mostly from the diagnosticInfoMapTs task below, but I can update both. |
||
| console.log(cmd); | ||
| var ex = jake.createExec([cmd]); | ||
| // Add listeners for output and error | ||
| ex.addListener("stdout", function(output) { | ||
| process.stdout.write(output); | ||
| }); | ||
| ex.addListener("stderr", function(error) { | ||
| process.stderr.write(error); | ||
| }); | ||
| ex.addListener("cmdEnd", function() { | ||
| complete(); | ||
| }); | ||
| ex.run(); | ||
| }, { async: true }); | ||
|
|
||
| desc("Generates the node factory and visitor in TypeScript based on an input JSON file"); | ||
| task("generate-factory", [factoryGeneratedTs]); | ||
|
|
||
| // Generate diagnostics | ||
| var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation