@stacksjs/defaults 0.75.559 → 0.75.561

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.
@@ -438,6 +438,8 @@ buddy dev:desktop # run from source, stx views
438
438
  buddy build:desktop # this machine's target
439
439
  buddy build:desktop --target linux-x64,win32-x64 # cross-compile the agents
440
440
  buddy build:desktop --target all --package # also make the installers this OS can make
441
+ buddy build:desktop --identity "Developer ID Application: Example (ABCDE12345)" # macOS: sign with this certificate
442
+ buddy build:desktop --import ./ci-output # add targets built on another machine to this build
441
443
  ```
442
444
 
443
445
  Output goes to `storage/framework/desktop/webview/<target>/`, with `build.json` listing every artifact.
@@ -458,7 +460,8 @@ machine's target; else the build fetches it. Craft publishes `craft-<os>-<arch>.
458
460
  `build:desktop --target ...` downloads the one for the installed `craft-native` version, checks its size and SHA-256
459
461
  against that release's `release-manifest.json`, and keeps it unpacked in `storage/framework/desktop/runtimes/<target>/`
460
462
  (gitignored; a later build reuses it and a new Craft version replaces it). An app needs no script of its own for
461
- this. Craft publishes runtimes for `darwin-arm64`, `darwin-x64`, `linux-x64` and `win32-x64`; the arm64 Linux and
463
+ this. A machine with no Craft of its own (a CI runner with no `CRAFT_BIN` and no `craft` on PATH) fetches its own
464
+ target's runtime the same way. Craft publishes runtimes for `darwin-arm64`, `darwin-x64`, `linux-x64` and `win32-x64`; the arm64 Linux and
462
465
  Windows targets still need a runtime named in the config. `DESKTOP_RUNTIME_FETCH=0` keeps a build off the network.
463
466
 
464
467
  On Windows, `WebView2Loader.dll` is copied into the app from beside the runtime (Craft's archive ships it there)
@@ -493,11 +496,33 @@ serves. Then per target:
493
496
 
494
497
  Artifacts and manifests go through `@stacksjs/storage` to `updates.disk` under `updates.prefix`
495
498
  (`desktop-updates/<channel>/<platform>-<arch>/latest.json`, artifacts under `<version>/`), plus a `release.json`
496
- a download page can read. A release is often made in several runs, the Mac from a Mac and then
499
+ a download page can read. Each target in it has `update` (what an installed app updates from) and `downloads` (what a
500
+ person takes, the usual choice first: the DMG on macOS, the MSI on Windows, the AppImage and then the deb and rpm on
501
+ Linux), every entry with `name`, `format` (`dmg`, `msi`, `appimage`, `deb`, `rpm`, `zip`), `url`, `sha256` and `bytes`,
502
+ so a download page needs no rules of its own. A release is often made in several runs, the Mac from a Mac and then
497
503
  `release:desktop --target linux-x64 --skip-build` for installers built elsewhere: a run for the same version and
498
504
  channel adds its targets to `release.json` and replaces only the ones it published again. A new version starts a
499
505
  new record.
500
506
 
507
+ **Targets built on another machine.** `build.json` in the output folder records every target and the SHA-256 of each
508
+ file, and a release publishes from it. To bring in what CI built, carry its output folder (the target folders and its
509
+ `build.json`) to the machine that releases and run `buddy build:desktop --import <folder>` (`--target` narrows it, and
510
+ a single target's folder works too). The import refuses a build of another app, version or commit (it must be the
511
+ commit this checkout is at) and any file that does not match its recorded hash, then copies the folders in and adds
512
+ the targets to the local record beside what was built here. An installer found under a target's `packages/` that the
513
+ record does not list (an MSI made by Craft's `packageApp` on its own) is recorded as found, with a warning that
514
+ there was nothing to check it against. With `--package`, an imported target for this operating system that has no
515
+ installer yet gets one made here: on a Windows runner, `buddy build:desktop --import <folder> --package` turns a
516
+ folder cross-compiled on Linux into a recorded MSI. Then `release:desktop --skip-build` publishes them. A build also
517
+ keeps the record's other targets when they are from the same version and commit.
518
+
519
+ **The identity a Mac build is signed with.** `build:desktop` signs with `--identity` or `DESKTOP_SIGNING_IDENTITY`
520
+ when one is given. Without one it uses the first Apple Development certificate it finds (which keeps Keychain items
521
+ trusted across rebuilds), else signs ad hoc, and says so in its output: neither can be notarized.
522
+ `release:desktop --identity` signs the bundle again with the identity it was given when the bundle is not already
523
+ signed with a Developer ID, hardened runtime and timestamp, so `--skip-build` works on a development build. It
524
+ refuses, before notarizing, when that identity is not a Developer ID Application certificate.
525
+
501
526
  The server side is one default action, `Actions/Desktop/UpdateFeedAction`, mounted at
502
527
  `/api/updates/{platform}/{arch}` whenever `webview.updates` is configured. It serves the stored manifest as is
503
528
  (204 when `?current=` is already that version, 404 when nothing was published). Override the action in
@@ -39,7 +39,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
39
39
  | `@stacksjs/datetime` | [`stacks-datetime`](../stacks-datetime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/datetime/src/index.ts) | 22 |
40
40
  | `@stacksjs/defaults` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/package.json) | 3 |
41
41
  | `@stacksjs/deploy` | [`stacks-deploy`](../stacks-deploy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/deploy/package.json) | 1 |
42
- | `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) | 21 |
42
+ | `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) | 22 |
43
43
  | `@stacksjs/development` | [`stacks-development`](../stacks-development/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/development/package.json) | 1 |
