Package Exports
- @hackbg/ganesha
- @hackbg/ganesha/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hackbg/ganesha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
"The very day I was born I made my first mistake,
and by that path have I sought wisdom ever since."
- William Buck
Ganesha
Tools for modern literate programming with ECMAScript-based languages and Markdown
File formatGanesha extracts fenced code blocks
from Markdown files. It also supports loading regular TypeScript without an
intermediate compilation step (no more running |
|
Module loadingUse
|
npm install --save @hackbg/ganesha
ganesha-node my-typescript-program.ts
ganesha-node my-literate-program.ts.md |
Frontend bundlingGanesha currently provides a Rollup plugin that can be used in Rollup or Vite to compile literate modules for the browser. |
<script type="module" src="./script"></script>
import { defineConfig } from 'vite'
import ganesha from '@ganesha/rollup'
export default defineConfig({ plugins: [ ganesha() ] }) |
IDE integrationHelp wanted! A language server is currently in development. |
(LSP sounds is a great idea, but I found the implementation to be obfuscated beyond belief) |
Comparison with alternatives
Feature | Ganesha | esmo/esno | ts-esnode | ts-node |
---|---|---|---|---|
Compile TypeScript on demand | ๐ฉ yes | ๐ฉ yes | ๐ฉ yes | ๐ฉ yes |
Literate modules | ๐ฉ yes | โ no | โ no | โ no |
Honors compilerOptions.paths |
๐ฉ yes | โ no | ? | ? |
Single entrypoint for CJS and ESM | ๐ฉ yes | โ no | โ no | โ no |
Depends on esbuild binary module |
๐ฉ no | โ yes | ๐ฉ no | ๐ฉ no |
Built-in hot reloader | โณ WIP | โ no | โ no | โ no |
Known issues
See doc/GRIPES.md