Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99d5cbb

Browse files
committed
[AssetMapper] Fixing merge from multiple PR's
1 parente400626 commit99d5cbb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

‎src/Symfony/Component/AssetMapper/Compiler/JavaScriptImportPathCompiler.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ private function findAssetForRelativeImport(string $importedModule, MappedAsset
172172
returnnull;
173173
}
174174

175-
$dependentAsset =$assetMapper->getAsset($resolvedSourcePath);
175+
try {
176+
$dependentAsset =$assetMapper->getAssetFromSourcePath($resolvedSourcePath);
177+
}catch (CircularAssetsException$exception) {
178+
$dependentAsset =$exception->getIncompleteMappedAsset();
179+
}
180+
176181
if ($dependentAsset) {
177182
return$dependentAsset;
178183
}

‎src/Symfony/Component/AssetMapper/Tests/Compiler/JavaScriptImportPathCompilerTest.php‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ public static function provideCompileTests(): iterable
173173
];
174174

175175
yield'importing_non_existent_file_without_strict_mode_is_ignored_and_no_import_added' => [
176-
'sourceLogicalName' =>'app.js',
177176
'input' =>"import './non-existent.js';",
178177
'expectedJavaScriptImports' => [],
179178
];
@@ -277,7 +276,6 @@ public static function provideCompileTests(): iterable
277276
];
278277

279278
yield'absolute_import_ignored_and_no_dependency_added' => [
280-
'sourceLogicalName' =>'app.js',
281279
'input' =>'import "https://example.com/module.js";',
282280
'expectedJavaScriptImports' => [],
283281
];
@@ -415,14 +413,14 @@ public static function providePathsCanUpdateTests(): iterable
415413

416414
publicfunctiontestCompileHandlesCircularRelativeAssets()
417415
{
418-
$appAsset =newMappedAsset('app.js','anythingapp','/assets/app.js');
419-
$otherAsset =newMappedAsset('other.js','anythingother','/assets/other.js');
416+
$appAsset =newMappedAsset('app.js','/project/assets/app.js','/assets/app.js');
417+
$otherAsset =newMappedAsset('other.js','/project/assets/other.js','/assets/other.js');
420418

421419
$importMapConfigReader =$this->createMock(ImportMapConfigReader::class);
422420
$assetMapper =$this->createMock(AssetMapperInterface::class);
423421
$assetMapper->expects($this->once())
424-
->method('getAsset')
425-
->with('other.js')
422+
->method('getAssetFromSourcePath')
423+
->with('/project/assets/other.js')
426424
->willThrowException(newCircularAssetsException($otherAsset));
427425

428426
$compiler =newJavaScriptImportPathCompiler($importMapConfigReader);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp