choi

make comment function, but can delete it

Showing 1000 changed files with 3850 additions and 425 deletions

Too many changes to show.

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

...@@ -24,8 +24,15 @@ var LocalStrategy = require('passport-local').Strategy ...@@ -24,8 +24,15 @@ var LocalStrategy = require('passport-local').Strategy
24 var session = require('express-session') 24 var session = require('express-session')
25 var flash = require('connect-flash') 25 var flash = require('connect-flash')
26 var path = require('path') 26 var path = require('path')
27 -const PORT = 3000 27 +const PORT = 3003
28 28
29 +var jsdom = require('jsdom');
30 +const { JSDOM } = jsdom;
31 +const { window } = new JSDOM();
32 +const { document } = (new JSDOM('')).window;
33 +global.document = document;
34 +
35 +var $ = jQuery = require('jquery')(window);
29 app.use(bodyParser.json()) 36 app.use(bodyParser.json())
30 app.use(bodyParser.urlencoded({extended:true})) 37 app.use(bodyParser.urlencoded({extended:true}))
31 app.use("/public", express.static(__dirname + "/public")); // static directory 38 app.use("/public", express.static(__dirname + "/public")); // static directory
...@@ -35,6 +42,7 @@ app.use("/css", express.static(__dirname + "/css")); ...@@ -35,6 +42,7 @@ app.use("/css", express.static(__dirname + "/css"));
35 app.use("/assets", express.static(__dirname + "/assets")); 42 app.use("/assets", express.static(__dirname + "/assets"));
36 app.use("/js", express.static(__dirname + "/js")); 43 app.use("/js", express.static(__dirname + "/js"));
37 app.use("/chat", express.static(__dirname+ "/chat")); 44 app.use("/chat", express.static(__dirname+ "/chat"));
45 +app.use("/node_modules", express.static(path.join(__dirname+ "/node_modules")));
38 app.set('view engine', 'ejs') 46 app.set('view engine', 'ejs')
39 47
40 // 로그용 48 // 로그용
......
1 /* 메인 */ 1 /* 메인 */
2 #main { 2 #main {
3 margin: auto; 3 margin: auto;
4 - margin-top: 100px; 4 + margin-top: 10px;
5 + margin-bottom: 10px;
5 border-radius: 20px; 6 border-radius: 20px;
6 - background-color: lightblue; 7 + background-color: #B2C7D9;
7 text-align: center; 8 text-align: center;
8 width: 500px; 9 width: 500px;
9 height: 800px; 10 height: 800px;
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
13 #chat { 14 #chat {
14 height: 90%; 15 height: 90%;
15 width: 100%; 16 width: 100%;
17 + padding-top: 10px;
16 overflow-y: auto; 18 overflow-y: auto;
17 -ms-overflow-style: none; /* IE and Edge */ 19 -ms-overflow-style: none; /* IE and Edge */
18 scrollbar-width: none; /* Firefox */ 20 scrollbar-width: none; /* Firefox */
...@@ -27,8 +29,8 @@ ...@@ -27,8 +29,8 @@
27 width: 90%; 29 width: 90%;
28 margin-left: 5%; 30 margin-left: 5%;
29 margin-right: 5%; 31 margin-right: 5%;
30 - margin-top: 10px; 32 + margin-bottom: 10px;
31 - background-color: aquamarine; 33 + background-color: #A9BDCE;
32 text-align: center; 34 text-align: center;
33 clear:both; 35 clear:both;
34 float:center; 36 float:center;
...@@ -39,8 +41,8 @@ ...@@ -39,8 +41,8 @@
39 width: 90%; 41 width: 90%;
40 margin-left: 5%; 42 margin-left: 5%;
41 margin-right: 5%; 43 margin-right: 5%;
42 - margin-top: 10px; 44 + margin-bottom: 10px;
43 - background-color: indianred; 45 + background-color: #A9BDCE;
44 text-align: center; 46 text-align: center;
45 clear:both; 47 clear:both;
46 float:center; 48 float:center;
...@@ -48,26 +50,37 @@ ...@@ -48,26 +50,37 @@
48 50
49 /* 내가 보낸 메시지 */ 51 /* 내가 보낸 메시지 */
50 .me { 52 .me {
51 - background-color: lemonchiffon; 53 + background-color: #FFEB33;
52 border-radius: 5px; 54 border-radius: 5px;
53 - margin-top: 10px; 55 + margin-bottom: 10px;
54 - margin-left: 5%; 56 + margin-left: 30%;
55 margin-right: 5%; 57 margin-right: 5%;
56 - padding: 3px; 58 + padding: 3px;
59 + padding-left: 10px;
60 + padding-right: 10px;
57 text-align: right; 61 text-align: right;
58 clear:both; 62 clear:both;
59 float:right; 63 float:right;
64 + word-break: break-all
60 } 65 }
61 66
62 /* 상대방이 보낸 메시지 */ 67 /* 상대방이 보낸 메시지 */
63 .other { 68 .other {
64 - background-color: white; 69 + background-color:#FFFFFF;
65 border-radius: 5px; 70 border-radius: 5px;
66 - margin-top: 10px; 71 + margin-bottom: 10px;
67 margin-left: 5%; 72 margin-left: 5%;
68 - margin-right: 5%; 73 + margin-right: 30%;
69 - padding: 3px; 74 + padding: 3px;
75 + padding-left: 10px;
76 + padding-right: 10px;
70 text-align: left; 77 text-align: left;
71 clear:both; 78 clear:both;
72 float:left; 79 float:left;
80 + }
81 +
82 + #input{
83 + width: 90%;
84 + margin-left: 5%;
85 + margin-right: 5%;
73 } 86 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -13,7 +13,12 @@ socket.on('update', function(data) { ...@@ -13,7 +13,12 @@ socket.on('update', function(data) {
13 var chat = document.getElementById('chat') 13 var chat = document.getElementById('chat')
14 14
15 var message = document.createElement('div') 15 var message = document.createElement('div')
16 - var node = document.createTextNode(`${data.name}: ${data.message}`) 16 + var node;
17 + if(data.name != "SERVER"){
18 + node = document.createTextNode(`${data.name}: ${data.message}`)
19 + } else{
20 + node = document.createTextNode(`${data.message}`)
21 + }
17 var className = '' 22 var className = ''
18 23
19 // 타입에 따라 적용할 클래스를 다르게 지정 24 // 타입에 따라 적용할 클래스를 다르게 지정
...@@ -48,7 +53,7 @@ function send() { ...@@ -48,7 +53,7 @@ function send() {
48 var message = document.getElementById('test').value 53 var message = document.getElementById('test').value
49 54
50 // 공백이 아닐때 55 // 공백이 아닐때
51 - if(message != ''){ 56 + if(!(message.replace(/\s| /gi, "").length == 0)){
52 // 가져왔으니 데이터 빈칸으로 변경 57 // 가져왔으니 데이터 빈칸으로 변경
53 document.getElementById('test').value = '' 58 document.getElementById('test').value = ''
54 59
...@@ -61,8 +66,12 @@ function send() { ...@@ -61,8 +66,12 @@ function send() {
61 chat.appendChild(msg) 66 chat.appendChild(msg)
62 67
63 // 서버로 message 이벤트 전달 + 데이터와 함께 68 // 서버로 message 이벤트 전달 + 데이터와 함께
69 +
64 socket.emit('message', {type: 'message', message: message}) 70 socket.emit('message', {type: 'message', message: message})
65 - } 71 + } else{
72 + alert("내용을 입력해주세요.");
73 +}
74 +
66 function a(chat = 'chat'){ 75 function a(chat = 'chat'){
67 var element = document.getElementById(chat); 76 var element = document.getElementById(chat);
68 element.scrollTop = element.scrollHeight - element.clientHeight; 77 element.scrollTop = element.scrollHeight - element.clientHeight;
......
1 +MIT License
2 +
3 +Copyright (c) 2020 Nathan Rajlich
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 all
13 +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 THE
21 +SOFTWARE.
1 +# @tootallnate/once
2 +
3 +### Creates a Promise that waits for a single event
4 +
5 +## Installation
6 +
7 +Install with `npm`:
8 +
9 +```bash
10 +$ npm install @tootallnate/once
11 +```
12 +
13 +## API
14 +
15 +### once(emitter: EventEmitter, name: string, opts?: OnceOptions): Promise<[...Args]>
16 +
17 +Creates a Promise that waits for event `name` to occur on `emitter`, and resolves
18 +the promise with an array of the values provided to the event handler. If an
19 +`error` event occurs before the event specified by `name`, then the Promise is
20 +rejected with the error argument.
21 +
22 +```typescript
23 +import once from '@tootallnate/once';
24 +import { EventEmitter } from 'events';
25 +
26 +const emitter = new EventEmitter();
27 +
28 +setTimeout(() => {
29 + emitter.emit('foo', 'bar');
30 +}, 100);
31 +
32 +const [result] = await once(emitter, 'foo');
33 +console.log({ result });
34 +// { result: 'bar' }
35 +```
36 +
37 +#### Promise Strong Typing
38 +
39 +The main feature that this module provides over other "once" implementations is that
40 +the Promise that is returned is _**strongly typed**_ based on the type of `emitter`
41 +and the `name` of the event. Some examples are shown below.
42 +
43 +_The process "exit" event contains a single number for exit code:_
44 +
45 +```typescript
46 +const [code] = await once(process, 'exit');
47 +// ^ number
48 +```
49 +_A child process "exit" event contains either an exit code or a signal:_
50 +
51 +```typescript
52 +const child = spawn('echo', []);
53 +const [code, signal] = await once(child, 'exit');
54 +// ^ number | null
55 +// ^ string | null
56 +```
57 +
58 +_A forked child process "message" event is type `any`, so you can cast the Promise directly:_
59 +
60 +```typescript
61 +const child = fork('file.js');
62 +
63 +// With `await`
64 +const [message, _]: [WorkerPayload, unknown] = await once(child, 'message');
65 +
66 +// With Promise
67 +const messagePromise: Promise<[WorkerPayload, unknown]> = once(child, 'message');
68 +
69 +// Better yet would be to leave it as `any`, and validate the payload
70 +// at runtime with i.e. `ajv` + `json-schema-to-typescript`
71 +```
72 +
73 +_If the TypeScript definition does not contain an overload for the specified event name, then the Promise will have type `unknown[]` and your code will need to narrow the result manually:_
74 +
75 +```typescript
76 +interface CustomEmitter extends EventEmitter {
77 + on(name: 'foo', listener: (a: string, b: number) => void): this;
78 +}
79 +
80 +const emitter: CustomEmitter = new EventEmitter();
81 +
82 +// "foo" event is a defined overload, so it's properly typed
83 +const fooPromise = once(emitter, 'foo');
84 +// ^ Promise<[a: string, b: number]>
85 +
86 +// "bar" event in not a defined overload, so it gets `unknown[]`
87 +const barPromise = once(emitter, 'bar');
88 +// ^ Promise<unknown[]>
89 +```
90 +
91 +### OnceOptions
92 +
93 +- `signal` - `AbortSignal` instance to unbind event handlers before the Promise has been fulfilled.
1 +/// <reference types="node" />
2 +import { EventEmitter } from 'events';
3 +import { EventNames, EventListenerParameters, AbortSignal } from './types';
4 +export interface OnceOptions {
5 + signal?: AbortSignal;
6 +}
7 +export default function once<Emitter extends EventEmitter, Event extends EventNames<Emitter>>(emitter: Emitter, name: Event, { signal }?: OnceOptions): Promise<EventListenerParameters<Emitter, Event>>;
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +function once(emitter, name, { signal } = {}) {
4 + return new Promise((resolve, reject) => {
5 + function cleanup() {
6 + signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cleanup);
7 + emitter.removeListener(name, onEvent);
8 + emitter.removeListener('error', onError);
9 + }
10 + function onEvent(...args) {
11 + cleanup();
12 + resolve(args);
13 + }
14 + function onError(err) {
15 + cleanup();
16 + reject(err);
17 + }
18 + signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cleanup);
19 + emitter.on(name, onEvent);
20 + emitter.on('error', onError);
21 + });
22 +}
23 +exports.default = once;
24 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAOA,SAAwB,IAAI,CAI3B,OAAgB,EAChB,IAAW,EACX,EAAE,MAAM,KAAkB,EAAE;IAE5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,SAAS,OAAO;YACf,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,SAAS,OAAO,CAAC,GAAG,IAAW;YAC9B,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAA+C,CAAC,CAAC;QAC1D,CAAC;QACD,SAAS,OAAO,CAAC,GAAU;YAC1B,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QACD,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AA1BD,uBA0BC"}
...\ No newline at end of file ...\ No newline at end of file
1 +export declare type OverloadedParameters<T> = T extends {
2 + (...args: infer A1): any;
3 + (...args: infer A2): any;
4 + (...args: infer A3): any;
5 + (...args: infer A4): any;
6 + (...args: infer A5): any;
7 + (...args: infer A6): any;
8 + (...args: infer A7): any;
9 + (...args: infer A8): any;
10 + (...args: infer A9): any;
11 + (...args: infer A10): any;
12 + (...args: infer A11): any;
13 + (...args: infer A12): any;
14 + (...args: infer A13): any;
15 + (...args: infer A14): any;
16 + (...args: infer A15): any;
17 + (...args: infer A16): any;
18 + (...args: infer A17): any;
19 + (...args: infer A18): any;
20 + (...args: infer A19): any;
21 + (...args: infer A20): any;
22 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 | A20 : T extends {
23 + (...args: infer A1): any;
24 + (...args: infer A2): any;
25 + (...args: infer A3): any;
26 + (...args: infer A4): any;
27 + (...args: infer A5): any;
28 + (...args: infer A6): any;
29 + (...args: infer A7): any;
30 + (...args: infer A8): any;
31 + (...args: infer A9): any;
32 + (...args: infer A10): any;
33 + (...args: infer A11): any;
34 + (...args: infer A12): any;
35 + (...args: infer A13): any;
36 + (...args: infer A14): any;
37 + (...args: infer A15): any;
38 + (...args: infer A16): any;
39 + (...args: infer A17): any;
40 + (...args: infer A18): any;
41 + (...args: infer A19): any;
42 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 : T extends {
43 + (...args: infer A1): any;
44 + (...args: infer A2): any;
45 + (...args: infer A3): any;
46 + (...args: infer A4): any;
47 + (...args: infer A5): any;
48 + (...args: infer A6): any;
49 + (...args: infer A7): any;
50 + (...args: infer A8): any;
51 + (...args: infer A9): any;
52 + (...args: infer A10): any;
53 + (...args: infer A11): any;
54 + (...args: infer A12): any;
55 + (...args: infer A13): any;
56 + (...args: infer A14): any;
57 + (...args: infer A15): any;
58 + (...args: infer A16): any;
59 + (...args: infer A17): any;
60 + (...args: infer A18): any;
61 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 : T extends {
62 + (...args: infer A1): any;
63 + (...args: infer A2): any;
64 + (...args: infer A3): any;
65 + (...args: infer A4): any;
66 + (...args: infer A5): any;
67 + (...args: infer A6): any;
68 + (...args: infer A7): any;
69 + (...args: infer A8): any;
70 + (...args: infer A9): any;
71 + (...args: infer A10): any;
72 + (...args: infer A11): any;
73 + (...args: infer A12): any;
74 + (...args: infer A13): any;
75 + (...args: infer A14): any;
76 + (...args: infer A15): any;
77 + (...args: infer A16): any;
78 + (...args: infer A17): any;
79 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 : T extends {
80 + (...args: infer A1): any;
81 + (...args: infer A2): any;
82 + (...args: infer A3): any;
83 + (...args: infer A4): any;
84 + (...args: infer A5): any;
85 + (...args: infer A6): any;
86 + (...args: infer A7): any;
87 + (...args: infer A8): any;
88 + (...args: infer A9): any;
89 + (...args: infer A10): any;
90 + (...args: infer A11): any;
91 + (...args: infer A12): any;
92 + (...args: infer A13): any;
93 + (...args: infer A14): any;
94 + (...args: infer A15): any;
95 + (...args: infer A16): any;
96 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 : T extends {
97 + (...args: infer A1): any;
98 + (...args: infer A2): any;
99 + (...args: infer A3): any;
100 + (...args: infer A4): any;
101 + (...args: infer A5): any;
102 + (...args: infer A6): any;
103 + (...args: infer A7): any;
104 + (...args: infer A8): any;
105 + (...args: infer A9): any;
106 + (...args: infer A10): any;
107 + (...args: infer A11): any;
108 + (...args: infer A12): any;
109 + (...args: infer A13): any;
110 + (...args: infer A14): any;
111 + (...args: infer A15): any;
112 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 : T extends {
113 + (...args: infer A1): any;
114 + (...args: infer A2): any;
115 + (...args: infer A3): any;
116 + (...args: infer A4): any;
117 + (...args: infer A5): any;
118 + (...args: infer A6): any;
119 + (...args: infer A7): any;
120 + (...args: infer A8): any;
121 + (...args: infer A9): any;
122 + (...args: infer A10): any;
123 + (...args: infer A11): any;
124 + (...args: infer A12): any;
125 + (...args: infer A13): any;
126 + (...args: infer A14): any;
127 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 : T extends {
128 + (...args: infer A1): any;
129 + (...args: infer A2): any;
130 + (...args: infer A3): any;
131 + (...args: infer A4): any;
132 + (...args: infer A5): any;
133 + (...args: infer A6): any;
134 + (...args: infer A7): any;
135 + (...args: infer A8): any;
136 + (...args: infer A9): any;
137 + (...args: infer A10): any;
138 + (...args: infer A11): any;
139 + (...args: infer A12): any;
140 + (...args: infer A13): any;
141 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 : T extends {
142 + (...args: infer A1): any;
143 + (...args: infer A2): any;
144 + (...args: infer A3): any;
145 + (...args: infer A4): any;
146 + (...args: infer A5): any;
147 + (...args: infer A6): any;
148 + (...args: infer A7): any;
149 + (...args: infer A8): any;
150 + (...args: infer A9): any;
151 + (...args: infer A10): any;
152 + (...args: infer A11): any;
153 + (...args: infer A12): any;
154 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 : T extends {
155 + (...args: infer A1): any;
156 + (...args: infer A2): any;
157 + (...args: infer A3): any;
158 + (...args: infer A4): any;
159 + (...args: infer A5): any;
160 + (...args: infer A6): any;
161 + (...args: infer A7): any;
162 + (...args: infer A8): any;
163 + (...args: infer A9): any;
164 + (...args: infer A10): any;
165 + (...args: infer A11): any;
166 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 : T extends {
167 + (...args: infer A1): any;
168 + (...args: infer A2): any;
169 + (...args: infer A3): any;
170 + (...args: infer A4): any;
171 + (...args: infer A5): any;
172 + (...args: infer A6): any;
173 + (...args: infer A7): any;
174 + (...args: infer A8): any;
175 + (...args: infer A9): any;
176 + (...args: infer A10): any;
177 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 : T extends {
178 + (...args: infer A1): any;
179 + (...args: infer A2): any;
180 + (...args: infer A3): any;
181 + (...args: infer A4): any;
182 + (...args: infer A5): any;
183 + (...args: infer A6): any;
184 + (...args: infer A7): any;
185 + (...args: infer A8): any;
186 + (...args: infer A9): any;
187 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 : T extends {
188 + (...args: infer A1): any;
189 + (...args: infer A2): any;
190 + (...args: infer A3): any;
191 + (...args: infer A4): any;
192 + (...args: infer A5): any;
193 + (...args: infer A6): any;
194 + (...args: infer A7): any;
195 + (...args: infer A8): any;
196 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 : T extends {
197 + (...args: infer A1): any;
198 + (...args: infer A2): any;
199 + (...args: infer A3): any;
200 + (...args: infer A4): any;
201 + (...args: infer A5): any;
202 + (...args: infer A6): any;
203 + (...args: infer A7): any;
204 +} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 : T extends {
205 + (...args: infer A1): any;
206 + (...args: infer A2): any;
207 + (...args: infer A3): any;
208 + (...args: infer A4): any;
209 + (...args: infer A5): any;
210 + (...args: infer A6): any;
211 +} ? A1 | A2 | A3 | A4 | A5 | A6 : T extends {
212 + (...args: infer A1): any;
213 + (...args: infer A2): any;
214 + (...args: infer A3): any;
215 + (...args: infer A4): any;
216 + (...args: infer A5): any;
217 +} ? A1 | A2 | A3 | A4 | A5 : T extends {
218 + (...args: infer A1): any;
219 + (...args: infer A2): any;
220 + (...args: infer A3): any;
221 + (...args: infer A4): any;
222 +} ? A1 | A2 | A3 | A4 : T extends {
223 + (...args: infer A1): any;
224 + (...args: infer A2): any;
225 + (...args: infer A3): any;
226 +} ? A1 | A2 | A3 : T extends {
227 + (...args: infer A1): any;
228 + (...args: infer A2): any;
229 +} ? A1 | A2 : T extends {
230 + (...args: infer A1): any;
231 +} ? A1 : any;
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +//# sourceMappingURL=overloaded-parameters.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"overloaded-parameters.js","sourceRoot":"","sources":["../src/overloaded-parameters.ts"],"names":[],"mappings":""}
...\ No newline at end of file ...\ No newline at end of file
1 +/// <reference types="node" />
2 +import { EventEmitter } from 'events';
3 +import { OverloadedParameters } from './overloaded-parameters';
4 +export declare type FirstParameter<T> = T extends [infer R, ...any[]] ? R : never;
5 +export declare type EventListener<F, T extends string | symbol> = F extends [
6 + T,
7 + infer R,
8 + ...any[]
9 +] ? R : never;
10 +export declare type EventParameters<Emitter extends EventEmitter> = OverloadedParameters<Emitter['on']>;
11 +export declare type EventNames<Emitter extends EventEmitter> = FirstParameter<EventParameters<Emitter>>;
12 +export declare type EventListenerParameters<Emitter extends EventEmitter, Event extends EventNames<Emitter>> = WithDefault<Parameters<EventListener<EventParameters<Emitter>, Event>>, unknown[]>;
13 +export declare type WithDefault<T, D> = [T] extends [never] ? D : T;
14 +export interface AbortSignal {
15 + addEventListener: (name: string, listener: (...args: any[]) => any) => void;
16 + removeEventListener: (name: string, listener: (...args: any[]) => any) => void;
17 +}
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +//# sourceMappingURL=types.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "_from": "@tootallnate/once@2",
3 + "_id": "@tootallnate/once@2.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
6 + "_location": "/@tootallnate/once",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@tootallnate/once@2",
12 + "name": "@tootallnate/once",
13 + "escapedName": "@tootallnate%2fonce",
14 + "scope": "@tootallnate",
15 + "rawSpec": "2",
16 + "saveSpec": null,
17 + "fetchSpec": "2"
18 + },
19 + "_requiredBy": [
20 + "/http-proxy-agent"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
23 + "_shasum": "f544a148d3ab35801c1f633a7441fd87c2e484bf",
24 + "_spec": "@tootallnate/once@2",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\http-proxy-agent",
26 + "author": {
27 + "name": "Nathan Rajlich",
28 + "email": "nathan@tootallnate.net",
29 + "url": "http://n8.io/"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/TooTallNate/once/issues"
33 + },
34 + "bundleDependencies": false,
35 + "deprecated": false,
36 + "description": "Creates a Promise that waits for a single event",
37 + "devDependencies": {
38 + "@types/jest": "^27.0.2",
39 + "@types/node": "^12.12.11",
40 + "abort-controller": "^3.0.0",
41 + "jest": "^27.2.1",
42 + "rimraf": "^3.0.0",
43 + "ts-jest": "^27.0.5",
44 + "typescript": "^4.4.3"
45 + },
46 + "engines": {
47 + "node": ">= 10"
48 + },
49 + "files": [
50 + "dist"
51 + ],
52 + "homepage": "https://github.com/TooTallNate/once#readme",
53 + "jest": {
54 + "preset": "ts-jest",
55 + "globals": {
56 + "ts-jest": {
57 + "diagnostics": false,
58 + "isolatedModules": true
59 + }
60 + },
61 + "verbose": false,
62 + "testEnvironment": "node",
63 + "testMatch": [
64 + "<rootDir>/test/**/*.test.ts"
65 + ]
66 + },
67 + "keywords": [],
68 + "license": "MIT",
69 + "main": "./dist/index.js",
70 + "name": "@tootallnate/once",
71 + "repository": {
72 + "type": "git",
73 + "url": "git://github.com/TooTallNate/once.git"
74 + },
75 + "scripts": {
76 + "build": "tsc",
77 + "prebuild": "rimraf dist",
78 + "prepublishOnly": "npm run build",
79 + "test": "jest"
80 + },
81 + "types": "./dist/index.d.ts",
82 + "version": "2.0.0"
83 +}
1 -## 6.4.0 (2019-11-26) 1 +## 7.4.0 (2020-08-03)
2 +
3 +### New features
4 +
5 +Add support for logical assignment operators.
6 +
7 +Add support for numeric separators.
8 +
9 +## 7.3.1 (2020-06-11)
10 +
11 +### Bug fixes
12 +
13 +Make the string in the `version` export match the actual library version.
14 +
15 +## 7.3.0 (2020-06-11)
16 +
17 +### Bug fixes
18 +
19 +Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
20 +
21 +### New features
22 +
23 +Add support for optional chaining (`?.`).
24 +
25 +## 7.2.0 (2020-05-09)
26 +
27 +### Bug fixes
28 +
29 +Fix precedence issue in parsing of async arrow functions.
30 +
31 +### New features
32 +
33 +Add support for nullish coalescing.
34 +
35 +Add support for `import.meta`.
36 +
37 +Support `export * as ...` syntax.
38 +
39 +Upgrade to Unicode 13.
40 +
41 +## 6.4.1 (2020-03-09)
42 +
43 +### Bug fixes
44 +
45 +More carefully check for valid UTF16 surrogate pairs in regexp validator.
46 +
47 +## 7.1.1 (2020-03-01)
48 +
49 +### Bug fixes
50 +
51 +Treat `\8` and `\9` as invalid escapes in template strings.
52 +
53 +Allow unicode escapes in property names that are keywords.
54 +
55 +Don't error on an exponential operator expression as argument to `await`.
56 +
57 +More carefully check for valid UTF16 surrogate pairs in regexp validator.
58 +
59 +## 7.1.0 (2019-09-24)
60 +
61 +### Bug fixes
62 +
63 +Disallow trailing object literal commas when ecmaVersion is less than 5.
2 64
3 ### New features 65 ### New features
4 66
5 Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on. 67 Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
6 68
69 +## 7.0.0 (2019-08-13)
70 +
71 +### Breaking changes
72 +
73 +Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
74 +
75 +Makes 10 (ES2019) the default value for the `ecmaVersion` option.
76 +
7 ## 6.3.0 (2019-08-12) 77 ## 6.3.0 (2019-08-12)
8 78
9 ### New features 79 ### New features
...@@ -28,9 +98,9 @@ Disallow binding `let` in patterns. ...@@ -28,9 +98,9 @@ Disallow binding `let` in patterns.
28 98
29 ### New features 99 ### New features
30 100
31 -Support bigint syntax with `ecmaVersion` >= 10. 101 +Support bigint syntax with `ecmaVersion` >= 11.
32 102
33 -Support dynamic `import` syntax with `ecmaVersion` >= 10. 103 +Support dynamic `import` syntax with `ecmaVersion` >= 11.
34 104
35 Upgrade to Unicode version 12. 105 Upgrade to Unicode version 12.
36 106
......
1 +MIT License
2 +
1 Copyright (C) 2012-2018 by various contributors (see AUTHORS) 3 Copyright (C) 2012-2018 by various contributors (see AUTHORS)
2 4
3 Permission is hereby granted, free of charge, to any person obtaining a copy 5 Permission is hereby granted, free of charge, to any person obtaining a copy
......
...@@ -52,9 +52,10 @@ Options can be provided by passing a second argument, which should be ...@@ -52,9 +52,10 @@ Options can be provided by passing a second argument, which should be
52 an object containing any of these fields: 52 an object containing any of these fields:
53 53
54 - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be 54 - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
55 - either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial 55 + either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
56 - support). This influences support for strict mode, the set of 56 + (2020, partial support). This influences support for strict mode,
57 - reserved words, and support for new syntax features. Default is 9. 57 + the set of reserved words, and support for new syntax features.
58 + Default is 10.
58 59
59 **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being 60 **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
60 implemented by Acorn. Other proposed new features can be implemented 61 implemented by Acorn. Other proposed new features can be implemented
...@@ -265,5 +266,4 @@ Plugins for ECMAScript proposals: ...@@ -265,5 +266,4 @@ Plugins for ECMAScript proposals:
265 - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling: 266 - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
266 - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields) 267 - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
267 - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta) 268 - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
268 - - [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
269 - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n 269 - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
......
...@@ -12,7 +12,7 @@ declare namespace acorn { ...@@ -12,7 +12,7 @@ declare namespace acorn {
12 } 12 }
13 13
14 interface Options { 14 interface Options {
15 - ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019 15 + ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
16 sourceType?: 'script' | 'module' 16 sourceType?: 'script' | 'module'
17 onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void 17 onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
18 onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void 18 onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
......
1 +import * as acorn from "./acorn";
2 +export = acorn;
...\ No newline at end of file ...\ No newline at end of file
1 { 1 {
2 - "_from": "acorn@^6.0.1", 2 + "_from": "acorn@^7.1.1",
3 - "_id": "acorn@6.4.2", 3 + "_id": "acorn@7.4.1",
4 "_inBundle": false, 4 "_inBundle": false,
5 - "_integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", 5 + "_integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
6 "_location": "/acorn-globals/acorn", 6 "_location": "/acorn-globals/acorn",
7 "_phantomChildren": {}, 7 "_phantomChildren": {},
8 "_requested": { 8 "_requested": {
9 "type": "range", 9 "type": "range",
10 "registry": true, 10 "registry": true,
11 - "raw": "acorn@^6.0.1", 11 + "raw": "acorn@^7.1.1",
12 "name": "acorn", 12 "name": "acorn",
13 "escapedName": "acorn", 13 "escapedName": "acorn",
14 - "rawSpec": "^6.0.1", 14 + "rawSpec": "^7.1.1",
15 "saveSpec": null, 15 "saveSpec": null,
16 - "fetchSpec": "^6.0.1" 16 + "fetchSpec": "^7.1.1"
17 }, 17 },
18 "_requiredBy": [ 18 "_requiredBy": [
19 "/acorn-globals" 19 "/acorn-globals"
20 ], 20 ],
21 - "_resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", 21 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
22 - "_shasum": "35866fd710528e92de10cf06016498e47e39e1e6", 22 + "_shasum": "feaed255973d2e77555b83dbc08851a6c63520fa",
23 - "_spec": "acorn@^6.0.1", 23 + "_spec": "acorn@^7.1.1",
24 - "_where": "C:\\Users\\KoMoGoon\\Desktop\\oss_project\\Singer-Composer\\node_modules\\acorn-globals", 24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\acorn-globals",
25 "bin": { 25 "bin": {
26 "acorn": "bin/acorn" 26 "acorn": "bin/acorn"
27 }, 27 },
...@@ -62,5 +62,6 @@ ...@@ -62,5 +62,6 @@
62 "scripts": { 62 "scripts": {
63 "prepare": "cd ..; npm run build:main && npm run build:bin" 63 "prepare": "cd ..; npm run build:main && npm run build:bin"
64 }, 64 },
65 - "version": "6.4.2" 65 + "types": "dist/acorn.d.ts",
66 + "version": "7.4.1"
66 } 67 }
......
1 { 1 {
2 - "_from": "acorn-globals@^4.1.0", 2 + "_from": "acorn-globals@^6.0.0",
3 - "_id": "acorn-globals@4.3.4", 3 + "_id": "acorn-globals@6.0.0",
4 "_inBundle": false, 4 "_inBundle": false,
5 - "_integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", 5 + "_integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==",
6 "_location": "/acorn-globals", 6 "_location": "/acorn-globals",
7 "_phantomChildren": {}, 7 "_phantomChildren": {},
8 "_requested": { 8 "_requested": {
9 "type": "range", 9 "type": "range",
10 "registry": true, 10 "registry": true,
11 - "raw": "acorn-globals@^4.1.0", 11 + "raw": "acorn-globals@^6.0.0",
12 "name": "acorn-globals", 12 "name": "acorn-globals",
13 "escapedName": "acorn-globals", 13 "escapedName": "acorn-globals",
14 - "rawSpec": "^4.1.0", 14 + "rawSpec": "^6.0.0",
15 "saveSpec": null, 15 "saveSpec": null,
16 - "fetchSpec": "^4.1.0" 16 + "fetchSpec": "^6.0.0"
17 }, 17 },
18 "_requiredBy": [ 18 "_requiredBy": [
19 "/jsdom" 19 "/jsdom"
20 ], 20 ],
21 - "_resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", 21 + "_resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz",
22 - "_shasum": "9fa1926addc11c97308c4e66d7add0d40c3272e7", 22 + "_shasum": "46cdd39f0f8ff08a876619b55f5ac8a6dc770b45",
23 - "_spec": "acorn-globals@^4.1.0", 23 + "_spec": "acorn-globals@^6.0.0",
24 - "_where": "C:\\Users\\KoMoGoon\\Desktop\\oss_project\\Singer-Composer\\node_modules\\jsdom", 24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\jsdom",
25 "author": { 25 "author": {
26 "name": "ForbesLindesay" 26 "name": "ForbesLindesay"
27 }, 27 },
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
30 }, 30 },
31 "bundleDependencies": false, 31 "bundleDependencies": false,
32 "dependencies": { 32 "dependencies": {
33 - "acorn": "^6.0.1", 33 + "acorn": "^7.1.1",
34 - "acorn-walk": "^6.0.1" 34 + "acorn-walk": "^7.1.1"
35 }, 35 },
36 "deprecated": false, 36 "deprecated": false,
37 "description": "Detect global variables in JavaScript using acorn", 37 "description": "Detect global variables in JavaScript using acorn",
38 "devDependencies": { 38 "devDependencies": {
39 - "testit": "^3.0.0" 39 + "testit": "^3.1.0"
40 }, 40 },
41 "files": [ 41 "files": [
42 "index.js", 42 "index.js",
...@@ -62,5 +62,5 @@ ...@@ -62,5 +62,5 @@
62 "scripts": { 62 "scripts": {
63 "test": "node test" 63 "test": "node test"
64 }, 64 },
65 - "version": "4.3.4" 65 + "version": "6.0.0"
66 } 66 }
......
1 +## 7.2.0 (2020-06-17)
2 +
3 +### New features
4 +
5 +Support optional chaining and nullish coalescing.
6 +
7 +Support `import.meta`.
8 +
9 +Add support for `export * as ns from "source"`.
10 +
11 +## 7.1.1 (2020-02-13)
12 +
13 +### Bug fixes
14 +
15 +Clean up the type definitions to actually work well with the main parser.
16 +
17 +## 7.1.0 (2020-02-11)
18 +
19 +### New features
20 +
21 +Add a TypeScript definition file for the library.
22 +
23 +## 7.0.0 (2017-08-12)
24 +
25 +### New features
26 +
27 +Support walking `ImportExpression` nodes.
28 +
1 ## 6.2.0 (2017-07-04) 29 ## 6.2.0 (2017-07-04)
2 30
3 ### New features 31 ### New features
......
1 +import {Node} from 'acorn';
2 +
3 +declare module "acorn-walk" {
4 + type FullWalkerCallback<TState> = (
5 + node: Node,
6 + state: TState,
7 + type: string
8 + ) => void;
9 +
10 + type FullAncestorWalkerCallback<TState> = (
11 + node: Node,
12 + state: TState | Node[],
13 + ancestors: Node[],
14 + type: string
15 + ) => void;
16 + type WalkerCallback<TState> = (node: Node, state: TState) => void;
17 +
18 + type SimpleWalkerFn<TState> = (
19 + node: Node,
20 + state: TState
21 + ) => void;
22 +
23 + type AncestorWalkerFn<TState> = (
24 + node: Node,
25 + state: TState| Node[],
26 + ancestors: Node[]
27 + ) => void;
28 +
29 + type RecursiveWalkerFn<TState> = (
30 + node: Node,
31 + state: TState,
32 + callback: WalkerCallback<TState>
33 + ) => void;
34 +
35 + type SimpleVisitors<TState> = {
36 + [type: string]: SimpleWalkerFn<TState>
37 + };
38 +
39 + type AncestorVisitors<TState> = {
40 + [type: string]: AncestorWalkerFn<TState>
41 + };
42 +
43 + type RecursiveVisitors<TState> = {
44 + [type: string]: RecursiveWalkerFn<TState>
45 + };
46 +
47 + type FindPredicate = (type: string, node: Node) => boolean;
48 +
49 + interface Found<TState> {
50 + node: Node,
51 + state: TState
52 + }
53 +
54 + export function simple<TState>(
55 + node: Node,
56 + visitors: SimpleVisitors<TState>,
57 + base?: RecursiveVisitors<TState>,
58 + state?: TState
59 + ): void;
60 +
61 + export function ancestor<TState>(
62 + node: Node,
63 + visitors: AncestorVisitors<TState>,
64 + base?: RecursiveVisitors<TState>,
65 + state?: TState
66 + ): void;
67 +
68 + export function recursive<TState>(
69 + node: Node,
70 + state: TState,
71 + functions: RecursiveVisitors<TState>,
72 + base?: RecursiveVisitors<TState>
73 + ): void;
74 +
75 + export function full<TState>(
76 + node: Node,
77 + callback: FullWalkerCallback<TState>,
78 + base?: RecursiveVisitors<TState>,
79 + state?: TState
80 + ): void;
81 +
82 + export function fullAncestor<TState>(
83 + node: Node,
84 + callback: FullAncestorWalkerCallback<TState>,
85 + base?: RecursiveVisitors<TState>,
86 + state?: TState
87 + ): void;
88 +
89 + export function make<TState>(
90 + functions: RecursiveVisitors<TState>,
91 + base?: RecursiveVisitors<TState>
92 + ): RecursiveVisitors<TState>;
93 +
94 + export function findNodeAt<TState>(
95 + node: Node,
96 + start: number | undefined,
97 + end?: number | undefined,
98 + type?: FindPredicate | string,
99 + base?: RecursiveVisitors<TState>,
100 + state?: TState
101 + ): Found<TState> | undefined;
102 +
103 + export function findNodeAround<TState>(
104 + node: Node,
105 + start: number | undefined,
106 + type?: FindPredicate | string,
107 + base?: RecursiveVisitors<TState>,
108 + state?: TState
109 + ): Found<TState> | undefined;
110 +
111 + export const findNodeAfter: typeof findNodeAround;
112 +}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 typeof define === 'function' && define.amd ? define(['exports'], factory) : 3 typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 (global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {}))); 4 (global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
5 -}(this, function (exports) { 'use strict'; 5 +}(this, (function (exports) { 'use strict';
6 6
7 // AST walker module for Mozilla Parser API compatible trees 7 // AST walker module for Mozilla Parser API compatible trees
8 8
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 // An ancestor walk keeps an array of ancestor nodes (including the 34 // An ancestor walk keeps an array of ancestor nodes (including the
35 // current node) and passes them to the callback as third parameter 35 // current node) and passes them to the callback as third parameter
36 // (and also as state parameter when no other state is present). 36 // (and also as state parameter when no other state is present).
37 - function ancestor(node, visitors, baseVisitor, state) { 37 + function ancestor(node, visitors, baseVisitor, state, override) {
38 var ancestors = []; 38 var ancestors = [];
39 if (!baseVisitor) { baseVisitor = base 39 if (!baseVisitor) { baseVisitor = base
40 ; }(function c(node, st, override) { 40 ; }(function c(node, st, override) {
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
44 baseVisitor[type](node, st, c); 44 baseVisitor[type](node, st, c);
45 if (found) { found(node, st || ancestors, ancestors); } 45 if (found) { found(node, st || ancestors, ancestors); }
46 if (isNew) { ancestors.pop(); } 46 if (isNew) { ancestors.pop(); }
47 - })(node, state); 47 + })(node, state, override);
48 } 48 }
49 49
50 // A recursive walk is one where your functions override the default 50 // A recursive walk is one where your functions override the default
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
200 }; 200 };
201 base.Statement = skipThrough; 201 base.Statement = skipThrough;
202 base.EmptyStatement = ignore; 202 base.EmptyStatement = ignore;
203 - base.ExpressionStatement = base.ParenthesizedExpression = 203 + base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
204 function (node, st, c) { return c(node.expression, st, "Expression"); }; 204 function (node, st, c) { return c(node.expression, st, "Expression"); };
205 base.IfStatement = function (node, st, c) { 205 base.IfStatement = function (node, st, c) {
206 c(node.test, st, "Expression"); 206 c(node.test, st, "Expression");
...@@ -405,6 +405,8 @@ ...@@ -405,6 +405,8 @@
405 if (node.source) { c(node.source, st, "Expression"); } 405 if (node.source) { c(node.source, st, "Expression"); }
406 }; 406 };
407 base.ExportAllDeclaration = function (node, st, c) { 407 base.ExportAllDeclaration = function (node, st, c) {
408 + if (node.exported)
409 + { c(node.exported, st); }
408 c(node.source, st, "Expression"); 410 c(node.source, st, "Expression");
409 }; 411 };
410 base.ImportDeclaration = function (node, st, c) { 412 base.ImportDeclaration = function (node, st, c) {
...@@ -416,7 +418,10 @@ ...@@ -416,7 +418,10 @@
416 } 418 }
417 c(node.source, st, "Expression"); 419 c(node.source, st, "Expression");
418 }; 420 };
419 - base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = base.Import = ignore; 421 + base.ImportExpression = function (node, st, c) {
422 + c(node.source, st, "Expression");
423 + };
424 + base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
420 425
421 base.TaggedTemplateExpression = function (node, st, c) { 426 base.TaggedTemplateExpression = function (node, st, c) {
422 c(node.tag, st, "Expression"); 427 c(node.tag, st, "Expression");
...@@ -455,4 +460,4 @@ ...@@ -455,4 +460,4 @@
455 460
456 Object.defineProperty(exports, '__esModule', { value: true }); 461 Object.defineProperty(exports, '__esModule', { value: true });
457 462
458 -})); 463 +})));
......
...@@ -28,7 +28,7 @@ function simple(node, visitors, baseVisitor, state, override) { ...@@ -28,7 +28,7 @@ function simple(node, visitors, baseVisitor, state, override) {
28 // An ancestor walk keeps an array of ancestor nodes (including the 28 // An ancestor walk keeps an array of ancestor nodes (including the
29 // current node) and passes them to the callback as third parameter 29 // current node) and passes them to the callback as third parameter
30 // (and also as state parameter when no other state is present). 30 // (and also as state parameter when no other state is present).
31 -function ancestor(node, visitors, baseVisitor, state) { 31 +function ancestor(node, visitors, baseVisitor, state, override) {
32 var ancestors = []; 32 var ancestors = [];
33 if (!baseVisitor) { baseVisitor = base 33 if (!baseVisitor) { baseVisitor = base
34 ; }(function c(node, st, override) { 34 ; }(function c(node, st, override) {
...@@ -38,7 +38,7 @@ function ancestor(node, visitors, baseVisitor, state) { ...@@ -38,7 +38,7 @@ function ancestor(node, visitors, baseVisitor, state) {
38 baseVisitor[type](node, st, c); 38 baseVisitor[type](node, st, c);
39 if (found) { found(node, st || ancestors, ancestors); } 39 if (found) { found(node, st || ancestors, ancestors); }
40 if (isNew) { ancestors.pop(); } 40 if (isNew) { ancestors.pop(); }
41 - })(node, state); 41 + })(node, state, override);
42 } 42 }
43 43
44 // A recursive walk is one where your functions override the default 44 // A recursive walk is one where your functions override the default
...@@ -194,7 +194,7 @@ base.Program = base.BlockStatement = function (node, st, c) { ...@@ -194,7 +194,7 @@ base.Program = base.BlockStatement = function (node, st, c) {
194 }; 194 };
195 base.Statement = skipThrough; 195 base.Statement = skipThrough;
196 base.EmptyStatement = ignore; 196 base.EmptyStatement = ignore;
197 -base.ExpressionStatement = base.ParenthesizedExpression = 197 +base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
198 function (node, st, c) { return c(node.expression, st, "Expression"); }; 198 function (node, st, c) { return c(node.expression, st, "Expression"); };
199 base.IfStatement = function (node, st, c) { 199 base.IfStatement = function (node, st, c) {
200 c(node.test, st, "Expression"); 200 c(node.test, st, "Expression");
...@@ -399,6 +399,8 @@ base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st ...@@ -399,6 +399,8 @@ base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st
399 if (node.source) { c(node.source, st, "Expression"); } 399 if (node.source) { c(node.source, st, "Expression"); }
400 }; 400 };
401 base.ExportAllDeclaration = function (node, st, c) { 401 base.ExportAllDeclaration = function (node, st, c) {
402 + if (node.exported)
403 + { c(node.exported, st); }
402 c(node.source, st, "Expression"); 404 c(node.source, st, "Expression");
403 }; 405 };
404 base.ImportDeclaration = function (node, st, c) { 406 base.ImportDeclaration = function (node, st, c) {
...@@ -410,7 +412,10 @@ base.ImportDeclaration = function (node, st, c) { ...@@ -410,7 +412,10 @@ base.ImportDeclaration = function (node, st, c) {
410 } 412 }
411 c(node.source, st, "Expression"); 413 c(node.source, st, "Expression");
412 }; 414 };
413 -base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = base.Import = ignore; 415 +base.ImportExpression = function (node, st, c) {
416 + c(node.source, st, "Expression");
417 +};
418 +base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
414 419
415 base.TaggedTemplateExpression = function (node, st, c) { 420 base.TaggedTemplateExpression = function (node, st, c) {
416 c(node.tag, st, "Expression"); 421 c(node.tag, st, "Expression");
......
1 { 1 {
2 - "_from": "acorn-walk@^6.0.1", 2 + "_from": "acorn-walk@^7.1.1",
3 - "_id": "acorn-walk@6.2.0", 3 + "_id": "acorn-walk@7.2.0",
4 "_inBundle": false, 4 "_inBundle": false,
5 - "_integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", 5 + "_integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==",
6 "_location": "/acorn-walk", 6 "_location": "/acorn-walk",
7 "_phantomChildren": {}, 7 "_phantomChildren": {},
8 "_requested": { 8 "_requested": {
9 "type": "range", 9 "type": "range",
10 "registry": true, 10 "registry": true,
11 - "raw": "acorn-walk@^6.0.1", 11 + "raw": "acorn-walk@^7.1.1",
12 "name": "acorn-walk", 12 "name": "acorn-walk",
13 "escapedName": "acorn-walk", 13 "escapedName": "acorn-walk",
14 - "rawSpec": "^6.0.1", 14 + "rawSpec": "^7.1.1",
15 "saveSpec": null, 15 "saveSpec": null,
16 - "fetchSpec": "^6.0.1" 16 + "fetchSpec": "^7.1.1"
17 }, 17 },
18 "_requiredBy": [ 18 "_requiredBy": [
19 "/acorn-globals" 19 "/acorn-globals"
20 ], 20 ],
21 - "_resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", 21 + "_resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
22 - "_shasum": "123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c", 22 + "_shasum": "0de889a601203909b0fbe07b8938dc21d2e967bc",
23 - "_spec": "acorn-walk@^6.0.1", 23 + "_spec": "acorn-walk@^7.1.1",
24 - "_where": "C:\\Users\\KoMoGoon\\Desktop\\oss_project\\Singer-Composer\\node_modules\\acorn-globals", 24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\acorn-globals",
25 "bugs": { 25 "bugs": {
26 "url": "https://github.com/acornjs/acorn/issues" 26 "url": "https://github.com/acornjs/acorn/issues"
27 }, 27 },
...@@ -59,5 +59,6 @@ ...@@ -59,5 +59,6 @@
59 "scripts": { 59 "scripts": {
60 "prepare": "cd ..; npm run build:walk" 60 "prepare": "cd ..; npm run build:walk"
61 }, 61 },
62 - "version": "6.2.0" 62 + "types": "dist/walk.d.ts",
63 + "version": "7.2.0"
63 } 64 }
......
This diff is collapsed. Click to expand it.
1 -Copyright (C) 2012-2018 by various contributors (see AUTHORS) 1 +MIT License
2 +
3 +Copyright (C) 2012-2020 by various contributors (see AUTHORS)
2 4
3 Permission is hereby granted, free of charge, to any person obtaining a copy 5 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 6 of this software and associated documentation files (the "Software"), to deal
......
This diff is collapsed. Click to expand it.
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 'use strict'; 2 'use strict';
3 3
4 -require('./_acorn.js'); 4 +require('../dist/bin.js');
......
1 +export as namespace acorn
2 +export = acorn
3 +
4 +declare namespace acorn {
5 + function parse(input: string, options: Options): Node
6 +
7 + function parseExpressionAt(input: string, pos: number, options: Options): Node
8 +
9 + function tokenizer(input: string, options: Options): {
10 + getToken(): Token
11 + [Symbol.iterator](): Iterator<Token>
12 + }
13 +
14 + interface Options {
15 + ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
16 + sourceType?: 'script' | 'module'
17 + onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
18 + onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
19 + allowReserved?: boolean | 'never'
20 + allowReturnOutsideFunction?: boolean
21 + allowImportExportEverywhere?: boolean
22 + allowAwaitOutsideFunction?: boolean
23 + allowSuperOutsideMethod?: boolean
24 + allowHashBang?: boolean
25 + locations?: boolean
26 + onToken?: ((token: Token) => any) | Token[]
27 + onComment?: ((
28 + isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
29 + endLoc?: Position
30 + ) => void) | Comment[]
31 + ranges?: boolean
32 + program?: Node
33 + sourceFile?: string
34 + directSourceFile?: string
35 + preserveParens?: boolean
36 + }
37 +
38 + class Parser {
39 + constructor(options: Options, input: string, startPos?: number)
40 + parse(this: Parser): Node
41 + static parse(this: typeof Parser, input: string, options: Options): Node
42 + static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node
43 + static tokenizer(this: typeof Parser, input: string, options: Options): {
44 + getToken(): Token
45 + [Symbol.iterator](): Iterator<Token>
46 + }
47 + static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
48 + }
49 +
50 + interface Position { line: number; column: number; offset: number }
51 +
52 + const defaultOptions: Options
53 +
54 + function getLineInfo(input: string, offset: number): Position
55 +
56 + class SourceLocation {
57 + start: Position
58 + end: Position
59 + source?: string | null
60 + constructor(p: Parser, start: Position, end: Position)
61 + }
62 +
63 + class Node {
64 + type: string
65 + start: number
66 + end: number
67 + loc?: SourceLocation
68 + sourceFile?: string
69 + range?: [number, number]
70 + constructor(parser: Parser, pos: number, loc?: SourceLocation)
71 + }
72 +
73 + class TokenType {
74 + label: string
75 + keyword: string
76 + beforeExpr: boolean
77 + startsExpr: boolean
78 + isLoop: boolean
79 + isAssign: boolean
80 + prefix: boolean
81 + postfix: boolean
82 + binop: number
83 + updateContext?: (prevType: TokenType) => void
84 + constructor(label: string, conf?: any)
85 + }
86 +
87 + const tokTypes: {
88 + num: TokenType
89 + regexp: TokenType
90 + string: TokenType
91 + name: TokenType
92 + privateId: TokenType
93 + eof: TokenType
94 + bracketL: TokenType
95 + bracketR: TokenType
96 + braceL: TokenType
97 + braceR: TokenType
98 + parenL: TokenType
99 + parenR: TokenType
100 + comma: TokenType
101 + semi: TokenType
102 + colon: TokenType
103 + dot: TokenType
104 + question: TokenType
105 + arrow: TokenType
106 + template: TokenType
107 + ellipsis: TokenType
108 + backQuote: TokenType
109 + dollarBraceL: TokenType
110 + eq: TokenType
111 + assign: TokenType
112 + incDec: TokenType
113 + prefix: TokenType
114 + logicalOR: TokenType
115 + logicalAND: TokenType
116 + bitwiseOR: TokenType
117 + bitwiseXOR: TokenType
118 + bitwiseAND: TokenType
119 + equality: TokenType
120 + relational: TokenType
121 + bitShift: TokenType
122 + plusMin: TokenType
123 + modulo: TokenType
124 + star: TokenType
125 + slash: TokenType
126 + starstar: TokenType
127 + _break: TokenType
128 + _case: TokenType
129 + _catch: TokenType
130 + _continue: TokenType
131 + _debugger: TokenType
132 + _default: TokenType
133 + _do: TokenType
134 + _else: TokenType
135 + _finally: TokenType
136 + _for: TokenType
137 + _function: TokenType
138 + _if: TokenType
139 + _return: TokenType
140 + _switch: TokenType
141 + _throw: TokenType
142 + _try: TokenType
143 + _var: TokenType
144 + _const: TokenType
145 + _while: TokenType
146 + _with: TokenType
147 + _new: TokenType
148 + _this: TokenType
149 + _super: TokenType
150 + _class: TokenType
151 + _extends: TokenType
152 + _export: TokenType
153 + _import: TokenType
154 + _null: TokenType
155 + _true: TokenType
156 + _false: TokenType
157 + _in: TokenType
158 + _instanceof: TokenType
159 + _typeof: TokenType
160 + _void: TokenType
161 + _delete: TokenType
162 + }
163 +
164 + class TokContext {
165 + constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
166 + }
167 +
168 + const tokContexts: {
169 + b_stat: TokContext
170 + b_expr: TokContext
171 + b_tmpl: TokContext
172 + p_stat: TokContext
173 + p_expr: TokContext
174 + q_tmpl: TokContext
175 + f_expr: TokContext
176 + f_stat: TokContext
177 + f_expr_gen: TokContext
178 + f_gen: TokContext
179 + }
180 +
181 + function isIdentifierStart(code: number, astral?: boolean): boolean
182 +
183 + function isIdentifierChar(code: number, astral?: boolean): boolean
184 +
185 + interface AbstractToken {
186 + }
187 +
188 + interface Comment extends AbstractToken {
189 + type: string
190 + value: string
191 + start: number
192 + end: number
193 + loc?: SourceLocation
194 + range?: [number, number]
195 + }
196 +
197 + class Token {
198 + type: TokenType
199 + value: any
200 + start: number
201 + end: number
202 + loc?: SourceLocation
203 + range?: [number, number]
204 + constructor(p: Parser)
205 + }
206 +
207 + function isNewLine(code: number): boolean
208 +
209 + const lineBreak: RegExp
210 +
211 + const lineBreakG: RegExp
212 +
213 + const version: string
214 +}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 +import * as acorn from "./acorn";
2 +export = acorn;
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +var path = require('path');
4 +var fs = require('fs');
5 +var acorn = require('./acorn.js');
6 +
7 +function _interopNamespace(e) {
8 + if (e && e.__esModule) return e;
9 + var n = Object.create(null);
10 + if (e) {
11 + Object.keys(e).forEach(function (k) {
12 + if (k !== 'default') {
13 + var d = Object.getOwnPropertyDescriptor(e, k);
14 + Object.defineProperty(n, k, d.get ? d : {
15 + enumerable: true,
16 + get: function () { return e[k]; }
17 + });
18 + }
19 + });
20 + }
21 + n["default"] = e;
22 + return Object.freeze(n);
23 +}
24 +
25 +var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
26 +
27 +var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
28 +var options = {};
29 +
30 +function help(status) {
31 + var print = (status === 0) ? console.log : console.error;
32 + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
33 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]");
34 + process.exit(status);
35 +}
36 +
37 +for (var i = 2; i < process.argv.length; ++i) {
38 + var arg = process.argv[i];
39 + if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); }
40 + else if (arg === "--") {
41 + inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1));
42 + forceFileName = true;
43 + break
44 + } else if (arg === "--locations") { options.locations = true; }
45 + else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
46 + else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
47 + else if (arg === "--silent") { silent = true; }
48 + else if (arg === "--compact") { compact = true; }
49 + else if (arg === "--help") { help(0); }
50 + else if (arg === "--tokenize") { tokenize = true; }
51 + else if (arg === "--module") { options.sourceType = "module"; }
52 + else {
53 + var match = arg.match(/^--ecma(\d+)$/);
54 + if (match)
55 + { options.ecmaVersion = +match[1]; }
56 + else
57 + { help(1); }
58 + }
59 +}
60 +
61 +function run(codeList) {
62 + var result = [], fileIdx = 0;
63 + try {
64 + codeList.forEach(function (code, idx) {
65 + fileIdx = idx;
66 + if (!tokenize) {
67 + result = acorn__namespace.parse(code, options);
68 + options.program = result;
69 + } else {
70 + var tokenizer = acorn__namespace.tokenizer(code, options), token;
71 + do {
72 + token = tokenizer.getToken();
73 + result.push(token);
74 + } while (token.type !== acorn__namespace.tokTypes.eof)
75 + }
76 + });
77 + } catch (e) {
78 + console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message);
79 + process.exit(1);
80 + }
81 + if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
82 +}
83 +
84 +if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {
85 + run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); }));
86 +} else {
87 + var code = "";
88 + process.stdin.resume();
89 + process.stdin.on("data", function (chunk) { return code += chunk; });
90 + process.stdin.on("end", function () { return run([code]); });
91 +}
1 { 1 {
2 - "_from": "acorn@^5.5.3", 2 + "_from": "acorn@^8.5.0",
3 - "_id": "acorn@5.7.4", 3 + "_id": "acorn@8.6.0",
4 "_inBundle": false, 4 "_inBundle": false,
5 - "_integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", 5 + "_integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==",
6 "_location": "/acorn", 6 "_location": "/acorn",
7 "_phantomChildren": {}, 7 "_phantomChildren": {},
8 "_requested": { 8 "_requested": {
9 "type": "range", 9 "type": "range",
10 "registry": true, 10 "registry": true,
11 - "raw": "acorn@^5.5.3", 11 + "raw": "acorn@^8.5.0",
12 "name": "acorn", 12 "name": "acorn",
13 "escapedName": "acorn", 13 "escapedName": "acorn",
14 - "rawSpec": "^5.5.3", 14 + "rawSpec": "^8.5.0",
15 "saveSpec": null, 15 "saveSpec": null,
16 - "fetchSpec": "^5.5.3" 16 + "fetchSpec": "^8.5.0"
17 }, 17 },
18 "_requiredBy": [ 18 "_requiredBy": [
19 "/jsdom" 19 "/jsdom"
20 ], 20 ],
21 - "_resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", 21 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz",
22 - "_shasum": "3e8d8a9947d0599a1796d10225d7432f4a4acf5e", 22 + "_shasum": "e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895",
23 - "_spec": "acorn@^5.5.3", 23 + "_spec": "acorn@^8.5.0",
24 - "_where": "C:\\Users\\KoMoGoon\\Desktop\\oss_project\\Singer-Composer\\node_modules\\jsdom", 24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\jsdom",
25 "bin": { 25 "bin": {
26 "acorn": "bin/acorn" 26 "acorn": "bin/acorn"
27 }, 27 },
...@@ -29,260 +29,22 @@ ...@@ -29,260 +29,22 @@
29 "url": "https://github.com/acornjs/acorn/issues" 29 "url": "https://github.com/acornjs/acorn/issues"
30 }, 30 },
31 "bundleDependencies": false, 31 "bundleDependencies": false,
32 - "contributors": [
33 - {
34 - "name": "List of Acorn contributors. Updated before every release."
35 - },
36 - {
37 - "name": "Adrian Heine"
38 - },
39 - {
40 - "name": "Adrian Rakovsky"
41 - },
42 - {
43 - "name": "Alistair Braidwood"
44 - },
45 - {
46 - "name": "Amila Welihinda"
47 - },
48 - {
49 - "name": "Andres Suarez"
50 - },
51 - {
52 - "name": "Angelo"
53 - },
54 - {
55 - "name": "Aparajita Fishman"
56 - },
57 - {
58 - "name": "Arian Stolwijk"
59 - },
60 - {
61 - "name": "Artem Govorov"
62 - },
63 - {
64 - "name": "Boopesh Mahendran"
65 - },
66 - {
67 - "name": "Bradley Heinz"
68 - },
69 - {
70 - "name": "Brandon Mills"
71 - },
72 - {
73 - "name": "Charles Hughes"
74 - },
75 - {
76 - "name": "Charmander"
77 - },
78 - {
79 - "name": "Chris McKnight"
80 - },
81 - {
82 - "name": "Conrad Irwin"
83 - },
84 - {
85 - "name": "Daniel Tschinder"
86 - },
87 - {
88 - "name": "David Bonnet"
89 - },
90 - {
91 - "name": "Domenico Matteo"
92 - },
93 - {
94 - "name": "ehmicky"
95 - },
96 - {
97 - "name": "Eugene Obrezkov"
98 - },
99 - {
100 - "name": "Felix Maier"
101 - },
102 - {
103 - "name": "Forbes Lindesay"
104 - },
105 - {
106 - "name": "Gilad Peleg"
107 - },
108 - {
109 - "name": "impinball"
110 - },
111 - {
112 - "name": "Ingvar Stepanyan"
113 - },
114 - {
115 - "name": "Jackson Ray Hamilton"
116 - },
117 - {
118 - "name": "Jesse McCarthy"
119 - },
120 - {
121 - "name": "Jiaxing Wang"
122 - },
123 - {
124 - "name": "Joel Kemp"
125 - },
126 - {
127 - "name": "Johannes Herr"
128 - },
129 - {
130 - "name": "John-David Dalton"
131 - },
132 - {
133 - "name": "Jordan Klassen"
134 - },
135 - {
136 - "name": "Jürg Lehni"
137 - },
138 - {
139 - "name": "Kai Cataldo"
140 - },
141 - {
142 - "name": "keeyipchan"
143 - },
144 - {
145 - "name": "Keheliya Gallaba"
146 - },
147 - {
148 - "name": "Kevin Irish"
149 - },
150 - {
151 - "name": "Kevin Kwok"
152 - },
153 - {
154 - "name": "krator"
155 - },
156 - {
157 - "name": "laosb"
158 - },
159 - {
160 - "name": "luckyzeng"
161 - },
162 - {
163 - "name": "Marek"
164 - },
165 - {
166 - "name": "Marijn Haverbeke"
167 - },
168 - {
169 - "name": "Martin Carlberg"
170 - },
171 - {
172 - "name": "Mat Garcia"
173 - },
174 - {
175 - "name": "Mathias Bynens"
176 - },
177 - {
178 - "name": "Mathieu 'p01' Henri"
179 - },
180 - {
181 - "name": "Matthew Bastien"
182 - },
183 - {
184 - "name": "Max Schaefer"
185 - },
186 - {
187 - "name": "Max Zerzouri"
188 - },
189 - {
190 - "name": "Mihai Bazon"
191 - },
192 - {
193 - "name": "Mike Rennie"
194 - },
195 - {
196 - "name": "naoh"
197 - },
198 - {
199 - "name": "Nicholas C. Zakas"
200 - },
201 - {
202 - "name": "Nick Fitzgerald"
203 - },
204 - {
205 - "name": "Olivier Thomann"
206 - },
207 - {
208 - "name": "Oskar Schöldström"
209 - },
210 - {
211 - "name": "Paul Harper"
212 - },
213 - {
214 - "name": "Peter Rust"
215 - },
216 - {
217 - "name": "PlNG"
218 - },
219 - {
220 - "name": "Prayag Verma"
221 - },
222 - {
223 - "name": "ReadmeCritic"
224 - },
225 - {
226 - "name": "r-e-d"
227 - },
228 - {
229 - "name": "Renée Kooi"
230 - },
231 - {
232 - "name": "Richard Gibson"
233 - },
234 - {
235 - "name": "Rich Harris"
236 - },
237 - {
238 - "name": "Sebastian McKenzie"
239 - },
240 - {
241 - "name": "Shahar Soel"
242 - },
243 - {
244 - "name": "Sheel Bedi"
245 - },
246 - {
247 - "name": "Simen Bekkhus"
248 - },
249 - {
250 - "name": "Teddy Katz"
251 - },
252 - {
253 - "name": "Timothy Gu"
254 - },
255 - {
256 - "name": "Toru Nagashima"
257 - },
258 - {
259 - "name": "Victor Homyakov"
260 - },
261 - {
262 - "name": "Wexpo Lyu"
263 - },
264 - {
265 - "name": "zsjforcn"
266 - }
267 - ],
268 "deprecated": false, 32 "deprecated": false,
269 "description": "ECMAScript parser", 33 "description": "ECMAScript parser",
270 - "devDependencies": {
271 - "eslint": "^4.10.0",
272 - "eslint-config-standard": "^10.2.1",
273 - "eslint-plugin-import": "^2.2.0",
274 - "eslint-plugin-node": "^5.2.1",
275 - "eslint-plugin-promise": "^3.5.0",
276 - "eslint-plugin-standard": "^3.0.1",
277 - "rollup": "^0.45.0",
278 - "rollup-plugin-buble": "^0.16.0",
279 - "test262": "git+https://github.com/tc39/test262.git#3bfad28cc302fd4455badcfcbca7c5bb7ce41a72",
280 - "test262-parser-runner": "^0.4.0",
281 - "unicode-11.0.0": "^0.7.7"
282 - },
283 "engines": { 34 "engines": {
284 "node": ">=0.4.0" 35 "node": ">=0.4.0"
285 }, 36 },
37 + "exports": {
38 + ".": [
39 + {
40 + "import": "./dist/acorn.mjs",
41 + "require": "./dist/acorn.js",
42 + "default": "./dist/acorn.js"
43 + },
44 + "./dist/acorn.js"
45 + ],
46 + "./package.json": "./package.json"
47 + },
286 "homepage": "https://github.com/acornjs/acorn", 48 "homepage": "https://github.com/acornjs/acorn",
287 "license": "MIT", 49 "license": "MIT",
288 "main": "dist/acorn.js", 50 "main": "dist/acorn.js",
...@@ -290,35 +52,27 @@ ...@@ -290,35 +52,27 @@
290 { 52 {
291 "name": "Marijn Haverbeke", 53 "name": "Marijn Haverbeke",
292 "email": "marijnh@gmail.com", 54 "email": "marijnh@gmail.com",
293 - "url": "http://marijnhaverbeke.nl" 55 + "url": "https://marijnhaverbeke.nl"
294 }, 56 },
295 { 57 {
296 "name": "Ingvar Stepanyan", 58 "name": "Ingvar Stepanyan",
297 "email": "me@rreverser.com", 59 "email": "me@rreverser.com",
298 - "url": "http://rreverser.com/" 60 + "url": "https://rreverser.com/"
299 }, 61 },
300 { 62 {
301 "name": "Adrian Heine", 63 "name": "Adrian Heine",
302 - "email": "http://adrianheine.de" 64 + "url": "http://adrianheine.de"
303 } 65 }
304 ], 66 ],
305 - "module": "dist/acorn.es.js", 67 + "module": "dist/acorn.mjs",
306 "name": "acorn", 68 "name": "acorn",
307 "repository": { 69 "repository": {
308 "type": "git", 70 "type": "git",
309 "url": "git+https://github.com/acornjs/acorn.git" 71 "url": "git+https://github.com/acornjs/acorn.git"
310 }, 72 },
311 "scripts": { 73 "scripts": {
312 - "build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin", 74 + "prepare": "cd ..; npm run build:main && npm run build:bin"
313 - "build:bin": "rollup -c rollup/config.bin.js",
314 - "build:loose": "rollup -c rollup/config.loose.js && rollup -c rollup/config.loose_es.js",
315 - "build:main": "rollup -c rollup/config.main.js",
316 - "build:walk": "rollup -c rollup/config.walk.js",
317 - "lint": "eslint src/",
318 - "prepare": "npm run build && node test/run.js && node test/lint.js",
319 - "pretest": "npm run build:main && npm run build:loose",
320 - "test": "node test/run.js && node test/lint.js",
321 - "test:test262": "node bin/run_test262.js"
322 }, 75 },
323 - "version": "5.7.4" 76 + "types": "dist/acorn.d.ts",
77 + "version": "8.6.0"
324 } 78 }
......
1 +agent-base
2 +==========
3 +### Turn a function into an [`http.Agent`][http.Agent] instance
4 +[![Build Status](https://github.com/TooTallNate/node-agent-base/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
5 +
6 +This module provides an `http.Agent` generator. That is, you pass it an async
7 +callback function, and it returns a new `http.Agent` instance that will invoke the
8 +given callback function when sending outbound HTTP requests.
9 +
10 +#### Some subclasses:
11 +
12 +Here's some more interesting uses of `agent-base`.
13 +Send a pull request to list yours!
14 +
15 + * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
16 + * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
17 + * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
18 + * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
19 +
20 +
21 +Installation
22 +------------
23 +
24 +Install with `npm`:
25 +
26 +``` bash
27 +$ npm install agent-base
28 +```
29 +
30 +
31 +Example
32 +-------
33 +
34 +Here's a minimal example that creates a new `net.Socket` connection to the server
35 +for every HTTP request (i.e. the equivalent of `agent: false` option):
36 +
37 +```js
38 +var net = require('net');
39 +var tls = require('tls');
40 +var url = require('url');
41 +var http = require('http');
42 +var agent = require('agent-base');
43 +
44 +var endpoint = 'http://nodejs.org/api/';
45 +var parsed = url.parse(endpoint);
46 +
47 +// This is the important part!
48 +parsed.agent = agent(function (req, opts) {
49 + var socket;
50 + // `secureEndpoint` is true when using the https module
51 + if (opts.secureEndpoint) {
52 + socket = tls.connect(opts);
53 + } else {
54 + socket = net.connect(opts);
55 + }
56 + return socket;
57 +});
58 +
59 +// Everything else works just like normal...
60 +http.get(parsed, function (res) {
61 + console.log('"response" event!', res.headers);
62 + res.pipe(process.stdout);
63 +});
64 +```
65 +
66 +Returning a Promise or using an `async` function is also supported:
67 +
68 +```js
69 +agent(async function (req, opts) {
70 + await sleep(1000);
71 + // etc…
72 +});
73 +```
74 +
75 +Return another `http.Agent` instance to "pass through" the responsibility
76 +for that HTTP request to that agent:
77 +
78 +```js
79 +agent(function (req, opts) {
80 + return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
81 +});
82 +```
83 +
84 +
85 +API
86 +---
87 +
88 +## Agent(Function callback[, Object options]) → [http.Agent][]
89 +
90 +Creates a base `http.Agent` that will execute the callback function `callback`
91 +for every HTTP request that it is used as the `agent` for. The callback function
92 +is responsible for creating a `stream.Duplex` instance of some kind that will be
93 +used as the underlying socket in the HTTP request.
94 +
95 +The `options` object accepts the following properties:
96 +
97 + * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
98 +
99 +The callback function should have the following signature:
100 +
101 +### callback(http.ClientRequest req, Object options, Function cb) → undefined
102 +
103 +The ClientRequest `req` can be accessed to read request headers and
104 +and the path, etc. The `options` object contains the options passed
105 +to the `http.request()`/`https.request()` function call, and is formatted
106 +to be directly passed to `net.connect()`/`tls.connect()`, or however
107 +else you want a Socket to be created. Pass the created socket to
108 +the callback function `cb` once created, and the HTTP request will
109 +continue to proceed.
110 +
111 +If the `https` module is used to invoke the HTTP request, then the
112 +`secureEndpoint` property on `options` _will be set to `true`_.
113 +
114 +
115 +License
116 +-------
117 +
118 +(The MIT License)
119 +
120 +Copyright (c) 2013 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
121 +
122 +Permission is hereby granted, free of charge, to any person obtaining
123 +a copy of this software and associated documentation files (the
124 +'Software'), to deal in the Software without restriction, including
125 +without limitation the rights to use, copy, modify, merge, publish,
126 +distribute, sublicense, and/or sell copies of the Software, and to
127 +permit persons to whom the Software is furnished to do so, subject to
128 +the following conditions:
129 +
130 +The above copyright notice and this permission notice shall be
131 +included in all copies or substantial portions of the Software.
132 +
133 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
134 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
136 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
137 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
138 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
139 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140 +
141 +[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
142 +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
143 +[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
144 +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
145 +[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
1 +/// <reference types="node" />
2 +import net from 'net';
3 +import http from 'http';
4 +import https from 'https';
5 +import { Duplex } from 'stream';
6 +import { EventEmitter } from 'events';
7 +declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
8 +declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent;
9 +declare namespace createAgent {
10 + interface ClientRequest extends http.ClientRequest {
11 + _last?: boolean;
12 + _hadError?: boolean;
13 + method: string;
14 + }
15 + interface AgentRequestOptions {
16 + host?: string;
17 + path?: string;
18 + port: number;
19 + }
20 + interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> {
21 + secureEndpoint: false;
22 + }
23 + interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> {
24 + secureEndpoint: true;
25 + }
26 + type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
27 + type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
28 + type AgentCallbackReturn = Duplex | AgentLike;
29 + type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void;
30 + type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
31 + type AgentCallback = typeof Agent.prototype.callback;
32 + type AgentOptions = {
33 + timeout?: number;
34 + };
35 + /**
36 + * Base `http.Agent` implementation.
37 + * No pooling/keep-alive is implemented by default.
38 + *
39 + * @param {Function} callback
40 + * @api public
41 + */
42 + class Agent extends EventEmitter {
43 + timeout: number | null;
44 + maxFreeSockets: number;
45 + maxTotalSockets: number;
46 + maxSockets: number;
47 + sockets: {
48 + [key: string]: net.Socket[];
49 + };
50 + freeSockets: {
51 + [key: string]: net.Socket[];
52 + };
53 + requests: {
54 + [key: string]: http.IncomingMessage[];
55 + };
56 + options: https.AgentOptions;
57 + private promisifiedCallback?;
58 + private explicitDefaultPort?;
59 + private explicitProtocol?;
60 + constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions);
61 + get defaultPort(): number;
62 + set defaultPort(v: number);
63 + get protocol(): string;
64 + set protocol(v: string);
65 + callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void;
66 + callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
67 + /**
68 + * Called by node-core's "_http_client.js" module when creating
69 + * a new HTTP request with this Agent instance.
70 + *
71 + * @api public
72 + */
73 + addRequest(req: ClientRequest, _opts: RequestOptions): void;
74 + freeSocket(socket: net.Socket, opts: AgentOptions): void;
75 + destroy(): void;
76 + }
77 +}
78 +export = createAgent;
1 +"use strict";
2 +var __importDefault = (this && this.__importDefault) || function (mod) {
3 + return (mod && mod.__esModule) ? mod : { "default": mod };
4 +};
5 +const events_1 = require("events");
6 +const debug_1 = __importDefault(require("debug"));
7 +const promisify_1 = __importDefault(require("./promisify"));
8 +const debug = debug_1.default('agent-base');
9 +function isAgent(v) {
10 + return Boolean(v) && typeof v.addRequest === 'function';
11 +}
12 +function isSecureEndpoint() {
13 + const { stack } = new Error();
14 + if (typeof stack !== 'string')
15 + return false;
16 + return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
17 +}
18 +function createAgent(callback, opts) {
19 + return new createAgent.Agent(callback, opts);
20 +}
21 +(function (createAgent) {
22 + /**
23 + * Base `http.Agent` implementation.
24 + * No pooling/keep-alive is implemented by default.
25 + *
26 + * @param {Function} callback
27 + * @api public
28 + */
29 + class Agent extends events_1.EventEmitter {
30 + constructor(callback, _opts) {
31 + super();
32 + let opts = _opts;
33 + if (typeof callback === 'function') {
34 + this.callback = callback;
35 + }
36 + else if (callback) {
37 + opts = callback;
38 + }
39 + // Timeout for the socket to be returned from the callback
40 + this.timeout = null;
41 + if (opts && typeof opts.timeout === 'number') {
42 + this.timeout = opts.timeout;
43 + }
44 + // These aren't actually used by `agent-base`, but are required
45 + // for the TypeScript definition files in `@types/node` :/
46 + this.maxFreeSockets = 1;
47 + this.maxSockets = 1;
48 + this.maxTotalSockets = Infinity;
49 + this.sockets = {};
50 + this.freeSockets = {};
51 + this.requests = {};
52 + this.options = {};
53 + }
54 + get defaultPort() {
55 + if (typeof this.explicitDefaultPort === 'number') {
56 + return this.explicitDefaultPort;
57 + }
58 + return isSecureEndpoint() ? 443 : 80;
59 + }
60 + set defaultPort(v) {
61 + this.explicitDefaultPort = v;
62 + }
63 + get protocol() {
64 + if (typeof this.explicitProtocol === 'string') {
65 + return this.explicitProtocol;
66 + }
67 + return isSecureEndpoint() ? 'https:' : 'http:';
68 + }
69 + set protocol(v) {
70 + this.explicitProtocol = v;
71 + }
72 + callback(req, opts, fn) {
73 + throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
74 + }
75 + /**
76 + * Called by node-core's "_http_client.js" module when creating
77 + * a new HTTP request with this Agent instance.
78 + *
79 + * @api public
80 + */
81 + addRequest(req, _opts) {
82 + const opts = Object.assign({}, _opts);
83 + if (typeof opts.secureEndpoint !== 'boolean') {
84 + opts.secureEndpoint = isSecureEndpoint();
85 + }
86 + if (opts.host == null) {
87 + opts.host = 'localhost';
88 + }
89 + if (opts.port == null) {
90 + opts.port = opts.secureEndpoint ? 443 : 80;
91 + }
92 + if (opts.protocol == null) {
93 + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
94 + }
95 + if (opts.host && opts.path) {
96 + // If both a `host` and `path` are specified then it's most
97 + // likely the result of a `url.parse()` call... we need to
98 + // remove the `path` portion so that `net.connect()` doesn't
99 + // attempt to open that as a unix socket file.
100 + delete opts.path;
101 + }
102 + delete opts.agent;
103 + delete opts.hostname;
104 + delete opts._defaultAgent;
105 + delete opts.defaultPort;
106 + delete opts.createConnection;
107 + // Hint to use "Connection: close"
108 + // XXX: non-documented `http` module API :(
109 + req._last = true;
110 + req.shouldKeepAlive = false;
111 + let timedOut = false;
112 + let timeoutId = null;
113 + const timeoutMs = opts.timeout || this.timeout;
114 + const onerror = (err) => {
115 + if (req._hadError)
116 + return;
117 + req.emit('error', err);
118 + // For Safety. Some additional errors might fire later on
119 + // and we need to make sure we don't double-fire the error event.
120 + req._hadError = true;
121 + };
122 + const ontimeout = () => {
123 + timeoutId = null;
124 + timedOut = true;
125 + const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
126 + err.code = 'ETIMEOUT';
127 + onerror(err);
128 + };
129 + const callbackError = (err) => {
130 + if (timedOut)
131 + return;
132 + if (timeoutId !== null) {
133 + clearTimeout(timeoutId);
134 + timeoutId = null;
135 + }
136 + onerror(err);
137 + };
138 + const onsocket = (socket) => {
139 + if (timedOut)
140 + return;
141 + if (timeoutId != null) {
142 + clearTimeout(timeoutId);
143 + timeoutId = null;
144 + }
145 + if (isAgent(socket)) {
146 + // `socket` is actually an `http.Agent` instance, so
147 + // relinquish responsibility for this `req` to the Agent
148 + // from here on
149 + debug('Callback returned another Agent instance %o', socket.constructor.name);
150 + socket.addRequest(req, opts);
151 + return;
152 + }
153 + if (socket) {
154 + socket.once('free', () => {
155 + this.freeSocket(socket, opts);
156 + });
157 + req.onSocket(socket);
158 + return;
159 + }
160 + const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
161 + onerror(err);
162 + };
163 + if (typeof this.callback !== 'function') {
164 + onerror(new Error('`callback` is not defined'));
165 + return;
166 + }
167 + if (!this.promisifiedCallback) {
168 + if (this.callback.length >= 3) {
169 + debug('Converting legacy callback function to promise');
170 + this.promisifiedCallback = promisify_1.default(this.callback);
171 + }
172 + else {
173 + this.promisifiedCallback = this.callback;
174 + }
175 + }
176 + if (typeof timeoutMs === 'number' && timeoutMs > 0) {
177 + timeoutId = setTimeout(ontimeout, timeoutMs);
178 + }
179 + if ('port' in opts && typeof opts.port !== 'number') {
180 + opts.port = Number(opts.port);
181 + }
182 + try {
183 + debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`);
184 + Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
185 + }
186 + catch (err) {
187 + Promise.reject(err).catch(callbackError);
188 + }
189 + }
190 + freeSocket(socket, opts) {
191 + debug('Freeing socket %o %o', socket.constructor.name, opts);
192 + socket.destroy();
193 + }
194 + destroy() {
195 + debug('Destroying agent %o', this.constructor.name);
196 + }
197 + }
198 + createAgent.Agent = Agent;
199 + // So that `instanceof` works correctly
200 + createAgent.prototype = createAgent.Agent.prototype;
201 +})(createAgent || (createAgent = {}));
202 +module.exports = createAgent;
203 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAIA,mCAAsC;AACtC,kDAAgC;AAChC,4DAAoC;AAEpC,MAAM,KAAK,GAAG,eAAW,CAAC,YAAY,CAAC,CAAC;AAExC,SAAS,OAAO,CAAC,CAAM;IACtB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,CAAC;AAOD,SAAS,WAAW,CACnB,QAA+D,EAC/D,IAA+B;IAE/B,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,WAAU,WAAW;IAmDpB;;;;;;OAMG;IACH,MAAa,KAAM,SAAQ,qBAAY;QAmBtC,YACC,QAA+D,EAC/D,KAAgC;YAEhC,KAAK,EAAE,CAAC;YAER,IAAI,IAAI,GAAG,KAAK,CAAC;YACjB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;aACzB;iBAAM,IAAI,QAAQ,EAAE;gBACpB,IAAI,GAAG,QAAQ,CAAC;aAChB;YAED,0DAA0D;YAC1D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;aAC5B;YAED,+DAA+D;YAC/D,0DAA0D;YAC1D,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,WAAW;YACd,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,QAAQ,EAAE;gBACjD,OAAO,IAAI,CAAC,mBAAmB,CAAC;aAChC;YACD,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,CAAC;QAED,IAAI,WAAW,CAAC,CAAS;YACxB,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,QAAQ;YACX,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,QAAQ,EAAE;gBAC9C,OAAO,IAAI,CAAC,gBAAgB,CAAC;aAC7B;YACD,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAChD,CAAC;QAED,IAAI,QAAQ,CAAC,CAAS;YACrB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC3B,CAAC;QAaD,QAAQ,CACP,GAA8B,EAC9B,IAA8B,EAC9B,EAAsC;YAKtC,MAAM,IAAI,KAAK,CACd,yFAAyF,CACzF,CAAC;QACH,CAAC;QAED;;;;;WAKG;QACH,UAAU,CAAC,GAAkB,EAAE,KAAqB;YACnD,MAAM,IAAI,qBAAwB,KAAK,CAAE,CAAC;YAE1C,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE;gBAC7C,IAAI,CAAC,cAAc,GAAG,gBAAgB,EAAE,CAAC;aACzC;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;aACxB;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C;YAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE;gBAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;aACzD;YAED,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;gBAC3B,2DAA2D;gBAC3D,0DAA0D;gBAC1D,4DAA4D;gBAC5D,8CAA8C;gBAC9C,OAAO,IAAI,CAAC,IAAI,CAAC;aACjB;YAED,OAAO,IAAI,CAAC,KAAK,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;YACrB,OAAO,IAAI,CAAC,aAAa,CAAC;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC;YACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC;YAE7B,kCAAkC;YAClC,2CAA2C;YAC3C,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;YACjB,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC;YAE5B,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,IAAI,SAAS,GAAyC,IAAI,CAAC;YAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;YAE/C,MAAM,OAAO,GAAG,CAAC,GAA0B,EAAE,EAAE;gBAC9C,IAAI,GAAG,CAAC,SAAS;oBAAE,OAAO;gBAC1B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBACvB,yDAAyD;gBACzD,iEAAiE;gBACjE,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,CAAC,CAAC;YAEF,MAAM,SAAS,GAAG,GAAG,EAAE;gBACtB,SAAS,GAAG,IAAI,CAAC;gBACjB,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM,GAAG,GAA0B,IAAI,KAAK,CAC3C,sDAAsD,SAAS,IAAI,CACnE,CAAC;gBACF,GAAG,CAAC,IAAI,GAAG,UAAU,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,MAAM,aAAa,GAAG,CAAC,GAA0B,EAAE,EAAE;gBACpD,IAAI,QAAQ;oBAAE,OAAO;gBACrB,IAAI,SAAS,KAAK,IAAI,EAAE;oBACvB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,SAAS,GAAG,IAAI,CAAC;iBACjB;gBACD,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,MAAM,QAAQ,GAAG,CAAC,MAA2B,EAAE,EAAE;gBAChD,IAAI,QAAQ;oBAAE,OAAO;gBACrB,IAAI,SAAS,IAAI,IAAI,EAAE;oBACtB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,SAAS,GAAG,IAAI,CAAC;iBACjB;gBAED,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;oBACpB,oDAAoD;oBACpD,wDAAwD;oBACxD,eAAe;oBACf,KAAK,CACJ,6CAA6C,EAC7C,MAAM,CAAC,WAAW,CAAC,IAAI,CACvB,CAAC;oBACD,MAA4B,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;oBACpD,OAAO;iBACP;gBAED,IAAI,MAAM,EAAE;oBACX,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;wBACxB,IAAI,CAAC,UAAU,CAAC,MAAoB,EAAE,IAAI,CAAC,CAAC;oBAC7C,CAAC,CAAC,CAAC;oBACH,GAAG,CAAC,QAAQ,CAAC,MAAoB,CAAC,CAAC;oBACnC,OAAO;iBACP;gBAED,MAAM,GAAG,GAAG,IAAI,KAAK,CACpB,qDAAqD,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,CAC/E,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC;YAEF,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;gBACxC,OAAO,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;gBAChD,OAAO;aACP;YAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC9B,KAAK,CAAC,gDAAgD,CAAC,CAAC;oBACxD,IAAI,CAAC,mBAAmB,GAAG,mBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACpD;qBAAM;oBACN,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC;iBACzC;aACD;YAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,GAAG,CAAC,EAAE;gBACnD,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;aAC7C;YAED,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACpD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAED,IAAI;gBACH,KAAK,CACJ,qCAAqC,EACrC,IAAI,CAAC,QAAQ,EACb,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAC3B,CAAC;gBACF,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CACxD,QAAQ,EACR,aAAa,CACb,CAAC;aACF;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aACzC;QACF,CAAC;QAED,UAAU,CAAC,MAAkB,EAAE,IAAkB;YAChD,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC7D,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QAED,OAAO;YACN,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;KACD;IAxPY,iBAAK,QAwPjB,CAAA;IAED,uCAAuC;IACvC,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;AACrD,CAAC,EAtTS,WAAW,KAAX,WAAW,QAsTpB;AAED,iBAAS,WAAW,CAAC"}
...\ No newline at end of file ...\ No newline at end of file
1 +import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index';
2 +declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void;
3 +export default function promisify(fn: LegacyCallback): AgentCallbackPromise;
4 +export {};
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +function promisify(fn) {
4 + return function (req, opts) {
5 + return new Promise((resolve, reject) => {
6 + fn.call(this, req, opts, (err, rtn) => {
7 + if (err) {
8 + reject(err);
9 + }
10 + else {
11 + resolve(rtn);
12 + }
13 + });
14 + });
15 + };
16 +}
17 +exports.default = promisify;
18 +//# sourceMappingURL=promisify.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}
...\ No newline at end of file ...\ No newline at end of file
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 +and associated documentation files (the 'Software'), to deal in the Software without restriction,
7 +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 +subject to the following conditions:
10 +
11 +The above copyright notice and this permission notice shall be included in all copies or substantial
12 +portions of the Software.
13 +
14 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 +
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "debug@4",
3 + "_id": "debug@4.3.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
6 + "_location": "/agent-base/debug",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "debug@4",
12 + "name": "debug",
13 + "escapedName": "debug",
14 + "rawSpec": "4",
15 + "saveSpec": null,
16 + "fetchSpec": "4"
17 + },
18 + "_requiredBy": [
19 + "/agent-base"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
22 + "_shasum": "f0a49c18ac8779e31d4a0c6029dfb76873c7428b",
23 + "_spec": "debug@4",
24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\agent-base",
25 + "author": {
26 + "name": "TJ Holowaychuk",
27 + "email": "tj@vision-media.ca"
28 + },
29 + "browser": "./src/browser.js",
30 + "bugs": {
31 + "url": "https://github.com/visionmedia/debug/issues"
32 + },
33 + "bundleDependencies": false,
34 + "contributors": [
35 + {
36 + "name": "Nathan Rajlich",
37 + "email": "nathan@tootallnate.net",
38 + "url": "http://n8.io"
39 + },
40 + {
41 + "name": "Andrew Rhyne",
42 + "email": "rhyneandrew@gmail.com"
43 + },
44 + {
45 + "name": "Josh Junon",
46 + "email": "josh@junon.me"
47 + }
48 + ],
49 + "dependencies": {
50 + "ms": "2.1.2"
51 + },
52 + "deprecated": false,
53 + "description": "small debugging utility",
54 + "devDependencies": {
55 + "brfs": "^2.0.1",
56 + "browserify": "^16.2.3",
57 + "coveralls": "^3.0.2",
58 + "istanbul": "^0.4.5",
59 + "karma": "^3.1.4",
60 + "karma-browserify": "^6.0.0",
61 + "karma-chrome-launcher": "^2.2.0",
62 + "karma-mocha": "^1.3.0",
63 + "mocha": "^5.2.0",
64 + "mocha-lcov-reporter": "^1.2.0",
65 + "xo": "^0.23.0"
66 + },
67 + "engines": {
68 + "node": ">=6.0"
69 + },
70 + "files": [
71 + "src",
72 + "LICENSE",
73 + "README.md"
74 + ],
75 + "homepage": "https://github.com/visionmedia/debug#readme",
76 + "keywords": [
77 + "debug",
78 + "log",
79 + "debugger"
80 + ],
81 + "license": "MIT",
82 + "main": "./src/index.js",
83 + "name": "debug",
84 + "peerDependenciesMeta": {
85 + "supports-color": {
86 + "optional": true
87 + }
88 + },
89 + "repository": {
90 + "type": "git",
91 + "url": "git://github.com/visionmedia/debug.git"
92 + },
93 + "scripts": {
94 + "lint": "xo",
95 + "test": "npm run test:node && npm run test:browser && npm run lint",
96 + "test:browser": "karma start --single-run",
97 + "test:coverage": "cat ./coverage/lcov.info | coveralls",
98 + "test:node": "istanbul cover _mocha -- test.js"
99 + },
100 + "version": "4.3.2"
101 +}
1 +/* eslint-env browser */
2 +
3 +/**
4 + * This is the web browser implementation of `debug()`.
5 + */
6 +
7 +exports.formatArgs = formatArgs;
8 +exports.save = save;
9 +exports.load = load;
10 +exports.useColors = useColors;
11 +exports.storage = localstorage();
12 +exports.destroy = (() => {
13 + let warned = false;
14 +
15 + return () => {
16 + if (!warned) {
17 + warned = true;
18 + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
19 + }
20 + };
21 +})();
22 +
23 +/**
24 + * Colors.
25 + */
26 +
27 +exports.colors = [
28 + '#0000CC',
29 + '#0000FF',
30 + '#0033CC',
31 + '#0033FF',
32 + '#0066CC',
33 + '#0066FF',
34 + '#0099CC',
35 + '#0099FF',
36 + '#00CC00',
37 + '#00CC33',
38 + '#00CC66',
39 + '#00CC99',
40 + '#00CCCC',
41 + '#00CCFF',
42 + '#3300CC',
43 + '#3300FF',
44 + '#3333CC',
45 + '#3333FF',
46 + '#3366CC',
47 + '#3366FF',
48 + '#3399CC',
49 + '#3399FF',
50 + '#33CC00',
51 + '#33CC33',
52 + '#33CC66',
53 + '#33CC99',
54 + '#33CCCC',
55 + '#33CCFF',
56 + '#6600CC',
57 + '#6600FF',
58 + '#6633CC',
59 + '#6633FF',
60 + '#66CC00',
61 + '#66CC33',
62 + '#9900CC',
63 + '#9900FF',
64 + '#9933CC',
65 + '#9933FF',
66 + '#99CC00',
67 + '#99CC33',
68 + '#CC0000',
69 + '#CC0033',
70 + '#CC0066',
71 + '#CC0099',
72 + '#CC00CC',
73 + '#CC00FF',
74 + '#CC3300',
75 + '#CC3333',
76 + '#CC3366',
77 + '#CC3399',
78 + '#CC33CC',
79 + '#CC33FF',
80 + '#CC6600',
81 + '#CC6633',
82 + '#CC9900',
83 + '#CC9933',
84 + '#CCCC00',
85 + '#CCCC33',
86 + '#FF0000',
87 + '#FF0033',
88 + '#FF0066',
89 + '#FF0099',
90 + '#FF00CC',
91 + '#FF00FF',
92 + '#FF3300',
93 + '#FF3333',
94 + '#FF3366',
95 + '#FF3399',
96 + '#FF33CC',
97 + '#FF33FF',
98 + '#FF6600',
99 + '#FF6633',
100 + '#FF9900',
101 + '#FF9933',
102 + '#FFCC00',
103 + '#FFCC33'
104 +];
105 +
106 +/**
107 + * Currently only WebKit-based Web Inspectors, Firefox >= v31,
108 + * and the Firebug extension (any Firefox version) are known
109 + * to support "%c" CSS customizations.
110 + *
111 + * TODO: add a `localStorage` variable to explicitly enable/disable colors
112 + */
113 +
114 +// eslint-disable-next-line complexity
115 +function useColors() {
116 + // NB: In an Electron preload script, document will be defined but not fully
117 + // initialized. Since we know we're in Chrome, we'll just detect this case
118 + // explicitly
119 + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
120 + return true;
121 + }
122 +
123 + // Internet Explorer and Edge do not support colors.
124 + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
125 + return false;
126 + }
127 +
128 + // Is webkit? http://stackoverflow.com/a/16459606/376773
129 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
130 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
131 + // Is firebug? http://stackoverflow.com/a/398120/376773
132 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
133 + // Is firefox >= v31?
134 + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
135 + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
136 + // Double check webkit in userAgent just in case we are in a worker
137 + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
138 +}
139 +
140 +/**
141 + * Colorize log arguments if enabled.
142 + *
143 + * @api public
144 + */
145 +
146 +function formatArgs(args) {
147 + args[0] = (this.useColors ? '%c' : '') +
148 + this.namespace +
149 + (this.useColors ? ' %c' : ' ') +
150 + args[0] +
151 + (this.useColors ? '%c ' : ' ') +
152 + '+' + module.exports.humanize(this.diff);
153 +
154 + if (!this.useColors) {
155 + return;
156 + }
157 +
158 + const c = 'color: ' + this.color;
159 + args.splice(1, 0, c, 'color: inherit');
160 +
161 + // The final "%c" is somewhat tricky, because there could be other
162 + // arguments passed either before or after the %c, so we need to
163 + // figure out the correct index to insert the CSS into
164 + let index = 0;
165 + let lastC = 0;
166 + args[0].replace(/%[a-zA-Z%]/g, match => {
167 + if (match === '%%') {
168 + return;
169 + }
170 + index++;
171 + if (match === '%c') {
172 + // We only are interested in the *last* %c
173 + // (the user may have provided their own)
174 + lastC = index;
175 + }
176 + });
177 +
178 + args.splice(lastC, 0, c);
179 +}
180 +
181 +/**
182 + * Invokes `console.debug()` when available.
183 + * No-op when `console.debug` is not a "function".
184 + * If `console.debug` is not available, falls back
185 + * to `console.log`.
186 + *
187 + * @api public
188 + */
189 +exports.log = console.debug || console.log || (() => {});
190 +
191 +/**
192 + * Save `namespaces`.
193 + *
194 + * @param {String} namespaces
195 + * @api private
196 + */
197 +function save(namespaces) {
198 + try {
199 + if (namespaces) {
200 + exports.storage.setItem('debug', namespaces);
201 + } else {
202 + exports.storage.removeItem('debug');
203 + }
204 + } catch (error) {
205 + // Swallow
206 + // XXX (@Qix-) should we be logging these?
207 + }
208 +}
209 +
210 +/**
211 + * Load `namespaces`.
212 + *
213 + * @return {String} returns the previously persisted debug modes
214 + * @api private
215 + */
216 +function load() {
217 + let r;
218 + try {
219 + r = exports.storage.getItem('debug');
220 + } catch (error) {
221 + // Swallow
222 + // XXX (@Qix-) should we be logging these?
223 + }
224 +
225 + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
226 + if (!r && typeof process !== 'undefined' && 'env' in process) {
227 + r = process.env.DEBUG;
228 + }
229 +
230 + return r;
231 +}
232 +
233 +/**
234 + * Localstorage attempts to return the localstorage.
235 + *
236 + * This is necessary because safari throws
237 + * when a user disables cookies/localstorage
238 + * and you attempt to access it.
239 + *
240 + * @return {LocalStorage}
241 + * @api private
242 + */
243 +
244 +function localstorage() {
245 + try {
246 + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
247 + // The Browser also has localStorage in the global context.
248 + return localStorage;
249 + } catch (error) {
250 + // Swallow
251 + // XXX (@Qix-) should we be logging these?
252 + }
253 +}
254 +
255 +module.exports = require('./common')(exports);
256 +
257 +const {formatters} = module.exports;
258 +
259 +/**
260 + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
261 + */
262 +
263 +formatters.j = function (v) {
264 + try {
265 + return JSON.stringify(v);
266 + } catch (error) {
267 + return '[UnexpectedJSONParseError]: ' + error.message;
268 + }
269 +};
1 +
2 +/**
3 + * This is the common logic for both the Node.js and web browser
4 + * implementations of `debug()`.
5 + */
6 +
7 +function setup(env) {
8 + createDebug.debug = createDebug;
9 + createDebug.default = createDebug;
10 + createDebug.coerce = coerce;
11 + createDebug.disable = disable;
12 + createDebug.enable = enable;
13 + createDebug.enabled = enabled;
14 + createDebug.humanize = require('ms');
15 + createDebug.destroy = destroy;
16 +
17 + Object.keys(env).forEach(key => {
18 + createDebug[key] = env[key];
19 + });
20 +
21 + /**
22 + * The currently active debug mode names, and names to skip.
23 + */
24 +
25 + createDebug.names = [];
26 + createDebug.skips = [];
27 +
28 + /**
29 + * Map of special "%n" handling functions, for the debug "format" argument.
30 + *
31 + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
32 + */
33 + createDebug.formatters = {};
34 +
35 + /**
36 + * Selects a color for a debug namespace
37 + * @param {String} namespace The namespace string for the for the debug instance to be colored
38 + * @return {Number|String} An ANSI color code for the given namespace
39 + * @api private
40 + */
41 + function selectColor(namespace) {
42 + let hash = 0;
43 +
44 + for (let i = 0; i < namespace.length; i++) {
45 + hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
46 + hash |= 0; // Convert to 32bit integer
47 + }
48 +
49 + return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
50 + }
51 + createDebug.selectColor = selectColor;
52 +
53 + /**
54 + * Create a debugger with the given `namespace`.
55 + *
56 + * @param {String} namespace
57 + * @return {Function}
58 + * @api public
59 + */
60 + function createDebug(namespace) {
61 + let prevTime;
62 + let enableOverride = null;
63 + let namespacesCache;
64 + let enabledCache;
65 +
66 + function debug(...args) {
67 + // Disabled?
68 + if (!debug.enabled) {
69 + return;
70 + }
71 +
72 + const self = debug;
73 +
74 + // Set `diff` timestamp
75 + const curr = Number(new Date());
76 + const ms = curr - (prevTime || curr);
77 + self.diff = ms;
78 + self.prev = prevTime;
79 + self.curr = curr;
80 + prevTime = curr;
81 +
82 + args[0] = createDebug.coerce(args[0]);
83 +
84 + if (typeof args[0] !== 'string') {
85 + // Anything else let's inspect with %O
86 + args.unshift('%O');
87 + }
88 +
89 + // Apply any `formatters` transformations
90 + let index = 0;
91 + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
92 + // If we encounter an escaped % then don't increase the array index
93 + if (match === '%%') {
94 + return '%';
95 + }
96 + index++;
97 + const formatter = createDebug.formatters[format];
98 + if (typeof formatter === 'function') {
99 + const val = args[index];
100 + match = formatter.call(self, val);
101 +
102 + // Now we need to remove `args[index]` since it's inlined in the `format`
103 + args.splice(index, 1);
104 + index--;
105 + }
106 + return match;
107 + });
108 +
109 + // Apply env-specific formatting (colors, etc.)
110 + createDebug.formatArgs.call(self, args);
111 +
112 + const logFn = self.log || createDebug.log;
113 + logFn.apply(self, args);
114 + }
115 +
116 + debug.namespace = namespace;
117 + debug.useColors = createDebug.useColors();
118 + debug.color = createDebug.selectColor(namespace);
119 + debug.extend = extend;
120 + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
121 +
122 + Object.defineProperty(debug, 'enabled', {
123 + enumerable: true,
124 + configurable: false,
125 + get: () => {
126 + if (enableOverride !== null) {
127 + return enableOverride;
128 + }
129 + if (namespacesCache !== createDebug.namespaces) {
130 + namespacesCache = createDebug.namespaces;
131 + enabledCache = createDebug.enabled(namespace);
132 + }
133 +
134 + return enabledCache;
135 + },
136 + set: v => {
137 + enableOverride = v;
138 + }
139 + });
140 +
141 + // Env-specific initialization logic for debug instances
142 + if (typeof createDebug.init === 'function') {
143 + createDebug.init(debug);
144 + }
145 +
146 + return debug;
147 + }
148 +
149 + function extend(namespace, delimiter) {
150 + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
151 + newDebug.log = this.log;
152 + return newDebug;
153 + }
154 +
155 + /**
156 + * Enables a debug mode by namespaces. This can include modes
157 + * separated by a colon and wildcards.
158 + *
159 + * @param {String} namespaces
160 + * @api public
161 + */
162 + function enable(namespaces) {
163 + createDebug.save(namespaces);
164 + createDebug.namespaces = namespaces;
165 +
166 + createDebug.names = [];
167 + createDebug.skips = [];
168 +
169 + let i;
170 + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
171 + const len = split.length;
172 +
173 + for (i = 0; i < len; i++) {
174 + if (!split[i]) {
175 + // ignore empty strings
176 + continue;
177 + }
178 +
179 + namespaces = split[i].replace(/\*/g, '.*?');
180 +
181 + if (namespaces[0] === '-') {
182 + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
183 + } else {
184 + createDebug.names.push(new RegExp('^' + namespaces + '$'));
185 + }
186 + }
187 + }
188 +
189 + /**
190 + * Disable debug output.
191 + *
192 + * @return {String} namespaces
193 + * @api public
194 + */
195 + function disable() {
196 + const namespaces = [
197 + ...createDebug.names.map(toNamespace),
198 + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
199 + ].join(',');
200 + createDebug.enable('');
201 + return namespaces;
202 + }
203 +
204 + /**
205 + * Returns true if the given mode name is enabled, false otherwise.
206 + *
207 + * @param {String} name
208 + * @return {Boolean}
209 + * @api public
210 + */
211 + function enabled(name) {
212 + if (name[name.length - 1] === '*') {
213 + return true;
214 + }
215 +
216 + let i;
217 + let len;
218 +
219 + for (i = 0, len = createDebug.skips.length; i < len; i++) {
220 + if (createDebug.skips[i].test(name)) {
221 + return false;
222 + }
223 + }
224 +
225 + for (i = 0, len = createDebug.names.length; i < len; i++) {
226 + if (createDebug.names[i].test(name)) {
227 + return true;
228 + }
229 + }
230 +
231 + return false;
232 + }
233 +
234 + /**
235 + * Convert regexp to namespace
236 + *
237 + * @param {RegExp} regxep
238 + * @return {String} namespace
239 + * @api private
240 + */
241 + function toNamespace(regexp) {
242 + return regexp.toString()
243 + .substring(2, regexp.toString().length - 2)
244 + .replace(/\.\*\?$/, '*');
245 + }
246 +
247 + /**
248 + * Coerce `val`.
249 + *
250 + * @param {Mixed} val
251 + * @return {Mixed}
252 + * @api private
253 + */
254 + function coerce(val) {
255 + if (val instanceof Error) {
256 + return val.stack || val.message;
257 + }
258 + return val;
259 + }
260 +
261 + /**
262 + * XXX DO NOT USE. This is a temporary stub function.
263 + * XXX It WILL be removed in the next major release.
264 + */
265 + function destroy() {
266 + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
267 + }
268 +
269 + createDebug.enable(createDebug.load());
270 +
271 + return createDebug;
272 +}
273 +
274 +module.exports = setup;
1 +/**
2 + * Detect Electron renderer / nwjs process, which is node, but we should
3 + * treat as a browser.
4 + */
5 +
6 +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
7 + module.exports = require('./browser.js');
8 +} else {
9 + module.exports = require('./node.js');
10 +}
1 +/**
2 + * Module dependencies.
3 + */
4 +
5 +const tty = require('tty');
6 +const util = require('util');
7 +
8 +/**
9 + * This is the Node.js implementation of `debug()`.
10 + */
11 +
12 +exports.init = init;
13 +exports.log = log;
14 +exports.formatArgs = formatArgs;
15 +exports.save = save;
16 +exports.load = load;
17 +exports.useColors = useColors;
18 +exports.destroy = util.deprecate(
19 + () => {},
20 + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
21 +);
22 +
23 +/**
24 + * Colors.
25 + */
26 +
27 +exports.colors = [6, 2, 3, 4, 5, 1];
28 +
29 +try {
30 + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
31 + // eslint-disable-next-line import/no-extraneous-dependencies
32 + const supportsColor = require('supports-color');
33 +
34 + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
35 + exports.colors = [
36 + 20,
37 + 21,
38 + 26,
39 + 27,
40 + 32,
41 + 33,
42 + 38,
43 + 39,
44 + 40,
45 + 41,
46 + 42,
47 + 43,
48 + 44,
49 + 45,
50 + 56,
51 + 57,
52 + 62,
53 + 63,
54 + 68,
55 + 69,
56 + 74,
57 + 75,
58 + 76,
59 + 77,
60 + 78,
61 + 79,
62 + 80,
63 + 81,
64 + 92,
65 + 93,
66 + 98,
67 + 99,
68 + 112,
69 + 113,
70 + 128,
71 + 129,
72 + 134,
73 + 135,
74 + 148,
75 + 149,
76 + 160,
77 + 161,
78 + 162,
79 + 163,
80 + 164,
81 + 165,
82 + 166,
83 + 167,
84 + 168,
85 + 169,
86 + 170,
87 + 171,
88 + 172,
89 + 173,
90 + 178,
91 + 179,
92 + 184,
93 + 185,
94 + 196,
95 + 197,
96 + 198,
97 + 199,
98 + 200,
99 + 201,
100 + 202,
101 + 203,
102 + 204,
103 + 205,
104 + 206,
105 + 207,
106 + 208,
107 + 209,
108 + 214,
109 + 215,
110 + 220,
111 + 221
112 + ];
113 + }
114 +} catch (error) {
115 + // Swallow - we only care if `supports-color` is available; it doesn't have to be.
116 +}
117 +
118 +/**
119 + * Build up the default `inspectOpts` object from the environment variables.
120 + *
121 + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
122 + */
123 +
124 +exports.inspectOpts = Object.keys(process.env).filter(key => {
125 + return /^debug_/i.test(key);
126 +}).reduce((obj, key) => {
127 + // Camel-case
128 + const prop = key
129 + .substring(6)
130 + .toLowerCase()
131 + .replace(/_([a-z])/g, (_, k) => {
132 + return k.toUpperCase();
133 + });
134 +
135 + // Coerce string value into JS value
136 + let val = process.env[key];
137 + if (/^(yes|on|true|enabled)$/i.test(val)) {
138 + val = true;
139 + } else if (/^(no|off|false|disabled)$/i.test(val)) {
140 + val = false;
141 + } else if (val === 'null') {
142 + val = null;
143 + } else {
144 + val = Number(val);
145 + }
146 +
147 + obj[prop] = val;
148 + return obj;
149 +}, {});
150 +
151 +/**
152 + * Is stdout a TTY? Colored output is enabled when `true`.
153 + */
154 +
155 +function useColors() {
156 + return 'colors' in exports.inspectOpts ?
157 + Boolean(exports.inspectOpts.colors) :
158 + tty.isatty(process.stderr.fd);
159 +}
160 +
161 +/**
162 + * Adds ANSI color escape codes if enabled.
163 + *
164 + * @api public
165 + */
166 +
167 +function formatArgs(args) {
168 + const {namespace: name, useColors} = this;
169 +
170 + if (useColors) {
171 + const c = this.color;
172 + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
173 + const prefix = ` ${colorCode};1m${name} \u001B[0m`;
174 +
175 + args[0] = prefix + args[0].split('\n').join('\n' + prefix);
176 + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
177 + } else {
178 + args[0] = getDate() + name + ' ' + args[0];
179 + }
180 +}
181 +
182 +function getDate() {
183 + if (exports.inspectOpts.hideDate) {
184 + return '';
185 + }
186 + return new Date().toISOString() + ' ';
187 +}
188 +
189 +/**
190 + * Invokes `util.format()` with the specified arguments and writes to stderr.
191 + */
192 +
193 +function log(...args) {
194 + return process.stderr.write(util.format(...args) + '\n');
195 +}
196 +
197 +/**
198 + * Save `namespaces`.
199 + *
200 + * @param {String} namespaces
201 + * @api private
202 + */
203 +function save(namespaces) {
204 + if (namespaces) {
205 + process.env.DEBUG = namespaces;
206 + } else {
207 + // If you set a process.env field to null or undefined, it gets cast to the
208 + // string 'null' or 'undefined'. Just delete instead.
209 + delete process.env.DEBUG;
210 + }
211 +}
212 +
213 +/**
214 + * Load `namespaces`.
215 + *
216 + * @return {String} returns the previously persisted debug modes
217 + * @api private
218 + */
219 +
220 +function load() {
221 + return process.env.DEBUG;
222 +}
223 +
224 +/**
225 + * Init logic for `debug` instances.
226 + *
227 + * Create a new `inspectOpts` object in case `useColors` is set
228 + * differently for a particular `debug` instance.
229 + */
230 +
231 +function init(debug) {
232 + debug.inspectOpts = {};
233 +
234 + const keys = Object.keys(exports.inspectOpts);
235 + for (let i = 0; i < keys.length; i++) {
236 + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
237 + }
238 +}
239 +
240 +module.exports = require('./common')(exports);
241 +
242 +const {formatters} = module.exports;
243 +
244 +/**
245 + * Map %o to `util.inspect()`, all on a single line.
246 + */
247 +
248 +formatters.o = function (v) {
249 + this.inspectOpts.colors = this.useColors;
250 + return util.inspect(v, this.inspectOpts)
251 + .split('\n')
252 + .map(str => str.trim())
253 + .join(' ');
254 +};
255 +
256 +/**
257 + * Map %O to `util.inspect()`, allowing multiple lines if needed.
258 + */
259 +
260 +formatters.O = function (v) {
261 + this.inspectOpts.colors = this.useColors;
262 + return util.inspect(v, this.inspectOpts);
263 +};
1 +/**
2 + * Helpers.
3 + */
4 +
5 +var s = 1000;
6 +var m = s * 60;
7 +var h = m * 60;
8 +var d = h * 24;
9 +var w = d * 7;
10 +var y = d * 365.25;
11 +
12 +/**
13 + * Parse or format the given `val`.
14 + *
15 + * Options:
16 + *
17 + * - `long` verbose formatting [false]
18 + *
19 + * @param {String|Number} val
20 + * @param {Object} [options]
21 + * @throws {Error} throw an error if val is not a non-empty string or a number
22 + * @return {String|Number}
23 + * @api public
24 + */
25 +
26 +module.exports = function(val, options) {
27 + options = options || {};
28 + var type = typeof val;
29 + if (type === 'string' && val.length > 0) {
30 + return parse(val);
31 + } else if (type === 'number' && isFinite(val)) {
32 + return options.long ? fmtLong(val) : fmtShort(val);
33 + }
34 + throw new Error(
35 + 'val is not a non-empty string or a valid number. val=' +
36 + JSON.stringify(val)
37 + );
38 +};
39 +
40 +/**
41 + * Parse the given `str` and return milliseconds.
42 + *
43 + * @param {String} str
44 + * @return {Number}
45 + * @api private
46 + */
47 +
48 +function parse(str) {
49 + str = String(str);
50 + if (str.length > 100) {
51 + return;
52 + }
53 + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
54 + str
55 + );
56 + if (!match) {
57 + return;
58 + }
59 + var n = parseFloat(match[1]);
60 + var type = (match[2] || 'ms').toLowerCase();
61 + switch (type) {
62 + case 'years':
63 + case 'year':
64 + case 'yrs':
65 + case 'yr':
66 + case 'y':
67 + return n * y;
68 + case 'weeks':
69 + case 'week':
70 + case 'w':
71 + return n * w;
72 + case 'days':
73 + case 'day':
74 + case 'd':
75 + return n * d;
76 + case 'hours':
77 + case 'hour':
78 + case 'hrs':
79 + case 'hr':
80 + case 'h':
81 + return n * h;
82 + case 'minutes':
83 + case 'minute':
84 + case 'mins':
85 + case 'min':
86 + case 'm':
87 + return n * m;
88 + case 'seconds':
89 + case 'second':
90 + case 'secs':
91 + case 'sec':
92 + case 's':
93 + return n * s;
94 + case 'milliseconds':
95 + case 'millisecond':
96 + case 'msecs':
97 + case 'msec':
98 + case 'ms':
99 + return n;
100 + default:
101 + return undefined;
102 + }
103 +}
104 +
105 +/**
106 + * Short format for `ms`.
107 + *
108 + * @param {Number} ms
109 + * @return {String}
110 + * @api private
111 + */
112 +
113 +function fmtShort(ms) {
114 + var msAbs = Math.abs(ms);
115 + if (msAbs >= d) {
116 + return Math.round(ms / d) + 'd';
117 + }
118 + if (msAbs >= h) {
119 + return Math.round(ms / h) + 'h';
120 + }
121 + if (msAbs >= m) {
122 + return Math.round(ms / m) + 'm';
123 + }
124 + if (msAbs >= s) {
125 + return Math.round(ms / s) + 's';
126 + }
127 + return ms + 'ms';
128 +}
129 +
130 +/**
131 + * Long format for `ms`.
132 + *
133 + * @param {Number} ms
134 + * @return {String}
135 + * @api private
136 + */
137 +
138 +function fmtLong(ms) {
139 + var msAbs = Math.abs(ms);
140 + if (msAbs >= d) {
141 + return plural(ms, msAbs, d, 'day');
142 + }
143 + if (msAbs >= h) {
144 + return plural(ms, msAbs, h, 'hour');
145 + }
146 + if (msAbs >= m) {
147 + return plural(ms, msAbs, m, 'minute');
148 + }
149 + if (msAbs >= s) {
150 + return plural(ms, msAbs, s, 'second');
151 + }
152 + return ms + ' ms';
153 +}
154 +
155 +/**
156 + * Pluralization helper.
157 + */
158 +
159 +function plural(ms, msAbs, n, name) {
160 + var isPlural = msAbs >= n * 1.5;
161 + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
162 +}
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2016 Zeit, Inc.
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 all
13 +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 THE
21 +SOFTWARE.
1 +{
2 + "_from": "ms@2.1.2",
3 + "_id": "ms@2.1.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
6 + "_location": "/agent-base/ms",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "ms@2.1.2",
12 + "name": "ms",
13 + "escapedName": "ms",
14 + "rawSpec": "2.1.2",
15 + "saveSpec": null,
16 + "fetchSpec": "2.1.2"
17 + },
18 + "_requiredBy": [
19 + "/agent-base/debug"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
22 + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009",
23 + "_spec": "ms@2.1.2",
24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\agent-base\\node_modules\\debug",
25 + "bugs": {
26 + "url": "https://github.com/zeit/ms/issues"
27 + },
28 + "bundleDependencies": false,
29 + "deprecated": false,
30 + "description": "Tiny millisecond conversion utility",
31 + "devDependencies": {
32 + "eslint": "4.12.1",
33 + "expect.js": "0.3.1",
34 + "husky": "0.14.3",
35 + "lint-staged": "5.0.0",
36 + "mocha": "4.0.1"
37 + },
38 + "eslintConfig": {
39 + "extends": "eslint:recommended",
40 + "env": {
41 + "node": true,
42 + "es6": true
43 + }
44 + },
45 + "files": [
46 + "index.js"
47 + ],
48 + "homepage": "https://github.com/zeit/ms#readme",
49 + "license": "MIT",
50 + "lint-staged": {
51 + "*.js": [
52 + "npm run lint",
53 + "prettier --single-quote --write",
54 + "git add"
55 + ]
56 + },
57 + "main": "./index",
58 + "name": "ms",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/zeit/ms.git"
62 + },
63 + "scripts": {
64 + "lint": "eslint lib/* bin/*",
65 + "precommit": "lint-staged",
66 + "test": "mocha tests.js"
67 + },
68 + "version": "2.1.2"
69 +}
1 +# ms
2 +
3 +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
4 +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
5 +
6 +Use this package to easily convert various time formats to milliseconds.
7 +
8 +## Examples
9 +
10 +```js
11 +ms('2 days') // 172800000
12 +ms('1d') // 86400000
13 +ms('10h') // 36000000
14 +ms('2.5 hrs') // 9000000
15 +ms('2h') // 7200000
16 +ms('1m') // 60000
17 +ms('5s') // 5000
18 +ms('1y') // 31557600000
19 +ms('100') // 100
20 +ms('-3 days') // -259200000
21 +ms('-1h') // -3600000
22 +ms('-200') // -200
23 +```
24 +
25 +### Convert from Milliseconds
26 +
27 +```js
28 +ms(60000) // "1m"
29 +ms(2 * 60000) // "2m"
30 +ms(-3 * 60000) // "-3m"
31 +ms(ms('10 hours')) // "10h"
32 +```
33 +
34 +### Time Format Written-Out
35 +
36 +```js
37 +ms(60000, { long: true }) // "1 minute"
38 +ms(2 * 60000, { long: true }) // "2 minutes"
39 +ms(-3 * 60000, { long: true }) // "-3 minutes"
40 +ms(ms('10 hours'), { long: true }) // "10 hours"
41 +```
42 +
43 +## Features
44 +
45 +- Works both in [Node.js](https://nodejs.org) and in the browser
46 +- If a number is supplied to `ms`, a string with a unit is returned
47 +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
48 +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
49 +
50 +## Related Packages
51 +
52 +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
53 +
54 +## Caught a Bug?
55 +
56 +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
57 +2. Link the package to the global module directory: `npm link`
58 +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
59 +
60 +As always, you can run the tests using: `npm test`
1 +{
2 + "_from": "agent-base@6",
3 + "_id": "agent-base@6.0.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
6 + "_location": "/agent-base",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "agent-base@6",
12 + "name": "agent-base",
13 + "escapedName": "agent-base",
14 + "rawSpec": "6",
15 + "saveSpec": null,
16 + "fetchSpec": "6"
17 + },
18 + "_requiredBy": [
19 + "/http-proxy-agent",
20 + "/https-proxy-agent"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
23 + "_shasum": "49fff58577cfee3f37176feab4c22e00f86d7f77",
24 + "_spec": "agent-base@6",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\http-proxy-agent",
26 + "author": {
27 + "name": "Nathan Rajlich",
28 + "email": "nathan@tootallnate.net",
29 + "url": "http://n8.io/"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/TooTallNate/node-agent-base/issues"
33 + },
34 + "bundleDependencies": false,
35 + "dependencies": {
36 + "debug": "4"
37 + },
38 + "deprecated": false,
39 + "description": "Turn a function into an `http.Agent` instance",
40 + "devDependencies": {
41 + "@types/debug": "4",
42 + "@types/mocha": "^5.2.7",
43 + "@types/node": "^14.0.20",
44 + "@types/semver": "^7.1.0",
45 + "@types/ws": "^6.0.3",
46 + "@typescript-eslint/eslint-plugin": "1.6.0",
47 + "@typescript-eslint/parser": "1.1.0",
48 + "async-listen": "^1.2.0",
49 + "cpy-cli": "^2.0.0",
50 + "eslint": "5.16.0",
51 + "eslint-config-airbnb": "17.1.0",
52 + "eslint-config-prettier": "4.1.0",
53 + "eslint-import-resolver-typescript": "1.1.1",
54 + "eslint-plugin-import": "2.16.0",
55 + "eslint-plugin-jsx-a11y": "6.2.1",
56 + "eslint-plugin-react": "7.12.4",
57 + "mocha": "^6.2.0",
58 + "rimraf": "^3.0.0",
59 + "semver": "^7.1.2",
60 + "typescript": "^3.5.3",
61 + "ws": "^3.0.0"
62 + },
63 + "engines": {
64 + "node": ">= 6.0.0"
65 + },
66 + "files": [
67 + "dist/src",
68 + "src"
69 + ],
70 + "homepage": "https://github.com/TooTallNate/node-agent-base#readme",
71 + "keywords": [
72 + "http",
73 + "agent",
74 + "base",
75 + "barebones",
76 + "https"
77 + ],
78 + "license": "MIT",
79 + "main": "dist/src/index",
80 + "name": "agent-base",
81 + "repository": {
82 + "type": "git",
83 + "url": "git://github.com/TooTallNate/node-agent-base.git"
84 + },
85 + "scripts": {
86 + "build": "tsc",
87 + "postbuild": "cpy --parents src test '!**/*.ts' dist",
88 + "prebuild": "rimraf dist",
89 + "prepublishOnly": "npm run build",
90 + "test": "mocha --reporter spec dist/test/*.js",
91 + "test-lint": "eslint src --ext .js,.ts"
92 + },
93 + "typings": "dist/src/index",
94 + "version": "6.0.2"
95 +}
1 +import net from 'net';
2 +import http from 'http';
3 +import https from 'https';
4 +import { Duplex } from 'stream';
5 +import { EventEmitter } from 'events';
6 +import createDebug from 'debug';
7 +import promisify from './promisify';
8 +
9 +const debug = createDebug('agent-base');
10 +
11 +function isAgent(v: any): v is createAgent.AgentLike {
12 + return Boolean(v) && typeof v.addRequest === 'function';
13 +}
14 +
15 +function isSecureEndpoint(): boolean {
16 + const { stack } = new Error();
17 + if (typeof stack !== 'string') return false;
18 + return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
19 +}
20 +
21 +function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
22 +function createAgent(
23 + callback: createAgent.AgentCallback,
24 + opts?: createAgent.AgentOptions
25 +): createAgent.Agent;
26 +function createAgent(
27 + callback?: createAgent.AgentCallback | createAgent.AgentOptions,
28 + opts?: createAgent.AgentOptions
29 +) {
30 + return new createAgent.Agent(callback, opts);
31 +}
32 +
33 +namespace createAgent {
34 + export interface ClientRequest extends http.ClientRequest {
35 + _last?: boolean;
36 + _hadError?: boolean;
37 + method: string;
38 + }
39 +
40 + export interface AgentRequestOptions {
41 + host?: string;
42 + path?: string;
43 + // `port` on `http.RequestOptions` can be a string or undefined,
44 + // but `net.TcpNetConnectOpts` expects only a number
45 + port: number;
46 + }
47 +
48 + export interface HttpRequestOptions
49 + extends AgentRequestOptions,
50 + Omit<http.RequestOptions, keyof AgentRequestOptions> {
51 + secureEndpoint: false;
52 + }
53 +
54 + export interface HttpsRequestOptions
55 + extends AgentRequestOptions,
56 + Omit<https.RequestOptions, keyof AgentRequestOptions> {
57 + secureEndpoint: true;
58 + }
59 +
60 + export type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
61 +
62 + export type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
63 +
64 + export type AgentCallbackReturn = Duplex | AgentLike;
65 +
66 + export type AgentCallbackCallback = (
67 + err?: Error | null,
68 + socket?: createAgent.AgentCallbackReturn
69 + ) => void;
70 +
71 + export type AgentCallbackPromise = (
72 + req: createAgent.ClientRequest,
73 + opts: createAgent.RequestOptions
74 + ) =>
75 + | createAgent.AgentCallbackReturn
76 + | Promise<createAgent.AgentCallbackReturn>;
77 +
78 + export type AgentCallback = typeof Agent.prototype.callback;
79 +
80 + export type AgentOptions = {
81 + timeout?: number;
82 + };
83 +
84 + /**
85 + * Base `http.Agent` implementation.
86 + * No pooling/keep-alive is implemented by default.
87 + *
88 + * @param {Function} callback
89 + * @api public
90 + */
91 + export class Agent extends EventEmitter {
92 + public timeout: number | null;
93 + public maxFreeSockets: number;
94 + public maxTotalSockets: number;
95 + public maxSockets: number;
96 + public sockets: {
97 + [key: string]: net.Socket[];
98 + };
99 + public freeSockets: {
100 + [key: string]: net.Socket[];
101 + };
102 + public requests: {
103 + [key: string]: http.IncomingMessage[];
104 + };
105 + public options: https.AgentOptions;
106 + private promisifiedCallback?: createAgent.AgentCallbackPromise;
107 + private explicitDefaultPort?: number;
108 + private explicitProtocol?: string;
109 +
110 + constructor(
111 + callback?: createAgent.AgentCallback | createAgent.AgentOptions,
112 + _opts?: createAgent.AgentOptions
113 + ) {
114 + super();
115 +
116 + let opts = _opts;
117 + if (typeof callback === 'function') {
118 + this.callback = callback;
119 + } else if (callback) {
120 + opts = callback;
121 + }
122 +
123 + // Timeout for the socket to be returned from the callback
124 + this.timeout = null;
125 + if (opts && typeof opts.timeout === 'number') {
126 + this.timeout = opts.timeout;
127 + }
128 +
129 + // These aren't actually used by `agent-base`, but are required
130 + // for the TypeScript definition files in `@types/node` :/
131 + this.maxFreeSockets = 1;
132 + this.maxSockets = 1;
133 + this.maxTotalSockets = Infinity;
134 + this.sockets = {};
135 + this.freeSockets = {};
136 + this.requests = {};
137 + this.options = {};
138 + }
139 +
140 + get defaultPort(): number {
141 + if (typeof this.explicitDefaultPort === 'number') {
142 + return this.explicitDefaultPort;
143 + }
144 + return isSecureEndpoint() ? 443 : 80;
145 + }
146 +
147 + set defaultPort(v: number) {
148 + this.explicitDefaultPort = v;
149 + }
150 +
151 + get protocol(): string {
152 + if (typeof this.explicitProtocol === 'string') {
153 + return this.explicitProtocol;
154 + }
155 + return isSecureEndpoint() ? 'https:' : 'http:';
156 + }
157 +
158 + set protocol(v: string) {
159 + this.explicitProtocol = v;
160 + }
161 +
162 + callback(
163 + req: createAgent.ClientRequest,
164 + opts: createAgent.RequestOptions,
165 + fn: createAgent.AgentCallbackCallback
166 + ): void;
167 + callback(
168 + req: createAgent.ClientRequest,
169 + opts: createAgent.RequestOptions
170 + ):
171 + | createAgent.AgentCallbackReturn
172 + | Promise<createAgent.AgentCallbackReturn>;
173 + callback(
174 + req: createAgent.ClientRequest,
175 + opts: createAgent.AgentOptions,
176 + fn?: createAgent.AgentCallbackCallback
177 + ):
178 + | createAgent.AgentCallbackReturn
179 + | Promise<createAgent.AgentCallbackReturn>
180 + | void {
181 + throw new Error(
182 + '"agent-base" has no default implementation, you must subclass and override `callback()`'
183 + );
184 + }
185 +
186 + /**
187 + * Called by node-core's "_http_client.js" module when creating
188 + * a new HTTP request with this Agent instance.
189 + *
190 + * @api public
191 + */
192 + addRequest(req: ClientRequest, _opts: RequestOptions): void {
193 + const opts: RequestOptions = { ..._opts };
194 +
195 + if (typeof opts.secureEndpoint !== 'boolean') {
196 + opts.secureEndpoint = isSecureEndpoint();
197 + }
198 +
199 + if (opts.host == null) {
200 + opts.host = 'localhost';
201 + }
202 +
203 + if (opts.port == null) {
204 + opts.port = opts.secureEndpoint ? 443 : 80;
205 + }
206 +
207 + if (opts.protocol == null) {
208 + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
209 + }
210 +
211 + if (opts.host && opts.path) {
212 + // If both a `host` and `path` are specified then it's most
213 + // likely the result of a `url.parse()` call... we need to
214 + // remove the `path` portion so that `net.connect()` doesn't
215 + // attempt to open that as a unix socket file.
216 + delete opts.path;
217 + }
218 +
219 + delete opts.agent;
220 + delete opts.hostname;
221 + delete opts._defaultAgent;
222 + delete opts.defaultPort;
223 + delete opts.createConnection;
224 +
225 + // Hint to use "Connection: close"
226 + // XXX: non-documented `http` module API :(
227 + req._last = true;
228 + req.shouldKeepAlive = false;
229 +
230 + let timedOut = false;
231 + let timeoutId: ReturnType<typeof setTimeout> | null = null;
232 + const timeoutMs = opts.timeout || this.timeout;
233 +
234 + const onerror = (err: NodeJS.ErrnoException) => {
235 + if (req._hadError) return;
236 + req.emit('error', err);
237 + // For Safety. Some additional errors might fire later on
238 + // and we need to make sure we don't double-fire the error event.
239 + req._hadError = true;
240 + };
241 +
242 + const ontimeout = () => {
243 + timeoutId = null;
244 + timedOut = true;
245 + const err: NodeJS.ErrnoException = new Error(
246 + `A "socket" was not created for HTTP request before ${timeoutMs}ms`
247 + );
248 + err.code = 'ETIMEOUT';
249 + onerror(err);
250 + };
251 +
252 + const callbackError = (err: NodeJS.ErrnoException) => {
253 + if (timedOut) return;
254 + if (timeoutId !== null) {
255 + clearTimeout(timeoutId);
256 + timeoutId = null;
257 + }
258 + onerror(err);
259 + };
260 +
261 + const onsocket = (socket: AgentCallbackReturn) => {
262 + if (timedOut) return;
263 + if (timeoutId != null) {
264 + clearTimeout(timeoutId);
265 + timeoutId = null;
266 + }
267 +
268 + if (isAgent(socket)) {
269 + // `socket` is actually an `http.Agent` instance, so
270 + // relinquish responsibility for this `req` to the Agent
271 + // from here on
272 + debug(
273 + 'Callback returned another Agent instance %o',
274 + socket.constructor.name
275 + );
276 + (socket as createAgent.Agent).addRequest(req, opts);
277 + return;
278 + }
279 +
280 + if (socket) {
281 + socket.once('free', () => {
282 + this.freeSocket(socket as net.Socket, opts);
283 + });
284 + req.onSocket(socket as net.Socket);
285 + return;
286 + }
287 +
288 + const err = new Error(
289 + `no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``
290 + );
291 + onerror(err);
292 + };
293 +
294 + if (typeof this.callback !== 'function') {
295 + onerror(new Error('`callback` is not defined'));
296 + return;
297 + }
298 +
299 + if (!this.promisifiedCallback) {
300 + if (this.callback.length >= 3) {
301 + debug('Converting legacy callback function to promise');
302 + this.promisifiedCallback = promisify(this.callback);
303 + } else {
304 + this.promisifiedCallback = this.callback;
305 + }
306 + }
307 +
308 + if (typeof timeoutMs === 'number' && timeoutMs > 0) {
309 + timeoutId = setTimeout(ontimeout, timeoutMs);
310 + }
311 +
312 + if ('port' in opts && typeof opts.port !== 'number') {
313 + opts.port = Number(opts.port);
314 + }
315 +
316 + try {
317 + debug(
318 + 'Resolving socket for %o request: %o',
319 + opts.protocol,
320 + `${req.method} ${req.path}`
321 + );
322 + Promise.resolve(this.promisifiedCallback(req, opts)).then(
323 + onsocket,
324 + callbackError
325 + );
326 + } catch (err) {
327 + Promise.reject(err).catch(callbackError);
328 + }
329 + }
330 +
331 + freeSocket(socket: net.Socket, opts: AgentOptions) {
332 + debug('Freeing socket %o %o', socket.constructor.name, opts);
333 + socket.destroy();
334 + }
335 +
336 + destroy() {
337 + debug('Destroying agent %o', this.constructor.name);
338 + }
339 + }
340 +
341 + // So that `instanceof` works correctly
342 + createAgent.prototype = createAgent.Agent.prototype;
343 +}
344 +
345 +export = createAgent;
1 +import {
2 + Agent,
3 + ClientRequest,
4 + RequestOptions,
5 + AgentCallbackCallback,
6 + AgentCallbackPromise,
7 + AgentCallbackReturn
8 +} from './index';
9 +
10 +type LegacyCallback = (
11 + req: ClientRequest,
12 + opts: RequestOptions,
13 + fn: AgentCallbackCallback
14 +) => void;
15 +
16 +export default function promisify(fn: LegacyCallback): AgentCallbackPromise {
17 + return function(this: Agent, req: ClientRequest, opts: RequestOptions) {
18 + return new Promise((resolve, reject) => {
19 + fn.call(
20 + this,
21 + req,
22 + opts,
23 + (err: Error | null | undefined, rtn?: AgentCallbackReturn) => {
24 + if (err) {
25 + reject(err);
26 + } else {
27 + resolve(rtn);
28 + }
29 + }
30 + );
31 + });
32 + };
33 +}
...@@ -46,9 +46,9 @@ div { ...@@ -46,9 +46,9 @@ div {
46 46
47 This pattern is often used to give browsers that don’t understand linear gradients a fallback solution (e.g. gray color in the example). 47 This pattern is often used to give browsers that don’t understand linear gradients a fallback solution (e.g. gray color in the example).
48 In CSSOM, `background: gray` [gets overwritten](http://nv.github.io/CSSOM/docs/parse.html#css=div%20%7B%0A%20%20%20%20%20%20background%3A%20gray%3B%0A%20%20%20%20background%3A%20linear-gradient(to%20bottom%2C%20white%200%25%2C%20black%20100%25)%3B%0A%7D). 48 In CSSOM, `background: gray` [gets overwritten](http://nv.github.io/CSSOM/docs/parse.html#css=div%20%7B%0A%20%20%20%20%20%20background%3A%20gray%3B%0A%20%20%20%20background%3A%20linear-gradient(to%20bottom%2C%20white%200%25%2C%20black%20100%25)%3B%0A%7D).
49 -It doesn't get preserved. 49 +It does **NOT** get preserved.
50 50
51 -If you do CSS mungling, minification, image inlining, and such, CSSOM.js is no good for you, considere using one of the following: 51 +If you do CSS mungling, minification, or image inlining, considere using one of the following:
52 52
53 * [postcss](https://github.com/postcss/postcss) 53 * [postcss](https://github.com/postcss/postcss)
54 * [reworkcss/css](https://github.com/reworkcss/css) 54 * [reworkcss/css](https://github.com/reworkcss/css)
......
1 +//.CommonJS
2 +var CSSOM = {
3 + CSSRule: require("./CSSRule").CSSRule,
4 + CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule
5 +};
6 +///CommonJS
7 +
8 +
9 +/**
10 + * @constructor
11 + * @see https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface
12 + */
13 +CSSOM.CSSConditionRule = function CSSConditionRule() {
14 + CSSOM.CSSGroupingRule.call(this);
15 + this.cssRules = [];
16 +};
17 +
18 +CSSOM.CSSConditionRule.prototype = new CSSOM.CSSGroupingRule();
19 +CSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;
20 +CSSOM.CSSConditionRule.prototype.conditionText = ''
21 +CSSOM.CSSConditionRule.prototype.cssText = ''
22 +
23 +//.CommonJS
24 +exports.CSSConditionRule = CSSOM.CSSConditionRule;
25 +///CommonJS
1 +//.CommonJS
2 +var CSSOM = {
3 + CSSRule: require("./CSSRule").CSSRule
4 +};
5 +///CommonJS
6 +
7 +
8 +/**
9 + * @constructor
10 + * @see https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
11 + */
12 +CSSOM.CSSGroupingRule = function CSSGroupingRule() {
13 + CSSOM.CSSRule.call(this);
14 + this.cssRules = [];
15 +};
16 +
17 +CSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();
18 +CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
19 +
20 +
21 +/**
22 + * Used to insert a new CSS rule to a list of CSS rules.
23 + *
24 + * @example
25 + * cssGroupingRule.cssText
26 + * -> "body{margin:0;}"
27 + * cssGroupingRule.insertRule("img{border:none;}", 1)
28 + * -> 1
29 + * cssGroupingRule.cssText
30 + * -> "body{margin:0;}img{border:none;}"
31 + *
32 + * @param {string} rule
33 + * @param {number} [index]
34 + * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-insertrule
35 + * @return {number} The index within the grouping rule's collection of the newly inserted rule.
36 + */
37 + CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {
38 + if (index < 0 || index > this.cssRules.length) {
39 + throw new RangeError("INDEX_SIZE_ERR");
40 + }
41 + var cssRule = CSSOM.parse(rule).cssRules[0];
42 + cssRule.parentRule = this;
43 + this.cssRules.splice(index, 0, cssRule);
44 + return index;
45 +};
46 +
47 +/**
48 + * Used to delete a rule from the grouping rule.
49 + *
50 + * cssGroupingRule.cssText
51 + * -> "img{border:none;}body{margin:0;}"
52 + * cssGroupingRule.deleteRule(0)
53 + * cssGroupingRule.cssText
54 + * -> "body{margin:0;}"
55 + *
56 + * @param {number} index within the grouping rule's rule list of the rule to remove.
57 + * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-deleterule
58 + */
59 + CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {
60 + if (index < 0 || index >= this.cssRules.length) {
61 + throw new RangeError("INDEX_SIZE_ERR");
62 + }
63 + this.cssRules.splice(index, 1)[0].parentRule = null;
64 +};
65 +
66 +//.CommonJS
67 +exports.CSSGroupingRule = CSSOM.CSSGroupingRule;
68 +///CommonJS
...@@ -19,7 +19,7 @@ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() { ...@@ -19,7 +19,7 @@ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
19 19
20 CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule(); 20 CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
21 CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule; 21 CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
22 -CSSOM.CSSKeyframeRule.prototype.type = 9; 22 +CSSOM.CSSKeyframeRule.prototype.type = 8;
23 //FIXME 23 //FIXME
24 //CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; 24 //CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
25 //CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; 25 //CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
......
...@@ -17,7 +17,7 @@ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() { ...@@ -17,7 +17,7 @@ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
17 17
18 CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule(); 18 CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
19 CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule; 19 CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
20 -CSSOM.CSSKeyframesRule.prototype.type = 8; 20 +CSSOM.CSSKeyframesRule.prototype.type = 7;
21 //FIXME 21 //FIXME
22 //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; 22 //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
23 //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; 23 //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
......
1 //.CommonJS 1 //.CommonJS
2 var CSSOM = { 2 var CSSOM = {
3 CSSRule: require("./CSSRule").CSSRule, 3 CSSRule: require("./CSSRule").CSSRule,
4 + CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
5 + CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
4 MediaList: require("./MediaList").MediaList 6 MediaList: require("./MediaList").MediaList
5 }; 7 };
6 ///CommonJS 8 ///CommonJS
...@@ -12,26 +14,36 @@ var CSSOM = { ...@@ -12,26 +14,36 @@ var CSSOM = {
12 * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule 14 * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule
13 */ 15 */
14 CSSOM.CSSMediaRule = function CSSMediaRule() { 16 CSSOM.CSSMediaRule = function CSSMediaRule() {
15 - CSSOM.CSSRule.call(this); 17 + CSSOM.CSSConditionRule.call(this);
16 this.media = new CSSOM.MediaList(); 18 this.media = new CSSOM.MediaList();
17 - this.cssRules = [];
18 }; 19 };
19 20
20 -CSSOM.CSSMediaRule.prototype = new CSSOM.CSSRule(); 21 +CSSOM.CSSMediaRule.prototype = new CSSOM.CSSConditionRule();
21 CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule; 22 CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
22 CSSOM.CSSMediaRule.prototype.type = 4; 23 CSSOM.CSSMediaRule.prototype.type = 4;
23 -//FIXME
24 -//CSSOM.CSSMediaRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
25 -//CSSOM.CSSMediaRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
26 24
27 -// http://opensource.apple.com/source/WebCore/WebCore-658.28/css/CSSMediaRule.cpp 25 +// https://opensource.apple.com/source/WebCore/WebCore-7611.1.21.161.3/css/CSSMediaRule.cpp
28 -Object.defineProperty(CSSOM.CSSMediaRule.prototype, "cssText", { 26 +Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
29 - get: function() { 27 + "conditionText": {
30 - var cssTexts = []; 28 + get: function() {
31 - for (var i=0, length=this.cssRules.length; i < length; i++) { 29 + return this.media.mediaText;
32 - cssTexts.push(this.cssRules[i].cssText); 30 + },
33 - } 31 + set: function(value) {
34 - return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}"; 32 + this.media.mediaText = value;
33 + },
34 + configurable: true,
35 + enumerable: true
36 + },
37 + "cssText": {
38 + get: function() {
39 + var cssTexts = [];
40 + for (var i=0, length=this.cssRules.length; i < length; i++) {
41 + cssTexts.push(this.cssRules[i].cssText);
42 + }
43 + return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
44 + },
45 + configurable: true,
46 + enumerable: true
35 } 47 }
36 }); 48 });
37 49
......
1 //.CommonJS 1 //.CommonJS
2 var CSSOM = { 2 var CSSOM = {
3 CSSRule: require("./CSSRule").CSSRule, 3 CSSRule: require("./CSSRule").CSSRule,
4 + CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
5 + CSSConditionRule: require("./CSSConditionRule").CSSConditionRule
4 }; 6 };
5 ///CommonJS 7 ///CommonJS
6 8
...@@ -10,12 +12,10 @@ var CSSOM = { ...@@ -10,12 +12,10 @@ var CSSOM = {
10 * @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface 12 * @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
11 */ 13 */
12 CSSOM.CSSSupportsRule = function CSSSupportsRule() { 14 CSSOM.CSSSupportsRule = function CSSSupportsRule() {
13 - CSSOM.CSSRule.call(this); 15 + CSSOM.CSSConditionRule.call(this);
14 - this.conditionText = '';
15 - this.cssRules = [];
16 }; 16 };
17 17
18 -CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSRule(); 18 +CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSConditionRule();
19 CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule; 19 CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
20 CSSOM.CSSSupportsRule.prototype.type = 12; 20 CSSOM.CSSSupportsRule.prototype.type = 12;
21 21
......
1 //.CommonJS 1 //.CommonJS
2 var CSSOM = { 2 var CSSOM = {
3 CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet, 3 CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
4 + CSSRule: require("./CSSRule").CSSRule,
4 CSSStyleRule: require("./CSSStyleRule").CSSStyleRule, 5 CSSStyleRule: require("./CSSStyleRule").CSSStyleRule,
6 + CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
7 + CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
5 CSSMediaRule: require("./CSSMediaRule").CSSMediaRule, 8 CSSMediaRule: require("./CSSMediaRule").CSSMediaRule,
6 CSSSupportsRule: require("./CSSSupportsRule").CSSSupportsRule, 9 CSSSupportsRule: require("./CSSSupportsRule").CSSSupportsRule,
7 CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration, 10 CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
...@@ -26,25 +29,14 @@ CSSOM.clone = function clone(stylesheet) { ...@@ -26,25 +29,14 @@ CSSOM.clone = function clone(stylesheet) {
26 return cloned; 29 return cloned;
27 } 30 }
28 31
29 - var RULE_TYPES = { 32 + for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) {
30 - 1: CSSOM.CSSStyleRule,
31 - 4: CSSOM.CSSMediaRule,
32 - //3: CSSOM.CSSImportRule,
33 - //5: CSSOM.CSSFontFaceRule,
34 - //6: CSSOM.CSSPageRule,
35 - 8: CSSOM.CSSKeyframesRule,
36 - 9: CSSOM.CSSKeyframeRule,
37 - 12: CSSOM.CSSSupportsRule
38 - };
39 -
40 - for (var i=0, rulesLength=rules.length; i < rulesLength; i++) {
41 var rule = rules[i]; 33 var rule = rules[i];
42 - var ruleClone = cloned.cssRules[i] = new RULE_TYPES[rule.type](); 34 + var ruleClone = cloned.cssRules[i] = new rule.constructor();
43 35
44 var style = rule.style; 36 var style = rule.style;
45 if (style) { 37 if (style) {
46 var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration(); 38 var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration();
47 - for (var j=0, styleLength=style.length; j < styleLength; j++) { 39 + for (var j = 0, styleLength = style.length; j < styleLength; j++) {
48 var name = styleClone[j] = style[j]; 40 var name = styleClone[j] = style[j];
49 styleClone[name] = style[name]; 41 styleClone[name] = style[name];
50 styleClone._importants[name] = style.getPropertyPriority(name); 42 styleClone._importants[name] = style.getPropertyPriority(name);
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
2 2
3 exports.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration; 3 exports.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;
4 exports.CSSRule = require('./CSSRule').CSSRule; 4 exports.CSSRule = require('./CSSRule').CSSRule;
5 +exports.CSSGroupingRule = require('./CSSGroupingRule').CSSGroupingRule;
6 +exports.CSSConditionRule = require('./CSSConditionRule').CSSConditionRule;
5 exports.CSSStyleRule = require('./CSSStyleRule').CSSStyleRule; 7 exports.CSSStyleRule = require('./CSSStyleRule').CSSStyleRule;
6 exports.MediaList = require('./MediaList').MediaList; 8 exports.MediaList = require('./MediaList').MediaList;
7 exports.CSSMediaRule = require('./CSSMediaRule').CSSMediaRule; 9 exports.CSSMediaRule = require('./CSSMediaRule').CSSMediaRule;
......
...@@ -240,7 +240,6 @@ CSSOM.parse = function parse(token) { ...@@ -240,7 +240,6 @@ CSSOM.parse = function parse(token) {
240 state = "before-selector"; 240 state = "before-selector";
241 } else if (state === "fontFaceRule-begin") { 241 } else if (state === "fontFaceRule-begin") {
242 if (parentRule) { 242 if (parentRule) {
243 - ancestorRules.push(parentRule);
244 fontFaceRule.parentRule = parentRule; 243 fontFaceRule.parentRule = parentRule;
245 } 244 }
246 fontFaceRule.parentStyleSheet = styleSheet; 245 fontFaceRule.parentStyleSheet = styleSheet;
...@@ -452,7 +451,9 @@ exports.parse = CSSOM.parse; ...@@ -452,7 +451,9 @@ exports.parse = CSSOM.parse;
452 CSSOM.CSSStyleSheet = require("./CSSStyleSheet").CSSStyleSheet; 451 CSSOM.CSSStyleSheet = require("./CSSStyleSheet").CSSStyleSheet;
453 CSSOM.CSSStyleRule = require("./CSSStyleRule").CSSStyleRule; 452 CSSOM.CSSStyleRule = require("./CSSStyleRule").CSSStyleRule;
454 CSSOM.CSSImportRule = require("./CSSImportRule").CSSImportRule; 453 CSSOM.CSSImportRule = require("./CSSImportRule").CSSImportRule;
454 +CSSOM.CSSGroupingRule = require("./CSSGroupingRule").CSSGroupingRule;
455 CSSOM.CSSMediaRule = require("./CSSMediaRule").CSSMediaRule; 455 CSSOM.CSSMediaRule = require("./CSSMediaRule").CSSMediaRule;
456 +CSSOM.CSSConditionRule = require("./CSSConditionRule").CSSConditionRule;
456 CSSOM.CSSSupportsRule = require("./CSSSupportsRule").CSSSupportsRule; 457 CSSOM.CSSSupportsRule = require("./CSSSupportsRule").CSSSupportsRule;
457 CSSOM.CSSFontFaceRule = require("./CSSFontFaceRule").CSSFontFaceRule; 458 CSSOM.CSSFontFaceRule = require("./CSSFontFaceRule").CSSFontFaceRule;
458 CSSOM.CSSHostRule = require("./CSSHostRule").CSSHostRule; 459 CSSOM.CSSHostRule = require("./CSSHostRule").CSSHostRule;
......
1 { 1 {
2 - "_from": "cssom@>= 0.3.2 < 0.4.0", 2 + "_from": "cssom@^0.5.0",
3 - "_id": "cssom@0.3.8", 3 + "_id": "cssom@0.5.0",
4 "_inBundle": false, 4 "_inBundle": false,
5 - "_integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", 5 + "_integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==",
6 "_location": "/cssom", 6 "_location": "/cssom",
7 "_phantomChildren": {}, 7 "_phantomChildren": {},
8 "_requested": { 8 "_requested": {
9 "type": "range", 9 "type": "range",
10 "registry": true, 10 "registry": true,
11 - "raw": "cssom@>= 0.3.2 < 0.4.0", 11 + "raw": "cssom@^0.5.0",
12 "name": "cssom", 12 "name": "cssom",
13 "escapedName": "cssom", 13 "escapedName": "cssom",
14 - "rawSpec": ">= 0.3.2 < 0.4.0", 14 + "rawSpec": "^0.5.0",
15 "saveSpec": null, 15 "saveSpec": null,
16 - "fetchSpec": ">= 0.3.2 < 0.4.0" 16 + "fetchSpec": "^0.5.0"
17 }, 17 },
18 "_requiredBy": [ 18 "_requiredBy": [
19 - "/cssstyle",
20 "/jsdom" 19 "/jsdom"
21 ], 20 ],
22 - "_resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", 21 + "_resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz",
23 - "_shasum": "9f1276f5b2b463f2114d3f2c75250af8c1a36f4a", 22 + "_shasum": "d254fa92cd8b6fbd83811b9fbaed34663cc17c36",
24 - "_spec": "cssom@>= 0.3.2 < 0.4.0", 23 + "_spec": "cssom@^0.5.0",
25 - "_where": "C:\\Users\\KoMoGoon\\Desktop\\oss_project\\Singer-Composer\\node_modules\\jsdom", 24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\jsdom",
26 "author": { 25 "author": {
27 "name": "Nikita Vasilyev", 26 "name": "Nikita Vasilyev",
28 "email": "me@elv1s.ru" 27 "email": "me@elv1s.ru"
...@@ -50,5 +49,5 @@ ...@@ -50,5 +49,5 @@
50 "type": "git", 49 "type": "git",
51 "url": "git+https://github.com/NV/CSSOM.git" 50 "url": "git+https://github.com/NV/CSSOM.git"
52 }, 51 },
53 - "version": "0.3.8" 52 + "version": "0.5.0"
54 } 53 }
......
1 # CSSStyleDeclaration 1 # CSSStyleDeclaration
2 2
3 -[![NpmVersion](https://img.shields.io/npm/v/cssstyle.svg)](https://www.npmjs.com/package/cssstyle) [![Build Status](https://travis-ci.org/jsakas/CSSStyleDeclaration.svg?branch=master)](https://travis-ci.org/jsakas/CSSStyleDeclaration) 3 +A Node JS implementation of the CSS Object Model [CSSStyleDeclaration interface](https://www.w3.org/TR/cssom-1/#the-cssstyledeclaration-interface).
4 4
5 -CSSStyleDeclaration is a work-a-like to the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM). I made it so that when using [jQuery in node](https://github.com/tmtk75/node-jquery) setting css attributes via $.fn.css() would work. node-jquery uses [jsdom](https://github.com/tmpvar/jsdom) to create a DOM to use in node. jsdom uses CSSOM for styling, and CSSOM's implementation of the [CSSStyleDeclaration](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration) doesn't support [CSS2Properties](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties), which is how jQuery's [$.fn.css()](http://api.jquery.com/css/) operates. 5 +[![NpmVersion](https://img.shields.io/npm/v/cssstyle.svg)](https://www.npmjs.com/package/cssstyle) [![Build Status](https://travis-ci.org/jsdom/cssstyle.svg?branch=master)](https://travis-ci.org/jsdom/cssstyle) [![codecov](https://codecov.io/gh/jsdom/cssstyle/branch/master/graph/badge.svg)](https://codecov.io/gh/jsdom/cssstyle)
6 6
7 -### Why not just issue a pull request? 7 +---
8 8
9 -Well, NV wants to keep CSSOM fast (which I can appreciate) and CSS2Properties aren't required by the standard (though every browser has the interface). So I figured the path of least resistance would be to just modify this one class, publish it as a node module (that requires CSSOM) and then make a pull request of jsdom to use it. 9 +#### Background
10 10
11 -### How do I test this code? 11 +This package is an extension of the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM) with added support for CSS 2 & 3 properties. The primary use case is for testing browser code in a Node environment.
12 12
13 -`npm test` should do the trick, assuming you have the dev dependencies installed: 13 +It was originally created by Chad Walker, it is now maintaind by Jon Sakas and other open source contributors.
14 14
15 -``` 15 +Bug reports and pull requests are welcome.
16 -$ npm test
17 -
18 -tests
19 -✔ Verify Has Properties
20 -✔ Verify Has Functions
21 -✔ Verify Has Special Properties
22 -✔ Test From Style String
23 -✔ Test From Properties
24 -✔ Test Shorthand Properties
25 -✔ Test width and height Properties and null and empty strings
26 -✔ Test Implicit Properties
27 -```
......
...@@ -56,6 +56,11 @@ CSSStyleDeclaration.prototype = { ...@@ -56,6 +56,11 @@ CSSStyleDeclaration.prototype = {
56 this.removeProperty(name); 56 this.removeProperty(name);
57 return; 57 return;
58 } 58 }
59 + var isCustomProperty = name.indexOf('--') === 0;
60 + if (isCustomProperty) {
61 + this._setProperty(name, value, priority);
62 + return;
63 + }
59 var lowercaseName = name.toLowerCase(); 64 var lowercaseName = name.toLowerCase();
60 if (!allProperties.has(lowercaseName) && !allExtraProperties.has(lowercaseName)) { 65 if (!allProperties.has(lowercaseName) && !allExtraProperties.has(lowercaseName)) {
61 return; 66 return;
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +/**
4 + * This file contains all implemented properties that are not a part of any
5 + * current specifications or drafts, but are handled by browsers nevertheless.
6 + */
7 +
8 +module.exports = [
9 + 'animation',
10 + 'animation-delay',
11 + 'animation-direction',
12 + 'animation-duration',
13 + 'animation-fill-mode',
14 + 'animation-iteration-count',
15 + 'animation-name',
16 + 'animation-play-state',
17 + 'animation-timing-function',
18 + 'appearance',
19 + 'aspect-ratio',
20 + 'backface-visibility',
21 + 'background-clip',
22 + 'background-composite',
23 + 'background-origin',
24 + 'background-size',
25 + 'border-after',
26 + 'border-after-color',
27 + 'border-after-style',
28 + 'border-after-width',
29 + 'border-before',
30 + 'border-before-color',
31 + 'border-before-style',
32 + 'border-before-width',
33 + 'border-end',
34 + 'border-end-color',
35 + 'border-end-style',
36 + 'border-end-width',
37 + 'border-fit',
38 + 'border-horizontal-spacing',
39 + 'border-image',
40 + 'border-radius',
41 + 'border-start',
42 + 'border-start-color',
43 + 'border-start-style',
44 + 'border-start-width',
45 + 'border-vertical-spacing',
46 + 'box-align',
47 + 'box-direction',
48 + 'box-flex',
49 + 'box-flex-group',
50 + 'box-lines',
51 + 'box-ordinal-group',
52 + 'box-orient',
53 + 'box-pack',
54 + 'box-reflect',
55 + 'box-shadow',
56 + 'color-correction',
57 + 'column-axis',
58 + 'column-break-after',
59 + 'column-break-before',
60 + 'column-break-inside',
61 + 'column-count',
62 + 'column-gap',
63 + 'column-rule',
64 + 'column-rule-color',
65 + 'column-rule-style',
66 + 'column-rule-width',
67 + 'columns',
68 + 'column-span',
69 + 'column-width',
70 + 'filter',
71 + 'flex-align',
72 + 'flex-direction',
73 + 'flex-flow',
74 + 'flex-item-align',
75 + 'flex-line-pack',
76 + 'flex-order',
77 + 'flex-pack',
78 + 'flex-wrap',
79 + 'flow-from',
80 + 'flow-into',
81 + 'font-feature-settings',
82 + 'font-kerning',
83 + 'font-size-delta',
84 + 'font-smoothing',
85 + 'font-variant-ligatures',
86 + 'highlight',
87 + 'hyphenate-character',
88 + 'hyphenate-limit-after',
89 + 'hyphenate-limit-before',
90 + 'hyphenate-limit-lines',
91 + 'hyphens',
92 + 'line-align',
93 + 'line-box-contain',
94 + 'line-break',
95 + 'line-clamp',
96 + 'line-grid',
97 + 'line-snap',
98 + 'locale',
99 + 'logical-height',
100 + 'logical-width',
101 + 'margin-after',
102 + 'margin-after-collapse',
103 + 'margin-before',
104 + 'margin-before-collapse',
105 + 'margin-bottom-collapse',
106 + 'margin-collapse',
107 + 'margin-end',
108 + 'margin-start',
109 + 'margin-top-collapse',
110 + 'marquee',
111 + 'marquee-direction',
112 + 'marquee-increment',
113 + 'marquee-repetition',
114 + 'marquee-speed',
115 + 'marquee-style',
116 + 'mask',
117 + 'mask-attachment',
118 + 'mask-box-image',
119 + 'mask-box-image-outset',
120 + 'mask-box-image-repeat',
121 + 'mask-box-image-slice',
122 + 'mask-box-image-source',
123 + 'mask-box-image-width',
124 + 'mask-clip',
125 + 'mask-composite',
126 + 'mask-image',
127 + 'mask-origin',
128 + 'mask-position',
129 + 'mask-position-x',
130 + 'mask-position-y',
131 + 'mask-repeat',
132 + 'mask-repeat-x',
133 + 'mask-repeat-y',
134 + 'mask-size',
135 + 'match-nearest-mail-blockquote-color',
136 + 'max-logical-height',
137 + 'max-logical-width',
138 + 'min-logical-height',
139 + 'min-logical-width',
140 + 'nbsp-mode',
141 + 'overflow-scrolling',
142 + 'padding-after',
143 + 'padding-before',
144 + 'padding-end',
145 + 'padding-start',
146 + 'perspective',
147 + 'perspective-origin',
148 + 'perspective-origin-x',
149 + 'perspective-origin-y',
150 + 'print-color-adjust',
151 + 'region-break-after',
152 + 'region-break-before',
153 + 'region-break-inside',
154 + 'region-overflow',
155 + 'rtl-ordering',
156 + 'svg-shadow',
157 + 'tap-highlight-color',
158 + 'text-combine',
159 + 'text-decorations-in-effect',
160 + 'text-emphasis',
161 + 'text-emphasis-color',
162 + 'text-emphasis-position',
163 + 'text-emphasis-style',
164 + 'text-fill-color',
165 + 'text-orientation',
166 + 'text-security',
167 + 'text-size-adjust',
168 + 'text-stroke',
169 + 'text-stroke-color',
170 + 'text-stroke-width',
171 + 'transform',
172 + 'transform-origin',
173 + 'transform-origin-x',
174 + 'transform-origin-y',
175 + 'transform-origin-z',
176 + 'transform-style',
177 + 'transition',
178 + 'transition-delay',
179 + 'transition-duration',
180 + 'transition-property',
181 + 'transition-timing-function',
182 + 'user-drag',
183 + 'user-modify',
184 + 'user-select',
185 + 'wrap',
186 + 'wrap-flow',
187 + 'wrap-margin',
188 + 'wrap-padding',
189 + 'wrap-shape-inside',
190 + 'wrap-shape-outside',
191 + 'wrap-through',
192 + 'writing-mode',
193 + 'zoom',
194 +].map(prop => 'webkit-' + prop);
1 'use strict'; 1 'use strict';
2 2
3 -// autogenerated - 7/15/2019 3 +// autogenerated - 4/29/2020
4 4
5 /* 5 /*
6 * 6 *
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
5 'use strict'; 5 'use strict';
6 6
7 const namedColors = require('./named_colors.json'); 7 const namedColors = require('./named_colors.json');
8 +const { hslToRgb } = require('./utils/colorSpace');
8 9
9 exports.TYPES = { 10 exports.TYPES = {
10 INTEGER: 1, 11 INTEGER: 1,
...@@ -17,18 +18,20 @@ exports.TYPES = { ...@@ -17,18 +18,20 @@ exports.TYPES = {
17 ANGLE: 8, 18 ANGLE: 8,
18 KEYWORD: 9, 19 KEYWORD: 9,
19 NULL_OR_EMPTY_STR: 10, 20 NULL_OR_EMPTY_STR: 10,
21 + CALC: 11,
20 }; 22 };
21 23
22 // rough regular expressions 24 // rough regular expressions
23 var integerRegEx = /^[-+]?[0-9]+$/; 25 var integerRegEx = /^[-+]?[0-9]+$/;
24 -var numberRegEx = /^[-+]?[0-9]*\.[0-9]+$/; 26 +var numberRegEx = /^[-+]?[0-9]*\.?[0-9]+$/;
25 -var lengthRegEx = /^(0|[-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw))$/; 27 +var lengthRegEx = /^(0|[-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw|ch))$/;
26 var percentRegEx = /^[-+]?[0-9]*\.?[0-9]+%$/; 28 var percentRegEx = /^[-+]?[0-9]*\.?[0-9]+%$/;
27 var urlRegEx = /^url\(\s*([^)]*)\s*\)$/; 29 var urlRegEx = /^url\(\s*([^)]*)\s*\)$/;
28 var stringRegEx = /^("[^"]*"|'[^']*')$/; 30 var stringRegEx = /^("[^"]*"|'[^']*')$/;
29 -var colorRegEx1 = /^#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])?$/; 31 +var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
30 var colorRegEx2 = /^rgb\(([^)]*)\)$/; 32 var colorRegEx2 = /^rgb\(([^)]*)\)$/;
31 var colorRegEx3 = /^rgba\(([^)]*)\)$/; 33 var colorRegEx3 = /^rgba\(([^)]*)\)$/;
34 +var calcRegEx = /^calc\(([^)]*)\)$/;
32 var colorRegEx4 = /^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/; 35 var colorRegEx4 = /^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/;
33 var angleRegEx = /^([-+]?[0-9]*\.?[0-9]+)(deg|grad|rad)$/; 36 var angleRegEx = /^([-+]?[0-9]*\.?[0-9]+)(deg|grad|rad)$/;
34 37
...@@ -60,6 +63,9 @@ exports.valueType = function valueType(val) { ...@@ -60,6 +63,9 @@ exports.valueType = function valueType(val) {
60 if (urlRegEx.test(val)) { 63 if (urlRegEx.test(val)) {
61 return exports.TYPES.URL; 64 return exports.TYPES.URL;
62 } 65 }
66 + if (calcRegEx.test(val)) {
67 + return exports.TYPES.CALC;
68 + }
63 if (stringRegEx.test(val)) { 69 if (stringRegEx.test(val)) {
64 return exports.TYPES.STRING; 70 return exports.TYPES.STRING;
65 } 71 }
...@@ -69,6 +75,7 @@ exports.valueType = function valueType(val) { ...@@ -69,6 +75,7 @@ exports.valueType = function valueType(val) {
69 if (colorRegEx1.test(val)) { 75 if (colorRegEx1.test(val)) {
70 return exports.TYPES.COLOR; 76 return exports.TYPES.COLOR;
71 } 77 }
78 +
72 var res = colorRegEx2.exec(val); 79 var res = colorRegEx2.exec(val);
73 var parts; 80 var parts;
74 if (res !== null) { 81 if (res !== null) {
...@@ -92,7 +99,7 @@ exports.valueType = function valueType(val) { ...@@ -92,7 +99,7 @@ exports.valueType = function valueType(val) {
92 } 99 }
93 if ( 100 if (
94 parts.slice(0, 3).every(percentRegEx.test.bind(percentRegEx)) || 101 parts.slice(0, 3).every(percentRegEx.test.bind(percentRegEx)) ||
95 - parts.every(integerRegEx.test.bind(integerRegEx)) 102 + parts.slice(0, 3).every(integerRegEx.test.bind(integerRegEx))
96 ) { 103 ) {
97 if (numberRegEx.test(parts[3])) { 104 if (numberRegEx.test(parts[3])) {
98 return exports.TYPES.COLOR; 105 return exports.TYPES.COLOR;
...@@ -200,6 +207,11 @@ exports.parsePercent = function parsePercent(val) { ...@@ -200,6 +207,11 @@ exports.parsePercent = function parsePercent(val) {
200 207
201 // either a length or a percent 208 // either a length or a percent
202 exports.parseMeasurement = function parseMeasurement(val) { 209 exports.parseMeasurement = function parseMeasurement(val) {
210 + var type = exports.valueType(val);
211 + if (type === exports.TYPES.CALC) {
212 + return val;
213 + }
214 +
203 var length = exports.parseLength(val); 215 var length = exports.parseLength(val);
204 if (length !== undefined) { 216 if (length !== undefined) {
205 return length; 217 return length;
...@@ -287,15 +299,26 @@ exports.parseColor = function parseColor(val) { ...@@ -287,15 +299,26 @@ exports.parseColor = function parseColor(val) {
287 alpha = 1; 299 alpha = 1;
288 var parts; 300 var parts;
289 var res = colorRegEx1.exec(val); 301 var res = colorRegEx1.exec(val);
290 - // is it #aaa or #ababab 302 + // is it #aaa, #ababab, #aaaa, #abababaa
291 if (res) { 303 if (res) {
304 + var defaultHex = val.substr(1);
292 var hex = val.substr(1); 305 var hex = val.substr(1);
293 - if (hex.length === 3) { 306 + if (hex.length === 3 || hex.length === 4) {
294 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 307 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
308 +
309 + if (defaultHex.length === 4) {
310 + hex = hex + defaultHex[3] + defaultHex[3];
311 + }
295 } 312 }
296 red = parseInt(hex.substr(0, 2), 16); 313 red = parseInt(hex.substr(0, 2), 16);
297 green = parseInt(hex.substr(2, 2), 16); 314 green = parseInt(hex.substr(2, 2), 16);
298 blue = parseInt(hex.substr(4, 2), 16); 315 blue = parseInt(hex.substr(4, 2), 16);
316 + if (hex.length === 8) {
317 + var hexAlpha = hex.substr(6, 2);
318 + var hexAlphaToRgbaAlpha = Number((parseInt(hexAlpha, 16) / 255).toFixed(3));
319 +
320 + return 'rgba(' + red + ', ' + green + ', ' + blue + ', ' + hexAlphaToRgbaAlpha + ')';
321 + }
299 return 'rgb(' + red + ', ' + green + ', ' + blue + ')'; 322 return 'rgb(' + red + ', ' + green + ', ' + blue + ')';
300 } 323 }
301 324
...@@ -367,10 +390,12 @@ exports.parseColor = function parseColor(val) { ...@@ -367,10 +390,12 @@ exports.parseColor = function parseColor(val) {
367 if (_alpha && numberRegEx.test(_alpha)) { 390 if (_alpha && numberRegEx.test(_alpha)) {
368 alpha = parseFloat(_alpha); 391 alpha = parseFloat(_alpha);
369 } 392 }
393 +
394 + const [r, g, b] = hslToRgb(hue, saturation / 100, lightness / 100);
370 if (!_alphaString || alpha === 1) { 395 if (!_alphaString || alpha === 1) {
371 - return 'hsl(' + hue + ', ' + saturation + '%, ' + lightness + '%)'; 396 + return 'rgb(' + r + ', ' + g + ', ' + b + ')';
372 } 397 }
373 - return 'hsla(' + hue + ', ' + saturation + '%, ' + lightness + '%, ' + alpha + ')'; 398 + return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')';
374 } 399 }
375 400
376 if (type === exports.TYPES.COLOR) { 401 if (type === exports.TYPES.COLOR) {
......
1 +'use strict';
2 +
3 +const parsers = require('./parsers');
4 +
5 +describe('valueType', () => {
6 + it('returns color for red', () => {
7 + let input = 'red';
8 + let output = parsers.valueType(input);
9 +
10 + expect(output).toEqual(parsers.TYPES.COLOR);
11 + });
12 +
13 + it('returns color for #nnnnnn', () => {
14 + let input = '#fefefe';
15 + let output = parsers.valueType(input);
16 +
17 + expect(output).toEqual(parsers.TYPES.COLOR);
18 + });
19 +
20 + it('returns color for rgb(n, n, n)', () => {
21 + let input = 'rgb(10, 10, 10)';
22 + let output = parsers.valueType(input);
23 +
24 + expect(output).toEqual(parsers.TYPES.COLOR);
25 + });
26 +
27 + it('returns color for rgb(p, p, p)', () => {
28 + let input = 'rgb(10%, 10%, 10%)';
29 + let output = parsers.valueType(input);
30 +
31 + expect(output).toEqual(parsers.TYPES.COLOR);
32 + });
33 +
34 + it('returns color for rgba(n, n, n, n)', () => {
35 + let input = 'rgba(10, 10, 10, 1)';
36 + let output = parsers.valueType(input);
37 +
38 + expect(output).toEqual(parsers.TYPES.COLOR);
39 + });
40 +
41 + it('returns color for rgba(n, n, n, n) with decimal alpha', () => {
42 + let input = 'rgba(10, 10, 10, 0.5)';
43 + let output = parsers.valueType(input);
44 +
45 + expect(output).toEqual(parsers.TYPES.COLOR);
46 + });
47 +
48 + it('returns color for rgba(p, p, p, n)', () => {
49 + let input = 'rgba(10%, 10%, 10%, 1)';
50 + let output = parsers.valueType(input);
51 +
52 + expect(output).toEqual(parsers.TYPES.COLOR);
53 + });
54 +
55 + it('returns color for rgba(p, p, p, n) with decimal alpha', () => {
56 + let input = 'rgba(10%, 10%, 10%, 0.5)';
57 + let output = parsers.valueType(input);
58 +
59 + expect(output).toEqual(parsers.TYPES.COLOR);
60 + });
61 +
62 + it('returns length for 100ch', () => {
63 + let input = '100ch';
64 + let output = parsers.valueType(input);
65 +
66 + expect(output).toEqual(parsers.TYPES.LENGTH);
67 + });
68 +
69 + it('returns calc from calc(100px * 2)', () => {
70 + let input = 'calc(100px * 2)';
71 + let output = parsers.valueType(input);
72 +
73 + expect(output).toEqual(parsers.TYPES.CALC);
74 + });
75 +});
76 +describe('parseInteger', () => {
77 + it.todo('test');
78 +});
79 +describe('parseNumber', () => {
80 + it.todo('test');
81 +});
82 +describe('parseLength', () => {
83 + it.todo('test');
84 +});
85 +describe('parsePercent', () => {
86 + it.todo('test');
87 +});
88 +describe('parseMeasurement', () => {
89 + it.todo('test');
90 +});
91 +describe('parseUrl', () => {
92 + it.todo('test');
93 +});
94 +describe('parseString', () => {
95 + it.todo('test');
96 +});
97 +describe('parseColor', () => {
98 + it('should convert hsl to rgb values', () => {
99 + let input = 'hsla(0, 1%, 2%)';
100 + let output = parsers.parseColor(input);
101 +
102 + expect(output).toEqual('rgb(5, 5, 5)');
103 + });
104 + it('should convert hsla to rgba values', () => {
105 + let input = 'hsla(0, 1%, 2%, 0.5)';
106 + let output = parsers.parseColor(input);
107 +
108 + expect(output).toEqual('rgba(5, 5, 5, 0.5)');
109 + });
110 +
111 + it.todo('Add more tests');
112 +});
113 +describe('parseAngle', () => {
114 + it.todo('test');
115 +});
116 +describe('parseKeyword', () => {
117 + it.todo('test');
118 +});
119 +describe('dashedToCamelCase', () => {
120 + it.todo('test');
121 +});
122 +describe('shorthandParser', () => {
123 + it.todo('test');
124 +});
125 +describe('shorthandSetter', () => {
126 + it.todo('test');
127 +});
128 +describe('shorthandGetter', () => {
129 + it.todo('test');
130 +});
131 +describe('implicitSetter', () => {
132 + it.todo('test');
133 +});
134 +describe('subImplicitSetter', () => {
135 + it.todo('test');
136 +});
137 +describe('camelToDashed', () => {
138 + it.todo('test');
139 +});
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 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 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 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 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 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 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 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.