-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new deprecation API for transform dependencies
- Loading branch information
1 parent
58114bd
commit 98cd72b
Showing
5 changed files
with
35 additions
and
46 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
19 changes: 19 additions & 0 deletions
19
test/function/samples/deprecations/transform-dependencies/_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,19 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
description: 'marks transform dependencies as deprecated', | ||
options: { | ||
plugins: { | ||
transform(code) { | ||
return { code, dependencies: [] }; | ||
} | ||
} | ||
}, | ||
error: { | ||
code: 'PLUGIN_ERROR', | ||
id: path.resolve(__dirname, 'main.js'), | ||
message: | ||
'Returning "dependencies" from the "transform" hook as done by plugin at position 1 is deprecated. The "this.addWatchFile" plugin context function should be used instead.', | ||
pluginCode: 'DEPRECATED_FEATURE' | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/function/samples/deprecations/transform-dependencies/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,11 @@ | ||
const foo = {}; | ||
|
||
function doIt(x) { | ||
if (foo[x]) { | ||
return true; | ||
} | ||
foo[x] = true; | ||
} | ||
|
||
doIt('x'); | ||
assert.ok(doIt('x'), 'foo was not reassigned'); |
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