Javascript
mountaineer.js_compiler.javascript.JavascriptBundler
JavascriptBundler(
root_element="root",
environment="development",
tmp_dir=None,
)
Bases: ClientBuilderBase
Compile the client-written tsx/jsx to raw javascript files for execution as part of the SSR pipeline and client hydration.
global_state
instance-attribute
global_state = None
pending_files
instance-attribute
pending_files = []
init_state
async
init_state(global_state)
process_pending_files
process_pending_files(input_queue, output_queue)
start_build
async
start_build()
handle_file
async
handle_file(file_path, controller, metadata)
finish_build
async
finish_build()
generate_js_bundle
generate_js_bundle(file_path, controller, metadata)
build_synthetic_client_page
build_synthetic_client_page(
synthetic_imports,
synthetic_endpoint,
synthetic_endpoint_name,
)
build_synthetic_ssr_page
build_synthetic_ssr_page(
synthetic_imports,
synthetic_endpoint,
synthetic_endpoint_name,
)
build_metadata_archive
build_metadata_archive(*, page_path, controller)
build_synthetic_endpoint
build_synthetic_endpoint(
*, page_path, layout_paths, output_path
)
Following the Next.js syntax, layouts wrap individual pages in a top-down order. Here we
create a synthetic page that wraps the actual page in the correct order.
The output is a valid React file that acts as the page entrypoint
for the rootElement
ID in the DOM.
link_project_files
link_project_files(*, view_root_path, temp_dir_path)
Javascript packages define a variety of build metadata in the root directory of the project (tsconfig.json, package.json, etc). Since we're running our esbuild pipeline in a temporary directory, we need to copy over the key files. We use a symbolic link to avoid copying the files over.
sniff_for_layouts
sniff_for_layouts(*, page_path, view_root_path)
Given a page.tsx path, find all the layouts that apply to it. Returns the layout paths that are found. Orders them from the top->down as they expect to be rendered.
validate_page
validate_page(*, page_path, view_root_path)