Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[WIP] [BREAKING] add this.warn method to plugin contexts
- Loading branch information
Showing
14 changed files
with
172 additions
and
98 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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,29 @@ | ||
const path = require( 'path' ); | ||
|
||
module.exports = { | ||
description: 'plugin transform hooks can use `this.error({...}, char)` (#1140)', | ||
options: { | ||
plugins: [{ | ||
name: 'test', | ||
transform ( code, id ) { | ||
this.error( 'nope', 22 ); | ||
} | ||
}] | ||
}, | ||
error: { | ||
code: 'PLUGIN_ERROR', | ||
plugin: 'test', | ||
message: 'nope', | ||
id: path.resolve( __dirname, 'main.js' ), | ||
pos: 22, | ||
loc: { | ||
file: path.resolve( __dirname, 'main.js' ), | ||
line: 1, | ||
column: 22 | ||
}, | ||
frame: ` | ||
1: assert.equal( 21 * 2, TK ); | ||
^ | ||
` | ||
} | ||
}; |
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 @@ | ||
assert.equal( 21 * 2, TK ); |
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,39 @@ | ||
const path = require( 'path' ); | ||
|
||
module.exports = { | ||
description: 'plugin transform hooks can use `this.warn({...}, char)` (#1140)', | ||
options: { | ||
plugins: [{ | ||
name: 'test', | ||
transform ( code, id ) { | ||
this.warn({ message: 'foo' }); | ||
this.warn( 'bar', 22 ); | ||
return 'assert.equal( 21 * 2, 42 );'; | ||
} | ||
}] | ||
}, | ||
warnings: [ | ||
{ | ||
code: 'PLUGIN_WARNING', | ||
id: path.resolve( __dirname, 'main.js' ), | ||
plugin: 'test', | ||
message: 'foo' | ||
}, | ||
{ | ||
code: 'PLUGIN_WARNING', | ||
id: path.resolve( __dirname, 'main.js' ), | ||
plugin: 'test', | ||
message: 'bar', | ||
pos: 22, | ||
loc: { | ||
file: path.resolve( __dirname, 'main.js' ), | ||
line: 1, | ||
column: 22 | ||
}, | ||
frame: ` | ||
1: assert.equal( 21 * 2, TK ); | ||
^ | ||
` | ||
} | ||
] | ||
}; |
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 @@ | ||
assert.equal( 21 * 2, TK ); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.