CARVIEW |
Select Language
HTTP/2 200
date: Mon, 25 Aug 2025 00:24:13 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/symfony/symfony.git
etag: W/"2506f234e8e5d87ac3c5e2502803d064"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=w58lsO02hoVklxXZAAqyLCFSoSQTUoKunRS3ouh3iCMDOSnRyPHvsxLpDrdEKV6jHbQysEcgiHnFCakvEeGRbk%2FQK93FTCmDDVpZkjDkyDbkTw0H0RmCm2R5vTAQSwGyzNAzyncWdVGGHAgi5%2FCiZ7%2FqBi1oKgLUWv1ypbCSuTM6raEgK07OPNknV86K%2FkeJUzhH%2BTO9d80ryPmuG3iMlQ8l3YtHpbagxttxddwYvsa1xPF53RrQd8tWw0PlNCfQCyv9wWgak4WrysaBY2IoRQ%3D%3D--7a3g7q0vl%2B6uimWi--tr89fgSEOtDk91F7y93I1A%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1136066522.1756081452; Path=/; Domain=github.com; Expires=Tue, 25 Aug 2026 00:24:12 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 25 Aug 2026 00:24:12 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9CBE:2633B2:12ABA33:18AED9E:68ABAD2C
feature #61133 [AssetMapper] Add support for loading JSON using impor… · symfony/symfony@c7493bb · GitHub
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/CHANGELOG.md
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Command/DebugAssetMapperCommand.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapType.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit c7493bb
committed
feature #61133 [AssetMapper] Add support for loading JSON using import statements (nicolas-grekas)
This PR was merged into the 7.4 branch.
Discussion
----------
[AssetMapper] Add support for loading JSON using import statements
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Issues | -
| License | MIT
This is inspired by https://web.dev/blog/json-imports-baseline-newly-available
Modern browsers [support loading JSONs](https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json) via the `import data from './foo.json' with {type: 'json'}` syntax. While this has been promoted as a new baseline, that's still not widely supported.
This PR proposes to add support for a more portable alternative using `import jsonPromise from './foo.json'` instead, with some server-side assisted loader.
On the client-side, one could then use the imported data by awaiting it first (the import returns a Promise):
`json = await jsonPromise`
Note that we already support importing css via import statements.
Native support for `import './foo.css' with {type: 'css'}` exists, but that's [even less available](https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_css).
Commits
-------
990a44c [AssetMapper] Add support for loading JSON using import statementsFile tree
Expand file treeCollapse file tree
7 files changed
+36
-22
lines changedFilter options
- src/Symfony/Component/AssetMapper
- Command
- ImportMap
- Tests/ImportMap
Expand file treeCollapse file tree
7 files changed
+36
-22
lines changedsrc/Symfony/Component/AssetMapper/CHANGELOG.md
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/CHANGELOG.md+5Lines changed: 5 additions & 0 deletions
- Display the source diff
- Display the rich diff
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 |
| |
5 | 10 |
| |
6 | 11 |
| |
|
src/Symfony/Component/AssetMapper/Command/DebugAssetMapperCommand.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Command/DebugAssetMapperCommand.php+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
|
src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
| 52 | + | |
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
|
src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php+1-6Lines changed: 1 addition & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
165 |
| - | |
| 165 | + | |
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
| |||
200 | 200 |
| |
201 | 201 |
| |
202 | 202 |
| |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 | 203 |
| |
209 | 204 |
| |
210 | 205 |
| |
|
src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php+26-13Lines changed: 26 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 |
| |
35 | 38 |
| |
36 | 39 |
| |
| |||
48 | 51 |
| |
49 | 52 |
| |
50 | 53 |
| |
51 |
| - | |
| 54 | + | |
52 | 55 |
| |
53 | 56 |
| |
54 | 57 |
| |
| |||
70 | 73 |
| |
71 | 74 |
| |
72 | 75 |
| |
73 |
| - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
74 | 82 |
| |
75 | 83 |
| |
76 | 84 |
| |
77 | 85 |
| |
78 | 86 |
| |
79 |
| - | |
| 87 | + | |
80 | 88 |
| |
81 | 89 |
| |
82 | 90 |
| |
83 |
| - | |
| 91 | + | |
84 | 92 |
| |
85 | 93 |
| |
86 | 94 |
| |
87 | 95 |
| |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
92 | 100 |
| |
93 | 101 |
| |
94 | 102 |
| |
95 |
| - | |
| 103 | + | |
96 | 104 |
| |
97 | 105 |
| |
98 | 106 |
| |
| |||
186 | 194 |
| |
187 | 195 |
| |
188 | 196 |
| |
189 |
| - | |
| 197 | + | |
190 | 198 |
| |
191 |
| - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
192 | 205 |
| |
193 | 206 |
| |
194 |
| - | |
| 207 | + | |
195 | 208 |
| |
196 | 209 |
| |
197 | 210 |
| |
| |||
200 | 213 |
| |
201 | 214 |
| |
202 | 215 |
| |
203 |
| - | |
| 216 | + | |
204 | 217 |
| |
205 | 218 |
| |
206 | 219 |
| |
|
src/Symfony/Component/AssetMapper/ImportMap/ImportMapType.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/ImportMap/ImportMapType.php+1Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
|
src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
95 |
| - | |
| 95 | + | |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
|
You can’t perform that action at this time.
0 commit comments