-
-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commonjs): limit ignoreTryCatch to external requires (#1038)
- Loading branch information
1 parent
3c00191
commit 38a3aa4
Showing
13 changed files
with
139 additions
and
92 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
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
5 changes: 0 additions & 5 deletions
5
packages/commonjs/test/fixtures/form/try-catch-remove/_config.js
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
packages/commonjs/test/fixtures/form/try-catch-remove/output.js
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
packages/commonjs/test/fixtures/function/try-catch-internal/_config.js
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 @@ | ||
module.exports = { | ||
description: | ||
'inlines internal require statements in try-catch blocks even when try-catch is ignored', | ||
pluginOptions: { | ||
ignoreTryCatch: true | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/commonjs/test/fixtures/function/try-catch-internal/dep.js
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 @@ | ||
exports.foo = 'foo'; |
7 changes: 7 additions & 0 deletions
7
packages/commonjs/test/fixtures/function/try-catch-internal/main.js
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 @@ | ||
/* eslint-disable global-require */ | ||
|
||
try { | ||
t.is(require('./dep.js').foo, 'foo'); | ||
} catch (err) { | ||
throw new Error(`Could not require: ${err}`); | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/commonjs/test/fixtures/function/try-catch-remove/_config.js
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,5 @@ | ||
module.exports = { | ||
pluginOptions: { | ||
ignoreTryCatch: (id) => (id === 'uninstalled-external-module' ? 'remove' : 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
Binary file not shown.