This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[scopes] Handle edge-case mappings that come up in TS and other misc …
…bugs (#6092)
- Loading branch information
1 parent
259f18e
commit f6aad4e
Showing
20 changed files
with
1,027 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/mochitest/examples/babel/fixtures/ts-classes/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// This file essentially reproduces an example Angular component to map testing, | ||
// among other typescript edge cases. | ||
|
||
import { decoratorFactory } from './src/mod.ts'; | ||
|
||
@decoratorFactory({ | ||
selector: 'app-root', | ||
}) | ||
export class AppComponent { | ||
title = 'app'; | ||
} | ||
|
||
const fn = arg => { | ||
console.log("here"); | ||
}; | ||
fn("arg"); | ||
|
||
// Un-decorated exported classes present a mapping challege because | ||
// the class name is mapped to an unhelpful export assignment. | ||
export class ExportedOther { | ||
title = 'app'; | ||
} | ||
|
||
class AnotherThing { | ||
prop = 4; | ||
} | ||
|
||
const anyWindow = (<any>window); | ||
anyWindow.Promise.resolve().then(() => { | ||
anyWindow.tsClasses = function() { | ||
// This file is specifically for testing the mappings of classes and things | ||
// above, which means we don't want to include _other_ references to then. | ||
// To avoid having them be optimized out, we include a no-op eval. | ||
eval(""); | ||
|
||
console.log("pause here"); | ||
}; | ||
}); |
143 changes: 143 additions & 0 deletions
143
src/test/mochitest/examples/babel/fixtures/ts-classes/output.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/test/mochitest/examples/babel/fixtures/ts-classes/output.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/test/mochitest/examples/babel/fixtures/ts-classes/src/mod.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
export function decoratorFactory(opts: { selector: string }) { | ||
return function decorator(target) { | ||
return <any>target; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"experimentalDecorators": true | ||
}, | ||
"include": [ | ||
"fixtures/*/input.ts", | ||
"fixtures/*/src/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.