MCPcopy
hub / github.com/esm-dev/esm.sh / AddImportFromSpecifier

Method AddImportFromSpecifier

internal/importmap/importmap.go:295–302  ·  view source on GitHub ↗

AddImportFromSpecifier adds an import from a specifier to the import map.

(specifier string, noSRI bool)

Source from the content-addressed store, hash-verified

293
294// AddImportFromSpecifier adds an import from a specifier to the import map.
295func (im *ImportMap) AddImportFromSpecifier(specifier string, noSRI bool) (warnings []string, errors []error) {
296 imp, err := im.ParseImport(specifier)
297 if err != nil {
298 errors = append(errors, err)
299 return
300 }
301 return im.AddImport(imp, noSRI)
302}
303
304// AddImport adds an import to the import map.
305func (im *ImportMap) AddImport(imp ImportMeta, noSRI bool) (warnings []string, errors []error) {

Callers 3

TestAddPackagesFunction · 0.95
showMethod · 0.80
TestResolveFunction · 0.80

Calls 2

ParseImportMethod · 0.95
AddImportMethod · 0.95

Tested by 2

TestAddPackagesFunction · 0.76
TestResolveFunction · 0.64