@solidrt/cli 0.0.1-exp.9 → 0.0.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.
- package/package.json +5 -5
- package/src/build.ts +1 -1
- package/src/bun-plugin-solid.ts +2 -19
- package/src/repl.ts +4 -1
- package/src/server.ts +2 -2
- package/src/util.ts +1 -1
- package/src/watcher.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidrt/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Antoine van Wel",
|
|
6
6
|
"type": "module",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"qrcode-generator": "^2.0.4"
|
|
20
20
|
},
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@solidrt/darwin-arm64": "0.0.
|
|
23
|
-
"@solidrt/linux-x64-gnu": "0.0.
|
|
24
|
-
"@solidrt/win32-x64-msvc": "0.0.
|
|
22
|
+
"@solidrt/darwin-arm64": "0.0.2",
|
|
23
|
+
"@solidrt/linux-x64-gnu": "0.0.2",
|
|
24
|
+
"@solidrt/win32-x64-msvc": "0.0.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@solidrt/core": "0.0.
|
|
27
|
+
"@solidrt/core": "0.0.2",
|
|
28
28
|
"typescript": "^5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/build.ts
CHANGED
|
@@ -48,7 +48,7 @@ export async function bundleTo(outfile: string) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async function compileJs(jsCode: string, outfile: string) {
|
|
51
|
-
let compiler = requireBinary("
|
|
51
|
+
let compiler = requireBinary("fluxc")
|
|
52
52
|
let proc = Bun.spawn([compiler], {
|
|
53
53
|
stdin: new Blob([jsCode]),
|
|
54
54
|
stdout: "pipe",
|
package/src/bun-plugin-solid.ts
CHANGED
|
@@ -2,11 +2,8 @@ import { transformAsync } from "@babel/core"
|
|
|
2
2
|
import ts from "@babel/preset-typescript"
|
|
3
3
|
import solid from "babel-preset-solid"
|
|
4
4
|
import { type BunPlugin } from "bun"
|
|
5
|
-
import { resolve } from "path"
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function solidPlugin(opts: { devBase?: string } = {}): BunPlugin {
|
|
6
|
+
export function solidPlugin(): BunPlugin {
|
|
10
7
|
return {
|
|
11
8
|
name: "bun-plugin-solid",
|
|
12
9
|
setup: (build) => {
|
|
@@ -19,20 +16,6 @@ export function solidPlugin(opts: { devBase?: string } = {}): BunPlugin {
|
|
|
19
16
|
})
|
|
20
17
|
return { contents: transforms?.code ?? "", loader: "js" }
|
|
21
18
|
})
|
|
22
|
-
|
|
23
|
-
// // -- dev-mode qjs:io rewrite ----------------------------------
|
|
24
|
-
// // In dev, user code's `import * as io from "qjs:io"` is redirected
|
|
25
|
-
// // to a wrapper that proxies non-http targets through the dev
|
|
26
|
-
// // server. The wrapper itself imports `qjs:io` -- that one import
|
|
27
|
-
// // is short-circuited to `external` to break the cycle.
|
|
28
|
-
// if (opts.devBase) {
|
|
29
|
-
// build.onResolve({ filter: /^qjs:io$/ }, (args) => {
|
|
30
|
-
// if (args.importer === ioDevPath) {
|
|
31
|
-
// return { path: "qjs:io", external: true }
|
|
32
|
-
// }
|
|
33
|
-
// return { path: ioDevPath }
|
|
34
|
-
// })
|
|
35
|
-
// }
|
|
36
19
|
},
|
|
37
20
|
}
|
|
38
|
-
}
|
|
21
|
+
}
|
package/src/repl.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { resolve, dirname } from "path"
|
|
|
3
3
|
import { readdirSync } from "node:fs"
|
|
4
4
|
import { state, print, printErr, broadcastStop, shutdown } from "./util"
|
|
5
5
|
import { bundle } from "./build"
|
|
6
|
-
import { startWatcher } from "./watcher"
|
|
6
|
+
import { startWatcher, stopWatcher } from "./watcher"
|
|
7
7
|
|
|
8
8
|
function cmdStop(args: string) {
|
|
9
9
|
if (!args) {
|
|
10
|
+
stopWatcher()
|
|
11
|
+
state.currentCode = null
|
|
12
|
+
state.source = undefined
|
|
10
13
|
broadcastStop()
|
|
11
14
|
print("[cli] Sent stop to all clients")
|
|
12
15
|
return
|
package/src/server.ts
CHANGED
|
@@ -44,10 +44,10 @@ export function startServer() {
|
|
|
44
44
|
}),
|
|
45
45
|
)
|
|
46
46
|
entries.sort((a, b) => a.name.localeCompare(b.name))
|
|
47
|
-
return Response.json(entries)
|
|
47
|
+
return Response.json(entries, { headers: { "X-SRT-Type": "directory" } })
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
return new Response(Bun.file(filePath))
|
|
50
|
+
return new Response(Bun.file(filePath), { headers: { "X-SRT-Type": "file" } })
|
|
51
51
|
},
|
|
52
52
|
websocket: {
|
|
53
53
|
open(ws) {
|
package/src/util.ts
CHANGED
|
@@ -11,7 +11,7 @@ export let state = {
|
|
|
11
11
|
source: undefined as string | undefined,
|
|
12
12
|
sourceDir: process.cwd(),
|
|
13
13
|
child: null as ReturnType<typeof Bun.spawn> | null,
|
|
14
|
-
server: null as BunServer<
|
|
14
|
+
server: null as BunServer<undefined> | null,
|
|
15
15
|
serverUrl: null as string | null,
|
|
16
16
|
rl: null as ReadlineInterface | null,
|
|
17
17
|
}
|
package/src/watcher.ts
CHANGED
|
@@ -5,6 +5,13 @@ import { bundle } from "./build"
|
|
|
5
5
|
|
|
6
6
|
let currentWatcher: ReturnType<typeof watch> | null = null
|
|
7
7
|
|
|
8
|
+
export function stopWatcher() {
|
|
9
|
+
if (currentWatcher) {
|
|
10
|
+
currentWatcher.close()
|
|
11
|
+
currentWatcher = null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
export function startWatcher() {
|
|
9
16
|
if (!state.source) return
|
|
10
17
|
let watchDir = dirname(resolve(state.source))
|