Created
December 9, 2024 20:53
-
-
Save fusionstrings/2ee2ced7d1eb8a028823e4ed272bd0ed to your computer and use it in GitHub Desktop.
ESZIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { build, LoadResponse, Parser } from 'npm:@deno/eszip'; | |
const moduleURL = | |
'https://raw.githubusercontent.com/fusionstrings/fusionstrings/refs/heads/creation/package/src/dom/home.ts'; | |
const importmapURL = | |
'https://raw.githubusercontent.com/fusionstrings/fusionstrings/refs/heads/creation/deno.json'; | |
const path = new URL('./home.ts', import.meta.url).href; | |
console.log(path); | |
async function main() { | |
const eszip = await build([path], undefined, importmapURL); | |
const parser = await Parser.createInstance(); | |
const specifiers = await parser.parseBytes(eszip); | |
console.log('specifier', specifiers); | |
console.log(typeof specifiers) | |
await parser.load(); | |
for await (const specifier of specifiers) { | |
console.log('s', specifier); | |
const code = await parser.getModuleSource(specifier); | |
console.log('code'); | |
console.log(code); | |
} | |
await Deno.writeFile('path.eszip2', eszip); | |
return eszip; | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment