tova 0.9.12 → 0.9.14
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/bin/tova.js +14 -0
- package/package.json +1 -1
- package/src/codegen/codegen.js +17 -48
- package/src/codegen/edge-codegen.js +1 -5
- package/src/version.js +1 -1
package/bin/tova.js
CHANGED
|
@@ -2720,6 +2720,13 @@ shared {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
}
|
|
2722
2722
|
|
|
2723
|
+
security {
|
|
2724
|
+
cors {
|
|
2725
|
+
origins: ["http://localhost:3000"]
|
|
2726
|
+
methods: ["GET", "POST"]
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2723
2730
|
server {
|
|
2724
2731
|
fn get_message() {
|
|
2725
2732
|
Message("Hello from Tova!", Date.new().toLocaleTimeString())
|
|
@@ -3204,6 +3211,13 @@ browser {
|
|
|
3204
3211
|
file: 'src/app.tova',
|
|
3205
3212
|
content: name => `// ${name} — Built with Tova
|
|
3206
3213
|
|
|
3214
|
+
security {
|
|
3215
|
+
cors {
|
|
3216
|
+
origins: ["http://localhost:3000"]
|
|
3217
|
+
methods: ["GET", "POST", "PUT", "DELETE"]
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3207
3221
|
server {
|
|
3208
3222
|
fn health() {
|
|
3209
3223
|
{ status: "ok" }
|
package/package.json
CHANGED
package/src/codegen/codegen.js
CHANGED
|
@@ -2,57 +2,26 @@
|
|
|
2
2
|
// Supports named multi-blocks: server "api" { }, server "ws" { }
|
|
3
3
|
// Blocks with the same name are merged; different names produce separate output files.
|
|
4
4
|
|
|
5
|
-
import { createRequire } from 'module';
|
|
6
5
|
import { SharedCodegen } from './shared-codegen.js';
|
|
7
6
|
import { BUILTIN_NAMES } from '../stdlib/inline.js';
|
|
8
7
|
import { BlockRegistry } from '../registry/register-all.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function getBrowserCodegen() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
return _SecurityCodegen;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getCliCodegen() {
|
|
30
|
-
if (!_CliCodegen) _CliCodegen = _require('./cli-codegen.js').CliCodegen;
|
|
31
|
-
return _CliCodegen;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getEdgeCodegen() {
|
|
35
|
-
if (!_EdgeCodegen) _EdgeCodegen = _require('./edge-codegen.js').EdgeCodegen;
|
|
36
|
-
return _EdgeCodegen;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let _DeployCodegen;
|
|
40
|
-
function getDeployCodegen() {
|
|
41
|
-
if (!_DeployCodegen) _DeployCodegen = _require('./deploy-codegen.js').DeployCodegen;
|
|
42
|
-
return _DeployCodegen;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let _ThemeCodegen;
|
|
46
|
-
function getThemeCodegen() {
|
|
47
|
-
if (!_ThemeCodegen) _ThemeCodegen = _require('./theme-codegen.js').ThemeCodegen;
|
|
48
|
-
return _ThemeCodegen;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let _AuthCodegen;
|
|
52
|
-
function getAuthCodegen() {
|
|
53
|
-
if (!_AuthCodegen) _AuthCodegen = _require('./auth-codegen.js').AuthCodegen;
|
|
54
|
-
return _AuthCodegen;
|
|
55
|
-
}
|
|
8
|
+
import { ServerCodegen } from './server-codegen.js';
|
|
9
|
+
import { BrowserCodegen } from './browser-codegen.js';
|
|
10
|
+
import { SecurityCodegen } from './security-codegen.js';
|
|
11
|
+
import { CliCodegen } from './cli-codegen.js';
|
|
12
|
+
import { EdgeCodegen } from './edge-codegen.js';
|
|
13
|
+
import { DeployCodegen } from './deploy-codegen.js';
|
|
14
|
+
import { ThemeCodegen } from './theme-codegen.js';
|
|
15
|
+
import { AuthCodegen } from './auth-codegen.js';
|
|
16
|
+
|
|
17
|
+
function getServerCodegen() { return ServerCodegen; }
|
|
18
|
+
function getBrowserCodegen() { return BrowserCodegen; }
|
|
19
|
+
function getSecurityCodegen() { return SecurityCodegen; }
|
|
20
|
+
function getCliCodegen() { return CliCodegen; }
|
|
21
|
+
function getEdgeCodegen() { return EdgeCodegen; }
|
|
22
|
+
function getDeployCodegen() { return DeployCodegen; }
|
|
23
|
+
function getThemeCodegen() { return ThemeCodegen; }
|
|
24
|
+
function getAuthCodegen() { return AuthCodegen; }
|
|
56
25
|
|
|
57
26
|
export class CodeGenerator {
|
|
58
27
|
constructor(ast, filename = '<stdin>', options = {}) {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// Edge/serverless code generator for the Tova language
|
|
2
2
|
// Produces deployment-ready code for Cloudflare Workers, Deno Deploy, Vercel Edge, AWS Lambda, or Bun.
|
|
3
3
|
|
|
4
|
-
import { createRequire } from 'module';
|
|
5
4
|
import { BaseCodegen } from './base-codegen.js';
|
|
6
|
-
|
|
7
|
-
const _require = createRequire(import.meta.url);
|
|
8
|
-
let _SecurityCodegen;
|
|
5
|
+
import { SecurityCodegen as _SecurityCodegen } from './security-codegen.js';
|
|
9
6
|
|
|
10
7
|
const DEFAULT_TARGET = 'cloudflare';
|
|
11
8
|
|
|
@@ -295,7 +292,6 @@ export class EdgeCodegen extends BaseCodegen {
|
|
|
295
292
|
const noSec = { hasAuth: false, hasProtect: false, hasAutoSanitize: false };
|
|
296
293
|
if (!securityConfig) return noSec;
|
|
297
294
|
|
|
298
|
-
if (!_SecurityCodegen) _SecurityCodegen = _require('./security-codegen.js').SecurityCodegen;
|
|
299
295
|
const secGen = new _SecurityCodegen();
|
|
300
296
|
const fragments = secGen.generateServerSecurity(securityConfig);
|
|
301
297
|
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/embed-runtime.js — do not edit
|
|
2
|
-
export const VERSION = "0.9.
|
|
2
|
+
export const VERSION = "0.9.14";
|