Skip to content

Commit

Permalink
Fix bundling not using ascii_only
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgithub committed Mar 22, 2024
1 parent f90bb77 commit e99b886
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js_printer.zig
Expand Up @@ -6036,7 +6036,8 @@ pub fn printWithWriterAndPlatform(
comptime generate_source_maps: bool,
) PrintResult {
const PrinterType = NewPrinter(
false,
// if it's bun, it is also ascii_only
is_bun_platform,
Writer,
false,
is_bun_platform,
Expand Down
22 changes: 22 additions & 0 deletions test/regression/issue/09559.test.ts
@@ -0,0 +1,22 @@
import { $ } from "bun";
import { expect, test } from "bun:test";
import { bunEnv, bunExe, tempDirWithFiles } from "harness";
import { readdirSync } from "node:fs";
import { join } from "path";

test("bun build --target bun should support non-ascii source", async () => {
const files = {"index.js": `
console.log(JSON.stringify({我: "a"}));
const 我 = "b";
console.log(JSON.stringify({我}));
`};
const filenames = Object.keys(files);
const source = tempDirWithFiles("source", files);

$.throws(true);
await $`${bunExe()} build --target bun ${join(source, "index.js")} --outfile ${join(source, "bundle.js")}`;
const result = await $`${bunExe()} ${join(source, "bundle.js")}`.text();

expect(result).toBe(`{"我":"a"}\n{"我":"b"}\n`);
})

0 comments on commit e99b886

Please sign in to comment.