
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@laziest/resource-manager
Advanced tools
@laziest/resource-managerBrowser-only resource preloading for web applications.
@laziest/resource-manager helps you preload runtime assets such as images, fonts, audio, video, lottie JSON, JSON, text, and binary files with a single scene-scoped manager instance.
pnpm add @laziest/resource-manager
Create one ResourceManager per scene, route, or page-level preload workflow.
import { ResourceManager } from '@laziest/resource-manager'
const manager = new ResourceManager({
concurrency: 4,
logLevel: 'info',
})
await manager.preload({
images: ['/images/hero.webp', '/images/logo.png'],
fonts: [
{
family: 'Brand Sans',
url: '/fonts/brand-sans.woff2',
},
],
audio: ['/audio/click.mp3'],
lottie: ['/animations/intro.json'],
json: ['/data/bootstrap.json'],
})
When all required resources succeed, preload() resolves with the completed result.
If any required resource reaches a final failure, preload() rejects with ResourcePreloadError.
Resources are grouped by bucket. The bucket itself defines the resource type, so each item does not need a type field.
await manager.preload({
images: [
'/images/hero.webp',
{ url: '/images/banner.webp', optional: true },
],
fonts: [
{
family: 'Brand Sans',
url: '/fonts/brand-sans.woff2',
descriptors: { weight: '400', style: 'normal' },
},
],
audio: [
'/audio/click.mp3',
{
url: '/audio/bgm.mp3',
preload: 'auto',
crossOrigin: 'anonymous',
},
],
video: [
{
url: '/video/intro.mp4',
preload: 'metadata',
},
],
lottie: ['/animations/intro.json'],
json: [
{
url: '/api/bootstrap.json',
requestInit: {
headers: {
Accept: 'application/json',
},
},
},
],
text: ['/copy/legal.txt'],
binary: ['/models/mesh.bin'],
})
Supported buckets:
imagesfontsaudiovideolottiejsontextbinaryThe manager is the shared state container for one preload workflow.
const manager = new ResourceManager({ concurrency: 3 })
const unsubscribe = manager.subscribe(({ snapshot, event }) => {
if (event.type === 'item-progress') {
console.log('loading', event.item.url, event.item.transfer)
}
console.log('progress', snapshot.completed, '/', snapshot.total)
console.log('active', snapshot.activeItems.map((item) => item.url))
})
try {
await manager.preload({
images: ['/images/hero.webp'],
json: ['/data/bootstrap.json'],
})
} finally {
unsubscribe()
}
Snapshot fields include:
status: idle | running | completed | failed | abortedtotalqueuedloadingsucceededfailedskippedcompletedprogress: 0 to 1activeItemsrecentlyCompletederrorswarningsCommon event types include:
session-starteditem-starteditem-progressitem-succeededitem-retryingitem-failedwarningsession-completedsession-failedsession-abortedsession-resetRequired resources fail the preload session. Optional resources become warnings and skipped items.
import {
ResourceManager,
ResourcePreloadError,
} from '@laziest/resource-manager'
const manager = new ResourceManager()
try {
await manager.preload({
images: ['/images/hero.webp'],
json: ['/data/bootstrap.json'],
})
} catch (error) {
if (error instanceof ResourcePreloadError) {
console.error(error.result.status)
console.error(error.result.errors)
console.error(error.result.warnings)
} else {
throw error
}
}
Failure categories include:
httpnetworktimeoutabortdecodeparseunsupportedunknownImportant behavior:
404 on a required resource is a final failureoptional: true and become skipped warnings after final failureabort() ends the active session and rejects the pending preload promiseconst manager = new ResourceManager({
concurrency: 4,
logLevel: 'debug',
retry: {
maxRetries: 2,
delayMs: 250,
backoff: 'exponential',
},
})
Available log levels:
silenterrorwarninfodebugYou can also provide a custom logger:
const manager = new ResourceManager({
logLevel: 'debug',
logger: {
error(message, context) {
console.error(message, context)
},
warn(message, context) {
console.warn(message, context)
},
info(message, context) {
console.info(message, context)
},
debug(message, context) {
console.debug(message, context)
},
},
})
Lifecycle helpers:
abort() cancels the active preload sessionreset() returns the manager to the idle snapshotresetClearsCache: true also clears the successful-resource cacheimport {
ResourceManager,
ResourcePreloadError,
consoleResourceLogger,
shouldLog,
type ResourceBuckets,
type ResourceManagerSnapshot,
type RetryOptions,
} from '@laziest/resource-manager'
FAQs
面向浏览器应用的资源加载库,支持静态 plan、优先级调度、blocking group 与后台续载。
The npm package @laziest/resource-manager receives a total of 2 weekly downloads. As such, @laziest/resource-manager popularity was classified as not popular.
We found that @laziest/resource-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.