Skip to content

Commit 28c4f32

Browse files
committed
Merge branch 'master' into destructuringEvaluationOrder
2 parents 7393dba + d1f87d1 commit 28c4f32

File tree

135 files changed

+5032
-2452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+5032
-2452
lines changed

package-lock.json

Lines changed: 98 additions & 325 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler/binder.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ namespace ts {
174174
const binder = createBinder();
175175

176176
export function bindSourceFile(file: SourceFile, options: CompilerOptions) {
177-
tracing.begin(tracing.Phase.Bind, "bindSourceFile", { path: file.path });
177+
const tracingData: tracing.EventData = [tracing.Phase.Bind, "bindSourceFile", { path: file.path }];
178+
tracing.begin(...tracingData);
178179
performance.mark("beforeBind");
179180
perfLogger.logStartBindFile("" + file.fileName);
180181
binder(file, options);
181182
perfLogger.logStopBindFile();
182183
performance.mark("afterBind");
183184
performance.measure("Bind", "beforeBind", "afterBind");
184-
tracing.end();
185+
tracing.end(...tracingData);
185186
}
186187

187188
function createBinder(): (file: SourceFile, options: CompilerOptions) => void {

src/compiler/checker.ts

Lines changed: 54 additions & 41 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,11 @@ namespace ts {
11341134
name: "exclude",
11351135
type: "string"
11361136
}
1137-
}
1137+
},
1138+
{
1139+
name: "disableFilenameBasedTypeAcquisition",
1140+
type: "boolean",
1141+
},
11381142
];
11391143

11401144
/* @internal */

src/compiler/emitter.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,17 @@ namespace ts {
300300
sourceFiles: sourceFileOrBundle.sourceFiles.map(file => relativeToBuildInfo(getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory())))
301301
};
302302
}
303-
tracing.begin(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath });
303+
tracing.push(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath });
304304
emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo);
305-
tracing.end();
305+
tracing.pop();
306306

307-
tracing.begin(tracing.Phase.Emit, "emitDeclarationFileOrBundle", { declarationFilePath });
307+
tracing.push(tracing.Phase.Emit, "emitDeclarationFileOrBundle", { declarationFilePath });
308308
emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo);
309-
tracing.end();
309+
tracing.pop();
310310

311-
tracing.begin(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
311+
tracing.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
312312
emitBuildInfo(bundleBuildInfo, buildInfoPath);
313-
tracing.end();
313+
tracing.pop();
314314

315315
if (!emitSkipped && emittedFilesList) {
316316
if (!emitOnlyDtsFiles) {
@@ -606,18 +606,19 @@ namespace ts {
606606
if (getRootLength(sourceMapDir) === 0) {
607607
// The relative paths are relative to the common directory
608608
sourceMapDir = combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
609-
return getRelativePathToDirectoryOrUrl(
610-
getDirectoryPath(normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath
611-
combinePaths(sourceMapDir, sourceMapFile), // this is where user expects to see sourceMap
612-
host.getCurrentDirectory(),
613-
host.getCanonicalFileName,
614-
/*isAbsolutePathAnUrl*/ true);
609+
return encodeURI(
610+
getRelativePathToDirectoryOrUrl(
611+
getDirectoryPath(normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath
612+
combinePaths(sourceMapDir, sourceMapFile), // this is where user expects to see sourceMap
613+
host.getCurrentDirectory(),
614+
host.getCanonicalFileName,
615+
/*isAbsolutePathAnUrl*/ true));
615616
}
616617
else {
617-
return combinePaths(sourceMapDir, sourceMapFile);
618+
return encodeURI(combinePaths(sourceMapDir, sourceMapFile));
618619
}
619620
}
620-
return sourceMapFile;
621+
return encodeURI(sourceMapFile);
621622
}
622623
}
623624

src/compiler/factory/utilities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace ts {
4646
}
4747
}
4848

49-
function createJsxFactoryExpression(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, parent: JsxOpeningLikeElement | JsxOpeningFragment): Expression {
49+
export function createJsxFactoryExpression(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, parent: JsxOpeningLikeElement | JsxOpeningFragment): Expression {
5050
return jsxFactoryEntity ?
5151
createJsxFactoryExpressionFromEntityName(factory, jsxFactoryEntity, parent) :
5252
factory.createPropertyAccessExpression(
@@ -64,7 +64,7 @@ namespace ts {
6464
);
6565
}
6666

67-
export function createExpressionForJsxElement(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, tagName: Expression, props: Expression | undefined, children: readonly Expression[] | undefined, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression {
67+
export function createExpressionForJsxElement(factory: NodeFactory, callee: Expression, tagName: Expression, props: Expression | undefined, children: readonly Expression[] | undefined, location: TextRange): LeftHandSideExpression {
6868
const argumentsList = [tagName];
6969
if (props) {
7070
argumentsList.push(props);
@@ -88,7 +88,7 @@ namespace ts {
8888

8989
return setTextRange(
9090
factory.createCallExpression(
91-
createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parentElement),
91+
callee,
9292
/*typeArguments*/ undefined,
9393
argumentsList
9494
),

src/compiler/parser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ namespace ts {
614614
}
615615

616616
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
617-
tracing.begin(tracing.Phase.Parse, "createSourceFile", { path: fileName });
617+
const tracingData: tracing.EventData = [tracing.Phase.Parse, "createSourceFile", { path: fileName }];
618+
tracing.begin(...tracingData);
618619
performance.mark("beforeParse");
619620
let result: SourceFile;
620621

@@ -629,7 +630,7 @@ namespace ts {
629630

630631
performance.mark("afterParse");
631632
performance.measure("Parse", "beforeParse", "afterParse");
632-
tracing.end();
633+
tracing.end(...tracingData);
633634
return result;
634635
}
635636

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
/*@internal*/
22
namespace ts {
33
declare const performance: { now?(): number } | undefined;
4+
function tryGlobalPerformanceNow() { // browsers
5+
if (typeof performance !== "undefined") return () => performance.now!();
6+
}
7+
function tryNodePerformanceNow() { // node
8+
try {
9+
const perf_hooks = require("perf_hooks") as typeof import("perf_hooks");
10+
if (perf_hooks.performance) return () => perf_hooks.performance.now();
11+
}
12+
// eslint-disable-next-line no-empty
13+
catch {
14+
}
15+
}
16+
function tryDateNow() {
17+
if (Date.now) return () => Date.now();
18+
}
419
/** Gets a timestamp with (at least) ms resolution */
5-
export const timestamp = typeof performance !== "undefined" && performance.now ? () => performance.now!() : Date.now ? Date.now : () => +(new Date());
6-
}
20+
export const timestamp: () => number =
21+
tryGlobalPerformanceNow()
22+
|| tryNodePerformanceNow()
23+
|| tryDateNow()
24+
|| (() => +(new Date()));
25+
26+
}

0 commit comments

Comments
 (0)