rollup-plugin-jsy
raw JSON → 1.9.4 verified Fri May 01 auth: no javascript
A Rollup plugin that transforms JSY (a JavaScript syntax extension/sugar) into standard JavaScript using @jsy-lang/jsy. Version 1.9.4 is current, with stable API. This plugin enables using JSY syntax in Rollup builds, supporting both ESM and CommonJS outputs. Key differentiator: it leverages JSY's concise syntax while integrating seamlessly with Rollup's plugin system, including source maps and watch mode. Alternatives like Babel require separate configuration; this plugin is purpose-built for JSY.
Common errors
error Error: Unexpected token (Note that you need plugins to import files that are not JavaScript) ↓
cause Input file has .jsy extension but Rollup does not recognize it; plugin not added or misconfigured.
fix
Add jsy plugin to rollup.config.js and ensure 'include' covers the file.
error TypeError: jsy is not a function ↓
cause Importing the module incorrectly (e.g., using require or wrong named import).
fix
Use
import jsy from 'rollup-plugin-jsy' (default import) or const jsy = require('rollup-plugin-jsy').default. error Error: Cannot find module '@jsy-lang/jsy' ↓
cause Missing peer dependency @jsy-lang/jsy.
fix
Install peer dependency: npm install @jsy-lang/jsy --save-dev (or yarn add).
Warnings
breaking Plugin output changed from object to string in version 1.0.0. ↓
fix Update to latest version (1.9.4) and ensure downstream code expects string output.
deprecated Option 'sourceMap' renamed to 'sourcemap' in v1.2.0. ↓
fix Use 'sourcemap' instead of 'sourceMap' in plugin options.
gotcha The plugin only processes files with .jsy extension by default; other extensions need explicit 'include'. ↓
fix Use jsy({ include: ['**/*.jsy', '**/*.mjs'] }) to include additional patterns.
breaking Dropped support for Node.js 10 and 12 in v1.5.0. ↓
fix Upgrade to Node.js >=14.
gotcha Must be placed before other syntax plugins (e.g., @rollup/plugin-babel) in Rollup plugins array. ↓
fix Order plugins as: [jsy(), babel()] to ensure JSY transforms first.
Install
npm install rollup-plugin-jsy yarn add rollup-plugin-jsy pnpm add rollup-plugin-jsy Imports
- default wrong
const jsy = require('rollup-plugin-jsy')correctimport jsy from 'rollup-plugin-jsy' - jsy wrong
import Jsy from 'rollup-plugin-jsy'correctimport { jsy } from 'rollup-plugin-jsy' - pluginOptions wrong
import type { PluginOptions } from 'rollup-plugin-jsy'correctimport jsy, { PluginOptions } from 'rollup-plugin-jsy'
Quickstart
// rollup.config.js
import jsy from 'rollup-plugin-jsy';
export default {
input: 'src/index.jsy',
output: {
file: 'dist/bundle.js',
format: 'esm'
},
plugins: [
jsy() // options: { include, exclude, sourceMap, etc. }
]
};