Skip to content

Commit 6aec99f

Browse files
authored
Merge pull request #6 from Abse2001/main
fixed the make-vfs repo added path from path/posix insted of from path
2 parents 896c731 + 8ed6076 commit 6aec99f

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import yargs from "yargs"
44
import { hideBin } from "yargs/helpers"
55
import * as fs from "fs/promises"
66
import mkdirp from "mkdirp"
7-
import path from "path"
7+
import path from "path/posix"
88

99
const argv = yargs(hideBin(process.argv))
1010
.option("dir", {

src/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import glob from "glob-promise"
22
import mkdirp from "mkdirp"
3-
import path from "path"
3+
import path from "path/posix"
44
import prettier from "prettier"
55
import { existsSync } from "fs"
66
import fs from "fs/promises"
@@ -85,7 +85,9 @@ export const getVirtualFilesystemModuleFromDirPath = async (
8585
Object.entries(vfs)
8686
.map(([path, content]) =>
8787
cf === "buffer"
88-
? ` "${path}": Buffer.from("${content.toString("base64")}", "base64")`
88+
? ` "${path}": Buffer.from("${content.toString(
89+
"base64"
90+
)}", "base64")`
8991
: ` "${path}": decodeURIComponent("${replaceSafeEncodedChars(
9092
encodeURIComponent(content.toString())
9193
)}")`
@@ -148,11 +150,15 @@ export const getVirtualFilesystemModuleFromDirPath = async (
148150
let fps = Object.keys(vfs)
149151
return (
150152
`${fps
151-
.map((fp) =>
152-
`import ${idsafe(fp)} from "./${path.join(basePath, fp)}" with { type: "file" };`
153+
.map(
154+
(fp) =>
155+
`import ${idsafe(fp)} from "./${path.join(
156+
basePath,
157+
fp
158+
)}" with { type: "file" };`
153159
)
154160
.join("\n")}\n\n` +
155-
'import { file } from "bun";\n\n' +
161+
'import { file } from "bun";\n\n' +
156162
`export default {\n` +
157163
fps.map((fp) => ` "${fp}": file(${idsafe(fp)})`).join(",\n") +
158164
`\n}`

0 commit comments

Comments
 (0)