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.
Files changed (122) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/bin/novac +6 -3
  4. package/bin/nvc +0 -0
  5. package/bin/nvml +0 -0
  6. package/demo.nv +0 -0
  7. package/demo_builtins.nv +0 -0
  8. package/demo_http.nv +0 -0
  9. package/examples/bf.nv +5 -13
  10. package/examples/math.nv +2 -2
  11. package/kits/kitffmpeg/kitdef.js +1174 -0
  12. package/kits/libos/kitdef.js +3135 -0
  13. package/kits/libtasker/kitdef.js +125 -0
  14. package/package.json +1 -1
  15. package/scripts/update-bin.js +0 -0
  16. package/src/core/executor.js +7 -4
  17. package/src/core/lexer.js +2 -2
  18. package/src/index.js +0 -0
  19. package/novac/LICENSE +0 -21
  20. package/novac/README.md +0 -1823
  21. package/novac/bin/novac +0 -950
  22. package/novac/bin/nvc +0 -522
  23. package/novac/bin/nvml +0 -542
  24. package/novac/demo.nv +0 -245
  25. package/novac/demo_builtins.nv +0 -209
  26. package/novac/demo_http.nv +0 -62
  27. package/novac/examples/bf.nv +0 -69
  28. package/novac/examples/math.nv +0 -21
  29. package/novac/kits/kitai/kitdef.js +0 -2185
  30. package/novac/kits/kitansi/kitdef.js +0 -1402
  31. package/novac/kits/kitformat/kitdef.js +0 -1485
  32. package/novac/kits/kitgps/kitdef.js +0 -1862
  33. package/novac/kits/kitlibfs/kitdef.js +0 -231
  34. package/novac/kits/kitlibproc/kitdef.js +0 -78
  35. package/novac/kits/kitmatrix/ex.js +0 -19
  36. package/novac/kits/kitmatrix/kitdef.js +0 -960
  37. package/novac/kits/kitmpatch/kitdef.js +0 -906
  38. package/novac/kits/kitnovacweb/README.md +0 -1572
  39. package/novac/kits/kitnovacweb/demo.nv +0 -12
  40. package/novac/kits/kitnovacweb/demo.nvml +0 -71
  41. package/novac/kits/kitnovacweb/index.nova +0 -12
  42. package/novac/kits/kitnovacweb/kitdef.js +0 -692
  43. package/novac/kits/kitnovacweb/nova.kit.json +0 -8
  44. package/novac/kits/kitnovacweb/nvml/executor.js +0 -739
  45. package/novac/kits/kitnovacweb/nvml/index.js +0 -67
  46. package/novac/kits/kitnovacweb/nvml/lexer.js +0 -263
  47. package/novac/kits/kitnovacweb/nvml/parser.js +0 -508
  48. package/novac/kits/kitnovacweb/nvml/renderer.js +0 -924
  49. package/novac/kits/kitparse/kitdef.js +0 -1688
  50. package/novac/kits/kitregex++/kitdef.js +0 -1353
  51. package/novac/kits/kitrequire/kitdef.js +0 -1599
  52. package/novac/kits/kitx11/kitdef.js +0 -1
  53. package/novac/kits/kitx11/kitx11.js +0 -2472
  54. package/novac/kits/kitx11/kitx11_conn.js +0 -948
  55. package/novac/kits/kitx11/kitx11_worker.js +0 -121
  56. package/novac/kits/libtea/tf.js +0 -2691
  57. package/novac/kits/libterm/ex.js +0 -285
  58. package/novac/kits/libterm/kitdef.js +0 -1927
  59. package/novac/node_modules/chalk/license +0 -9
  60. package/novac/node_modules/chalk/package.json +0 -83
  61. package/novac/node_modules/chalk/readme.md +0 -297
  62. package/novac/node_modules/chalk/source/index.d.ts +0 -325
  63. package/novac/node_modules/chalk/source/index.js +0 -225
  64. package/novac/node_modules/chalk/source/utilities.js +0 -33
  65. package/novac/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -236
  66. package/novac/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -223
  67. package/novac/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
  68. package/novac/node_modules/chalk/source/vendor/supports-color/browser.js +0 -34
  69. package/novac/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
  70. package/novac/node_modules/chalk/source/vendor/supports-color/index.js +0 -190
  71. package/novac/node_modules/commander/LICENSE +0 -22
  72. package/novac/node_modules/commander/Readme.md +0 -1176
  73. package/novac/node_modules/commander/esm.mjs +0 -16
  74. package/novac/node_modules/commander/index.js +0 -24
  75. package/novac/node_modules/commander/lib/argument.js +0 -150
  76. package/novac/node_modules/commander/lib/command.js +0 -2777
  77. package/novac/node_modules/commander/lib/error.js +0 -39
  78. package/novac/node_modules/commander/lib/help.js +0 -747
  79. package/novac/node_modules/commander/lib/option.js +0 -380
  80. package/novac/node_modules/commander/lib/suggestSimilar.js +0 -101
  81. package/novac/node_modules/commander/package-support.json +0 -19
  82. package/novac/node_modules/commander/package.json +0 -82
  83. package/novac/node_modules/commander/typings/esm.d.mts +0 -3
  84. package/novac/node_modules/commander/typings/index.d.ts +0 -1113
  85. package/novac/node_modules/node-addon-api/LICENSE.md +0 -9
  86. package/novac/node_modules/node-addon-api/README.md +0 -95
  87. package/novac/node_modules/node-addon-api/common.gypi +0 -21
  88. package/novac/node_modules/node-addon-api/except.gypi +0 -25
  89. package/novac/node_modules/node-addon-api/index.js +0 -14
  90. package/novac/node_modules/node-addon-api/napi-inl.deprecated.h +0 -186
  91. package/novac/node_modules/node-addon-api/napi-inl.h +0 -7165
  92. package/novac/node_modules/node-addon-api/napi.h +0 -3364
  93. package/novac/node_modules/node-addon-api/node_addon_api.gyp +0 -42
  94. package/novac/node_modules/node-addon-api/node_api.gyp +0 -9
  95. package/novac/node_modules/node-addon-api/noexcept.gypi +0 -26
  96. package/novac/node_modules/node-addon-api/nothing.c +0 -0
  97. package/novac/node_modules/node-addon-api/package-support.json +0 -21
  98. package/novac/node_modules/node-addon-api/package.json +0 -480
  99. package/novac/node_modules/node-addon-api/tools/README.md +0 -73
  100. package/novac/node_modules/node-addon-api/tools/check-napi.js +0 -99
  101. package/novac/node_modules/node-addon-api/tools/clang-format.js +0 -71
  102. package/novac/node_modules/node-addon-api/tools/conversion.js +0 -301
  103. package/novac/node_modules/serialize-javascript/LICENSE +0 -27
  104. package/novac/node_modules/serialize-javascript/README.md +0 -149
  105. package/novac/node_modules/serialize-javascript/index.js +0 -297
  106. package/novac/node_modules/serialize-javascript/package.json +0 -33
  107. package/novac/package.json +0 -27
  108. package/novac/scripts/update-bin.js +0 -24
  109. package/novac/src/core/bstd.js +0 -1035
  110. package/novac/src/core/config.js +0 -155
  111. package/novac/src/core/describe.js +0 -187
  112. package/novac/src/core/emitter.js +0 -499
  113. package/novac/src/core/error.js +0 -86
  114. package/novac/src/core/executor.js +0 -5606
  115. package/novac/src/core/formatter.js +0 -686
  116. package/novac/src/core/lexer.js +0 -1026
  117. package/novac/src/core/nova_builtins.js +0 -717
  118. package/novac/src/core/nova_thread_worker.js +0 -166
  119. package/novac/src/core/parser.js +0 -2181
  120. package/novac/src/core/types.js +0 -112
  121. package/novac/src/index.js +0 -28
  122. package/novac/src/runtime/stdlib.js +0 -244
