porffor 0.55.14 → 0.55.15

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/cache.js DELETED
@@ -1,44 +0,0 @@
1
- // simple generic node-like-only compiler cache internal api
2
- import './prefs.js';
3
- import fs from 'node:fs';
4
-
5
- // import crypto from 'node:crypto';
6
- // const hash = x => crypto.createHash('sha1').update(x).digest('hex');
7
-
8
- export default name => {
9
- const cacheDir =
10
- (process.env.XDG_CACHE_HOME || (process.env.HOME + '/.cache')) +
11
- '/porffor/cache/' + name;
12
-
13
- fs.mkdirSync(cacheDir, { recursive: true });
14
-
15
- const read = key => {
16
- try {
17
- return JSON.parse(fs.readFileSync(cacheDir + `/${key}.json`));
18
- } catch {
19
- return null;
20
- }
21
- };
22
- const write = (key, value) => fs.writeFileSync(cacheDir + `/${key}.json`, JSON.stringify(value));
23
-
24
- const memory = new Map();
25
- const keys = new Map();
26
- return {
27
- get(key) {
28
- if (key == null) return undefined;
29
-
30
- if (memory.has(key)) return memory.get(key);
31
-
32
- const value = read(key);
33
- memory.set(key, value);
34
- return value;
35
- },
36
-
37
- set(key, value) {
38
- if (key == null) return;
39
-
40
- memory.set(key, value);
41
- write(key, value);
42
- }
43
- };
44
- };
@@ -1,11 +0,0 @@
1
- import { Opcodes, Valtype } from './wasmSpec.js';
2
- import { signedLEB128, ieee754_binary64, signedLEB128_into } from './encoding.js';
3
-
4
- export const number = (n, valtype = valtypeBinary) => {
5
- if (valtype === Valtype.f64) return [ Opcodes.f64_const, n ];
6
-
7
- const out = [ valtype === Valtype.i32 ? Opcodes.i32_const : Opcodes.i64_const ];
8
- signedLEB128_into(n, out);
9
-
10
- return out;
11
- };