Skip to content

Commit

Permalink
fabbot
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Oct 30, 2023
1 parent e5e2c9d commit 36e5aec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ private function findAssetForBareImport(string $importedModule, AssetMapperInter
return $asset;
}

$path = $this->importMapConfigReader->convertPathToFilesystemPath($importMapEntry->path);

return $assetMapper->getAssetFromSourcePath($path);
return $assetMapper->getAssetFromSourcePath($this->importMapConfigReader->convertPathToFilesystemPath($importMapEntry->path));
} catch (CircularAssetsException $exception) {
return $exception->getIncompleteMappedAsset();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testRequire(array $packages, int $expectedProviderPackageArgumen
$this->configReader->expects($this->any())
->method('convertFilesystemPathToPath')
->willReturnCallback(function ($path) {
return match($path) {
return match ($path) {
'/path/to/assets/some_file.js' => './assets/some_file.js',
default => throw new \Exception(sprintf('Unexpected path "%s"', $path)),
};
Expand Down Expand Up @@ -200,16 +200,16 @@ public static function getRequirePackageTests(): iterable
],
];

yield 'single_package_with_a_path' => [
'packages' => [new PackageRequireOptions('some/module', path: self::$writableRoot.'/assets/some_file.js')],
'expectedProviderPackageArgumentCount' => 0,
'resolvedPackages' => [],
'expectedImportMap' => [
'some/module' => [
// converted to relative path
'path' => './assets/some_file.js',
],
yield 'single_package_with_a_path' => [
'packages' => [new PackageRequireOptions('some/module', path: self::$writableRoot.'/assets/some_file.js')],
'expectedProviderPackageArgumentCount' => 0,
'resolvedPackages' => [],
'expectedImportMap' => [
'some/module' => [
// converted to relative path
'path' => './assets/some_file.js',
],
],
];
}

Expand Down

0 comments on commit 36e5aec

Please sign in to comment.