|
4 | 4 | * This file defines all the different variants of the quickjs WASM library.
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -import path from "path" |
8 |
| -import fs, { write } from "fs" |
9 |
| -import prettier from "prettier" |
| 7 | +import path from "node:path" |
| 8 | +import fs from "node:fs" |
| 9 | +import { writePretty } from "./scripts/helpers" |
10 | 10 | import { Context, getMatches, buildFFI } from "./generate"
|
11 | 11 | import { TypeDocOptions } from "typedoc"
|
12 | 12 |
|
@@ -374,21 +374,6 @@ async function main() {
|
374 | 374 | await writePretty(path.join(__dirname, "variants.json"), JSON.stringify(variantsJson))
|
375 | 375 | }
|
376 | 376 |
|
377 |
| -async function writePretty(filePath: string, text: string) { |
378 |
| - let output = text |
379 |
| - |
380 |
| - const isPrettierUnsupportedType = filePath.endsWith(".mk") || filePath.endsWith("Makefile") |
381 |
| - if (!isPrettierUnsupportedType) { |
382 |
| - const prettierConfig = (await prettier.resolveConfig(filePath)) ?? {} |
383 |
| - output = await prettier.format(text, { |
384 |
| - ...prettierConfig, |
385 |
| - filepath: filePath, |
386 |
| - }) |
387 |
| - } |
388 |
| - console.warn(`write`, path.relative(process.cwd(), filePath)) |
389 |
| - fs.writeFileSync(filePath, output) |
390 |
| -} |
391 |
| - |
392 | 377 | const describeInclusion = {
|
393 | 378 | [EmscriptenInclusion.SingleFile]: `The WASM runtime is included directly in the JS file. Use if you run into issues with missing .wasm files when building or deploying your app.`,
|
394 | 379 | [EmscriptenInclusion.Separate]: `Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant.`,
|
|
0 commit comments