강현태

first commit

Showing 1000 changed files with 4853 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +var createError = require('http-errors');
2 +var express = require('express');
3 +var path = require('path');
4 +var cookieParser = require('cookie-parser');
5 +var logger = require('morgan');
6 +
7 +var indexRouter = require('./routes/index');
8 +//var usersRouter = require('./routes/users');
9 +
10 +var app = express();
11 +
12 +// view engine setup
13 +app.set('views', path.join(__dirname, 'views'));
14 +app.set('view engine', 'jade');
15 +
16 +app.use(logger('dev'));
17 +app.use(express.json());
18 +app.use(express.urlencoded({ extended: false }));
19 +app.use(cookieParser());
20 +app.use(express.static(path.join(__dirname, 'public')));
21 +
22 +app.use('/', indexRouter);
23 +//app.use('/users', usersRouter);
24 +
25 +// catch 404 and forward to error handler
26 +app.use(function(req, res, next) {
27 + next(createError(404));
28 +});
29 +
30 +// error handler
31 +app.use(function(err, req, res, next) {
32 + // set locals, only providing error in development
33 + res.locals.message = err.message;
34 + res.locals.error = req.app.get('env') === 'development' ? err : {};
35 +
36 + // render the error page
37 + res.status(err.status || 500);
38 + res.render('error');
39 +});
40 +
41 +module.exports = app;
1 +#!/usr/bin/env node
2 +
3 +/**
4 + * Module dependencies.
5 + */
6 +
7 +var app = require('../app');
8 +var debug = require('debug')('backend:server');
9 +var http = require('http');
10 +
11 +/**
12 + * Get port from environment and store in Express.
13 + */
14 +
15 +var port = normalizePort(process.env.PORT || '3000');
16 +app.set('port', port);
17 +
18 +/**
19 + * Create HTTP server.
20 + */
21 +
22 +var server = http.createServer(app);
23 +
24 +/**
25 + * Listen on provided port, on all network interfaces.
26 + */
27 +
28 +server.listen(port);
29 +server.on('error', onError);
30 +server.on('listening', onListening);
31 +
32 +/**
33 + * Normalize a port into a number, string, or false.
34 + */
35 +
36 +function normalizePort(val) {
37 + var port = parseInt(val, 10);
38 +
39 + if (isNaN(port)) {
40 + // named pipe
41 + return val;
42 + }
43 +
44 + if (port >= 0) {
45 + // port number
46 + return port;
47 + }
48 +
49 + return false;
50 +}
51 +
52 +/**
53 + * Event listener for HTTP server "error" event.
54 + */
55 +
56 +function onError(error) {
57 + if (error.syscall !== 'listen') {
58 + throw error;
59 + }
60 +
61 + var bind = typeof port === 'string'
62 + ? 'Pipe ' + port
63 + : 'Port ' + port;
64 +
65 + // handle specific listen errors with friendly messages
66 + switch (error.code) {
67 + case 'EACCES':
68 + console.error(bind + ' requires elevated privileges');
69 + process.exit(1);
70 + break;
71 + case 'EADDRINUSE':
72 + console.error(bind + ' is already in use');
73 + process.exit(1);
74 + break;
75 + default:
76 + throw error;
77 + }
78 +}
79 +
80 +/**
81 + * Event listener for HTTP server "listening" event.
82 + */
83 +
84 +function onListening() {
85 + var addr = server.address();
86 + var bind = typeof addr === 'string'
87 + ? 'pipe ' + addr
88 + : 'port ' + addr.port;
89 + debug('Listening on ' + bind);
90 +}
1 +35.05,35,17.5,1,137.85,137.85,137.85,137.85,73.5,89,20,52,75,0.2,100,134.5,83,134.5,83,36,20,0.75,50,15.5,144.5,31.5,9.3,140,3.45,102.5,13.5,13.5,13.5,13.5,2.239,2.239,2.239,1.6,1.4,6.85,1.65,1.24,0.15,0.25,1.4,0.25,3.5,8.75,100,85,2.4,99.9,300,10.75,1.36,0.5,25,88,90,85,5.5,50,44,14.5,1.5,223,50,267,1156,161.5,6.75,15.8,6.75,4.25,350.75,65,40.5,2.25,33.5,29,35,35,88.5,2.2,15,15,6.5,9.15,61.55,140,285,40,4,20,250,100,105,7.15,10.7,6.8,99.5,0.55,37.75,10.5,8.6,10,13.5,4.975,1.25,0.495,57,100,140,8.25,30,300,0.65,132.5,26,550,100,0.02,2.15,5.1,565,7,145
...\ No newline at end of file ...\ No newline at end of file
1 +../acorn/bin/acorn
...\ No newline at end of file ...\ No newline at end of file
1 +../clean-css/bin/cleancss
...\ No newline at end of file ...\ No newline at end of file
1 +../jade/bin/jade.js
...\ No newline at end of file ...\ No newline at end of file
1 +../json2csv/bin/json2csv.js
...\ No newline at end of file ...\ No newline at end of file
1 +../mime/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../mkdirp/bin/cmd.js
...\ No newline at end of file ...\ No newline at end of file
1 +../uglify-js/bin/uglifyjs
...\ No newline at end of file ...\ No newline at end of file
1 +1.3.5 / 2018-02-28
2 +==================
3 +
4 + * deps: mime-types@~2.1.18
5 + - deps: mime-db@~1.33.0
6 +
7 +1.3.4 / 2017-08-22
8 +==================
9 +
10 + * deps: mime-types@~2.1.16
11 + - deps: mime-db@~1.29.0
12 +
13 +1.3.3 / 2016-05-02
14 +==================
15 +
16 + * deps: mime-types@~2.1.11
17 + - deps: mime-db@~1.23.0
18 + * deps: negotiator@0.6.1
19 + - perf: improve `Accept` parsing speed
20 + - perf: improve `Accept-Charset` parsing speed
21 + - perf: improve `Accept-Encoding` parsing speed
22 + - perf: improve `Accept-Language` parsing speed
23 +
24 +1.3.2 / 2016-03-08
25 +==================
26 +
27 + * deps: mime-types@~2.1.10
28 + - Fix extension of `application/dash+xml`
29 + - Update primary extension for `audio/mp4`
30 + - deps: mime-db@~1.22.0
31 +
32 +1.3.1 / 2016-01-19
33 +==================
34 +
35 + * deps: mime-types@~2.1.9
36 + - deps: mime-db@~1.21.0
37 +
38 +1.3.0 / 2015-09-29
39 +==================
40 +
41 + * deps: mime-types@~2.1.7
42 + - deps: mime-db@~1.19.0
43 + * deps: negotiator@0.6.0
44 + - Fix including type extensions in parameters in `Accept` parsing
45 + - Fix parsing `Accept` parameters with quoted equals
46 + - Fix parsing `Accept` parameters with quoted semicolons
47 + - Lazy-load modules from main entry point
48 + - perf: delay type concatenation until needed
49 + - perf: enable strict mode
50 + - perf: hoist regular expressions
51 + - perf: remove closures getting spec properties
52 + - perf: remove a closure from media type parsing
53 + - perf: remove property delete from media type parsing
54 +
55 +1.2.13 / 2015-09-06
56 +===================
57 +
58 + * deps: mime-types@~2.1.6
59 + - deps: mime-db@~1.18.0
60 +
61 +1.2.12 / 2015-07-30
62 +===================
63 +
64 + * deps: mime-types@~2.1.4
65 + - deps: mime-db@~1.16.0
66 +
67 +1.2.11 / 2015-07-16
68 +===================
69 +
70 + * deps: mime-types@~2.1.3
71 + - deps: mime-db@~1.15.0
72 +
73 +1.2.10 / 2015-07-01
74 +===================
75 +
76 + * deps: mime-types@~2.1.2
77 + - deps: mime-db@~1.14.0
78 +
79 +1.2.9 / 2015-06-08
80 +==================
81 +
82 + * deps: mime-types@~2.1.1
83 + - perf: fix deopt during mapping
84 +
85 +1.2.8 / 2015-06-07
86 +==================
87 +
88 + * deps: mime-types@~2.1.0
89 + - deps: mime-db@~1.13.0
90 + * perf: avoid argument reassignment & argument slice
91 + * perf: avoid negotiator recursive construction
92 + * perf: enable strict mode
93 + * perf: remove unnecessary bitwise operator
94 +
95 +1.2.7 / 2015-05-10
96 +==================
97 +
98 + * deps: negotiator@0.5.3
99 + - Fix media type parameter matching to be case-insensitive
100 +
101 +1.2.6 / 2015-05-07
102 +==================
103 +
104 + * deps: mime-types@~2.0.11
105 + - deps: mime-db@~1.9.1
106 + * deps: negotiator@0.5.2
107 + - Fix comparing media types with quoted values
108 + - Fix splitting media types with quoted commas
109 +
110 +1.2.5 / 2015-03-13
111 +==================
112 +
113 + * deps: mime-types@~2.0.10
114 + - deps: mime-db@~1.8.0
115 +
116 +1.2.4 / 2015-02-14
117 +==================
118 +
119 + * Support Node.js 0.6
120 + * deps: mime-types@~2.0.9
121 + - deps: mime-db@~1.7.0
122 + * deps: negotiator@0.5.1
123 + - Fix preference sorting to be stable for long acceptable lists
124 +
125 +1.2.3 / 2015-01-31
126 +==================
127 +
128 + * deps: mime-types@~2.0.8
129 + - deps: mime-db@~1.6.0
130 +
131 +1.2.2 / 2014-12-30
132 +==================
133 +
134 + * deps: mime-types@~2.0.7
135 + - deps: mime-db@~1.5.0
136 +
137 +1.2.1 / 2014-12-30
138 +==================
139 +
140 + * deps: mime-types@~2.0.5
141 + - deps: mime-db@~1.3.1
142 +
143 +1.2.0 / 2014-12-19
144 +==================
145 +
146 + * deps: negotiator@0.5.0
147 + - Fix list return order when large accepted list
148 + - Fix missing identity encoding when q=0 exists
149 + - Remove dynamic building of Negotiator class
150 +
151 +1.1.4 / 2014-12-10
152 +==================
153 +
154 + * deps: mime-types@~2.0.4
155 + - deps: mime-db@~1.3.0
156 +
157 +1.1.3 / 2014-11-09
158 +==================
159 +
160 + * deps: mime-types@~2.0.3
161 + - deps: mime-db@~1.2.0
162 +
163 +1.1.2 / 2014-10-14
164 +==================
165 +
166 + * deps: negotiator@0.4.9
167 + - Fix error when media type has invalid parameter
168 +
169 +1.1.1 / 2014-09-28
170 +==================
171 +
172 + * deps: mime-types@~2.0.2
173 + - deps: mime-db@~1.1.0
174 + * deps: negotiator@0.4.8
175 + - Fix all negotiations to be case-insensitive
176 + - Stable sort preferences of same quality according to client order
177 +
178 +1.1.0 / 2014-09-02
179 +==================
180 +
181 + * update `mime-types`
182 +
183 +1.0.7 / 2014-07-04
184 +==================
185 +
186 + * Fix wrong type returned from `type` when match after unknown extension
187 +
188 +1.0.6 / 2014-06-24
189 +==================
190 +
191 + * deps: negotiator@0.4.7
192 +
193 +1.0.5 / 2014-06-20
194 +==================
195 +
196 + * fix crash when unknown extension given
197 +
198 +1.0.4 / 2014-06-19
199 +==================
200 +
201 + * use `mime-types`
202 +
203 +1.0.3 / 2014-06-11
204 +==================
205 +
206 + * deps: negotiator@0.4.6
207 + - Order by specificity when quality is the same
208 +
209 +1.0.2 / 2014-05-29
210 +==================
211 +
212 + * Fix interpretation when header not in request
213 + * deps: pin negotiator@0.4.5
214 +
215 +1.0.1 / 2014-01-18
216 +==================
217 +
218 + * Identity encoding isn't always acceptable
219 + * deps: negotiator@~0.4.0
220 +
221 +1.0.0 / 2013-12-27
222 +==================
223 +
224 + * Genesis
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# accepts
2 +
3 +[![NPM Version][npm-image]][npm-url]
4 +[![NPM Downloads][downloads-image]][downloads-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][travis-image]][travis-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
10 +Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
11 +
12 +In addition to negotiator, it allows:
13 +
14 +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
15 + as well as `('text/html', 'application/json')`.
16 +- Allows type shorthands such as `json`.
17 +- Returns `false` when no types match
18 +- Treats non-existent headers as `*`
19 +
20 +## Installation
21 +
22 +This is a [Node.js](https://nodejs.org/en/) module available through the
23 +[npm registry](https://www.npmjs.com/). Installation is done using the
24 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25 +
26 +```sh
27 +$ npm install accepts
28 +```
29 +
30 +## API
31 +
32 +<!-- eslint-disable no-unused-vars -->
33 +
34 +```js
35 +var accepts = require('accepts')
36 +```
37 +
38 +### accepts(req)
39 +
40 +Create a new `Accepts` object for the given `req`.
41 +
42 +#### .charset(charsets)
43 +
44 +Return the first accepted charset. If nothing in `charsets` is accepted,
45 +then `false` is returned.
46 +
47 +#### .charsets()
48 +
49 +Return the charsets that the request accepts, in the order of the client's
50 +preference (most preferred first).
51 +
52 +#### .encoding(encodings)
53 +
54 +Return the first accepted encoding. If nothing in `encodings` is accepted,
55 +then `false` is returned.
56 +
57 +#### .encodings()
58 +
59 +Return the encodings that the request accepts, in the order of the client's
60 +preference (most preferred first).
61 +
62 +#### .language(languages)
63 +
64 +Return the first accepted language. If nothing in `languages` is accepted,
65 +then `false` is returned.
66 +
67 +#### .languages()
68 +
69 +Return the languages that the request accepts, in the order of the client's
70 +preference (most preferred first).
71 +
72 +#### .type(types)
73 +
74 +Return the first accepted type (and it is returned as the same text as what
75 +appears in the `types` array). If nothing in `types` is accepted, then `false`
76 +is returned.
77 +
78 +The `types` array can contain full MIME types or file extensions. Any value
79 +that is not a full MIME types is passed to `require('mime-types').lookup`.
80 +
81 +#### .types()
82 +
83 +Return the types that the request accepts, in the order of the client's
84 +preference (most preferred first).
85 +
86 +## Examples
87 +
88 +### Simple type negotiation
89 +
90 +This simple example shows how to use `accepts` to return a different typed
91 +respond body based on what the client wants to accept. The server lists it's
92 +preferences in order and will get back the best match between the client and
93 +server.
94 +
95 +```js
96 +var accepts = require('accepts')
97 +var http = require('http')
98 +
99 +function app (req, res) {
100 + var accept = accepts(req)
101 +
102 + // the order of this list is significant; should be server preferred order
103 + switch (accept.type(['json', 'html'])) {
104 + case 'json':
105 + res.setHeader('Content-Type', 'application/json')
106 + res.write('{"hello":"world!"}')
107 + break
108 + case 'html':
109 + res.setHeader('Content-Type', 'text/html')
110 + res.write('<b>hello, world!</b>')
111 + break
112 + default:
113 + // the fallback is text/plain, so no need to specify it above
114 + res.setHeader('Content-Type', 'text/plain')
115 + res.write('hello, world!')
116 + break
117 + }
118 +
119 + res.end()
120 +}
121 +
122 +http.createServer(app).listen(3000)
123 +```
124 +
125 +You can test this out with the cURL program:
126 +```sh
127 +curl -I -H'Accept: text/html' http://localhost:3000/
128 +```
129 +
130 +## License
131 +
132 +[MIT](LICENSE)
133 +
134 +[npm-image]: https://img.shields.io/npm/v/accepts.svg
135 +[npm-url]: https://npmjs.org/package/accepts
136 +[node-version-image]: https://img.shields.io/node/v/accepts.svg
137 +[node-version-url]: https://nodejs.org/en/download/
138 +[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg
139 +[travis-url]: https://travis-ci.org/jshttp/accepts
140 +[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg
141 +[coveralls-url]: https://coveralls.io/r/jshttp/accepts
142 +[downloads-image]: https://img.shields.io/npm/dm/accepts.svg
143 +[downloads-url]: https://npmjs.org/package/accepts
1 +/*!
2 + * accepts
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var Negotiator = require('negotiator')
16 +var mime = require('mime-types')
17 +
18 +/**
19 + * Module exports.
20 + * @public
21 + */
22 +
23 +module.exports = Accepts
24 +
25 +/**
26 + * Create a new Accepts object for the given req.
27 + *
28 + * @param {object} req
29 + * @public
30 + */
31 +
32 +function Accepts (req) {
33 + if (!(this instanceof Accepts)) {
34 + return new Accepts(req)
35 + }
36 +
37 + this.headers = req.headers
38 + this.negotiator = new Negotiator(req)
39 +}
40 +
41 +/**
42 + * Check if the given `type(s)` is acceptable, returning
43 + * the best match when true, otherwise `undefined`, in which
44 + * case you should respond with 406 "Not Acceptable".
45 + *
46 + * The `type` value may be a single mime type string
47 + * such as "application/json", the extension name
48 + * such as "json" or an array `["json", "html", "text/plain"]`. When a list
49 + * or array is given the _best_ match, if any is returned.
50 + *
51 + * Examples:
52 + *
53 + * // Accept: text/html
54 + * this.types('html');
55 + * // => "html"
56 + *
57 + * // Accept: text/*, application/json
58 + * this.types('html');
59 + * // => "html"
60 + * this.types('text/html');
61 + * // => "text/html"
62 + * this.types('json', 'text');
63 + * // => "json"
64 + * this.types('application/json');
65 + * // => "application/json"
66 + *
67 + * // Accept: text/*, application/json
68 + * this.types('image/png');
69 + * this.types('png');
70 + * // => undefined
71 + *
72 + * // Accept: text/*;q=.5, application/json
73 + * this.types(['html', 'json']);
74 + * this.types('html', 'json');
75 + * // => "json"
76 + *
77 + * @param {String|Array} types...
78 + * @return {String|Array|Boolean}
79 + * @public
80 + */
81 +
82 +Accepts.prototype.type =
83 +Accepts.prototype.types = function (types_) {
84 + var types = types_
85 +
86 + // support flattened arguments
87 + if (types && !Array.isArray(types)) {
88 + types = new Array(arguments.length)
89 + for (var i = 0; i < types.length; i++) {
90 + types[i] = arguments[i]
91 + }
92 + }
93 +
94 + // no types, return all requested types
95 + if (!types || types.length === 0) {
96 + return this.negotiator.mediaTypes()
97 + }
98 +
99 + // no accept header, return first given type
100 + if (!this.headers.accept) {
101 + return types[0]
102 + }
103 +
104 + var mimes = types.map(extToMime)
105 + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
106 + var first = accepts[0]
107 +
108 + return first
109 + ? types[mimes.indexOf(first)]
110 + : false
111 +}
112 +
113 +/**
114 + * Return accepted encodings or best fit based on `encodings`.
115 + *
116 + * Given `Accept-Encoding: gzip, deflate`
117 + * an array sorted by quality is returned:
118 + *
119 + * ['gzip', 'deflate']
120 + *
121 + * @param {String|Array} encodings...
122 + * @return {String|Array}
123 + * @public
124 + */
125 +
126 +Accepts.prototype.encoding =
127 +Accepts.prototype.encodings = function (encodings_) {
128 + var encodings = encodings_
129 +
130 + // support flattened arguments
131 + if (encodings && !Array.isArray(encodings)) {
132 + encodings = new Array(arguments.length)
133 + for (var i = 0; i < encodings.length; i++) {
134 + encodings[i] = arguments[i]
135 + }
136 + }
137 +
138 + // no encodings, return all requested encodings
139 + if (!encodings || encodings.length === 0) {
140 + return this.negotiator.encodings()
141 + }
142 +
143 + return this.negotiator.encodings(encodings)[0] || false
144 +}
145 +
146 +/**
147 + * Return accepted charsets or best fit based on `charsets`.
148 + *
149 + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
150 + * an array sorted by quality is returned:
151 + *
152 + * ['utf-8', 'utf-7', 'iso-8859-1']
153 + *
154 + * @param {String|Array} charsets...
155 + * @return {String|Array}
156 + * @public
157 + */
158 +
159 +Accepts.prototype.charset =
160 +Accepts.prototype.charsets = function (charsets_) {
161 + var charsets = charsets_
162 +
163 + // support flattened arguments
164 + if (charsets && !Array.isArray(charsets)) {
165 + charsets = new Array(arguments.length)
166 + for (var i = 0; i < charsets.length; i++) {
167 + charsets[i] = arguments[i]
168 + }
169 + }
170 +
171 + // no charsets, return all requested charsets
172 + if (!charsets || charsets.length === 0) {
173 + return this.negotiator.charsets()
174 + }
175 +
176 + return this.negotiator.charsets(charsets)[0] || false
177 +}
178 +
179 +/**
180 + * Return accepted languages or best fit based on `langs`.
181 + *
182 + * Given `Accept-Language: en;q=0.8, es, pt`
183 + * an array sorted by quality is returned:
184 + *
185 + * ['es', 'pt', 'en']
186 + *
187 + * @param {String|Array} langs...
188 + * @return {Array|String}
189 + * @public
190 + */
191 +
192 +Accepts.prototype.lang =
193 +Accepts.prototype.langs =
194 +Accepts.prototype.language =
195 +Accepts.prototype.languages = function (languages_) {
196 + var languages = languages_
197 +
198 + // support flattened arguments
199 + if (languages && !Array.isArray(languages)) {
200 + languages = new Array(arguments.length)
201 + for (var i = 0; i < languages.length; i++) {
202 + languages[i] = arguments[i]
203 + }
204 + }
205 +
206 + // no languages, return all requested languages
207 + if (!languages || languages.length === 0) {
208 + return this.negotiator.languages()
209 + }
210 +
211 + return this.negotiator.languages(languages)[0] || false
212 +}
213 +
214 +/**
215 + * Convert extnames to mime.
216 + *
217 + * @param {String} type
218 + * @return {String}
219 + * @private
220 + */
221 +
222 +function extToMime (type) {
223 + return type.indexOf('/') === -1
224 + ? mime.lookup(type)
225 + : type
226 +}
227 +
228 +/**
229 + * Check if mime is valid.
230 + *
231 + * @param {String} type
232 + * @return {String}
233 + * @private
234 + */
235 +
236 +function validMime (type) {
237 + return typeof type === 'string'
238 +}
1 +{
2 + "_from": "accepts@~1.3.5",
3 + "_id": "accepts@1.3.5",
4 + "_inBundle": false,
5 + "_integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
6 + "_location": "/accepts",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "accepts@~1.3.5",
12 + "name": "accepts",
13 + "escapedName": "accepts",
14 + "rawSpec": "~1.3.5",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.5"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
22 + "_shasum": "eb777df6011723a3b14e8a72c0805c8e86746bd2",
23 + "_spec": "accepts@~1.3.5",
24 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/express",
25 + "bugs": {
26 + "url": "https://github.com/jshttp/accepts/issues"
27 + },
28 + "bundleDependencies": false,
29 + "contributors": [
30 + {
31 + "name": "Douglas Christopher Wilson",
32 + "email": "doug@somethingdoug.com"
33 + },
34 + {
35 + "name": "Jonathan Ong",
36 + "email": "me@jongleberry.com",
37 + "url": "http://jongleberry.com"
38 + }
39 + ],
40 + "dependencies": {
41 + "mime-types": "~2.1.18",
42 + "negotiator": "0.6.1"
43 + },
44 + "deprecated": false,
45 + "description": "Higher-level content negotiation",
46 + "devDependencies": {
47 + "eslint": "4.18.1",
48 + "eslint-config-standard": "11.0.0",
49 + "eslint-plugin-import": "2.9.0",
50 + "eslint-plugin-markdown": "1.0.0-beta.6",
51 + "eslint-plugin-node": "6.0.1",
52 + "eslint-plugin-promise": "3.6.0",
53 + "eslint-plugin-standard": "3.0.1",
54 + "istanbul": "0.4.5",
55 + "mocha": "~1.21.5"
56 + },
57 + "engines": {
58 + "node": ">= 0.6"
59 + },
60 + "files": [
61 + "LICENSE",
62 + "HISTORY.md",
63 + "index.js"
64 + ],
65 + "homepage": "https://github.com/jshttp/accepts#readme",
66 + "keywords": [
67 + "content",
68 + "negotiation",
69 + "accept",
70 + "accepts"
71 + ],
72 + "license": "MIT",
73 + "name": "accepts",
74 + "repository": {
75 + "type": "git",
76 + "url": "git+https://github.com/jshttp/accepts.git"
77 + },
78 + "scripts": {
79 + "lint": "eslint --plugin markdown --ext js,md .",
80 + "test": "mocha --reporter spec --check-leaks --bail test/",
81 + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
82 + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
83 + },
84 + "version": "1.3.5"
85 +}
1 +Copyright (c) 2014 Forbes Lindesay
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
1 +# acorn-globals
2 +
3 +Detect global variables in JavaScript using acorn
4 +
5 +[![Build Status](https://img.shields.io/travis/ForbesLindesay/acorn-globals/master.svg)](https://travis-ci.org/ForbesLindesay/acorn-globals)
6 +[![Dependency Status](https://img.shields.io/david/ForbesLindesay/acorn-globals.svg)](https://david-dm.org/ForbesLindesay/acorn-globals)
7 +[![NPM version](https://img.shields.io/npm/v/acorn-globals.svg)](https://www.npmjs.org/package/acorn-globals)
8 +
9 +## Installation
10 +
11 + npm install acorn-globals
12 +
13 +## Usage
14 +
15 +detect.js
16 +
17 +```js
18 +var fs = require('fs');
19 +var detect = require('acorn-globals');
20 +
21 +var src = fs.readFileSync(__dirname + '/input.js', 'utf8');
22 +
23 +var scope = detect(src);
24 +console.dir(scope);
25 +```
26 +
27 +input.js
28 +
29 +```js
30 +var x = 5;
31 +var y = 3, z = 2;
32 +
33 +w.foo();
34 +w = 2;
35 +
36 +RAWR=444;
37 +RAWR.foo();
38 +
39 +BLARG=3;
40 +
41 +foo(function () {
42 + var BAR = 3;
43 + process.nextTick(function (ZZZZZZZZZZZZ) {
44 + console.log('beep boop');
45 + var xyz = 4;
46 + x += 10;
47 + x.zzzzzz;
48 + ZZZ=6;
49 + });
50 + function doom () {
51 + }
52 + ZZZ.foo();
53 +
54 +});
55 +
56 +console.log(xyz);
57 +```
58 +
59 +output:
60 +
61 +```
62 +$ node example/detect.js
63 +[ { name: 'BLARG', nodes: [ [Object] ] },
64 + { name: 'RAWR', nodes: [ [Object], [Object] ] },
65 + { name: 'ZZZ', nodes: [ [Object], [Object] ] },
66 + { name: 'console', nodes: [ [Object], [Object] ] },
67 + { name: 'foo', nodes: [ [Object] ] },
68 + { name: 'process', nodes: [ [Object] ] },
69 + { name: 'w', nodes: [ [Object], [Object] ] },
70 + { name: 'xyz', nodes: [ [Object] ] } ]
71 +```
72 +
73 +
74 +## License
75 +
76 + MIT
1 +'use strict';
2 +
3 +var acorn = require('acorn');
4 +var walk = require('acorn/dist/walk');
5 +
6 +function isScope(node) {
7 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunctionExpression' || node.type === 'Program';
8 +}
9 +function isBlockScope(node) {
10 + return node.type === 'BlockStatement' || isScope(node);
11 +}
12 +
13 +function declaresArguments(node) {
14 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';
15 +}
16 +
17 +function declaresThis(node) {
18 + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';
19 +}
20 +
21 +function reallyParse(source) {
22 + try {
23 + return acorn.parse(source, {
24 + ecmaVersion: 6,
25 + allowReturnOutsideFunction: true,
26 + allowImportExportEverywhere: true,
27 + allowHashBang: true
28 + });
29 + } catch (ex) {
30 + return acorn.parse(source, {
31 + ecmaVersion: 5,
32 + allowReturnOutsideFunction: true,
33 + allowImportExportEverywhere: true,
34 + allowHashBang: true
35 + });
36 + }
37 +}
38 +module.exports = findGlobals;
39 +module.exports.parse = reallyParse;
40 +function findGlobals(source) {
41 + var globals = [];
42 + var ast;
43 + // istanbul ignore else
44 + if (typeof source === 'string') {
45 + ast = reallyParse(source);
46 + } else {
47 + ast = source;
48 + }
49 + // istanbul ignore if
50 + if (!(ast && typeof ast === 'object' && ast.type === 'Program')) {
51 + throw new TypeError('Source must be either a string of JavaScript or an acorn AST');
52 + }
53 + var declareFunction = function (node) {
54 + var fn = node;
55 + fn.locals = fn.locals || {};
56 + node.params.forEach(function (node) {
57 + declarePattern(node, fn);
58 + });
59 + if (node.id) {
60 + fn.locals[node.id.name] = true;
61 + }
62 + }
63 + var declarePattern = function (node, parent) {
64 + switch (node.type) {
65 + case 'Identifier':
66 + parent.locals[node.name] = true;
67 + break;
68 + case 'ObjectPattern':
69 + node.properties.forEach(function (node) {
70 + declarePattern(node.value, parent);
71 + });
72 + break;
73 + case 'ArrayPattern':
74 + node.elements.forEach(function (node) {
75 + if (node) declarePattern(node, parent);
76 + });
77 + break;
78 + case 'RestElement':
79 + declarePattern(node.argument, parent);
80 + break;
81 + case 'AssignmentPattern':
82 + declarePattern(node.left, parent);
83 + break;
84 + // istanbul ignore next
85 + default:
86 + throw new Error('Unrecognized pattern type: ' + node.type);
87 + }
88 + }
89 + var declareModuleSpecifier = function (node, parents) {
90 + ast.locals = ast.locals || {};
91 + ast.locals[node.local.name] = true;
92 + }
93 + walk.ancestor(ast, {
94 + 'VariableDeclaration': function (node, parents) {
95 + var parent = null;
96 + for (var i = parents.length - 1; i >= 0 && parent === null; i--) {
97 + if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) {
98 + parent = parents[i];
99 + }
100 + }
101 + parent.locals = parent.locals || {};
102 + node.declarations.forEach(function (declaration) {
103 + declarePattern(declaration.id, parent);
104 + });
105 + },
106 + 'FunctionDeclaration': function (node, parents) {
107 + var parent = null;
108 + for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
109 + if (isScope(parents[i])) {
110 + parent = parents[i];
111 + }
112 + }
113 + parent.locals = parent.locals || {};
114 + parent.locals[node.id.name] = true;
115 + declareFunction(node);
116 + },
117 + 'Function': declareFunction,
118 + 'ClassDeclaration': function (node, parents) {
119 + var parent = null;
120 + for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
121 + if (isScope(parents[i])) {
122 + parent = parents[i];
123 + }
124 + }
125 + parent.locals = parent.locals || {};
126 + parent.locals[node.id.name] = true;
127 + },
128 + 'TryStatement': function (node) {
129 + if (node.handler === null) return;
130 + node.handler.body.locals = node.handler.body.locals || {};
131 + node.handler.body.locals[node.handler.param.name] = true;
132 + },
133 + 'ImportDefaultSpecifier': declareModuleSpecifier,
134 + 'ImportSpecifier': declareModuleSpecifier,
135 + 'ImportNamespaceSpecifier': declareModuleSpecifier
136 + });
137 + function identifier(node, parents) {
138 + var name = node.name;
139 + if (name === 'undefined') return;
140 + for (var i = 0; i < parents.length; i++) {
141 + if (name === 'arguments' && declaresArguments(parents[i])) {
142 + return;
143 + }
144 + if (parents[i].locals && name in parents[i].locals) {
145 + return;
146 + }
147 + }
148 + if (
149 + parents[parents.length - 2] &&
150 + parents[parents.length - 2].type === 'TryStatement' &&
151 + parents[parents.length - 2].handler &&
152 + node === parents[parents.length - 2].handler.param
153 + ) {
154 + return;
155 + }
156 + node.parents = parents;
157 + globals.push(node);
158 + }
159 + walk.ancestor(ast, {
160 + 'VariablePattern': identifier,
161 + 'Identifier': identifier,
162 + 'ThisExpression': function (node, parents) {
163 + for (var i = 0; i < parents.length; i++) {
164 + if (declaresThis(parents[i])) {
165 + return;
166 + }
167 + }
168 + node.parents = parents;
169 + globals.push(node);
170 + }
171 + });
172 + var groupedGlobals = {};
173 + globals.forEach(function (node) {
174 + groupedGlobals[node.name] = (groupedGlobals[node.name] || []);
175 + groupedGlobals[node.name].push(node);
176 + });
177 + return Object.keys(groupedGlobals).sort().map(function (name) {
178 + return {name: name, nodes: groupedGlobals[name]};
179 + });
180 +}
1 +{
2 + "_from": "acorn-globals@^1.0.3",
3 + "_id": "acorn-globals@1.0.9",
4 + "_inBundle": false,
5 + "_integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=",
6 + "_location": "/acorn-globals",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "acorn-globals@^1.0.3",
12 + "name": "acorn-globals",
13 + "escapedName": "acorn-globals",
14 + "rawSpec": "^1.0.3",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.0.3"
17 + },
18 + "_requiredBy": [
19 + "/with"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz",
22 + "_shasum": "55bb5e98691507b74579d0513413217c380c54cf",
23 + "_spec": "acorn-globals@^1.0.3",
24 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/with",
25 + "author": {
26 + "name": "ForbesLindesay"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/ForbesLindesay/acorn-globals/issues"
30 + },
31 + "bundleDependencies": false,
32 + "dependencies": {
33 + "acorn": "^2.1.0"
34 + },
35 + "deprecated": false,
36 + "description": "Detect global variables in JavaScript using acorn",
37 + "devDependencies": {
38 + "testit": "^2.0.2"
39 + },
40 + "files": [
41 + "index.js",
42 + "LICENSE"
43 + ],
44 + "homepage": "https://github.com/ForbesLindesay/acorn-globals#readme",
45 + "keywords": [
46 + "ast",
47 + "variable",
48 + "name",
49 + "lexical",
50 + "scope",
51 + "local",
52 + "global",
53 + "implicit"
54 + ],
55 + "license": "MIT",
56 + "name": "acorn-globals",
57 + "repository": {
58 + "type": "git",
59 + "url": "git+https://github.com/ForbesLindesay/acorn-globals.git"
60 + },
61 + "scripts": {
62 + "test": "node test"
63 + },
64 + "version": "1.0.9"
65 +}
1 +root = true
2 +
3 +[*]
4 +indent_style = space
5 +indent_size = 2
6 +end_of_line = lf
7 +insert_final_newline = true
1 +/.tern-port
2 +/test
3 +/local
1 +{
2 + "plugins": {
3 + "node": true,
4 + "es_modules": true
5 + }
6 +}
...\ No newline at end of file ...\ No newline at end of file
1 +language: node_js
2 +sudo: false
3 +node_js:
4 + - '0.10'
5 + - '0.12'
6 + - '4'
1 +List of Acorn contributors. Updated before every release.
2 +
3 +Adrian Rakovsky
4 +Alistair Braidwood
5 +Andres Suarez
6 +Aparajita Fishman
7 +Arian Stolwijk
8 +Artem Govorov
9 +Brandon Mills
10 +Charles Hughes
11 +Conrad Irwin
12 +David Bonnet
13 +ForbesLindesay
14 +Forbes Lindesay
15 +Gilad Peleg
16 +impinball
17 +Ingvar Stepanyan
18 +Jesse McCarthy
19 +Jiaxing Wang
20 +Joel Kemp
21 +Johannes Herr
22 +Jürg Lehni
23 +keeyipchan
24 +Kevin Kwok
25 +krator
26 +Marijn Haverbeke
27 +Martin Carlberg
28 +Mathias Bynens
29 +Mathieu 'p01' Henri
30 +Max Schaefer
31 +Max Zerzouri
32 +Mihai Bazon
33 +Mike Rennie
34 +Nick Fitzgerald
35 +Oskar Schöldström
36 +Paul Harper
37 +Peter Rust
38 +PlNG
39 +r-e-d
40 +Rich Harris
41 +Sebastian McKenzie
42 +Timothy Gu
43 +zsjforcn
1 +Copyright (C) 2012-2014 by various contributors (see AUTHORS)
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +#!/usr/bin/env node
2 +"use strict";
3 +
4 +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
5 +
6 +var _path = require("path");
7 +
8 +var _fs = require("fs");
9 +
10 +var _distAcornJs = require("../dist/acorn.js");
11 +
12 +var acorn = _interopRequireWildcard(_distAcornJs);
13 +
14 +var infile = undefined,
15 + forceFile = undefined,
16 + silent = false,
17 + compact = false,
18 + tokenize = false;
19 +var options = {};
20 +
21 +function help(status) {
22 + var print = status == 0 ? console.log : console.error;
23 + print("usage: " + (0, _path.basename)(process.argv[1]) + " [--ecma3|--ecma5|--ecma6]");
24 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
25 + process.exit(status);
26 +}
27 +
28 +for (var i = 2; i < process.argv.length; ++i) {
29 + var arg = process.argv[i];
30 + if ((arg == "-" || arg[0] != "-") && !infile) infile = arg;else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i];else if (arg == "--ecma3") options.ecmaVersion = 3;else if (arg == "--ecma5") options.ecmaVersion = 5;else if (arg == "--ecma6") options.ecmaVersion = 6;else if (arg == "--locations") options.locations = true;else if (arg == "--allow-hash-bang") options.allowHashBang = true;else if (arg == "--silent") silent = true;else if (arg == "--compact") compact = true;else if (arg == "--help") help(0);else if (arg == "--tokenize") tokenize = true;else if (arg == "--module") options.sourceType = 'module';else help(1);
31 +}
32 +
33 +function run(code) {
34 + var result = undefined;
35 + if (!tokenize) {
36 + try {
37 + result = acorn.parse(code, options);
38 + } catch (e) {
39 + console.error(e.message);process.exit(1);
40 + }
41 + } else {
42 + result = [];
43 + var tokenizer = acorn.tokenizer(code, options),
44 + token = undefined;
45 + while (true) {
46 + try {
47 + token = tokenizer.getToken();
48 + } catch (e) {
49 + console.error(e.message);process.exit(1);
50 + }
51 + result.push(token);
52 + if (token.type == acorn.tokTypes.eof) break;
53 + }
54 + }
55 + if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2));
56 +}
57 +
58 +if (forceFile || infile && infile != "-") {
59 + run((0, _fs.readFileSync)(infile, "utf8"));
60 +} else {
61 + (function () {
62 + var code = "";
63 + process.stdin.resume();
64 + process.stdin.on("data", function (chunk) {
65 + return code += chunk;
66 + });
67 + process.stdin.on("end", function () {
68 + return run(code);
69 + });
70 + })();
71 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var fs = require("fs"), path = require("path")
2 +var stream = require("stream")
3 +
4 +var browserify = require("browserify")
5 +var babel = require('babel-core')
6 +var babelify = require("babelify").configure({loose: "all"})
7 +
8 +process.chdir(path.resolve(__dirname, ".."))
9 +
10 +browserify({standalone: "acorn"})
11 + .plugin(require('browserify-derequire'))
12 + .transform(babelify)
13 + .require("./src/index.js", {entry: true})
14 + .bundle()
15 + .on("error", function (err) { console.log("Error: " + err.message) })
16 + .pipe(fs.createWriteStream("dist/acorn.js"))
17 +
18 +var ACORN_PLACEHOLDER = "this_function_call_should_be_replaced_with_a_call_to_load_acorn()";
19 +function acornShimPrepare(file) {
20 + var tr = new stream.Transform
21 + if (file == path.resolve(__dirname, "../src/index.js")) {
22 + var sent = false
23 + tr._transform = function(chunk, _, callback) {
24 + if (!sent) {
25 + sent = true
26 + callback(null, ACORN_PLACEHOLDER);
27 + } else {
28 + callback()
29 + }
30 + }
31 + } else {
32 + tr._transform = function(chunk, _, callback) { callback(null, chunk) }
33 + }
34 + return tr
35 +}
36 +function acornShimComplete() {
37 + var tr = new stream.Transform
38 + var buffer = "";
39 + tr._transform = function(chunk, _, callback) {
40 + buffer += chunk.toString("utf8");
41 + callback();
42 + };
43 + tr._flush = function (callback) {
44 + tr.push(buffer.replace(ACORN_PLACEHOLDER, "module.exports = typeof acorn != 'undefined' ? acorn : require(\"./acorn\")"));
45 + callback(null);
46 + };
47 + return tr;
48 +}
49 +
50 +browserify({standalone: "acorn.loose"})
51 + .plugin(require('browserify-derequire'))
52 + .transform(acornShimPrepare)
53 + .transform(babelify)
54 + .require("./src/loose/index.js", {entry: true})
55 + .bundle()
56 + .on("error", function (err) { console.log("Error: " + err.message) })
57 + .pipe(acornShimComplete())
58 + .pipe(fs.createWriteStream("dist/acorn_loose.js"))
59 +
60 +browserify({standalone: "acorn.walk"})
61 + .plugin(require('browserify-derequire'))
62 + .transform(acornShimPrepare)
63 + .transform(babelify)
64 + .require("./src/walk/index.js", {entry: true})
65 + .bundle()
66 + .on("error", function (err) { console.log("Error: " + err.message) })
67 + .pipe(acornShimComplete())
68 + .pipe(fs.createWriteStream("dist/walk.js"))
69 +
70 +babel.transformFile("./src/bin/acorn.js", function (err, result) {
71 + if (err) return console.log("Error: " + err.message)
72 + fs.writeFile("bin/acorn", result.code, function (err) {
73 + if (err) return console.log("Error: " + err.message)
74 +
75 + // Make bin/acorn executable
76 + if (process.platform === 'win32')
77 + return
78 + var stat = fs.statSync("bin/acorn")
79 + var newPerm = stat.mode | parseInt('111', 8)
80 + fs.chmodSync("bin/acorn", newPerm)
81 + })
82 +})
1 +// Note: run `npm install unicode-7.0.0` first.
2 +
3 +// Which Unicode version should be used?
4 +var version = '7.0.0';
5 +
6 +var start = require('unicode-' + version + '/properties/ID_Start/code-points')
7 + .filter(function(ch) { return ch > 127; });
8 +var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/properties/ID_Continue/code-points')
9 + .filter(function(ch) { return ch > 127 && start.indexOf(ch) == -1; }));
10 +
11 +function pad(str, width) {
12 + while (str.length < width) str = "0" + str;
13 + return str;
14 +}
15 +
16 +function esc(code) {
17 + var hex = code.toString(16);
18 + if (hex.length <= 2) return "\\x" + pad(hex, 2);
19 + else return "\\u" + pad(hex, 4);
20 +}
21 +
22 +function generate(chars) {
23 + var astral = [], re = "";
24 + for (var i = 0, at = 0x10000; i < chars.length; i++) {
25 + var from = chars[i], to = from;
26 + while (i < chars.length - 1 && chars[i + 1] == to + 1) {
27 + i++;
28 + to++;
29 + }
30 + if (to <= 0xffff) {
31 + if (from == to) re += esc(from);
32 + else if (from + 1 == to) re += esc(from) + esc(to);
33 + else re += esc(from) + "-" + esc(to);
34 + } else {
35 + astral.push(from - at, to - from);
36 + at = to;
37 + }
38 + }
39 + return {nonASCII: re, astral: astral};
40 +}
41 +
42 +var startData = generate(start), contData = generate(cont);
43 +
44 +console.log(" var nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";");
45 +console.log(" var nonASCIIidentifierChars = \"" + contData.nonASCII + "\";");
46 +console.log(" var astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";");
47 +console.log(" var astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";");
1 +# Combine existing list of authors with everyone known in git, sort, add header.
2 +tail --lines=+3 AUTHORS > AUTHORS.tmp
3 +git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp
4 +echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS
5 +sort -u AUTHORS.tmp >> AUTHORS
6 +rm -f AUTHORS.tmp
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "acorn@^2.1.0",
3 + "_id": "acorn@2.7.0",
4 + "_inBundle": false,
5 + "_integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=",
6 + "_location": "/acorn",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "acorn@^2.1.0",
12 + "name": "acorn",
13 + "escapedName": "acorn",
14 + "rawSpec": "^2.1.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^2.1.0"
17 + },
18 + "_requiredBy": [
19 + "/acorn-globals",
20 + "/constantinople"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
23 + "_shasum": "ab6e7d9d886aaca8b085bc3312b79a198433f0e7",
24 + "_spec": "acorn@^2.1.0",
25 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/constantinople",
26 + "bin": {
27 + "acorn": "./bin/acorn"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/ternjs/acorn/issues"
31 + },
32 + "bundleDependencies": false,
33 + "contributors": [
34 + {
35 + "name": "List of Acorn contributors. Updated before every release."
36 + },
37 + {
38 + "name": "Adrian Rakovsky"
39 + },
40 + {
41 + "name": "Alistair Braidwood"
42 + },
43 + {
44 + "name": "Andres Suarez"
45 + },
46 + {
47 + "name": "Aparajita Fishman"
48 + },
49 + {
50 + "name": "Arian Stolwijk"
51 + },
52 + {
53 + "name": "Artem Govorov"
54 + },
55 + {
56 + "name": "Brandon Mills"
57 + },
58 + {
59 + "name": "Charles Hughes"
60 + },
61 + {
62 + "name": "Conrad Irwin"
63 + },
64 + {
65 + "name": "David Bonnet"
66 + },
67 + {
68 + "name": "ForbesLindesay"
69 + },
70 + {
71 + "name": "Forbes Lindesay"
72 + },
73 + {
74 + "name": "Gilad Peleg"
75 + },
76 + {
77 + "name": "impinball"
78 + },
79 + {
80 + "name": "Ingvar Stepanyan"
81 + },
82 + {
83 + "name": "Jesse McCarthy"
84 + },
85 + {
86 + "name": "Jiaxing Wang"
87 + },
88 + {
89 + "name": "Joel Kemp"
90 + },
91 + {
92 + "name": "Johannes Herr"
93 + },
94 + {
95 + "name": "Jürg Lehni"
96 + },
97 + {
98 + "name": "keeyipchan"
99 + },
100 + {
101 + "name": "Kevin Kwok"
102 + },
103 + {
104 + "name": "krator"
105 + },
106 + {
107 + "name": "Marijn Haverbeke"
108 + },
109 + {
110 + "name": "Martin Carlberg"
111 + },
112 + {
113 + "name": "Mathias Bynens"
114 + },
115 + {
116 + "name": "Mathieu 'p01' Henri"
117 + },
118 + {
119 + "name": "Max Schaefer"
120 + },
121 + {
122 + "name": "Max Zerzouri"
123 + },
124 + {
125 + "name": "Mihai Bazon"
126 + },
127 + {
128 + "name": "Mike Rennie"
129 + },
130 + {
131 + "name": "Nick Fitzgerald"
132 + },
133 + {
134 + "name": "Oskar Schöldström"
135 + },
136 + {
137 + "name": "Paul Harper"
138 + },
139 + {
140 + "name": "Peter Rust"
141 + },
142 + {
143 + "name": "PlNG"
144 + },
145 + {
146 + "name": "r-e-d"
147 + },
148 + {
149 + "name": "Rich Harris"
150 + },
151 + {
152 + "name": "Sebastian McKenzie"
153 + },
154 + {
155 + "name": "Timothy Gu"
156 + },
157 + {
158 + "name": "zsjforcn"
159 + }
160 + ],
161 + "deprecated": false,
162 + "description": "ECMAScript parser",
163 + "devDependencies": {
164 + "babel-core": "^5.6.15",
165 + "babelify": "^6.1.2",
166 + "browserify": "^10.2.4",
167 + "browserify-derequire": "^0.9.4",
168 + "unicode-7.0.0": "~0.1.5"
169 + },
170 + "engines": {
171 + "node": ">=0.4.0"
172 + },
173 + "homepage": "https://github.com/ternjs/acorn",
174 + "license": "MIT",
175 + "main": "dist/acorn.js",
176 + "maintainers": [
177 + {
178 + "name": "Marijn Haverbeke",
179 + "email": "marijnh@gmail.com",
180 + "url": "http://marijnhaverbeke.nl"
181 + },
182 + {
183 + "name": "Ingvar Stepanyan",
184 + "email": "me@rreverser.com",
185 + "url": "http://rreverser.com/"
186 + }
187 + ],
188 + "name": "acorn",
189 + "repository": {
190 + "type": "git",
191 + "url": "git+https://github.com/ternjs/acorn.git"
192 + },
193 + "scripts": {
194 + "prepublish": "node bin/build-acorn.js",
195 + "test": "node test/run.js"
196 + },
197 + "version": "2.7.0"
198 +}
1 +#!/usr/bin/env node
2 +
3 +import {basename} from "path"
4 +import {readFileSync as readFile} from "fs"
5 +import * as acorn from "../dist/acorn.js"
6 +
7 +let infile, forceFile, silent = false, compact = false, tokenize = false
8 +const options = {}
9 +
10 +function help(status) {
11 + const print = (status == 0) ? console.log : console.error
12 + print("usage: " + basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6]")
13 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]")
14 + process.exit(status)
15 +}
16 +
17 +for (let i = 2; i < process.argv.length; ++i) {
18 + const arg = process.argv[i]
19 + if ((arg == "-" || arg[0] != "-") && !infile) infile = arg
20 + else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i]
21 + else if (arg == "--ecma3") options.ecmaVersion = 3
22 + else if (arg == "--ecma5") options.ecmaVersion = 5
23 + else if (arg == "--ecma6") options.ecmaVersion = 6
24 + else if (arg == "--locations") options.locations = true
25 + else if (arg == "--allow-hash-bang") options.allowHashBang = true
26 + else if (arg == "--silent") silent = true
27 + else if (arg == "--compact") compact = true
28 + else if (arg == "--help") help(0)
29 + else if (arg == "--tokenize") tokenize = true
30 + else if (arg == "--module") options.sourceType = 'module'
31 + else help(1)
32 +}
33 +
34 +function run(code) {
35 + let result
36 + if (!tokenize) {
37 + try { result = acorn.parse(code, options) }
38 + catch(e) { console.error(e.message); process.exit(1) }
39 + } else {
40 + result = []
41 + let tokenizer = acorn.tokenizer(code, options), token
42 + while (true) {
43 + try { token = tokenizer.getToken() }
44 + catch(e) { console.error(e.message); process.exit(1) }
45 + result.push(token)
46 + if (token.type == acorn.tokTypes.eof) break
47 + }
48 + }
49 + if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
50 +}
51 +
52 +if (forceFile || infile && infile != "-") {
53 + run(readFile(infile, "utf8"))
54 +} else {
55 + let code = ""
56 + process.stdin.resume()
57 + process.stdin.on("data", chunk => code += chunk)
58 + process.stdin.on("end", () => run(code))
59 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +// Acorn is a tiny, fast JavaScript parser written in JavaScript.
2 +//
3 +// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
4 +// various contributors and released under an MIT license.
5 +//
6 +// Git repositories for Acorn are available at
7 +//
8 +// http://marijnhaverbeke.nl/git/acorn
9 +// https://github.com/ternjs/acorn.git
10 +//
11 +// Please use the [github bug tracker][ghbt] to report issues.
12 +//
13 +// [ghbt]: https://github.com/ternjs/acorn/issues
14 +//
15 +// This file defines the main parser interface. The library also comes
16 +// with a [error-tolerant parser][dammit] and an
17 +// [abstract syntax tree walker][walk], defined in other files.
18 +//
19 +// [dammit]: acorn_loose.js
20 +// [walk]: util/walk.js
21 +
22 +import {Parser} from "./state"
23 +import "./parseutil"
24 +import "./statement"
25 +import "./lval"
26 +import "./expression"
27 +import "./location"
28 +
29 +export {Parser, plugins} from "./state"
30 +export {defaultOptions} from "./options"
31 +export {Position, SourceLocation, getLineInfo} from "./locutil"
32 +export {Node} from "./node"
33 +export {TokenType, types as tokTypes} from "./tokentype"
34 +export {TokContext, types as tokContexts} from "./tokencontext"
35 +export {isIdentifierChar, isIdentifierStart} from "./identifier"
36 +export {Token} from "./tokenize"
37 +export {isNewLine, lineBreak, lineBreakG} from "./whitespace"
38 +
39 +export const version = "2.7.0"
40 +
41 +// The main exported interface (under `self.acorn` when in the
42 +// browser) is a `parse` function that takes a code string and
43 +// returns an abstract syntax tree as specified by [Mozilla parser
44 +// API][api].
45 +//
46 +// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
47 +
48 +export function parse(input, options) {
49 + return new Parser(options, input).parse()
50 +}
51 +
52 +// This function tries to parse a single expression at a given
53 +// offset in a string. Useful for parsing mixed-language formats
54 +// that embed JavaScript expressions.
55 +
56 +export function parseExpressionAt(input, pos, options) {
57 + let p = new Parser(options, input, pos)
58 + p.nextToken()
59 + return p.parseExpression()
60 +}
61 +
62 +// Acorn is organized as a tokenizer and a recursive-descent parser.
63 +// The `tokenizer` export provides an interface to the tokenizer.
64 +
65 +export function tokenizer(input, options) {
66 + return new Parser(options, input)
67 +}
1 +import {Parser} from "./state"
2 +import {Position, getLineInfo} from "./locutil"
3 +
4 +const pp = Parser.prototype
5 +
6 +// This function is used to raise exceptions on parse errors. It
7 +// takes an offset integer (into the current `input`) to indicate
8 +// the location of the error, attaches the position to the end
9 +// of the error message, and then raises a `SyntaxError` with that
10 +// message.
11 +
12 +pp.raise = function(pos, message) {
13 + let loc = getLineInfo(this.input, pos)
14 + message += " (" + loc.line + ":" + loc.column + ")"
15 + let err = new SyntaxError(message)
16 + err.pos = pos; err.loc = loc; err.raisedAt = this.pos
17 + throw err
18 +}
19 +
20 +pp.curPosition = function() {
21 + if (this.options.locations) {
22 + return new Position(this.curLine, this.pos - this.lineStart)
23 + }
24 +}
1 +import {lineBreakG} from "./whitespace"
2 +
3 +// These are used when `options.locations` is on, for the
4 +// `startLoc` and `endLoc` properties.
5 +
6 +export class Position {
7 + constructor(line, col) {
8 + this.line = line
9 + this.column = col
10 + }
11 +
12 + offset(n) {
13 + return new Position(this.line, this.column + n)
14 + }
15 +}
16 +
17 +export class SourceLocation {
18 + constructor(p, start, end) {
19 + this.start = start
20 + this.end = end
21 + if (p.sourceFile !== null) this.source = p.sourceFile
22 + }
23 +}
24 +
25 +// The `getLineInfo` function is mostly useful when the
26 +// `locations` option is off (for performance reasons) and you
27 +// want to find the line/column position for a given character
28 +// offset. `input` should be the code string that the offset refers
29 +// into.
30 +
31 +export function getLineInfo(input, offset) {
32 + for (let line = 1, cur = 0;;) {
33 + lineBreakG.lastIndex = cur
34 + let match = lineBreakG.exec(input)
35 + if (match && match.index < offset) {
36 + ++line
37 + cur = match.index + match[0].length
38 + } else {
39 + return new Position(line, offset - cur)
40 + }
41 + }
42 +}
This diff is collapsed. Click to expand it.
1 +// Acorn: Loose parser
2 +//
3 +// This module provides an alternative parser (`parse_dammit`) that
4 +// exposes that same interface as `parse`, but will try to parse
5 +// anything as JavaScript, repairing syntax error the best it can.
6 +// There are circumstances in which it will raise an error and give
7 +// up, but they are very rare. The resulting AST will be a mostly
8 +// valid JavaScript AST (as per the [Mozilla parser API][api], except
9 +// that:
10 +//
11 +// - Return outside functions is allowed
12 +//
13 +// - Label consistency (no conflicts, break only to existing labels)
14 +// is not enforced.
15 +//
16 +// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
17 +// the parser got too confused to return anything meaningful.
18 +//
19 +// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
20 +//
21 +// The expected use for this is to *first* try `acorn.parse`, and only
22 +// if that fails switch to `parse_dammit`. The loose parser might
23 +// parse badly indented code incorrectly, so **don't** use it as
24 +// your default parser.
25 +//
26 +// Quite a lot of acorn.js is duplicated here. The alternative was to
27 +// add a *lot* of extra cruft to that file, making it less readable
28 +// and slower. Copying and editing the code allowed me to make
29 +// invasive changes and simplifications without creating a complicated
30 +// tangle.
31 +
32 +import * as acorn from ".."
33 +import {LooseParser, pluginsLoose} from "./state"
34 +import "./tokenize"
35 +import "./statement"
36 +import "./expression"
37 +
38 +export {LooseParser, pluginsLoose} from "./state"
39 +
40 +acorn.defaultOptions.tabSize = 4
41 +
42 +export function parse_dammit(input, options) {
43 + let p = new LooseParser(input, options)
44 + p.next()
45 + return p.parseTopLevel()
46 +}
47 +
48 +acorn.parse_dammit = parse_dammit
49 +acorn.LooseParser = LooseParser
50 +acorn.pluginsLoose = pluginsLoose
1 +export function isDummy(node) { return node.name == "✖" }
...\ No newline at end of file ...\ No newline at end of file
1 +import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} from ".."
2 +
3 +// Registered plugins
4 +export const pluginsLoose = {}
5 +
6 +export class LooseParser {
7 + constructor(input, options) {
8 + this.toks = tokenizer(input, options)
9 + this.options = this.toks.options
10 + this.input = this.toks.input
11 + this.tok = this.last = {type: tt.eof, start: 0, end: 0}
12 + if (this.options.locations) {
13 + let here = this.toks.curPosition()
14 + this.tok.loc = new SourceLocation(this.toks, here, here)
15 + }
16 + this.ahead = []; // Tokens ahead
17 + this.context = []; // Indentation contexted
18 + this.curIndent = 0
19 + this.curLineStart = 0
20 + this.nextLineStart = this.lineEnd(this.curLineStart) + 1
21 + // Load plugins
22 + this.options.pluginsLoose = options.pluginsLoose || {}
23 + this.loadPlugins(this.options.pluginsLoose)
24 + }
25 +
26 + startNode() {
27 + return new Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
28 + }
29 +
30 + storeCurrentPos() {
31 + return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
32 + }
33 +
34 + startNodeAt(pos) {
35 + if (this.options.locations) {
36 + return new Node(this.toks, pos[0], pos[1])
37 + } else {
38 + return new Node(this.toks, pos)
39 + }
40 + }
41 +
42 + finishNode(node, type) {
43 + node.type = type
44 + node.end = this.last.end
45 + if (this.options.locations)
46 + node.loc.end = this.last.loc.end
47 + if (this.options.ranges)
48 + node.range[1] = this.last.end
49 + return node
50 + }
51 +
52 + dummyNode(type) {
53 + let dummy = this.startNode()
54 + dummy.type = type
55 + dummy.end = dummy.start
56 + if (this.options.locations)
57 + dummy.loc.end = dummy.loc.start
58 + if (this.options.ranges)
59 + dummy.range[1] = dummy.start
60 + this.last = {type: tt.name, start: dummy.start, end: dummy.start, loc: dummy.loc}
61 + return dummy
62 + }
63 +
64 + dummyIdent() {
65 + let dummy = this.dummyNode("Identifier")
66 + dummy.name = "✖"
67 + return dummy
68 + }
69 +
70 + dummyString() {
71 + let dummy = this.dummyNode("Literal")
72 + dummy.value = dummy.raw = "✖"
73 + return dummy
74 + }
75 +
76 + eat(type) {
77 + if (this.tok.type === type) {
78 + this.next()
79 + return true
80 + } else {
81 + return false
82 + }
83 + }
84 +
85 + isContextual(name) {
86 + return this.tok.type === tt.name && this.tok.value === name
87 + }
88 +
89 + eatContextual(name) {
90 + return this.tok.value === name && this.eat(tt.name)
91 + }
92 +
93 + canInsertSemicolon() {
94 + return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
95 + lineBreak.test(this.input.slice(this.last.end, this.tok.start))
96 + }
97 +
98 + semicolon() {
99 + return this.eat(tt.semi)
100 + }
101 +
102 + expect(type) {
103 + if (this.eat(type)) return true
104 + for (let i = 1; i <= 2; i++) {
105 + if (this.lookAhead(i).type == type) {
106 + for (let j = 0; j < i; j++) this.next()
107 + return true
108 + }
109 + }
110 + }
111 +
112 + pushCx() {
113 + this.context.push(this.curIndent)
114 + }
115 +
116 + popCx() {
117 + this.curIndent = this.context.pop()
118 + }
119 +
120 + lineEnd(pos) {
121 + while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) ++pos
122 + return pos
123 + }
124 +
125 + indentationAfter(pos) {
126 + for (let count = 0;; ++pos) {
127 + let ch = this.input.charCodeAt(pos)
128 + if (ch === 32) ++count
129 + else if (ch === 9) count += this.options.tabSize
130 + else return count
131 + }
132 + }
133 +
134 + closes(closeTok, indent, line, blockHeuristic) {
135 + if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
136 + return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
137 + (!blockHeuristic || this.nextLineStart >= this.input.length ||
138 + this.indentationAfter(this.nextLineStart) < indent)
139 + }
140 +
141 + tokenStartsLine() {
142 + for (let p = this.tok.start - 1; p >= this.curLineStart; --p) {
143 + let ch = this.input.charCodeAt(p)
144 + if (ch !== 9 && ch !== 32) return false
145 + }
146 + return true
147 + }
148 +
149 + extend(name, f) {
150 + this[name] = f(this[name])
151 + }
152 +
153 + loadPlugins(pluginConfigs) {
154 + for (let name in pluginConfigs) {
155 + let plugin = pluginsLoose[name]
156 + if (!plugin) throw new Error("Plugin '" + name + "' not found")
157 + plugin(this, pluginConfigs[name])
158 + }
159 + }
160 +}
This diff is collapsed. Click to expand it.
1 +import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from ".."
2 +import {LooseParser} from "./state"
3 +
4 +const lp = LooseParser.prototype
5 +
6 +function isSpace(ch) {
7 + return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
8 +}
9 +
10 +lp.next = function() {
11 + this.last = this.tok
12 + if (this.ahead.length)
13 + this.tok = this.ahead.shift()
14 + else
15 + this.tok = this.readToken()
16 +
17 + if (this.tok.start >= this.nextLineStart) {
18 + while (this.tok.start >= this.nextLineStart) {
19 + this.curLineStart = this.nextLineStart
20 + this.nextLineStart = this.lineEnd(this.curLineStart) + 1
21 + }
22 + this.curIndent = this.indentationAfter(this.curLineStart)
23 + }
24 +}
25 +
26 +lp.readToken = function() {
27 + for (;;) {
28 + try {
29 + this.toks.next()
30 + if (this.toks.type === tt.dot &&
31 + this.input.substr(this.toks.end, 1) === "." &&
32 + this.options.ecmaVersion >= 6) {
33 + this.toks.end++
34 + this.toks.type = tt.ellipsis
35 + }
36 + return new Token(this.toks)
37 + } catch(e) {
38 + if (!(e instanceof SyntaxError)) throw e
39 +
40 + // Try to skip some text, based on the error message, and then continue
41 + let msg = e.message, pos = e.raisedAt, replace = true
42 + if (/unterminated/i.test(msg)) {
43 + pos = this.lineEnd(e.pos + 1)
44 + if (/string/.test(msg)) {
45 + replace = {start: e.pos, end: pos, type: tt.string, value: this.input.slice(e.pos + 1, pos)}
46 + } else if (/regular expr/i.test(msg)) {
47 + let re = this.input.slice(e.pos, pos)
48 + try { re = new RegExp(re) } catch(e) {}
49 + replace = {start: e.pos, end: pos, type: tt.regexp, value: re}
50 + } else if (/template/.test(msg)) {
51 + replace = {start: e.pos, end: pos,
52 + type: tt.template,
53 + value: this.input.slice(e.pos, pos)}
54 + } else {
55 + replace = false
56 + }
57 + } else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
58 + while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos
59 + } else if (/character escape|expected hexadecimal/i.test(msg)) {
60 + while (pos < this.input.length) {
61 + let ch = this.input.charCodeAt(pos++)
62 + if (ch === 34 || ch === 39 || isNewLine(ch)) break
63 + }
64 + } else if (/unexpected character/i.test(msg)) {
65 + pos++
66 + replace = false
67 + } else if (/regular expression/i.test(msg)) {
68 + replace = true
69 + } else {
70 + throw e
71 + }
72 + this.resetTo(pos)
73 + if (replace === true) replace = {start: pos, end: pos, type: tt.name, value: "✖"}
74 + if (replace) {
75 + if (this.options.locations)
76 + replace.loc = new SourceLocation(
77 + this.toks,
78 + getLineInfo(this.input, replace.start),
79 + getLineInfo(this.input, replace.end))
80 + return replace
81 + }
82 + }
83 + }
84 +}
85 +
86 +lp.resetTo = function(pos) {
87 + this.toks.pos = pos
88 + let ch = this.input.charAt(pos - 1)
89 + this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
90 + /[enwfd]/.test(ch) &&
91 + /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
92 +
93 + if (this.options.locations) {
94 + this.toks.curLine = 1
95 + this.toks.lineStart = lineBreakG.lastIndex = 0
96 + let match
97 + while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
98 + ++this.toks.curLine
99 + this.toks.lineStart = match.index + match[0].length
100 + }
101 + }
102 +}
103 +
104 +lp.lookAhead = function(n) {
105 + while (n > this.ahead.length)
106 + this.ahead.push(this.readToken())
107 + return this.ahead[n - 1]
108 +}
1 +import {types as tt} from "./tokentype"
2 +import {Parser} from "./state"
3 +import {has} from "./util"
4 +
5 +const pp = Parser.prototype
6 +
7 +// Convert existing expression atom to assignable pattern
8 +// if possible.
9 +
10 +pp.toAssignable = function(node, isBinding) {
11 + if (this.options.ecmaVersion >= 6 && node) {
12 + switch (node.type) {
13 + case "Identifier":
14 + case "ObjectPattern":
15 + case "ArrayPattern":
16 + break
17 +
18 + case "ObjectExpression":
19 + node.type = "ObjectPattern"
20 + for (let i = 0; i < node.properties.length; i++) {
21 + let prop = node.properties[i]
22 + if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter")
23 + this.toAssignable(prop.value, isBinding)
24 + }
25 + break
26 +
27 + case "ArrayExpression":
28 + node.type = "ArrayPattern"
29 + this.toAssignableList(node.elements, isBinding)
30 + break
31 +
32 + case "AssignmentExpression":
33 + if (node.operator === "=") {
34 + node.type = "AssignmentPattern"
35 + delete node.operator
36 + // falls through to AssignmentPattern
37 + } else {
38 + this.raise(node.left.end, "Only '=' operator can be used for specifying default value.")
39 + break;
40 + }
41 +
42 + case "AssignmentPattern":
43 + if (node.right.type === "YieldExpression")
44 + this.raise(node.right.start, "Yield expression cannot be a default value")
45 + break;
46 +
47 + case "ParenthesizedExpression":
48 + node.expression = this.toAssignable(node.expression, isBinding)
49 + break
50 +
51 + case "MemberExpression":
52 + if (!isBinding) break
53 +
54 + default:
55 + this.raise(node.start, "Assigning to rvalue")
56 + }
57 + }
58 + return node
59 +}
60 +
61 +// Convert list of expression atoms to binding list.
62 +
63 +pp.toAssignableList = function(exprList, isBinding) {
64 + let end = exprList.length
65 + if (end) {
66 + let last = exprList[end - 1]
67 + if (last && last.type == "RestElement") {
68 + --end
69 + } else if (last && last.type == "SpreadElement") {
70 + last.type = "RestElement"
71 + let arg = last.argument
72 + this.toAssignable(arg, isBinding)
73 + if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern")
74 + this.unexpected(arg.start)
75 + --end
76 + }
77 +
78 + if (isBinding && last.type === "RestElement" && last.argument.type !== "Identifier")
79 + this.unexpected(last.argument.start);
80 + }
81 + for (let i = 0; i < end; i++) {
82 + let elt = exprList[i]
83 + if (elt) this.toAssignable(elt, isBinding)
84 + }
85 + return exprList
86 +}
87 +
88 +// Parses spread element.
89 +
90 +pp.parseSpread = function(refDestructuringErrors) {
91 + let node = this.startNode()
92 + this.next()
93 + node.argument = this.parseMaybeAssign(refDestructuringErrors)
94 + return this.finishNode(node, "SpreadElement")
95 +}
96 +
97 +pp.parseRest = function(allowNonIdent) {
98 + let node = this.startNode()
99 + this.next()
100 +
101 + // RestElement inside of a function parameter must be an identifier
102 + if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()
103 + else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()
104 +
105 + return this.finishNode(node, "RestElement")
106 +}
107 +
108 +// Parses lvalue (assignable) atom.
109 +
110 +pp.parseBindingAtom = function() {
111 + if (this.options.ecmaVersion < 6) return this.parseIdent()
112 + switch (this.type) {
113 + case tt.name:
114 + return this.parseIdent()
115 +
116 + case tt.bracketL:
117 + let node = this.startNode()
118 + this.next()
119 + node.elements = this.parseBindingList(tt.bracketR, true, true)
120 + return this.finishNode(node, "ArrayPattern")
121 +
122 + case tt.braceL:
123 + return this.parseObj(true)
124 +
125 + default:
126 + this.unexpected()
127 + }
128 +}
129 +
130 +pp.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {
131 + let elts = [], first = true
132 + while (!this.eat(close)) {
133 + if (first) first = false
134 + else this.expect(tt.comma)
135 + if (allowEmpty && this.type === tt.comma) {
136 + elts.push(null)
137 + } else if (allowTrailingComma && this.afterTrailingComma(close)) {
138 + break
139 + } else if (this.type === tt.ellipsis) {
140 + let rest = this.parseRest(allowNonIdent)
141 + this.parseBindingListItem(rest)
142 + elts.push(rest)
143 + this.expect(close)
144 + break
145 + } else {
146 + let elem = this.parseMaybeDefault(this.start, this.startLoc)
147 + this.parseBindingListItem(elem)
148 + elts.push(elem)
149 + }
150 + }
151 + return elts
152 +}
153 +
154 +pp.parseBindingListItem = function(param) {
155 + return param
156 +}
157 +
158 +// Parses assignment pattern around given atom if possible.
159 +
160 +pp.parseMaybeDefault = function(startPos, startLoc, left) {
161 + left = left || this.parseBindingAtom()
162 + if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left
163 + let node = this.startNodeAt(startPos, startLoc)
164 + node.left = left
165 + node.right = this.parseMaybeAssign()
166 + return this.finishNode(node, "AssignmentPattern")
167 +}
168 +
169 +// Verify that a node is an lval — something that can be assigned
170 +// to.
171 +
172 +pp.checkLVal = function(expr, isBinding, checkClashes) {
173 + switch (expr.type) {
174 + case "Identifier":
175 + if (this.strict && this.reservedWordsStrictBind.test(expr.name))
176 + this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode")
177 + if (checkClashes) {
178 + if (has(checkClashes, expr.name))
179 + this.raise(expr.start, "Argument name clash")
180 + checkClashes[expr.name] = true
181 + }
182 + break
183 +
184 + case "MemberExpression":
185 + if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression")
186 + break
187 +
188 + case "ObjectPattern":
189 + for (let i = 0; i < expr.properties.length; i++)
190 + this.checkLVal(expr.properties[i].value, isBinding, checkClashes)
191 + break
192 +
193 + case "ArrayPattern":
194 + for (let i = 0; i < expr.elements.length; i++) {
195 + let elem = expr.elements[i]
196 + if (elem) this.checkLVal(elem, isBinding, checkClashes)
197 + }
198 + break
199 +
200 + case "AssignmentPattern":
201 + this.checkLVal(expr.left, isBinding, checkClashes)
202 + break
203 +
204 + case "RestElement":
205 + this.checkLVal(expr.argument, isBinding, checkClashes)
206 + break
207 +
208 + case "ParenthesizedExpression":
209 + this.checkLVal(expr.expression, isBinding, checkClashes)
210 + break
211 +
212 + default:
213 + this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue")
214 + }
215 +}
1 +import {Parser} from "./state"
2 +import {SourceLocation} from "./locutil"
3 +
4 +export class Node {
5 + constructor(parser, pos, loc) {
6 + this.type = ""
7 + this.start = pos
8 + this.end = 0
9 + if (parser.options.locations)
10 + this.loc = new SourceLocation(parser, loc)
11 + if (parser.options.directSourceFile)
12 + this.sourceFile = parser.options.directSourceFile
13 + if (parser.options.ranges)
14 + this.range = [pos, 0]
15 + }
16 +}
17 +
18 +// Start an AST node, attaching a start offset.
19 +
20 +const pp = Parser.prototype
21 +
22 +pp.startNode = function() {
23 + return new Node(this, this.start, this.startLoc)
24 +}
25 +
26 +pp.startNodeAt = function(pos, loc) {
27 + return new Node(this, pos, loc)
28 +}
29 +
30 +// Finish an AST node, adding `type` and `end` properties.
31 +
32 +function finishNodeAt(node, type, pos, loc) {
33 + node.type = type
34 + node.end = pos
35 + if (this.options.locations)
36 + node.loc.end = loc
37 + if (this.options.ranges)
38 + node.range[1] = pos
39 + return node
40 +}
41 +
42 +pp.finishNode = function(node, type) {
43 + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
44 +}
45 +
46 +// Finish node at given position
47 +
48 +pp.finishNodeAt = function(node, type, pos, loc) {
49 + return finishNodeAt.call(this, node, type, pos, loc)
50 +}
1 +import {has, isArray} from "./util"
2 +import {SourceLocation} from "./locutil"
3 +
4 +// A second optional argument can be given to further configure
5 +// the parser process. These options are recognized:
6 +
7 +export const defaultOptions = {
8 + // `ecmaVersion` indicates the ECMAScript version to parse. Must
9 + // be either 3, or 5, or 6. This influences support for strict
10 + // mode, the set of reserved words, support for getters and
11 + // setters and other features.
12 + ecmaVersion: 5,
13 + // Source type ("script" or "module") for different semantics
14 + sourceType: "script",
15 + // `onInsertedSemicolon` can be a callback that will be called
16 + // when a semicolon is automatically inserted. It will be passed
17 + // th position of the comma as an offset, and if `locations` is
18 + // enabled, it is given the location as a `{line, column}` object
19 + // as second argument.
20 + onInsertedSemicolon: null,
21 + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
22 + // trailing commas.
23 + onTrailingComma: null,
24 + // By default, reserved words are only enforced if ecmaVersion >= 5.
25 + // Set `allowReserved` to a boolean value to explicitly turn this on
26 + // an off. When this option has the value "never", reserved words
27 + // and keywords can also not be used as property names.
28 + allowReserved: null,
29 + // When enabled, a return at the top level is not considered an
30 + // error.
31 + allowReturnOutsideFunction: false,
32 + // When enabled, import/export statements are not constrained to
33 + // appearing at the top of the program.
34 + allowImportExportEverywhere: false,
35 + // When enabled, hashbang directive in the beginning of file
36 + // is allowed and treated as a line comment.
37 + allowHashBang: false,
38 + // When `locations` is on, `loc` properties holding objects with
39 + // `start` and `end` properties in `{line, column}` form (with
40 + // line being 1-based and column 0-based) will be attached to the
41 + // nodes.
42 + locations: false,
43 + // A function can be passed as `onToken` option, which will
44 + // cause Acorn to call that function with object in the same
45 + // format as tokens returned from `tokenizer().getToken()`. Note
46 + // that you are not allowed to call the parser from the
47 + // callback—that will corrupt its internal state.
48 + onToken: null,
49 + // A function can be passed as `onComment` option, which will
50 + // cause Acorn to call that function with `(block, text, start,
51 + // end)` parameters whenever a comment is skipped. `block` is a
52 + // boolean indicating whether this is a block (`/* */`) comment,
53 + // `text` is the content of the comment, and `start` and `end` are
54 + // character offsets that denote the start and end of the comment.
55 + // When the `locations` option is on, two more parameters are
56 + // passed, the full `{line, column}` locations of the start and
57 + // end of the comments. Note that you are not allowed to call the
58 + // parser from the callback—that will corrupt its internal state.
59 + onComment: null,
60 + // Nodes have their start and end characters offsets recorded in
61 + // `start` and `end` properties (directly on the node, rather than
62 + // the `loc` object, which holds line/column data. To also add a
63 + // [semi-standardized][range] `range` property holding a `[start,
64 + // end]` array with the same numbers, set the `ranges` option to
65 + // `true`.
66 + //
67 + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
68 + ranges: false,
69 + // It is possible to parse multiple files into a single AST by
70 + // passing the tree produced by parsing the first file as
71 + // `program` option in subsequent parses. This will add the
72 + // toplevel forms of the parsed file to the `Program` (top) node
73 + // of an existing parse tree.
74 + program: null,
75 + // When `locations` is on, you can pass this to record the source
76 + // file in every node's `loc` object.
77 + sourceFile: null,
78 + // This value, if given, is stored in every node, whether
79 + // `locations` is on or off.
80 + directSourceFile: null,
81 + // When enabled, parenthesized expressions are represented by
82 + // (non-standard) ParenthesizedExpression nodes
83 + preserveParens: false,
84 + plugins: {}
85 +}
86 +
87 +// Interpret and default an options object
88 +
89 +export function getOptions(opts) {
90 + let options = {}
91 + for (let opt in defaultOptions)
92 + options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]
93 + if (options.allowReserved == null)
94 + options.allowReserved = options.ecmaVersion < 5
95 +
96 + if (isArray(options.onToken)) {
97 + let tokens = options.onToken
98 + options.onToken = (token) => tokens.push(token)
99 + }
100 + if (isArray(options.onComment))
101 + options.onComment = pushComment(options, options.onComment)
102 +
103 + return options
104 +}
105 +
106 +function pushComment(options, array) {
107 + return function (block, text, start, end, startLoc, endLoc) {
108 + let comment = {
109 + type: block ? 'Block' : 'Line',
110 + value: text,
111 + start: start,
112 + end: end
113 + }
114 + if (options.locations)
115 + comment.loc = new SourceLocation(this, startLoc, endLoc)
116 + if (options.ranges)
117 + comment.range = [start, end]
118 + array.push(comment)
119 + }
120 +}
121 +
1 +import {types as tt} from "./tokentype"
2 +import {Parser} from "./state"
3 +import {lineBreak} from "./whitespace"
4 +
5 +const pp = Parser.prototype
6 +
7 +// ## Parser utilities
8 +
9 +// Test whether a statement node is the string literal `"use strict"`.
10 +
11 +pp.isUseStrict = function(stmt) {
12 + return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" &&
13 + stmt.expression.type === "Literal" &&
14 + stmt.expression.raw.slice(1, -1) === "use strict"
15 +}
16 +
17 +// Predicate that tests whether the next token is of the given
18 +// type, and if yes, consumes it as a side effect.
19 +
20 +pp.eat = function(type) {
21 + if (this.type === type) {
22 + this.next()
23 + return true
24 + } else {
25 + return false
26 + }
27 +}
28 +
29 +// Tests whether parsed token is a contextual keyword.
30 +
31 +pp.isContextual = function(name) {
32 + return this.type === tt.name && this.value === name
33 +}
34 +
35 +// Consumes contextual keyword if possible.
36 +
37 +pp.eatContextual = function(name) {
38 + return this.value === name && this.eat(tt.name)
39 +}
40 +
41 +// Asserts that following token is given contextual keyword.
42 +
43 +pp.expectContextual = function(name) {
44 + if (!this.eatContextual(name)) this.unexpected()
45 +}
46 +
47 +// Test whether a semicolon can be inserted at the current position.
48 +
49 +pp.canInsertSemicolon = function() {
50 + return this.type === tt.eof ||
51 + this.type === tt.braceR ||
52 + lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
53 +}
54 +
55 +pp.insertSemicolon = function() {
56 + if (this.canInsertSemicolon()) {
57 + if (this.options.onInsertedSemicolon)
58 + this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)
59 + return true
60 + }
61 +}
62 +
63 +// Consume a semicolon, or, failing that, see if we are allowed to
64 +// pretend that there is a semicolon at this position.
65 +
66 +pp.semicolon = function() {
67 + if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()
68 +}
69 +
70 +pp.afterTrailingComma = function(tokType) {
71 + if (this.type == tokType) {
72 + if (this.options.onTrailingComma)
73 + this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)
74 + this.next()
75 + return true
76 + }
77 +}
78 +
79 +// Expect a token of a given type. If found, consume it, otherwise,
80 +// raise an unexpected token error.
81 +
82 +pp.expect = function(type) {
83 + this.eat(type) || this.unexpected()
84 +}
85 +
86 +// Raise an unexpected token error.
87 +
88 +pp.unexpected = function(pos) {
89 + this.raise(pos != null ? pos : this.start, "Unexpected token")
90 +}
91 +
92 +pp.checkPatternErrors = function(refDestructuringErrors, andThrow) {
93 + let pos = refDestructuringErrors && refDestructuringErrors.trailingComma
94 + if (!andThrow) return !!pos
95 + if (pos) this.raise(pos, "Trailing comma is not permitted in destructuring patterns")
96 +}
97 +
98 +pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
99 + let pos = refDestructuringErrors && refDestructuringErrors.shorthandAssign
100 + if (!andThrow) return !!pos
101 + if (pos) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns")
102 +}
1 +import {reservedWords, keywords} from "./identifier"
2 +import {types as tt} from "./tokentype"
3 +import {lineBreak} from "./whitespace"
4 +import {getOptions} from "./options"
5 +
6 +// Registered plugins
7 +export const plugins = {}
8 +
9 +function keywordRegexp(words) {
10 + return new RegExp("^(" + words.replace(/ /g, "|") + ")$")
11 +}
12 +
13 +export class Parser {
14 + constructor(options, input, startPos) {
15 + this.options = options = getOptions(options)
16 + this.sourceFile = options.sourceFile
17 + this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])
18 + let reserved = options.allowReserved ? "" :
19 + reservedWords[options.ecmaVersion] + (options.sourceType == "module" ? " await" : "")
20 + this.reservedWords = keywordRegexp(reserved)
21 + let reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict
22 + this.reservedWordsStrict = keywordRegexp(reservedStrict)
23 + this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind)
24 + this.input = String(input)
25 +
26 + // Used to signal to callers of `readWord1` whether the word
27 + // contained any escape sequences. This is needed because words with
28 + // escape sequences must not be interpreted as keywords.
29 + this.containsEsc = false;
30 +
31 + // Load plugins
32 + this.loadPlugins(options.plugins)
33 +
34 + // Set up token state
35 +
36 + // The current position of the tokenizer in the input.
37 + if (startPos) {
38 + this.pos = startPos
39 + this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos))
40 + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length
41 + } else {
42 + this.pos = this.lineStart = 0
43 + this.curLine = 1
44 + }
45 +
46 + // Properties of the current token:
47 + // Its type
48 + this.type = tt.eof
49 + // For tokens that include more information than their type, the value
50 + this.value = null
51 + // Its start and end offset
52 + this.start = this.end = this.pos
53 + // And, if locations are used, the {line, column} object
54 + // corresponding to those offsets
55 + this.startLoc = this.endLoc = this.curPosition()
56 +
57 + // Position information for the previous token
58 + this.lastTokEndLoc = this.lastTokStartLoc = null
59 + this.lastTokStart = this.lastTokEnd = this.pos
60 +
61 + // The context stack is used to superficially track syntactic
62 + // context to predict whether a regular expression is allowed in a
63 + // given position.
64 + this.context = this.initialContext()
65 + this.exprAllowed = true
66 +
67 + // Figure out if it's a module code.
68 + this.strict = this.inModule = options.sourceType === "module"
69 +
70 + // Used to signify the start of a potential arrow function
71 + this.potentialArrowAt = -1
72 +
73 + // Flags to track whether we are in a function, a generator.
74 + this.inFunction = this.inGenerator = false
75 + // Labels in scope.
76 + this.labels = []
77 +
78 + // If enabled, skip leading hashbang line.
79 + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!')
80 + this.skipLineComment(2)
81 + }
82 +
83 + // DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them
84 + isKeyword(word) { return this.keywords.test(word) }
85 + isReservedWord(word) { return this.reservedWords.test(word) }
86 +
87 + extend(name, f) {
88 + this[name] = f(this[name])
89 + }
90 +
91 + loadPlugins(pluginConfigs) {
92 + for (let name in pluginConfigs) {
93 + let plugin = plugins[name]
94 + if (!plugin) throw new Error("Plugin '" + name + "' not found")
95 + plugin(this, pluginConfigs[name])
96 + }
97 + }
98 +
99 + parse() {
100 + let node = this.options.program || this.startNode()
101 + this.nextToken()
102 + return this.parseTopLevel(node)
103 + }
104 +}
This diff is collapsed. Click to expand it.
1 +// The algorithm used to determine whether a regexp can appear at a
2 +// given point in the program is loosely based on sweet.js' approach.
3 +// See https://github.com/mozilla/sweet.js/wiki/design
4 +
5 +import {Parser} from "./state"
6 +import {types as tt} from "./tokentype"
7 +import {lineBreak} from "./whitespace"
8 +
9 +export class TokContext {
10 + constructor(token, isExpr, preserveSpace, override) {
11 + this.token = token
12 + this.isExpr = !!isExpr
13 + this.preserveSpace = !!preserveSpace
14 + this.override = override
15 + }
16 +}
17 +
18 +export const types = {
19 + b_stat: new TokContext("{", false),
20 + b_expr: new TokContext("{", true),
21 + b_tmpl: new TokContext("${", true),
22 + p_stat: new TokContext("(", false),
23 + p_expr: new TokContext("(", true),
24 + q_tmpl: new TokContext("`", true, true, p => p.readTmplToken()),
25 + f_expr: new TokContext("function", true)
26 +}
27 +
28 +const pp = Parser.prototype
29 +
30 +pp.initialContext = function() {
31 + return [types.b_stat]
32 +}
33 +
34 +pp.braceIsBlock = function(prevType) {
35 + if (prevType === tt.colon) {
36 + let parent = this.curContext()
37 + if (parent === types.b_stat || parent === types.b_expr)
38 + return !parent.isExpr
39 + }
40 + if (prevType === tt._return)
41 + return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
42 + if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR)
43 + return true
44 + if (prevType == tt.braceL)
45 + return this.curContext() === types.b_stat
46 + return !this.exprAllowed
47 +}
48 +
49 +pp.updateContext = function(prevType) {
50 + let update, type = this.type
51 + if (type.keyword && prevType == tt.dot)
52 + this.exprAllowed = false
53 + else if (update = type.updateContext)
54 + update.call(this, prevType)
55 + else
56 + this.exprAllowed = type.beforeExpr
57 +}
58 +
59 +// Token-specific context update code
60 +
61 +tt.parenR.updateContext = tt.braceR.updateContext = function() {
62 + if (this.context.length == 1) {
63 + this.exprAllowed = true
64 + return
65 + }
66 + let out = this.context.pop()
67 + if (out === types.b_stat && this.curContext() === types.f_expr) {
68 + this.context.pop()
69 + this.exprAllowed = false
70 + } else if (out === types.b_tmpl) {
71 + this.exprAllowed = true
72 + } else {
73 + this.exprAllowed = !out.isExpr
74 + }
75 +}
76 +
77 +tt.braceL.updateContext = function(prevType) {
78 + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)
79 + this.exprAllowed = true
80 +}
81 +
82 +tt.dollarBraceL.updateContext = function() {
83 + this.context.push(types.b_tmpl)
84 + this.exprAllowed = true
85 +}
86 +
87 +tt.parenL.updateContext = function(prevType) {
88 + let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while
89 + this.context.push(statementParens ? types.p_stat : types.p_expr)
90 + this.exprAllowed = true
91 +}
92 +
93 +tt.incDec.updateContext = function() {
94 + // tokExprAllowed stays unchanged
95 +}
96 +
97 +tt._function.updateContext = function() {
98 + if (this.curContext() !== types.b_stat)
99 + this.context.push(types.f_expr)
100 + this.exprAllowed = false
101 +}
102 +
103 +tt.backQuote.updateContext = function() {
104 + if (this.curContext() === types.q_tmpl)
105 + this.context.pop()
106 + else
107 + this.context.push(types.q_tmpl)
108 + this.exprAllowed = false
109 +}
This diff is collapsed. Click to expand it.
1 +// ## Token types
2 +
3 +// The assignment of fine-grained, information-carrying type objects
4 +// allows the tokenizer to store the information it has about a
5 +// token in a way that is very cheap for the parser to look up.
6 +
7 +// All token type variables start with an underscore, to make them
8 +// easy to recognize.
9 +
10 +// The `beforeExpr` property is used to disambiguate between regular
11 +// expressions and divisions. It is set on all token types that can
12 +// be followed by an expression (thus, a slash after them would be a
13 +// regular expression).
14 +//
15 +// The `startsExpr` property is used to check if the token ends a
16 +// `yield` expression. It is set on all token types that either can
17 +// directly start an expression (like a quotation mark) or can
18 +// continue an expression (like the body of a string).
19 +//
20 +// `isLoop` marks a keyword as starting a loop, which is important
21 +// to know when parsing a label, in order to allow or disallow
22 +// continue jumps to that label.
23 +
24 +export class TokenType {
25 + constructor(label, conf = {}) {
26 + this.label = label
27 + this.keyword = conf.keyword
28 + this.beforeExpr = !!conf.beforeExpr
29 + this.startsExpr = !!conf.startsExpr
30 + this.isLoop = !!conf.isLoop
31 + this.isAssign = !!conf.isAssign
32 + this.prefix = !!conf.prefix
33 + this.postfix = !!conf.postfix
34 + this.binop = conf.binop || null
35 + this.updateContext = null
36 + }
37 +}
38 +
39 +function binop(name, prec) {
40 + return new TokenType(name, {beforeExpr: true, binop: prec})
41 +}
42 +const beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}
43 +
44 +export const types = {
45 + num: new TokenType("num", startsExpr),
46 + regexp: new TokenType("regexp", startsExpr),
47 + string: new TokenType("string", startsExpr),
48 + name: new TokenType("name", startsExpr),
49 + eof: new TokenType("eof"),
50 +
51 + // Punctuation token types.
52 + bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
53 + bracketR: new TokenType("]"),
54 + braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
55 + braceR: new TokenType("}"),
56 + parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
57 + parenR: new TokenType(")"),
58 + comma: new TokenType(",", beforeExpr),
59 + semi: new TokenType(";", beforeExpr),
60 + colon: new TokenType(":", beforeExpr),
61 + dot: new TokenType("."),
62 + question: new TokenType("?", beforeExpr),
63 + arrow: new TokenType("=>", beforeExpr),
64 + template: new TokenType("template"),
65 + ellipsis: new TokenType("...", beforeExpr),
66 + backQuote: new TokenType("`", startsExpr),
67 + dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
68 +
69 + // Operators. These carry several kinds of properties to help the
70 + // parser use them properly (the presence of these properties is
71 + // what categorizes them as operators).
72 + //
73 + // `binop`, when present, specifies that this operator is a binary
74 + // operator, and will refer to its precedence.
75 + //
76 + // `prefix` and `postfix` mark the operator as a prefix or postfix
77 + // unary operator.
78 + //
79 + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
80 + // binary operators with a very low precedence, that should result
81 + // in AssignmentExpression nodes.
82 +
83 + eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
84 + assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
85 + incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
86 + prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
87 + logicalOR: binop("||", 1),
88 + logicalAND: binop("&&", 2),
89 + bitwiseOR: binop("|", 3),
90 + bitwiseXOR: binop("^", 4),
91 + bitwiseAND: binop("&", 5),
92 + equality: binop("==/!=", 6),
93 + relational: binop("</>", 7),
94 + bitShift: binop("<</>>", 8),
95 + plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
96 + modulo: binop("%", 10),
97 + star: binop("*", 10),
98 + slash: binop("/", 10)
99 +}
100 +
101 +// Map keyword names to token types.
102 +
103 +export const keywords = {}
104 +
105 +// Succinct definitions of keyword token types
106 +function kw(name, options = {}) {
107 + options.keyword = name
108 + keywords[name] = types["_" + name] = new TokenType(name, options)
109 +}
110 +
111 +kw("break")
112 +kw("case", beforeExpr)
113 +kw("catch")
114 +kw("continue")
115 +kw("debugger")
116 +kw("default", beforeExpr)
117 +kw("do", {isLoop: true, beforeExpr: true})
118 +kw("else", beforeExpr)
119 +kw("finally")
120 +kw("for", {isLoop: true})
121 +kw("function", startsExpr)
122 +kw("if")
123 +kw("return", beforeExpr)
124 +kw("switch")
125 +kw("throw", beforeExpr)
126 +kw("try")
127 +kw("var")
128 +kw("let")
129 +kw("const")
130 +kw("while", {isLoop: true})
131 +kw("with")
132 +kw("new", {beforeExpr: true, startsExpr: true})
133 +kw("this", startsExpr)
134 +kw("super", startsExpr)
135 +kw("class")
136 +kw("extends", beforeExpr)
137 +kw("export")
138 +kw("import")
139 +kw("yield", {beforeExpr: true, startsExpr: true})
140 +kw("null", startsExpr)
141 +kw("true", startsExpr)
142 +kw("false", startsExpr)
143 +kw("in", {beforeExpr: true, binop: 7})
144 +kw("instanceof", {beforeExpr: true, binop: 7})
145 +kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true})
146 +kw("void", {beforeExpr: true, prefix: true, startsExpr: true})
147 +kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
1 +export function isArray(obj) {
2 + return Object.prototype.toString.call(obj) === "[object Array]"
3 +}
4 +
5 +// Checks if an object has a property.
6 +
7 +export function has(obj, propName) {
8 + return Object.prototype.hasOwnProperty.call(obj, propName)
9 +}
This diff is collapsed. Click to expand it.
1 +// Matches a whole line break (where CRLF is considered a single
2 +// line break). Used to count lines.
3 +
4 +export const lineBreak = /\r\n?|\n|\u2028|\u2029/
5 +export const lineBreakG = new RegExp(lineBreak.source, "g")
6 +
7 +export function isNewLine(code) {
8 + return code === 10 || code === 13 || code === 0x2028 || code == 0x2029
9 +}
10 +
11 +export const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/
12 +
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2015, Jon Schlinkert.
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in
13 +all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 +THE SOFTWARE.
1 +# align-text [![NPM version](https://badge.fury.io/js/align-text.svg)](http://badge.fury.io/js/align-text) [![Build Status](https://travis-ci.org/jonschlinkert/align-text.svg)](https://travis-ci.org/jonschlinkert/align-text)
2 +
3 +> Align the text in a string.
4 +
5 +**Examples**
6 +
7 +Align text values in an array:
8 +
9 +```js
10 +align([1, 2, 3, 100]);
11 +//=> [' 1', ' 2', ' 3', '100']
12 +```
13 +
14 +Or [do stuff like this](./example.js):
15 +
16 +[![screen shot 2015-06-09 at 2 08 34 am](https://cloud.githubusercontent.com/assets/383994/8051597/7b716fbc-0e4c-11e5-9aef-4493fd22db58.png)](./example.js)
17 +
18 +Visit [the example](./example.js) to see how this works.
19 +
20 +## Install
21 +
22 +Install with [npm](https://www.npmjs.com/)
23 +
24 +```sh
25 +$ npm i align-text --save
26 +```
27 +
28 +## Usage
29 +
30 +```js
31 +var align = require('align-text');
32 +align(text, callback_function_or_integer);
33 +```
34 +
35 +**Params**
36 +
37 +* `text` can be a **string or array**. If a string is passed, a string will be returned. If an array is passed, an array will be returned.
38 +* `callback|integer`: if an integer, the text will be indented by that amount. If a function, it must return an integer representing the amount of leading indentation to use as `align` loops over each line.
39 +
40 +**Example**
41 +
42 +```js
43 +align(text, 4);
44 +```
45 +
46 +Would align:
47 +
48 +```
49 +abc
50 +abc
51 +abc
52 +```
53 +
54 +To:
55 +
56 +```
57 + abc
58 + abc
59 + abc
60 +```
61 +
62 +## callback
63 +
64 +### params
65 +
66 +The callback is used to determine the indentation of each line and gets the following params:
67 +
68 +* `len` the length of the "current" line
69 +* `longest` the length of the longest line
70 +* `line` the current line (string) being aligned
71 +* `lines` the array of all lines
72 +
73 +### return
74 +
75 +The callback may return:
76 +
77 +* an integer that represents the number of spaces to use for padding,
78 +* or an object with the following properties:
79 + - `indent`: **{Number}** the amount of indentation to use. Default is `0` when an object is returned.
80 + - `character`: **{String}** the character to use for indentation. Default is `''` (empty string) when an object is returned.
81 + - `prefix`: **{String}** leading characters to use at the beginning of each line. `''` (empty string) when an object is returned.
82 +
83 +**Integer example:**
84 +
85 +```js
86 +// calculate half the difference between the length
87 +// of the current line and the longest line
88 +function centerAlign(len, longest, line, lines) {
89 + return Math.floor((longest - len) / 2);
90 +}
91 +```
92 +
93 +**Object example:**
94 +
95 +```js
96 +function centerAlign(len, longest, line, lines) {
97 + return {
98 + character: '\t',
99 + indent: Math.floor((longest - len) / 2),
100 + prefix: '~ ',
101 + }
102 +}
103 +```
104 +
105 +## Usage examples
106 +
107 +### Center align
108 +
109 +Using the `centerAlign` function from above:
110 +
111 +```js
112 +align(text, centerAlign);
113 +```
114 +
115 +Would align this text:
116 +
117 +```js
118 +Lorem ipsum dolor sit amet
119 +consectetur adipiscin
120 +elit, sed do eiusmod tempor incididun
121 +ut labore et dolor
122 +magna aliqua. Ut enim ad mini
123 +veniam, quis
124 +```
125 +
126 +Resulting in this:
127 +
128 +```
129 + Lorem ipsum dolor sit amet,
130 + consectetur adipiscing
131 +elit, sed do eiusmod tempor incididunt
132 + ut labore et dolore
133 + magna aliqua. Ut enim ad minim
134 + veniam, quis
135 +```
136 +
137 +**Customize**
138 +
139 +If you wanted to add more padding on the left, just pass the number in the callback.
140 +
141 +For example, to add 4 spaces before every line:
142 +
143 +```js
144 +function centerAlign(len, longest, line, lines) {
145 + return 4 + Math.floor((longest - len) / 2);
146 +}
147 +```
148 +
149 +Would result in:
150 +
151 +```
152 + Lorem ipsum dolor sit amet,
153 + consectetur adipiscing
154 + elit, sed do eiusmod tempor incididunt
155 + ut labore et dolore
156 + magna aliqua. Ut enim ad minim
157 + veniam, quis
158 +```
159 +
160 +### Bullets
161 +
162 +```js
163 +align(text, function (len, max, line, lines) {
164 + return {prefix: ' - '};
165 +});
166 +```
167 +
168 +Would return:
169 +
170 +```
171 +- Lorem ipsum dolor sit amet,
172 +- consectetur adipiscing
173 +- elit, sed do eiusmod tempor incididunt
174 +- ut labore et dolore
175 +- magna aliqua. Ut enim ad minim
176 +- veniam, quis
177 +```
178 +
179 +### Different indent character
180 +
181 +```js
182 +align(text, function (len, max, line, lines) {
183 + return {
184 + indent: Math.floor((max - len) / 2),
185 + character: '~',
186 + };
187 +});
188 +```
189 +
190 +Would return
191 +
192 +```
193 +~~~~~Lorem ipsum dolor sit amet,
194 +~~~~~~~~consectetur adipiscing
195 +elit, sed do eiusmod tempor incididunt
196 +~~~~~~~~~ut labore et dolore
197 +~~~~magna aliqua. Ut enim ad minim
198 +~~~~~~~~~~~~~veniam, quis
199 +```
200 +
201 +## Related projects
202 +
203 +* [center-align](https://github.com/jonschlinkert/center-align): Center-align the text in a string.
204 +* [justify](https://github.com/bahamas10/node-justify): Left or right (or both) justify text using a custom width and character
205 +* [longest](https://github.com/jonschlinkert/longest): Get the longest item in an array.
206 +* [right-align](https://github.com/jonschlinkert/right-align): Right-align the text in a string.
207 +* [repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string.
208 +* [word-wrap](https://github.com/jonschlinkert/word-wrap): Wrap words to a specified length.
209 +
210 +## Running tests
211 +
212 +Install dev dependencies:
213 +
214 +```sh
215 +$ npm i -d && npm test
216 +```
217 +
218 +## Contributing
219 +
220 +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/align-text/issues/new)
221 +
222 +## Author
223 +
224 +**Jon Schlinkert**
225 +
226 ++ [github/jonschlinkert](https://github.com/jonschlinkert)
227 ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
228 +
229 +## License
230 +
231 +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
232 +Released under the MIT license.
233 +
234 +***
235 +
236 +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 09, 2015._
1 +/*!
2 + * align-text <https://github.com/jonschlinkert/align-text>
3 + *
4 + * Copyright (c) 2015, Jon Schlinkert.
5 + * Licensed under the MIT License.
6 + */
7 +
8 +'use strict';
9 +
10 +var typeOf = require('kind-of');
11 +var repeat = require('repeat-string');
12 +var longest = require('longest');
13 +
14 +module.exports = function alignText(val, fn) {
15 + var lines, type = typeOf(val);
16 +
17 + if (type === 'array') {
18 + lines = val;
19 + } else if (type === 'string') {
20 + lines = val.split(/(?:\r\n|\n)/);
21 + } else {
22 + throw new TypeError('align-text expects a string or array.');
23 + }
24 +
25 + var fnType = typeOf(fn);
26 + var len = lines.length;
27 + var max = longest(lines);
28 + var res = [], i = 0;
29 +
30 + while (len--) {
31 + var line = String(lines[i++]);
32 + var diff;
33 +
34 + if (fnType === 'function') {
35 + diff = fn(line.length, max.length, line, lines, i);
36 + } else if (fnType === 'number') {
37 + diff = fn;
38 + } else {
39 + diff = max.length - line.length;
40 + }
41 +
42 + if (typeOf(diff) === 'number') {
43 + res.push(repeat(' ', diff) + line);
44 + } else if (typeOf(diff) === 'object') {
45 + var result = repeat(diff.character || ' ', diff.indent || 0);
46 + res.push((diff.prefix || '') + result + line);
47 + }
48 + }
49 +
50 + if (type === 'array') return res;
51 + return res.join('\n');
52 +};
1 +{
2 + "_from": "align-text@^0.1.3",
3 + "_id": "align-text@0.1.4",
4 + "_inBundle": false,
5 + "_integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
6 + "_location": "/align-text",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "align-text@^0.1.3",
12 + "name": "align-text",
13 + "escapedName": "align-text",
14 + "rawSpec": "^0.1.3",
15 + "saveSpec": null,
16 + "fetchSpec": "^0.1.3"
17 + },
18 + "_requiredBy": [
19 + "/center-align",
20 + "/right-align"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
23 + "_shasum": "0cd90a561093f35d0a99256c22b7069433fad117",
24 + "_spec": "align-text@^0.1.3",
25 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/center-align",
26 + "author": {
27 + "name": "Jon Schlinkert",
28 + "url": "https://github.com/jonschlinkert"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/jonschlinkert/align-text/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "kind-of": "^3.0.2",
36 + "longest": "^1.0.1",
37 + "repeat-string": "^1.5.2"
38 + },
39 + "deprecated": false,
40 + "description": "Align the text in a string.",
41 + "devDependencies": {
42 + "mocha": "*",
43 + "should": "*",
44 + "word-wrap": "^1.0.3"
45 + },
46 + "engines": {
47 + "node": ">=0.10.0"
48 + },
49 + "files": [
50 + "index.js"
51 + ],
52 + "homepage": "https://github.com/jonschlinkert/align-text",
53 + "keywords": [
54 + "align",
55 + "align-center",
56 + "alignment",
57 + "center",
58 + "center-align",
59 + "indent",
60 + "pad",
61 + "padding",
62 + "right",
63 + "right-align",
64 + "text",
65 + "typography"
66 + ],
67 + "license": "MIT",
68 + "main": "index.js",
69 + "name": "align-text",
70 + "repository": {
71 + "type": "git",
72 + "url": "git://github.com/jonschlinkert/align-text.git"
73 + },
74 + "scripts": {
75 + "test": "mocha"
76 + },
77 + "version": "0.1.4"
78 +}
1 +amdefine is released under two licenses: new BSD, and MIT. You may pick the
2 +license that best suits your development needs. The text of both licenses are
3 +provided below.
4 +
5 +
6 +The "New" BSD License:
7 +----------------------
8 +
9 +Copyright (c) 2011-2016, The Dojo Foundation
10 +All rights reserved.
11 +
12 +Redistribution and use in source and binary forms, with or without
13 +modification, are permitted provided that the following conditions are met:
14 +
15 + * Redistributions of source code must retain the above copyright notice, this
16 + list of conditions and the following disclaimer.
17 + * Redistributions in binary form must reproduce the above copyright notice,
18 + this list of conditions and the following disclaimer in the documentation
19 + and/or other materials provided with the distribution.
20 + * Neither the name of the Dojo Foundation nor the names of its contributors
21 + may be used to endorse or promote products derived from this software
22 + without specific prior written permission.
23 +
24 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25 +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
28 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 +
35 +
36 +
37 +MIT License
38 +-----------
39 +
40 +Copyright (c) 2011-2016, The Dojo Foundation
41 +
42 +Permission is hereby granted, free of charge, to any person obtaining a copy
43 +of this software and associated documentation files (the "Software"), to deal
44 +in the Software without restriction, including without limitation the rights
45 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46 +copies of the Software, and to permit persons to whom the Software is
47 +furnished to do so, subject to the following conditions:
48 +
49 +The above copyright notice and this permission notice shall be included in
50 +all copies or substantial portions of the Software.
51 +
52 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58 +THE SOFTWARE.
1 +# amdefine
2 +
3 +A module that can be used to implement AMD's define() in Node. This allows you
4 +to code to the AMD API and have the module work in node programs without
5 +requiring those other programs to use AMD.
6 +
7 +## Usage
8 +
9 +**1)** Update your package.json to indicate amdefine as a dependency:
10 +
11 +```javascript
12 + "dependencies": {
13 + "amdefine": ">=0.1.0"
14 + }
15 +```
16 +
17 +Then run `npm install` to get amdefine into your project.
18 +
19 +**2)** At the top of each module that uses define(), place this code:
20 +
21 +```javascript
22 +if (typeof define !== 'function') { var define = require('amdefine')(module) }
23 +```
24 +
25 +**Only use these snippets** when loading amdefine. If you preserve the basic structure,
26 +with the braces, it will be stripped out when using the [RequireJS optimizer](#optimizer).
27 +
28 +You can add spaces, line breaks and even require amdefine with a local path, but
29 +keep the rest of the structure to get the stripping behavior.
30 +
31 +As you may know, because `if` statements in JavaScript don't have their own scope, the var
32 +declaration in the above snippet is made whether the `if` expression is truthy or not. If
33 +RequireJS is loaded then the declaration is superfluous because `define` is already already
34 +declared in the same scope in RequireJS. Fortunately JavaScript handles multiple `var`
35 +declarations of the same variable in the same scope gracefully.
36 +
37 +If you want to deliver amdefine.js with your code rather than specifying it as a dependency
38 +with npm, then just download the latest release and refer to it using a relative path:
39 +
40 +[Latest Version](https://github.com/jrburke/amdefine/raw/latest/amdefine.js)
41 +
42 +### amdefine/intercept
43 +
44 +Consider this very experimental.
45 +
46 +Instead of pasting the piece of text for the amdefine setup of a `define`
47 +variable in each module you create or consume, you can use `amdefine/intercept`
48 +instead. It will automatically insert the above snippet in each .js file loaded
49 +by Node.
50 +
51 +**Warning**: you should only use this if you are creating an application that
52 +is consuming AMD style defined()'d modules that are distributed via npm and want
53 +to run that code in Node.
54 +
55 +For library code where you are not sure if it will be used by others in Node or
56 +in the browser, then explicitly depending on amdefine and placing the code
57 +snippet above is suggested path, instead of using `amdefine/intercept`. The
58 +intercept module affects all .js files loaded in the Node app, and it is
59 +inconsiderate to modify global state like that unless you are also controlling
60 +the top level app.
61 +
62 +#### Why distribute AMD-style modules via npm?
63 +
64 +npm has a lot of weaknesses for front-end use (installed layout is not great,
65 +should have better support for the `baseUrl + moduleID + '.js' style of loading,
66 +single file JS installs), but some people want a JS package manager and are
67 +willing to live with those constraints. If that is you, but still want to author
68 +in AMD style modules to get dynamic require([]), better direct source usage and
69 +powerful loader plugin support in the browser, then this tool can help.
70 +
71 +#### amdefine/intercept usage
72 +
73 +Just require it in your top level app module (for example index.js, server.js):
74 +
75 +```javascript
76 +require('amdefine/intercept');
77 +```
78 +
79 +The module does not return a value, so no need to assign the result to a local
80 +variable.
81 +
82 +Then just require() code as you normally would with Node's require(). Any .js
83 +loaded after the intercept require will have the amdefine check injected in
84 +the .js source as it is loaded. It does not modify the source on disk, just
85 +prepends some content to the text of the module as it is loaded by Node.
86 +
87 +#### How amdefine/intercept works
88 +
89 +It overrides the `Module._extensions['.js']` in Node to automatically prepend
90 +the amdefine snippet above. So, it will affect any .js file loaded by your
91 +app.
92 +
93 +## define() usage
94 +
95 +It is best if you use the anonymous forms of define() in your module:
96 +
97 +```javascript
98 +define(function (require) {
99 + var dependency = require('dependency');
100 +});
101 +```
102 +
103 +or
104 +
105 +```javascript
106 +define(['dependency'], function (dependency) {
107 +
108 +});
109 +```
110 +
111 +## RequireJS optimizer integration. <a name="optimizer"></name>
112 +
113 +Version 1.0.3 of the [RequireJS optimizer](http://requirejs.org/docs/optimization.html)
114 +will have support for stripping the `if (typeof define !== 'function')` check
115 +mentioned above, so you can include this snippet for code that runs in the
116 +browser, but avoid taking the cost of the if() statement once the code is
117 +optimized for deployment.
118 +
119 +## Node 0.4 Support
120 +
121 +If you want to support Node 0.4, then add `require` as the second parameter to amdefine:
122 +
123 +```javascript
124 +//Only if you want Node 0.4. If using 0.5 or later, use the above snippet.
125 +if (typeof define !== 'function') { var define = require('amdefine')(module, require) }
126 +```
127 +
128 +## Limitations
129 +
130 +### Synchronous vs Asynchronous
131 +
132 +amdefine creates a define() function that is callable by your code. It will
133 +execute and trace dependencies and call the factory function *synchronously*,
134 +to keep the behavior in line with Node's synchronous dependency tracing.
135 +
136 +The exception: calling AMD's callback-style require() from inside a factory
137 +function. The require callback is called on process.nextTick():
138 +
139 +```javascript
140 +define(function (require) {
141 + require(['a'], function(a) {
142 + //'a' is loaded synchronously, but
143 + //this callback is called on process.nextTick().
144 + });
145 +});
146 +```
147 +
148 +### Loader Plugins
149 +
150 +Loader plugins are supported as long as they call their load() callbacks
151 +synchronously. So ones that do network requests will not work. However plugins
152 +like [text](http://requirejs.org/docs/api.html#text) can load text files locally.
153 +
154 +The plugin API's `load.fromText()` is **not supported** in amdefine, so this means
155 +transpiler plugins like the [CoffeeScript loader plugin](https://github.com/jrburke/require-cs)
156 +will not work. This may be fixable, but it is a bit complex, and I do not have
157 +enough node-fu to figure it out yet. See the source for amdefine.js if you want
158 +to get an idea of the issues involved.
159 +
160 +## Tests
161 +
162 +To run the tests, cd to **tests** and run:
163 +
164 +```
165 +node all.js
166 +node all-intercept.js
167 +```
168 +
169 +## License
170 +
171 +New BSD and MIT. Check the LICENSE file for all the details.
1 +/** vim: et:ts=4:sw=4:sts=4
2 + * @license amdefine 1.0.1 Copyright (c) 2011-2016, The Dojo Foundation All Rights Reserved.
3 + * Available via the MIT or new BSD license.
4 + * see: http://github.com/jrburke/amdefine for details
5 + */
6 +
7 +/*jslint node: true */
8 +/*global module, process */
9 +'use strict';
10 +
11 +/**
12 + * Creates a define for node.
13 + * @param {Object} module the "module" object that is defined by Node for the
14 + * current module.
15 + * @param {Function} [requireFn]. Node's require function for the current module.
16 + * It only needs to be passed in Node versions before 0.5, when module.require
17 + * did not exist.
18 + * @returns {Function} a define function that is usable for the current node
19 + * module.
20 + */
21 +function amdefine(module, requireFn) {
22 + 'use strict';
23 + var defineCache = {},
24 + loaderCache = {},
25 + alreadyCalled = false,
26 + path = require('path'),
27 + makeRequire, stringRequire;
28 +
29 + /**
30 + * Trims the . and .. from an array of path segments.
31 + * It will keep a leading path segment if a .. will become
32 + * the first path segment, to help with module name lookups,
33 + * which act like paths, but can be remapped. But the end result,
34 + * all paths that use this function should look normalized.
35 + * NOTE: this method MODIFIES the input array.
36 + * @param {Array} ary the array of path segments.
37 + */
38 + function trimDots(ary) {
39 + var i, part;
40 + for (i = 0; ary[i]; i+= 1) {
41 + part = ary[i];
42 + if (part === '.') {
43 + ary.splice(i, 1);
44 + i -= 1;
45 + } else if (part === '..') {
46 + if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
47 + //End of the line. Keep at least one non-dot
48 + //path segment at the front so it can be mapped
49 + //correctly to disk. Otherwise, there is likely
50 + //no path mapping for a path starting with '..'.
51 + //This can still fail, but catches the most reasonable
52 + //uses of ..
53 + break;
54 + } else if (i > 0) {
55 + ary.splice(i - 1, 2);
56 + i -= 2;
57 + }
58 + }
59 + }
60 + }
61 +
62 + function normalize(name, baseName) {
63 + var baseParts;
64 +
65 + //Adjust any relative paths.
66 + if (name && name.charAt(0) === '.') {
67 + //If have a base name, try to normalize against it,
68 + //otherwise, assume it is a top-level require that will
69 + //be relative to baseUrl in the end.
70 + if (baseName) {
71 + baseParts = baseName.split('/');
72 + baseParts = baseParts.slice(0, baseParts.length - 1);
73 + baseParts = baseParts.concat(name.split('/'));
74 + trimDots(baseParts);
75 + name = baseParts.join('/');
76 + }
77 + }
78 +
79 + return name;
80 + }
81 +
82 + /**
83 + * Create the normalize() function passed to a loader plugin's
84 + * normalize method.
85 + */
86 + function makeNormalize(relName) {
87 + return function (name) {
88 + return normalize(name, relName);
89 + };
90 + }
91 +
92 + function makeLoad(id) {
93 + function load(value) {
94 + loaderCache[id] = value;
95 + }
96 +
97 + load.fromText = function (id, text) {
98 + //This one is difficult because the text can/probably uses
99 + //define, and any relative paths and requires should be relative
100 + //to that id was it would be found on disk. But this would require
101 + //bootstrapping a module/require fairly deeply from node core.
102 + //Not sure how best to go about that yet.
103 + throw new Error('amdefine does not implement load.fromText');
104 + };
105 +
106 + return load;
107 + }
108 +
109 + makeRequire = function (systemRequire, exports, module, relId) {
110 + function amdRequire(deps, callback) {
111 + if (typeof deps === 'string') {
112 + //Synchronous, single module require('')
113 + return stringRequire(systemRequire, exports, module, deps, relId);
114 + } else {
115 + //Array of dependencies with a callback.
116 +
117 + //Convert the dependencies to modules.
118 + deps = deps.map(function (depName) {
119 + return stringRequire(systemRequire, exports, module, depName, relId);
120 + });
121 +
122 + //Wait for next tick to call back the require call.
123 + if (callback) {
124 + process.nextTick(function () {
125 + callback.apply(null, deps);
126 + });
127 + }
128 + }
129 + }
130 +
131 + amdRequire.toUrl = function (filePath) {
132 + if (filePath.indexOf('.') === 0) {
133 + return normalize(filePath, path.dirname(module.filename));
134 + } else {
135 + return filePath;
136 + }
137 + };
138 +
139 + return amdRequire;
140 + };
141 +
142 + //Favor explicit value, passed in if the module wants to support Node 0.4.
143 + requireFn = requireFn || function req() {
144 + return module.require.apply(module, arguments);
145 + };
146 +
147 + function runFactory(id, deps, factory) {
148 + var r, e, m, result;
149 +
150 + if (id) {
151 + e = loaderCache[id] = {};
152 + m = {
153 + id: id,
154 + uri: __filename,
155 + exports: e
156 + };
157 + r = makeRequire(requireFn, e, m, id);
158 + } else {
159 + //Only support one define call per file
160 + if (alreadyCalled) {
161 + throw new Error('amdefine with no module ID cannot be called more than once per file.');
162 + }
163 + alreadyCalled = true;
164 +
165 + //Use the real variables from node
166 + //Use module.exports for exports, since
167 + //the exports in here is amdefine exports.
168 + e = module.exports;
169 + m = module;
170 + r = makeRequire(requireFn, e, m, module.id);
171 + }
172 +
173 + //If there are dependencies, they are strings, so need
174 + //to convert them to dependency values.
175 + if (deps) {
176 + deps = deps.map(function (depName) {
177 + return r(depName);
178 + });
179 + }
180 +
181 + //Call the factory with the right dependencies.
182 + if (typeof factory === 'function') {
183 + result = factory.apply(m.exports, deps);
184 + } else {
185 + result = factory;
186 + }
187 +
188 + if (result !== undefined) {
189 + m.exports = result;
190 + if (id) {
191 + loaderCache[id] = m.exports;
192 + }
193 + }
194 + }
195 +
196 + stringRequire = function (systemRequire, exports, module, id, relId) {
197 + //Split the ID by a ! so that
198 + var index = id.indexOf('!'),
199 + originalId = id,
200 + prefix, plugin;
201 +
202 + if (index === -1) {
203 + id = normalize(id, relId);
204 +
205 + //Straight module lookup. If it is one of the special dependencies,
206 + //deal with it, otherwise, delegate to node.
207 + if (id === 'require') {
208 + return makeRequire(systemRequire, exports, module, relId);
209 + } else if (id === 'exports') {
210 + return exports;
211 + } else if (id === 'module') {
212 + return module;
213 + } else if (loaderCache.hasOwnProperty(id)) {
214 + return loaderCache[id];
215 + } else if (defineCache[id]) {
216 + runFactory.apply(null, defineCache[id]);
217 + return loaderCache[id];
218 + } else {
219 + if(systemRequire) {
220 + return systemRequire(originalId);
221 + } else {
222 + throw new Error('No module with ID: ' + id);
223 + }
224 + }
225 + } else {
226 + //There is a plugin in play.
227 + prefix = id.substring(0, index);
228 + id = id.substring(index + 1, id.length);
229 +
230 + plugin = stringRequire(systemRequire, exports, module, prefix, relId);
231 +
232 + if (plugin.normalize) {
233 + id = plugin.normalize(id, makeNormalize(relId));
234 + } else {
235 + //Normalize the ID normally.
236 + id = normalize(id, relId);
237 + }
238 +
239 + if (loaderCache[id]) {
240 + return loaderCache[id];
241 + } else {
242 + plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
243 +
244 + return loaderCache[id];
245 + }
246 + }
247 + };
248 +
249 + //Create a define function specific to the module asking for amdefine.
250 + function define(id, deps, factory) {
251 + if (Array.isArray(id)) {
252 + factory = deps;
253 + deps = id;
254 + id = undefined;
255 + } else if (typeof id !== 'string') {
256 + factory = id;
257 + id = deps = undefined;
258 + }
259 +
260 + if (deps && !Array.isArray(deps)) {
261 + factory = deps;
262 + deps = undefined;
263 + }
264 +
265 + if (!deps) {
266 + deps = ['require', 'exports', 'module'];
267 + }
268 +
269 + //Set up properties for this module. If an ID, then use
270 + //internal cache. If no ID, then use the external variables
271 + //for this node module.
272 + if (id) {
273 + //Put the module in deep freeze until there is a
274 + //require call for it.
275 + defineCache[id] = [id, deps, factory];
276 + } else {
277 + runFactory(id, deps, factory);
278 + }
279 + }
280 +
281 + //define.require, which has access to all the values in the
282 + //cache. Useful for AMD modules that all have IDs in the file,
283 + //but need to finally export a value to node based on one of those
284 + //IDs.
285 + define.require = function (id) {
286 + if (loaderCache[id]) {
287 + return loaderCache[id];
288 + }
289 +
290 + if (defineCache[id]) {
291 + runFactory.apply(null, defineCache[id]);
292 + return loaderCache[id];
293 + }
294 + };
295 +
296 + define.amd = {};
297 +
298 + return define;
299 +}
300 +
301 +module.exports = amdefine;
1 +/*jshint node: true */
2 +var inserted,
3 + Module = require('module'),
4 + fs = require('fs'),
5 + existingExtFn = Module._extensions['.js'],
6 + amdefineRegExp = /amdefine\.js/;
7 +
8 +inserted = "if (typeof define !== 'function') {var define = require('amdefine')(module)}";
9 +
10 +//From the node/lib/module.js source:
11 +function stripBOM(content) {
12 + // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
13 + // because the buffer-to-string conversion in `fs.readFileSync()`
14 + // translates it to FEFF, the UTF-16 BOM.
15 + if (content.charCodeAt(0) === 0xFEFF) {
16 + content = content.slice(1);
17 + }
18 + return content;
19 +}
20 +
21 +//Also adapted from the node/lib/module.js source:
22 +function intercept(module, filename) {
23 + var content = stripBOM(fs.readFileSync(filename, 'utf8'));
24 +
25 + if (!amdefineRegExp.test(module.id)) {
26 + content = inserted + content;
27 + }
28 +
29 + module._compile(content, filename);
30 +}
31 +
32 +intercept._id = 'amdefine/intercept';
33 +
34 +if (!existingExtFn._id || existingExtFn._id !== intercept._id) {
35 + Module._extensions['.js'] = intercept;
36 +}
1 +{
2 + "_from": "amdefine@>=0.0.4",
3 + "_id": "amdefine@1.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
6 + "_location": "/amdefine",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "amdefine@>=0.0.4",
12 + "name": "amdefine",
13 + "escapedName": "amdefine",
14 + "rawSpec": ">=0.0.4",
15 + "saveSpec": null,
16 + "fetchSpec": ">=0.0.4"
17 + },
18 + "_requiredBy": [
19 + "/source-map",
20 + "/transformers/source-map"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
23 + "_shasum": "4a5282ac164729e93619bcfd3ad151f817ce91f5",
24 + "_spec": "amdefine@>=0.0.4",
25 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/source-map",
26 + "author": {
27 + "name": "James Burke",
28 + "email": "jrburke@gmail.com",
29 + "url": "http://github.com/jrburke"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/jrburke/amdefine/issues"
33 + },
34 + "bundleDependencies": false,
35 + "deprecated": false,
36 + "description": "Provide AMD's define() API for declaring modules in the AMD format",
37 + "engines": {
38 + "node": ">=0.4.2"
39 + },
40 + "homepage": "http://github.com/jrburke/amdefine",
41 + "license": "BSD-3-Clause OR MIT",
42 + "main": "./amdefine.js",
43 + "name": "amdefine",
44 + "repository": {
45 + "type": "git",
46 + "url": "git+https://github.com/jrburke/amdefine.git"
47 + },
48 + "version": "1.0.1"
49 +}
1 +'use strict';
2 +module.exports = function () {
3 + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
4 +};
1 +The MIT License (MIT)
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in
13 +all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 +THE SOFTWARE.
1 +{
2 + "_from": "ansi-regex@^2.0.0",
3 + "_id": "ansi-regex@2.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
6 + "_location": "/ansi-regex",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "ansi-regex@^2.0.0",
12 + "name": "ansi-regex",
13 + "escapedName": "ansi-regex",
14 + "rawSpec": "^2.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^2.0.0"
17 + },
18 + "_requiredBy": [
19 + "/strip-ansi"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
22 + "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
23 + "_spec": "ansi-regex@^2.0.0",
24 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/strip-ansi",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/chalk/ansi-regex/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Regular expression for matching ANSI escape codes",
36 + "devDependencies": {
37 + "ava": "0.17.0",
38 + "xo": "0.16.0"
39 + },
40 + "engines": {
41 + "node": ">=0.10.0"
42 + },
43 + "files": [
44 + "index.js"
45 + ],
46 + "homepage": "https://github.com/chalk/ansi-regex#readme",
47 + "keywords": [
48 + "ansi",
49 + "styles",
50 + "color",
51 + "colour",
52 + "colors",
53 + "terminal",
54 + "console",
55 + "cli",
56 + "string",
57 + "tty",
58 + "escape",
59 + "formatting",
60 + "rgb",
61 + "256",
62 + "shell",
63 + "xterm",
64 + "command-line",
65 + "text",
66 + "regex",
67 + "regexp",
68 + "re",
69 + "match",
70 + "test",
71 + "find",
72 + "pattern"
73 + ],
74 + "license": "MIT",
75 + "maintainers": [
76 + {
77 + "name": "Sindre Sorhus",
78 + "email": "sindresorhus@gmail.com",
79 + "url": "sindresorhus.com"
80 + },
81 + {
82 + "name": "Joshua Appelman",
83 + "email": "jappelman@xebia.com",
84 + "url": "jbnicolai.com"
85 + },
86 + {
87 + "name": "JD Ballard",
88 + "email": "i.am.qix@gmail.com",
89 + "url": "github.com/qix-"
90 + }
91 + ],
92 + "name": "ansi-regex",
93 + "repository": {
94 + "type": "git",
95 + "url": "git+https://github.com/chalk/ansi-regex.git"
96 + },
97 + "scripts": {
98 + "test": "xo && ava --verbose",
99 + "view-supported": "node fixtures/view-codes.js"
100 + },
101 + "version": "2.1.1",
102 + "xo": {
103 + "rules": {
104 + "guard-for-in": 0,
105 + "no-loop-func": 0
106 + }
107 + }
108 +}
1 +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
2 +
3 +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
4 +
5 +
6 +## Install
7 +
8 +```
9 +$ npm install --save ansi-regex
10 +```
11 +
12 +
13 +## Usage
14 +
15 +```js
16 +const ansiRegex = require('ansi-regex');
17 +
18 +ansiRegex().test('\u001b[4mcake\u001b[0m');
19 +//=> true
20 +
21 +ansiRegex().test('cake');
22 +//=> false
23 +
24 +'\u001b[4mcake\u001b[0m'.match(ansiRegex());
25 +//=> ['\u001b[4m', '\u001b[0m']
26 +```
27 +
28 +## FAQ
29 +
30 +### Why do you test for codes not in the ECMA 48 standard?
31 +
32 +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
33 +
34 +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
35 +
36 +
37 +## License
38 +
39 +MIT © [Sindre Sorhus](http://sindresorhus.com)
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in
13 +all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 +THE SOFTWARE.
1 +# Array Flatten
2 +
3 +[![NPM version][npm-image]][npm-url]
4 +[![NPM downloads][downloads-image]][downloads-url]
5 +[![Build status][travis-image]][travis-url]
6 +[![Test coverage][coveralls-image]][coveralls-url]
7 +
8 +> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
9 +
10 +## Installation
11 +
12 +```
13 +npm install array-flatten --save
14 +```
15 +
16 +## Usage
17 +
18 +```javascript
19 +var flatten = require('array-flatten')
20 +
21 +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
22 +//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
23 +
24 +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
25 +//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
26 +
27 +(function () {
28 + flatten(arguments) //=> [1, 2, 3]
29 +})(1, [2, 3])
30 +```
31 +
32 +## License
33 +
34 +MIT
35 +
36 +[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
37 +[npm-url]: https://npmjs.org/package/array-flatten
38 +[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
39 +[downloads-url]: https://npmjs.org/package/array-flatten
40 +[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
41 +[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
42 +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
43 +[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
1 +'use strict'
2 +
3 +/**
4 + * Expose `arrayFlatten`.
5 + */
6 +module.exports = arrayFlatten
7 +
8 +/**
9 + * Recursive flatten function with depth.
10 + *
11 + * @param {Array} array
12 + * @param {Array} result
13 + * @param {Number} depth
14 + * @return {Array}
15 + */
16 +function flattenWithDepth (array, result, depth) {
17 + for (var i = 0; i < array.length; i++) {
18 + var value = array[i]
19 +
20 + if (depth > 0 && Array.isArray(value)) {
21 + flattenWithDepth(value, result, depth - 1)
22 + } else {
23 + result.push(value)
24 + }
25 + }
26 +
27 + return result
28 +}
29 +
30 +/**
31 + * Recursive flatten function. Omitting depth is slightly faster.
32 + *
33 + * @param {Array} array
34 + * @param {Array} result
35 + * @return {Array}
36 + */
37 +function flattenForever (array, result) {
38 + for (var i = 0; i < array.length; i++) {
39 + var value = array[i]
40 +
41 + if (Array.isArray(value)) {
42 + flattenForever(value, result)
43 + } else {
44 + result.push(value)
45 + }
46 + }
47 +
48 + return result
49 +}
50 +
51 +/**
52 + * Flatten an array, with the ability to define a depth.
53 + *
54 + * @param {Array} array
55 + * @param {Number} depth
56 + * @return {Array}
57 + */
58 +function arrayFlatten (array, depth) {
59 + if (depth == null) {
60 + return flattenForever(array, [])
61 + }
62 +
63 + return flattenWithDepth(array, [], depth)
64 +}
1 +{
2 + "_from": "array-flatten@1.1.1",
3 + "_id": "array-flatten@1.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
6 + "_location": "/array-flatten",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "array-flatten@1.1.1",
12 + "name": "array-flatten",
13 + "escapedName": "array-flatten",
14 + "rawSpec": "1.1.1",
15 + "saveSpec": null,
16 + "fetchSpec": "1.1.1"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
22 + "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
23 + "_spec": "array-flatten@1.1.1",
24 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/express",
25 + "author": {
26 + "name": "Blake Embrey",
27 + "email": "hello@blakeembrey.com",
28 + "url": "http://blakeembrey.me"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/blakeembrey/array-flatten/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Flatten an array of nested arrays into a single flat array",
36 + "devDependencies": {
37 + "istanbul": "^0.3.13",
38 + "mocha": "^2.2.4",
39 + "pre-commit": "^1.0.7",
40 + "standard": "^3.7.3"
41 + },
42 + "files": [
43 + "array-flatten.js",
44 + "LICENSE"
45 + ],
46 + "homepage": "https://github.com/blakeembrey/array-flatten",
47 + "keywords": [
48 + "array",
49 + "flatten",
50 + "arguments",
51 + "depth"
52 + ],
53 + "license": "MIT",
54 + "main": "array-flatten.js",
55 + "name": "array-flatten",
56 + "repository": {
57 + "type": "git",
58 + "url": "git://github.com/blakeembrey/array-flatten.git"
59 + },
60 + "scripts": {
61 + "test": "istanbul cover _mocha -- -R spec"
62 + },
63 + "version": "1.1.1"
64 +}
1 +
2 +Copyright 2009–2013 Contributors. All rights reserved.
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to
5 +deal in the Software without restriction, including without limitation the
6 +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 +sell copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 +IN THE SOFTWARE.
20 +
1 +
2 +# ASAP
3 +
4 +This `asap` CommonJS package contains a single `asap` module that
5 +exports a single `asap` function that executes a function **as soon as
6 +possible**.
7 +
8 +```javascript
9 +asap(function () {
10 + // ...
11 +});
12 +```
13 +
14 +More formally, ASAP provides a fast event queue that will execute tasks
15 +until it is empty before yielding to the JavaScript engine's underlying
16 +event-loop. When the event queue becomes non-empty, ASAP schedules a
17 +flush event, preferring for that event to occur before the JavaScript
18 +engine has an opportunity to perform IO tasks or rendering, thus making
19 +the first task and subsequent tasks semantically indistinguishable.
20 +ASAP uses a variety of techniques to preserve this invariant on
21 +different versions of browsers and NodeJS.
22 +
23 +By design, ASAP can starve the event loop on the theory that, if there
24 +is enough work to be done synchronously, albeit in separate events, long
25 +enough to starve input or output, it is a strong indicator that the
26 +program needs to push back on scheduling more work.
27 +
28 +Take care. ASAP can sustain infinite recursive calls indefinitely
29 +without warning. This is behaviorally equivalent to an infinite loop.
30 +It will not halt from a stack overflow, but it *will* chew through
31 +memory (which is an oddity I cannot explain at this time). Just as with
32 +infinite loops, you can monitor a Node process for this behavior with a
33 +heart-beat signal. As with infinite loops, a very small amount of
34 +caution goes a long way to avoiding problems.
35 +
36 +```javascript
37 +function loop() {
38 + asap(loop);
39 +}
40 +loop();
41 +```
42 +
43 +ASAP is distinct from `setImmediate` in that it does not suffer the
44 +overhead of returning a handle and being possible to cancel. For a
45 +`setImmediate` shim, consider [setImmediate][].
46 +
47 +[setImmediate]: https://github.com/noblejs/setimmediate
48 +
49 +If a task throws an exception, it will not interrupt the flushing of
50 +high-priority tasks. The exception will be postponed to a later,
51 +low-priority event to avoid slow-downs, when the underlying JavaScript
52 +engine will treat it as it does any unhandled exception.
53 +
54 +## Heritage
55 +
56 +ASAP has been factored out of the [Q][] asynchronous promise library.
57 +It originally had a naïve implementation in terms of `setTimeout`, but
58 +[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be
59 +useful for creating a high-priority, no-delay event dispatch hack.
60 +Since then, Internet Explorer proposed and implemented `setImmediate`.
61 +Robert Kratić began contributing to Q by measuring the performance of
62 +the internal implementation of `asap`, paying particular attention to
63 +error recovery. Domenic, Robert, and I collectively settled on the
64 +current strategy of unrolling the high-priority event queue internally
65 +regardless of what strategy we used to dispatch the potentially
66 +lower-priority flush event. Domenic went on to make ASAP cooperate with
67 +NodeJS domains.
68 +
69 +[Q]: https://github.com/kriskowal/q
70 +[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html
71 +
72 +For further reading, Nicholas Zakas provided a thorough article on [The
73 +Case for setImmediate][NCZ].
74 +
75 +[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/
76 +
77 +## License
78 +
79 +Copyright 2009-2013 by Contributors
80 +MIT License (enclosed)
81 +
1 +
2 +// Use the fastest possible means to execute a task in a future turn
3 +// of the event loop.
4 +
5 +// linked list of tasks (single, with head node)
6 +var head = {task: void 0, next: null};
7 +var tail = head;
8 +var flushing = false;
9 +var requestFlush = void 0;
10 +var isNodeJS = false;
11 +
12 +function flush() {
13 + /* jshint loopfunc: true */
14 +
15 + while (head.next) {
16 + head = head.next;
17 + var task = head.task;
18 + head.task = void 0;
19 + var domain = head.domain;
20 +
21 + if (domain) {
22 + head.domain = void 0;
23 + domain.enter();
24 + }
25 +
26 + try {
27 + task();
28 +
29 + } catch (e) {
30 + if (isNodeJS) {
31 + // In node, uncaught exceptions are considered fatal errors.
32 + // Re-throw them synchronously to interrupt flushing!
33 +
34 + // Ensure continuation if the uncaught exception is suppressed
35 + // listening "uncaughtException" events (as domains does).
36 + // Continue in next event to avoid tick recursion.
37 + if (domain) {
38 + domain.exit();
39 + }
40 + setTimeout(flush, 0);
41 + if (domain) {
42 + domain.enter();
43 + }
44 +
45 + throw e;
46 +
47 + } else {
48 + // In browsers, uncaught exceptions are not fatal.
49 + // Re-throw them asynchronously to avoid slow-downs.
50 + setTimeout(function() {
51 + throw e;
52 + }, 0);
53 + }
54 + }
55 +
56 + if (domain) {
57 + domain.exit();
58 + }
59 + }
60 +
61 + flushing = false;
62 +}
63 +
64 +if (typeof process !== "undefined" && process.nextTick) {
65 + // Node.js before 0.9. Note that some fake-Node environments, like the
66 + // Mocha test runner, introduce a `process` global without a `nextTick`.
67 + isNodeJS = true;
68 +
69 + requestFlush = function () {
70 + process.nextTick(flush);
71 + };
72 +
73 +} else if (typeof setImmediate === "function") {
74 + // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate
75 + if (typeof window !== "undefined") {
76 + requestFlush = setImmediate.bind(window, flush);
77 + } else {
78 + requestFlush = function () {
79 + setImmediate(flush);
80 + };
81 + }
82 +
83 +} else if (typeof MessageChannel !== "undefined") {
84 + // modern browsers
85 + // http://www.nonblocking.io/2011/06/windownexttick.html
86 + var channel = new MessageChannel();
87 + channel.port1.onmessage = flush;
88 + requestFlush = function () {
89 + channel.port2.postMessage(0);
90 + };
91 +
92 +} else {
93 + // old browsers
94 + requestFlush = function () {
95 + setTimeout(flush, 0);
96 + };
97 +}
98 +
99 +function asap(task) {
100 + tail = tail.next = {
101 + task: task,
102 + domain: isNodeJS && process.domain,
103 + next: null
104 + };
105 +
106 + if (!flushing) {
107 + flushing = true;
108 + requestFlush();
109 + }
110 +};
111 +
112 +module.exports = asap;
113 +
1 +{
2 + "_from": "asap@~1.0.0",
3 + "_id": "asap@1.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha1-sqRdpf36ILBJb8N2jMJ8EvqRan0=",
6 + "_location": "/asap",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "asap@~1.0.0",
12 + "name": "asap",
13 + "escapedName": "asap",
14 + "rawSpec": "~1.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.0.0"
17 + },
18 + "_requiredBy": [
19 + "/promise"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz",
22 + "_shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d",
23 + "_spec": "asap@~1.0.0",
24 + "_where": "/Users/ganghyeontae/Desktop/R_BACKEND/backend/node_modules/promise",
25 + "bundleDependencies": false,
26 + "deprecated": false,
27 + "description": "High-priority task queue for Node.js and browsers",
28 + "keywords": [
29 + "event",
30 + "task",
31 + "queue"
32 + ],
33 + "licenses": [
34 + {
35 + "type": "MIT",
36 + "url": "https://github.com/kriskowal/asap/raw/master/LICENSE.md"
37 + }
38 + ],
39 + "main": "asap",
40 + "name": "asap",
41 + "version": "1.0.0"
42 +}
1 +2.0.0 / 2017-09-12
2 +==================
3 +
4 + * Drop support for Node.js below 0.8
5 + * Remove `auth(ctx)` signature -- pass in header or `auth(ctx.req)`
6 + * Use `safe-buffer` for improved Buffer API
7 +
8 +1.1.0 / 2016-11-18
9 +==================
10 +
11 + * Add `auth.parse` for low-level string parsing
12 +
13 +1.0.4 / 2016-05-10
14 +==================
15 +
16 + * Improve error message when `req` argument is not an object
17 + * Improve error message when `req` missing `headers` property
18 +
19 +1.0.3 / 2015-07-01
20 +==================
21 +
22 + * Fix regression accepting a Koa context
23 +
24 +1.0.2 / 2015-06-12
25 +==================
26 +
27 + * Improve error message when `req` argument missing
28 + * perf: enable strict mode
29 + * perf: hoist regular expression
30 + * perf: parse with regular expressions
31 + * perf: remove argument reassignment
32 +
33 +1.0.1 / 2015-05-04
34 +==================
35 +
36 + * Update readme
37 +
38 +1.0.0 / 2014-07-01
39 +==================
40 +
41 + * Support empty password
42 + * Support empty username
43 +
44 +0.0.1 / 2013-11-30
45 +==================
46 +
47 + * Initial release
1 +(The MIT License)
2 +
3 +Copyright (c) 2013 TJ Holowaychuk
4 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
5 +Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com>
6 +
7 +Permission is hereby granted, free of charge, to any person obtaining
8 +a copy of this software and associated documentation files (the
9 +'Software'), to deal in the Software without restriction, including
10 +without limitation the rights to use, copy, modify, merge, publish,
11 +distribute, sublicense, and/or sell copies of the Software, and to
12 +permit persons to whom the Software is furnished to do so, subject to
13 +the following conditions:
14 +
15 +The above copyright notice and this permission notice shall be
16 +included in all copies or substantial portions of the Software.
17 +
18 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# basic-auth
2 +
3 +[![NPM Version][npm-image]][npm-url]
4 +[![NPM Downloads][downloads-image]][downloads-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][travis-image]][travis-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Generic basic auth Authorization header field parser for whatever.
10 +
11 +## Installation
12 +
13 +This is a [Node.js](https://nodejs.org/en/) module available through the
14 +[npm registry](https://www.npmjs.com/). Installation is done using the
15 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
16 +
17 +```
18 +$ npm install basic-auth
19 +```
20 +
21 +## API
22 +
23 +<!-- eslint-disable no-unused-vars -->
24 +
25 +```js
26 +var auth = require('basic-auth')
27 +```
28 +
29 +### auth(req)
30 +
31 +Get the basic auth credentials from the given request. The `Authorization`
32 +header is parsed and if the header is invalid, `undefined` is returned,
33 +otherwise an object with `name` and `pass` properties.
34 +
35 +### auth.parse(string)
36 +
37 +Parse a basic auth authorization header string. This will return an object
38 +with `name` and `pass` properties, or `undefined` if the string is invalid.
39 +
40 +## Example
41 +
42 +Pass a Node.js request object to the module export. If parsing fails
43 +`undefined` is returned, otherwise an object with `.name` and `.pass`.
44 +
45 +<!-- eslint-disable no-unused-vars, no-undef -->
46 +
47 +```js
48 +var auth = require('basic-auth')
49 +var user = auth(req)
50 +// => { name: 'something', pass: 'whatever' }
51 +```
52 +
53 +A header string from any other location can also be parsed with
54 +`auth.parse`, for example a `Proxy-Authorization` header:
55 +
56 +<!-- eslint-disable no-unused-vars, no-undef -->
57 +
58 +```js
59 +var auth = require('basic-auth')
60 +var user = auth.parse(req.getHeader('Proxy-Authorization'))
61 +```
62 +
63 +### With vanilla node.js http server
64 +
65 +```js
66 +var http = require('http')
67 +var auth = require('basic-auth')
68 +
69 +// Create server
70 +var server = http.createServer(function (req, res) {
71 + var credentials = auth(req)
72 +
73 + if (!credentials || credentials.name !== 'john' || credentials.pass !== 'secret') {
74 + res.statusCode = 401
75 + res.setHeader('WWW-Authenticate', 'Basic realm="example"')
76 + res.end('Access denied')
77 + } else {
78 + res.end('Access granted')
79 + }
80 +})
81 +
82 +// Listen
83 +server.listen(3000)
84 +```
85 +
86 +# License
87 +
88 +[MIT](LICENSE)
89 +
90 +[npm-image]: https://img.shields.io/npm/v/basic-auth.svg
91 +[npm-url]: https://npmjs.org/package/basic-auth
92 +[node-version-image]: https://img.shields.io/node/v/basic-auth.svg
93 +[node-version-url]: https://nodejs.org/en/download
94 +[travis-image]: https://img.shields.io/travis/jshttp/basic-auth/master.svg
95 +[travis-url]: https://travis-ci.org/jshttp/basic-auth
96 +[coveralls-image]: https://img.shields.io/coveralls/jshttp/basic-auth/master.svg
97 +[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
98 +[downloads-image]: https://img.shields.io/npm/dm/basic-auth.svg
99 +[downloads-url]: https://npmjs.org/package/basic-auth
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.