mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
21
web/node_modules/strip-comments/LICENSE
generated
vendored
Normal file
21
web/node_modules/strip-comments/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2018, Jon Schlinkert.
|
||||
|
||||
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.
|
185
web/node_modules/strip-comments/README.md
generated
vendored
Normal file
185
web/node_modules/strip-comments/README.md
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
# strip-comments [](https://www.npmjs.com/package/strip-comments) [](https://npmjs.org/package/strip-comments) [](https://npmjs.org/package/strip-comments) [](https://travis-ci.org/jonschlinkert/strip-comments)
|
||||
|
||||
> Strip comments from code. Removes line comments, block comments, the first comment only, or all comments. Optionally leave protected comments unharmed.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
- [About](#about)
|
||||
|
||||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save strip-comments
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
By default all comments are stripped.
|
||||
|
||||
```js
|
||||
const strip = require('strip-comments');
|
||||
const str = strip('const foo = "bar";// this is a comment\n /* me too *\/');
|
||||
console.log(str);
|
||||
// => 'const foo = "bar";\n'
|
||||
```
|
||||
|
||||
For more use-cases see the [tests](./test/test.js)
|
||||
|
||||
## API
|
||||
|
||||
### [strip](index.js#L34)
|
||||
|
||||
Strip all code comments from the given `input`, including protected comments that start with `!`, unless disabled by setting `options.keepProtected` to true.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: string from which to strip comments
|
||||
* `options` **{Object}**: optional options, passed to [extract-comments](https://github.com/jonschlinkert/extract-comments)
|
||||
* `returns` **{String}**: modified input
|
||||
|
||||
**Options**
|
||||
|
||||
- `line` **{Boolean}**: if `false` strip only block comments, default `true`
|
||||
- `block` **{Boolean}**: if `false` strip only line comments, default `true`
|
||||
- `keepProtected` **{Boolean}**: Keep ignored comments (e.g. `/*!`, `/**!` and `//!`)
|
||||
- `preserveNewlines` **{Boolean}**: Preserve newlines after comments are stripped
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const str = strip('const foo = "bar";// this is a comment\n /* me too */');
|
||||
console.log(str);
|
||||
// => 'const foo = "bar";'
|
||||
```
|
||||
|
||||
### [.block](index.js#L54)
|
||||
|
||||
Strip only block comments.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: string from which to strip comments
|
||||
* `options` **{Object}**: pass `opts.keepProtected: true` to keep ignored comments (e.g. `/*!`)
|
||||
* `returns` **{String}**: modified string
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const strip = require('..');
|
||||
const str = strip.block('const foo = "bar";// this is a comment\n /* me too */');
|
||||
console.log(str);
|
||||
// => 'const foo = "bar";// this is a comment'
|
||||
```
|
||||
|
||||
### [.line](index.js#L73)
|
||||
|
||||
Strip only line comments.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: string from which to strip comments
|
||||
* `options` **{Object}**: pass `opts.keepProtected: true` to keep ignored comments (e.g. `//!`)
|
||||
* `returns` **{String}**: modified string
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const str = strip.line('const foo = "bar";// this is a comment\n /* me too */');
|
||||
console.log(str);
|
||||
// => 'const foo = "bar";\n/* me too */'
|
||||
```
|
||||
|
||||
### [.first](index.js#L93)
|
||||
|
||||
Strip the first comment from the given `input`. Or, if `opts.keepProtected` is true, the first non-protected comment will be stripped.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**
|
||||
* `options` **{Object}**: pass `opts.keepProtected: true` to keep comments with `!`
|
||||
* `returns` **{String}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const output = strip.first(input, { keepProtected: true });
|
||||
console.log(output);
|
||||
// => '//! first comment\nfoo; '
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [babel-extract-comments](https://www.npmjs.com/package/babel-extract-comments): Uses babel (babylon) to extract JavaScript code comments from a JavaScript string or file. | [homepage](https://github.com/jonschlinkert/babel-extract-comments "Uses babel (babylon) to extract JavaScript code comments from a JavaScript string or file.")
|
||||
* [code-context](https://www.npmjs.com/package/code-context): Parse a string of javascript to determine the context for functions, variables and comments based… [more](https://github.com/jonschlinkert/code-context) | [homepage](https://github.com/jonschlinkert/code-context "Parse a string of javascript to determine the context for functions, variables and comments based on the code that follows.")
|
||||
* [extract-comments](https://www.npmjs.com/package/extract-comments): Uses esprima to extract line and block comments from a string of JavaScript. Also optionally… [more](https://github.com/jonschlinkert/extract-comments) | [homepage](https://github.com/jonschlinkert/extract-comments "Uses esprima to extract line and block comments from a string of JavaScript. Also optionally parses code context (the next line of code after a comment).")
|
||||
* [parse-code-context](https://www.npmjs.com/package/parse-code-context): Parse code context in a single line of javascript, for functions, variable declarations, methods, prototype… [more](https://github.com/jonschlinkert/parse-code-context) | [homepage](https://github.com/jonschlinkert/parse-code-context "Parse code context in a single line of javascript, for functions, variable declarations, methods, prototype properties, prototype methods etc.")
|
||||
* [parse-comments](https://www.npmjs.com/package/parse-comments): Parse code comments from JavaScript or any language that uses the same format. | [homepage](https://github.com/jonschlinkert/parse-comments "Parse code comments from JavaScript or any language that uses the same format.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 59 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 4 | [charlike-old](https://github.com/charlike-old) |
|
||||
| 2 | [mk-pmb](https://github.com/mk-pmb) |
|
||||
| 1 | [kgryte](https://github.com/kgryte) |
|
||||
| 1 | [epicoxymoron](https://github.com/epicoxymoron) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 24, 2018._
|
186
web/node_modules/strip-comments/index.js
generated
vendored
Normal file
186
web/node_modules/strip-comments/index.js
generated
vendored
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*!
|
||||
* strip-comments <https://github.com/jonschlinkert/strip-comments>
|
||||
*
|
||||
* Copyright (c) 2014-2016, 2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const assign = Object.assign;
|
||||
const extract = require('babel-extract-comments');
|
||||
|
||||
/**
|
||||
* Strip all code comments from the given `input`, including protected
|
||||
* comments that start with `!`, unless disabled by setting `options.keepProtected`
|
||||
* to true.
|
||||
*
|
||||
* ```js
|
||||
* const str = strip('const foo = "bar";// this is a comment\n /* me too *\/');
|
||||
* console.log(str);
|
||||
* // => 'const foo = "bar";'
|
||||
* ```
|
||||
* @name strip
|
||||
* @param {String} `input` string from which to strip comments
|
||||
* @param {Object} `options` optional options, passed to [extract-comments][extract-comments]
|
||||
* @option {Boolean} [options] `line` if `false` strip only block comments, default `true`
|
||||
* @option {Boolean} [options] `block` if `false` strip only line comments, default `true`
|
||||
* @option {Boolean} [options] `keepProtected` Keep ignored comments (e.g. `/*!` and `//!`)
|
||||
* @option {Boolean} [options] `preserveNewlines` Preserve newlines after comments are stripped
|
||||
* @return {String} modified input
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function strip(input, options) {
|
||||
return stripComments(input, assign({ block: true, line: true }, options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip only block comments.
|
||||
*
|
||||
* ```js
|
||||
* const strip = require('..');
|
||||
* const str = strip.block('const foo = "bar";// this is a comment\n /* me too *\/');
|
||||
* console.log(str);
|
||||
* // => 'const foo = "bar";// this is a comment'
|
||||
* ```
|
||||
* @name .block
|
||||
* @param {String} `input` string from which to strip comments
|
||||
* @param {Object} `options` pass `opts.keepProtected: true` to keep ignored comments (e.g. `/*!`)
|
||||
* @return {String} modified string
|
||||
* @api public
|
||||
*/
|
||||
|
||||
strip.block = function(input, options) {
|
||||
return stripComments(input, assign({ block: true }, options));
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip only line comments.
|
||||
*
|
||||
* ```js
|
||||
* const str = strip.line('const foo = "bar";// this is a comment\n /* me too *\/');
|
||||
* console.log(str);
|
||||
* // => 'const foo = "bar";\n/* me too *\/'
|
||||
* ```
|
||||
* @name .line
|
||||
* @param {String} `input` string from which to strip comments
|
||||
* @param {Object} `options` pass `opts.keepProtected: true` to keep ignored comments (e.g. `//!`)
|
||||
* @return {String} modified string
|
||||
* @api public
|
||||
*/
|
||||
|
||||
strip.line = function(input, options) {
|
||||
return stripComments(input, assign({ line: true }, options));
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip the first comment from the given `input`. Or, if `opts.keepProtected` is true,
|
||||
* the first non-protected comment will be stripped.
|
||||
*
|
||||
* ```js
|
||||
* const output = strip.first(input, { keepProtected: true });
|
||||
* console.log(output);
|
||||
* // => '//! first comment\nfoo; '
|
||||
* ```
|
||||
* @name .first
|
||||
* @param {String} `input`
|
||||
* @param {Object} `options` pass `opts.keepProtected: true` to keep comments with `!`
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
strip.first = function(input, options) {
|
||||
const opts = assign({ block: true, line: true, first: true }, options);
|
||||
return stripComments(input, opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip comments
|
||||
*/
|
||||
|
||||
function stripComments(input, options) {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('expected a string');
|
||||
}
|
||||
|
||||
// strip all by default, including `ingored` comments.
|
||||
const defaults = {
|
||||
// we shouldn't care about this here since our goal is to strip comments,
|
||||
// not transpiling, and this has been a common cause of parsing issues
|
||||
allowReturnOutsideFunction: true,
|
||||
block: false,
|
||||
line: false,
|
||||
safe: false,
|
||||
first: false,
|
||||
plugins: []
|
||||
};
|
||||
|
||||
const opts = assign({}, defaults, options);
|
||||
opts.plugins.push('objectRestSpread');
|
||||
|
||||
if (typeof opts.keepProtected !== 'boolean') {
|
||||
opts.keepProtected = opts.safe;
|
||||
}
|
||||
|
||||
try {
|
||||
const comments = extract(input, opts);
|
||||
let pos = { start: 0, end: 0, removed: 0 };
|
||||
if (!comments) return input;
|
||||
|
||||
for (const comment of comments) {
|
||||
if (typeof opts.filter === 'function' && opts.filter(comment, opts) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
input = remove(input, comment, opts, pos);
|
||||
|
||||
if (opts.first === true && !isProtected(comment, opts)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (options.silent !== true) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a single comment from the given string.
|
||||
*/
|
||||
|
||||
function remove(str, comment, options, pos) {
|
||||
let nl = '';
|
||||
|
||||
if (isProtected(comment, options)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (options && options.preserveNewlines) {
|
||||
nl = comment.value.replace(/[^\r\n]/g, '');
|
||||
}
|
||||
|
||||
if (comment.type === 'CommentLine' && options.line === true) {
|
||||
const before = str.slice(0, comment.start - pos.removed);
|
||||
const after = str.slice(comment.end - pos.removed);
|
||||
pos.removed += comment.end - comment.start - nl.length;
|
||||
return before + nl + after;
|
||||
}
|
||||
|
||||
if (comment.type === 'CommentBlock' && options.block === true) {
|
||||
const before = str.slice(0, comment.start - pos.removed);
|
||||
const after = str.slice(comment.end - pos.removed);
|
||||
pos.removed += comment.end - comment.start - nl.length;
|
||||
return before + nl + after;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function isProtected(comment, options) {
|
||||
return options && options.keepProtected === true && /^\*?!/.test(comment.value);
|
||||
}
|
||||
|
||||
module.exports = strip;
|
69
web/node_modules/strip-comments/package.json
generated
vendored
Normal file
69
web/node_modules/strip-comments/package.json
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "strip-comments",
|
||||
"description": "Strip comments from code. Removes line comments, block comments, the first comment only, or all comments. Optionally leave protected comments unharmed.",
|
||||
"version": "1.0.2",
|
||||
"homepage": "https://github.com/jonschlinkert/strip-comments",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"repository": "jonschlinkert/strip-comments",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/strip-comments/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-extract-comments": "^1.0.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"babylon",
|
||||
"block",
|
||||
"block comment",
|
||||
"code comment",
|
||||
"comment",
|
||||
"comments",
|
||||
"javascript",
|
||||
"line",
|
||||
"line comment",
|
||||
"remove",
|
||||
"strip"
|
||||
],
|
||||
"verb": {
|
||||
"toc": true,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"helpers": [
|
||||
"./examples/support/helpers.js"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"babel-extract-comments",
|
||||
"code-context",
|
||||
"extract-comments",
|
||||
"parse-code-context",
|
||||
"parse-comments"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue