OneScript

Technical Details

A few technical notes to help you use OneScript more effectively.

Runtime

Scripts run in the system WebView, with a Node.js compatibility layer. See Node.js Compatibility for supported APIs, limitations, and per-module notes.

Each run creates an isolated WebView virtual machine. Projects are bundled by esbuild, then executed by the runtime:

ComponentRole
WebViewRun user scripts
esbuildBundle the project to JavaScript
pnpmDependency management

Build

Embedded esbuild bundles the project to ESM JavaScript (dist/index.js), which WebView then executes. Node.js builtins are mapped to the compatibility layer. TypeScript, JSX, and static assets such as images, fonts, and Wasm are supported.

Runtime-computed import() cannot be bundled and will fail the build.

pnpm

When installing, adding, or removing dependencies, OneScript runs embedded pnpm with these options:

OptionMeaningReason
--config.ignore-scripts=trueDo not run package lifecycle scripts (such as preinstall / postinstall)iOS does not allow spawning child processes; pnpm lifecycle scripts rely on child_process and cannot run
--config.ignore-pnpmfile=trueDo not run .pnpmfile.cjsIt can also execute arbitrary scripts or spawn child processes
--config.node-linker=isolatedUse pnpm's isolated node_modules layoutAvoids phantom dependencies from a flattened install
--config.package-import-method=hardlinkImport package contents via hard linksFits the app sandbox filesystem

Also: git dependencies are unavailable; native modules (.node / binding.gyp) are unavailable; packages that depend on lifecycle scripts, native executables, or package CLI bins cannot run inside the app.

How is this guide?

Last updated on

On this page