Registry / web-framework / es6-module-transpiler-coffee-brunch

es6-module-transpiler-coffee-brunch

JSON →
library0.1.0jsnpmunverified

Brunch plugin that compiles CoffeeScript files through coffee-script and then Square's es6-module-transpiler to produce AMD or CommonJS modules with ES6 module syntax (import/export). Version 0.1.0 is the latest and only release. This plugin is a stop-gap alternative to ember-cli for ES6 module transpiling in CoffeeScript codebases using Brunch. It is effectively limited to AMD output due to CommonJS interoperability issues. Requires manual backtick escaping of ES6 syntax in CoffeeScript.

npm install es6-module-transpiler-coffee-brunch
INSTALL
IMPORT
SIG · ES6-MODULE-TRANSPI
E
es6-module-transpiler-coffee-brunch
web-frameworkjavascriptv0.1.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.

ES6ModuleTranspilerCoffeeBrunchPlugin
const ES6ModuleTranspilerCoffeeBrunchPlugin = require('es6-module-transpiler-coffee-brunch');
import ES6ModuleTranspilerCoffeeBrunchPlugin from 'es6-module-transpiler-coffee-brunch';
This package is CJS-only. No ES module exports.
export default / import
`import Animal from 'animal';` ... `export default Snake;`
import Animal from 'animal' (without backticks)
CoffeeScript cannot parse ES6 syntax; must use backticks to escape.
Configuration
plugins.es6ModuleTranspiler.wrapper = 'amd' in config.coffee/brunch config
plugins.es6_module_transpiler
Configuration key uses camelCase 'es6ModuleTranspiler' as per plugin code.

Shows configuration with brunch module wrapper disabled, transpiler set to AMD, and a CoffeeScript file using backtick-escaped ES6 import/export.

// In config.coffee exports.config = modules: wrapper: false # Disable brunch's module wrapper plugins: es6ModuleTranspiler: wrapper: 'amd' # or 'cjs' moduleName: (path) -> 'myapp/' + path options: imports: underscore: '_' global: 'MyApp' // In app/snake.coffee `import Animal from 'animal';` class Snake extends Animal move: -> alert "Slithering..." super 5 `export default Snake;`
Debug
Known issues
gotchaES6 module syntax must be escaped with backticks in CoffeeScript files.
fix
Use backticks around import/export statements as shown in README.
affects: all
gotchaCommonJS output may not work correctly; recommended to use AMD wrapper.
fix
Set wrapper to 'amd' in configuration.
affects: all
gotchaDo not use coffee-script-brunch simultaneously; this plugin replaces it.
fix
Remove coffee-script-brunch from package.json and run npm prune.
affects: all
gotchaBrunch's module wrapper must be disabled when using AMD wrapper.
fix
Set modules.wrapper: false in brunch config.
affects: all
gotchaConfiguration key must be plugins.es6ModuleTranspiler (not es6_module_transpiler).
fix
Use camelCase key: es6ModuleTranspiler in the plugins section.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'es6-module-transpiler'
Missing required dependency es6-module-transpiler.
fix
Run: npm install es6-module-transpiler
Error: ENOTDIR: not a directory, scandir '/path/to/app'
Brunch expects source files under 'app' directory; plugin may not find files if directory structure is different.
fix
Ensure CoffeeScript files are under a directory named 'app' or configure brunch's paths accordingly.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
coffee-scriptrequiredCompiles CoffeeScript files before ES6 module transpilation
es6-module-transpilerrequiredPerforms ES6 module transpilation to AMD/CJS
brunchrequiredRequired as build tool; plugin is designed for Brunch ecosystem
Agent activity
2 hits · last 30 days
node
2
Resources
es6-module-transpiler-coffee-brunch — npm install es6-module-transpiler-coffee-brunch · libregistry