Skip to content

Commit 8205a46

Browse files
committed
Fix module type issues in scripts
Signed-off-by: Roberto Raggi <[email protected]>
1 parent c423f45 commit 8205a46

13 files changed

+52
-17
lines changed

package-lock.json

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

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.1.27",
44
"description": "A compiler frontend for C++23",
55
"private": true,
6+
"type": "module",
67
"keywords": [
78
"c++",
89
"compiler",
@@ -25,6 +26,7 @@
2526
},
2627
"devDependencies": {
2728
"@types/node": "^24.8.1",
29+
"jsonc-parser": "^3.3.1",
2830
"zx": "^8.8.5"
2931
},
3032
"workspaces": [
@@ -34,14 +36,14 @@
3436
"build:cxx-frontend": "npm run build -w cxx-frontend",
3537
"build:playground": "npm run build -w @robertoraggi/cxx-playground",
3638
"build:emscripten": "npm run build -w cxx-frontend",
37-
"build:wasi": "zx scripts/build-wasi.mjs",
38-
"build:mlir": "zx scripts/build-mlir.mjs",
39+
"build:wasi": "node scripts/build-wasi.js",
40+
"build:mlir": "node scripts/build-mlir.js",
3941
"playground": "npm run dev -w @robertoraggi/cxx-playground",
40-
"setup-venv": "zx scripts/setup-venv.mjs",
41-
"update-tests": "zx scripts/update-tests.mjs",
42+
"setup-venv": "node scripts/setup-venv.js",
43+
"update-tests": "node scripts/update-tests.js",
4244
"cxx-gen-ast": "node --no-warnings packages/cxx-gen-ast/src/gen.ts",
4345
"cxx-gen-lsp": "node --no-warnings packages/cxx-gen-lsp/src/main.ts packages/cxx-gen-lsp/metaModel.json packages/cxx-gen-lsp -o src/lsp/cxx/lsp",
44-
"download-lsp-model": "zx scripts/download-lsp-model.mjs",
46+
"download-lsp-model": "node scripts/download-lsp-model.js",
4547
"download-mlir": "gh run download -n mlir --dir build.em/llvm-project/install/"
4648
}
4749
}
File renamed without changes.

scripts/build-mlir.mjs renamed to scripts/build-mlir.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ async function main() {
9696
await zx.fs.mkdir(llvm_source_dir, { recursive: true });
9797
await zx.fs.writeFile(zx.path.join(llvm_source_dir, ".gitignore"), "*");
9898

99+
await zx.fs.writeFile(
100+
zx.path.join(llvm_install_dir, "package.json"),
101+
`{
102+
"name": "mlir",
103+
"version": "${version}",
104+
"type": "commonjs"
105+
}`
106+
);
107+
99108
await downloadLLVM({ version, packages, outdir: llvm_source_dir });
100109

101110
await $`emcmake cmake ${llvm_cmake_options} -S ${llvm_source_dir}/llvm -B ${llvm_build_dir}/llvm -DCMAKE_INSTALL_PREFIX=${llvm_install_dir}`;
@@ -120,7 +129,8 @@ async function main() {
120129

121130
await zx.fs.writeFile(
122131
zx.path.join(llvm_install_dir, "bin", app),
123-
`#!/usr/bin/env node\nrequire("./${app}.js");`
132+
`#!/usr/bin/env node
133+
require("./${app}.js");`
124134
);
125135

126136
await zx.fs.chmod(zx.path.join(llvm_install_dir, "bin", app), 0o755);
@@ -154,8 +164,4 @@ async function main() {
154164
}
155165
}
156166

157-
try {
158-
await main();
159-
} catch (e) {
160-
console.error(e.message);
161-
}
167+
await await main();
File renamed without changes.

scripts/cxx-wasmtime.mjs renamed to scripts/cxx-wasmtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ try {
4242
} catch (e) {
4343
if (e instanceof ProcessOutput) {
4444
echo`${e}`;
45-
process.exit(e.status);
45+
process.exit(e.exitCode);
4646
} else {
4747
process.exit(1);
4848
}

scripts/devcontainer-post-create.sh

100755100644
File mode changed.
File renamed without changes.
File renamed without changes.

scripts/tsconfig.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@
55
"lib": ["esnext"],
66
"types": ["node"],
77

8+
"noEmit": true,
9+
10+
// Stricter Typechecking Options
811
"noUncheckedIndexedAccess": true,
912
"exactOptionalPropertyTypes": true,
1013

14+
// Style Options
15+
// "noImplicitReturns": true,
16+
// "noImplicitOverride": true,
17+
// "noUnusedLocals": true,
18+
// "noUnusedParameters": true,
19+
// "noFallthroughCasesInSwitch": true,
20+
// "noPropertyAccessFromIndexSignature": true,
21+
22+
// Recommended Options
1123
"strict": true,
12-
// "verbatimModuleSyntax": true,
24+
"jsx": "react-jsx",
25+
"verbatimModuleSyntax": true,
1326
"isolatedModules": true,
1427
"noUncheckedSideEffectImports": true,
1528
"moduleDetection": "force",

0 commit comments

Comments
 (0)