(id, parentPath)
| 363 | } |
| 364 | |
| 365 | resolve(id, parentPath) { |
| 366 | parentPath = parentPath || files.pathJoin( |
| 367 | this.getSourceRoot(), |
| 368 | this.getPathInPackage() |
| 369 | ); |
| 370 | |
| 371 | const resId = this._resolveCacheLookup(id, parentPath); |
| 372 | if (resId) { |
| 373 | return resId; |
| 374 | } |
| 375 | |
| 376 | const parentStat = optimisticStatOrNull(parentPath); |
| 377 | if (! parentStat || |
| 378 | ! parentStat.isFile()) { |
| 379 | throw new Error("Not a file: " + parentPath); |
| 380 | } |
| 381 | |
| 382 | const batch = this._resourceSlot.packageSourceBatch; |
| 383 | const resolver = batch.getResolver({ |
| 384 | // Make sure we use a server architecture when resolving, so that we |
| 385 | // don't accidentally use package.json "browser" fields. |
| 386 | // https://github.com/meteor/meteor/issues/9870 |
| 387 | targetArch: archinfo.host(), |
| 388 | }); |
| 389 | const resolved = resolver.resolve(id, parentPath); |
| 390 | |
| 391 | if (resolved === "missing") { |
| 392 | const error = new Error("Cannot find module '" + id + "'"); |
| 393 | error.code = "MODULE_NOT_FOUND"; |
| 394 | throw error; |
| 395 | } |
| 396 | |
| 397 | return this._resolveCacheStore(id, parentPath, resolved.id); |
| 398 | } |
| 399 | |
| 400 | require(id, parentPath) { |
| 401 | return this._require(id, parentPath); |
no test coverage detected