npm.io
0.13.0 • Published yesterday

@gjsify/rolldown-plugin-gjsify

Licence
MIT
Version
0.13.0
Deps
10
Size
231 kB
Vulns
0
Weekly
1.6K

@gjsify/rolldown-plugin-gjsify

The core Rolldown plugin set powering gjsify build. Orchestrates per-target app builds for GJS, Node, Browser, and NativeScript — handling NodeGJS module aliasing, automatic globals injection (--globals auto), CSS-as-string loading (via @gjsify/lightningcss-native or the npm fallback), platform-file resolution (.android.ts / .ios.ts), process-stub injection, shebang hoisting, and more.

Part of the gjsify project — Node.js and Web APIs for GJS (GNOME JavaScript).

Installation

gjsify install @gjsify/rolldown-plugin-gjsify

Usage

Typically consumed via the gjsify CLI (gjsify build --app gjs). For direct use in a custom Rolldown config:

import rolldown from 'rolldown';
import { setupForGjs } from '@gjsify/rolldown-plugin-gjsify';

const { options, plugins } = await setupForGjs({
    input: 'src/index.ts',
    globals: 'auto',
});

const build = await rolldown({ ...options, plugins });
await build.write({ file: 'dist/app.gjs.mjs' });

Individual plugins are also exported for use in custom pipelines:

import {
    cssAsStringPlugin,
    gjsImportsEmptyPlugin,
    processStubPlugin,
    shebangPlugin,
    textLoaderPlugin,
    platformResolvePlugin,
} from '@gjsify/rolldown-plugin-gjsify';

License

MIT

Keywords