Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coffee-loader

Package Overview
Dependencies
Maintainers
8
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffee-loader - npm Package Compare versions

Comparing version 0.9.0 to 1.0.0

dist/cjs.js

18

CHANGELOG.md

@@ -5,2 +5,20 @@ # Change Log

### [1.0.0](https://github.com/webpack-contrib/coffee-loader/compare/v0.9.0...v1.0.0) (2020-05-22)
### BREAKING CHANGES
* minimum required Node.js version is `10.13.0`
* minimum required `webpack` version is `4.0.0`
* minimum required `coffeescript` version is `2.0.0`
* default value for the `sourceMap` option based on the value of the `compiler.devtool` option
### Features
* respect the `compiler.devtool` value for the `sourceMap` option
* developer can override CoffeeScript options
### Bug Fixes
* fix error reporting
<a name="0.9.0"></a>

@@ -7,0 +25,0 @@ # [0.9.0](https://github.com/webpack-contrib/coffee-loader/compare/v0.8.0...v0.9.0) (2017-10-25)

81

package.json
{
"name": "coffee-loader",
"version": "0.9.0",
"version": "1.0.0",
"description": "coffee loader module for webpack",
"license": "MIT",
"repository": "webpack-contrib/coffee-loader",
"author": "Tobias Koppers @sokra",
"description": "coffee loader module for webpack",
"homepage": "https://github.com/webpack-contrib/coffee-loader",
"bugs": "https://github.com/webpack-contrib/coffee-loader/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"main": "dist/cjs.js",
"engines": {
"node": ">= 10.13.0"
},
"scripts": {
"start": "npm run build -- -w",
"clean": "del-cli dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
"commitlint": "commitlint --from=master",
"security": "npm audit",
"lint:prettier": "prettier --list-different .",
"lint:js": "eslint --cache .",
"lint": "npm-run-all -l -p \"lint:**\"",
"test:only": "cross-env NODE_ENV=test jest",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"pretest": "npm run lint",
"test": "npm run test:coverage",
"prepare": "npm run build",
"release": "standard-version",
"defaults": "webpack-defaults"
},
"files": [
"index.js"
"dist"
],
"scripts": {
"release": "standard-version"
"peerDependencies": {
"coffeescript": ">= 2.0.0",
"webpack": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"loader-utils": "^1.0.2"
"loader-utils": "^2.0.0",
"schema-utils": "^2.6.6"
},
"devDependencies": {
"standard-version": "^4.2.0"
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^26.0.1",
"coffeescript": "^2.5.1",
"cross-env": "^7.0.2",
"del": "^5.1.0",
"del-cli": "^3.0.1",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"husky": "^4.2.5",
"jest": "^26.0.1",
"lint-staged": "^10.2.6",
"memfs": "^3.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"standard-version": "^8.0.0",
"webpack": "^4.43.0"
},
"peerDependencies": {
"coffeescript": ">= 1.8.x"
},
"homepage": "http://github.com/webpack-contrib/coffee-loader",
"repository": {
"type": "git",
"url": "git@github.com:webpack-contrib/coffee-loader.git"
},
"license": "MIT"
"keywords": [
"webpack"
]
}

247

README.md

@@ -0,1 +1,8 @@

<div align="center">
<img width="160" height="160" src="https://cdn.worldvectorlogo.com/logos/coffeescript.svg">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" hspace="20" src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
</div>
[![npm][npm]][npm-url]

@@ -7,35 +14,53 @@ [![node][node]][node-url]

[![chat][chat]][chat-url]
[![size][size]][size-url]
<div align="center">
<img width="160" height="160"
src="https://cdn.worldvectorlogo.com/logos/coffeescript.svg">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" hspace="20"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Coffee Loader</h1>
<p>Loads <a href="http://coffeescript.org/">CoffeeScript</a> like JavaScript</p>
</div>
# coffee-loader
<h2 align="center">Install</h2>
Compile [CoffeeScript](https://coffeescript.org/) to JavaScript.
```bash
npm install --save-dev coffee-loader
## Getting Started
To begin, you'll need to install `coffeescript` and `coffee-loader`:
```console
npm install --save-dev coffeescript coffee-loader
```
<h2 align="center">Usage</h2>
Then add the plugin to your `webpack` config. For example:
**file.coffee**
```js
import coffee from 'coffee-loader!./file.coffee';
```
```coffee
# Assignment:
number = 42
opposite = true
### `Configuration (recommended)`
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
```js
import coffee from 'file.coffee';
# Arrays:
list = [1, 2, 3, 4, 5]
# Objects:
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
# Splats:
race = (winner, runners...) ->
print winner, runners
# Existence:
alert "I knew it!" if elvis?
# Array comprehensions:
cubes = (math.cube num for num in list)
```
**webpack.config.js**
```js

@@ -47,20 +72,32 @@ module.exports = {

test: /\.coffee$/,
use: [ 'coffee-loader' ]
}
]
}
}
loader: 'coffee-loader',
},
],
},
};
```
<h2 align="center">Options</h2>
Alternative usage:
|Name|Default|Description|
|:--:|:-----:|:----------|
|**`literate`**|`false`|Enable CoffeeScript in Markdown (Code Blocks) e.g `file.coffee.md`|
|**`sourceMap`**|`false`|Enable/Disable Sourcemaps|
|**`transpile`**|`false`|Provide Babel presets and plugins|
```js
import coffee from 'coffee-loader!./file.coffee';
```
### [`Literate`](http://coffeescript.org/#literate)
And run `webpack` via your preferred method.
## Options
Type: `Object`
Default: `{ bare: true }`
Options for CoffeeScript. All possible options you can find [here](https://coffeescript.org/#nodejs-usage).
Documentation for the `transpile` option you can fine [here](https://coffeescript.org/#transpilation).
> ℹ️ The `sourceMap` option takes a value from the `compiler.devtool` value by default.
> ℹ️ The `filename` option takes a value from webpack loader API. The option value will be ignored.
**webpack.config.js**
```js

@@ -71,18 +108,36 @@ module.exports = {

{
test: /\.coffee.md$/,
use: [
{
loader: 'coffee-loader',
options: { literate: true }
}
]
}
]
}
}
test: /\.coffee$/,
loader: 'coffee-loader',
options: {
bare: false,
transpile: {
presets: ['@babel/env'],
},
},
},
],
},
};
```
### `Sourcemaps`
## Examples
### CoffeeScript and Babel
From CoffeeScript 2 documentation:
> CoffeeScript 2 generates JavaScript that uses the latest, modern syntax.
> The runtime or browsers where you want your code to run might not support all of that syntax.
> In that case, we want to convert modern JavaScript into older JavaScript that will run in older versions of Node or older browsers; for example, { a } = obj into a = obj.a.
> This is done via transpilers like Babel, Bublé or Traceur Compiler.
You'll need to install `@babel/core` and `@babel/preset-env` and then create a configuration file:
```console
npm install --save-dev @babel/core @babel/preset-env
echo '{ "presets": ["@babel/env"] }' > .babelrc
```
**webpack.config.js**
```js

@@ -94,17 +149,20 @@ module.exports = {

test: /\.coffee$/,
use: [
{
loader: 'coffee-loader',
options: { sourceMap: true }
}
]
}
]
}
}
loader: 'coffee-loader',
options: {
transpile: {
presets: ['@babel/env'],
},
},
},
],
},
};
```
### [`Transpile`](http://coffeescript.org/#transpilation)
### Literate CoffeeScript
For using Literate CoffeeScript you should setup:
**webpack.config.js**
```js

@@ -116,68 +174,35 @@ module.exports = {

test: /\.coffee$/,
use: [
{
loader: 'coffee-loader',
options: {
transpile: {
presets: ['env']
}
}
}
]
}
]
}
}
loader: 'coffee-loader',
options: {
literate: true,
},
},
],
},
};
```
<h2 align="center">Maintainer</h2>
## Contributing
<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
</br>
<a href="https://github.com/bebraw">Juho Vepsäläinen</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
</br>
<a href="https://github.com/d3viant0ne">Joshua Wiens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
</br>
<a href="https://github.com/SpaceK33z">Kees Kluskens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
</br>
<a href="https://github.com/TheLarkInn">Sean Larkin</a>
</td>
</tr>
<tbody>
</table>
Please take a moment to read our contributing guidelines if you haven't yet done so.
[CONTRIBUTING](./.github/CONTRIBUTING.md)
## License
[MIT](./LICENSE)
[npm]: https://img.shields.io/npm/v/coffee-loader.svg
[npm-url]: https://npmjs.com/package/coffee-loader
[node]: https://img.shields.io/node/v/coffee-loader.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack/coffee-loader.svg
[deps-url]: https://david-dm.org/webpack/coffee-loader
[tests]: http://img.shields.io/travis/webpack/coffee-loader.svg
[tests-url]: https://travis-ci.org/webpack/coffee-loader
[cover]: https://coveralls.io/repos/github/webpack/coffee-loader/badge.svg
[cover-url]: https://coveralls.io/github/webpack/coffee-loader
[deps]: https://david-dm.org/webpack-contrib/coffee-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/coffee-loader
[tests]: https://github.com/webpack-contrib/coffee-loader/workflows/coffee-loader/badge.svg
[tests-url]: https://github.com/webpack-contrib/coffee-loader/actions
[cover]: https://codecov.io/gh/webpack-contrib/coffee-loader/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/coffee-loader
[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack
[size]: https://packagephobia.now.sh/badge?p=coffee-loader
[size-url]: https://packagephobia.now.sh/result?p=coffee-loader
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc