Comparing version 4.0.1 to 5.0.0
@@ -1,14 +0,18 @@ | ||
# v4.0.1 (2018-04-08) | ||
# Changelog | ||
- **Patch**: Fix Typescript type definitions. (#179) | ||
- **Internal**: Drop dependency on `object-assign`. (#177) | ||
- **Internal**: Use `eslint` directly (without `gulp`). (#180) | ||
## [5.0.0](https://www.github.com/gulp-community/gulp-pug/compare/v4.0.1...v5.0.0) (2021-06-09) | ||
# v4.0.0 (2018-04-08) | ||
### ⚠ BREAKING CHANGES | ||
- **Breaking change**: Update required Node version from `0.10` to `4.0.0`. (#171) | ||
- **Feature**: Add Typescript type definitions. (#173) | ||
- **Patch**: Drop dependency on deprecated `gulp-util`. (#172) | ||
- **Internal**: Move repo to `gulp-community/gulp-pug`. (#175) | ||
- **Internal**: Update dependencies. (#175) | ||
- **Internal**: Add `CHANGELOG.md` | ||
- Update dependencies (#221) | ||
- Convert to gulp scaffold, dropping node <10 support (#215) | ||
### Features | ||
- Add streaming support using vinyl-contents ([#200](https://www.github.com/gulp-community/gulp-pug/issues/200)) ([642d1ea](https://www.github.com/gulp-community/gulp-pug/commit/642d1ea8088dd14162a6ccb767ebf8fbda690456)) | ||
- Add template filename to PluginError ([#220](https://www.github.com/gulp-community/gulp-pug/issues/220)) ([cfaad8c](https://www.github.com/gulp-community/gulp-pug/commit/cfaad8c5d6923d6c15f824ae717c5f0d16fc7490)) | ||
### Miscellaneous Chores | ||
- Convert to gulp scaffold, dropping node <10 support ([#215](https://www.github.com/gulp-community/gulp-pug/issues/215)) ([004417e](https://www.github.com/gulp-community/gulp-pug/commit/004417e79c5e3013ad1c3a913e8e4b3ad23b8813)) | ||
- Update dependencies ([#221](https://www.github.com/gulp-community/gulp-pug/issues/221)) ([8bb7f1c](https://www.github.com/gulp-community/gulp-pug/commit/8bb7f1c24bd05b33bda01efd8ed37a10d3417c97)) |
@@ -1,3 +0,3 @@ | ||
import { Transform } from "stream"; | ||
import { Options as PugOptions } from "pug"; | ||
import { Transform } from 'stream'; | ||
import { Options as PugOptions } from 'pug'; | ||
@@ -4,0 +4,0 @@ /** |
30
index.js
@@ -8,2 +8,3 @@ 'use strict'; | ||
const log = require('fancy-log'); | ||
const vinylContents = require('vinyl-contents'); | ||
@@ -22,10 +23,16 @@ module.exports = function gulpPug(options) { | ||
if (file.isStream()) { | ||
return cb(new PluginError('gulp-pug', 'Streaming not supported')); | ||
} | ||
vinylContents(file, function onContents(err, contents) { | ||
if (err) { | ||
return cb( | ||
new PluginError('gulp-pug', err, { fileName: opts.filename }) | ||
); | ||
} | ||
if (file.isBuffer()) { | ||
if (!contents) { | ||
return cb(null, file); | ||
} | ||
try { | ||
let compiled; | ||
const contents = String(file.contents); | ||
if (opts.verbose === true) { | ||
@@ -39,9 +46,12 @@ log('compiling file', file.path); | ||
} | ||
file.contents = new Buffer(compiled); | ||
} catch (e) { | ||
return cb(new PluginError('gulp-pug', e)); | ||
file.contents = Buffer.from(compiled); | ||
} catch (err) { | ||
return cb( | ||
new PluginError('gulp-pug', err, { fileName: opts.filename }) | ||
); | ||
} | ||
} | ||
cb(null, file); | ||
cb(null, file); | ||
}); | ||
}); | ||
}; |
{ | ||
"name": "gulp-pug", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Gulp plugin for compiling Pug templates", | ||
"nyc": { | ||
"reporter": [ | ||
"lcov", | ||
"text-summary" | ||
] | ||
}, | ||
"prettier": { | ||
"singleQuote": true | ||
}, | ||
"keywords": [ | ||
@@ -20,25 +29,29 @@ "jade", | ||
"engines": { | ||
"node": ">= 4.0.0" | ||
"node": ">=10.13.0" | ||
}, | ||
"scripts": { | ||
"test": "npm run lint && tap ./test", | ||
"lint": "eslint index.js \"test/**/*.js\"" | ||
"pretest": "npm run lint", | ||
"test": "nyc mocha --async-only", | ||
"lint": "eslint ." | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@types/pug": "^2.0.4", | ||
"fancy-log": "^1.3.2", | ||
"fancy-log": "^1.3.3", | ||
"plugin-error": "^1.0.1", | ||
"pug": "^2.0.3", | ||
"replace-ext": "^1.0.0", | ||
"through2": "^2.0.3" | ||
"pug": "^3.0.2", | ||
"replace-ext": "^2.0.0", | ||
"through2": "^4.0.2", | ||
"vinyl-contents": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^9.6.2", | ||
"eslint": "^4.19.1", | ||
"eslint-config-google": "^0.9.1", | ||
"gulp": "^4.0.0", | ||
"tap": "^11.1.3", | ||
"vinyl": "^2.1.0" | ||
"@types/node": "^14.0.0", | ||
"@types/pug": "^2.0.4", | ||
"eslint": "^7.0.0", | ||
"eslint-config-gulp": "^5.0.0", | ||
"expect": "^27.0.2", | ||
"mississippi": "^4.0.0", | ||
"mocha": "^8.0.0", | ||
"nyc": "^15.0.1", | ||
"vinyl": "^2.2.0" | ||
} | ||
} |
@@ -1,15 +0,28 @@ | ||
# gulp-pug [![Build Status][status-img]][status] ![Dependencies][deps] ![Downloads][downloads] | ||
> Gulp plugin for compiling Pug templates | ||
<p align="center"> | ||
<a href="http://gulpjs.com"> | ||
<img height="257" width="257" src="https://raw.githubusercontent.com/gulpjs/artwork/master/community/logo-2021/community.png"> | ||
</a> | ||
</p> | ||
This Gulp plugin enables you to compile your Pug templates into HTML or JS, with support for template locals, custom Pug filters, AMD wrapping, and others. Here is a simple example using `gulp-pug`: | ||
# gulp-pug | ||
```javascript | ||
var pug = require('gulp-pug'); | ||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] | ||
gulp.task('views', function buildHTML() { | ||
return gulp.src('views/*.pug') | ||
.pipe(pug({ | ||
// Your options in here. | ||
})) | ||
}); | ||
Gulp plugin for compiling Pug templates. Enabling you to compile your Pug templates into HTML or JS, with support for template locals, custom Pug filters, AMD wrapping, and others. | ||
## Usage | ||
```js | ||
const { src, dest } = require('gulp'); | ||
const pug = require('gulp-pug'); | ||
exports.views = () => { | ||
return src('./src/*.pug') | ||
.pipe( | ||
pug({ | ||
// Your options in here. | ||
}) | ||
) | ||
.pipe(dest('./dist')); | ||
}; | ||
``` | ||
@@ -21,9 +34,9 @@ | ||
- `opts` (`Object`): Any options from [Pug's API][api] in addition to `pug`'s own options. | ||
- `opts.locals` (`Object`): Locals to compile the Pug with. You can also provide locals through the `data` field of the file object, e.g. with [`gulp-data`][gulp-data]. They will be merged with `opts.locals`. | ||
- `opts.data` (`Object`): Same as `opts.locals`. | ||
- `opts.client` (`Boolean`): Compile Pug to JavaScript code. | ||
- `opts.pug`: A custom instance of Pug for `gulp-pug` to use. | ||
- `opts.verbose`: display name of file from stream that is being compiled. | ||
- `opts` (`Object`): Any options from [Pug's API][api] in addition to `pug`'s own options. | ||
- `opts.locals` (`Object`): Locals to compile the Pug with. You can also provide locals through the `data` field of the file object, e.g. with [`gulp-data`][gulp-data]. They will be merged with `opts.locals`. | ||
- `opts.data` (`Object`): Same as `opts.locals`. | ||
- `opts.client` (`Boolean`): Compile Pug to JavaScript code. | ||
- `opts.pug`: A custom instance of Pug for `gulp-pug` to use. | ||
- `opts.verbose`: display name of file from stream that is being compiled. | ||
To change `opts.filename` use [`gulp-rename`][gulp-rename] before `gulp-pug`. | ||
@@ -35,20 +48,26 @@ | ||
- [`pug`][pug] | ||
- [`gulp-data`][gulp-data]: Using locals in your Pug templates easier. | ||
- [`gulp-rename`][gulp-rename]: Change `opts.filename` passed into Pug. | ||
- [`gulp-wrap-amd`][gulp-wrap-amd]: Wrap your Pug in an AMD wrapper. | ||
- [`pug`][pug] | ||
- [`gulp-data`][gulp-data]: Using locals in your Pug templates easier. | ||
- [`gulp-rename`][gulp-rename]: Change `opts.filename` passed into Pug. | ||
- [`gulp-wrap-amd`][gulp-wrap-amd]: Wrap your Pug in an AMD wrapper. | ||
- [`gulp-frontmatter-wrangler`][gulp-frontmatter-wrangler]: Useful if you need YAML frontmatter at the top of your Pug file. | ||
## Thanks | ||
## License | ||
- Many thanks to [Blaine Bublitz][phated] for the original `gulp-jade` plugin. | ||
MIT | ||
## LICENSE | ||
<!-- prettier-ignore-start --> | ||
[downloads-image]: https://img.shields.io/npm/dm/gulp-pug.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/gulp-pug | ||
[npm-image]: https://img.shields.io/npm/v/gulp-pug.svg?style=flat-square | ||
[MIT][license] © Jamen Marzonie | ||
[ci-url]: https://github.com/gulp-community/gulp-pug/actions?query=workflow:dev | ||
[ci-image]: https://img.shields.io/github/workflow/status/gulp-community/gulp-pug/dev?style=flat-square | ||
[status]: https://travis-ci.org/gulp-community/gulp-pug | ||
[status-img]: https://travis-ci.org/gulp-community/gulp-pug.png?branch=master | ||
[deps]: https://david-dm.org/gulp-community/gulp-pug.svg | ||
[downloads]: https://img.shields.io/npm/dm/gulp-pug.svg | ||
[pug]: http://github.com/gulp-community/pug | ||
[coveralls-url]: https://coveralls.io/r/gulp-community/gulp-pug | ||
[coveralls-image]: https://img.shields.io/coveralls/gulp-community/gulp-pug/master.svg?style=flat-square | ||
<!-- prettier-ignore-end --> | ||
<!-- prettier-ignore-start --> | ||
[pug]: https://github.com/pugjs/pug | ||
[api]: https://pugjs.org/api/reference.html | ||
@@ -58,3 +77,3 @@ [gulp-data]: https://npmjs.com/gulp-data | ||
[gulp-wrap-amd]: https://github.com/phated/gulp-wrap-amd | ||
[phated]: https://github.com/phated | ||
[license]: LICENSE | ||
[gulp-frontmatter-wrangler]: https://github.com/DougBeney/gulp-frontmatter-wrangler | ||
<!-- prettier-ignore-end --> |
Sorry, the diff of this file is not supported yet
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
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
8758
79
77
9
1
+ Addedvinyl-contents@^1.0.0
+ Added@babel/helper-string-parser@7.24.8(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/parser@7.25.6(transitive)
+ Added@babel/types@7.25.6(transitive)
+ Addedacorn@7.4.1(transitive)
+ Addedassert-never@1.3.0(transitive)
+ Addedbabel-walk@3.0.0-canary-5(transitive)
+ Addedbl@3.0.1(transitive)
+ Addedclone@2.1.2(transitive)
+ Addedclone-buffer@1.0.0(transitive)
+ Addedclone-stats@1.0.0(transitive)
+ Addedcloneable-readable@1.1.3(transitive)
+ Addedconstantinople@4.0.1(transitive)
+ Addedis-expression@4.0.0(transitive)
+ Addedpug@3.0.3(transitive)
+ Addedpug-attrs@3.0.0(transitive)
+ Addedpug-code-gen@3.0.3(transitive)
+ Addedpug-error@2.1.0(transitive)
+ Addedpug-filters@4.0.0(transitive)
+ Addedpug-lexer@5.0.1(transitive)
+ Addedpug-linker@4.0.0(transitive)
+ Addedpug-load@3.0.0(transitive)
+ Addedpug-parser@6.0.0(transitive)
+ Addedpug-runtime@3.0.1(transitive)
+ Addedpug-strip-comments@2.0.0(transitive)
+ Addedpug-walk@2.0.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedreplace-ext@2.0.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthrough2@4.0.2(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
+ Addedtoken-stream@1.0.0(transitive)
+ Addedvinyl@2.2.1(transitive)
+ Addedvinyl-contents@1.0.0(transitive)
+ Addedvoid-elements@3.1.0(transitive)
+ Addedwith@7.0.2(transitive)
- Removed@types/pug@^2.0.4
- Removed@types/babel-types@7.0.15(transitive)
- Removed@types/babylon@6.16.9(transitive)
- Removed@types/pug@2.0.10(transitive)
- Removedacorn@3.3.04.0.13(transitive)
- Removedacorn-globals@3.1.0(transitive)
- Removedalign-text@0.1.4(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbabel-types@6.26.0(transitive)
- Removedbabylon@6.18.0(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedclean-css@4.2.4(transitive)
- Removedcliui@2.1.0(transitive)
- Removedconstantinople@3.1.2(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-expression@3.0.0(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlongest@1.0.1(transitive)
- Removedpug@2.0.4(transitive)
- Removedpug-attrs@2.0.4(transitive)
- Removedpug-code-gen@2.0.3(transitive)
- Removedpug-error@1.3.3(transitive)
- Removedpug-filters@3.1.1(transitive)
- Removedpug-lexer@4.1.0(transitive)
- Removedpug-linker@3.0.6(transitive)
- Removedpug-load@2.0.12(transitive)
- Removedpug-parser@5.0.1(transitive)
- Removedpug-runtime@2.0.5(transitive)
- Removedpug-strip-comments@1.0.4(transitive)
- Removedpug-walk@1.1.8(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsource-map@0.5.70.6.1(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedto-fast-properties@1.0.3(transitive)
- Removedtoken-stream@0.0.1(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedvoid-elements@2.0.1(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwith@5.1.1(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyargs@3.10.0(transitive)
Updatedfancy-log@^1.3.3
Updatedpug@^3.0.2
Updatedreplace-ext@^2.0.0
Updatedthrough2@^4.0.2