Skip to main content

Elements

Output

The build artifact management layer for Land that compiles VS Code platform source through a dual-compiler pipeline (ESBuild primary, Rest OXC optional), produces the @codeeditorland/output npm package, and is consumed by Cocoon, Sky, and Wind.

Output is the build orchestration layer for Land’s TypeScript assets. It wraps ESBuild with Land-specific transforms, plugin hooks, and polyfill injection, and supports an optional Rest (OXC-based) compiler pipeline for faster TypeScript compilation. The result is published as the @codeeditorland/output npm package consumed by Cocoon (extension host), Sky (UI layer), and Wind (service layer).

Architecture

Mermaid diagram ### Module Map
PathPurpose
Source/ESBuild/Output.tsPrimary ESBuild compilation pipeline
Source/ESBuild/Rest/Rest OXC compiler plugin integration
Source/ESBuild/Microsoft/VS Code source-specific compilation config
Source/ESBuild/CodeEditorLand/Land-specific compilation config
Source/ESBuild/Exclude/Exclude patterns for compilation
Source/Plugin/Apply.tsESBuild plugin for applying transforms
Source/Plugin/Copy/Asset copying plugin
Source/Plugin/Transform/Code transform plugins
Source/Plugin/Polyfill/Polyfill injection plugins
Source/Plugin/Index.tsPlugin registry
Source/Polyfill/Child/Child process polyfills
Source/Polyfill/File/File system polyfills
Source/Polyfill/IPC/IPC polyfills
Source/Polyfill/Native/Native module polyfills
Source/Polyfill/Process/Process polyfills
Source/Polyfill/Shared/Shared polyfill utilities
Source/Service/CEL/Code Editor Land specific services
Source/Service/Dev/Development-time services
Source/Service/Tauri/Tauri-specific services
Source/Asset/Style/CSS asset management
Source/Apply/Pipeline.tsApply pipeline orchestration

Compiler Modes

Output supports two compiler backends.

Default: ESBuild

Mermaid diagram ### Optional: Rest OXC

Activated via Compiler=Rest environment variable:

Mermaid diagram ### Integration
// Output/ESBuild/Output.ts
const compiler =
	process.env.Compiler === "Rest" ? await import("./Rest/RestPlugin") : null;

const plugins = [];
if (compiler) {
	plugins.push(compiler.createPlugin());
}
// Standard ESBuild build with optional Rest plugin

Build Pipeline

The Output build pipeline processes VS Code platform code:

1. Input discovery
   - Reads from Dependency/Editor/out/ (Stage 1 compiled VS Code)
   - Identifies entry points (workbench, extHost files)

2. Module resolution
   - Remaps electron imports to Tauri stubs
   - Remaps Node.js built-in modules to polyfills
   - Resolves Land-specific module paths

3. Transform application
   - Polyfill injection (see below)
   - Source map chaining
   - Platform code markers (CEL:platform)

4. Bundle compilation
   - ESBuild compiles to single or multiple output files
   - Source maps generated for debugging

5. Output packaging
   - Produces @codeeditorland/output package
   - Versioned and cached in Output/Target/

Plugin System

Output defines a plugin interface for extending the build pipeline:

export interface OutputPlugin {
	name: string;
	setup(build: ESBuild.PluginBuild): void;
}

Built-in Plugins

PluginPurpose
Apply.tsApplies Land-specific code transforms
Copy.tsCopies static assets to output directory
Transform.tsTypeScript-to-JavaScript transformation config
Polyfill/Index.tsPolyfill injection orchestration
RestPlugin.tsRest OXC compiler integration (optional)

Polyfill Injection

Output injects polyfills during compilation for APIs that don’t exist in the Tauri WebView:

PolyfillTargetReplaces
Child/child_process moduleNo-op stubs
File/fs moduleTauri invoke wrappers
IPC/ipcRendererTauri event system
Native/Native Node modulesNo-op stubs
Process/process globalWind Preload shim integration
Shared/Shared polyfill utilitiesShared initialization
  • Polyfills are injected via ESBuild’s inject configuration
  • Prepends the polyfill modules to output bundles

Output Layout

After compilation, Output produces the following structure:

Output/Target/
+-- @codeeditorland/output/
    +-- index.js                    # Main entry point
    +-- workbench/                  # VS Code workbench bundle
    |   +-- workbench.js
    |   +-- workbench.css
    +-- extHost/                    # Extension host bootstrap
    |   +-- extHost.js
    +-- vs/                         # VS Code platform code
    |   +-- base/
    |   +-- platform/
    |   +-- workbench/
    +-- polyfills/                  # Injected polyfill modules
    +-- sourcemaps/                 # Source maps
    +-- package.json                # npm package manifest
  • Cocoon - Extension host (Output consumer)
  • Sky - UI layer (Output consumer)
  • Wind - Service layer (Output consumer)
  • Rest - OXC compiler (optional Output backend)
  • BuildPipeline - Build pipeline
  • Polyfills - Full polyfill documentation

Project Maintainers: Source Open (Source/Open@Editor.Land) | GitHub Repository | Report an Issue


See Also