Lines Matching refs:specifier

268  * Finalizes the resolution of a module specifier by checking if the resolved pathname contains encoded "/" or "\\"
295 if (getOptionValue('--experimental-specifier-resolution') === 'node') {
347 * @param {string} specifier - The import specifier that is not defined.
352 function importNotDefined(specifier, packageJSONUrl, base) {
354 specifier, packageJSONUrl && fileURLToPath(new URL('.', packageJSONUrl)),
749 const reason = 'is not a valid internal imports specifier name';
816 * Parse a package name from a specifier.
817 * @param {string} specifier - The import specifier.
820 function parsePackageName(specifier, base) {
821 let separatorIndex = StringPrototypeIndexOf(specifier, '/');
824 if (specifier[0] === '@') {
826 if (separatorIndex === -1 || specifier.length === 0) {
830 specifier, '/', separatorIndex + 1);
835 specifier : StringPrototypeSlice(specifier, 0, separatorIndex);
845 specifier, 'is not a valid package name', fileURLToPath(base));
849 StringPrototypeSlice(specifier, separatorIndex));
855 * Resolves a package specifier to a URL.
856 * @param {string} specifier - The package specifier to resolve.
861 function packageResolve(specifier, base, conditions) {
862 if (BuiltinModule.canBeRequiredWithoutScheme(specifier)) {
863 return new URL('node:' + specifier);
867 parsePackageName(specifier, base);
897 const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true });
920 * Checks if a specifier is a bare specifier.
921 * @param {string} specifier - The specifier to check.
923 function isBareSpecifier(specifier) {
924 return specifier[0] && specifier[0] !== '/' && specifier[0] !== '.';
928 * Determines whether a specifier is a relative path.
929 * @param {string} specifier - The specifier to check.
931 function isRelativeSpecifier(specifier) {
932 if (specifier[0] === '.') {
933 if (specifier.length === 1 || specifier[1] === '/') { return true; }
934 if (specifier[1] === '.') {
935 if (specifier.length === 2 || specifier[2] === '/') { return true; }
942 * Determines whether a specifier should be treated as a relative or absolute path.
943 * @param {string} specifier - The specifier to check.
945 function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
946 if (specifier === '') { return false; }
947 if (specifier[0] === '/') { return true; }
948 return isRelativeSpecifier(specifier);
952 * Resolves a module specifier to a URL.
953 * @param {string} specifier - The module specifier to resolve.
958 function moduleResolve(specifier, base, conditions, preserveSymlinks) {
964 if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
965 resolved = new URL(specifier, base);
966 } else if (!isRemote && specifier[0] === '#') {
967 resolved = packageImportsResolve(specifier, base, conditions);
970 resolved = new URL(specifier);
973 resolved = packageResolve(specifier, base, conditions);
985 * @param {string} specifier - The specifier to resolve.
988 function resolveAsCommonJS(specifier, parentURL) {
994 let found = CJSModule._resolveFilename(specifier, tmpModule, false);
996 // If it is a relative specifier return the relative path
998 if (isRelativeSpecifier(specifier)) {
1003 // there should not be a specifier like '..' or '.'
1007 } else if (isBareSpecifier(specifier)) {
1008 // If it is a bare specifier return the relative path within the
1010 const pkg = StringPrototypeSplit(specifier, '/')[0];
1030 * TODO(@JakobJingleheimer): de-dupe `specifier` & `parsed`
1031 * @param {string} specifier - The import specifier.
1032 * @param {URL} parsed - The parsed URL of the import specifier.
1036 function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
1044 if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1054 specifier,
1062 if (BuiltinModule.canBeRequiredWithoutScheme(specifier)) {
1064 specifier,
1071 specifier,
1093 * Resolves the given specifier using the provided context, which includes the parent URL and conditions.
1095 * Otherwise, attempts to resolve the specifier and returns the resulting URL and format.
1096 * @param {string} specifier - The specifier to resolve.
1099 * @param {string[]} [context.conditions] - The conditions for resolving the specifier.
1101 function defaultResolve(specifier, context = {}) {
1108 const destination = resolve(specifier, new SafeSet(conditions));
1122 specifier,
1140 if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1141 parsed = new URL(specifier, parsedParentURL);
1143 parsed = new URL(specifier);
1166 specifier,
1174 if (parsed && parsed.protocol === 'node:') { return { __proto__: null, url: specifier }; }
1194 specifier,
1204 if (StringPrototypeStartsWith(specifier, 'file://')) {
1205 specifier = fileURLToPath(specifier);
1207 decorateErrorWithCommonJSHints(error, specifier, parentURL);
1223 * @param {string} specifier - The specifier that was attempted to be imported.
1226 function decorateErrorWithCommonJSHints(error, specifier, parentURL) {
1227 const found = resolveAsCommonJS(specifier, parentURL);
1259 specifier,
1262 const ret = $defaultResolve(specifier, context);
1267 specifier,