Skip to main content

Crate bonsai_lang_javascript

Crate bonsai_lang_javascript 

Source
Expand description

JavaScript language adapter.

Structs§

JavaScriptAdapter

Constants§

JS_TS_MODULE_RESOLUTION_EXTENSIONS
LANG_ID

Functions§

apply_ecmascript_assigned_member_callable_owners
Model classic ECMAScript object/prototype methods from their assignment syntax.
apply_javascript_getter_property_sources
apply_js_ts_commonjs_named_export_aliases
Surface JS/TS named exports under their public export member name when it differs from the local implementation name:
apply_js_ts_default_export_aliases
Surface ECMAScript export default and CommonJS module.exports = function ... as an additional callable/type binding named default in the exporting module. The original declaration remains indexed by its real local name, so same-file references still resolve while default imports / callable CommonJS requires can target the language-level export name.
ecmascript_static_subscript_key
extract_ecmascript_pseudo_call
Lower JSX/TSX opening elements to their component-call semantics. The concrete grammar vocabulary lives here and is shared only with the TypeScript adapter, which uses the same ECMAScript frontend shapes.
js_ts_imports
Shared ES-module import parser used by both the JavaScript and TypeScript adapters. Handles: import x from "y" — default import import { a, b as c } from "z" — named imports + alias import * as ns from "n" — namespace import
js_ts_module_segments
Split a workspace-relative JS/TS path into module-identity segments. The trailing source extension is stripped so src/utils/log.ts becomes ["src", "utils", "log"]. Skips path roots and parent (..) components.
js_ts_require_calls
populate_ecmascript_compiler_facts
Attach ECMAScript-specific syntax meaning to the language-neutral compiler IR. TypeScript deliberately reuses this lowering because its expression grammar extends ECMAScript; downstream engines see only typed boolean relations and exact decoded literal values.