This commit is contained in:
parent
f2ebcf560f
commit
b95d2954ba
5 changed files with 77 additions and 30 deletions
11
wasm/wasm.go
11
wasm/wasm.go
|
|
@ -17,18 +17,21 @@ func (r *JsResolver) IsSame(a, b string) bool {
|
|||
return a == b
|
||||
}
|
||||
|
||||
func (r *JsResolver) Resolve(name string) (string, error) {
|
||||
func (r *JsResolver) Resolve(_, name string) (*core.ImportResult, error) {
|
||||
jsv := r.jsResolver.Invoke(name)
|
||||
|
||||
if jsv.Type() == js.TypeUndefined {
|
||||
return "", errors.New("cannot find import with name " + name)
|
||||
return nil, errors.New("cannot find import with name " + name)
|
||||
}
|
||||
|
||||
if jsv.Type() != js.TypeString {
|
||||
return "", errors.New("invalid value for source: " + jsv.String())
|
||||
return nil, errors.New("invalid value for source: " + jsv.String())
|
||||
}
|
||||
|
||||
return jsv.String(), nil
|
||||
return &core.ImportResult{
|
||||
Source: jsv.String(),
|
||||
Path: name,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func jsError(err error) interface{} {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue