Repository navigation
Map framings and codecs through the request's encodings (core#120 B4) - #92
Merged
Merged
Conversation
framing_choice and the package's codec read GenerateRequest.encodings instead of a name-to-class table, and generate_typescript refuses an encoding the package uses with no mapping (encodings::check) instead of assuming a known framing. A mapped class from @comline/runtime goes in the runtime import as before, so the official output is unchanged; one from any other package gets an import of its own. lib mode adds each mapped package a file imports from to package.json, beside the runtime and std. runtime/test/generated/acme.ts is a protocol over a third-party framing and codec, type-checked (with the TypeScript 5.0 floor too) against a stub of their package, acme-encodings.ts. Pins generation b116831 (encodings::resolve/check/official_for).
Closed
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step B4 of core#120 for TypeScript.
framing_choiceand the package codec now readGenerateRequest.encodings. Theframing_for/codec_class/default_codectables are gone.generate_typescriptcallscomline_codegen::encodings::checkfirst: an unmapped used encoding is an error, never assumed known. MessagePack still hits the support table's refusal first.@comline/runtimegoes in the runtime import, in the same order as before, so the official output is byte-identical. A class from another package getsimport { A, B } from "<package>";after it. A mapping with no package imports nothing (the class is in scope already).lib: each mapped package a file imports from is added topackage.jsondependencies (its version, or"*"), beside the runtime and std.Connection/Client.checkstill requirescomline@1to be mapped.Tests
a_third_party_framing_and_codec_are_imported_from_their_packagekeepsruntime/test/generated/acme.ts, a protocol overcom.acme.lines@1andcom.acme.cbor@1mapped ontoacme-encodings.typecheck,typecheck:generatedand the TypeScript 5.0.4 floor check it against a stub of that package,runtime/test/generated/acme-encodings.ts, mapped throughpaths.an_unmapped_framing_is_an_error_not_a_fallbackandlib_output_depends_on_a_mapped_package.cargo test,xtask --check(std-extra unchanged),npm run typecheck,npm test,typecheck:generatedand the 5.0.4 floor.Pins generation
b116831from ComlineProject/generation#88. Merge after that PR.