@vyckr/tachyon 1.1.3 → 1.1.5
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/main.js +13 -0
- package/package.json +1 -1
- package/routes/HTML +6 -28
- package/src/serve.ts +45 -30
- package/src/server/tach.ts +8 -0
package/main.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const link = document.createElement("link")
|
|
2
|
+
link.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
|
|
3
|
+
link.href = "stylesheet"
|
|
4
|
+
document.head.appendChild(link)
|
|
5
|
+
|
|
6
|
+
const script = document.createElement('script')
|
|
7
|
+
script.type = "module"
|
|
8
|
+
script.src = "https://esm.run/@material/web/all.js"
|
|
9
|
+
document.head.appendChild(script)
|
|
10
|
+
|
|
11
|
+
import("https://esm.run/@material/web/typography/md-typescale-styles.js").then(module => {
|
|
12
|
+
document.adoptedStyleSheets.push(module.styles.styleSheet)
|
|
13
|
+
})
|
package/package.json
CHANGED
package/routes/HTML
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
console.log("Hello from JavaScript")
|
|
8
|
-
|
|
9
|
-
let greeting = "Hello from HTML!"
|
|
10
|
-
|
|
11
|
-
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
12
|
-
|
|
13
|
-
const start = 5
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<h1>${greeting}</h1>
|
|
17
|
-
<input type="text" placeholder="Write Something" :value="greeting" @input="(value) => greeting = value" />
|
|
18
|
-
<br/>
|
|
19
|
-
<ty-counter :count="start" />
|
|
20
|
-
<ty-loop :for="const num of arr">
|
|
21
|
-
<ty-logic :if="num % 5 === 0">
|
|
22
|
-
<p>Half way there! Number ${num}</p>
|
|
23
|
-
</ty-logic>
|
|
24
|
-
<ty-logic :else>
|
|
25
|
-
<p>Number ${num}</p>
|
|
26
|
-
</ty-logic>
|
|
27
|
-
</ty-loop>
|
|
28
|
-
<ty-counter :count="start" />
|
|
1
|
+
<h1 class="md-typescale-display-medium">Hello Material!</h1>
|
|
2
|
+
<form>
|
|
3
|
+
<p class="md-typescale-body-medium">Check out these controls in a form!</p>
|
|
4
|
+
<md-outlined-text-field label="Favorite color" value="Purple"></md-outlined-text-field>
|
|
5
|
+
<md-outlined-button type="reset">Reset</md-outlined-button>
|
|
6
|
+
</form>
|
package/src/serve.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Router, { _ctx } from "./router.js"
|
|
|
4
4
|
import Yon from "./client/yon.js"
|
|
5
5
|
import { Logger } from "./server/logger.js"
|
|
6
6
|
import { ServerWebSocket } from "bun"
|
|
7
|
-
import { watch } from "fs/promises"
|
|
7
|
+
import { watch, exists } from "fs/promises"
|
|
8
8
|
import { watch as watcher } from "node:fs";
|
|
9
9
|
|
|
10
10
|
type WebSocketData = {
|
|
@@ -93,26 +93,32 @@ if(server.development) {
|
|
|
93
93
|
return undefined
|
|
94
94
|
},
|
|
95
95
|
websocket: {
|
|
96
|
-
open(ws) {
|
|
96
|
+
async open(ws) {
|
|
97
97
|
console.info("HMR Enabled")
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
|
|
99
|
+
if(await exists(Router.routesPath)) {
|
|
100
|
+
|
|
101
|
+
watcher(Router.routesPath, { recursive: true }, () => {
|
|
102
|
+
queueMicrotask(async () => {
|
|
103
|
+
console.info("HMR Update")
|
|
104
|
+
await configureRoutes()
|
|
105
|
+
server.reload({ routes: Router.reqRoutes })
|
|
106
|
+
ws.send('')
|
|
107
|
+
})
|
|
105
108
|
})
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if(await exists(Router.componentsPath)) {
|
|
112
|
+
|
|
113
|
+
watcher(Router.componentsPath, { recursive: true }, () => {
|
|
114
|
+
queueMicrotask(async () => {
|
|
115
|
+
console.info("HMR Update")
|
|
116
|
+
await configureRoutes()
|
|
117
|
+
server.reload({ routes: Router.reqRoutes })
|
|
118
|
+
ws.send('')
|
|
119
|
+
})
|
|
114
120
|
})
|
|
115
|
-
}
|
|
121
|
+
}
|
|
116
122
|
},
|
|
117
123
|
message(ws, message) {
|
|
118
124
|
|
|
@@ -124,21 +130,30 @@ if(server.development) {
|
|
|
124
130
|
port: 9876
|
|
125
131
|
})
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
|
|
134
|
+
if(await exists(Router.routesPath)) {
|
|
135
|
+
|
|
136
|
+
watcher(Router.routesPath, { recursive: true }, () => {
|
|
137
|
+
queueMicrotask(async () => {
|
|
138
|
+
await configureRoutes()
|
|
139
|
+
server.reload({ routes: Router.reqRoutes })
|
|
140
|
+
})
|
|
131
141
|
})
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if(await exists(Router.componentsPath)) {
|
|
145
|
+
|
|
146
|
+
watcher(Router.componentsPath, { recursive: true }, () => {
|
|
147
|
+
queueMicrotask(async () => {
|
|
148
|
+
await configureRoutes()
|
|
149
|
+
server.reload({ routes: Router.reqRoutes })
|
|
150
|
+
})
|
|
138
151
|
})
|
|
139
|
-
}
|
|
152
|
+
}
|
|
140
153
|
}
|
|
141
154
|
|
|
142
155
|
const elapsed = Date.now() - start
|
|
143
156
|
|
|
144
|
-
console.info(`Live Server is running on http://${server.hostname}:${server.port} (Press CTRL+C to quit) - ${elapsed.toFixed(2)}ms`)
|
|
157
|
+
console.info(`Live Server is running on http://${server.hostname}:${server.port} (Press CTRL+C to quit) - ${elapsed.toFixed(2)}ms`)
|
|
158
|
+
|
|
159
|
+
// console.info(`Available Routes:\n\t${Object.keys(Router.reqRoutes).join('\n\t')}`)
|
package/src/server/tach.ts
CHANGED
|
@@ -229,6 +229,14 @@ export default class Tach {
|
|
|
229
229
|
Router.reqRoutes[`${route}/*`][method] = serverRoute
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
if(Router.reqRoutes['//*']) delete Router.reqRoutes['//*']
|
|
234
|
+
|
|
235
|
+
if(!Router.reqRoutes['/']) {
|
|
236
|
+
Router.reqRoutes['/'] = {
|
|
237
|
+
GET: serverRoute
|
|
238
|
+
}
|
|
239
|
+
}
|
|
232
240
|
}
|
|
233
241
|
}
|
|
234
242
|
}
|