@nirguna/plugin-fasm 1.0.0 → 1.1.0
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 +1 -0
- package/lib/apply-types/index.js +0 -1
- package/lib/convert-assign-to-mov/index.js +0 -1
- package/lib/index.js +2 -0
- package/lib/insert-target/index.js +37 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -46,3 +46,4 @@ Transforms:
|
|
|
46
46
|
- ✅[`remove-useless-braces`](https://putout.cloudcmd.io/#/gist/140689014540d48d501c1fa50b3694ca/e1521db4f951c38c17a6c3af46456c47f1f3a1a8);
|
|
47
47
|
- ✅[`remove-useless-promise`](https://putout.cloudcmd.io/#/gist/d21eb87bc77b53e54c28b1ae8442a403/1b35064142068e623a564f578517c2aace55ceba);
|
|
48
48
|
- ✅[`switch-cmp-operands`](https://putout.cloudcmd.io/#/gist/cdf71331f1024c9c966d4756c6159684/9d3f2ebeb41cd096de7919f0c39bc75cbaf5ce0c);
|
|
49
|
+
- ✅[`insert-target`](https://putout.cloudcmd.io/#/gist/e7e3f495fdfde1b065117fc0ae41873c/b6fe3dc81d33c81d332ce5d551b8a2fb40b63d70);
|
package/lib/apply-types/index.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as insertTarget from './insert-target/index.js';
|
|
1
2
|
import * as removeUselessPromise from './remove-useless-promise/index.js';
|
|
2
3
|
import * as applyInclude from './apply-include/index.js';
|
|
3
4
|
import * as switchCmpOperands from './switch-cmp-operands/index.js';
|
|
@@ -90,4 +91,5 @@ export const rules = {
|
|
|
90
91
|
'switch-cmp-operands': switchCmpOperands,
|
|
91
92
|
'apply-include': applyInclude,
|
|
92
93
|
'remove-useless-promise': removeUselessPromise,
|
|
94
|
+
'insert-target': insertTarget,
|
|
93
95
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {template} from 'putout';
|
|
2
|
+
|
|
3
|
+
const createBinary = (address) => `{
|
|
4
|
+
org(${address});
|
|
5
|
+
use16();
|
|
6
|
+
}`;
|
|
7
|
+
|
|
8
|
+
const TARGET = {
|
|
9
|
+
boot: createBinary('0x7c00'),
|
|
10
|
+
kernel: createBinary('0x7e00'),
|
|
11
|
+
nemesis: createBinary('0x500'),
|
|
12
|
+
linux: `{
|
|
13
|
+
format.ELF64.executable;
|
|
14
|
+
entry.$;
|
|
15
|
+
}`,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const report = (path, {target}) => `Insert target: '${target}'`;
|
|
19
|
+
|
|
20
|
+
export const fix = (path, {target = 'boot'}) => {
|
|
21
|
+
path.node.extra.target = target;
|
|
22
|
+
path.node.body.unshift(template.ast(TARGET[target]));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const include = () => ['Program'];
|
|
26
|
+
|
|
27
|
+
export const filter = (path, {options}) => {
|
|
28
|
+
const {target} = options;
|
|
29
|
+
|
|
30
|
+
if (!target)
|
|
31
|
+
return;
|
|
32
|
+
|
|
33
|
+
if (path.node.extra.target)
|
|
34
|
+
return;
|
|
35
|
+
|
|
36
|
+
return TARGET[target];
|
|
37
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nirguna/plugin-fasm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊nirguna plugin adds ability to optimize fasm",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"@putout/plugin-remove-nested-blocks": "^9.1.0",
|
|
37
37
|
"@putout/test": "^15.1.1",
|
|
38
38
|
"c8": "^10.0.0",
|
|
39
|
-
"eslint": "^10.0.
|
|
39
|
+
"eslint": "^10.0.1",
|
|
40
40
|
"eslint-plugin-n": "^17.0.0",
|
|
41
|
-
"eslint-plugin-putout": "^
|
|
42
|
-
"madrun": "^
|
|
41
|
+
"eslint-plugin-putout": "^31.0.1",
|
|
42
|
+
"madrun": "^13.0.0",
|
|
43
43
|
"montag": "^1.2.1",
|
|
44
44
|
"nodemon": "^3.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"putout": ">=
|
|
47
|
+
"putout": ">=42"
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"engines": {
|