ckParser Transpiler

raw JSON →
2.0.3 verified Fri May 01 auth: no javascript

A transpiler for the Momoko project that converts custom syntax into target code. Current stable version is 2.0.3. The package is tightly coupled with the Momoko ecosystem and offers specialized transformation rules not found in general transpilers. Release cadence is irregular, aligned with Momoko updates. Differentiators include lightweight implementation and direct integration with ckParser grammar.

error Error: Cannot find module 'ck-transpiler'
cause Package not installed or missing from node_modules.
fix
Run npm install ck-transpiler to install the package.
error TypeError: transpile is not a function
cause Importing the default export instead of named export.
fix
Use import { transpile } from 'ck-transpiler' instead of import ckTranspiler from ....
breaking In v2.0.0, the default export was removed; use named exports instead.
fix Replace `import ckTranspiler from 'ck-transpiler'` with `import { transpile } from 'ck-transpiler'`.
deprecated The `transform` function is deprecated in v2.0.3 and will be removed in v3.
fix Use `transpile` with `{ mode: 'transform' }` option instead.
gotcha The package requires Node.js >=14 due to ESM and top-level await usage.
fix Update Node.js to version 14 or later.
npm install ck-transpiler
yarn add ck-transpiler
pnpm add ck-transpiler

Demonstrates importing and using the transpile function with options, including error handling.

import { transpile } from 'ck-transpiler';

const input = `let x = 1;`;
try {
  const output = transpile(input, { target: 'es2020' });
  console.log(output.code);
} catch (err) {
  console.error('Transpilation failed:', err.message);
}