porffor 0.49.6 โ†’ 0.49.7

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/README.md CHANGED
@@ -42,7 +42,7 @@ Expect nothing to work! Only very limited JS is currently supported. See files i
42
42
  > [!WARNING]
43
43
  > Very experimental WIP feature!
44
44
 
45
- **`porf profile path/to/script.js`**
45
+ **`porf hotlines path/to/script.js`**
46
46
 
47
47
  ### Debugging a JS file
48
48
  > [!WARNING]
@@ -54,7 +54,7 @@ Expect nothing to work! Only very limited JS is currently supported. See files i
54
54
  > [!WARNING]
55
55
  > Very experimental WIP feature!
56
56
 
57
- **`porf debug-wasm path/to/script.js`**
57
+ **`porf dissect path/to/script.js`**
58
58
 
59
59
 
60
60
  ### Options
@@ -80,7 +80,7 @@ Asur is Porffor's own Wasm engine; it is an intentionally simple interpreter wri
80
80
  Rhemyn is Porffor's own regex engine; it compiles literal regex to Wasm bytecode AOT (remind you of anything?). It is quite basic and WIP. See [its readme](rhemyn/README.md) for more details.
81
81
 
82
82
  ### 2c
83
- 2c is Porffor's own Wasm -> C compiler, using generated Wasm bytecode and internal info to generate specific and efficient/fast C code. Little boilerplate/preluded code or required external files, just for CLI binaries (not like wasm2c very much).
83
+ 2c is Porffor's own Wasm -> C compiler, using generated Wasm bytecode and internal info to generate specific and efficient C code. Little boilerplate/preluded code or required external files, just for CLI binaries (not like wasm2c very much).
84
84
 
85
85
  ## Versioning
86
86
  Porffor uses a unique versioning system, here's an example: `0.48.7`. Let's break it down:
package/compiler/parse.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { log } from './log.js';
2
2
  import './prefs.js';
3
3
 
4
- const file = process.argv.slice(2).find(x => x[0] !== '-' && !['run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm'].includes(x));
4
+ const file = process.argv.slice(2).find(x => x[0] !== '-' && !['precompile', 'run', 'wasm', 'native', 'c', 'hotlines', 'debug', 'dissect'].includes(x));
5
5
 
6
6
  // should we try to support types (while parsing)
7
7
  const types = Prefs.parseTypes || Prefs.t || file?.endsWith('.ts');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.49.6",
4
+ "version": "0.49.7",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.49.6';
3
+ globalThis.version = '0.49.7';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
@@ -11,43 +11,38 @@ const start = performance.now();
11
11
 
