Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions .dagger/modules/packager/main.dang
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ type Packager {
with the TypeScript compiler left external, plus the rolled-up type
declarations for it.

The install resolves through the vendored yarn.lock, which is load-bearing:
letting it resolve freely instead pulls newer transitive versions and grows
core.js by roughly a quarter (4.3 MB -> 5.4 MB).
The install is frozen against the committed bun.lock. Both lockfiles matter and
neither is redundant: yarn.lock is what the vendored sources came with, and
dropping it lets resolution pull newer transitives that grow core.js by roughly
a quarter (4.3 MB -> 5.4 MB); but it is a yarn v1 file that does not pin
everything bun resolves, so without bun.lock a rebuild days later can still
drift — observed as a bundle quietly gaining transitive modules on an unchanged
tree. Freezing makes that drift a failed install instead of a silent diff.
"""
libraryBundle(ws: Workspace!): Changeset! @generate {
let built = bun
.withDirectory("/src", ws.directory("/" + libraryPath))
.withWorkdir("/src")
.withExec(["bun", "install"])
.withExec(["bun", "install", "--frozen-lockfile"])
.withExec(["bun", "build", "./src/index.ts", "--external=typescript", "--target=node", "--outfile", "/out/core.js"])
.withExec(["tsc", "--emitDeclarationOnly"])
.withExec(["bun", "x", "rollup", "-c", "rollup.dts.config.mjs", "-o", "/out/core.d.ts"])
Expand Down Expand Up @@ -104,6 +108,31 @@ type Packager {
.withExec(["bun", "install", "-g", "typescript"])
}

"""
Run the vendored library's own test suite.

Mostly the introspector's: it scans the fixture modules under testdata and
compares the result against a recorded expectation. That is the contract
entrypoint generation is built on — the scanner's output is what the
dispatcher is rendered from — and nothing else here would notice it drifting,
since our own golden pins the renderer given a typedef, not the typedef given
a module.

The specs that need a live session (invoke, registry, api, connect) are not
vendored: they would need an engine inside this container, and what they cover
is the library's runtime rather than anything this SDK generates.
"""
libraryTests(ws: Workspace!): Void @check {
bun
.withDirectory("/src", ws.directory("/" + libraryPath))
.withWorkdir("/src")
.withExec(["bun", "install"])
.withExec(["bun", "run", "--bun", "mocha"])
.sync

null
}

"""
Container with the codegen helper compiled and on PATH at
/usr/local/bin/codegen. Read from the workspace rather than this module's own
Expand Down
6 changes: 6 additions & 0 deletions library/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extension": ["ts"],
"spec": "**/*.spec.ts",
"loader": "ts-node/esm",
"timeout": 60000
}
582 changes: 582 additions & 0 deletions library/bun.lock

Large diffs are not rendered by default.

125 changes: 123 additions & 2 deletions library/bundle/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 123 additions & 2 deletions library/bundle/introspector.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,22 @@
"typescript": "^6.0.3"
},
"resolutions": {
"@grpc/grpc-js": "1.14.4",
"**/@grpc/proto-loader/protobufjs": "7.6.1",
"**/@opentelemetry/otlp-transformer/protobufjs": "8.4.1",
"**/glob/minimatch": "9.0.9",
"form-data": "4.0.6"
"@grpc/grpc-js": "1.14.4",
"form-data": "4.0.6",
"mocha/minimatch": "9.0.9",
"mocha/serialize-javascript": "7.0.3"
},
"devDependencies": {
"@types/adm-zip": "^0.5.8",
"@types/mocha": "^10.0.10",
"@types/node": "~26.0.1",
"@types/tar": "^7.0.87",
"mocha": "^11.7.6",
"rollup": "^4.62.2",
"rollup-plugin-dts": "^6.4.1"
"rollup-plugin-dts": "^6.4.1",
"ts-node": "^10.9.2"
}
}
Loading