coffee-loader
Advanced tools
Comparing version 0.9.0 to 1.0.0
@@ -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) |
{ | ||
"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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11598
8
64
0
204
4
23
1
1
+ Addedschema-utils@^2.6.6
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/source-map@0.3.6(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@types/eslint@9.6.1(transitive)
+ Added@types/eslint-scope@3.7.7(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/node@22.9.0(transitive)
+ Added@webassemblyjs/ast@1.14.1(transitive)
+ Added@webassemblyjs/floating-point-hex-parser@1.13.2(transitive)
+ Added@webassemblyjs/helper-api-error@1.13.2(transitive)
+ Added@webassemblyjs/helper-buffer@1.14.1(transitive)
+ Added@webassemblyjs/helper-numbers@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-section@1.14.1(transitive)
+ Added@webassemblyjs/ieee754@1.13.2(transitive)
+ Added@webassemblyjs/leb128@1.13.2(transitive)
+ Added@webassemblyjs/utf8@1.13.2(transitive)
+ Added@webassemblyjs/wasm-edit@1.14.1(transitive)
+ Added@webassemblyjs/wasm-gen@1.14.1(transitive)
+ Added@webassemblyjs/wasm-opt@1.14.1(transitive)
+ Added@webassemblyjs/wasm-parser@1.14.1(transitive)
+ Added@webassemblyjs/wast-printer@1.14.1(transitive)
+ Added@xtuc/ieee754@1.2.0(transitive)
+ Added@xtuc/long@4.2.2(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedajv-keywords@3.5.2(transitive)
+ Addedbrowserslist@4.24.2(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaniuse-lite@1.0.30001680(transitive)
+ Addedchrome-trace-event@1.0.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedelectron-to-chromium@1.5.62(transitive)
+ Addedenhanced-resolve@5.17.1(transitive)
+ Addedes-module-lexer@1.5.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedglob-to-regexp@0.4.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedjest-worker@27.5.1(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedloader-runner@4.3.0(transitive)
+ Addedloader-utils@2.0.4(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednode-releases@2.0.18(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedschema-utils@2.7.13.3.0(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addedtapable@2.2.1(transitive)
+ Addedterser@5.36.0(transitive)
+ Addedterser-webpack-plugin@5.3.10(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwatchpack@2.4.2(transitive)
+ Addedwebpack@5.96.1(transitive)
+ Addedwebpack-sources@3.2.3(transitive)
- Removedjson5@1.0.2(transitive)
- Removedloader-utils@1.4.2(transitive)
- Removedminimist@1.2.8(transitive)
Updatedloader-utils@^2.0.0