webcontainer-utils
v0.0.1
Published
[![NPM version](https://img.shields.io/npm/v/webcontainer-utils?color=a1b858&label=)](https://www.npmjs.com/package/webcontainer-utils)
Downloads
1
Readme
webcontainer-utils
webcontainer-utils
is a small utility package for WebContainers. Currently there are only a small number of utils. More will be added in the future. If you have any suggestions feel free to open an issue or a PR!
convertRawGlobImportToFileSystemTree()
Converts a Vite raw glob import into Webcontainers FileSystemTree structure.
Usage
import { WebContainer } from '@webcontainer/api'
import { convertRawGlobImportToFileSystemTree } from 'webcontainer-utils'
const files = import.meta.glob('./playground/**/*.*', { as: 'raw' })
const filesystem = await convertRawGlobImportToFileSystemTree(files)
const container = await WebContainer.boot()
container.mount(filesystem)
License
MIT License © 2023 Jacob Clevenger