porffor 0.57.22 → 0.57.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compiler/index.js CHANGED
@@ -227,6 +227,8 @@ export default (code, module = undefined) => {
227
227
  }
228
228
 
229
229
  if (target === 'c') {
230
+ if (Prefs.wasm) fs.writeFileSync(Prefs.wasm, Buffer.from(wasm));
231
+
230
232
  const c = toc(out);
231
233
  out.c = c;
232
234
 
@@ -248,12 +250,15 @@ export default (code, module = undefined) => {
248
250
  if (target === 'native') {
249
251
  outFile ??= Prefs.native ? './porffor_tmp' : file.split('/').at(-1).split('.')[0];
250
252
 
251
- const compiler = (Prefs.compiler ?? 'clang').split(' ');
253
+ const compiler = (Prefs.compiler ?? process.env.CC ?? 'cc').split(' ');
252
254
  const cO = Prefs._cO ?? 'O3';
253
255
 
254
256
  const tmpfile = 'porffor_tmp.c';
255
257
  const args = [ ...compiler, tmpfile, '-o', outFile ?? (process.platform === 'win32' ? 'out.exe' : 'out'), '-' + cO ];
258
+
259
+ // todo: redo how default cc args work
256
260
  if (compiler.includes('clang')) args.push('-lm', '-flto=thin', '-march=native', '-ffast-math', '-fno-exceptions', '-fno-ident', '-fno-asynchronous-unwind-tables', '-ffunction-sections', '-fdata-sections');
261
+
257
262
  if (Prefs.s) args.push('-s');
258
263
 
259
264
  if (logProgress) progressStart('compiling Wasm to C...');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "An ahead-of-time JavaScript compiler",
4
- "version": "0.57.22",
4
+ "version": "0.57.23",
5
5
  "author": "Oliver Medhurst <honk@goose.icu>",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runtime/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.57.22';
3
+ globalThis.version = '0.57.23';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {