render-workflows-dart 0.8.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/LICENSE +21 -0
  3. package/README.md +678 -0
  4. package/dart/generator/bin/generate.dart +419 -0
  5. package/dart/generator/pubspec.lock +149 -0
  6. package/dart/generator/pubspec.yaml +9 -0
  7. package/examples/README.md +56 -0
  8. package/examples/default/README.md +18 -0
  9. package/examples/default/gitignore +7 -0
  10. package/examples/default/index.js +2 -0
  11. package/examples/default/package.json +17 -0
  12. package/examples/default/pubspec.yaml +7 -0
  13. package/examples/default/tasks.dart +39 -0
  14. package/examples/http/README.md +26 -0
  15. package/examples/http/gitignore +7 -0
  16. package/examples/http/index.js +2 -0
  17. package/examples/http/package.json +18 -0
  18. package/examples/http/pubspec.yaml +13 -0
  19. package/examples/http/tasks.dart +100 -0
  20. package/examples/introspect/README.md +50 -0
  21. package/examples/introspect/gitignore +7 -0
  22. package/examples/introspect/index.js +2 -0
  23. package/examples/introspect/node_env.dart +35 -0
  24. package/examples/introspect/package.json +18 -0
  25. package/examples/introspect/pubspec.yaml +23 -0
  26. package/examples/introspect/tasks.dart +144 -0
  27. package/examples/native/README.md +32 -0
  28. package/examples/native/gitignore +7 -0
  29. package/examples/native/index.js +2 -0
  30. package/examples/native/native/tools_impl.dart +105 -0
  31. package/examples/native/package.json +23 -0
  32. package/examples/native/pubspec.yaml +7 -0
  33. package/examples/native/tasks.dart +35 -0
  34. package/examples/postgres/README.md +73 -0
  35. package/examples/postgres/gitignore +7 -0
  36. package/examples/postgres/index.js +2 -0
  37. package/examples/postgres/native/db_impl.dart +205 -0
  38. package/examples/postgres/package.json +26 -0
  39. package/examples/postgres/pubspec.yaml +14 -0
  40. package/examples/postgres/seed/bin/seed.dart +56 -0
  41. package/examples/postgres/seed/bin/show.dart +64 -0
  42. package/examples/postgres/seed/lib/src/connect.dart +93 -0
  43. package/examples/postgres/seed/lib/src/schema.dart +46 -0
  44. package/examples/postgres/seed/pubspec.yaml +17 -0
  45. package/examples/postgres/tasks.dart +66 -0
  46. package/package.json +51 -0
  47. package/runtime/AGENTS.md +141 -0
  48. package/runtime/CLAUDE.md +2 -0
  49. package/runtime/native_task.dart +115 -0
  50. package/runtime/render_dart.dart +428 -0
  51. package/src/cli.js +396 -0
  52. package/src/native-worker.js +196 -0
  53. package/src/node-bridge.js +118 -0
  54. package/src/runtime.js +108 -0
  55. package/src/toolchain/compile.js +153 -0
  56. package/src/toolchain/dart-sdk.js +216 -0
  57. package/src/toolchain/dart-version.js +113 -0
  58. package/src/toolchain/generate.js +112 -0
  59. package/src/toolchain/index.js +8 -0
  60. package/src/toolchain/native.js +217 -0
  61. package/src/web-shims.js +281 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,193 @@
1
+ # Changelog
2
+
3
+ ## 0.8.2
4
+
5
+ **Renamed to `render-workflows-dart`.** `render-dart` said neither which Render
6
+ nor that this is about Workflows, and it reads like a Dart rendering library.
7
+ The name now leads with the product, so a sibling for another language sits
8
+ beside it in a registry listing rather than somewhere else in the alphabet —
9
+ `render-workflows-rust` is the first of those.
10
+
11
+ Nothing else changed.
12
+
13
+ - **`render-dart` still works as a command.** The package installs two bins, so
14
+ an existing project's `"build": "render-dart build"` keeps running untouched.
15
+ Only the dependency name and the `npx` line move.
16
+ - **`npx render-workflows-dart init`** for a new project: npx resolves a package
17
+ name, so first contact needs the full one.
18
+ - **`init` removes the old dependency key** rather than adding a second one
19
+ beside it.
20
+ - The old package is deprecated on npm with a pointer here. It stays
21
+ installable; nothing breaks the day this ships.
22
+
23
+ Migrating an existing project is one line:
24
+
25
+ ```diff
26
+ - "render-dart": "^0.8.1"
27
+ + "render-workflows-dart": "^0.8.2"
28
+ ```
29
+
30
+ Also fixed: the recovery hint printed when a bridge file is missing pointed at
31
+ `node_modules/render-dart/template/`, a directory that has not existed for
32
+ several releases. The files ship in `runtime/`.
33
+
34
+ ## 0.8.1
35
+
36
+ - **The built-in default is Dart 3.13.1**, was 3.13.0. It is the version an
37
+ unpinned project gets when no Dart is on `PATH` — which in practice means
38
+ every Render build — so it should not trail stable by a release.
39
+
40
+ This cannot disturb anything already deployed. A default is not an explicit
41
+ request, and an unexplicit request reuses whatever SDK is vendored whichever
42
+ version that is; only a build with no vendored SDK fetches the new one. A
43
+ service that wants a specific version should pin it, which since 0.8.0 works.
44
+
45
+ ## 0.8.0
46
+ **The Dart version pin now pins.** `renderDart.dartVersion` existed before and
47
+ was consulted only on the download path, so it worked on a first Render build
48
+ and was silently ignored everywhere else: on a laptop the Dart on `PATH` always
49
+ won, and on later Render builds whatever had been vendored first won for ever,
50
+ because the cache key was "does the directory exist". Setting it appeared to do
51
+ nothing, which is exactly what it did.
52
+
53
+ A version asked for explicitly is now honoured wherever the build runs: if
54
+ `PATH` holds a different one, the requested version is downloaded. The built-in
55
+ default still defers to a local toolchain — it exists so a first build has
56
+ something to fetch, not to override a Dart you installed on purpose.
57
+
58
+ - **Three places to set it**, highest first: `--dart-version`,
59
+ `RENDER_DART_VERSION`, `renderDart.dartVersion`.
60
+ - **`latest` and channel names** — `stable`, `beta`, `dev` — as well as exact
61
+ versions. An exact version is interpreted without touching the network, so a
62
+ pinned project still builds when the archive is unreachable.
63
+ - **`render-dart dart`** reports which Dart the project will use and where it
64
+ comes from; **`--list`** shows what the archive offers, 176 stable releases
65
+ today.
66
+ - **The vendored SDK records its version** and is replaced when the pin changes.
67
+ - **Every build says which Dart it used**, and whether it came from `PATH`, the
68
+ vendored copy, or a download. That alone answers the question that prompted
69
+ all of this.
70
+ - **Downloads are verified** against the archive's published SHA-256 before
71
+ being unpacked, hashed while streaming so it costs no extra I/O — 0.18s of CPU
72
+ for a 228 MB archive against roughly 30s to fetch it.
73
+
74
+ Two smaller fixes, both found while documenting the above:
75
+
76
+ - **`render-dart --help` exits 0.** It fell into the unknown-command branch and
77
+ exited 1, so a script running it defensively saw a failure.
78
+ - **`--help` documents the precedence**, and a test asserts the order it prints
79
+ matches the resolver's. The help text is one long template literal that no
80
+ test had ever parsed — a stray backtick in it turned every command into a
81
+ `SyntaxError` while the whole suite still passed.
82
+
83
+ ## 0.7.1
84
+
85
+ - Fixes a dead link on the package page. The Postgres example pointed at
86
+ `github.com/timmaffett/render_dart_workflow_test`, which is private and not
87
+ where that example lives; it is `examples/postgres` in this repo, and also
88
+ what `init --template postgres` scaffolds.
89
+ - Documents `--template` in the Commands table, and `allowDartIoIn` in the
90
+ configuration section — both shipped in 0.7.0 without being written down.
91
+ - The Layout section described `template/`, which 0.7.0 removed. It now lists
92
+ `examples/` and `runtime/`.
93
+
94
+ ## 0.7.0
95
+
96
+ **Examples are the templates.** `examples/` holds five complete, runnable
97
+ services, and `init` scaffolds from them:
98
+
99
+ ```bash
100
+ npx render-dart init my-app --template postgres
101
+ ```
102
+
103
+ `default`, `http`, `native`, `postgres` and `introspect`. Making them the same
104
+ thing means a template that does not work is a test failure rather than a
105
+ surprise — there is no second copy to drift.
106
+
107
+ **Scaffolds carry agent guidance.** `init` writes `AGENTS.md` and a `CLAUDE.md`
108
+ pointing at it into the project it creates. Coding agents never read
109
+ `node_modules`, so nothing shipped inside this package reaches an agent helping
110
+ in your project; the scaffold is the only place that text is certain to be
111
+ seen.
112
+
113
+ **`renderDart.allowDartIoIn`** exempts named directories from the `dart:io`
114
+ guard. A local tool sitting beside a workflow — a database seeder, say — is a
115
+ normal shape, and previously the only escape was `allowDartIo: true`, which
116
+ switched the check off for task code too.
117
+
118
+ - `template/` is gone. The two Dart bridge files live in `runtime/`, and the
119
+ examples carry no copies — `build` writes them when missing, which is also
120
+ how they stay current on upgrade.
121
+ - README documents native tasks against WebAssembly as two routes past dart2js,
122
+ with measurements: V8 matches Dart AOT on integer work, so native is for
123
+ capability and parallelism rather than raw speed.
124
+
125
+ ## 0.6.0
126
+
127
+ Nothing at a call site needs to know a task is native.
128
+
129
+ - `@NativeTask(worker: true, idleTimeout: …, timeout: …)` — settings ride with
130
+ the declaration; `renderDart.native` can still override per entry.
131
+ - A generated facade conditionally exports the implementation or the
132
+ process-spawning stub, so `import 'native/tools.dart'` compiles to a direct
133
+ call natively and a process call under dart2js. The same source works both
134
+ ways, which also makes native code unit-testable on the VM.
135
+ - `NativeCall.scope(worker: false, …)` varies settings for one caller without
136
+ changing any signature.
137
+ - Implementations are named `<name>_impl.dart` so the facade can take the plain
138
+ name; an entry that would be clobbered by its own facade is refused.
139
+
140
+ ## 0.5.0
141
+
142
+ Native tasks, and worker mode.
143
+
144
+ - Declare Dart files in `renderDart.native`, annotate top-level functions with
145
+ `@nativeTask`, and call them from task code. That reaches `dart:io`,
146
+ `dart:ffi`, isolates and packages with no web build — `postgres` among them.
147
+ - JSONL over stdin/stdout, every message carrying an id. `print()` on the
148
+ native side becomes a `$log` line rather than corrupting the framing, and a
149
+ native `throw` arrives as a `NativeTaskException` with its real message.
150
+ - `worker: true` keeps the executable alive between calls: 10 ms across 20
151
+ calls against 132 ms spawning each time, measured on Render.
152
+ - Nothing is cross-compiled and no binary is committed — the vendored SDK
153
+ carries `gen_snapshot`, and Render's build host is already linux/x64.
154
+
155
+ ## 0.4.1
156
+
157
+ `init` writes `^${version}` from its own package.json.
158
+
159
+ The template carried a hardcoded `^0.1.0`, which npm reads as `<0.2.0` — so
160
+ every project scaffolded since 0.2.0 silently installed 0.1.1, without wasm
161
+ support, asset resolution or the node bridge. Local tarballs and explicit
162
+ `render-dart@x.y.z` installs all hid it.
163
+
164
+ ## 0.4.0
165
+
166
+ Tasks can reach npm packages and subprocesses.
167
+
168
+ - `requireModule(id)` — dart2js output is CommonJS, so `require` is
169
+ module-scoped and never reaches `globalThis`. The runtime hoists one, rooted
170
+ at the project directory.
171
+ - `runProcess(command, …)` — `dart:io`'s `Process` compiles under dart2js and
172
+ then throws. A non-zero exit is returned rather than thrown.
173
+
174
+ ## 0.3.0
175
+
176
+ Packages that carry their own JS wasm runtime work, `rust_crypto` through
177
+ `wasm_run` among them. Its setup looks browser-only but skips DOM injection
178
+ when the globals are already present, which the runtime seeds.
179
+
180
+ ## 0.2.0
181
+
182
+ Packages that load `.wasm` modules work. Dart's web asset convention
183
+ (`packages/<name>/…`) is resolved from `.dart_tool/package_config.json`, so
184
+ forge2d's bundled Box2D build needs no configuration.
185
+
186
+ ## 0.1.1
187
+
188
+ Export `./package.json`.
189
+
190
+ ## 0.1.0
191
+
192
+ Initial release: write Render Workflows tasks in Dart, compiled to JavaScript
193
+ and registered through Render's `@renderinc/sdk`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tim Maffett
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.