Skip to content

Commit

Permalink
deps: update to latest deps, including ComponentizeJS (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Aug 22, 2024
1 parent dc3cf8d commit 7614126
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 357 deletions.
10 changes: 0 additions & 10 deletions eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"rules": {
"no-sparse-arrays": 0,
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
Expand Down
552 changes: 233 additions & 319 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
"terser": "^5"
},
"devDependencies": {
"@bytecodealliance/componentize-js": "^0.9.0",
"@bytecodealliance/componentize-js": "^0.10.4",
"@types/node": "^20.14.12",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"eslint": "^9.9.0",
"mime": "^4.0.4",
"mocha": "^10.7.0",
"puppeteer": "^22.14.0",
"terser": "^5.16.1",
"typescript": "^5.5.4"
},
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions packages/preview2-shim/lib/nodejs/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Descriptor {
let isSymlink = false;
try {
isSymlink = lstatSync(fullPath).isSymbolicLink();
} catch (e) {
} catch {
//
}
if (isSymlink) throw openFlags.directory ? "not-directory" : "loop";
Expand All @@ -361,7 +361,7 @@ class Descriptor {
let isFile = false;
try {
isFile = !statSync(fullPath).isDirectory();
} catch (e) {
} catch {
//
}
if (isFile) throw "not-directory";
Expand Down Expand Up @@ -430,7 +430,7 @@ class Descriptor {
let isDir = false;
try {
isDir = statSync(fullPath).isDirectory();
} catch (_) {
} catch {
//
}
if (!isDir) throw isWindows ? "no-entry" : "not-directory";
Expand All @@ -449,7 +449,7 @@ class Descriptor {
let isDir = false;
try {
isDir = statSync(fullPath).isDirectory();
} catch (e) {
} catch {
//
}
throw isDir ? (isWindows ? "access" : (isMac ? "not-permitted" : "is-directory")) : "not-directory";
Expand Down
2 changes: 1 addition & 1 deletion packages/preview2-shim/lib/nodejs/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ class Fields {
}
try {
validateHeaderValue(name, new TextDecoder().decode(value));
} catch (e) {
} catch {
throw { tag: "invalid-syntax" };
}
const lowercased = name.toLowerCase();
Expand Down
4 changes: 4 additions & 0 deletions src/cmd/componentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ export async function componentize (jsSource, opts) {
throw new Error(`componentize-js must first be installed separately via "npm install @bytecodealliance/componentize-js".`);
throw e;
}
if (opts.disable?.includes('all')) {
opts.disable = ['stdio', 'random', 'clocks'];
}
const source = await readFile(jsSource, 'utf8');
const { component } = await componentizeFn(source, {
sourceName: basename(jsSource),
witPath: resolve(opts.wit),
worldName: opts.worldName,
disableFeatures: opts.disable,
enableFeatures: opts.enable,
preview2Adapter: opts.preview2Adapter,
});
await writeFile(opts.out, component);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/opt.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ora from '#ora';
let WASM_OPT;
try {
WASM_OPT = fileURLToPath(new URL('../../node_modules/binaryen/bin/wasm-opt', import.meta.url));
} catch (e) {
} catch {
WASM_OPT = new URL('../../node_modules/binaryen/bin/wasm-opt', import.meta.url);
}

Expand Down
3 changes: 2 additions & 1 deletion src/jco.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ program.command('componentize')
.argument('<js-source>', 'JS source file to build')
.requiredOption('-w, --wit <path>', 'WIT path to build with')
.option('-n, --world-name <name>', 'WIT world to build')
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks', 'http']))
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks', 'all']))
.addOption(new Option('-e, --enable <feature...>', 'enable WASI features').choices(['http']))
.option('--preview2-adapter <adapter>', 'provide a custom preview2 adapter path')
.requiredOption('-o, --out <out>', 'output component file')
.action(asyncAction(componentize));
Expand Down
6 changes: 1 addition & 5 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,7 @@ export async function cliTest(fixtures) {
"componentize",
"test/fixtures/componentize/source.js",
"-d",
"clocks",
"-d",
"random",
"-d",
"stdio",
"all",
"-w",
"test/fixtures/componentize/source.wit",
"-o",
Expand Down
10 changes: 0 additions & 10 deletions test/eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"rules": {
// allow this since we generate `const {} = e;` for empty structs
"no-empty-pattern": 0,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/componentize/source.wit
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ world test {
export consume-bar: func(bar: bar) -> string;

export hello: func() -> string;
}
}
2 changes: 2 additions & 0 deletions test/preview2.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export async function preview2Test() {
"test/fixtures/componentize/wasi-http-proxy/source.js",
"-w",
"test/fixtures/wit",
"-e",
"http",
"--world-name",
"test:jco/command-extended",
"-o",
Expand Down

0 comments on commit 7614126

Please sign in to comment.