vike
Version:
(Replaces Next.js/Nuxt) 🔨 Composable framework to build advanced applications with flexibility and stability.
20 lines (19 loc) • 654 B
JavaScript
export { isImportPath };
export { isImportPathRelative };
import { assertPosixPath } from './path.js';
import { assert } from './assert.js';
import { isImportNpmPackageOrPathAlias } from './parseNpmPackage.js';
function isImportPath(importPath) {
return isImportPathRelative(importPath) || isImportNpmPackageOrPathAlias(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;
}
}