nirguna 1.1.1 → 1.2.1

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/ChangeLog CHANGED
@@ -1,3 +1,28 @@
1
+ 2026.03.03, v1.2.1
2
+
3
+ fix:
4
+ - eedfbf4 nirguna: bin: no output
5
+ - 11c51a9 @nirguna/plugin-bundler-fasm: replace-section-const-with-equ: order
6
+
7
+ feature:
8
+ - 8680c9b @nirguna/printer-fasm: rm unused
9
+ - 778ba36 @nirguna/printer-fasm: remove unused
10
+
11
+ 2026.03.02, v1.2.0
12
+
13
+ fix:
14
+ - 64da4e4 @putout/plugin-nirguna: putout version
15
+
16
+ feature:
17
+ - 1a9f176 @nirguna/printer-fasm: move out
18
+ - d77d729 nirguna: c8 -> superc8
19
+ - f46a6a7 @nirguna/plugin-fasm: apply-registers: remove uncovered
20
+ - 322637b @nirguna/plugin-bundler-fasm: apply-async: add
21
+ - 49c729a @nirguna/plugin-fasm: insert-target, convert-args-to-regs: move out targets
22
+ - 4ff8507 @nirguna/plugin-fasm: add-label-prefix: AwaitExpression
23
+ - 3fd806d @nirguna/plugin-wasm: apply-types: returnType
24
+ - 2c7cee8 root: c8 v11.0.0
25
+
1
26
  2026.02.24, v1.1.1
2
27
 
3
28
  fix:
package/bin/nirguna.js CHANGED
@@ -140,10 +140,10 @@ if (args.output) {
140
140
  }
141
141
 
142
142
  if (!args.output)
143
- if (args.target === 'fasm')
144
- write(name, 'bin', binary);
145
- else if (args.target === 'wasm')
143
+ if (args.target === 'wasm')
146
144
  write(name, 'wasm', binary);
145
+ else
146
+ write(name, 'bin', binary);
147
147
 
148
148
  if (args.target === 'wast')
149
149
  write(name, 'wast', binary);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nirguna",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Compile JavaScript to WASM and FASM",
@@ -39,6 +39,7 @@
39
39
  "@nirguna/plugin-optimizer-fasm": "^1.0.0",
40
40
  "@nirguna/plugin-optimizer-wasm": "^1.0.0",
41
41
  "@nirguna/plugin-wasm": "^1.0.0",
42
+ "@nirguna/printer-fasm": "^1.0.0",
42
43
  "@nirguna/transformer-fasm": "^1.0.0",
43
44
  "@nirguna/transformer-wasm": "^1.0.0",
44
45
  "@putout/babel": "^5.2.12",
@@ -68,7 +69,6 @@
68
69
  "@nirguna/runner-wasm": "*",
69
70
  "@putout/plugin-printer": "^7.1.1",
70
71
  "@putout/test": "^15.1.1",
71
- "c8": "^10.0.0",
72
72
  "eslint": "^10.0.1",
73
73
  "eslint-plugin-n": "^17.0.0",
74
74
  "eslint-plugin-putout": "^31.0.1",
@@ -77,6 +77,7 @@
77
77
  "montag": "^1.2.1",
78
78
  "nodemon": "^3.0.1",
79
79
  "redlint": "^6.1.1",
80
+ "superc8": "^12.0.0",
80
81
  "supertape": "^12.4.0"
81
82
  },
