vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
20 lines (19 loc) • 662 B
JavaScript
export { isImportPath };
export { isImportPathRelative };
import { assertPosixPath } from './path.js';
import { assert } from './assert.js';
import { isImportPathNpmPackageOrPathAlias } from './parseNpmPackage.js';
function isImportPath(importPath) {
return isImportPathRelative(importPath) || isImportPathNpmPackageOrPathAlias(importPath);
}
// See also `import { pathIsRelative } from './path'`
function isImportPathRelative(importPath) {
assertPosixPath(importPath);
if (importPath.startsWith('./') || importPath.startsWith('../')) {
return true;
}
else {
assert(!importPath.startsWith('.'));
return false;
}
}