@remix-run/assets 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -13
- package/dist/assets.d.ts +2 -1
- package/dist/assets.d.ts.map +1 -1
- package/dist/lib/asset-server.d.ts +41 -19
- package/dist/lib/asset-server.d.ts.map +1 -1
- package/dist/lib/asset-server.js +98 -41
- package/dist/lib/compilation-error.d.ts +1 -1
- package/dist/lib/compilation-error.d.ts.map +1 -1
- package/dist/lib/files/compiler.d.ts +1 -1
- package/dist/lib/files/compiler.d.ts.map +1 -1
- package/dist/lib/files/compiler.js +26 -29
- package/dist/lib/files/config.d.ts +6 -0
- package/dist/lib/files/config.d.ts.map +1 -1
- package/dist/lib/files/config.js +9 -0
- package/dist/lib/fingerprint.d.ts +0 -4
- package/dist/lib/fingerprint.d.ts.map +1 -1
- package/dist/lib/fingerprint.js +0 -4
- package/dist/lib/hmr.d.ts +7 -0
- package/dist/lib/hmr.d.ts.map +1 -1
- package/dist/lib/hmr.js +198 -25
- package/dist/lib/routes.d.ts +1 -0
- package/dist/lib/routes.d.ts.map +1 -1
- package/dist/lib/routes.js +1 -1
- package/dist/lib/scripts/compiler.d.ts +8 -2
- package/dist/lib/scripts/compiler.d.ts.map +1 -1
- package/dist/lib/scripts/compiler.js +186 -36
- package/dist/lib/scripts/emit.d.ts +2 -1
- package/dist/lib/scripts/emit.d.ts.map +1 -1
- package/dist/lib/scripts/emit.js +25 -16
- package/dist/lib/scripts/resolve.d.ts +7 -1
- package/dist/lib/scripts/resolve.d.ts.map +1 -1
- package/dist/lib/scripts/resolve.js +110 -3
- package/dist/lib/scripts/specifiers.d.ts +2 -0
- package/dist/lib/scripts/specifiers.d.ts.map +1 -0
- package/dist/lib/scripts/specifiers.js +9 -0
- package/dist/lib/scripts/transform.d.ts +2 -3
- package/dist/lib/scripts/transform.d.ts.map +1 -1
- package/dist/lib/scripts/transform.js +2 -16
- package/dist/lib/styles/compiler.d.ts +0 -1
- package/dist/lib/styles/compiler.d.ts.map +1 -1
- package/dist/lib/styles/compiler.js +105 -25
- package/dist/lib/styles/emit.d.ts +2 -1
- package/dist/lib/styles/emit.d.ts.map +1 -1
- package/dist/lib/styles/emit.js +12 -10
- package/dist/lib/styles/resolve.d.ts +0 -1
- package/dist/lib/styles/resolve.d.ts.map +1 -1
- package/dist/lib/styles/resolve.js +0 -1
- package/dist/lib/styles/transform.d.ts +0 -2
- package/dist/lib/styles/transform.d.ts.map +1 -1
- package/dist/lib/styles/transform.js +0 -7
- package/dist/lib/virtual-store.d.ts +8 -0
- package/dist/lib/virtual-store.d.ts.map +1 -0
- package/dist/lib/virtual-store.js +100 -0
- package/package.json +6 -5
- package/src/assets.ts +7 -1
- package/src/lib/asset-server.ts +175 -73
- package/src/lib/compilation-error.ts +1 -0
- package/src/lib/files/compiler.ts +30 -40
- package/src/lib/files/config.ts +17 -0
- package/src/lib/fingerprint.ts +0 -9
- package/src/lib/hmr.ts +210 -26
- package/src/lib/routes.ts +1 -1
- package/src/lib/scripts/compiler.ts +238 -52
- package/src/lib/scripts/emit.ts +34 -19
- package/src/lib/scripts/resolve.ts +166 -4
- package/src/lib/scripts/specifiers.ts +11 -0
- package/src/lib/scripts/transform.ts +4 -23
- package/src/lib/styles/compiler.ts +137 -39
- package/src/lib/styles/emit.ts +18 -13
- package/src/lib/styles/resolve.ts +0 -2
- package/src/lib/styles/transform.ts +0 -10
- package/src/lib/virtual-store.ts +124 -0
package/dist/lib/hmr.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export function createHmrClientSource(options) {
|
|
2
2
|
return `
|
|
3
|
+
${options.moduleImporter
|
|
4
|
+
? `import { importModule as __remixImport } from ${JSON.stringify(options.moduleImporter)}`
|
|
5
|
+
: 'const __remixImport = (specifier) => import(specifier)'}
|
|
6
|
+
|
|
3
7
|
const contexts = new Map()
|
|
4
8
|
const dataByPath = new Map()
|
|
5
9
|
|
|
@@ -71,6 +75,13 @@ let reconnectPending = false
|
|
|
71
75
|
let pageReloadTimer
|
|
72
76
|
let failedJavaScriptUpdates = new Map()
|
|
73
77
|
let stylesheetUpdatePromise = Promise.resolve()
|
|
78
|
+
let installedImportMap = { imports: new Map(), scopes: new Map() }
|
|
79
|
+
let processedScripts = new WeakSet()
|
|
80
|
+
|
|
81
|
+
let observer = new MutationObserver(processMutations)
|
|
82
|
+
observer.observe(document, { childList: true })
|
|
83
|
+
observer.observe(document.head, { childList: true })
|
|
84
|
+
processImportMaps()
|
|
74
85
|
|
|
75
86
|
let events = new EventSource(${JSON.stringify(options.eventPathname)})
|
|
76
87
|
|
|
@@ -96,11 +107,18 @@ events.onerror = () => {
|
|
|
96
107
|
|
|
97
108
|
events.onmessage = (event) => {
|
|
98
109
|
let payload = JSON.parse(event.data)
|
|
110
|
+
if (payload.type === 'browser:update') {
|
|
111
|
+
let update = payload.data?.[${JSON.stringify(options.dataKey)}]
|
|
112
|
+
if (!update) return
|
|
113
|
+
handleBrowserUpdate(update).catch((error) => {
|
|
114
|
+
console.error('[remix] HMR update failed', error)
|
|
115
|
+
if (update.updates.some((entry) => entry.type !== 'js')) reloadPage()
|
|
116
|
+
})
|
|
117
|
+
return
|
|
118
|
+
}
|
|
99
119
|
handlePayload(payload).catch((error) => {
|
|
100
120
|
console.error('[remix] HMR update failed', error)
|
|
101
|
-
|
|
102
|
-
reloadPage()
|
|
103
|
-
}
|
|
121
|
+
reloadPage()
|
|
104
122
|
})
|
|
105
123
|
}
|
|
106
124
|
|
|
@@ -115,27 +133,28 @@ async function handlePayload(payload) {
|
|
|
115
133
|
await dispatchCustomEvent(payload.type, payload)
|
|
116
134
|
return
|
|
117
135
|
}
|
|
136
|
+
}
|
|
118
137
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
async function handleBrowserUpdate(payload) {
|
|
139
|
+
for (let update of payload.updates) {
|
|
140
|
+
if (update.type === 'css') {
|
|
141
|
+
let updated = await queueStylesheetUpdate(update.path, payload.timestamp)
|
|
142
|
+
if (updated) console.debug('[remix] HMR updated stylesheet', update.path)
|
|
143
|
+
continue
|
|
144
|
+
}
|
|
126
145
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
try {
|
|
147
|
+
if (update.importMap && !installImportMap(update.importMap)) return
|
|
148
|
+
let updated = await updateJavaScriptModule(
|
|
149
|
+
update.path,
|
|
150
|
+
update.acceptedPath ?? update.path,
|
|
151
|
+
payload.timestamp,
|
|
152
|
+
)
|
|
153
|
+
failedJavaScriptUpdates.delete(update.path)
|
|
154
|
+
if (updated) console.debug('[remix] HMR accepted update', update.path)
|
|
155
|
+
} catch (error) {
|
|
156
|
+
failedJavaScriptUpdates.set(update.path, update.acceptedPath ?? update.path)
|
|
157
|
+
throw error
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
}
|
|
@@ -204,7 +223,7 @@ async function updateJavaScriptModule(path, acceptedPath, timestamp) {
|
|
|
204
223
|
await callback(previousContext.data)
|
|
205
224
|
}
|
|
206
225
|
|
|
207
|
-
let updatedModule = await
|
|
226
|
+
let updatedModule = await __remixImport(withTimestamp(path, timestamp), import.meta.url)
|
|
208
227
|
previousContext.invalidated = false
|
|
209
228
|
previousContext.updating = true
|
|
210
229
|
try {
|
|
@@ -227,7 +246,7 @@ async function updateJavaScriptModule(path, acceptedPath, timestamp) {
|
|
|
227
246
|
}
|
|
228
247
|
}
|
|
229
248
|
|
|
230
|
-
let updatedModule = await
|
|
249
|
+
let updatedModule = await __remixImport(withTimestamp(acceptedPath, timestamp), import.meta.url)
|
|
231
250
|
previousContext.invalidated = false
|
|
232
251
|
previousContext.updating = true
|
|
233
252
|
try {
|
|
@@ -258,7 +277,7 @@ async function propagateInvalidatedJavaScriptModule(path, timestamp) {
|
|
|
258
277
|
await callback(importerContext.data)
|
|
259
278
|
}
|
|
260
279
|
|
|
261
|
-
let updatedModule = await
|
|
280
|
+
let updatedModule = await __remixImport(withTimestamp(path, timestamp), import.meta.url)
|
|
262
281
|
importerContext.invalidated = false
|
|
263
282
|
importerContext.updating = true
|
|
264
283
|
try {
|
|
@@ -346,6 +365,160 @@ function withTimestamp(path, timestamp) {
|
|
|
346
365
|
return url.pathname + url.search
|
|
347
366
|
}
|
|
348
367
|
|
|
368
|
+
function installImportMap(importMap) {
|
|
369
|
+
processMutations(observer.takeRecords())
|
|
370
|
+
processImportMaps()
|
|
371
|
+
let delta = getImportMapDelta(installedImportMap, importMap)
|
|
372
|
+
if (delta === null) {
|
|
373
|
+
reloadPage()
|
|
374
|
+
return false
|
|
375
|
+
}
|
|
376
|
+
if (!delta) return true
|
|
377
|
+
|
|
378
|
+
let script = document.createElement('script')
|
|
379
|
+
script.setAttribute('data-rmx-import-map', '')
|
|
380
|
+
script.type = 'importmap'
|
|
381
|
+
script.textContent = JSON.stringify(delta)
|
|
382
|
+
document.head.appendChild(script)
|
|
383
|
+
processedScripts.add(script)
|
|
384
|
+
mergeImportMap(installedImportMap, delta)
|
|
385
|
+
return true
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function processImportMap(script) {
|
|
389
|
+
if (processedScripts.has(script)) return
|
|
390
|
+
processedScripts.add(script)
|
|
391
|
+
|
|
392
|
+
let importMap
|
|
393
|
+
try {
|
|
394
|
+
importMap = JSON.parse(script.textContent ?? '')
|
|
395
|
+
} catch {
|
|
396
|
+
return
|
|
397
|
+
}
|
|
398
|
+
if (!importMap || typeof importMap !== 'object') return
|
|
399
|
+
mergeImportMap(installedImportMap, importMap)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function processImportMaps() {
|
|
403
|
+
for (let script of document.querySelectorAll('script[type="importmap"]')) {
|
|
404
|
+
processImportMap(script)
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function processMutations(mutations) {
|
|
409
|
+
for (let mutation of mutations) {
|
|
410
|
+
if (mutation.type !== 'childList') continue
|
|
411
|
+
for (let node of mutation.addedNodes) {
|
|
412
|
+
if (node instanceof HTMLScriptElement && node.matches('script[type="importmap"]')) {
|
|
413
|
+
processImportMap(node)
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function getImportMapDelta(installed, importMap) {
|
|
420
|
+
let imports = getImportMapImportsDelta(installed.imports, importMap.imports)
|
|
421
|
+
if (imports === null) return null
|
|
422
|
+
|
|
423
|
+
let scopes
|
|
424
|
+
if (importMap.scopes && typeof importMap.scopes === 'object') {
|
|
425
|
+
scopes = {}
|
|
426
|
+
for (let [scope, entries] of Object.entries(importMap.scopes)) {
|
|
427
|
+
let normalizedScope = normalizeImportMapUrl(scope)
|
|
428
|
+
if (!normalizedScope || !entries || typeof entries !== 'object') continue
|
|
429
|
+
let installedEntries = installed.scopes.get(normalizedScope) ?? new Map()
|
|
430
|
+
let entriesDelta = getImportMapImportsDelta(installedEntries, entries, scope)
|
|
431
|
+
if (entriesDelta === null) return null
|
|
432
|
+
if (entriesDelta) scopes[scope] = entriesDelta
|
|
433
|
+
}
|
|
434
|
+
if (Object.keys(scopes).length === 0) scopes = undefined
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (!imports && !scopes) return undefined
|
|
438
|
+
return {
|
|
439
|
+
...(imports ? { imports } : null),
|
|
440
|
+
...(scopes ? { scopes } : null),
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function getImportMapImportsDelta(installed, entries, scope) {
|
|
445
|
+
if (!entries || typeof entries !== 'object') return undefined
|
|
446
|
+
let delta = {}
|
|
447
|
+
for (let [specifier, href] of Object.entries(entries)) {
|
|
448
|
+
if (href !== null && typeof href !== 'string') continue
|
|
449
|
+
let normalizedSpecifier = normalizeImportMapSpecifier(specifier)
|
|
450
|
+
if (!normalizedSpecifier) continue
|
|
451
|
+
let normalizedHref = normalizeImportMapAddress(href)
|
|
452
|
+
let existing = installed.get(normalizedSpecifier)
|
|
453
|
+
if (existing === normalizedHref) continue
|
|
454
|
+
if (existing !== undefined) {
|
|
455
|
+
let scopeDescription = scope ? \` in scope "\${scope}"\` : ''
|
|
456
|
+
console.warn(
|
|
457
|
+
\`[remix] HMR reloading page after import map conflict for "\${specifier}"\${scopeDescription}: \` +
|
|
458
|
+
formatImportMapAddress(existing) +
|
|
459
|
+
' is already installed, but the new map points to ' +
|
|
460
|
+
formatImportMapAddress(normalizedHref),
|
|
461
|
+
)
|
|
462
|
+
return null
|
|
463
|
+
}
|
|
464
|
+
delta[specifier] = href
|
|
465
|
+
}
|
|
466
|
+
return Object.keys(delta).length > 0 ? delta : undefined
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function mergeImportMap(installed, importMap) {
|
|
470
|
+
mergeImportMapImports(installed.imports, importMap.imports)
|
|
471
|
+
if (!importMap.scopes || typeof importMap.scopes !== 'object') return
|
|
472
|
+
for (let [scope, entries] of Object.entries(importMap.scopes)) {
|
|
473
|
+
let normalizedScope = normalizeImportMapUrl(scope)
|
|
474
|
+
if (!normalizedScope || !entries || typeof entries !== 'object') continue
|
|
475
|
+
let installedEntries = installed.scopes.get(normalizedScope)
|
|
476
|
+
if (!installedEntries) {
|
|
477
|
+
installedEntries = new Map()
|
|
478
|
+
installed.scopes.set(normalizedScope, installedEntries)
|
|
479
|
+
}
|
|
480
|
+
mergeImportMapImports(installedEntries, entries)
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function mergeImportMapImports(installed, entries) {
|
|
485
|
+
if (!entries || typeof entries !== 'object') return
|
|
486
|
+
for (let [specifier, href] of Object.entries(entries)) {
|
|
487
|
+
if (href !== null && typeof href !== 'string') continue
|
|
488
|
+
let normalizedSpecifier = normalizeImportMapSpecifier(specifier)
|
|
489
|
+
if (!normalizedSpecifier || installed.has(normalizedSpecifier)) continue
|
|
490
|
+
installed.set(normalizedSpecifier, normalizeImportMapAddress(href))
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function normalizeImportMapSpecifier(specifier) {
|
|
495
|
+
if (
|
|
496
|
+
specifier.startsWith('/') ||
|
|
497
|
+
specifier.startsWith('./') ||
|
|
498
|
+
specifier.startsWith('../') ||
|
|
499
|
+
URL.canParse(specifier)
|
|
500
|
+
) {
|
|
501
|
+
return normalizeImportMapUrl(specifier)
|
|
502
|
+
}
|
|
503
|
+
return specifier
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function normalizeImportMapAddress(href) {
|
|
507
|
+
return href === null ? null : normalizeImportMapUrl(href)
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function formatImportMapAddress(href) {
|
|
511
|
+
return href === null ? 'null' : '"' + href + '"'
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function normalizeImportMapUrl(value) {
|
|
515
|
+
try {
|
|
516
|
+
return new URL(value, document.baseURI).href
|
|
517
|
+
} catch {
|
|
518
|
+
return null
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
349
522
|
function reloadPage() {
|
|
350
523
|
if (pageReloadTimer) clearTimeout(pageReloadTimer)
|
|
351
524
|
pageReloadTimer = setTimeout(() => {
|
package/dist/lib/routes.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ export interface AssetRouteMatch {
|
|
|
15
15
|
urlRoot: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function compileRoutes(basePath: string, mountConfigs: readonly MountConfig[]): CompiledRoutes;
|
|
18
|
+
export declare function resolveMountFileRoot(rootDir: string, fileRoot: string): string;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=routes.d.ts.map
|
package/dist/lib/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":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G,IAAI,CAAA;CACxD;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,SAAS,WAAW,EAAE,GACnC,cAAc,CA8DhB;AAuCD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU9E"}
|
package/dist/lib/routes.js
CHANGED
|
@@ -76,7 +76,7 @@ function normalizeMountUrlRoot(urlRoot) {
|
|
|
76
76
|
}
|
|
77
77
|
return url.pathname.replace(/\/+$/, '') || '/';
|
|
78
78
|
}
|
|
79
|
-
function resolveMountFileRoot(rootDir, fileRoot) {
|
|
79
|
+
export function resolveMountFileRoot(rootDir, fileRoot) {
|
|
80
80
|
let resolvedRoot = resolveFilePath(rootDir, fileRoot);
|
|
81
81
|
try {
|
|
82
82
|
resolvedRoot = normalizeFilePath(fs.realpathSync(resolvedRoot));
|
|
@@ -8,6 +8,10 @@ type ScriptCompileResult = {
|
|
|
8
8
|
fingerprint: string | null;
|
|
9
9
|
sourceMap: EmittedAsset | null;
|
|
10
10
|
};
|
|
11
|
+
export type ScriptImportMap = {
|
|
12
|
+
imports: Record<string, string>;
|
|
13
|
+
scopes?: Record<string, Record<string, string>>;
|
|
14
|
+
};
|
|
11
15
|
type ScriptGetResult = {
|
|
12
16
|
script: ScriptCompileResult;
|
|
13
17
|
type: 'script';
|
|
@@ -21,7 +25,6 @@ type ScriptGetOptions = {
|
|
|
21
25
|
requestedFingerprint: string | null;
|
|
22
26
|
};
|
|
23
27
|
type ScriptCompilerOptions = {
|
|
24
|
-
buildId?: string;
|
|
25
28
|
define?: Record<string, string>;
|
|
26
29
|
external: string[];
|
|
27
30
|
fingerprintAssets: boolean;
|
|
@@ -51,7 +54,9 @@ type ScriptCompilerOptions = {
|
|
|
51
54
|
type ScriptCompiler = {
|
|
52
55
|
getScript(filePath: string, options: ScriptGetOptions): Promise<ScriptGetResult>;
|
|
53
56
|
getPreloadLayers(filePath: string | readonly string[]): Promise<string[][]>;
|
|
57
|
+
getImportMap(filePath: string | readonly string[]): Promise<ScriptImportMap>;
|
|
54
58
|
getHref(filePath: string): Promise<string>;
|
|
59
|
+
resolveSpecifierFromRoot(specifier: string): Promise<string>;
|
|
55
60
|
classifyHmrFileEvent(filePath: string, event: ModuleWatchEvent): Promise<ScriptHmrUpdate[]>;
|
|
56
61
|
invalidateFileEvent(filePath: string, event: ModuleWatchEvent): void;
|
|
57
62
|
parseRequestPathname(pathname: string): ParsedRequestPathname | null;
|
|
@@ -69,7 +74,8 @@ export type ScriptHmrUpdate = {
|
|
|
69
74
|
timestamp: number;
|
|
70
75
|
} | {
|
|
71
76
|
accepted: true;
|
|
72
|
-
|
|
77
|
+
acceptedFilePath: string;
|
|
78
|
+
acceptedUrlPathname: string;
|
|
73
79
|
filePath: string;
|
|
74
80
|
path: string;
|
|
75
81
|
timestamp: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/compiler.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAKV,gBAAgB,EACjB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,WAAW,CAAA;AAK5D,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,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