Skip to content

Upstream the patched Vize compiler fixes and remove local source copies #138

Open

Description

@JuroOravec

(Opus 5.5)

Problem

Citry's native Vue compiler currently depends on locally patched copies of vize_atelier_core and vize_s1_to_s2 0.420.0 under third_party/rust/. The copies come from the crates.io archives and retain Vize's MIT license; Citry's patch manifests identify them as 0.420.0+citry.1.

The local patches correct code generation that Citry relies on:

  • quote and escape custom-directive and v-model modifier keys;
  • preserve runtime directive wrappers when a single element is transformed out of <template v-for>;
  • preserve an element's own key instead of losing it when loop or conditional template fragments are transformed;
  • preserve keyed component and slot children inside conditional fragments.

The exact source and test deltas are inventoried in
vize_atelier_core/README.citry.md
and
vize_s1_to_s2/README.citry.md.
The remainder of each directory is the corresponding upstream archive.

These crates are source dependencies. Citry does not publish or deploy them separately: Cargo compiles them into citry_core through citry_vue_compiler.

Goal

Contribute the generally applicable fixes upstream and return Citry to released Vize crates without local source forks.

Upstream work

  • Rebase each Citry regression against current Vize main and the newest compatible release; identify fixes already present upstream.
  • Split the remaining behavior into focused Vize issues or pull requests with minimal reproductions.
  • Submit the modifier-key escaping fixes and regression coverage.
  • Submit the template v-for runtime-directive and keyed-child fixes and regression coverage.
  • Submit the keyed template v-if element/component/slot fixes and regression coverage.
  • Track the upstream release containing every required fix.

Removal work

  • Update citry_vue_compiler to the released upstream crates.
  • Remove the root [patch.crates-io] overrides and local path dependencies.
  • Delete third_party/rust/vize_atelier_core and third_party/rust/vize_s1_to_s2.
  • Remove the copied Vize wheel-license artifact if the released dependency metadata makes it unnecessary, or regenerate it from the final dependency license inventory.
  • Retain Citry-facing regression coverage for the compiler behavior on which prepared Vue rendering depends.
  • Run the native compiler, Python binding, Vue rendering and packaging/license gates.

Acceptance criteria

  • Citry builds against an immutable released Vize version with no local Vize source override.
  • All currently documented Citry patch cases pass against that release.
  • The vendored directories are removed.
  • Provenance and wheel-license output identify the released dependency and
    contain no stale +citry.1 source-fork identity.

Added by #159

#159 updated the local copies (now labelled 0.420.0+citry.2) with three more fixes to send upstream:

  • Read an event handler as a list of statements only when it contains ;, as @vue/compiler-core does, and report any other statement (:title="a; b", {{ a; b }}, v-if="a; b", @click="if (ok) run()") as an invalid expression. Before this, any text that failed to parse as one expression was retried as statements, which produced JavaScript that does not parse, with no error.
  • Write line comments in an event handler as block comments, so a trailing // note cannot hide the closing } of $event => {...} or the , before the next prop.
  • With TypeScript on, keep @click="foo!" and @click="handler as any" as handler references (decide after removing the type syntax), so Vue calls them instead of returning them.

Regression tests for these are in vize_atelier_core/tests/event_handler_statements.rs and vize_s1_to_s2/tests/citry_event_handler_statements.rs.

Known Vize bugs Citry does not hit

Citry compiles without TypeScript and with prefixed identifiers, so these don't affect it, but they are worth reporting upstream:

  • (x as any).run(); y and a!; b() are wrapped twice and lose their _ctx. prefixes.
  • foo! // note with no newline after the comment produces broken output.
  • Without prefixed identifiers, () => run() // note is wrapped as $event => (...), so it never calls run.

Stale upstream tests in the local copies

  • Six upstream tests in the local copies fail: five expect output from before Vendor patched Vize compiler crates #140's patches, and one needs fixture files that exist only in the upstream repository. CI never runs these crates' own tests, which is why nobody noticed. Update or drop them when the copies are next refreshed, or retire them together with the copies.

Event modifier parity

  • (Fixed in Citry's patched copy, 0.420.0+citry.3, Vue migration 4/4: replace the Alpine runtime with Vue #137; still to send upstream) v-on: Vize wraps a static non-keyboard event in withKeys for any modifier it doesn't recognise (@click.foo, @click.enter), so the listener never fires; Vue adds withKeys only for keyup/keydown/keypress or dynamic event names (compiler-dom vOn, isKeyboardEvent). The patch flag differs too (40 vs 8). Citry first needs its @c-*.enter / .escape key matching to stop relying on this behaviour.

  • v-on: Vize drops .native (Vue reads it as a key name), and @click.native still gets NEED_HYDRATION where Vue gives flag 8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions