feat/assets-shards
Divyansh Singh 3 weeks ago
parent 7cae23a56c
commit a51b54e14f

@ -1,5 +1,5 @@
import { readFileSync, readdirSync } from 'node:fs' import { readFileSync, readdirSync } from 'node:fs'
import { join, resolve } from 'node:path' import { join, resolve, sep } from 'node:path'
import { fileURLToPath } from 'node:url' import { fileURLToPath } from 'node:url'
import { newPage, realErrors, waitForHydration, type TestPage } from './helpers' import { newPage, realErrors, waitForHydration, type TestPage } from './helpers'
@ -13,7 +13,12 @@ const origin = () => `http://localhost:${process.env['SHARDED_PORT']}`
const files = () => const files = () =>
readdirSync(dist('assets'), { recursive: true, withFileTypes: true }) readdirSync(dist('assets'), { recursive: true, withFileTypes: true })
.filter((e) => e.isFile()) .filter((e) => e.isFile())
.map((e) => join(e.parentPath, e.name).slice(dist('assets').length + 1)) .map((e) =>
join(e.parentPath, e.name)
.slice(dist('assets').length + 1)
.split(sep)
.join('/')
)
const isShardedPath = (f: string) => /^[0-2]\/[^/]+$/.test(f) const isShardedPath = (f: string) => /^[0-2]\/[^/]+$/.test(f)

Loading…
Cancel
Save