@solidrt/cli 0.0.52 → 0.0.53

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "solidrt-components-demos",
3
+ "type": "module",
4
+ "private": true,
5
+ "solidrt": {
6
+ "appId": "dev.solidrt.demos.components",
7
+ "displayName": "Gallery"
8
+ }
9
+ }
package/dist/server.js CHANGED
@@ -3842,7 +3842,7 @@ async function bindFirstFree() {
3842
3842
  candidates.push(p);
3843
3843
  let last = null;
3844
3844
  for (let port of candidates) {
3845
- if (await probe("127.0.0.1", port, { timeoutMs: 200 }) !== "closed")
3845
+ if (await probe("127.0.0.1", port, { timeoutMs: 200 }) === "open")
3846
3846
  continue;
3847
3847
  try {
3848
3848
  return bind(port);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/cli",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "license": "MIT",
5
5
  "funding": "https://github.com/sponsors/wellawaretech",
6
6
  "author": "Antoine van Wel",
@@ -24,22 +24,22 @@
24
24
  "@jridgewell/remapping": "^2.3.0",
25
25
  "@jridgewell/trace-mapping": "^0.3.25",
26
26
  "@modelcontextprotocol/sdk": "^1.29.0",
27
- "babel-preset-solid": "2.0.0-rc.1",
27
+ "@solidjs/babel-plugin": "2.0.0-rc.3",
28
28
  "bonjour-service": "^1.4.0",
29
29
  "qrcode-generator": "^2.0.4",
30
30
  "zod": "^4.4.3"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@solidrt/darwin-arm64": "0.0.52",
34
- "@solidrt/linux-arm64-gnu": "0.0.52",
35
- "@solidrt/linux-x64-gnu": "0.0.52",
36
- "@solidrt/win32-x64-msvc": "0.0.52"
33
+ "@solidrt/darwin-arm64": "0.0.53",
34
+ "@solidrt/linux-arm64-gnu": "0.0.53",
35
+ "@solidrt/linux-x64-gnu": "0.0.53",
36
+ "@solidrt/win32-x64-msvc": "0.0.53"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "typescript": "^7"
40
40
  },
41
41
  "devDependencies": {
42
- "@solidrt/flux-types": "0.0.52",
42
+ "@solidrt/flux-types": "0.0.53",
43
43
  "@types/babel__core": "^7.20.5",
44
44
  "@types/bun": "latest"
45
45
  }
@@ -2,7 +2,7 @@ import { transformAsync } from "@babel/core"
2
2
  import jsx from "@babel/plugin-syntax-jsx"
3
3
  import ts from "@babel/preset-typescript"
4
4
  import remapping from "@jridgewell/remapping"
5
- import solid from "babel-preset-solid"
5
+ import solid from "@solidjs/babel-plugin"
6
6
  import { type BunPlugin, type BuildArtifact } from "bun"
7
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"
8
8
  import { dirname, join, relative, resolve as resolvePath, sep } from "node:path"
@@ -76,7 +76,7 @@ async function codeFromOutputs(outputs: BuildArtifact[]): Promise<string> {
76
76
  return code
77
77
  }
78
78
 
79
- // Bun build plugin that runs JSX/TSX through babel-preset-solid (universal
79
+ // Bun build plugin that runs JSX/TSX through @solidjs/babel-plugin (universal
80
80
  // generate, targeting @solidrt/core) plus the TS preset. `moduleName` only ends
81
81
  // up as an import specifier in the emitted code, resolved from the app's tree at
82
82
  // bundle time; the CLI itself never loads core, so core is deliberately neither
@@ -108,8 +108,8 @@ function solidPlugin(inputs: Set<string>, babelMaps?: Map<string, object>, isola
108
108
  let transforms = await transformAsync(code, {
109
109
  filename: args.path,
110
110
  sourceMaps: !!babelMaps,
111
- presets: [[solid, { moduleName: "@solidrt/core", generate: "universal" }], [ts]],
112
- plugins: [jsx, inlineImport(inputs)],
111
+ presets: [[ts]],
112
+ plugins: [jsx, [solid, { moduleName: "@solidrt/core", generate: "universal" }], inlineImport(inputs)],
113
113
  })
114
114
  if (babelMaps && transforms?.map) babelMaps.set(args.path, transforms.map)
115
115
  return { contents: transforms?.code ?? "", loader: "js" }
@@ -11,8 +11,8 @@ declare module "@babel/preset-typescript" {
11
11
  let preset: PluginItem
12
12
  export default preset
13
13
  }
14
- declare module "babel-preset-solid" {
14
+ declare module "@solidjs/babel-plugin" {
15
15
  import { type PluginItem } from "@babel/core"
16
- let preset: PluginItem
17
- export default preset
16
+ let plugin: PluginItem
17
+ export default plugin
18
18
  }
package/src/demo/docs.md CHANGED
@@ -2,26 +2,32 @@
2
2
 
3
3
  {{ usage demo }}
4
4
 
5
- The demos that come with the packages this project installs. Without an
6
- argument it lists them, numbered:
5
+ The demos the SolidRT packages come with, shipped pre-bundled with the CLI so
6
+ every install has all of them, whether or not the packages themselves are
7
+ installed. Without an argument it lists them, numbered:
7
8
 
8
9
  ```
9
10
  1 3d/the-third-dimension
11
+ 2 components/gallery
10
12
  ```
11
13
 
12
14
  `srt demo 1` runs that one, exactly as [srt run](../server/docs.md) runs any
13
- project: a dev server, a local client window, reload on save, and the same
14
- server options (`--lan` to reach it from a device, `--port`, `--tunnel`). The qualified
15
- name works too (`srt demo 3d/the-third-dimension`), which is the stable way to
16
- name one in a script - the numbers follow the list, and the list follows what
17
- is installed.
15
+ project: a dev server and a local client window, with the same server
16
+ options (`--lan` to reach it from a device, `--port`, `--tunnel`). So a
17
+ running demo is an app the [console](../console/docs.md) picks up like any
18
+ other, with its tree, stats and control API. The qualified name works too
19
+ (`srt demo 3d/the-third-dimension`), which is the stable way to name one in
20
+ a script - the numbers follow the list.
18
21
 
19
- A package keeps its demos in `demos/`, and that folder is one project: its own
20
- package.json, one `assets/` folder, and `src/<name>.tsx` per demo. So the
21
- demos of one package share a dev server and a port - start a second one while
22
- the first is up and it says so. Demos from different packages run side by
23
- side.
22
+ A package keeps its demos in `demos/` in the repository, and that folder is
23
+ one project: its own package.json, one `assets/` folder, and `src/<name>.tsx`
24
+ per demo. The CLI ships that project bundled (`dist/demos/<package>/`, built
25
+ by `make -C packages/cli demos`), and `srt demo` serves it with the chosen
26
+ bundle as its entry. So the demos of one package share a dev server and a
27
+ port - start a second one while the first is up and it says so. Demos from
28
+ different packages run side by side.
24
29
 
25
- The demos ship inside the packages, so `node_modules` is where they are found:
26
- `srt demo` looks in the current directory and nowhere above it. Run it from
27
- the project root.
30
+ The bundles are what runs, so editing a demo's source does not reload it. In
31
+ a checkout, work on a demo with `srt run src/<name>.tsx --project` from the
32
+ package's `demos/` folder, and rebuild the shipped bundles with
33
+ `make -C packages/cli demos` when done.
package/src/demo/main.ts CHANGED
@@ -1,34 +1,36 @@
1
1
  import { readdirSync } from "node:fs"
2
- import { join, resolve } from "node:path"
2
+ import { join } from "node:path"
3
+ import { fileURLToPath } from "node:url"
3
4
  import { source } from "../lib/args"
4
5
 
5
- // srt demo: the demos the installed @solidrt packages ship. A package's
6
- // demos are ONE project (`<package>/demos/`: package.json, one assets/, and
7
- // src/<name>.tsx per demo), so a demo runs as the project it lives in - this
8
- // file only lists and resolves, and main.ts starts the ordinary dev server
9
- // with its cwd set to that project. Nothing downstream knows about demos.
6
+ // srt demo: the package demos the CLI ships pre-bundled (dist/demos/, built
7
+ // by `make -C packages/cli demos`: the release workflow before publishing, a
8
+ // checkout after editing a demo or its package). dist/demos/<pkg>/ is the
9
+ // package's demos project as the dev server serves it - package.json,
10
+ // assets/, and <slug>/<slug>.srt.js per demo - so a demo runs as the project
11
+ // it lives in: this file only lists and resolves, and main.ts starts the
12
+ // ordinary dev server with its cwd set to that project. Nothing downstream
13
+ // knows about demos, and a demo shows up in the console like any app.
10
14
 
11
15
  export type Demo = { name: string; cwd: string; entry: string }
12
16
 
13
- const SCOPE = join("node_modules", "@solidrt")
17
+ const DEMOS = fileURLToPath(new URL("../../dist/demos", import.meta.url))
14
18
 
15
- /** Every demo installed here, sorted so the printed numbers are stable.
16
- * The cwd and nothing above it - the same rule the server's mode resolution
17
- * follows (server/mode.ts), so this lists what THIS project installed. */
19
+ /** Every demo the CLI ships, sorted so the printed numbers are stable. */
18
20
  function discover(): Demo[] {
19
21
  let demos: Demo[] = []
20
- for (let pkg of names(SCOPE)) {
21
- let dir = join(SCOPE, pkg, "demos")
22
- for (let file of names(join(dir, "src"))) {
23
- if (!file.endsWith(".tsx")) continue
24
- demos.push({ name: `${pkg}/${file.slice(0, -".tsx".length)}`, cwd: resolve(dir), entry: join("src", file) })
22
+ for (let pkg of names(DEMOS)) {
23
+ let cwd = join(DEMOS, pkg)
24
+ for (let slug of names(cwd)) {
25
+ let entry = join(slug, `${slug}.srt.js`)
26
+ if (names(join(cwd, slug)).includes(`${slug}.srt.js`)) demos.push({ name: `${pkg}/${slug}`, cwd, entry })
25
27
  }
26
28
  }
27
29
  return demos
28
30
  }
29
31
 
30
- // A missing folder is the normal case (most packages ship no demos), so it
31
- // reads as an empty one rather than an error.
32
+ // A missing folder reads as an empty one: a checkout without a demos build
33
+ // has none, and assets/ is a sibling of the demo dirs, not one of them.
32
34
  function names(dir: string): string[] {
33
35
  try {
34
36
  return readdirSync(dir).sort()
@@ -45,7 +47,7 @@ function list(demos: Demo[]) {
45
47
  export async function main(): Promise<{ cwd: string; entry: string } | undefined> {
46
48
  let demos = discover()
47
49
  if (demos.length === 0) {
48
- console.error(`No demos installed in ${process.cwd()} (looked in ${SCOPE}/*/demos/src/)`)
50
+ console.error("Demos not built: run make -C packages/cli demos")
49
51
  process.exit(1)
50
52
  }
51
53
 
@@ -11,7 +11,9 @@ should open whenever the work matches its trigger.
11
11
  - @solidrt/core is the low-level foundation: host intrinsics (`<window>`,
12
12
  `<view>`, `<text>`, the detached `d-*` drawing primitives) with flat props
13
13
  that feed the layout and paint engine directly. An app can be written
14
- entirely at this level.
14
+ entirely at this level. d-* elements go under anything; laid-out elements
15
+ only under laid-out parents (a `<view>` inside a `<d-view>` throws), so a
16
+ component's doc comment says which kind it renders.
15
17
  - Extensions build on core. The first-party ones are @solidrt/components
16
18
  (UI components), @solidrt/2d (2D graphics) and @solidrt/3d (3D graphics).
17
19
  None is privileged - an extension is just functions returning core JSX,
@@ -10,14 +10,14 @@
10
10
  "android": "srt android"
11
11
  },
12
12
  "dependencies": {
13
- "@solidrt/core": "0.0.52",
14
- "@solidrt/components": "0.0.52",
15
- "@solidrt/2d": "0.0.52",
16
- "@solidrt/3d": "0.0.52"
13
+ "@solidrt/core": "0.0.53",
14
+ "@solidrt/components": "0.0.53",
15
+ "@solidrt/2d": "0.0.53",
16
+ "@solidrt/3d": "0.0.53"
17
17
  },
18
18
  "devDependencies": {
19
- "@solidrt/cli": "0.0.52",
20
- "@solidrt/flux-types": "0.0.52",
19
+ "@solidrt/cli": "0.0.53",
20
+ "@solidrt/flux-types": "0.0.53",
21
21
  "typescript": "^7"
22
22
  }
23
23
  }
package/src/lib/usage.ts CHANGED
@@ -27,7 +27,7 @@ Commands:
27
27
  run [file] Start dev server + local solidrt-go client
28
28
  server [file] Start dev server only
29
29
  client Start solidrt-go client only
30
- demo [<number>] List the demos the installed packages ship, or run one
30
+ demo [<number>] List the demos the CLI ships, or run one
31
31
  tool [<pkg>/<name>] List the tools the installed packages ship, or run one
32
32
  (everything after the tool name is the tool's own arguments)
33
33
  console Start the dev console: the dev servers on this machine and their clients
@@ -348,18 +348,21 @@ function bind(port: number): Server {
348
348
  })
349
349
  }
350
350
 
351
- // A bind alone does not prove a port free: with SO_REUSEADDR (the default
352
- // on a listener) Linux lets a loopback bind coexist with another process's
351
+ // A bind alone does not prove a port free: on macOS (BSD SO_REUSEADDR, the
352
+ // default on a listener) a loopback bind coexists with another process's
353
353
  // all-interfaces listener on the same port, and the newcomer then silently
354
- // takes the loopback traffic. So each candidate is dialed first; only a
355
- // refusal means free.
354
+ // takes the loopback traffic; Linux and Windows refuse the second bind. So
355
+ // each candidate is dialed first, and an answer means taken. Anything else
356
+ // is left to the bind: a refusal cannot be waited for, because Windows only
357
+ // reports one after ~2 s of SYN retries, so it reads as filtered within the
358
+ // probe budget and the bind is the truth.
356
359
  async function bindFirstFree(): Promise<Server> {
357
360
  if (config.port !== undefined) return bind(config.port)
358
361
  let candidates: number[] = remembered !== null ? [remembered] : []
359
362
  for (let p = DEFAULT_PORT; p < DEFAULT_PORT + PORT_TRIES; p++) candidates.push(p)
360
363
  let last: unknown = null
361
364
  for (let port of candidates) {
362
- if ((await probe("127.0.0.1", port, { timeoutMs: 200 })) !== "closed") continue
365
+ if ((await probe("127.0.0.1", port, { timeoutMs: 200 })) === "open") continue
363
366
  try {
364
367
  return bind(port)
365
368
  } catch (e) {