vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
22 lines (21 loc) • 818 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isImportPath = isImportPath;
exports.isImportPathRelative = isImportPathRelative;
const path_js_1 = require("./path.js");
const assert_js_1 = require("./assert.js");
const parseNpmPackage_js_1 = require("./parseNpmPackage.js");
function isImportPath(importPath) {
return isImportPathRelative(importPath) || (0, parseNpmPackage_js_1.isImportPathNpmPackageOrPathAlias)(importPath);
}
// See also `import { pathIsRelative } from './path'`
function isImportPathRelative(importPath) {
(0, path_js_1.assertPosixPath)(importPath);
if (importPath.startsWith('./') || importPath.startsWith('../')) {
return true;
}
else {
(0, assert_js_1.assert)(!importPath.startsWith('.'));
return false;
}
}