rehype-remove-external-script-content
Advanced tools
Comparing version 1.0.0 to 1.0.1
19
index.js
/** | ||
* @fileoverview | ||
* Remove content of external JavaScript | ||
* `script` elements. | ||
* Remove content of external JavaScript `script` elements. | ||
* @example | ||
@@ -9,16 +8,16 @@ * <script src="index.js">Hello!</script> | ||
'use strict'; | ||
'use strict' | ||
var visit = require('unist-util-visit'); | ||
var js = require('hast-util-is-javascript'); | ||
var has = require('hast-util-has-property'); | ||
var visit = require('unist-util-visit') | ||
var js = require('hast-util-is-javascript') | ||
var has = require('hast-util-has-property') | ||
module.exports = scriptJS; | ||
module.exports = scriptJS | ||
function scriptJS() { | ||
return transform; | ||
return transform | ||
} | ||
function transform(tree) { | ||
visit(tree, 'element', visitor); | ||
visit(tree, 'element', visitor) | ||
} | ||
@@ -28,4 +27,4 @@ | ||
if (js(node) && has(node, 'src')) { | ||
node.children = []; | ||
node.children = [] | ||
} | ||
} |
{ | ||
"name": "rehype-remove-external-script-content", | ||
"version": "1.0.0", | ||
"description": "Remove content of external JavaScript `script` elements", | ||
"version": "1.0.1", | ||
"description": "rehype plugin to remove content of external JavaScript `script` elements", | ||
"license": "MIT", | ||
"keywords": [ | ||
"unified", | ||
"rehype", | ||
@@ -12,5 +13,5 @@ "hast", | ||
], | ||
"repository": "https://github.com/wooorm/rehype-minify/tree/master/packages/rehype-remove-external-script-content", | ||
"bugs": "https://github.com/wooorm/rehype-minify/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"repository": "https://github.com/rehypejs/rehype-minify/tree/master/packages/rehype-remove-external-script-content", | ||
"bugs": "https://github.com/rehypejs/rehype-minify/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
"contributors": [ | ||
@@ -26,3 +27,4 @@ "Titus Wormer <tituswormer@gmail.com>" | ||
"hast-util-is-javascript": "^1.0.0" | ||
} | ||
}, | ||
"xo": false | ||
} |
@@ -5,7 +5,16 @@ <!--This file is generated by `build-packages.js`--> | ||
Remove content of external JavaScript | ||
`script` elements. | ||
[![Build][build-badge]][build] | ||
[![Coverage][coverage-badge]][coverage] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Size][size-badge]][size] | ||
[![Sponsors][sponsors-badge]][collective] | ||
[![Backers][backers-badge]][collective] | ||
[![Chat][chat-badge]][chat] | ||
Remove content of external JavaScript `script` elements. | ||
## Install | ||
[npm][]: | ||
```sh | ||
@@ -29,4 +38,54 @@ npm install rehype-remove-external-script-content | ||
## Contribute | ||
See [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways | ||
to get started. | ||
See [`support.md`][support] for ways to get help. | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
abide by its terms. | ||
## License | ||
[MIT](https://github.com/wooorm/rehype-minify/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com) | ||
[MIT][license] © [Titus Wormer][author] | ||
[build-badge]: https://img.shields.io/travis/rehypejs/rehype-minify.svg | ||
[build]: https://travis-ci.org/rehypejs/rehype-minify | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg | ||
[coverage]: https://codecov.io/github/rehypejs/rehype-minify | ||
[downloads-badge]: https://img.shields.io/npm/dm/rehype-remove-external-script-content.svg | ||
[downloads]: https://www.npmjs.com/package/rehype-remove-external-script-content | ||
[size-badge]: https://img.shields.io/bundlephobia/minzip/rehype-remove-external-script-content.svg | ||
[size]: https://bundlephobia.com/result?p=rehype-remove-external-script-content | ||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg | ||
[collective]: https://opencollective.com/unified | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat]: https://spectrum.chat/unified/rehype | ||
[npm]: https://docs.npmjs.com/cli/install | ||
[health]: https://github.com/rehypejs/.github | ||
[contributing]: https://github.com/rehypejs/.github/blob/master/contributing.md | ||
[support]: https://github.com/rehypejs/.github/blob/master/support.md | ||
[coc]: https://github.com/rehypejs/.github/blob/master/code-of-conduct.md | ||
[license]: https://github.com/rehypejs/rehype-minify/blob/master/license | ||
[author]: https://wooorm.com |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
3662
90
22