@@ -0,0 +1,125 @@
1
+ const units = {
2
+ ms: 1,
3
+ s: 1000,
4
+ m: 60 * 1000,
5
+ h: 60 * 60 * 1000,
6
+ day: 24 * 60 * 60 * 1000,
7
+ week: 7 * 24 * 60 * 60 * 1000,
8
+ month: 30 * 24 * 60 * 60 * 1000,
9
+ year: 365 * 24 * 60 * 60 * 1000,
10
+ };
11
+ class Task {
12
+ constructor(name, fn, options = {}) {
13
+ this.name = name;
14
+ this.fn = fn;
15
+ this.options = options;
16
+ this.resolved = false;
17
+ process.on('exit', () => {
18
+ if (!this.resolved) {
19
+ console.warn(`Task "${this.name}" was not resolved before process exit.`);
20
+ }
21
+ });
22
+ }
23
+ schedule(delay, unit) {
24
+ const delayMs = delay * (units[unit] || 1000);
25
+ setTimeout(() => {
26
+ this.fn();
27
+ this.resolved = true;
28
+ }, delayMs);
29
+ }
30
+ interval(delay, unit) {
31
+ const delayMs = delay * (units[unit] || 1000);
32
+ setInterval(() => {
33
+ this.fn();
34
+ this.resolved = true;
35
+ }, delayMs);
36
+ }
37
+ run() {
38
+ return new Promise((resolve, reject) => {
39
+ try {
40
+ const result = this.fn();
41
+ this.resolved = true;
42
+ resolve(result);
43
+ } catch (error) {
44
+ reject(error);
45
+ }
46
+ this.remove();
47
+ });
48
+ }
49
+ remove() {
50
+ this.resolved = true;
51
+ delete this;
52
+ }
53
+ }
54
+ class SyncTask {
55
+ constructor(name, fn, options = {}) {
56
+ this.name = name;
57
+ this.fn = fn;
58
+ this.options = options;
59
+ this.resolved = false;
60
+ process.on('exit', () => {
61
+ if (!this.resolved) {
62
+ console.warn(`Task "${this.name}" was not resolved before process exit.`);
63
+ }
64
+ });
65
+ }
66
+ schedule(delay, unit) {
67
+ const delayMs = delay * (units[unit] || 1000);
68
+ let execDate = delayMs + Date.now();
69
+ while (true) {
70
+ if (Date.now() >= execDate) {
71
+ this.fn();
72
+ this.resolved = true;
73
+ break;
74
+ }
75
+ /* spin */
76
+ }
77
+ }
78
+ interval(delay, unit) {
79
+ const delayMs = delay * (units[unit] || 1000);
80
+ let execDate = delayMs + Date.now();
81
+ while (true) {
82
+ if (Date.now() >= execDate) {
83
+ execDate += delayMs;
84
+ this.fn();
85
+ this.resolved = true;
86
+ }
87
+ /* spin */
88
+ }
89
+ }
90
+ run() {
91
+ let result = null;
92
+ try {
93
+ result = this.fn();
94
+ this.resolved = true;
95
+ } catch (error) {
96
+ throw error;
97
+ }
98
+ this.remove();
99
+ return result;
100
+ }
101
+ remove() {
102
+ this.resolved = true;
103
+ delete this;
104
+ }
105
+ }
106
+
107
+ class Tasker {
108
+ constructor(name, opts = {}) {
109
+ this.name = name;
110
+ this.options = opts;
111
+ }
112
+ createTask(name, fn, opts) {
113
+ return new Task(name, fn, opts);
114
+ }
115
+ createSyncTask(name, fn, opts) {
116
+ return new SyncTask(name, fn, opts);
117
+ }
118
+ removeTask(task) {
119
+ task.remove();
120
+ }
121
+ scheduleTask(task, delay, unit) {
122
+ task.schedule(delay, unit);
123
+ }
124
+
125
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "novac",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "a rewrite version of my package nvlang",
5
5
  "license": "MIT",
6
6
  "author": "purcwix",
File without changes
@@ -230,7 +230,7 @@ class Executor {
230
230
  this.globalScope.variables.std = stdlib;
231
231
  const self = this;
232
232
 
233
- this.globalScope.set('avaibleKits', (() => {
233
+ this.globalScope.set('availableKits', (() => {
234
234
  const kits = [];
235
235
  const kitsDir = require('path').join(__dirname, '../..', 'kits');
236
236
  try {
@@ -473,7 +473,10 @@ class Executor {
473
473
  info: (msg) => process.stdout.write('INFO: ' + String(msg) + '\n'),
474
474
  };
475
475
  this.globalScope.set('nvk', nvk);
476
- this.globalScope.set('charAt', String.fromCharCode);
476
+ this.globalScope.set('charCode', String.fromCharCode);
477
+ this.globalScope.set('codePoint', String.fromCodePoint);
478
+ this.globalScope.set('charAt', (str, idx=0) => (str instanceof NovaValue ? str.inner : str).charCodeAt(idx));
479
+ this.globalScope.set('codePointAt', (str, idx=0) => (str instanceof NovaValue ? str.inner : str).codePointAt(idx));
477
480
  // ── waitsync(fn, ...args) ─────────────────────────────────────────────
478
481
  // Calls fn(...args) and blocks synchronously until the result settles,
479
482
  // whether the function is:
@@ -4032,10 +4035,10 @@ Atomics.wait(flag, 0, 0);
4032
4035
  case 'run_expr': return this.execute(expr.code, scope)
4033
4036
 
4034
4037
  case 'native':
4035
- let val = this.evaluate(expr.value);
4038
+ let val = this.evaluate(expr.value);
4036
4039
  return val instanceof NovaValue ? val.inner : val;
4037
4040
 
4038
- case 'ast': return { kind:"ast", ast: expr.ast };
4041
+ case 'ast': return { kind: "ast", ast: expr.ast };
4039
4042
 
4040
4043
  case 'link': return {
4041
4044
  read: () => this.evaluate(expr.linked),
package/src/core/lexer.js CHANGED
@@ -403,7 +403,7 @@ const DYNAMIC_VARS = new Set([
403
403
  const CLASSIC_KEYWORDS = new Set([
404
404
  'foreach','temp','keep','echo','gear','engage','sandbox','infer','addto',
405
405
  'macro','snippet','defunc','lambda','compose','partial',
406
- 'backup','retrieve','describe','classify','rate',
406
+ 'backup','retrieve','describe','classify',
407
407
  'using','unuse',
408
408
  'lend','sstream','declare','session','enter','resu',
409
409
  'warn','info','skip','end','clear','time','keyfunc',
@@ -415,7 +415,7 @@ const KEYWORDS = new Set([
415
415
  // core
416
416
  'var','let','const','class','if','else','for','repeat','unless','until',
417
417
  'throw','try','catch','finally','func','function','return','give', 'yield', 'goback',
418
- 'async','await','do','while', 'block',
418
+ 'async','await','do','while', 'block', 'rate',
419
419
  // control
420
420
  'switch','case','default','break','continue',
421
421
  'of','each','match','when','where','as',
package/src/index.js CHANGED
File without changes
package/novac/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Purcwix (c) 2026
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the Software), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.