(spec: string, raw: string, kind: string, pkg: PluginPackage)
| 87 | } |
| 88 | |
| 89 | function resolvePackageFile(spec: string, raw: string, kind: string, pkg: PluginPackage) { |
| 90 | const resolved = resolveExportPath(raw, pkg.dir) |
| 91 | const root = Filesystem.resolve(pkg.dir) |
| 92 | const next = Filesystem.resolve(resolved) |
| 93 | if (!Filesystem.contains(root, next)) { |
| 94 | throw new Error(`Plugin ${spec} resolved ${kind} entry outside plugin directory`) |
| 95 | } |
| 96 | return next |
| 97 | } |
| 98 | |
| 99 | function resolvePackagePath(spec: string, raw: string, kind: PluginKind, pkg: PluginPackage) { |
| 100 | return pathToFileURL(resolvePackageFile(spec, raw, kind, pkg)).href |
no test coverage detected