babel-preset-jsy
raw JSON → 0.15.3 verified Sat Apr 25 auth: no javascript maintenance
Babel preset for JSY, an indentation-based (offside) JavaScript syntax dialect that uses Python-like indentation instead of braces. This preset builds on babel-preset-env and supports Babel 6.x. It compiles JSY into standard JavaScript with automatic transpilation based on environment. The latest version is 0.15.3, with maintenance updates as needed. Unlike other indentation-based syntaxes such as CoffeeScript or LiveScript, JSY aims to stay close to standard JavaScript semantics while providing clean, whitespace-sensitive code. Current status is maintenance as JSY has limited adoption.
Common errors
error Error: Requires Babel "^6.0.0-0" but was loaded with "7.x.x". ↓
cause Using babel-preset-jsy with Babel 7 or later.
fix
Upgrade to a Babel 7 compatible preset or downgrade Babel to version 6.
error Error: Cannot find module 'babel-preset-jsy/lean' ↓
cause Incorrect path in preset configuration.
fix
Change preset to 'babel-preset-jsy/lean' or 'jsy/lean' depending on your setup.
error SyntaxError: Unexpected token (1:6) - using indentation ↓
cause Babel not configured to use the JSY preset.
fix
Add 'jsy/lean' to presets in your Babel config.
Warnings
deprecated This package is designed for Babel 6.x and may not work with Babel 7+. ↓
fix For Babel 7, consider using babel-plugin-jsy directly or look for updated presets.
breaking Version 0.10.0 changed the preset name from 'jsy' to 'jsy/lean'. ↓
fix Update your .babelrc: change "presets": ["jsy"] to "presets": ["jsy/lean"].
gotcha JSY syntax may conflict with standard JavaScript when used in mixed codebases. ↓
fix Use file extensions like .jsy or configure Babel to only transform JSY files if possible.
gotcha Cannot use both JSY and standard JavaScript in the same file without explicit transformation. ↓
fix Use babel-plugin-jsy with proper configuration to handle mixed syntax, or separate files.
Install
npm install babel-preset-jsy yarn add babel-preset-jsy pnpm add babel-preset-jsy Imports
- jsy wrong
import { jsy } from 'babel-preset-jsy'correctmodule.exports = { presets: ['jsy/lean'] } - babel-preset-jsy wrong
require('babel-preset-jsy')correctconst presets = ['babel-preset-jsy'] - jsy/lean
const presets = ['jsy/lean']
Quickstart
// Install: npm install --save-dev babel-preset-jsy
// .babelrc configuration:
{
"presets": ["jsy/lean"]
}
// Example JSY code (file.jsy)
// Indentation-based syntax
const add = (a, b) =>
a + b
for (let i = 0; i < 10; i++)
console.log(i)
if (true)
console.log('true')
else
console.log('false')
// Compile with: babel file.jsy