Registry / web-framework / bun-plugin-dlight

bun-plugin-dlight

JSON →
library0.5.0jsnpmunverified

Bun build plugin for transpiling DLight views and models (.view.js/.view.ts files) inside Bun's bundler. v0.5.0, stable, with TypeScript types. Integrates directly into Bun.build() using Babel under the hood, without requiring Vite or Astro. Supports custom file filters and DLight preset options. Designed for Bun + DLight projects that want minimal tooling overhead.

npm install bun-plugin-dlight
INSTALL
IMPORT
SIG · BUN-PLUGIN-DLIGHT
B
bun-plugin-dlight
web-frameworkjavascriptv0.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dlightPlugin
import { dlightPlugin } from 'bun-plugin-dlight'
import dlightPlugin from 'bun-plugin-dlight'
Named export only; no default export available.
DLightPluginOptions
import { DLightPluginOptions } from 'bun-plugin-dlight'
const DLightPluginOptions = require('bun-plugin-dlight').DLightPluginOptions
Type export; use import type in TypeScript.
PluginBuilder
import type { PluginBuilder } from 'bun-plugin-dlight'
Type-only export for advanced usage; not needed in most cases.

Shows how to import and use dlightPlugin inside Bun.build() with custom filter and options.

import { dlightPlugin } from 'bun-plugin-dlight'; const result = await Bun.build({ outdir: './dist', entrypoints: ['./src/index.ts'], publicPath: '/build/', throw: true, plugins: [ dlightPlugin({ filter: /\.(view|model)\.[tj]s$/, options: {} }), ], }); console.log('Build output:', result.outputs);
Debug
Known issues
gotchaPlugin only works with Bun's Bun.build() API, not with other bundlers or runtimes.
fix
Ensure you run the code with Bun and use Bun.build().
affects: >=0.1.0
gotchaRequires Babel to be installed (comes bundled with Bun, but if custom Babel config is needed, it may conflict).
fix
Avoid overriding Babel globally; rely on Bun's internal Babel.
affects: >=0.1.0
breakingIn v0.5.0, the plugin switched from CommonJS to ESM-only; require() no longer works.
fix
Use import { dlightPlugin } from 'bun-plugin-dlight' instead of require().
affects: >=0.5.0
Errors
Common errors & fixes
TypeError: dlightPlugin is not a function
Importing default export instead of named export.
fix
Use import { dlightPlugin } from 'bun-plugin-dlight'.
Error: Cannot find module 'bun-plugin-dlight'
Package not installed or not in node_modules.
fix
Run 'bun add bun-plugin-dlight' to install.
Bun.build: Plugin must be an object with a `name` property.
Passing an invalid plugin object (e.g., forgetting to call dlightPlugin()).
fix
Ensure you call dlightPlugin() as a function: plugins: [dlightPlugin()].
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
bunrequiredRuntime dependency: plugin only works with Bun's Bun.build() API
@dlightjs/dlightoptionalTranspilation target: processes DLight view/model files
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
bun-plugin-dlight — npm install bun-plugin-dlight · libregistry