Lines Matching refs:path
97 const path = require('path');
181 * Get a path's properties, using an in-memory cache to minimize lookups.
182 * @param {string} filename Absolute path to the file
185 filename = path.toNamespacedPath(filename);
225 * @param {string} filename Absolute path of the module
235 * @param {string} basePath The absolute path that errored
240 process.send({ 'watch:require': ArrayPrototypeMap(extensions, (ext) => path.resolve(`${basePath}${ext}`)) });
253 this.path = path.dirname(id);
423 * @param {string} requestPath The path to what we are trying to load
432 return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain);
435 const filename = path.resolve(requestPath, pkg);
438 tryExtensions(path.resolve(filename, 'index'), exts, isMain);
440 actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain);
448 err.path = path.resolve(requestPath, 'package.json');
453 const jsonPath = path.resolve(requestPath, 'package.json');
468 * @param {string} requestPath The path to the file to load.
475 return path.resolve(requestPath);
481 * Given a path, check if the file exists with any of the set extensions.
482 * @param {string} basePath The path and filename without extension
502 const name = path.basename(filename);
516 * Tries to get the absolute file path of the parent module.
526 return process.cwd() + path.sep;
535 * @param {string} parentPath The path of the parent module
541 const { data: pkg, path: pkgPath } = packageJsonReader.readPackageScope(parentPath);
576 * Resolves the exports for a given module path and request.
577 * @param {string} nmPath The path to the module.
585 const pkgPath = path.resolve(nmPath, name);
603 * Get the absolute path to a module.
604 * @param {string} request Relative or absolute file path
610 const absoluteRequest = path.isAbsolute(request);
649 const normalizedRequest = path.normalize(request);
655 // For each path
657 // Don't search further if path doesn't exist and request is inside the path
670 const basePath = path.resolve(curPath, request);
678 filename = path.resolve(basePath);
691 filename = path.resolve(basePath);
734 * Get the paths to the `node_modules` folder for a given path.
739 from = path.resolve(from);
741 // note: this approach *only* works when the path is guaranteed
742 // to be absolute. Doing a fully-edge-case-correct path.split
745 // return root node_modules when path is 'D:\\'.
746 // path.resolve will make sure from.length >=3 in Windows.
757 // The path segment separator check ('\' and '/') was used to get
758 // node_modules path for every path segment.
760 // path for drive root like 'C:\node_modules' and don't need to
786 * Get the paths to the `node_modules` folder for a given path.
791 from = path.resolve(from);
798 // note: this approach *only* works when the path is guaranteed
799 // to be absolute. Doing a fully-edge-case-correct path.split
863 // Make require('./path/to/foo') work - normally the path is taken
873 const parentDir = [path.dirname(parent.filename)];
943 * @param {string} parent Absolute path of the module importing the child
950 // Fast path for (lazy loaded) modules in the same directory. The indirect
953 relResolveCacheIdentifier = `${parent.path}\x00${request}`;
1046 * Given a `require` string and its context, get its absolute file path.
1076 const path = options.paths[i];
1077 fakeParent.paths = Module._nodeModulePaths(path);
1097 const parentPath = parent?.filename ?? process.cwd() + path.sep;
1105 pkg.path);
1147 * Finishes resolving an ES module specifier into an absolute file path.
1149 * @param {string} parentPath The path of the parent module
1150 * @param {string} pkgPath The path of the package.json file
1166 path.resolve(pkgPath, 'package.json'));
1173 * @param {string} [path] The path to the requested module
1175 function createEsmNotFoundErr(request, path) {
1179 if (path) {
1180 err.path = path;
1195 this.paths = Module._nodeModulePaths(path.dirname(filename));
1218 * Loads a module at the given file path. Returns that module's `exports` property.
1238 * Resolved path to `process.argv[1]` will be lazily placed here
1316 * @param {string} filename The file path of the module
1353 const dirname = path.dirname(filename);
1375 * @param {string} filename The file path of the module
1393 const packageJsonPath = path.resolve(pkg.path, 'package.json');
1428 * @param {string} filename The file path of the module
1450 * @param {string} filename The file path of the module
1460 return process.dlopen(module, path.toNamespacedPath(filename));
1464 * Creates a `require` function that can be used to load modules from the specified path.
1465 * @param {string} filename The path to the module
1474 path.join(filename, 'noop.js') :
1480 m.paths = Module._nodeModulePaths(m.path);
1485 'absolute path string';
1489 * @param {string | URL} filename The path or URL to the module context for this `require`
1490 * @throws {ERR_INVALID_ARG_VALUE} If `filename` is not a string or URL, or if it is a relative path that cannot be
1491 * resolved to an absolute path.
1497 (typeof filename === 'string' && !path.isAbsolute(filename))) {
1524 path.resolve(process.execPath, '..') :
1525 path.resolve(process.execPath, '..', '..');
1527 const paths = [path.resolve(prefixDir, 'lib', 'node')];
1530 ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));
1531 ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_modules'));
1536 StringPrototypeSplit(nodePath, path.delimiter),
1557 // in the current working directory. This seeds the search path for