12
12
  if (process.argv.includes('--help')) {
13
13
  // description + version
14
- console.log(`\x1B[1m\x1B[35mPorffor\x1B[0m is a JavaScript engine/runtime/compiler. \x1B[90m(${globalThis.version})\x1B[0m`);
14
+ console.log(`\x1B[1m\x1B[35mPorffor\x1B[0m is a JavaScript/TypeScript engine/compiler/runtime. \x1B[90m(${globalThis.version})\x1B[0m`);
15
15
 
16
16
  // basic usage
17
- console.log(`Usage: \x1B[1mporf [command] [...prefs] path/to/script.js [...args]\x1B[0m`);
17
+ console.log(`Usage: \x1B[1mporf <command> [...prefs] path/to/script.js [...args]\x1B[0m`);
18
18
 
19
19
  // commands
20
- console.log(`\n\x1B[1mCommands:\x1B[0m`);
21
- for (const [ cmd, [ color, desc ] ] of Object.entries({
22
- run: [ 34, 'Run a JS file' ],
23
- wasm: [ 34, 'Compile a JS file to a Wasm binary\n' ],
20
+ for (let [ cmd, [ color, post, desc ] ] of Object.entries({
21
+ 'Compile': [],
22
+ '': [ 34, 'foo.js', 'Compile and execute a file' ],
23
+ wasm: [ 34, 'foo.js foo.wasm', 'Compile to a Wasm binary' ],
24
+ c: [ 94, 'foo.js foo.c', 'Compile to C source code' ],
25
+ native: [ 94, 'foo.js foo', 'Compile to a native binary' ],
26
+
27
+ 'Profile': [],
28
+ flamegraph: [ 93, 'foo.js', 'View detailed func-by-func performance' ],
29
+ hotlines: [ 93, 'foo.js', 'View source with line-by-line performance' ],
30
+
31
+ 'Debug': [],
32
+ debug: [ 33, 'foo.js', 'Debug the source of a file' ],
33
+ dissect: [ 33, 'foo.js', 'Debug the compiled Wasm of a file' ],
34
+ })) {
35
+ if (color == null) {
36
+ // header
37
+ console.log(`\n\x1B[1m\x1B[4m${cmd}\x1B[0m`);
38
+ continue;
39
+ }
24
40
 
25
- c: [ 31, 'Compile a JS file to C source code' ],
26
- native: [ 31, 'Compile a JS file to a native binary\n' ],
41
+ if (cmd.length > 0) post = ' ' + post;
27
42
 
28
- profile: [ 33, 'Profile a JS file' ],
29
- debug: [ 33, 'Debug a JS file' ],
30
- 'debug-wasm': [ 33, 'Debug the compiled Wasm of a JS file' ],
31
- })) {
32
- console.log(` \x1B[1m\x1B[${color}m${cmd}\x1B[0m${' '.repeat(20 - cmd.length - (desc.startsWith('๐Ÿงช') ? 3 : 0))}${desc}`);
43
+ console.log(` \x1B[90mporf\x1B[0m \x1B[1m\x1B[${color}m${cmd}\x1B[0m\x1B[2m${post}\x1B[0m ${' '.repeat(30 - cmd.length - post.length)}${desc}`);
33
44
  }
34
45
 
35
- // console.log();
36
-
37
- // // options
38
- // console.log(`\n\u001b[4mCommands\x1B[0m`);
39
- // for (const [ cmd, [ color, desc ] ] of Object.entries({
40
- // run: [ 34, 'Run a JS file' ],
41
- // wasm: [ 34, 'Compile a JS file to a Wasm binary\n' ],
42
- // c: [ 31, 'Compile a JS file to C source code' ],
43
- // native: [ 31, 'Compile a JS file to a native binary\n' ],
44
- // profile: [ 33, 'Profile a JS file' ],
45
- // debug: [ 33, 'Debug a JS file' ],
46
- // 'debug-wasm': [ 33, 'Debug the compiled Wasm of a JS file' ]
47
- // })) {
48
- // console.log(` \x1B[1m\x1B[${color}m${cmd}\x1B[0m${' '.repeat(20 - cmd.length - (desc.startsWith('๐Ÿงช') ? 3 : 0))}${desc}`);
49
- // }
50
-
51
46
  console.log();
52
47
  process.exit(0);
53
48
  }
@@ -59,7 +54,7 @@ const done = async () => {
59
54
  };
60
55
 
61
56
  let file = process.argv.slice(2).find(x => x[0] !== '-');
62
- if (['precompile', 'run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm'].includes(file)) {
57
+ if (['precompile', 'run', 'wasm', 'native', 'c', 'hotlines', 'debug', 'dissect'].includes(file)) {
63
58
  // remove this arg
64
59
  process.argv.splice(process.argv.indexOf(file), 1);
65
60
 
@@ -68,8 +63,8 @@ if (['precompile', 'run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm
68
63
  await done();
69
64
  }
70
65
 
71
- if (file === 'profile') {
72
- await import('./profile.js');
66
+ if (file === 'hotlines') {
67
+ await import('./hotlines.js');
73
68
  await done();
74
69
  }
75
70
 
@@ -82,7 +77,7 @@ if (['precompile', 'run', 'wasm', 'native', 'c', 'profile', 'debug', 'debug-wasm
82
77
  process.argv.push(`--target=${file}`);
83
78
  }
84
79
 
85
- if (file === 'debug-wasm') {
80
+ if (file === 'dissect') {
86
81
  process.argv.push('--asur', '--wasm-debug');
87
82
  }
88
83
 
File without changes