44
44
  | `@stacksjs/dns` | [`stacks-dns`](../stacks-dns/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/dns/src/index.ts) | 4 |
45
45
  | `@stacksjs/docs` | [`stacks-docs`](../stacks-docs/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/src/index.ts) | 3 |
@@ -90,7 +90,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
90
90
  | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 52 |
91
91
  | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
92
92
  | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 24 |
93
- | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 3 |
93
+ | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 4 |
94
94
  | `@stacksjs/tunnel` | [`stacks-tunnel`](../stacks-tunnel/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tunnel/src/index.ts) | 1 |
95
95
  | `@stacksjs/types` | [`stacks-types`](../stacks-types/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/types/src/index.ts) | 2 |
96
96
  | `@stacksjs/ui` | [`stacks-ui`](../stacks-ui/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ui/src/index.ts) | 6 |
@@ -392,9 +392,9 @@ Guidance: [`stacks-desktop`](../stacks-desktop/SKILL.md). Source: [storage/frame
392
392
 
393
393
  Declared runtime exports: `BUN_EXECUTABLE_MARKER`, `RESERVED_PLIST_KEYS`, `USERLAND_LAUNCHER`, `bundleDirectoryFor`, `codesignArgs`, `craftDevCommand`, `createUpdateManifestUrl`, `describeRuntimeDuplication`, `desktopAppVersion`, `desktopLauncherCompileArgs`, `developerIdProblem`, `dmgVolumeName`, `hasUserlandDesktopLauncher`, `isMachO`, `looksLikeBunExecutable`, `notarizationOutcome`, `notarytoolAuthArgs`, `openDevWindow`, `plistValue`, `renderInfoPlist`, `renderUserlandPlistEntries`, `resolveCraftBinary`, `resolveCraftExecutable`, `resolveDesktopLauncher`, `resolveDevWindowUrl`, `resolveDmgPackaging`, `xmlEscape`.
394
394
 
395
- Local source modules: [src/agent-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent-launcher.ts), [src/agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent.ts), [src/craft-runtime.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/craft-runtime.ts), [src/invites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/invites.ts), [src/macos-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-app.ts), [src/macos-bundle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-bundle.ts), [src/support.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/support.ts), [src/update-feed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-feed.ts), [src/update-install.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-install.ts), [src/update-signing.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-signing.ts), [src/updater.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/updater.ts), [src/webview-agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-agent.ts), [src/webview-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-app.ts), [src/webview-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-launcher.ts).
395
+ Local source modules: [src/agent-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent-launcher.ts), [src/agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent.ts), [src/craft-runtime.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/craft-runtime.ts), [src/invites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/invites.ts), [src/macos-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-app.ts), [src/macos-bundle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-bundle.ts), [src/support.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/support.ts), [src/update-feed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-feed.ts), [src/update-install.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-install.ts), [src/update-signing.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-signing.ts), [src/updater.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/updater.ts), [src/webview-agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-agent.ts), [src/webview-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-app.ts), [src/webview-build-record.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-build-record.ts), [src/webview-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-launcher.ts).
396
396
 
397
- Evidence directory: [21 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
397
+ Evidence directory: [22 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
398
398
 
399
399
  ### @stacksjs/development
400
400
 
@@ -882,9 +882,9 @@ Guidance: [`stacks-repl`](../stacks-repl/SKILL.md). Source: [storage/framework/c
882
882
 
883
883
  Declared runtime exports: `appendHistory`, `clearHistory`, `getHistoryPath`, `isIncompleteSnippet`, `readHistory`, `renderValue`, `startTinker`, `tinkerEval`, `tinkerPrint`.
884
884
 
885
- Local source modules: [src/magic.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/magic.ts), [src/protocol.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/protocol.ts), [src/serialize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/serialize.ts), [src/session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/session.ts).
885
+ Local source modules: [src/magic.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/magic.ts), [src/protocol.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/protocol.ts), [src/serialize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/serialize.ts), [src/session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/session.ts), [src/settle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/settle.ts).
886
886
 
887
- Evidence directory: [3 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
887
+ Evidence directory: [4 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
888
888
 
889
889
  ### @stacksjs/tunnel
890
890
 
@@ -51,8 +51,8 @@ import type { TinkerConfig } from '@stacksjs/repl'
51
51
 
52
52
  ```bash
53
53
  buddy tinker # interactive prompt, app booted
54
- buddy tinker --print 'await User.count()' # evaluate, print the value, exit
55
- buddy tinker --eval 'await seed()' # evaluate, exit, print nothing
54
+ buddy tinker --print 'User.count()' # evaluate, print the value, exit
55
+ buddy tinker --eval 'seed()' # evaluate, exit, print nothing
56
56
  buddy tinker --project ../other-app # run in another project directory
57
57
  buddy tinker --bare # plain Bun session, app not booted
58
58
  buddy tinker --serve # frame protocol on stdio, for tools
@@ -77,7 +77,8 @@ evaluates it at global scope:
77
77
  - several statements work, and the last expression is the result;
78
78
  - `const`, `let`, functions, classes and imports persist to the next call, and
79
79
  a name can be declared again;
80
- - top-level `await` works;
80
+ - a query needs no `await` at the top level (see "No await at the top level");
81
+ top-level `await` still works;
81
82
  - a relative `import('./x')` resolves against the session's directory;
82
83
  - nothing is written to the project.
83
84
 
@@ -91,6 +92,51 @@ Map, Set, class names, cycles and errors, and records every cut.
91
92
  `dump(value)` emits a frame. `dd(value)` dumps and stops the current run; it
92
93
  does not exit the process.
93
94
 
95
+ ## No await at the top level
96
+
97
+ Outside a function, a snippet reads as if it ran in order. Both of these bind
98
+ the row, and the line after can use it:
99
+
100
+ ```ts
101
+ const user = await User.where('email', 'like', '%@example.com').orderByDesc('created_at').first()
102
+ const user = User.where('email', 'like', '%@example.com').orderByDesc('created_at').first()
103
+
104
+ user.email // the email, not undefined
105
+ User.first().email // mid-expression too
106
+ if (User.where('active', true).exists()) dump(User.count())
107
+ for (const post of Post.latest().limit(5).get()) dump(post.title)
108
+ ```
109
+
110
+ The rule: outside a function, a call that returns a promise is waited for
111
+ where it stands, and so is a promise a statement names (the value of a line,
112
+ of a declaration, of an assignment). A rejection is thrown there, so
113
+ `User.findOrFail(0)` fails the run it was written in.
114
+
115
+ - **Inside a function nothing changes.** `await` there is yours to write:
116
+ `users.map(async user => await user.posts())`.
117
+ - **Promise-handling code keeps its promise:** the receiver of `.then()`,
118
+ `.catch()` or `.finally()`, the arguments of `Promise.all()` and its
119
+ siblings (so they still run together), the operand of `void` (fire and
120
+ forget), and anything already under `await`.
121
+ - **Only a real `Promise` is waited for.** A query builder is not, so
122
+ `const query = User.where('active', true)` keeps the builder and
123
+ `query.count()` and `query.first()` both work.
124
+ - **A snippet with no promise in it is untouched at runtime:** same order,
125
+ same turn. Only a promise causes a wait.
126
+
127
+ `createTinkerSession({ settle: false })` turns it off for a session,
128
+ `session.evaluate(code, { settle: false })` and the request field
129
+ `"settle": false` for one run. A promise is then a promise, as in plain
130
+ JavaScript.
131
+
132
+ The transform is `settleTopLevel(code)`. It reads the snippet with a real
133
+ TypeScript parser and only inserts text, so no line moves; code it cannot
134
+ parse comes back untouched for the runtime to report. An editor that wants
135
+ the same answer from the type checker (`user` typed as the row, not as a
136
+ promise) checks `settleTopLevel(code, { wrap: SETTLE_TYPE_WRAP })` with
137
+ `SETTLE_TYPE_AMBIENT` in scope and maps positions with `settledOffset` and
138
+ `originalOffset`.
139
+
94
140
  ## The frame protocol (`--serve`)
95
141
 
96
142
  One JSON request per line on stdin: `{ "op": "eval", "id": "a", "code": "..." }`,
@@ -107,9 +153,9 @@ A comment that starts with a question mark shows a value where it is computed.
107
153
  The run's result is unchanged, and no line moves.
108
154
 
109
155
  ```ts
110
- const users = await User.all() //? the value of users
156
+ const users = User.all() //? the value of users
111
157
  users.filter(u => u.active)/*?.length*/.map(u => u.name) //?
112
- await rebuildIndex() //?. ms since the run began
158
+ rebuildIndex() //?. ms since the run began
113
159
  ```
114
160
 
115
161
  - `//?` at the end of a line: the statement that ends there. A declaration
@@ -141,6 +187,9 @@ what a relation graph and a completion list are built from.
141
187
  ## Gotchas
142
188
 
143
189
  - **The database is real.** Mutations are not isolated or rolled back.
190
+ - **A promise held on purpose needs a function or `void`.** At the top level
191
+ `const job = startJob()` waits for the job. `void startJob()` does not, and
192
+ neither does anything inside a function.
144
193
  - **A model is described as a model.** A result that is a model instance is a
145
194
  `model` node: its name, table, key, the attributes its `toJSON()` exposes, the
146
195
  relations it declares and the ones already loaded. Hidden attributes (a
@@ -158,5 +207,5 @@ what a relation graph and a completion list are built from.
158
207
  - `tinkerEval` and `tinkerPrint` resolve with an exit code, not the value. Use
159
208
  a session when the value is wanted.
160
209
 
161
- Source: `storage/framework/core/tinker/src/{index,session,serialize,protocol}.ts`
162
- and `core/repl/src/index.ts`. Tests: `core/tinker/tests/session.test.ts`.
210
+ Source: `storage/framework/core/tinker/src/{index,session,settle,magic,serialize,protocol}.ts`
211
+ and `core/repl/src/index.ts`. Tests: `core/tinker/tests/{session,settle,magic}.test.ts`.
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.559",
5
+ "version": "0.75.561",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.559",
5
+ "version": "0.75.561",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,10 +45,10 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/mobile": "0.75.559",
48
+ "@stacksjs/mobile": "0.75.561",
49
49
  "@stacksjs/sanitizer": "^0.2.864",
50
50
  "@stacksjs/stx": "^0.2.864",
51
- "@stacksjs/strings": "0.75.559",
51
+ "@stacksjs/strings": "0.75.561",
52
52
  "@xterm/addon-fit": "^0.11.0",
53
53
  "@xterm/xterm": "^6.0.0",
54
54
  "ts-qr-codes": "^0.1.8"