WIP - add extractor, generate snippet_data
This commit is contained in:
7
node_modules/@comandeer/babel-plugin-banner/CHANGELOG.md
generated
vendored
Normal file
7
node_modules/@comandeer/babel-plugin-banner/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# babel-plugin-banner Changelog
|
||||
|
||||
---
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* First working version, yay!
|
||||
21
node_modules/@comandeer/babel-plugin-banner/LICENSE
generated
vendored
Normal file
21
node_modules/@comandeer/babel-plugin-banner/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Comandeer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
26
node_modules/@comandeer/babel-plugin-banner/README.md
generated
vendored
Normal file
26
node_modules/@comandeer/babel-plugin-banner/README.md
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# babel-plugin-banner [](https://travis-ci.org/Comandeer/babel-plugin-banner) [](https://david-dm.org/Comandeer/babel-plugin-banner) [](https://david-dm.org/Comandeer/babel-plugin-banner#info=devDependencies)
|
||||
|
||||
Prepends given comment to the beginning of babelified code.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @comandeer/babel-plugin-banner [--save-dev]
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [
|
||||
["@comandeer/babel-plugin-banner", {
|
||||
"banner": "/*! Some nice comment */"
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
See [LICENSE](./LICENSE) file for details.
|
||||
31
node_modules/@comandeer/babel-plugin-banner/index.js
generated
vendored
Normal file
31
node_modules/@comandeer/babel-plugin-banner/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const utils = require( './utils' );
|
||||
const isComment = utils.isComment;
|
||||
const getCommentContent = utils.getCommentContent;
|
||||
|
||||
module.exports = function( babel ) {
|
||||
const t = babel.types;
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
Program: function Program( path, $ ) {
|
||||
const options = $.opts;
|
||||
const banner = options.banner;
|
||||
const newLine = typeof options.newLine !== 'undefined' ? Boolean( options.newLine ) : true;
|
||||
|
||||
if ( typeof banner !== 'string' || !isComment( banner ) ) {
|
||||
throw new TypeError( 'Banner must be a valid comment.' );
|
||||
}
|
||||
|
||||
if ( newLine ) {
|
||||
path.unshiftContainer( 'body', t.noop() );
|
||||
}
|
||||
|
||||
if ( isComment( banner ) ) {
|
||||
path.addComment( 'leading', getCommentContent( banner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
73
node_modules/@comandeer/babel-plugin-banner/package.json
generated
vendored
Normal file
73
node_modules/@comandeer/babel-plugin-banner/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "@comandeer/babel-plugin-banner@^1.0.0",
|
||||
"_id": "@comandeer/babel-plugin-banner@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QLzOC77ghLWwJUWjNjXQU8JINW8=",
|
||||
"_location": "/@comandeer/babel-plugin-banner",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@comandeer/babel-plugin-banner@^1.0.0",
|
||||
"name": "@comandeer/babel-plugin-banner",
|
||||
"escapedName": "@comandeer%2fbabel-plugin-banner",
|
||||
"scope": "@comandeer",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/rollup-plugin-babel-minify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@comandeer/babel-plugin-banner/-/babel-plugin-banner-1.0.0.tgz",
|
||||
"_shasum": "40bcce0bbee084b5b02545a33635d053c248356f",
|
||||
"_spec": "@comandeer/babel-plugin-banner@^1.0.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/rollup-plugin-babel-minify",
|
||||
"author": {
|
||||
"name": "Comandeer"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Comandeer/babel-plugin-banner/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Simple Babel plugin to prepend comment to the beginning of transformed code.",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.21.0",
|
||||
"chai": "^3.5.0",
|
||||
"cz-conventional-changelog": "^1.2.0",
|
||||
"eslint": "^3.12.2",
|
||||
"mocha": "^3.2.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"utils.js"
|
||||
],
|
||||
"homepage": "https://github.com/Comandeer/babel-plugin-banner#readme",
|
||||
"keywords": [
|
||||
"babel",
|
||||
"plugin",
|
||||
"banner"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@comandeer/babel-plugin-banner",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Comandeer/babel-plugin-banner.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint src/**/*.js tests/*.js",
|
||||
"postversion": "git push origin && git push origin --tags",
|
||||
"prebuild": "rimraf dist",
|
||||
"pretest": "npm run lint",
|
||||
"preversion": "npm test",
|
||||
"test": "mocha tests/*.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
20
node_modules/@comandeer/babel-plugin-banner/utils.js
generated
vendored
Normal file
20
node_modules/@comandeer/babel-plugin-banner/utils.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
const oneLineRegex = /^\/\/(.*?)\n?$/;
|
||||
const multiLineRegex = /^\/\*([\s\S]*?)\*\/$/;
|
||||
|
||||
exports.isComment = function( input ) {
|
||||
if ( oneLineRegex.test( input ) || multiLineRegex.test( input ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.getCommentContent = function( input ) {
|
||||
if ( oneLineRegex.test( input ) ) {
|
||||
return input.replace( /^\/\//, '' );
|
||||
}
|
||||
|
||||
return input.replace( /^\/\*/, '' ).replace( /\*\/$/, '' );
|
||||
}
|
||||
Reference in New Issue
Block a user