mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-10 21:01:41 +00:00
update
This commit is contained in:
16
node_modules/pug-strip-comments/CHANGELOG.md
generated
vendored
Normal file
16
node_modules/pug-strip-comments/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 1.0.1 - 2016-08-10
|
||||
### Changed
|
||||
- Project name is changed to Pug
|
||||
- Otherwise unchanged from 1.0.0
|
||||
|
||||
## 1.0.0 - 2015-08-10
|
||||
### Added
|
||||
- Initial stable release – unchanged from 0.0.1
|
||||
|
||||
## 0.0.1 - 2015-08-10
|
||||
### Added
|
||||
- Initial release
|
7
node_modules/pug-strip-comments/LICENSE.md
generated
vendored
Normal file
7
node_modules/pug-strip-comments/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2015 Tiancheng “Timothy” Gu
|
||||
|
||||
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.
|
46
node_modules/pug-strip-comments/README.md
generated
vendored
Normal file
46
node_modules/pug-strip-comments/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# pug-strip-comments
|
||||
|
||||
Strips comments from Pug token stream
|
||||
|
||||
[](https://travis-ci.org/pugjs/pug-strip-comments)
|
||||
[](https://david-dm.org/pugjs/pug?path=packages/pug-strip-comments)
|
||||
[](https://david-dm.org/pugjs/pug?path=packages/pug-strip-comments&type=dev)
|
||||
[](https://www.npmjs.org/package/pug-strip-comments)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install pug-strip-comments
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var lex = require('pug-lexer');
|
||||
var stripComments = require('pug-strip-comments');
|
||||
|
||||
var tokens = lex('//- unbuffered\n// buffered');
|
||||
// [ { type: 'comment', line: 1, val: ' unbuffered', buffer: false },
|
||||
// { type: 'newline', line: 2 },
|
||||
// { type: 'comment', line: 2, val: ' buffered', buffer: true },
|
||||
// { type: 'eos', line: 2 } ]
|
||||
|
||||
// Only strip unbuffered comments (default)
|
||||
stripComments(tokens, { filename: 'pug' });
|
||||
// [ { type: 'newline', line: 2 },
|
||||
// { type: 'comment', line: 2, val: ' buffered', buffer: true },
|
||||
// { type: 'eos', line: 2 } ]
|
||||
|
||||
// Only strip buffered comments (when you want to play a joke on your coworkers)
|
||||
stripComments(tokens, { filename: 'pug', stripUnbuffered: false, stripBuffered: true });
|
||||
// [ { type: 'comment', line: 1, val: ' unbuffered', buffer: false },
|
||||
// { type: 'newline', line: 2 },
|
||||
// { type: 'eos', line: 2 } ]
|
||||
|
||||
// Strip both (if you want Pug VERY clean)
|
||||
stripComments(tokens, { filename: 'pug', stripBuffered: true });
|
||||
// [ { type: 'newline', line: 2 },
|
||||
// { type: 'eos', line: 2 } ]
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
70
node_modules/pug-strip-comments/index.js
generated
vendored
Normal file
70
node_modules/pug-strip-comments/index.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
'use strict';
|
||||
|
||||
var error = require('pug-error');
|
||||
|
||||
module.exports = stripComments;
|
||||
|
||||
function unexpectedToken (type, occasion, filename, line) {
|
||||
var msg = '`' + type + '` encountered when ' + occasion;
|
||||
throw error('UNEXPECTED_TOKEN', msg, { filename: filename, line: line });
|
||||
}
|
||||
|
||||
function stripComments (input, options) {
|
||||
options = options || {};
|
||||
|
||||
// Default: strip unbuffered comments and leave buffered ones alone
|
||||
var stripUnbuffered = options.stripUnbuffered !== false;
|
||||
var stripBuffered = options.stripBuffered === true;
|
||||
var filename = options.filename;
|
||||
|
||||
var out = [];
|
||||
// If we have encountered a comment token and are not sure if we have gotten
|
||||
// out of the comment or not
|
||||
var inComment = false;
|
||||
// If we are sure that we are in a block comment and all tokens except
|
||||
// `end-pipeless-text` should be ignored
|
||||
var inPipelessText = false;
|
||||
|
||||
return input.filter(function (tok) {
|
||||
switch (tok.type) {
|
||||
case 'comment':
|
||||
if (inComment) {
|
||||
unexpectedToken(
|
||||
'comment', 'already in a comment', filename, tok.line
|
||||
);
|
||||
} else {
|
||||
inComment = tok.buffer ? stripBuffered : stripUnbuffered;
|
||||
return !inComment;
|
||||
}
|
||||
case 'start-pipeless-text':
|
||||
if (!inComment) return true;
|
||||
if (inPipelessText) {
|
||||
unexpectedToken(
|
||||
'start-pipeless-text', 'already in pipeless text mode',
|
||||
filename, tok.line
|
||||
);
|
||||
}
|
||||
inPipelessText = true;
|
||||
return false;
|
||||
case 'end-pipeless-text':
|
||||
if (!inComment) return true;
|
||||
if (!inPipelessText) {
|
||||
unexpectedToken(
|
||||
'end-pipeless-text', 'not in pipeless text mode',
|
||||
filename, tok.line
|
||||
);
|
||||
}
|
||||
inPipelessText = false;
|
||||
inComment = false;
|
||||
return false;
|
||||
// There might be a `text` right after `comment` but before
|
||||
// `start-pipeless-text`. Treat it accordingly.
|
||||
case 'text':
|
||||
return !inComment;
|
||||
default:
|
||||
if (inPipelessText) return false;
|
||||
inComment = false;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
55
node_modules/pug-strip-comments/package.json
generated
vendored
Normal file
55
node_modules/pug-strip-comments/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"pug-strip-comments@1.0.4",
|
||||
"/Users/tatiana/selfdefined"
|
||||
]
|
||||
],
|
||||
"_from": "pug-strip-comments@1.0.4",
|
||||
"_id": "pug-strip-comments@1.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-i5j/9CS4yFhSxHp5iKPHwigaig/VV9g+FgReLJWWHEHbvKsbqL0oP/K5ubuLco6Wu3Kan5p7u7qk8A4oLLh6vw==",
|
||||
"_location": "/pug-strip-comments",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "pug-strip-comments@1.0.4",
|
||||
"name": "pug-strip-comments",
|
||||
"escapedName": "pug-strip-comments",
|
||||
"rawSpec": "1.0.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-1.0.4.tgz",
|
||||
"_spec": "1.0.4",
|
||||
"_where": "/Users/tatiana/selfdefined",
|
||||
"author": {
|
||||
"name": "Timothy Gu",
|
||||
"email": "timothygu99@gmail.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"pug-error": "^1.3.3"
|
||||
},
|
||||
"description": "Strip comments from a Pug token stream (from the lexer)",
|
||||
"devDependencies": {
|
||||
"line-json": "^1.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "1bdf628a70fda7a0d840c52f3abce54b1c6b0130",
|
||||
"keywords": [
|
||||
"pug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "pug-strip-comments",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pugjs/pug/tree/master/packages/pug-strip-comments"
|
||||
},
|
||||
"version": "1.0.4"
|
||||
}
|
Reference in New Issue
Block a user