Skip to content

Commit d37956c

Browse files
committed
Adding %PACKAGE% in sychronizer to point to paths in the package
1 parent de25855 commit d37956c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/PackageJsonSynchronizer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ private function resolveImportMapPackages($phpPackage): array
156156
}
157157

158158
if (0 === strpos($constraint, 'path:')) {
159+
$path = substr($constraint, 5);
160+
$path = str_replace('%PACKAGE%', \dirname($packageJson->getPath()), $path);
161+
159162
$dependencies[$importMapName] = [
160-
'path' => \dirname($packageJson->getPath()).'/'.substr($constraint, 5),
163+
'path' => $path,
161164
'preload' => $preload,
162165
];
163166

tests/Fixtures/packageJson/vendor/symfony/new-package/assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"importmap": {
1414
"@hotcake": "^1.9.0",
1515
"@symfony/new-package": {
16-
"version": "path:dist/loader.js",
16+
"version": "path:%PACKAGE%/dist/loader.js",
1717
"preload": true
1818
}
1919
}

0 commit comments

Comments
 (0)