Lines Matching refs:URL
40 const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
74 * @param {string} pjsonUrl - The URL of the package.json file.
75 * @param {string} base - The URL of the module that imported the package.
98 * @param {string} pjsonUrl - The package.json URL.
100 * @param {string} base - The base URL.
119 * Emits a deprecation warning if the given URL is a module and
121 * @param {URL} url - The URL of the module being resolved.
122 * @param {URL} packageJSONUrl - The URL of the package.json file for the module.
123 * @param {string | URL} [base] - The base URL for the module being resolved.
130 const pkgPath = fileURLToPath(new URL('.', packageJSONUrl));
157 * @param {string | URL} url
171 * @param {URL} packageJSONUrl
173 * @param {string | URL | undefined} base
174 * @returns {URL}
180 if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) {
182 } else if (fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))) {
184 } else if (fileExists(guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl))) {
186 } else if (fileExists(guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl))) {
188 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl))) {
190 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl))) {
192 } else if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl))) {
204 if (fileExists(guess = new URL('./index.js', packageJSONUrl))) {
206 } else if (fileExists(guess = new URL('./index.json', packageJSONUrl))) {
208 } else if (fileExists(guess = new URL('./index.node', packageJSONUrl))) {
219 fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base));
223 * @param {URL} search
224 * @returns {URL | undefined}
234 * @param {URL} search
235 * @returns {URL | undefined}
240 const guess = new URL(`${search.pathname}${extension}`, search);
247 * @param {URL} search
248 * @returns {URL | undefined}
263 return resolveExtensions(new URL('index', search));
270 * @param {URL} resolved - The resolved URL object.
271 * @param {string | URL | undefined} base - The base URL object.
273 * @returns {URL} - The finalized URL object.
301 (resolveDirectoryEntry(resolved) || resolved) : resolveDirectoryEntry(new URL(`${resolved}/`));
348 * @param {URL} packageJSONUrl - The URL of the package.json file, or null if not available.
349 * @param {string | URL | undefined} base - The base URL to use for resolving relative URLs.
354 specifier, packageJSONUrl && fileURLToPath(new URL('.', packageJSONUrl)),
361 * @param {URL} packageJSONUrl - The URL of the package.json file.
362 * @param {string | URL | undefined} [base] - The base URL to use for resolving the subpath.
367 fileURLToPath(new URL('.', packageJSONUrl)), subpath,
375 * @param {URL} packageJSONUrl - The URL of the package.json file being resolved.
377 * @param {string | URL | undefined} base - The base URL for the resolution.
392 * @param {URL} packageJSONUrl - The URL of the package.json file.
394 * @param {string | URL | undefined} base - The base URL.
405 fileURLToPath(new URL('.', packageJSONUrl)), subpath, target,
415 * Resolves the package target string to a URL object.
417 * @param {string} subpath - The subpath to append to the resolved URL.
419 * @param {string} packageJSONUrl - The URL of the package.json file.
420 * @param {string} base - The base URL to resolve the target against.
425 * @returns {URL} - The resolved URL object.
476 const resolved = new URL(target, packageJSONUrl);
478 const packagePath = new URL('.', packageJSONUrl).pathname;
501 return new URL(
506 return new URL(subpath, resolved);
522 * @param {string} packageJSONUrl - The URL of the package.json file.
531 * @returns {URL | null | undefined} - The resolved target, or null if not found, or undefined if not resolvable.
604 * @param {URL} packageJSONUrl The URL of the package.json file.
605 * @param {string | URL | undefined} base The base URL.
632 * @param {URL} packageJSONUrl - The URL of the package.json file.
635 * @param {string | URL | undefined} base - The base path to resolve from.
637 * @returns {URL} - The resolved package target.
740 * @param {string | URL | undefined} base - The base URL to resolve the import from.
744 * @returns {URL} The resolved import URL.
807 * Returns the package type for a given URL.
808 * @param {URL} url - The URL to get the package type for.
818 * @param {string | URL | undefined} base - The parent URL.
855 * Resolves a package specifier to a URL.
857 * @param {string | URL | undefined} base - The base URL to use for resolution.
859 * @returns {URL} - The resolved URL.
863 return new URL('node:' + specifier);
880 new URL('./node_modules/' + packageName + '/package.json', base);
889 packageJSONUrl = new URL((isScoped ?
910 return new URL(packageSubpath, packageJSONUrl);
952 * Resolves a module specifier to a URL.
954 * @param {string | URL | undefined} base - The base URL to resolve against.
956 * @param {boolean} preserveSymlinks - Whether to preserve symlinks in the resolved URL.
965 resolved = new URL(specifier, base);
970 resolved = new URL(specifier);
986 * @param {string} parentURL - The base URL.
1032 * @param {URL} parsed - The parsed URL of the import specifier.
1033 * @param {URL} parsedParentURL - The parsed URL of the parent module.
1081 * @param {string | URL | undefined} parentURL - The parent URL.
1088 throw new ERR_INVALID_ARG_TYPE('parentURL', ['string', 'URL'], parentURL);
1093 * Resolves the given specifier using the provided context, which includes the parent URL and conditions.
1094 * Throws an error if the parent URL is invalid or if the resolution is disallowed by the policy manifest.
1095 * Otherwise, attempts to resolve the specifier and returns the resulting URL and format.
1097 * @param {object} [context={}] - The context object containing the parent URL and conditions.
1098 * @param {string} [context.parentURL] - The URL of the parent module.
1132 parsedParentURL = new URL(parentURL);
1141 parsed = new URL(specifier, parsedParentURL);
1143 parsed = new URL(specifier);
1224 * @param {string} parentURL - The URL of the parent module.