tw-framework 0.3.4__tar.gz → 0.3.6__tar.gz

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 (67) hide show
  1. tw_framework-0.3.6/LICENSE +21 -0
  2. tw_framework-0.3.6/PKG-INFO +103 -0
  3. tw_framework-0.3.6/README.md +91 -0
  4. {tw_framework-0.3.4 → tw_framework-0.3.6}/pyproject.toml +1 -1
  5. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/framework.py +36 -18
  6. tw_framework-0.3.6/tw_framework.egg-info/PKG-INFO +103 -0
  7. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework.egg-info/SOURCES.txt +1 -0
  8. tw_framework-0.3.4/PKG-INFO +0 -101
  9. tw_framework-0.3.4/README.md +0 -91
  10. tw_framework-0.3.4/tw_framework.egg-info/PKG-INFO +0 -101
  11. {tw_framework-0.3.4 → tw_framework-0.3.6}/setup.cfg +0 -0
  12. {tw_framework-0.3.4 → tw_framework-0.3.6}/tests/test_deployment.py +0 -0
  13. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/__init__.py +0 -0
  14. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/adapters/__init__.py +0 -0
  15. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/adapters/cloudflare.py +0 -0
  16. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/adapters/netlify.py +0 -0
  17. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/adapters/vercel.py +0 -0
  18. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/adapters/vercel_functions.py +0 -0
  19. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/advanced_diagnostics.py +0 -0
  20. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/asset_optimizer.py +0 -0
  21. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/ast_nodes.py +0 -0
  22. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/build.py +0 -0
  23. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/build_performance.py +0 -0
  24. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/build_report.py +0 -0
  25. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/cli.py +0 -0
  26. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/code_splitting.py +0 -0
  27. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/common.py +0 -0
  28. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/compiler.py +0 -0
  29. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/compiler_stats.py +0 -0
  30. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/dead_code.py +0 -0
  31. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/dependency_graph.py +0 -0
  32. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/deploy.py +0 -0
  33. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/dev.py +0 -0
  34. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/diagnostics.py +0 -0
  35. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/dynamic_imports.py +0 -0
  36. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/error_formatter.py +0 -0
  37. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/hydration.py +0 -0
  38. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/incremental_cache.py +0 -0
  39. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/interpreter.py +0 -0
  40. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/ir.py +0 -0
  41. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/lexer.py +0 -0
  42. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/lowering.py +0 -0
  43. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/parser.py +0 -0
  44. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/partial_rebuild.py +0 -0
  45. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/performance_analyzer.py +0 -0
  46. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/plugin_runtime.py +0 -0
  47. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/production_optimizer.py +0 -0
  48. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/reactivity.py +0 -0
  49. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/render_css.py +0 -0
  50. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/render_html.py +0 -0
  51. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/route_optimizer.py +0 -0
  52. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/router.py +0 -0
  53. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/runtime_model.py +0 -0
  54. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/runtime_values.py +0 -0
  55. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/semantic.py +0 -0
  56. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/server.py +0 -0
  57. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/signature.py +0 -0
  58. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/static_dynamic_auto.py +0 -0
  59. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/streaming.py +0 -0
  60. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/test_build_cli_pytest.py +0 -0
  61. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/tree_shaking.py +0 -0
  62. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/twm_api_runner.js +0 -0
  63. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework/twm_parser.py +0 -0
  64. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework.egg-info/dependency_links.txt +0 -0
  65. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework.egg-info/entry_points.txt +0 -0
  66. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework.egg-info/requires.txt +0 -0
  67. {tw_framework-0.3.4 → tw_framework-0.3.6}/tw_framework.egg-info/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TW
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.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: tw-framework
3
+ Version: 0.3.6
4
+ Summary: TW framework CLI with create, dev, build, and deploy commands
5
+ Author: TW Framework
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest>=7; extra == "dev"
11
+ Dynamic: license-file
12
+
13
+ <div align="center">
14
+
15
+ <img src="./tw-logo.svg" alt="TW logo" width="100" height="100">
16
+
17
+ # TW Framework
18
+
19
+ **A custom language + framework for building websites — write `.tw` / `.tss`, ship a full site.**
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/tw-framework.svg?color=22c55e)](https://pypi.org/project/tw-framework/)
22
+ [![PyPI downloads](https://img.shields.io/pypi/dm/tw-framework.svg?color=3b82f6)](https://pypi.org/project/tw-framework/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
24
+ [![GitHub stars](https://img.shields.io/github/stars/ffakraj-ui/twlang?style=social)](https://github.com/ffakraj-ui/twlang/stargazers)
25
+
26
+ [Getting Started](#getting-started) •
27
+ [CLI Commands](#cli-commands) •
28
+ [Features](#features) •
29
+ [Deploying](#deploying) •
30
+ [Contributing](#contributing)
31
+
32
+ </div>
33
+
34
+ ---
35
+
36
+ ## What is TW?
37
+
38
+ TW is both a **language** and a **framework**, in one package — comparable to TypeScript + Next.js combined:
39
+
40
+ - **Language** — `.tw` files (markup + logic) and `.tss` files (styles) compile down to plain HTML, CSS, and JS. TW has its own lexer, parser, and compiler pipeline.
41
+ - **Framework** — file-based routing, API routes, middleware, authentication helpers, a dev server with live reload, and one-command deploys to Vercel, Netlify, and Cloudflare Pages.
42
+
43
+ ```tw
44
+ page {
45
+ title "Home"
46
+ layout "main"
47
+ render static
48
+ }
49
+
50
+ BODY {
51
+ h1 "Hello from TW"
52
+ p "Write .tw and .tss files. Run tw dev. Ship fast."
53
+ }
54
+ ```
55
+
56
+ ## Getting Started
57
+
58
+ ```bash
59
+ pip install tw-framework
60
+
61
+ tw create my-site
62
+ cd my-site
63
+ tw dev
64
+ ```
65
+
66
+ Open `http://127.0.0.1:3000` — you now have a live-reloading dev server.
67
+
68
+ ## CLI Commands
69
+
70
+ | Command | Description |
71
+ |---|---|
72
+ | `tw create <name>` | Scaffold a new TW project |
73
+ | `tw dev` | Start the dev server with live reload |
74
+ | `tw build` | Generate a production build |
75
+ | `tw preview` | Preview the production build locally |
76
+ | `tw doctor` | Run project health checks |
77
+ | `tw deploy` | Build and deploy to a hosting provider |
78
+ | `tw check <file>` | Print diagnostics for a `.tw` file |
79
+
80
+ ## Features
81
+
82
+ - 📄 **File-based routing** — pages and dynamic routes (`[slug].tw`) from your folder structure
83
+ - ⚡ **Reactive bindings** — `on:click`, `bind:value` for interactivity without writing raw JS
84
+ - 🔌 **API routes** — `.twm` server functions for GET/POST/etc., colocated with your pages
85
+ - 🛡️ **Middleware** — auth, rate limiting, origin checks, custom headers — all declarative
86
+ - 🎨 **`.tss` stylesheets** — CSS with a friendlier syntax, animations, and variables
87
+ - 🔍 **Built-in search** — automatic search index generation, no extra setup
88
+ - 🚀 **Zero-config deploys** — Vercel, Netlify, and Cloudflare Pages adapters included
89
+
90
+ ## Deploying
91
+
92
+ **Vercel** — connect your GitHub repo, TW's `vercel.json` handles the rest.
93
+ **GitHub Pages** — enable Pages (Source → GitHub Actions) and push; the included workflow builds and deploys automatically.
94
+
95
+ See [Deploying](#deploying) in the docs for provider-specific notes.
96
+
97
+ ## Contributing
98
+
99
+ Issues and pull requests are welcome. If you find a bug, please open an issue with a minimal reproduction.
100
+
101
+ ## License
102
+
103
+ [MIT](./LICENSE)
@@ -0,0 +1,91 @@
1
+ <div align="center">
2
+
3
+ <img src="./tw-logo.svg" alt="TW logo" width="100" height="100">
4
+
5
+ # TW Framework
6
+
7
+ **A custom language + framework for building websites — write `.tw` / `.tss`, ship a full site.**
8
+
9
+ [![PyPI version](https://img.shields.io/pypi/v/tw-framework.svg?color=22c55e)](https://pypi.org/project/tw-framework/)
10
+ [![PyPI downloads](https://img.shields.io/pypi/dm/tw-framework.svg?color=3b82f6)](https://pypi.org/project/tw-framework/)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
12
+ [![GitHub stars](https://img.shields.io/github/stars/ffakraj-ui/twlang?style=social)](https://github.com/ffakraj-ui/twlang/stargazers)
13
+
14
+ [Getting Started](#getting-started) •
15
+ [CLI Commands](#cli-commands) •
16
+ [Features](#features) •
17
+ [Deploying](#deploying) •
18
+ [Contributing](#contributing)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## What is TW?
25
+
26
+ TW is both a **language** and a **framework**, in one package — comparable to TypeScript + Next.js combined:
27
+
28
+ - **Language** — `.tw` files (markup + logic) and `.tss` files (styles) compile down to plain HTML, CSS, and JS. TW has its own lexer, parser, and compiler pipeline.
29
+ - **Framework** — file-based routing, API routes, middleware, authentication helpers, a dev server with live reload, and one-command deploys to Vercel, Netlify, and Cloudflare Pages.
30
+
31
+ ```tw
32
+ page {
33
+ title "Home"
34
+ layout "main"
35
+ render static
36
+ }
37
+
38
+ BODY {
39
+ h1 "Hello from TW"
40
+ p "Write .tw and .tss files. Run tw dev. Ship fast."
41
+ }
42
+ ```
43
+
44
+ ## Getting Started
45
+
46
+ ```bash
47
+ pip install tw-framework
48
+
49
+ tw create my-site
50
+ cd my-site
51
+ tw dev
52
+ ```
53
+
54
+ Open `http://127.0.0.1:3000` — you now have a live-reloading dev server.
55
+
56
+ ## CLI Commands
57
+
58
+ | Command | Description |
59
+ |---|---|
60
+ | `tw create <name>` | Scaffold a new TW project |
61
+ | `tw dev` | Start the dev server with live reload |
62
+ | `tw build` | Generate a production build |
63
+ | `tw preview` | Preview the production build locally |
64
+ | `tw doctor` | Run project health checks |
65
+ | `tw deploy` | Build and deploy to a hosting provider |
66
+ | `tw check <file>` | Print diagnostics for a `.tw` file |
67
+
68
+ ## Features
69
+
70
+ - 📄 **File-based routing** — pages and dynamic routes (`[slug].tw`) from your folder structure
71
+ - ⚡ **Reactive bindings** — `on:click`, `bind:value` for interactivity without writing raw JS
72
+ - 🔌 **API routes** — `.twm` server functions for GET/POST/etc., colocated with your pages
73
+ - 🛡️ **Middleware** — auth, rate limiting, origin checks, custom headers — all declarative
74
+ - 🎨 **`.tss` stylesheets** — CSS with a friendlier syntax, animations, and variables
75
+ - 🔍 **Built-in search** — automatic search index generation, no extra setup
76
+ - 🚀 **Zero-config deploys** — Vercel, Netlify, and Cloudflare Pages adapters included
77
+
78
+ ## Deploying
79
+
80
+ **Vercel** — connect your GitHub repo, TW's `vercel.json` handles the rest.
81
+ **GitHub Pages** — enable Pages (Source → GitHub Actions) and push; the included workflow builds and deploys automatically.
82
+
83
+ See [Deploying](#deploying) in the docs for provider-specific notes.
84
+
85
+ ## Contributing
86
+
87
+ Issues and pull requests are welcome. If you find a bug, please open an issue with a minimal reproduction.
88
+
89
+ ## License
90
+
91
+ [MIT](./LICENSE)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tw-framework"
7
- version = "0.3.4"
7
+ version = "0.3.6"
8
8
  description = "TW framework CLI with create, dev, build, and deploy commands"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -338,33 +338,51 @@ def inject_dev_client(html_text: str) -> str:
338
338
 
339
339
 
340
340
  def render_error_html(title: str, message: str, status_code: int = 500) -> bytes:
341
+ if status_code == 404:
342
+ doc = f"""<!DOCTYPE html>
343
+ <html>
344
+ <head>
345
+ <meta charset="UTF-8">
346
+ <title>{html.escape(title)}</title>
347
+ <style>
348
+ body {{ margin: 0; height: 100vh; display: flex; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #fff; color: #000; }}
349
+ .wrap {{ text-align: center; padding: 0 24px; }}
350
+ h1 {{ display: inline-block; margin: 0 20px 0 0; padding-right: 20px; font-size: 24px; font-weight: 500; vertical-align: top; border-right: 1px solid rgba(0,0,0,0.3); }}
351
+ .msg {{ display: inline-block; text-align: left; line-height: 49px; height: 49px; }}
352
+ h2 {{ font-size: 14px; font-weight: 400; line-height: 49px; margin: 0; }}
353
+ </style>
354
+ </head>
355
+ <body>
356
+ <div class="wrap">
357
+ <h1>{status_code}</h1>
358
+ <div class="msg"><h2>{html.escape(message)}</h2></div>
359
+ </div>
360
+ </body>
361
+ </html>"""
362
+ return doc.encode("utf-8")
363
+
364
+ if 400 <= status_code < 500:
365
+ accent = "#b45309"
366
+ else:
367
+ accent = "#b91c1c"
341
368
  doc = f"""<!DOCTYPE html>
342
369
  <html>
343
370
  <head>
344
371
  <meta charset="UTF-8">
345
372
  <title>{html.escape(title)}</title>
346
373
  <style>
347
- body {{ margin: 0; font-family: Inter, system-ui, sans-serif; background: #0b1020; color: #f9fafb; }}
348
- .overlay {{ min-height: 100vh; padding: 32px; background:
349
- radial-gradient(circle at top left, rgba(220, 38, 38, 0.25), transparent 35%),
350
- linear-gradient(180deg, #130d14 0%, #0b1020 100%);
351
- }}
352
- .card {{ max-width: 1100px; margin: 0 auto; border: 1px solid rgba(248,113,113,0.35); background: rgba(17,24,39,0.88); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,0.45); overflow: hidden; }}
353
- .header {{ padding: 18px 22px; border-bottom: 1px solid rgba(248,113,113,0.18); background: rgba(127,29,29,0.22); }}
354
- .status {{ color: #fca5a5; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }}
355
- h1 {{ margin: 0; font-size: 28px; }}
356
- pre {{ margin: 0; white-space: pre-wrap; background: #020617; padding: 22px; overflow: auto; line-height: 1.55; }}
374
+ body {{ margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #fafafa; color: #111; padding: 24px; box-sizing: border-box; }}
375
+ .card {{ max-width: 720px; width: 100%; }}
376
+ .status {{ color: {accent}; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 10px; }}
377
+ h1 {{ margin: 0 0 16px; font-size: 24px; font-weight: 600; }}
378
+ pre {{ margin: 0; white-space: pre-wrap; background: #111; color: #f5f5f5; padding: 20px; border-radius: 8px; overflow: auto; line-height: 1.55; font-size: 13px; }}
357
379
  </style>
358
380
  </head>
359
381
  <body>
360
- <div class="overlay">
361
- <div class="card">
362
- <div class="header">
363
- <div class="status">TW Compile Error · HTTP {status_code}</div>
364
- <h1>{html.escape(title)}</h1>
365
- </div>
366
- <pre>{html.escape(message)}</pre>
367
- </div>
382
+ <div class="card">
383
+ <div class="status">HTTP {status_code}</div>
384
+ <h1>{html.escape(title)}</h1>
385
+ <pre>{html.escape(message)}</pre>
368
386
  </div>
369
387
  </body>
370
388
  </html>"""
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: tw-framework
3
+ Version: 0.3.6
4
+ Summary: TW framework CLI with create, dev, build, and deploy commands
5
+ Author: TW Framework
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest>=7; extra == "dev"
11
+ Dynamic: license-file
12
+
13
+ <div align="center">
14
+
15
+ <img src="./tw-logo.svg" alt="TW logo" width="100" height="100">
16
+
17
+ # TW Framework
18
+
19
+ **A custom language + framework for building websites — write `.tw` / `.tss`, ship a full site.**
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/tw-framework.svg?color=22c55e)](https://pypi.org/project/tw-framework/)
22
+ [![PyPI downloads](https://img.shields.io/pypi/dm/tw-framework.svg?color=3b82f6)](https://pypi.org/project/tw-framework/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
24
+ [![GitHub stars](https://img.shields.io/github/stars/ffakraj-ui/twlang?style=social)](https://github.com/ffakraj-ui/twlang/stargazers)
25
+
26
+ [Getting Started](#getting-started) •
27
+ [CLI Commands](#cli-commands) •
28
+ [Features](#features) •
29
+ [Deploying](#deploying) •
30
+ [Contributing](#contributing)
31
+
32
+ </div>
33
+
34
+ ---
35
+
36
+ ## What is TW?
37
+
38
+ TW is both a **language** and a **framework**, in one package — comparable to TypeScript + Next.js combined:
39
+
40
+ - **Language** — `.tw` files (markup + logic) and `.tss` files (styles) compile down to plain HTML, CSS, and JS. TW has its own lexer, parser, and compiler pipeline.
41
+ - **Framework** — file-based routing, API routes, middleware, authentication helpers, a dev server with live reload, and one-command deploys to Vercel, Netlify, and Cloudflare Pages.
42
+
43
+ ```tw
44
+ page {
45
+ title "Home"
46
+ layout "main"
47
+ render static
48
+ }
49
+
50
+ BODY {
51
+ h1 "Hello from TW"
52
+ p "Write .tw and .tss files. Run tw dev. Ship fast."
53
+ }
54
+ ```
55
+
56
+ ## Getting Started
57
+
58
+ ```bash
59
+ pip install tw-framework
60
+
61
+ tw create my-site
62
+ cd my-site
63
+ tw dev
64
+ ```
65
+
66
+ Open `http://127.0.0.1:3000` — you now have a live-reloading dev server.
67
+
68
+ ## CLI Commands
69
+
70
+ | Command | Description |
71
+ |---|---|
72
+ | `tw create <name>` | Scaffold a new TW project |
73
+ | `tw dev` | Start the dev server with live reload |
74
+ | `tw build` | Generate a production build |
75
+ | `tw preview` | Preview the production build locally |
76
+ | `tw doctor` | Run project health checks |
77
+ | `tw deploy` | Build and deploy to a hosting provider |
78
+ | `tw check <file>` | Print diagnostics for a `.tw` file |
79
+
80
+ ## Features
81
+
82
+ - 📄 **File-based routing** — pages and dynamic routes (`[slug].tw`) from your folder structure
83
+ - ⚡ **Reactive bindings** — `on:click`, `bind:value` for interactivity without writing raw JS
84
+ - 🔌 **API routes** — `.twm` server functions for GET/POST/etc., colocated with your pages
85
+ - 🛡️ **Middleware** — auth, rate limiting, origin checks, custom headers — all declarative
86
+ - 🎨 **`.tss` stylesheets** — CSS with a friendlier syntax, animations, and variables
87
+ - 🔍 **Built-in search** — automatic search index generation, no extra setup
88
+ - 🚀 **Zero-config deploys** — Vercel, Netlify, and Cloudflare Pages adapters included
89
+
90
+ ## Deploying
91
+
92
+ **Vercel** — connect your GitHub repo, TW's `vercel.json` handles the rest.
93
+ **GitHub Pages** — enable Pages (Source → GitHub Actions) and push; the included workflow builds and deploys automatically.
94
+
95
+ See [Deploying](#deploying) in the docs for provider-specific notes.
96
+
97
+ ## Contributing
98
+
99
+ Issues and pull requests are welcome. If you find a bug, please open an issue with a minimal reproduction.
100
+
101
+ ## License
102
+
103
+ [MIT](./LICENSE)
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  tests/test_deployment.py
@@ -1,101 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tw-framework
3
- Version: 0.3.4
4
- Summary: TW framework CLI with create, dev, build, and deploy commands
5
- Author: TW Framework
6
- Requires-Python: >=3.9
7
- Description-Content-Type: text/markdown
8
- Provides-Extra: dev
9
- Requires-Dist: pytest>=7; extra == "dev"
10
-
11
- # TW Framework
12
-
13
- TW is a custom language + framework for building websites with a Next.js‑like developer experience.
14
-
15
- ## Zero‑Config Deployment
16
-
17
- 1. Create a GitHub repository with your TW project (containing `tw.config`, `pages/`, `components/`, `public/`).
18
- 2. Connect the repository to Vercel or Netlify.
19
- 3. The platform automatically detects `tw.config` and runs `tw build`.
20
- 4. Your site goes live – no terminal commands required.
21
-
22
- ## Quick Start
23
-
24
- ```bash
25
- # Create a new project
26
- tw init my-site
27
- cd my-site
28
-
29
- # Development server
30
- tw dev
31
-
32
- # Production build
33
- tw build
34
-
35
- # Preview the build
36
- tw preview
37
- ```
38
-
39
- ## CLI Commands
40
-
41
- | Command | Description |
42
- |---------|-------------|
43
- | `tw init [name]` | Create a new TW project in the current directory |
44
- | `tw dev` | Start the development server with live reload |
45
- | `tw build` | Generate a production build |
46
- | `tw preview` | Preview the built output |
47
- | `tw export` | Generate a static export |
48
- | `tw deploy` | Build and deploy to a hosting provider |
49
- | `tw doctor` | Run project health checks and deployment compatibility |
50
- | `tw ast file.tw` | Print the AST JSON for a TW source file |
51
- | `tw ir file.tw` | Print the IR JSON for a TW source file |
52
- | `tw run file.tw` | Interpret a TW file and output HTML |
53
- | `tw check file.tw` | Print diagnostics for a TW file |
54
- | `tw tokens file.tw` | Print the token stream JSON for a TW source file |
55
- | `tw clean` | Clean dist and hidden cache folders |
56
- | `tw info` | Show a project summary |
57
- | `tw login` | Save deploy provider configuration |
58
-
59
- ## Deployment Metadata
60
-
61
- After a build, the file `dist/tw.deploy.json` is automatically generated. It contains:
62
-
63
- ```json
64
- {
65
- "framework": "tw",
66
- "version": "1.0.0",
67
- "build": "tw build",
68
- "output": "dist",
69
- "runtime": "ssr"
70
- }
71
- ```
72
-
73
- Deployment platforms can read this file to detect the framework and configure the build.
74
-
75
- ## Adapters
76
-
77
- TW Framework includes built‑in adapters for Vercel and Netlify. They provide:
78
-
79
- - Framework detection (`detect()` function)
80
- - Automatic generation of `vercel.json` / `netlify.toml` when missing
81
- - Build command, output directory, install command, and SSR handling
82
-
83
- ## Documentation
84
-
85
- - [Getting Started](docs/getting-started.md)
86
- - [Deployment to Vercel](docs/deployment/vercel.md)
87
- - [Deployment to Netlify](docs/deployment/netlify.md)
88
-
89
- ## Testing
90
-
91
- ```bash
92
- python3 -m unittest discover -s tests -q
93
- python3 run_tests.py
94
- ```
95
-
96
- ## Debug Flags
97
-
98
- - `TW_WARN_LITERAL_PARSE=1` – warn when literal parsing falls back to string
99
- - `TW_STRICT_EVAL=1` – re‑raise runtime expression errors instead of warning
100
-
101
- These flags are mainly useful while debugging parser/runtime edge cases or tightening CI checks around expression handling.
@@ -1,91 +0,0 @@
1
- # TW Framework
2
-
3
- TW is a custom language + framework for building websites with a Next.js‑like developer experience.
4
-
5
- ## Zero‑Config Deployment
6
-
7
- 1. Create a GitHub repository with your TW project (containing `tw.config`, `pages/`, `components/`, `public/`).
8
- 2. Connect the repository to Vercel or Netlify.
9
- 3. The platform automatically detects `tw.config` and runs `tw build`.
10
- 4. Your site goes live – no terminal commands required.
11
-
12
- ## Quick Start
13
-
14
- ```bash
15
- # Create a new project
16
- tw init my-site
17
- cd my-site
18
-
19
- # Development server
20
- tw dev
21
-
22
- # Production build
23
- tw build
24
-
25
- # Preview the build
26
- tw preview
27
- ```
28
-
29
- ## CLI Commands
30
-
31
- | Command | Description |
32
- |---------|-------------|
33
- | `tw init [name]` | Create a new TW project in the current directory |
34
- | `tw dev` | Start the development server with live reload |
35
- | `tw build` | Generate a production build |
36
- | `tw preview` | Preview the built output |
37
- | `tw export` | Generate a static export |
38
- | `tw deploy` | Build and deploy to a hosting provider |
39
- | `tw doctor` | Run project health checks and deployment compatibility |
40
- | `tw ast file.tw` | Print the AST JSON for a TW source file |
41
- | `tw ir file.tw` | Print the IR JSON for a TW source file |
42
- | `tw run file.tw` | Interpret a TW file and output HTML |
43
- | `tw check file.tw` | Print diagnostics for a TW file |
44
- | `tw tokens file.tw` | Print the token stream JSON for a TW source file |
45
- | `tw clean` | Clean dist and hidden cache folders |
46
- | `tw info` | Show a project summary |
47
- | `tw login` | Save deploy provider configuration |
48
-
49
- ## Deployment Metadata
50
-
51
- After a build, the file `dist/tw.deploy.json` is automatically generated. It contains:
52
-
53
- ```json
54
- {
55
- "framework": "tw",
56
- "version": "1.0.0",
57
- "build": "tw build",
58
- "output": "dist",
59
- "runtime": "ssr"
60
- }
61
- ```
62
-
63
- Deployment platforms can read this file to detect the framework and configure the build.
64
-
65
- ## Adapters
66
-
67
- TW Framework includes built‑in adapters for Vercel and Netlify. They provide:
68
-
69
- - Framework detection (`detect()` function)
70
- - Automatic generation of `vercel.json` / `netlify.toml` when missing
71
- - Build command, output directory, install command, and SSR handling
72
-
73
- ## Documentation
74
-
75
- - [Getting Started](docs/getting-started.md)
76
- - [Deployment to Vercel](docs/deployment/vercel.md)
77
- - [Deployment to Netlify](docs/deployment/netlify.md)
78
-
79
- ## Testing
80
-
81
- ```bash
82
- python3 -m unittest discover -s tests -q
83
- python3 run_tests.py
84
- ```
85
-
86
- ## Debug Flags
87
-
88
- - `TW_WARN_LITERAL_PARSE=1` – warn when literal parsing falls back to string
89
- - `TW_STRICT_EVAL=1` – re‑raise runtime expression errors instead of warning
90
-
91
- These flags are mainly useful while debugging parser/runtime edge cases or tightening CI checks around expression handling.
@@ -1,101 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tw-framework
3
- Version: 0.3.4
4
- Summary: TW framework CLI with create, dev, build, and deploy commands
5
- Author: TW Framework
6
- Requires-Python: >=3.9
7
- Description-Content-Type: text/markdown
8
- Provides-Extra: dev
9
- Requires-Dist: pytest>=7; extra == "dev"
10
-
11
- # TW Framework
12
-
13
- TW is a custom language + framework for building websites with a Next.js‑like developer experience.
14
-
15
- ## Zero‑Config Deployment
16
-
17
- 1. Create a GitHub repository with your TW project (containing `tw.config`, `pages/`, `components/`, `public/`).
18
- 2. Connect the repository to Vercel or Netlify.
19
- 3. The platform automatically detects `tw.config` and runs `tw build`.
20
- 4. Your site goes live – no terminal commands required.
21
-
22
- ## Quick Start
23
-
24
- ```bash
25
- # Create a new project
26
- tw init my-site
27
- cd my-site
28
-
29
- # Development server
30
- tw dev
31
-
32
- # Production build
33
- tw build
34
-
35
- # Preview the build
36
- tw preview
37
- ```
38
-
39
- ## CLI Commands
40
-
41
- | Command | Description |
42
- |---------|-------------|
43
- | `tw init [name]` | Create a new TW project in the current directory |
44
- | `tw dev` | Start the development server with live reload |
45
- | `tw build` | Generate a production build |
46
- | `tw preview` | Preview the built output |
47
- | `tw export` | Generate a static export |
48
- | `tw deploy` | Build and deploy to a hosting provider |
49
- | `tw doctor` | Run project health checks and deployment compatibility |
50
- | `tw ast file.tw` | Print the AST JSON for a TW source file |
51
- | `tw ir file.tw` | Print the IR JSON for a TW source file |
52
- | `tw run file.tw` | Interpret a TW file and output HTML |
53
- | `tw check file.tw` | Print diagnostics for a TW file |
54
- | `tw tokens file.tw` | Print the token stream JSON for a TW source file |
55
- | `tw clean` | Clean dist and hidden cache folders |
56
- | `tw info` | Show a project summary |
57
- | `tw login` | Save deploy provider configuration |
58
-
59
- ## Deployment Metadata
60
-
61
- After a build, the file `dist/tw.deploy.json` is automatically generated. It contains:
62
-
63
- ```json
64
- {
65
- "framework": "tw",
66
- "version": "1.0.0",
67
- "build": "tw build",
68
- "output": "dist",
69
- "runtime": "ssr"
70
- }
71
- ```
72
-
73
- Deployment platforms can read this file to detect the framework and configure the build.
74
-
75
- ## Adapters
76
-
77
- TW Framework includes built‑in adapters for Vercel and Netlify. They provide:
78
-
79
- - Framework detection (`detect()` function)
80
- - Automatic generation of `vercel.json` / `netlify.toml` when missing
81
- - Build command, output directory, install command, and SSR handling
82
-
83
- ## Documentation
84
-
85
- - [Getting Started](docs/getting-started.md)
86
- - [Deployment to Vercel](docs/deployment/vercel.md)
87
- - [Deployment to Netlify](docs/deployment/netlify.md)
88
-
89
- ## Testing
90
-
91
- ```bash
92
- python3 -m unittest discover -s tests -q
93
- python3 run_tests.py
94
- ```
95
-
96
- ## Debug Flags
97
-
98
- - `TW_WARN_LITERAL_PARSE=1` – warn when literal parsing falls back to string
99
- - `TW_STRICT_EVAL=1` – re‑raise runtime expression errors instead of warning
100
-
101
- These flags are mainly useful while debugging parser/runtime edge cases or tightening CI checks around expression handling.
File without changes