-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: parse extended tsconfigs when transpiling script blocks (#502)
* fix(tsconfig): parse extended tsconfigs when transpiling script blocks A change introduced in v28.1.0 in PR #471 unintentionally changed the behavior of the tsconfig parsing such that configs using "extends" were no longer being considered. Fixes: #495 * chore(cache): cache tsconfig parsing to avoid the cost per vue file / interpolated string Co-authored-by: Adam Hines <[email protected]>
- Loading branch information
1 parent
62d6ebc
commit bb516da
Showing
16 changed files
with
220 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<template> | ||
<div> | ||
{{ exclamationMarks }} | ||
<type-script-child /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import TypeScriptChild from './TypeScriptChild.vue' | ||
import moduleRequiringEsModuleInterop from './ModuleRequiringEsModuleInterop' | ||
// The default import above relies on esModuleInterop being set to true in order to use it from | ||
// an import statement instead of require. This option is configured in the tsconfig.base.json, | ||
// so if we are no longer fully processing the tsconfig options (extended from a base config) | ||
// this test should fail. This was one of the only reliable ways I could get a test to fail if | ||
// these conditions are not being met and happen to be the use-case which was triggering errors | ||
// in my config setup. | ||
if (moduleRequiringEsModuleInterop()) { | ||
throw new Error('Should never hit this') | ||
} | ||
export default { | ||
computed: { | ||
exclamationMarks(): string { | ||
return 'string' | ||
} | ||
}, | ||
components: { | ||
TypeScriptChild | ||
} | ||
} | ||
</script> |
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 @@ | ||
module.exports = () => false |
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,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "es6"], | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"types": ["vue-typescript-import-dts", "node"], | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"allowSyntheticDefaultImports": true, | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"allowJs": true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,20 +1,3 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "es6"], | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"types": ["vue-typescript-import-dts", "node"], | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"allowSyntheticDefaultImports": true, | ||
"sourceMap": true, | ||
"allowJs": true | ||
} | ||
"extends": "./tsconfig.base.json" | ||
} |
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,34 @@ | ||
<template> | ||
<div> | ||
{{ exclamationMarks }} | ||
<type-script-child /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import TypeScriptChild from './TypeScriptChild.vue' | ||
import moduleRequiringEsModuleInterop from './ModuleRequiringEsModuleInterop' | ||
// The default import above relies on esModuleInterop being set to true in order to use it from | ||
// an import statement instead of require. This option is configured in the tsconfig.base.json, | ||
// so if we are no longer fully processing the tsconfig options (extended from a base config) | ||
// this test should fail. This was one of the only reliable ways I could get a test to fail if | ||
// these conditions are not being met and happen to be the use-case which was triggering errors | ||
// in my config setup. | ||
if (moduleRequiringEsModuleInterop()) { | ||
throw new Error('Should never hit this') | ||
} | ||
export default { | ||
computed: { | ||
exclamationMarks(): string { | ||
return 'string' | ||
} | ||
}, | ||
components: { | ||
TypeScriptChild | ||
} | ||
} | ||
</script> |
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 @@ | ||
module.exports = () => false |
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,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "es6"], | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"types": ["vue-typescript-import-dts", "node"], | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"allowSyntheticDefaultImports": true, | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"allowJs": true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,20 +1,3 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "es6"], | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"types": ["vue-typescript-import-dts", "node"], | ||
"isolatedModules": false, | ||
"experimentalDecorators": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"allowSyntheticDefaultImports": true, | ||
"sourceMap": true, | ||
"allowJs": true | ||
} | ||
"extends": "./tsconfig.base.json" | ||
} |
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,3 @@ | ||
module.exports = function throwError(msg) { | ||
throw new Error('\n[vue-jest] Error: ' + msg + '\n') | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function throwError(msg) { | ||
throw new Error('\n[vue-jest] Error: ' + msg + '\n') | ||
} |
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