-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.json
executable file
·161 lines (161 loc) · 12.7 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
"_args": [
[
"snapdragon@^0.8.1",
"/home/gabe/HackTech2019/static/node_modules/micromatch"
]
],
"_from": "snapdragon@>=0.8.1 <0.9.0",
"_id": "snapdragon@0.8.2",
"_inCache": true,
"_installable": true,
"_location": "/snapdragon",
"_nodeVersion": "9.7.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/snapdragon_0.8.2_1520776598430_0.674348590844402"
},
"_npmUser": {
"email": "github@sellside.com",
"name": "jonschlinkert"
},
"_npmVersion": "5.7.1",
"_phantomChildren": {
"is-descriptor": "0.1.6",
"is-extendable": "0.1.1"
},
"_requested": {
"name": "snapdragon",
"raw": "snapdragon@^0.8.1",
"rawSpec": "^0.8.1",
"scope": null,
"spec": ">=0.8.1 <0.9.0",
"type": "range"
},
"_requiredBy": [
"/braces",
"/expand-brackets",
"/extglob",
"/micromatch",
"/nanomatch"
],
"_resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
"_shasum": "64922e7c565b0e14204ba1aa7d6964278d25182d",
"_shrinkwrap": null,
"_spec": "snapdragon@^0.8.1",
"_where": "/home/gabe/HackTech2019/static/node_modules/micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/snapdragon/issues"
},
"contributors": [
{
"name": "Brian Woodward",
"url": "https://twitter.com/doowb"
},
{
"name": "Edward Betts",
"url": "http://edwardbetts.com"
},
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
}
],
"dependencies": {
"base": "^0.11.1",
"debug": "^2.2.0",
"define-property": "^0.2.5",
"extend-shallow": "^2.0.1",
"map-cache": "^0.2.2",
"source-map": "^0.5.6",
"source-map-resolve": "^0.5.0",
"use": "^3.1.0"
},
"description": "Fast, pluggable and easy-to-use parser-renderer factory.",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1",
"gulp-format-md": "^0.1.10",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-unused": "^0.2.0",
"mocha": "^3.0.2"
},
"directories": {},
"dist": {
"fileCount": 9,
"integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
"shasum": "64922e7c565b0e14204ba1aa7d6964278d25182d",
"tarball": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
"unpackedSize": 35228
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"lib"
],
"gitHead": "6c952b12cabe896a86d9a4fe378f934bccbe6436",
"homepage": "https://github.com/jonschlinkert/snapdragon",
"keywords": [
"lexer",
"snapdragon"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
},
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"name": "snapdragon",
"optionalDependencies": {},
"readme": "# snapdragon [![NPM version](https://img.shields.io/npm/v/snapdragon.svg?style=flat)](https://www.npmjs.com/package/snapdragon) [![NPM downloads](https://img.shields.io/npm/dm/snapdragon.svg?style=flat)](https://npmjs.org/package/snapdragon) [![Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon.svg?style=flat)](https://travis-ci.org/jonschlinkert/snapdragon)\n\n> Fast, pluggable and easy-to-use parser-renderer factory.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save snapdragon\n```\n\nCreated by [jonschlinkert](https://github.com/jonschlinkert) and [doowb](https://github.com/doowb).\n\n**Features**\n\n* Bootstrap your own parser, get sourcemap support for free\n* All parsing and compiling is handled by simple, reusable middleware functions\n* Inspired by the parsers in [pug](http://jade-lang.com) and [css](https://github.com/reworkcss/css).\n\n## History\n\n### v0.5.0\n\n**Breaking changes**\n\nSubstantial breaking changes were made in v0.5.0! Most of these changes are part of a larger refactor that will be finished in 0.6.0, including the introduction of a `Lexer` class.\n\n* Renderer was renamed to `Compiler`\n* the `.render` method was renamed to `.compile`\n* Many other smaller changes. A more detailed overview will be provided in 0.6.0. If you don't have to time review code, I recommend you wait for the 0.6.0 release.\n\n## Usage examples\n\n```js\nvar Snapdragon = require('snapdragon');\nvar snapdragon = new Snapdragon();\n```\n\n**Parse**\n\n```js\nvar ast = snapdragon.parser('some string', options)\n // parser middleware that can be called by other middleware\n .set('foo', function () {})\n // parser middleware, runs immediately in the order defined\n .use(bar())\n .use(baz())\n```\n\n**Render**\n\n```js\n// pass the `ast` from the parse method\nvar res = snapdragon.compiler(ast)\n // compiler middleware, called when the name of the middleware\n // matches the `node.type` (defined in a parser middleware)\n .set('bar', function () {})\n .set('baz', function () {})\n .compile()\n```\n\nSee the [examples](./examples/).\n\n## Getting started\n\n**Parsers**\n\nParsers are middleware functions used for parsing a string into an ast node.\n\n```js\nvar ast = snapdragon.parser(str, options)\n .use(function() {\n var pos = this.position();\n var m = this.match(/^\\./);\n if (!m) return;\n return pos({\n // `type` specifies the compiler to use\n type: 'dot',\n val: m[0]\n });\n })\n```\n\n**AST node**\n\nWhen the parser finds a match, `pos()` is called, pushing a token for that node onto the ast that looks something like:\n\n```js\n{ type: 'dot',\n val: '.',\n position:\n { start: { lineno: 1, column: 1 },\n end: { lineno: 1, column: 2 } }}\n```\n\n**Renderers**\n\nRenderers are _named_ middleware functions that visit over an array of ast nodes to compile a string.\n\n```js\nvar res = snapdragon.compiler(ast)\n .set('dot', function (node) {\n console.log(node.val)\n //=> '.'\n return this.emit(node.val);\n })\n```\n\n**Source maps**\n\nIf you want source map support, make sure to emit the position as well.\n\n```js\nvar res = snapdragon.compiler(ast)\n .set('dot', function (node) {\n return this.emit(node.val, node.position);\n })\n```\n\n## Docs\n\n### Parser middleware\n\nA parser middleware is a function that returns an abject called a `token`. This token is pushed onto the AST as a node.\n\n**Example token**\n\n```js\n{ type: 'dot',\n val: '.',\n position:\n { start: { lineno: 1, column: 1 },\n end: { lineno: 1, column: 2 } }}\n```\n\n**Example parser middleware**\n\nMatch a single `.` in a string:\n\n1. Get the starting position by calling `this.position()`\n2. pass a regex for matching a single dot to the `.match` method\n3. if **no match** is found, return `undefined`\n4. if a **match** is found, `pos()` is called, which returns a token with:\n - `type`: the name of the [compiler] to use\n - `val`: The actual value captured by the regex. In this case, a `.`. Note that you can capture and return whatever will be needed by the corresponding [compiler].\n - The ending position: automatically calculated by adding the length of the first capture group to the starting position.\n\n## Renderer middleware\n\nRenderers are run when the name of the compiler middleware matches the `type` defined on an ast `node` (which is defined in a parser).\n\n**Example**\n\nExercise: Parse a dot, then compile it as an escaped dot.\n\n```js\nvar ast = snapdragon.parser('.')\n .use(function () {\n var pos = this.position();\n var m = this.match(/^\\./);\n if (!m) return;\n return pos({\n // define the `type` of compiler to use\n type: 'dot',\n val: m[0]\n })\n })\n\nvar result = snapdragon.compiler(ast)\n .set('dot', function (node) {\n return this.emit('\\\\' + node.val);\n })\n .compile()\n\nconsole.log(result.output);\n//=> '\\.'\n```\n\n## API\n\n### [Parser](lib/parser.js#L19)\n\nCreate a new `Parser` with the given `input` and `options`.\n\n**Params**\n\n* `input` **{String}**\n* `options` **{Object}**\n\n### [.define](lib/parser.js#L103)\n\nDefine a non-enumberable property on the `Parser` instance.\n\n**Example**\n\n```js\nparser.define('foo', 'bar');\n```\n\n**Params**\n\n* `key` **{String}**: propery name\n* `val` **{any}**: property value\n* `returns` **{Object}**: Returns the Parser instance for chaining.\n\nSet parser `name` with the given `fn`\n\n**Params**\n\n* `name` **{String}**\n* `fn` **{Function}**\n\nGet parser `name`\n\n**Params**\n\n* `name` **{String}**\n\nPush a `token` onto the `type` stack.\n\n**Params**\n\n* `type` **{String}**\n* `returns` **{Object}** `token`\n\nPop a token off of the `type` stack\n\n**Params**\n\n* `type` **{String}**\n* `returns` **{Object}**: Returns a token\n\nReturn true if inside a `stack` node. Types are `braces`, `parens` or `brackets`.\n\n**Params**\n\n* `type` **{String}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nparser.isType(node, 'brace');\n```\n\n**Params**\n\n* `node` **{Object}**\n* `type` **{String}**\n* `returns` **{Boolean}**\n\n### [.define](lib/compiler.js#L71)\n\nDefine a non-enumberable property on the `Compiler` instance.\n\n**Example**\n\n```js\ncompiler.define('foo', 'bar');\n```\n\n**Params**\n\n* `key` **{String}**: propery name\n* `val` **{any}**: property value\n* `returns` **{Object}**: Returns the Compiler instance for chaining.\n\n## About\n\n### Related projects\n\n* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces \"Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.\")\n* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets \"Expand POSIX bracket expressions (character classes) in glob patterns.\")\n* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob \"Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.\")\n* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch \"Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor**<br/> | \n| --- | --- |\n| 106 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 2 | [doowb](https://github.com/doowb) |\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme && verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](https://github.com/jonschlinkert/snapdragon/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 10, 2016._",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/snapdragon.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"layout": "default",
"lint": {
"reflinks": true
},
"plugins": [
"gulp-format-md"
],
"reflinks": [
"css",
"pug",
"verb",
"verb-generate-readme"
],
"related": {
"description": "These libraries use snapdragon:",
"list": [
"braces",
"expand-brackets",
"extglob",
"micromatch"
]
},
"tasks": [
"readme"
],
"toc": false
},
"version": "0.8.2"
}