Repository navigation
Conversation
…bals Two apps in one process shared the single process-wide engine state. Gather the persistent state into values that can be exchanged with the live globals: - css::engine_state::CssState holds the prefix, debug flag, atom hoist threshold and plan, slot reservation, class map, file map, canonical map, file routes, custom shorthands, theme tokens and Tailwind definitions. css::test_state::TestStateGuard is now built on it. - extractor::ExtractorCaches holds the vanilla-extract imported runs and stripped TypeScript of the calling thread. - devup_ui_binding_core::session keeps session 0 live from the start and parks every other session's EngineState (CSS state + stylesheet). select_session swaps a parked state with the live globals, with_session runs a closure under the session lock and swaps back, also on unwind. Extractor caches are parked per thread and aligned on every switch, since they hold Rc values and session file numbers. - PerSession<T> keys host values by the live session; the WASM and native module resolvers use it. Existing call sites read the globals unchanged; until a host creates a session the engine behaves as before. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the engine session calls to the WASM and native engines: - createSession() returns the id of a new session with a clean state - selectSession(id) makes it live; every later call works on its state - dropSession(id) drops it with its module resolver, returning whether it existed; dropping the live session makes session 0 live The shared argument boundary checks the id as an unsigned 32-bit integer before engine entry. The ABI grows from 29 to 32 names: the WASM glue check, the native adapter and typings, the e2e ABI list, the validation positions (47 in 20 functions, 283 invalid-input cases) and a parity corpus scenario follow it. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hape Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
openCompilerSession(compiler) creates an engine session on a shared
compiler and returns { id, compiler, close }. Every function read from
the scoped compiler selects the session before it runs; the calls are
synchronous and JavaScript is single-threaded, so no other session's
call can run between the selection and the call. close() drops the
session, after which calls through the scoped compiler throw.
Refs #686
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Keep main's check_resolved_path/resolved_module re-exports beside the session re-exports in libs/binding. removeFile (#951) only touches the file map, canonical map, class map and global sheet, which CssState and EngineState already swap per session; a new session test pins that forgetting a file in one session leaves another session's styles alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main through #963, including removeFile (#951). The ABI now holds 33 names: main's 30 plus createSession, selectSession and dropSession. Updated script.js, the native typings and README, the e2e ABI list and consumer, and compiler-types (32 without Output). Validation covers 48 positions in 21 functions (288 cases), and the summary reports 21 functions. The corpus keeps both new scenarios and adds remove-file-stays-in-its-session, which checks that removeFile only forgets the file in the live session (28 scenarios). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No conflicts. openCompilerSession wraps every compiler function in a Proxy that selects the session first, so removeFile from main (#951) runs on the scoped session like every other call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
extractor/lib.rs keeps both this branch's ExtractorCaches export and main's vanilla_extract_theme_import_tests module. Main added no binding exports since the last merge, so the counts stay: 33 ABI names, 21 validated functions with 48 positions and 288 cases, and 28 parity scenarios. #967's serialization cache needs no session state: a session switch swaps the sheet through a tracked mutable borrow, which forgets the cached serializations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up #990, which fixes main's hook-order and WASM ABI count tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
NXT-07 step 3: adds a session wrapper
openCompilerSession(compiler)to plugin-utils.{ id, compiler, close }.compileris a Proxy wrapping the original. Reading a function returns a wrapper that first callsselectSession(id)and then runs the original function.a.getCss === a.getCss).close()discards the session. Calls through the scoped compiler after that make the engine throw anengine session N does not existerror.index.tsexportsopenCompilerSessionand theCompilerSessiontype.Test plan
bun test packages/plugin-utils/src/__tests__/compiler-session.test.ts --coverage: 3 pass with the real WASM pkg,compiler-session.ts100% coveragebunx tsc --noEmit(plugin-utils)bunx prettier --single-quote --no-semi --check요약
NXT-07 3단계: plugin-utils에 세션 래퍼
openCompilerSession(compiler)를 추가합니다.{ id, compiler, close }를 돌려줍니다.compiler는 원본을 감싼 Proxy입니다. 함수를 읽으면selectSession(id)를 먼저 부른 뒤 원래 함수를 실행하는 wrapper를 돌려줍니다.a.getCss === a.getCss).close()는 세션을 버립니다. 그 뒤에 scoped compiler로 호출하면 엔진이engine session N does not exist오류를 던집니다.index.ts에서openCompilerSession과CompilerSession타입을 export합니다.테스트 계획
bun test packages/plugin-utils/src/__tests__/compiler-session.test.ts --coverage: 실제 WASM pkg로 3개 통과,compiler-session.ts100% 커버리지bunx tsc --noEmit(plugin-utils)bunx prettier --single-quote --no-semi --checkRefs #686
🤖 Generated with Claude Code