Lines Matching refs:target

95  * @param {string} target - The target module.
101 * @param {boolean} isTarget - Whether the target is a module.
103 function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, internal, base, isTarget) {
106 const double = RegExpPrototypeExec(doubleSlashRegEx, isTarget ? target : request) !== null;
109 'leading or trailing slash matching'} resolving "${target}" for module ` +
389 * Creates an error object for an invalid package target.
391 * @param {import('internal/modules/esm/package_config.js').PackageTarget} target - The target.
398 subpath, target, packageJSONUrl, internal, base) {
399 if (typeof target === 'object' && target !== null) {
400 target = JSONStringify(target, null, '');
402 target = `${target}`;
405 fileURLToPath(new URL('.', packageJSONUrl)), subpath, target,
415 * Resolves the package target string to a URL object.
416 * @param {string} target - The target string to resolve.
420 * @param {string} base - The base URL to resolve the target against.
421 * @param {RegExp} pattern - The pattern to replace in the target string.
422 * @param {boolean} internal - Whether the target is internal to the package.
423 * @param {boolean} isPathMap - Whether the target is a path map.
426 * @throws {ERR_INVALID_PACKAGE_TARGET} - If the target is invalid.
430 target,
441 if (subpath !== '' && !pattern && target[target.length - 1] !== '/') {
442 throw invalidPackageTarget(match, target, packageJSONUrl, internal, base);
445 if (!StringPrototypeStartsWith(target, './')) {
446 if (internal && !StringPrototypeStartsWith(target, '../') &&
447 !StringPrototypeStartsWith(target, '/')) {
448 // No need to convert target to string, since it's already presumed to be
449 if (!URLCanParse(target)) {
451 RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
452 target + subpath;
457 throw invalidPackageTarget(match, target, packageJSONUrl, internal, base);
460 if (RegExpPrototypeExec(invalidSegmentRegEx, StringPrototypeSlice(target, 2)) !== null) {
461 if (RegExpPrototypeExec(deprecatedInvalidSegmentRegEx, StringPrototypeSlice(target, 2)) === null) {
467 RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
468 target;
472 throw invalidPackageTarget(match, target, packageJSONUrl, internal, base);
476 const resolved = new URL(target, packageJSONUrl);
481 throw invalidPackageTarget(match, target, packageJSONUrl, internal, base);
491 RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
492 target;
521 * Resolves the target of a package based on the provided parameters.
523 * @param {import('internal/modules/esm/package_config.js').PackageTarget} target - The target to resolve.
531 * @returns {URL | null | undefined} - The resolved target, or null if not found, or undefined if not resolvable.
533 function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath,
535 if (typeof target === 'string') {
537 target, subpath, packageSubpath, packageJSONUrl, base, pattern, internal,
539 } else if (ArrayIsArray(target)) {
540 if (target.length === 0) {
545 for (let i = 0; i < target.length; i++) {
546 const targetItem = target[i];
572 } else if (typeof target === 'object' && target !== null) {
573 const keys = ObjectGetOwnPropertyNames(target);
585 const conditionalTarget = target[key];
594 } else if (target === null) {
597 throw invalidPackageTarget(packageSubpath, target, packageJSONUrl, internal,
637 * @returns {URL} - The resolved package target.
649 const target = exports[packageSubpath];
651 packageJSONUrl, target, '', packageSubpath, base, false, false, false,
695 const target = exports[bestMatch];
698 target,
791 const target = imports[bestMatch];
792 const resolveResult = resolvePackageTarget(packageJSONUrl, target,