novac 2.2.0 → 2.2.2
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/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/novac +6 -3
- package/bin/nvc +0 -0
- package/bin/nvml +0 -0
- package/demo.nv +0 -0
- package/demo_builtins.nv +0 -0
- package/demo_http.nv +0 -0
- package/examples/bf.nv +5 -13
- package/examples/math.nv +2 -2
- package/kits/kitffmpeg/kitdef.js +1174 -0
- package/kits/libos/kitdef.js +3135 -0
- package/kits/libtasker/kitdef.js +125 -0
- package/package.json +1 -1
- package/scripts/update-bin.js +0 -0
- package/src/core/executor.js +7 -4
- package/src/core/lexer.js +2 -2
- package/src/index.js +0 -0
- package/novac/LICENSE +0 -21
- package/novac/README.md +0 -1823
- package/novac/bin/novac +0 -950
- package/novac/bin/nvc +0 -522
- package/novac/bin/nvml +0 -542
- package/novac/demo.nv +0 -245
- package/novac/demo_builtins.nv +0 -209
- package/novac/demo_http.nv +0 -62
- package/novac/examples/bf.nv +0 -69
- package/novac/examples/math.nv +0 -21
- package/novac/kits/kitai/kitdef.js +0 -2185
- package/novac/kits/kitansi/kitdef.js +0 -1402
- package/novac/kits/kitformat/kitdef.js +0 -1485
- package/novac/kits/kitgps/kitdef.js +0 -1862
- package/novac/kits/kitlibfs/kitdef.js +0 -231
- package/novac/kits/kitlibproc/kitdef.js +0 -78
- package/novac/kits/kitmatrix/ex.js +0 -19
- package/novac/kits/kitmatrix/kitdef.js +0 -960
- package/novac/kits/kitmpatch/kitdef.js +0 -906
- package/novac/kits/kitnovacweb/README.md +0 -1572
- package/novac/kits/kitnovacweb/demo.nv +0 -12
- package/novac/kits/kitnovacweb/demo.nvml +0 -71
- package/novac/kits/kitnovacweb/index.nova +0 -12
- package/novac/kits/kitnovacweb/kitdef.js +0 -692
- package/novac/kits/kitnovacweb/nova.kit.json +0 -8
- package/novac/kits/kitnovacweb/nvml/executor.js +0 -739
- package/novac/kits/kitnovacweb/nvml/index.js +0 -67
- package/novac/kits/kitnovacweb/nvml/lexer.js +0 -263
- package/novac/kits/kitnovacweb/nvml/parser.js +0 -508
- package/novac/kits/kitnovacweb/nvml/renderer.js +0 -924
- package/novac/kits/kitparse/kitdef.js +0 -1688
- package/novac/kits/kitregex++/kitdef.js +0 -1353
- package/novac/kits/kitrequire/kitdef.js +0 -1599
- package/novac/kits/kitx11/kitdef.js +0 -1
- package/novac/kits/kitx11/kitx11.js +0 -2472
- package/novac/kits/kitx11/kitx11_conn.js +0 -948
- package/novac/kits/kitx11/kitx11_worker.js +0 -121
- package/novac/kits/libtea/tf.js +0 -2691
- package/novac/kits/libterm/ex.js +0 -285
- package/novac/kits/libterm/kitdef.js +0 -1927
- package/novac/node_modules/chalk/license +0 -9
- package/novac/node_modules/chalk/package.json +0 -83
- package/novac/node_modules/chalk/readme.md +0 -297
- package/novac/node_modules/chalk/source/index.d.ts +0 -325
- package/novac/node_modules/chalk/source/index.js +0 -225
- package/novac/node_modules/chalk/source/utilities.js +0 -33
- package/novac/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -236
- package/novac/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -223
- package/novac/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
- package/novac/node_modules/chalk/source/vendor/supports-color/browser.js +0 -34
- package/novac/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
- package/novac/node_modules/chalk/source/vendor/supports-color/index.js +0 -190
- package/novac/node_modules/commander/LICENSE +0 -22
- package/novac/node_modules/commander/Readme.md +0 -1176
- package/novac/node_modules/commander/esm.mjs +0 -16
- package/novac/node_modules/commander/index.js +0 -24
- package/novac/node_modules/commander/lib/argument.js +0 -150
- package/novac/node_modules/commander/lib/command.js +0 -2777
- package/novac/node_modules/commander/lib/error.js +0 -39
- package/novac/node_modules/commander/lib/help.js +0 -747
- package/novac/node_modules/commander/lib/option.js +0 -380
- package/novac/node_modules/commander/lib/suggestSimilar.js +0 -101
- package/novac/node_modules/commander/package-support.json +0 -19
- package/novac/node_modules/commander/package.json +0 -82
- package/novac/node_modules/commander/typings/esm.d.mts +0 -3
- package/novac/node_modules/commander/typings/index.d.ts +0 -1113
- package/novac/node_modules/node-addon-api/LICENSE.md +0 -9
- package/novac/node_modules/node-addon-api/README.md +0 -95
- package/novac/node_modules/node-addon-api/common.gypi +0 -21
- package/novac/node_modules/node-addon-api/except.gypi +0 -25
- package/novac/node_modules/node-addon-api/index.js +0 -14
- package/novac/node_modules/node-addon-api/napi-inl.deprecated.h +0 -186
- package/novac/node_modules/node-addon-api/napi-inl.h +0 -7165
- package/novac/node_modules/node-addon-api/napi.h +0 -3364
- package/novac/node_modules/node-addon-api/node_addon_api.gyp +0 -42
- package/novac/node_modules/node-addon-api/node_api.gyp +0 -9
- package/novac/node_modules/node-addon-api/noexcept.gypi +0 -26
- package/novac/node_modules/node-addon-api/nothing.c +0 -0
- package/novac/node_modules/node-addon-api/package-support.json +0 -21
- package/novac/node_modules/node-addon-api/package.json +0 -480
- package/novac/node_modules/node-addon-api/tools/README.md +0 -73
- package/novac/node_modules/node-addon-api/tools/check-napi.js +0 -99
- package/novac/node_modules/node-addon-api/tools/clang-format.js +0 -71
- package/novac/node_modules/node-addon-api/tools/conversion.js +0 -301
- package/novac/node_modules/serialize-javascript/LICENSE +0 -27
- package/novac/node_modules/serialize-javascript/README.md +0 -149
- package/novac/node_modules/serialize-javascript/index.js +0 -297
- package/novac/node_modules/serialize-javascript/package.json +0 -33
- package/novac/package.json +0 -27
- package/novac/scripts/update-bin.js +0 -24
- package/novac/src/core/bstd.js +0 -1035
- package/novac/src/core/config.js +0 -155
- package/novac/src/core/describe.js +0 -187
- package/novac/src/core/emitter.js +0 -499
- package/novac/src/core/error.js +0 -86
- package/novac/src/core/executor.js +0 -5606
- package/novac/src/core/formatter.js +0 -686
- package/novac/src/core/lexer.js +0 -1026
- package/novac/src/core/nova_builtins.js +0 -717
- package/novac/src/core/nova_thread_worker.js +0 -166
- package/novac/src/core/parser.js +0 -2181
- package/novac/src/core/types.js +0 -112
- package/novac/src/index.js +0 -28
- package/novac/src/runtime/stdlib.js +0 -244
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
const { kStringMaxLength } = require('buffer');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
const filesystem = {
|
|
6
|
-
//note:this implementation is completely synchronous, It is only intended for use in development and testing environments.
|
|
7
|
-
//it should have all fs methods, but synchronous versions only.
|
|
8
|
-
read: (filePath, encoding = 'utf8') => {
|
|
9
|
-
const absolutePath = path.resolve(filePath);
|
|
10
|
-
if (!fs.existsSync(absolutePath)) {
|
|
11
|
-
throw new Error(`File not found: ${filePath}`);
|
|
12
|
-
}
|
|
13
|
-
return fs.readFileSync(absolutePath, encoding);
|
|
14
|
-
},
|
|
15
|
-
write: (filePath, content, encoding = 'utf8') => {
|
|
16
|
-
const absolutePath = path.resolve(filePath);
|
|
17
|
-
fs.writeFileSync(absolutePath, content, encoding);
|
|
18
|
-
},
|
|
19
|
-
exists: (filePath) => {
|
|
20
|
-
const absolutePath = path.resolve(filePath);
|
|
21
|
-
return fs.existsSync(absolutePath);
|
|
22
|
-
},
|
|
23
|
-
delete: (filePath) => {
|
|
24
|
-
const absolutePath = path.resolve(filePath);
|
|
25
|
-
if (fs.existsSync(absolutePath)) {
|
|
26
|
-
fs.unlinkSync(absolutePath);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
list: (directoryPath) => {
|
|
30
|
-
const absolutePath = path.resolve(directoryPath);
|
|
31
|
-
return fs.readdirSync(absolutePath);
|
|
32
|
-
},
|
|
33
|
-
isDirectory: (filePath) => {
|
|
34
|
-
const absolutePath = path.resolve(filePath);
|
|
35
|
-
return fs.statSync(absolutePath).isDirectory();
|
|
36
|
-
},
|
|
37
|
-
createDirectory: (directoryPath) => {
|
|
38
|
-
const absolutePath = path.resolve(directoryPath);
|
|
39
|
-
fs.mkdirSync(absolutePath);
|
|
40
|
-
},
|
|
41
|
-
deleteDirectory: (directoryPath) => {
|
|
42
|
-
const absolutePath = path.resolve(directoryPath);
|
|
43
|
-
if (fs.existsSync(absolutePath)) {
|
|
44
|
-
fs.rmdirSync(absolutePath);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
stats: (filePath) => {
|
|
48
|
-
const absolutePath = path.resolve(filePath);
|
|
49
|
-
return fs.statSync(absolutePath);
|
|
50
|
-
},
|
|
51
|
-
cp: (sourcePath, destinationPath) => {
|
|
52
|
-
const absoluteSourcePath = path.resolve(sourcePath);
|
|
53
|
-
const absoluteDestinationPath = path.resolve(destinationPath);
|
|
54
|
-
fs.copyFileSync(absoluteSourcePath, absoluteDestinationPath);
|
|
55
|
-
},
|
|
56
|
-
cpDir: (sourceDir, destinationDir) => {
|
|
57
|
-
const absoluteSourceDir = path.resolve(sourceDir);
|
|
58
|
-
const absoluteDestinationDir = path.resolve(destinationDir);
|
|
59
|
-
if (!fs.existsSync(absoluteDestinationDir)) {
|
|
60
|
-
fs.mkdirSync(absoluteDestinationDir);
|
|
61
|
-
}
|
|
62
|
-
const items = fs.readdirSync(absoluteSourceDir);
|
|
63
|
-
items.forEach(item => {
|
|
64
|
-
const sourceItemPath = path.join(absoluteSourceDir, item);
|
|
65
|
-
const destinationItemPath = path.join(absoluteDestinationDir, item);
|
|
66
|
-
if (fs.statSync(sourceItemPath).isDirectory()) {
|
|
67
|
-
filesystem.cpDir(sourceItemPath, destinationItemPath);
|
|
68
|
-
} else {
|
|
69
|
-
fs.copyFileSync(sourceItemPath, destinationItemPath);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
appendFile: (filePath, content, encoding = 'utf8') => {
|
|
74
|
-
const absolutePath = path.resolve(filePath);
|
|
75
|
-
fs.appendFileSync(absolutePath, content, encoding);
|
|
76
|
-
},
|
|
77
|
-
rename: (oldPath, newPath) => {
|
|
78
|
-
const absoluteOldPath = path.resolve(oldPath);
|
|
79
|
-
const absoluteNewPath = path.resolve(newPath);
|
|
80
|
-
fs.renameSync(absoluteOldPath, absoluteNewPath);
|
|
81
|
-
},
|
|
82
|
-
access: (filePath, mode = fs.constants.F_OK) => {
|
|
83
|
-
const absolutePath = path.resolve(filePath);
|
|
84
|
-
try {
|
|
85
|
-
fs.accessSync(absolutePath, mode);
|
|
86
|
-
return true;
|
|
87
|
-
} catch {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
chmod: (filePath, mode) => {
|
|
92
|
-
const absolutePath = path.resolve(filePath);
|
|
93
|
-
fs.chmodSync(absolutePath, mode);
|
|
94
|
-
},
|
|
95
|
-
readlink: (filePath) => {
|
|
96
|
-
const absolutePath = path.resolve(filePath);
|
|
97
|
-
return fs.readlinkSync(absolutePath);
|
|
98
|
-
},
|
|
99
|
-
symlink: (target, filePath, type = 'file') => {
|
|
100
|
-
const absoluteTarget = path.resolve(target);
|
|
101
|
-
const absolutePath = path.resolve(filePath);
|
|
102
|
-
fs.symlinkSync(absoluteTarget, absolutePath, type);
|
|
103
|
-
},
|
|
104
|
-
link: (existingPath, newPath) => {
|
|
105
|
-
const absoluteExistingPath = path.resolve(existingPath);
|
|
106
|
-
const absoluteNewPath = path.resolve(newPath);
|
|
107
|
-
fs.linkSync(absoluteExistingPath, absoluteNewPath);
|
|
108
|
-
},
|
|
109
|
-
lstat: (filePath) => {
|
|
110
|
-
const absolutePath = path.resolve(filePath);
|
|
111
|
-
return fs.lstatSync(absolutePath);
|
|
112
|
-
},
|
|
113
|
-
realpath: (filePath) => {
|
|
114
|
-
const absolutePath = path.resolve(filePath);
|
|
115
|
-
return fs.realpathSync(absolutePath);
|
|
116
|
-
},
|
|
117
|
-
isFile: (filePath) => {
|
|
118
|
-
const absolutePath = path.resolve(filePath);
|
|
119
|
-
if (!fs.existsSync(absolutePath)) return false;
|
|
120
|
-
return fs.statSync(absolutePath).isFile();
|
|
121
|
-
},
|
|
122
|
-
isSymbolicLink: (filePath) => {
|
|
123
|
-
const absolutePath = path.resolve(filePath);
|
|
124
|
-
if (!fs.existsSync(absolutePath)) return false;
|
|
125
|
-
return fs.lstatSync(absolutePath).isSymbolicLink();
|
|
126
|
-
},
|
|
127
|
-
truncate: (filePath, len = 0) => {
|
|
128
|
-
const absolutePath = path.resolve(filePath);
|
|
129
|
-
fs.truncateSync(absolutePath, len);
|
|
130
|
-
},
|
|
131
|
-
mkdtemp: (prefix) => {
|
|
132
|
-
return fs.mkdtempSync(prefix);
|
|
133
|
-
},
|
|
134
|
-
rm: (filePath, options = {}) => {
|
|
135
|
-
const absolutePath = path.resolve(filePath);
|
|
136
|
-
if (fs.existsSync(absolutePath)) {
|
|
137
|
-
const stat = fs.statSync(absolutePath);
|
|
138
|
-
if (stat.isDirectory()) {
|
|
139
|
-
if (options.recursive) {
|
|
140
|
-
fs.rmSync(absolutePath, { recursive: true });
|
|
141
|
-
} else {
|
|
142
|
-
fs.rmdirSync(absolutePath);
|
|
143
|
-
}
|
|
144
|
-
} else {
|
|
145
|
-
fs.unlinkSync(absolutePath);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
dirents: (directoryPath) => {
|
|
150
|
-
const absolutePath = path.resolve(directoryPath);
|
|
151
|
-
return fs.readdirSync(absolutePath, { withFileTypes: true });
|
|
152
|
-
},
|
|
153
|
-
// Path utilities
|
|
154
|
-
pathDirname: (filePath) => {
|
|
155
|
-
return path.dirname(filePath);
|
|
156
|
-
},
|
|
157
|
-
pathBasename: (filePath, ext = '') => {
|
|
158
|
-
return path.basename(filePath, ext);
|
|
159
|
-
},
|
|
160
|
-
pathExtname: (filePath) => {
|
|
161
|
-
return path.extname(filePath);
|
|
162
|
-
},
|
|
163
|
-
pathJoin: (...paths) => {
|
|
164
|
-
return path.join(...paths);
|
|
165
|
-
},
|
|
166
|
-
pathResolve: (...paths) => {
|
|
167
|
-
return path.resolve(...paths);
|
|
168
|
-
},
|
|
169
|
-
pathRelative: (from, to) => {
|
|
170
|
-
return path.relative(from, to);
|
|
171
|
-
},
|
|
172
|
-
pathNormalize: (filePath) => {
|
|
173
|
-
return path.normalize(filePath);
|
|
174
|
-
},
|
|
175
|
-
pathParse: (filePath) => {
|
|
176
|
-
return path.parse(filePath);
|
|
177
|
-
},
|
|
178
|
-
pathFormat: (pathObj) => {
|
|
179
|
-
return path.format(pathObj);
|
|
180
|
-
},
|
|
181
|
-
pathIsAbsolute: (filePath) => {
|
|
182
|
-
return path.isAbsolute(filePath);
|
|
183
|
-
},
|
|
184
|
-
getSize: (filePath) => {
|
|
185
|
-
const absolutePath = path.resolve(filePath);
|
|
186
|
-
return fs.statSync(absolutePath).size;
|
|
187
|
-
},
|
|
188
|
-
isReadable: (filePath) => {
|
|
189
|
-
const absolutePath = path.resolve(filePath);
|
|
190
|
-
try {
|
|
191
|
-
fs.accessSync(absolutePath, fs.constants.R_OK);
|
|
192
|
-
return true;
|
|
193
|
-
} catch {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
isWritable: (filePath) => {
|
|
198
|
-
const absolutePath = path.resolve(filePath);
|
|
199
|
-
try {
|
|
200
|
-
fs.accessSync(absolutePath, fs.constants.W_OK);
|
|
201
|
-
return true;
|
|
202
|
-
} catch {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
isExecutable: (filePath) => {
|
|
207
|
-
const absolutePath = path.resolve(filePath);
|
|
208
|
-
try {
|
|
209
|
-
fs.accessSync(absolutePath, fs.constants.X_OK);
|
|
210
|
-
return true;
|
|
211
|
-
} catch {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
getModifiedTime: (filePath) => {
|
|
216
|
-
const absolutePath = path.resolve(filePath);
|
|
217
|
-
return fs.statSync(absolutePath).mtime;
|
|
218
|
-
},
|
|
219
|
-
getCreatedTime: (filePath) => {
|
|
220
|
-
const absolutePath = path.resolve(filePath);
|
|
221
|
-
return fs.statSync(absolutePath).birthtime;
|
|
222
|
-
},
|
|
223
|
-
getAccessedTime: (filePath) => {
|
|
224
|
-
const absolutePath = path.resolve(filePath);
|
|
225
|
-
return fs.statSync(absolutePath).atime;
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
module.exports = {
|
|
230
|
-
kitdef: filesystem
|
|
231
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// kitlibproc — process & shell execution kit for Nova
|
|
2
|
-
// Synchronous wrappers around child_process for scripting use.
|
|
3
|
-
const { execSync, spawnSync } = require('child_process');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
|
|
8
|
-
const proc = {
|
|
9
|
-
// Run a shell command, return stdout string. Throws on non-zero exit.
|
|
10
|
-
exec(cmd, options = {}) {
|
|
11
|
-
const { cwd = process.cwd(), env = process.env, timeout = 30000 } = options;
|
|
12
|
-
return execSync(cmd, { encoding: 'utf8', cwd, env, timeout }).trimEnd();
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
// Run a command, return { code, stdout, stderr } — never throws.
|
|
16
|
-
run(cmd, options = {}) {
|
|
17
|
-
const { cwd = process.cwd(), env = process.env, timeout = 30000 } = options;
|
|
18
|
-
try {
|
|
19
|
-
const stdout = execSync(cmd, { encoding: 'utf8', cwd, env, timeout, stdio: ['ignore', 'pipe', 'pipe'] }).trimEnd();
|
|
20
|
-
return { code: 0, stdout, stderr: '' };
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return { code: e.status || 1, stdout: (e.stdout || '').trimEnd(), stderr: (e.stderr || '').trimEnd() };
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// Spawn a process with explicit argv, return { code, stdout, stderr }
|
|
27
|
-
spawn(bin, args = [], options = {}) {
|
|
28
|
-
const { cwd = process.cwd(), env = process.env, timeout = 30000 } = options;
|
|
29
|
-
const result = spawnSync(bin, args, { encoding: 'utf8', cwd, env, timeout });
|
|
30
|
-
return {
|
|
31
|
-
code: result.status ?? 1,
|
|
32
|
-
stdout: (result.stdout || '').trimEnd(),
|
|
33
|
-
stderr: (result.stderr || '').trimEnd(),
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
// Exit current process
|
|
38
|
-
exit(code = 0) { process.exit(code); },
|
|
39
|
-
|
|
40
|
-
// Environment variable access
|
|
41
|
-
env(key) { return process.env[key] ?? null; },
|
|
42
|
-
setEnv(key, value) { process.env[key] = String(value); },
|
|
43
|
-
|
|
44
|
-
// Current working directory
|
|
45
|
-
cwd() { return process.cwd(); },
|
|
46
|
-
chdir(dir) { process.chdir(dir); },
|
|
47
|
-
|
|
48
|
-
// Platform info
|
|
49
|
-
platform() { return os.platform(); },
|
|
50
|
-
arch() { return os.arch(); },
|
|
51
|
-
hostname() { return os.hostname(); },
|
|
52
|
-
cpus() { return os.cpus().length; },
|
|
53
|
-
mem() { return { total: os.totalmem(), free: os.freemem() }; },
|
|
54
|
-
|
|
55
|
-
// Temp file helpers
|
|
56
|
-
tmpFile(ext = '.tmp') {
|
|
57
|
-
return path.join(os.tmpdir(), `nv_tmp_${Date.now()}${ext}`);
|
|
58
|
-
},
|
|
59
|
-
tmpDir() {
|
|
60
|
-
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'nova_'));
|
|
61
|
-
return d;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
// Sleep (blocking) in ms
|
|
65
|
-
sleepSync(ms) {
|
|
66
|
-
const t = Date.now() + ms;
|
|
67
|
-
while (Date.now() < t) { /* spin */ }
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// PID of current process
|
|
71
|
-
pid() { return process.pid; },
|
|
72
|
-
|
|
73
|
-
// argv passthrough
|
|
74
|
-
argv() { return process.argv.slice(2); },
|
|
75
|
-
...process
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
module.exports = { kitdef: proc };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { Matrix } = require("./kitdef").kitdef;
|
|
2
|
-
|
|
3
|
-
const m = new Matrix(20, 20);
|
|
4
|
-
|
|
5
|
-
const grid = m.grid(10, 10, 0, 0, 2, 2);
|
|
6
|
-
|
|
7
|
-
const player = grid.at(2, 2)
|
|
8
|
-
.clone()
|
|
9
|
-
.withLabel("@");
|
|
10
|
-
|
|
11
|
-
const target = grid.at(8, 7)
|
|
12
|
-
.clone()
|
|
13
|
-
.withLabel("X");
|
|
14
|
-
|
|
15
|
-
console.log(player.distanceTo(target));
|
|
16
|
-
|
|
17
|
-
const neighbors = grid.neighbors(2, 2, true);
|
|
18
|
-
|
|
19
|
-
m.render.frame()
|