Skip to content

Commit

Permalink
Add pluginName to esbuild messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Apr 29, 2021
1 parent d2f3fa3 commit 3b0ad6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lib/integration/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ var eol = /\r\n|\r|\n|\u2028|\u2029/g
* @return {Plugin}
*/
export function esbuild(options) {
var name = 'esbuild-xdm'
var {extnames, process} = createFormatAwareProcessors(options)

return {name: 'esbuild-xdm', setup}
return {name, setup}

/**
* @param {PluginBuild} build
Expand Down Expand Up @@ -100,6 +101,7 @@ export function esbuild(options) {
match = eol.exec(doc)
lineEnd = match ? match.index : doc.length
;(message.fatal ? errors : warnings).push({
pluginName: name,
text: message.reason,
notes: [],
location: {
Expand Down
24 changes: 16 additions & 8 deletions test/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
pluginName: 'esbuild-xdm',
text:
'[esbuild-xdm] Unexpected character `/` (U+002F) before local name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a link in MDX, use `[text](url)`)'
'Unexpected character `/` (U+002F) before local name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a link in MDX, use `[text](url)`)'
},
'should pass errors'
)
Expand Down Expand Up @@ -234,7 +235,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 7'
pluginName: 'esbuild-xdm',
text: '7'
}
],
warnings: [
Expand All @@ -249,7 +251,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 1'
pluginName: 'esbuild-xdm',
text: '1'
},
{
location: {
Expand All @@ -262,7 +265,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 2'
pluginName: 'esbuild-xdm',
text: '2'
},
{
location: {
Expand All @@ -275,7 +279,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 3'
pluginName: 'esbuild-xdm',
text: '3'
},
{
location: {
Expand All @@ -288,7 +293,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 4'
pluginName: 'esbuild-xdm',
text: '4'
},
{
location: {
Expand All @@ -301,7 +307,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 5'
pluginName: 'esbuild-xdm',
text: '5'
},
{
location: {
Expand All @@ -314,7 +321,8 @@ test('xdm (esbuild)', async function (t) {
suggestion: ''
},
notes: [],
text: '[esbuild-xdm] 6'
pluginName: 'esbuild-xdm',
text: '6'
}
]
},
Expand Down

0 comments on commit 3b0ad6e

Please sign in to comment.