82
83
  "imports": {
@@ -89,7 +90,6 @@
89
90
  "#optimizer-fasm": "./packages/optimizer-fasm/optimizer.js",
90
91
  "#optimizer-wasm": "./packages/optimizer-wasm/optimizer.js",
91
92
  "#printer-wasm": "./packages/printer-wasm/printer.js",
92
- "#printer-fasm": "./packages/printer-fasm/printer.js",
93
93
  "#translator-wasm": "./packages/translator-wasm/translator.js",
94
94
  "#test-wasm": "./packages/test-wasm/test.js",
95
95
  "#translator-fasm": "./packages/translator-fasm/translator.js",
@@ -1,5 +1,5 @@
1
1
  import {transform} from '@nirguna/transformer-fasm';
2
- import {print} from '#printer-fasm';
2
+ import {print} from '@nirguna/printer-fasm';
3
3
  import {translate} from '#translator-fasm';
4
4
  import {optimize} from '#optimizer-fasm';
5
5
 
@@ -60,4 +60,3 @@ export const compile = async (source, options = {}) => {
60
60
  emitLastStateChange('translate', places);
61
61
  return [binary, places];
62
62
  };
63
-
@@ -1,30 +0,0 @@
1
- import {print as putoutPrint} from '@putout/printer';
2
- import {CallExpression} from './visitors/call-expression.js';
3
- import {MemberExpression} from './visitors/member-expression.js';
4
- import {BlockStatement} from './visitors/block-statement.js';
5
- import {LabeledStatement} from './visitors/labeled-statement.js';
6
- import {ExpressionStatement} from './visitors/expression-statement/expression-statement.js';
7
- import {SequenceExpression} from './visitors/sequence-expression.js';
8
- import {AssignmentExpression} from './visitors/assignment-expression.js';
9
- import {TaggedTemplateExpression} from './visitors/tagged-template-expression.js';
10
- import {StringLiteral} from './visitors/string-literal.js';
11
-
12
- export const print = (ast) => {
13
- return putoutPrint(ast, {
14
- semantics: {
15
- comments: false,
16
- maxElementLengthInOneLine: 100,
17
- },
18
- visitors: {
19
- AssignmentExpression,
20
- CallExpression,
21
- MemberExpression,
22
- BlockStatement,
23
- LabeledStatement,
24
- ExpressionStatement,
25
- SequenceExpression,
26
- StringLiteral,
27
- TaggedTemplateExpression,
28
- },
29
- });
30
- };
@@ -1,47 +0,0 @@
1
- import {visitors, maybeVisitor} from '@putout/printer';
2
- import {types} from '@putout/babel';
3
-
4
- const {isMemberExpression} = types;
5
-
6
- export const AssignmentExpression = (path, printer, semantics) => {
7
- const left = path.get('left');
8
- const right = path.get('right');
9
-
10
- if (isMemberExpression(left) && left.node.computed) {
11
- const {write, traverse} = printer;
12
- const object = path.get('left.object');
13
- const property = path.get('left.property');
14
-
15
- write('mov ');
16
- write('[');
17
- traverse(object);
18
- write(':');
19
- traverse(property);
20
- write(']');
21
- write(',');
22
- write.space();
23
- traverse(right);
24
-
25
- return;
26
- }
27
-
28
- if (isMemberExpression(right) && right.node.computed) {
29
- const {write, traverse} = printer;
30
- const object = path.get('right.object');
31
- const property = path.get('right.property');
32
-
33
- write('mov ');
34
- traverse(left);
35
- write(',');
36
- write.space();
37
- write('[');
38
- traverse(object);
39
- write(':');
40
- traverse(property);
41
- write(']');
42
-
43
- return;
44
- }
45
-
46
- return maybeVisitor(visitors.AssignmentExpression, path, printer, semantics);
47
- };
@@ -1,7 +0,0 @@
1
- export const BlockStatement = (path, {traverse}) => {
2
- const body = path.get('body');
3
-
4
- for (const element of body) {
5
- traverse(element);
6
- }
7
- };
@@ -1,56 +0,0 @@
1
- const {isArray} = Array;
2
-
3
- const parseArgs = (path) => {
4
- const argsPath = path.get('arguments');
5
-
6
- if (!isArray(argsPath))
7
- return [];
8
-
9
- return argsPath;
10
- };
11
-
12
- export function CallExpression(path, {indent, print, maybe, traverse}) {
13
- const args = parseArgs(path);
14
- const isParentCall = tooLong(args) && path.parentPath.isCallExpression();
15
-
16
- const callee = path.get('callee');
17
-
18
- traverse(callee);
19
-
20
- maybe.print.space(args.length);
21
-
22
- const n = args.length - 1;
23
-
24
- maybe.indent.inc(isParentCall);
25
-
26
- for (const [i, arg] of args.entries()) {
27
- const isObject = arg.isObjectExpression();
28
-
29
- if (isParentCall && !isObject && n)
30
- print.breakline();
31
-
32
- print(arg);
33
-
34
- if (isParentCall && n) {
35
- print(',');
36
- continue;
37
- }
38
-
39
- if (i < n)
40
- print(', ');
41
- }
42
-
43
- if (isParentCall) {
44
- indent.dec();
45
- maybe.print.breakline(n);
46
- }
47
- }
48
-
49
- function tooLong(args) {
50
- for (const arg of args) {
51
- if (arg.isIdentifier() && arg.node.name.length > 10)
52
- return true;
53
- }
54
-
55
- return false;
56
- }
@@ -1,34 +0,0 @@
1
- import {isNext, exists} from '@putout/printer/is';
2
- import {isJmpFar, printJmpFar} from './print-jmp-far.js';
3
- import {isInOut, printInOut} from './print-in-out.js';
4
-
5
- export const ExpressionStatement = (path, printer) => {
6
- const {
7
- maybe,
8
- print,
9
- indent,
10
- traverse,
11
- } = printer;
12
-
13
- const expression = path.get('expression');
14
-
15
- if (isJmpFar(expression)) {
16
- printJmpFar(expression, printer);
17
- maybe.print.breakline(isNext(path));
18
-
19
- return;
20
- }
21
-
22
- if (isInOut(expression)) {
23
- printInOut(expression, printer);
24
- print.breakline();
25
-
26
- return;
27
- }
28
-
29
- indent();
30
- traverse(expression);
31
-
32
- const next = path.getNextSibling();
33
- maybe.print.newline(exists(next));
34
- };
@@ -1,37 +0,0 @@
1
- import {types} from '@putout/babel';
2
-
3
- const {
4
- isCallExpression,
5
- isMemberExpression,
6
- } = types;
7
-
8
- export const isInOut = (expression) => {
9
- if (!isCallExpression(expression))
10
- return false;
11
-
12
- const {callee} = expression.node;
13
-
14
- if (!isMemberExpression(callee))
15
- return false;
16
-
17
- const {object, property} = callee;
18
-
19
- if (object.name !== 'io')
20
- return false;
21
-
22
- return /^(in|out)$/.test(property.name);
23
- };
24
-
25
- export function printInOut(path, printer) {
26
- const {print} = printer;
27
- const callee = path.get('callee');
28
- const property = callee.get('property');
29
-
30
- print(property);
31
- print(' ');
32
- const [arg1, arg2] = path.get('arguments');
33
-
34
- print(arg1);
35
- print(', ');
36
- print(arg2);
37
- }
@@ -1,30 +0,0 @@
1
- import {types} from '@putout/babel';
2
-
3
- const {
4
- isCallExpression,
5
- isMemberExpression,
6
- } = types;
7
-
8
- export const isJmpFar = (expression) => {
9
- if (!isCallExpression(expression))
10
- return false;
11
-
12
- const {callee} = expression.node;
13
-
14
- if (!isMemberExpression(callee))
15
- return false;
16
-
17
- const {object, property} = callee;
18
-
19
- return object.name === 'jmp' && property.name === 'far';
20
- };
21
-
22
- export function printJmpFar(path, printer) {
23
- const {print} = printer;
24
- const callee = path.get('callee');
25
- const [first] = path.node.arguments;
26
-
27
- print(callee);
28
- print(' ');
29
- print(first.value);
30
- }
@@ -1,14 +0,0 @@
1
- import {exists} from '@putout/printer/is';
2
-
3
- export const LabeledStatement = (path, {print, maybe}) => {
4
- const prev = path.getPrevSibling();
5
- const next = path.getNextSibling();
6
-
7
- maybe.print.breakline(exists(prev));
8
-
9
- print('__label');
10
- print(':');
11
- print.breakline();
12
- print('__body');
13
- maybe.print.breakline(exists(next));
14
- };
@@ -1,5 +0,0 @@
1
- export const MemberExpression = (path, {print}) => {
2
- print('__object');
3
- print(' ');
4
- print('__property');
5
- };
@@ -1,17 +0,0 @@
1
- import {types} from '@putout/babel';
2
-
3
- const {isMemberExpression} = types;
4
-
5
- export const SequenceExpression = (path, {traverse, maybe, write}) => {
6
- const expressions = path.get('expressions');
7
- const n = expressions.length - 1;
8
-
9
- for (const [i, expression] of expressions.entries()) {
10
- traverse(expression);
11
-
12
- if (isMemberExpression(expression) || n > 1 && i < n)
13
- write(',');
14
-
15
- maybe.write(i < n, ' ');
16
- }
17
- };
@@ -1,55 +0,0 @@
1
- export const StringLiteral = (path, {write}, semantics) => {
2
- const {value, raw = `'${value}'`} = path.node;
3
-
4
- if (path.parentPath.isJSXAttribute()) {
5
- write(`"${value}"`);
6
- return;
7
- }
8
-
9
- const newValue = raw.slice(1, -1);
10
- write.quote();
11
- write(maybeEscape(newValue, semantics));
12
- write.quote();
13
- };
14
-
15
- const maybeEscape = (value, {escapeDoubleQuote, escapeSingleQuote}) => {
16
- const list = value.split('');
17
- const slash = '\\';
18
-
19
- if (escapeSingleQuote)
20
- return escape(list, {
21
- slash,
22
- quote: `'`,
23
- });
24
-
25
- if (escapeDoubleQuote)
26
- return escape(list, {
27
- slash,
28
- quote: `"`,
29
- });
30
-
31
- return value;
32
- };
33
-
34
- const escape = (list, {slash, quote}) => {
35
- const result = [];
36
-
37
- for (const [index, char] of list.entries()) {
38
- const prev = list[index - 1];
39
- const next = list[index + 1];
40
-
41
- if (char === slash && next === quote) {
42
- result.push(quote);
43
- continue;
44
- }
45
-
46
- if (char === quote && prev !== slash) {
47
- result.push(`${slash}${char}`);
48
- continue;
49
- }
50
-
51
- result.push(char);
52
- }
53
-
54
- return result.join('');
55
- };
@@ -1,4 +0,0 @@
1
- export const TaggedTemplateExpression = (path, {write}) => {
2
- const {value} = path.node.quasi.quasis[0];
3
- write(value.cooked.trim());
4
- };
@@ -1,7 +0,0 @@
1
- import {parse} from 'putout';
2
- import * as printer from './printer/printer.js';
3
-
4
- export const print = (source) => {
5
- const ast = parse(source);
6
- return printer.print(ast);
7
- };