@yannosay/sinth 4.1.0 → 5.1.1

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 (78) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/DOCS.md +1359 -0
  3. package/README.md +83 -74
  4. package/bin/sinth.js +2 -1
  5. package/dist/cli/args.d.ts +11 -0
  6. package/dist/cli/args.js +74 -0
  7. package/dist/cli/index.d.ts +1 -0
  8. package/dist/cli/index.js +437 -0
  9. package/dist/cli/templates.d.ts +10 -0
  10. package/dist/cli/templates.js +193 -0
  11. package/dist/cli/ui.d.ts +28 -0
  12. package/dist/cli/ui.js +61 -0
  13. package/dist/cli/update-check.d.ts +2 -0
  14. package/dist/cli/update-check.js +124 -0
  15. package/dist/compiler/ast.d.ts +315 -0
  16. package/dist/compiler/ast.js +4 -0
  17. package/dist/compiler/codegen.d.ts +143 -0
  18. package/dist/compiler/codegen.js +1326 -0
  19. package/dist/compiler/diagnostics.d.ts +36 -0
  20. package/dist/compiler/diagnostics.js +142 -0
  21. package/dist/compiler/elements.d.ts +14 -0
  22. package/dist/compiler/elements.js +78 -0
  23. package/dist/compiler/globals.d.ts +2 -0
  24. package/dist/compiler/globals.js +27 -0
  25. package/dist/compiler/html.d.ts +37 -0
  26. package/dist/compiler/html.js +152 -0
  27. package/dist/compiler/lexer.d.ts +42 -0
  28. package/dist/compiler/lexer.js +404 -0
  29. package/dist/compiler/parser.d.ts +95 -0
  30. package/dist/compiler/parser.js +1374 -0
  31. package/dist/compiler/prerender.d.ts +72 -0
  32. package/dist/compiler/prerender.js +910 -0
  33. package/dist/compiler/script-analysis.d.ts +6 -0
  34. package/dist/compiler/script-analysis.js +106 -0
  35. package/dist/compiler/style.d.ts +39 -0
  36. package/dist/compiler/style.js +463 -0
  37. package/dist/deploy/cloudflare.d.ts +9 -0
  38. package/dist/deploy/cloudflare.js +111 -0
  39. package/dist/index.d.ts +13 -0
  40. package/dist/index.js +23 -0
  41. package/dist/project/build.d.ts +31 -0
  42. package/dist/project/build.js +425 -0
  43. package/dist/project/config.d.ts +33 -0
  44. package/dist/project/config.js +142 -0
  45. package/dist/project/project.d.ts +74 -0
  46. package/dist/project/project.js +555 -0
  47. package/dist/runtime/index.d.ts +68 -0
  48. package/dist/runtime/index.js +912 -0
  49. package/dist/server/client.d.ts +1 -0
  50. package/dist/server/client.js +112 -0
  51. package/dist/server/dev.d.ts +8 -0
  52. package/dist/server/dev.js +244 -0
  53. package/dist/server/preview.d.ts +6 -0
  54. package/dist/server/preview.js +106 -0
  55. package/dist/server/static.d.ts +10 -0
  56. package/dist/server/static.js +136 -0
  57. package/lib/ui/index.sinth +436 -0
  58. package/package.json +33 -15
  59. package/schema/sinth.config.schema.json +54 -0
  60. package/dist/browser/compile.js +0 -63
  61. package/dist/cli.js +0 -509
  62. package/dist/core/builtins.js +0 -117
  63. package/dist/core/cli-compiler.js +0 -705
  64. package/dist/core/compiler.js +0 -1489
  65. package/dist/core/expr.js +0 -129
  66. package/dist/core/head-builder.js +0 -130
  67. package/dist/core/lexer.js +0 -410
  68. package/dist/core/parser.js +0 -1646
  69. package/dist/core/runtime/custom-element.js +0 -81
  70. package/dist/core/runtime/functions.js +0 -99
  71. package/dist/core/runtime/helpers.js +0 -347
  72. package/dist/core/runtime/render.js +0 -136
  73. package/dist/core/style-processor.js +0 -317
  74. package/dist/core/types.js +0 -93
  75. package/dist/resolver.js +0 -175
  76. package/dist/server.js +0 -174
  77. package/dist/update-check.js +0 -109
  78. package/dist/utils.js +0 -80
@@ -0,0 +1,72 @@
1
+ import { Expr, MetaEntry, SinthFile } from "./ast";
2
+ import { ResolvedImport } from "./codegen";
3
+ type Value = unknown;
4
+ declare class Cell {
5
+ value: Value;
6
+ constructor(value: Value);
7
+ }
8
+ declare class Env {
9
+ readonly parent: Env | null;
10
+ private readonly vars;
11
+ constructor(parent: Env | null);
12
+ define(name: string, value: Value): void;
13
+ find(name: string): Cell | undefined;
14
+ }
15
+ export interface PrerenderHost {
16
+ getFile(path: string): SinthFile;
17
+ getImports(file: SinthFile): ResolvedImport[];
18
+ }
19
+ export declare class Prerenderer {
20
+ private readonly host;
21
+ complete: boolean;
22
+ private steps;
23
+ private readonly moduleEnvs;
24
+ private readonly componentTables;
25
+ private depth;
26
+ constructor(host: PrerenderHost);
27
+ renderPage(file: SinthFile, params?: Record<string, string>): string;
28
+ /** Evaluates metadata in the page's module scope. Values that need the browser come back as `undefined` with `known: false`. */
29
+ evalMeta(file: SinthFile, params?: Record<string, string>): {
30
+ key: string;
31
+ value: Value;
32
+ known: boolean;
33
+ loc: MetaEntry["loc"];
34
+ }[];
35
+ /** Evaluates `paths` for a dynamic route. Route params are unknown at this point. */
36
+ evalPaths(file: SinthFile, paramNames: string[]): {
37
+ value: Value;
38
+ known: boolean;
39
+ };
40
+ private tick;
41
+ private moduleEnv;
42
+ private declare;
43
+ private makeFunction;
44
+ private execAll;
45
+ private exec;
46
+ eval(e: Expr, env: Env, file: SinthFile): Value;
47
+ private components;
48
+ private renderNodes;
49
+ private renderNode;
50
+ private renderUiFunction;
51
+ private attrValue;
52
+ private renderElement;
53
+ private renderComponent;
54
+ private styleVars;
55
+ }
56
+ export declare function toText(value: Value): string;
57
+ export interface PrerenderResult {
58
+ html: string;
59
+ complete: boolean;
60
+ meta: {
61
+ key: string;
62
+ value: unknown;
63
+ known: boolean;
64
+ loc: MetaEntry["loc"];
65
+ }[];
66
+ }
67
+ export declare function prerenderPage(file: SinthFile, host: PrerenderHost, params?: Record<string, string>): PrerenderResult;
68
+ export declare function evaluatePaths(file: SinthFile, host: PrerenderHost, paramNames: string[]): {
69
+ value: unknown;
70
+ known: boolean;
71
+ };
72
+ export {};