npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@4bitlabs/sci-asset-loader

v0.1.1

Published

An Astro integration for loading Sierra On-Line SCI0/SCI01 engine assets from resource files and patches.

Readme

@4bitlabs/sci-asset-loader

License NPM Version NPM Downloads Ko-fi

An Astro integration for loading Sierra On-line SCI-engine assets from resource files and patches.

Install

npm install --save-dev astro @4bitlabs/sci0 @4bitlabs/sci-asset-loader

Usage

There are two loaders available sciAssetLoader and sciRawAssetLoader

sciAssetLoader

import { sciAssetLoader } from "@4bitlabs/sci-asset-loader";

This loader will load the uncompressed bytes into the collection entry with the following shape:

type Data = {
  id: number;      /* The SCI-engine ID number */
  content: string; /* Base64 encoded raw data */
}

sciRawAssetLoader

import { sciRawAssetLoader } from "@4bitlabs/sci-asset-loader";

This loader will load the compressed bytes into the collection entry with the following shape:

type Data = {
  id: number;             /* The SCI-engine ID number */
  compression: 0 | 1 | 2; /* The compression algoithm used */
  content: string;        /* Base64 encoded compressed data */
}

See decompress() from @4bitlabs/sci0 to manually decompress the data, when you need it.

Configuration

Add to Astro content.config.ts file, the same as any custom loader.

import { sciRawAssetLoader } from "@4bitlabs/sci-asset-loader";

/* other collection data */

/**
 * The loader will fill this collection with *all* resources from RESOURCE.MAP in `./path/to/kq4`
 * with the default collection ids of: "kq4/pic.001"
 */
const sciData = defineCollection({
  loader: sciRawAssetLoader({
    resources: {
      kq4: { path: './path/to/kq4' },
    },
  })
})

export const collections = {
  /* other collections */
  sciData,
}

Loading from multiple games

You can either point to multiple folders

const sciData = defineCollection({
  loader: sciRawAssetLoader({
    resources: {
      kq4: { path: './path/to/kq1' },
      sq3: { path: './path/to/sq3' },
    }
  })
})

or you can rename RESOURCE.MAP and RESOURCE.XXX files into the same folder and use resourceName option to load the correct ones:

const sciData = defineCollection({
  loader: sciRawAssetLoader({
    resources: {
      kq4: { 
        path: './path/to/sci0',
        resourceName: 'KQ4', /* will search for KG4.MAP and KG4.001 */
      },
      sq3: { 
        path: './path/to/sci0',
        resourceName: 'SQ3', /* will search for SQ3.MAP and SQ3.001 */
      },
    }
  })
})

Loading from patches

You can load from RESOURCE.* packs that can be found in most Sierra On-Line releases, or you can load specific PATCH files directly:

const sciData = defineCollection({
  loader: sciRawAssetLoader({
    patches: [
      { prefix: 'qg1', path: './path/to/patch/PIC.001', number: 1 },  /** loads "qg1/pic.001" */
      { prefix: 'qg1', path: './path/to/patch/VIEW.026', number: 26 } /** loads "qg1/view.026" */
    ],
  })
})

Customization

Filtering resources

You can filter resources to specific resource types, or resource number, to optimize the number of resources loaded into the collection, using the filter option:

import { Resource, ResourceType } from '@4bitlabs/sci0'; 

const sciData = defineCollection({
  loader: sciRawAssetLoader({
    idFn: (prefix: string, resourceId: number) => {
      /** your custom id logic here */
    }, 
    resources: {
      kq4: { 
        path: './path/to/kq4', 
        /** Only process resources that are PIC_TYPE resources */
        filter: (id: number) => Resource.getType(id) === ResourceType.PIC_TYPE,
      },
    },
  })
})

Adjusting the default collection id generation scheme

The default id generation will always generate "[prefix]/[type].[num]", where [prefix] is the key in the resources object or prefix value of a patch. [type] and [num] will be generated from the decoded resource as defined by the SCI-Engine. Some examples: kq4/pic.001 or qg1/view.029 or sq3/font.000

const sciData = defineCollection({
  loader: sciRawAssetLoader({
    idFn: (prefix: string, resourceId: number) => {
      /** your custom id logic here */
    }, 
    resources: {
      kq4: { path: './path/to/kq4' },
    },
  })
})