Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/jco-transpile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@bytecodealliance/preview2-shim": "^0.19.0",
"@bytecodealliance/preview3-shim": "^0.2.0",
"binaryen": "^130.0.0",
"terser": "^5"
"oxc-minify": "^0.136.0"
},
"devDependencies": {
"@bytecodealliance/componentize-js": "catalog:",
Expand Down
9 changes: 4 additions & 5 deletions packages/jco-transpile/src/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
import { Buffer } from 'node:buffer';
import { extname, basename, resolve } from 'node:path';

import { minify } from 'terser';
import { minify } from 'oxc-minify';

import { $init as $initBindgenComponent, generate } from '../vendor/js-component-bindgen-component.js';
import type {
Expand Down Expand Up @@ -351,14 +351,13 @@ export async function transpileBytes(

// Perform minification if configured
if (opts.minify && jsFile) {
const minified = await minify(Buffer.from(jsFile[1]).toString('utf8'), {
const minified = await minify('component.js', Buffer.from(jsFile[1]).toString('utf8'), {
module: true,
compress: {
ecma: 2019,
unsafe: true,
target: 'es2019',
},
mangle: {
keep_classnames: true,
keepNames: true,
},
});
jsFile[1] = new TextEncoder().encode(minified.code);
Expand Down
5 changes: 2 additions & 3 deletions packages/jco-transpile/test/transpile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fileURLToPath, URL } from 'node:url';
import { writeFile } from 'node:fs/promises';
import { Buffer } from 'node:buffer';

import { suite, test, assert } from 'vitest';

Expand Down Expand Up @@ -88,7 +88,6 @@ suite('Transpile', async () => {
assert.strictEqual(imports.length, 4);
assert.strictEqual(exports.length, 3);
assert.deepStrictEqual(exports[0], ['test', 'instance']);
await writeFile('/tmp/output.min.js', files[name + '.js']);
assert.isAtMost(files[name + '.js'].length, FLAVORFUL_WASM_TRANSPILED_CODE_CHAR_LIMIT);
assert.isBelow(files[name + '.js'].length, FLAVORFUL_WASM_TRANSPILED_CODE_CHAR_LIMIT);
});
});
3 changes: 1 addition & 2 deletions packages/jco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
"binaryen": "^130.0.0",
"commander": "^14",
"mkdirp": "^3",
"ora": "^8",
"terser": "^5"
"ora": "^8"
},
"devDependencies": {
"@commitlint/config-conventional": "^19.8.1",
Expand Down
Loading
Loading