You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #12 Created cached entrypoint look up class (codayblue, nicolas-grekas, weaverryan)
This PR was merged into the master branch.
Discussion
----------
Created cached entrypoint look up class
- Created the CacheEntrypointLookup
- modified the EntrypointLookup to have a protected method instead of private to easily just extend it
- Created the cache compiler pass that reads the file and will save it to the symfony cache with the service construction
- Created a config option to enable the cache class and compiler pass
- Enabled the compiler pass in the bundle
- Updated tests
This will resolve issue #3
Commits
-------
c165e64 removing extra use statement
614964e Add cache flag
465aae2 Adjusted code to pass tests and updated tests
badc55d -
243c87f Cache Entry Point Files
@@ -84,20 +89,34 @@ private function validateEntryName(string $entryName)
84
89
85
90
privatefunctiongetEntriesData(): array
86
91
{
87
-
if (null === $this->entriesData) {
88
-
if (!file_exists($this->entrypointJsonPath)) {
89
-
thrownew \InvalidArgumentException(sprintf('Could not find the entrypoints file from Webpack: the file "%s" does not exist.', $this->entrypointJsonPath));
thrownew \InvalidArgumentException(sprintf('There was a problem JSON decoding the "%s" file', $this->entrypointJsonPath));
99
+
if ($cached->isHit()) {
100
+
return$this->entriesData = $cached->get();
96
101
}
102
+
}
97
103
98
-
if (!isset($this->entriesData['entrypoints'])) {
99
-
thrownew \InvalidArgumentException(sprintf('Could not find an "entrypoints" key in the "%s" file', $this->entrypointJsonPath));
100
-
}
104
+
if (!file_exists($this->entrypointJsonPath)) {
105
+
thrownew \InvalidArgumentException(sprintf('Could not find the entrypoints file from Webpack: the file "%s" does not exist.', $this->entrypointJsonPath));
Copy file name to clipboardExpand all lines: src/Asset/TagRenderer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ public function __construct(
26
26
@trigger_error(sprintf('The "$entrypointLookupCollection" argument in method "%s()" must be an instance of EntrypointLookupCollection.', __METHOD__), E_USER_DEPRECATED);
0 commit comments