Skip to content

Commit

Permalink
fixup! feat evanw#3666 add optional exclude option for plugin `onLoad…
Browse files Browse the repository at this point in the history
…` and `onResolve` hooks
  • Loading branch information
sod committed Feb 24, 2024
1 parent 6d2d857 commit f168897
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/api/api_impl.go
Expand Up @@ -1929,7 +1929,7 @@ func resolveKindToImportKind(kind ResolveKind) ast.ImportKind {

func (impl *pluginImpl) onResolve(options OnResolveOptions, callback func(OnResolveArgs) (OnResolveResult, error)) {
filter, err := config.CompileFilterForPlugin(impl.plugin.Name, "OnResolve", options.Filter)
if filter == nil {
if filter == nil || err != nil {
impl.log.AddError(nil, logger.Range{}, err.Error())
return
}
Expand Down Expand Up @@ -1985,7 +1985,7 @@ func (impl *pluginImpl) onResolve(options OnResolveOptions, callback func(OnReso

func (impl *pluginImpl) onLoad(options OnLoadOptions, callback func(OnLoadArgs) (OnLoadResult, error)) {
filter, err := config.CompileFilterForPlugin(impl.plugin.Name, "OnLoad", options.Filter)
if err != nil {
if filter == nil || err != nil {
impl.log.AddError(nil, logger.Range{}, err.Error())
return
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/plugin-tests.js
Expand Up @@ -2354,7 +2354,7 @@ error: Invalid path suffix "%what" returned from plugin (must start with "?" or
],
onLoad: [
{ path: pathFor('a') },
// { path: pathFor('c') }, should have been excluded via `exclude: /_b(\.js)?$/`
// { path: pathFor('b') }, should have been excluded via `exclude: /_b(\.js)?$/`
{ path: pathFor('c') },
],
}, null, 2)
Expand Down

0 comments on commit f168897

Please sign in to comment.