j1_template_mde 2018.4.15 → 2018.4.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/content_generator_blog_archive.html +3 -3
- data/_includes/themes/j1/layouts/layout_shim_generator.html +4 -0
- data/_includes/themes/j1/modules/navigator/generator.html +4 -4
- data/_includes/themes/j1/modules/navigator/procedures/sidebar.proc +174 -127
- data/lib/j1/version.rb +1 -1
- data/lib/j1_app.rb +4 -1
- data/lib/j1_app/j1_auth_manager/auth_manager.previous.rb +939 -0
- data/lib/j1_app/j1_auth_manager/auth_manager.rb +386 -214
- data/lib/j1_app/j1_auth_manager/config.rb +103 -66
- data/lib/j1_app/j1_auth_manager/helpers.rb +22 -14
- data/lib/j1_app/j1_auth_manager/views/auth_manager_ui.erb +7 -2
- data/lib/j1_app/omniauth/strategies/_unused/doumart_patreon.rb +75 -0
- data/lib/j1_app/omniauth/strategies/_unused/my_patreon.rb +78 -0
- data/lib/j1_app/omniauth/strategies/_unused/patreon.v1.rb +50 -0
- data/lib/j1_app/omniauth/strategies/_unused/patreon.v2-v1.rb +82 -0
- data/lib/j1_app/omniauth/strategies/_unused/patreon.v2.rb +79 -0
- data/lib/starter_web/Gemfile +185 -168
- data/lib/starter_web/_config.yml +85 -69
- data/lib/starter_web/_data/j1_resources.yml +15 -0
- data/lib/starter_web/_data/modules/j1_navigator.yml +79 -12
- data/lib/starter_web/_rack/Guardfile +75 -0
- data/lib/starter_web/assets/data/authclient.html +10 -7
- data/lib/starter_web/assets/data/banner.html +127 -127
- data/lib/starter_web/assets/images/patreon/premium-content-460x200.png +0 -0
- data/lib/starter_web/assets/images/patreon/scalable/{Premium-content.psd → premium-content.psd} +0 -0
- data/lib/starter_web/assets/images/patreon/scalable/value-content.psd +0 -0
- data/lib/starter_web/assets/images/patreon/value-content-460x200.png +0 -0
- data/lib/starter_web/assets/themes/j1/core/css/theme_extensions.css +2 -2
- data/lib/starter_web/assets/themes/j1/core/css/theme_extensions.min.css +1 -1
- data/lib/starter_web/assets/themes/j1/core/css/uno.css +2 -2
- data/lib/starter_web/assets/themes/j1/core/css/uno.min.css +1 -1
- data/lib/starter_web/assets/themes/j1/core/js/adapter/navigator.js +66 -11
- data/lib/starter_web/assets/themes/j1/core/js/adapter/navigator.js.failed +797 -0
- data/lib/starter_web/assets/themes/j1/core/js/adapter/template.js +26 -7
- data/lib/starter_web/assets/themes/j1/extensions/livereload/LICENSE +20 -0
- data/lib/starter_web/assets/themes/j1/extensions/livereload/README.md +249 -0
- data/lib/starter_web/assets/themes/j1/extensions/livereload/js/livereload.js +1951 -0
- data/lib/starter_web/assets/themes/j1/extensions/livereload/js/livereload.min.js +1 -0
- data/lib/starter_web/assets/themes/j1/extensions/patreon/patreon.widget.button.html +21 -0
- data/lib/starter_web/package.json +14 -5
- data/lib/starter_web/pages/public/about/become_a_patron.adoc +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive.html +0 -1
- metadata +19 -4
- data/lib/starter_web/assets/images/patreon/premium-content-420x200.png +0 -0
@@ -434,13 +434,6 @@ var j1 = function () {
|
|
434
434
|
return state;
|
435
435
|
},
|
436
436
|
|
437
|
-
// -------------------------------------------------------------------------
|
438
|
-
// returns true if the site is running as an app
|
439
|
-
// -------------------------------------------------------------------------
|
440
|
-
app: function () {
|
441
|
-
return app_detected;
|
442
|
-
},
|
443
|
-
|
444
437
|
// -------------------------------------------------------------------------
|
445
438
|
// Returns the content of a given cookie (name) if exists otherwise
|
446
439
|
// null is returned
|
@@ -471,6 +464,32 @@ var j1 = function () {
|
|
471
464
|
return decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
472
465
|
}, // end getCookie
|
473
466
|
|
467
|
+
// -------------------------------------------------------------------------
|
468
|
+
// Returns the current user state collected from /status endpoint
|
469
|
+
// if the web is detected as an app
|
470
|
+
// -------------------------------------------------------------------------
|
471
|
+
getUserState: function (params, cbData) {
|
472
|
+
var parameters = params == '' ? 'all' : params;
|
473
|
+
var url = '/status?fields=' + parameters;
|
474
|
+
|
475
|
+
if ( j1.existsCookie('j1.web.session') ) {
|
476
|
+
$.ajax({
|
477
|
+
url: url,
|
478
|
+
success: function(data) {
|
479
|
+
if (typeof data == 'string') {
|
480
|
+
JSON.parse(data)
|
481
|
+
}
|
482
|
+
if (typeof data == 'object') {
|
483
|
+
data
|
484
|
+
}
|
485
|
+
cbData(data);
|
486
|
+
}
|
487
|
+
});
|
488
|
+
} else {
|
489
|
+
return { authenticated : false }
|
490
|
+
}
|
491
|
+
}, // end getUserState
|
492
|
+
|
474
493
|
// -------------------------------------------------------------------------
|
475
494
|
// Returns the content of J1 user state cookie (j1.user.state) as
|
476
495
|
// an object if exists, otherwise null is returned
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2012 Andrey Tarantsov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,249 @@
|
|
1
|
+
LiveReload.js
|
2
|
+
=============
|
3
|
+
|
4
|
+
What is LiveReload?
|
5
|
+
-------------------
|
6
|
+
|
7
|
+
LiveReload is a tool for web developers and designers. See [livereload.com](http://livereload.com) for more info.
|
8
|
+
|
9
|
+
To use LiveReload, you need a client (this script) in your browser and a server running on your development machine.
|
10
|
+
|
11
|
+
This repository (livereload.js) implements the client side of the protocol. The client connects to a LiveReload server via web sockets and listens for incoming change notifications. When a CSS or an image file is modified, it is live-refreshed without reloading the page. When any other file is modified, the page is reloaded.
|
12
|
+
|
13
|
+
The server notifies the client whenever a change is made. Available servers are:
|
14
|
+
|
15
|
+
* [LiveReload app for Mac](http://livereload.com/)
|
16
|
+
* [rack-livereload](https://github.com/johnbintz/rack-livereload)
|
17
|
+
* [guard-livereload](https://github.com/guard/guard-livereload)
|
18
|
+
* [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch)
|
19
|
+
* [python-livereload](https://github.com/lepture/python-livereload)
|
20
|
+
* more available on Google :-)
|
21
|
+
* you can even write your own; refer to the [LiveReload protocol](http://livereload.com/api/protocol/)
|
22
|
+
|
23
|
+
If you are a web developer looking to _use_ LiveReload, you should refer to your LiveReload server/app/tool's documentation, rather that this repository. **You should use the copy of livereload.js script bundled with your server**, because it's guaranteed to be compatible, and may be customized for that server.
|
24
|
+
|
25
|
+
Most LiveReload server vendors will serve livereload.js on the LiveReload port. When your server is running, you can typically access the script at `http://0.0.0.0:35729/livereload.js`.
|
26
|
+
|
27
|
+
Please read on *only* if you are:
|
28
|
+
|
29
|
+
* using a server that doesn't document the usage of livereload.js
|
30
|
+
* interested in hacking on livereload.js or want to understand it better
|
31
|
+
* developing a LiveReload server
|
32
|
+
|
33
|
+
|
34
|
+
What is livereload.js?
|
35
|
+
----------------------
|
36
|
+
|
37
|
+
This repository contains a JavaScript file implementing the client side of the LiveReload protocol. It gets change notifications from a LiveReload server and applies them to the browser.
|
38
|
+
|
39
|
+
If you are **developing** a LiveReload server, see [dist/livereload.js](https://github.com/livereload/livereload-js/raw/master/dist/livereload.js) for the latest version built using the sources in this repository. We require LiveReload server vendors to distribute livereload.js as part of their apps or tools.
|
40
|
+
|
41
|
+
An old version of this script is also bundled with the LiveReload browser extensions, but it's not getting updated and only serves for compatibility with very old clients.
|
42
|
+
|
43
|
+
Features:
|
44
|
+
|
45
|
+
* Live CSS reloading
|
46
|
+
* Full page reloading
|
47
|
+
* Protocol, WebSocket communication
|
48
|
+
* CSS `@import` support
|
49
|
+
* Live image reloading (`<img src="..." />`, `background-image` and `border-image` properties, both inline and in stylesheets)
|
50
|
+
* Live, in-browser LESS.js reloading
|
51
|
+
|
52
|
+
Would love, but doesn't seem possible:
|
53
|
+
|
54
|
+
* live JS reloading
|
55
|
+
|
56
|
+
|
57
|
+
Installing using Bower
|
58
|
+
----------------------
|
59
|
+
|
60
|
+
This script is published on Bower. (But, to reiterate: the preferred method is to avoid installing it altogether, and instead use the one bundled with your LiveReload server/app/tool.)
|
61
|
+
|
62
|
+
Installation:
|
63
|
+
|
64
|
+
bower install livereload-js --save-dev
|
65
|
+
|
66
|
+
This gives you a component containing a single script file, `dist/livereload.js`.
|
67
|
+
|
68
|
+
|
69
|
+
Installing using npm and Browserify
|
70
|
+
-----------------------------------
|
71
|
+
|
72
|
+
Including livereload.js into your Browserify bundle probably makes no sense, because livereload.js isn't something you would ship to production.
|
73
|
+
|
74
|
+
But if you insist _and_ you know what you're doing, you can install LiveReload via npm:
|
75
|
+
|
76
|
+
npm install livereload-js --save
|
77
|
+
|
78
|
+
and then add this to your bundle:
|
79
|
+
|
80
|
+
window.LiveReloadOptions = { host: 'localhost' };
|
81
|
+
require('livereload-js');
|
82
|
+
|
83
|
+
Note that livereload-js package uses `window` and `document` globals, so won't run under Node.js environment.
|
84
|
+
|
85
|
+
The reason you need to specify `LiveReloadOptions` is that `livereload.js` won't be able to find its `<script>` tag and would normally bail out with an error message.
|
86
|
+
|
87
|
+
|
88
|
+
Using livereload.js
|
89
|
+
-------------------
|
90
|
+
|
91
|
+
This script is meant to be included into the web pages you want to monitor, like this:
|
92
|
+
|
93
|
+
<script src="http://localhost:35729/livereload.js"></script>
|
94
|
+
|
95
|
+
LiveReload 2 server listens on port `35729` and serves livereload.js over HTTP (besides speaking the web socket protocol on the same port).
|
96
|
+
|
97
|
+
A slightly smarter way is to use the host name of the current page, assuming that it is being served from the same computer. This approach enables LiveReload when viewing the web page from other devices on the network:
|
98
|
+
|
99
|
+
```html
|
100
|
+
<script>document.write('<script src="http://'
|
101
|
+
+ location.host.split(':')[0]
|
102
|
+
+ ':35729/livereload.js"></'
|
103
|
+
+ 'script>')</script>
|
104
|
+
```
|
105
|
+
|
106
|
+
|
107
|
+
However, since `location.host` is empty for `file:` URLs, we need to account for that:
|
108
|
+
|
109
|
+
```html
|
110
|
+
<script>document.write('<script src="http://'
|
111
|
+
+ (location.host || 'localhost').split(':')[0]
|
112
|
+
+ ':35729/livereload.js"></'
|
113
|
+
+ 'script>')</script>
|
114
|
+
```
|
115
|
+
|
116
|
+
|
117
|
+
LiveReload.js finds a `script` tag that includes `…/livereload.js` and uses it to determine the hostname/port to connect to. It also understands some options from the query string: `host`, `port`, `snipver`, `mindelay` and `maxdelay`.
|
118
|
+
|
119
|
+
`snipver` specifies a version of the snippet, so that we can warn when the snippet needs to be updated. The currently recommended `snipver` is version 1:
|
120
|
+
|
121
|
+
```html
|
122
|
+
<script>document.write('<script src="http://'
|
123
|
+
+ (location.host || 'localhost').split(':')[0]
|
124
|
+
+ ':35729/livereload.js?snipver=1"></'
|
125
|
+
+ 'script>')</script>
|
126
|
+
```
|
127
|
+
|
128
|
+
|
129
|
+
Additionally, you might want to specify `mindelay` and `maxdelay`, which is minimum and maximum reconnection delay in milliseconds (defaulting to `1000` and `60000`).
|
130
|
+
|
131
|
+
Alternatively, instead of loading livereload.js from the LiveReload server, you might want to include it from a different URL. In this case, add a `host` parameter to override the host name. For example:
|
132
|
+
|
133
|
+
```html
|
134
|
+
<script src="https://github.com/livereload/livereload-js/raw/master/dist/livereload.js?host=localhost"></script>
|
135
|
+
```
|
136
|
+
|
137
|
+
|
138
|
+
Options
|
139
|
+
-------
|
140
|
+
|
141
|
+
Options can either be specified as query parameters of the `<script src="..../livereload.js">` tag's source URL, or as a global `window.LiveReloadOptions` dictionary. If the dictionary is specified, `livereload.js` does not even try looking for its `<script>` tag.
|
142
|
+
|
143
|
+
The set of supported options is the same for both methods:
|
144
|
+
|
145
|
+
* `host`: the host that runs a LiveReload server; required if specifying `LiveReloadOptions`, otherwise will be autodetected as the origin of the `<script>` tag
|
146
|
+
* `port`: optional server port override
|
147
|
+
* `path`: optional path to livereload server (default: 'livereload')
|
148
|
+
* `mindelay`, `maxdelay`: range of reconnection delays (if `livereload.js` cannot connect to the server, it will attempt to reconnect with increasing delays); defaults to 1,000 ms minimum and 60,000 ms maximum
|
149
|
+
* `handshake_timeout`: timeout for a protocol handshake to be completed after a connection attempt; mostly only needed if you're running an interactive debugger on your web socket server
|
150
|
+
* `isChromeExtension`: reload chrome runtime instead of page when true (default: false)
|
151
|
+
* `reloadMissingCSS`: prevent reload of CSS when changed stylesheet isn't found in page (default: true)
|
152
|
+
|
153
|
+
|
154
|
+
Issues & Limitations
|
155
|
+
--------------------
|
156
|
+
|
157
|
+
**Live reloading of imported stylesheets has a 200ms lag.** Modifying a CSS `@import` rule to reference a not-yet-cached file causes WebKit to lose all document styles, so we have to apply a workaround that causes a lag.
|
158
|
+
|
159
|
+
Our workaround is to add a temporary `<link />` element for the imported stylesheet we're trying to reload, wait 200ms to make sure WebKit loads the new file, then remove `<link />` and recreate the `@import` rule. This prevents a flash of unstyled content. (We also wait 200 more milliseconds and recreate the `@import` rule again, in case those initial 200ms were not enough.)
|
160
|
+
|
161
|
+
**Live image reloading is limited to `<img src="..." />`, `background-image` and `border-image` styles.** Any other places where images can be mentioned?
|
162
|
+
|
163
|
+
**Live image reloading is limited to `jpg`, `jpeg`, `gif`, and `png` extensions.** Maybe need to add `svg` there? Anything else?
|
164
|
+
|
165
|
+
|
166
|
+
Communicating with livereload.js
|
167
|
+
--------------------------------
|
168
|
+
|
169
|
+
It is possible to communicate with a running LiveReload script using DOM events:
|
170
|
+
|
171
|
+
* fire `LiveReloadShutDown` event on `document` to make LiveReload disconnect and go away
|
172
|
+
* listen for `LiveReloadConnect` event on `document` to learn when the connection is established
|
173
|
+
* listen for `LiveReloadDisconnect` event on `document` to learn when the connection is interrupted (or fails to be established)
|
174
|
+
|
175
|
+
The `LiveReload` object is also exposed as `window.LiveReload`, with `LiveReload.disconnect()`, `LiveReload.connect()`, and `LiveReload.shutDown()` available. However, I'm not yet sure if I want to keep this API, so consider it non-contractual. (And please tell me if you have a use for it!)
|
176
|
+
|
177
|
+
|
178
|
+
Having trouble?
|
179
|
+
---------------
|
180
|
+
|
181
|
+
To enable debugging output to console, append `?LR-verbose` to your URL.
|
182
|
+
|
183
|
+
|
184
|
+
Hacking on LiveReload.js
|
185
|
+
------------------------
|
186
|
+
|
187
|
+
Requirements:
|
188
|
+
|
189
|
+
* Node.js with npm
|
190
|
+
|
191
|
+
To install additional prerequisites:
|
192
|
+
|
193
|
+
npm install
|
194
|
+
|
195
|
+
To build:
|
196
|
+
|
197
|
+
npm run build
|
198
|
+
|
199
|
+
To run tests:
|
200
|
+
|
201
|
+
npm test
|
202
|
+
|
203
|
+
Manual testing: open files in `test/html/*` in various browsers, make some changes and make sure they are applied.
|
204
|
+
|
205
|
+
Testing the Browserify usage scenario: `npm run test-manual`, then perform manual testing of `test/html/browserified/`.
|
206
|
+
|
207
|
+
|
208
|
+
Releasing a new version
|
209
|
+
-----------------------
|
210
|
+
|
211
|
+
1. Run `npm version` with the applicable identifier (`major`/`minor`/`patch`/...).
|
212
|
+
|
213
|
+
1. Do some manual testing.
|
214
|
+
|
215
|
+
1. Create a release on GitHub.
|
216
|
+
|
217
|
+
1. Run `npm publish`.
|
218
|
+
|
219
|
+
|
220
|
+
License
|
221
|
+
-------
|
222
|
+
|
223
|
+
livereload-js is available under the MIT license. See the LICENSE file for details.
|
224
|
+
|
225
|
+
|
226
|
+
Version history
|
227
|
+
---------------
|
228
|
+
|
229
|
+
2.2.1 (Jan 17, 2015)
|
230
|
+
|
231
|
+
* npm fix: actually include `/lib` in the package
|
232
|
+
|
233
|
+
2.2.0 (Jan 16, 2015)
|
234
|
+
|
235
|
+
* the first version stitched with Browserify; everything seems to work, but 2.1.0 is available just in case
|
236
|
+
* switched the build system to Grunt
|
237
|
+
|
238
|
+
2.1.0 (Jan 16, 2015)
|
239
|
+
|
240
|
+
* use case-insensitive matching for `rel` attribute in `<link rel="stylesheet">` tags, to accommodate legacy Rails versions
|
241
|
+
* avoid usage of `console` when it's not defined
|
242
|
+
* some README changes
|
243
|
+
|
244
|
+
2.0.8 (May 22, 2012)
|
245
|
+
|
246
|
+
* Fix live CSS refresh to work with prefixfree
|
247
|
+
* Correctly trigger removal of old `<link>` tags
|
248
|
+
|
249
|
+
(older history not recorded)
|
@@ -0,0 +1,1951 @@
|
|
1
|
+
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2
|
+
module.exports = function (it) {
|
3
|
+
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
4
|
+
return it;
|
5
|
+
};
|
6
|
+
|
7
|
+
},{}],2:[function(require,module,exports){
|
8
|
+
// 22.1.3.31 Array.prototype[@@unscopables]
|
9
|
+
var UNSCOPABLES = require('./_wks')('unscopables');
|
10
|
+
var ArrayProto = Array.prototype;
|
11
|
+
if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});
|
12
|
+
module.exports = function (key) {
|
13
|
+
ArrayProto[UNSCOPABLES][key] = true;
|
14
|
+
};
|
15
|
+
|
16
|
+
},{"./_hide":16,"./_wks":44}],3:[function(require,module,exports){
|
17
|
+
var isObject = require('./_is-object');
|
18
|
+
module.exports = function (it) {
|
19
|
+
if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
20
|
+
return it;
|
21
|
+
};
|
22
|
+
|
23
|
+
},{"./_is-object":20}],4:[function(require,module,exports){
|
24
|
+
// false -> Array#indexOf
|
25
|
+
// true -> Array#includes
|
26
|
+
var toIObject = require('./_to-iobject');
|
27
|
+
var toLength = require('./_to-length');
|
28
|
+
var toAbsoluteIndex = require('./_to-absolute-index');
|
29
|
+
module.exports = function (IS_INCLUDES) {
|
30
|
+
return function ($this, el, fromIndex) {
|
31
|
+
var O = toIObject($this);
|
32
|
+
var length = toLength(O.length);
|
33
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
34
|
+
var value;
|
35
|
+
// Array#includes uses SameValueZero equality algorithm
|
36
|
+
// eslint-disable-next-line no-self-compare
|
37
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
38
|
+
value = O[index++];
|
39
|
+
// eslint-disable-next-line no-self-compare
|
40
|
+
if (value != value) return true;
|
41
|
+
// Array#indexOf ignores holes, Array#includes - not
|
42
|
+
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
43
|
+
if (O[index] === el) return IS_INCLUDES || index || 0;
|
44
|
+
} return !IS_INCLUDES && -1;
|
45
|
+
};
|
46
|
+
};
|
47
|
+
|
48
|
+
},{"./_to-absolute-index":37,"./_to-iobject":39,"./_to-length":40}],5:[function(require,module,exports){
|
49
|
+
var toString = {}.toString;
|
50
|
+
|
51
|
+
module.exports = function (it) {
|
52
|
+
return toString.call(it).slice(8, -1);
|
53
|
+
};
|
54
|
+
|
55
|
+
},{}],6:[function(require,module,exports){
|
56
|
+
var core = module.exports = { version: '2.6.0' };
|
57
|
+
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
|
58
|
+
|
59
|
+
},{}],7:[function(require,module,exports){
|
60
|
+
// optional / simple context binding
|
61
|
+
var aFunction = require('./_a-function');
|
62
|
+
module.exports = function (fn, that, length) {
|
63
|
+
aFunction(fn);
|
64
|
+
if (that === undefined) return fn;
|
65
|
+
switch (length) {
|
66
|
+
case 1: return function (a) {
|
67
|
+
return fn.call(that, a);
|
68
|
+
};
|
69
|
+
case 2: return function (a, b) {
|
70
|
+
return fn.call(that, a, b);
|
71
|
+
};
|
72
|
+
case 3: return function (a, b, c) {
|
73
|
+
return fn.call(that, a, b, c);
|
74
|
+
};
|
75
|
+
}
|
76
|
+
return function (/* ...args */) {
|
77
|
+
return fn.apply(that, arguments);
|
78
|
+
};
|
79
|
+
};
|
80
|
+
|
81
|
+
},{"./_a-function":1}],8:[function(require,module,exports){
|
82
|
+
// 7.2.1 RequireObjectCoercible(argument)
|
83
|
+
module.exports = function (it) {
|
84
|
+
if (it == undefined) throw TypeError("Can't call method on " + it);
|
85
|
+
return it;
|
86
|
+
};
|
87
|
+
|
88
|
+
},{}],9:[function(require,module,exports){
|
89
|
+
// Thank's IE8 for his funny defineProperty
|
90
|
+
module.exports = !require('./_fails')(function () {
|
91
|
+
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
92
|
+
});
|
93
|
+
|
94
|
+
},{"./_fails":13}],10:[function(require,module,exports){
|
95
|
+
var isObject = require('./_is-object');
|
96
|
+
var document = require('./_global').document;
|
97
|
+
// typeof document.createElement is 'object' in old IE
|
98
|
+
var is = isObject(document) && isObject(document.createElement);
|
99
|
+
module.exports = function (it) {
|
100
|
+
return is ? document.createElement(it) : {};
|
101
|
+
};
|
102
|
+
|
103
|
+
},{"./_global":14,"./_is-object":20}],11:[function(require,module,exports){
|
104
|
+
// IE 8- don't enum bug keys
|
105
|
+
module.exports = (
|
106
|
+
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
107
|
+
).split(',');
|
108
|
+
|
109
|
+
},{}],12:[function(require,module,exports){
|
110
|
+
var global = require('./_global');
|
111
|
+
var core = require('./_core');
|
112
|
+
var hide = require('./_hide');
|
113
|
+
var redefine = require('./_redefine');
|
114
|
+
var ctx = require('./_ctx');
|
115
|
+
var PROTOTYPE = 'prototype';
|
116
|
+
|
117
|
+
var $export = function (type, name, source) {
|
118
|
+
var IS_FORCED = type & $export.F;
|
119
|
+
var IS_GLOBAL = type & $export.G;
|
120
|
+
var IS_STATIC = type & $export.S;
|
121
|
+
var IS_PROTO = type & $export.P;
|
122
|
+
var IS_BIND = type & $export.B;
|
123
|
+
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
|
124
|
+
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
125
|
+
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
|
126
|
+
var key, own, out, exp;
|
127
|
+
if (IS_GLOBAL) source = name;
|
128
|
+
for (key in source) {
|
129
|
+
// contains in native
|
130
|
+
own = !IS_FORCED && target && target[key] !== undefined;
|
131
|
+
// export native or passed
|
132
|
+
out = (own ? target : source)[key];
|
133
|
+
// bind timers to global for call from export context
|
134
|
+
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
135
|
+
// extend global
|
136
|
+
if (target) redefine(target, key, out, type & $export.U);
|
137
|
+
// export
|
138
|
+
if (exports[key] != out) hide(exports, key, exp);
|
139
|
+
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
|
140
|
+
}
|
141
|
+
};
|
142
|
+
global.core = core;
|
143
|
+
// type bitmap
|
144
|
+
$export.F = 1; // forced
|
145
|
+
$export.G = 2; // global
|
146
|
+
$export.S = 4; // static
|
147
|
+
$export.P = 8; // proto
|
148
|
+
$export.B = 16; // bind
|
149
|
+
$export.W = 32; // wrap
|
150
|
+
$export.U = 64; // safe
|
151
|
+
$export.R = 128; // real proto method for `library`
|
152
|
+
module.exports = $export;
|
153
|
+
|
154
|
+
},{"./_core":6,"./_ctx":7,"./_global":14,"./_hide":16,"./_redefine":33}],13:[function(require,module,exports){
|
155
|
+
module.exports = function (exec) {
|
156
|
+
try {
|
157
|
+
return !!exec();
|
158
|
+
} catch (e) {
|
159
|
+
return true;
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
},{}],14:[function(require,module,exports){
|
164
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
165
|
+
var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
166
|
+
? window : typeof self != 'undefined' && self.Math == Math ? self
|
167
|
+
// eslint-disable-next-line no-new-func
|
168
|
+
: Function('return this')();
|
169
|
+
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
|
170
|
+
|
171
|
+
},{}],15:[function(require,module,exports){
|
172
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
173
|
+
module.exports = function (it, key) {
|
174
|
+
return hasOwnProperty.call(it, key);
|
175
|
+
};
|
176
|
+
|
177
|
+
},{}],16:[function(require,module,exports){
|
178
|
+
var dP = require('./_object-dp');
|
179
|
+
var createDesc = require('./_property-desc');
|
180
|
+
module.exports = require('./_descriptors') ? function (object, key, value) {
|
181
|
+
return dP.f(object, key, createDesc(1, value));
|
182
|
+
} : function (object, key, value) {
|
183
|
+
object[key] = value;
|
184
|
+
return object;
|
185
|
+
};
|
186
|
+
|
187
|
+
},{"./_descriptors":9,"./_object-dp":27,"./_property-desc":32}],17:[function(require,module,exports){
|
188
|
+
var document = require('./_global').document;
|
189
|
+
module.exports = document && document.documentElement;
|
190
|
+
|
191
|
+
},{"./_global":14}],18:[function(require,module,exports){
|
192
|
+
module.exports = !require('./_descriptors') && !require('./_fails')(function () {
|
193
|
+
return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
|
194
|
+
});
|
195
|
+
|
196
|
+
},{"./_descriptors":9,"./_dom-create":10,"./_fails":13}],19:[function(require,module,exports){
|
197
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
198
|
+
var cof = require('./_cof');
|
199
|
+
// eslint-disable-next-line no-prototype-builtins
|
200
|
+
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
201
|
+
return cof(it) == 'String' ? it.split('') : Object(it);
|
202
|
+
};
|
203
|
+
|
204
|
+
},{"./_cof":5}],20:[function(require,module,exports){
|
205
|
+
module.exports = function (it) {
|
206
|
+
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
207
|
+
};
|
208
|
+
|
209
|
+
},{}],21:[function(require,module,exports){
|
210
|
+
'use strict';
|
211
|
+
var create = require('./_object-create');
|
212
|
+
var descriptor = require('./_property-desc');
|
213
|
+
var setToStringTag = require('./_set-to-string-tag');
|
214
|
+
var IteratorPrototype = {};
|
215
|
+
|
216
|
+
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
217
|
+
require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
|
218
|
+
|
219
|
+
module.exports = function (Constructor, NAME, next) {
|
220
|
+
Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
|
221
|
+
setToStringTag(Constructor, NAME + ' Iterator');
|
222
|
+
};
|
223
|
+
|
224
|
+
},{"./_hide":16,"./_object-create":26,"./_property-desc":32,"./_set-to-string-tag":34,"./_wks":44}],22:[function(require,module,exports){
|
225
|
+
'use strict';
|
226
|
+
var LIBRARY = require('./_library');
|
227
|
+
var $export = require('./_export');
|
228
|
+
var redefine = require('./_redefine');
|
229
|
+
var hide = require('./_hide');
|
230
|
+
var Iterators = require('./_iterators');
|
231
|
+
var $iterCreate = require('./_iter-create');
|
232
|
+
var setToStringTag = require('./_set-to-string-tag');
|
233
|
+
var getPrototypeOf = require('./_object-gpo');
|
234
|
+
var ITERATOR = require('./_wks')('iterator');
|
235
|
+
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
|
236
|
+
var FF_ITERATOR = '@@iterator';
|
237
|
+
var KEYS = 'keys';
|
238
|
+
var VALUES = 'values';
|
239
|
+
|
240
|
+
var returnThis = function () { return this; };
|
241
|
+
|
242
|
+
module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
|
243
|
+
$iterCreate(Constructor, NAME, next);
|
244
|
+
var getMethod = function (kind) {
|
245
|
+
if (!BUGGY && kind in proto) return proto[kind];
|
246
|
+
switch (kind) {
|
247
|
+
case KEYS: return function keys() { return new Constructor(this, kind); };
|
248
|
+
case VALUES: return function values() { return new Constructor(this, kind); };
|
249
|
+
} return function entries() { return new Constructor(this, kind); };
|
250
|
+
};
|
251
|
+
var TAG = NAME + ' Iterator';
|
252
|
+
var DEF_VALUES = DEFAULT == VALUES;
|
253
|
+
var VALUES_BUG = false;
|
254
|
+
var proto = Base.prototype;
|
255
|
+
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
|
256
|
+
var $default = $native || getMethod(DEFAULT);
|
257
|
+
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
|
258
|
+
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
|
259
|
+
var methods, key, IteratorPrototype;
|
260
|
+
// Fix native
|
261
|
+
if ($anyNative) {
|
262
|
+
IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
|
263
|
+
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
|
264
|
+
// Set @@toStringTag to native iterators
|
265
|
+
setToStringTag(IteratorPrototype, TAG, true);
|
266
|
+
// fix for some old engines
|
267
|
+
if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
// fix Array#{values, @@iterator}.name in V8 / FF
|
271
|
+
if (DEF_VALUES && $native && $native.name !== VALUES) {
|
272
|
+
VALUES_BUG = true;
|
273
|
+
$default = function values() { return $native.call(this); };
|
274
|
+
}
|
275
|
+
// Define iterator
|
276
|
+
if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
|
277
|
+
hide(proto, ITERATOR, $default);
|
278
|
+
}
|
279
|
+
// Plug for library
|
280
|
+
Iterators[NAME] = $default;
|
281
|
+
Iterators[TAG] = returnThis;
|
282
|
+
if (DEFAULT) {
|
283
|
+
methods = {
|
284
|
+
values: DEF_VALUES ? $default : getMethod(VALUES),
|
285
|
+
keys: IS_SET ? $default : getMethod(KEYS),
|
286
|
+
entries: $entries
|
287
|
+
};
|
288
|
+
if (FORCED) for (key in methods) {
|
289
|
+
if (!(key in proto)) redefine(proto, key, methods[key]);
|
290
|
+
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
291
|
+
}
|
292
|
+
return methods;
|
293
|
+
};
|
294
|
+
|
295
|
+
},{"./_export":12,"./_hide":16,"./_iter-create":21,"./_iterators":24,"./_library":25,"./_object-gpo":29,"./_redefine":33,"./_set-to-string-tag":34,"./_wks":44}],23:[function(require,module,exports){
|
296
|
+
module.exports = function (done, value) {
|
297
|
+
return { value: value, done: !!done };
|
298
|
+
};
|
299
|
+
|
300
|
+
},{}],24:[function(require,module,exports){
|
301
|
+
module.exports = {};
|
302
|
+
|
303
|
+
},{}],25:[function(require,module,exports){
|
304
|
+
module.exports = false;
|
305
|
+
|
306
|
+
},{}],26:[function(require,module,exports){
|
307
|
+
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
308
|
+
var anObject = require('./_an-object');
|
309
|
+
var dPs = require('./_object-dps');
|
310
|
+
var enumBugKeys = require('./_enum-bug-keys');
|
311
|
+
var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
312
|
+
var Empty = function () { /* empty */ };
|
313
|
+
var PROTOTYPE = 'prototype';
|
314
|
+
|
315
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
316
|
+
var createDict = function () {
|
317
|
+
// Thrash, waste and sodomy: IE GC bug
|
318
|
+
var iframe = require('./_dom-create')('iframe');
|
319
|
+
var i = enumBugKeys.length;
|
320
|
+
var lt = '<';
|
321
|
+
var gt = '>';
|
322
|
+
var iframeDocument;
|
323
|
+
iframe.style.display = 'none';
|
324
|
+
require('./_html').appendChild(iframe);
|
325
|
+
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
|
326
|
+
// createDict = iframe.contentWindow.Object;
|
327
|
+
// html.removeChild(iframe);
|
328
|
+
iframeDocument = iframe.contentWindow.document;
|
329
|
+
iframeDocument.open();
|
330
|
+
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
331
|
+
iframeDocument.close();
|
332
|
+
createDict = iframeDocument.F;
|
333
|
+
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
334
|
+
return createDict();
|
335
|
+
};
|
336
|
+
|
337
|
+
module.exports = Object.create || function create(O, Properties) {
|
338
|
+
var result;
|
339
|
+
if (O !== null) {
|
340
|
+
Empty[PROTOTYPE] = anObject(O);
|
341
|
+
result = new Empty();
|
342
|
+
Empty[PROTOTYPE] = null;
|
343
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
344
|
+
result[IE_PROTO] = O;
|
345
|
+
} else result = createDict();
|
346
|
+
return Properties === undefined ? result : dPs(result, Properties);
|
347
|
+
};
|
348
|
+
|
349
|
+
},{"./_an-object":3,"./_dom-create":10,"./_enum-bug-keys":11,"./_html":17,"./_object-dps":28,"./_shared-key":35}],27:[function(require,module,exports){
|
350
|
+
var anObject = require('./_an-object');
|
351
|
+
var IE8_DOM_DEFINE = require('./_ie8-dom-define');
|
352
|
+
var toPrimitive = require('./_to-primitive');
|
353
|
+
var dP = Object.defineProperty;
|
354
|
+
|
355
|
+
exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
356
|
+
anObject(O);
|
357
|
+
P = toPrimitive(P, true);
|
358
|
+
anObject(Attributes);
|
359
|
+
if (IE8_DOM_DEFINE) try {
|
360
|
+
return dP(O, P, Attributes);
|
361
|
+
} catch (e) { /* empty */ }
|
362
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
363
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
364
|
+
return O;
|
365
|
+
};
|
366
|
+
|
367
|
+
},{"./_an-object":3,"./_descriptors":9,"./_ie8-dom-define":18,"./_to-primitive":42}],28:[function(require,module,exports){
|
368
|
+
var dP = require('./_object-dp');
|
369
|
+
var anObject = require('./_an-object');
|
370
|
+
var getKeys = require('./_object-keys');
|
371
|
+
|
372
|
+
module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
|
373
|
+
anObject(O);
|
374
|
+
var keys = getKeys(Properties);
|
375
|
+
var length = keys.length;
|
376
|
+
var i = 0;
|
377
|
+
var P;
|
378
|
+
while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
379
|
+
return O;
|
380
|
+
};
|
381
|
+
|
382
|
+
},{"./_an-object":3,"./_descriptors":9,"./_object-dp":27,"./_object-keys":31}],29:[function(require,module,exports){
|
383
|
+
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
|
384
|
+
var has = require('./_has');
|
385
|
+
var toObject = require('./_to-object');
|
386
|
+
var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
387
|
+
var ObjectProto = Object.prototype;
|
388
|
+
|
389
|
+
module.exports = Object.getPrototypeOf || function (O) {
|
390
|
+
O = toObject(O);
|
391
|
+
if (has(O, IE_PROTO)) return O[IE_PROTO];
|
392
|
+
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
393
|
+
return O.constructor.prototype;
|
394
|
+
} return O instanceof Object ? ObjectProto : null;
|
395
|
+
};
|
396
|
+
|
397
|
+
},{"./_has":15,"./_shared-key":35,"./_to-object":41}],30:[function(require,module,exports){
|
398
|
+
var has = require('./_has');
|
399
|
+
var toIObject = require('./_to-iobject');
|
400
|
+
var arrayIndexOf = require('./_array-includes')(false);
|
401
|
+
var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
402
|
+
|
403
|
+
module.exports = function (object, names) {
|
404
|
+
var O = toIObject(object);
|
405
|
+
var i = 0;
|
406
|
+
var result = [];
|
407
|
+
var key;
|
408
|
+
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
409
|
+
// Don't enum bug & hidden keys
|
410
|
+
while (names.length > i) if (has(O, key = names[i++])) {
|
411
|
+
~arrayIndexOf(result, key) || result.push(key);
|
412
|
+
}
|
413
|
+
return result;
|
414
|
+
};
|
415
|
+
|
416
|
+
},{"./_array-includes":4,"./_has":15,"./_shared-key":35,"./_to-iobject":39}],31:[function(require,module,exports){
|
417
|
+
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
418
|
+
var $keys = require('./_object-keys-internal');
|
419
|
+
var enumBugKeys = require('./_enum-bug-keys');
|
420
|
+
|
421
|
+
module.exports = Object.keys || function keys(O) {
|
422
|
+
return $keys(O, enumBugKeys);
|
423
|
+
};
|
424
|
+
|
425
|
+
},{"./_enum-bug-keys":11,"./_object-keys-internal":30}],32:[function(require,module,exports){
|
426
|
+
module.exports = function (bitmap, value) {
|
427
|
+
return {
|
428
|
+
enumerable: !(bitmap & 1),
|
429
|
+
configurable: !(bitmap & 2),
|
430
|
+
writable: !(bitmap & 4),
|
431
|
+
value: value
|
432
|
+
};
|
433
|
+
};
|
434
|
+
|
435
|
+
},{}],33:[function(require,module,exports){
|
436
|
+
var global = require('./_global');
|
437
|
+
var hide = require('./_hide');
|
438
|
+
var has = require('./_has');
|
439
|
+
var SRC = require('./_uid')('src');
|
440
|
+
var TO_STRING = 'toString';
|
441
|
+
var $toString = Function[TO_STRING];
|
442
|
+
var TPL = ('' + $toString).split(TO_STRING);
|
443
|
+
|
444
|
+
require('./_core').inspectSource = function (it) {
|
445
|
+
return $toString.call(it);
|
446
|
+
};
|
447
|
+
|
448
|
+
(module.exports = function (O, key, val, safe) {
|
449
|
+
var isFunction = typeof val == 'function';
|
450
|
+
if (isFunction) has(val, 'name') || hide(val, 'name', key);
|
451
|
+
if (O[key] === val) return;
|
452
|
+
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
|
453
|
+
if (O === global) {
|
454
|
+
O[key] = val;
|
455
|
+
} else if (!safe) {
|
456
|
+
delete O[key];
|
457
|
+
hide(O, key, val);
|
458
|
+
} else if (O[key]) {
|
459
|
+
O[key] = val;
|
460
|
+
} else {
|
461
|
+
hide(O, key, val);
|
462
|
+
}
|
463
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
464
|
+
})(Function.prototype, TO_STRING, function toString() {
|
465
|
+
return typeof this == 'function' && this[SRC] || $toString.call(this);
|
466
|
+
});
|
467
|
+
|
468
|
+
},{"./_core":6,"./_global":14,"./_has":15,"./_hide":16,"./_uid":43}],34:[function(require,module,exports){
|
469
|
+
var def = require('./_object-dp').f;
|
470
|
+
var has = require('./_has');
|
471
|
+
var TAG = require('./_wks')('toStringTag');
|
472
|
+
|
473
|
+
module.exports = function (it, tag, stat) {
|
474
|
+
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
|
475
|
+
};
|
476
|
+
|
477
|
+
},{"./_has":15,"./_object-dp":27,"./_wks":44}],35:[function(require,module,exports){
|
478
|
+
var shared = require('./_shared')('keys');
|
479
|
+
var uid = require('./_uid');
|
480
|
+
module.exports = function (key) {
|
481
|
+
return shared[key] || (shared[key] = uid(key));
|
482
|
+
};
|
483
|
+
|
484
|
+
},{"./_shared":36,"./_uid":43}],36:[function(require,module,exports){
|
485
|
+
var core = require('./_core');
|
486
|
+
var global = require('./_global');
|
487
|
+
var SHARED = '__core-js_shared__';
|
488
|
+
var store = global[SHARED] || (global[SHARED] = {});
|
489
|
+
|
490
|
+
(module.exports = function (key, value) {
|
491
|
+
return store[key] || (store[key] = value !== undefined ? value : {});
|
492
|
+
})('versions', []).push({
|
493
|
+
version: core.version,
|
494
|
+
mode: require('./_library') ? 'pure' : 'global',
|
495
|
+
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
496
|
+
});
|
497
|
+
|
498
|
+
},{"./_core":6,"./_global":14,"./_library":25}],37:[function(require,module,exports){
|
499
|
+
var toInteger = require('./_to-integer');
|
500
|
+
var max = Math.max;
|
501
|
+
var min = Math.min;
|
502
|
+
module.exports = function (index, length) {
|
503
|
+
index = toInteger(index);
|
504
|
+
return index < 0 ? max(index + length, 0) : min(index, length);
|
505
|
+
};
|
506
|
+
|
507
|
+
},{"./_to-integer":38}],38:[function(require,module,exports){
|
508
|
+
// 7.1.4 ToInteger
|
509
|
+
var ceil = Math.ceil;
|
510
|
+
var floor = Math.floor;
|
511
|
+
module.exports = function (it) {
|
512
|
+
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
513
|
+
};
|
514
|
+
|
515
|
+
},{}],39:[function(require,module,exports){
|
516
|
+
// to indexed object, toObject with fallback for non-array-like ES3 strings
|
517
|
+
var IObject = require('./_iobject');
|
518
|
+
var defined = require('./_defined');
|
519
|
+
module.exports = function (it) {
|
520
|
+
return IObject(defined(it));
|
521
|
+
};
|
522
|
+
|
523
|
+
},{"./_defined":8,"./_iobject":19}],40:[function(require,module,exports){
|
524
|
+
// 7.1.15 ToLength
|
525
|
+
var toInteger = require('./_to-integer');
|
526
|
+
var min = Math.min;
|
527
|
+
module.exports = function (it) {
|
528
|
+
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
|
529
|
+
};
|
530
|
+
|
531
|
+
},{"./_to-integer":38}],41:[function(require,module,exports){
|
532
|
+
// 7.1.13 ToObject(argument)
|
533
|
+
var defined = require('./_defined');
|
534
|
+
module.exports = function (it) {
|
535
|
+
return Object(defined(it));
|
536
|
+
};
|
537
|
+
|
538
|
+
},{"./_defined":8}],42:[function(require,module,exports){
|
539
|
+
// 7.1.1 ToPrimitive(input [, PreferredType])
|
540
|
+
var isObject = require('./_is-object');
|
541
|
+
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
542
|
+
// and the second argument - flag - preferred type is a string
|
543
|
+
module.exports = function (it, S) {
|
544
|
+
if (!isObject(it)) return it;
|
545
|
+
var fn, val;
|
546
|
+
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
547
|
+
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
548
|
+
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
549
|
+
throw TypeError("Can't convert object to primitive value");
|
550
|
+
};
|
551
|
+
|
552
|
+
},{"./_is-object":20}],43:[function(require,module,exports){
|
553
|
+
var id = 0;
|
554
|
+
var px = Math.random();
|
555
|
+
module.exports = function (key) {
|
556
|
+
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
557
|
+
};
|
558
|
+
|
559
|
+
},{}],44:[function(require,module,exports){
|
560
|
+
var store = require('./_shared')('wks');
|
561
|
+
var uid = require('./_uid');
|
562
|
+
var Symbol = require('./_global').Symbol;
|
563
|
+
var USE_SYMBOL = typeof Symbol == 'function';
|
564
|
+
|
565
|
+
var $exports = module.exports = function (name) {
|
566
|
+
return store[name] || (store[name] =
|
567
|
+
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
568
|
+
};
|
569
|
+
|
570
|
+
$exports.store = store;
|
571
|
+
|
572
|
+
},{"./_global":14,"./_shared":36,"./_uid":43}],45:[function(require,module,exports){
|
573
|
+
'use strict';
|
574
|
+
var addToUnscopables = require('./_add-to-unscopables');
|
575
|
+
var step = require('./_iter-step');
|
576
|
+
var Iterators = require('./_iterators');
|
577
|
+
var toIObject = require('./_to-iobject');
|
578
|
+
|
579
|
+
// 22.1.3.4 Array.prototype.entries()
|
580
|
+
// 22.1.3.13 Array.prototype.keys()
|
581
|
+
// 22.1.3.29 Array.prototype.values()
|
582
|
+
// 22.1.3.30 Array.prototype[@@iterator]()
|
583
|
+
module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
|
584
|
+
this._t = toIObject(iterated); // target
|
585
|
+
this._i = 0; // next index
|
586
|
+
this._k = kind; // kind
|
587
|
+
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
|
588
|
+
}, function () {
|
589
|
+
var O = this._t;
|
590
|
+
var kind = this._k;
|
591
|
+
var index = this._i++;
|
592
|
+
if (!O || index >= O.length) {
|
593
|
+
this._t = undefined;
|
594
|
+
return step(1);
|
595
|
+
}
|
596
|
+
if (kind == 'keys') return step(0, index);
|
597
|
+
if (kind == 'values') return step(0, O[index]);
|
598
|
+
return step(0, [index, O[index]]);
|
599
|
+
}, 'values');
|
600
|
+
|
601
|
+
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
|
602
|
+
Iterators.Arguments = Iterators.Array;
|
603
|
+
|
604
|
+
addToUnscopables('keys');
|
605
|
+
addToUnscopables('values');
|
606
|
+
addToUnscopables('entries');
|
607
|
+
|
608
|
+
},{"./_add-to-unscopables":2,"./_iter-define":22,"./_iter-step":23,"./_iterators":24,"./_to-iobject":39}],46:[function(require,module,exports){
|
609
|
+
var $iterators = require('./es6.array.iterator');
|
610
|
+
var getKeys = require('./_object-keys');
|
611
|
+
var redefine = require('./_redefine');
|
612
|
+
var global = require('./_global');
|
613
|
+
var hide = require('./_hide');
|
614
|
+
var Iterators = require('./_iterators');
|
615
|
+
var wks = require('./_wks');
|
616
|
+
var ITERATOR = wks('iterator');
|
617
|
+
var TO_STRING_TAG = wks('toStringTag');
|
618
|
+
var ArrayValues = Iterators.Array;
|
619
|
+
|
620
|
+
var DOMIterables = {
|
621
|
+
CSSRuleList: true, // TODO: Not spec compliant, should be false.
|
622
|
+
CSSStyleDeclaration: false,
|
623
|
+
CSSValueList: false,
|
624
|
+
ClientRectList: false,
|
625
|
+
DOMRectList: false,
|
626
|
+
DOMStringList: false,
|
627
|
+
DOMTokenList: true,
|
628
|
+
DataTransferItemList: false,
|
629
|
+
FileList: false,
|
630
|
+
HTMLAllCollection: false,
|
631
|
+
HTMLCollection: false,
|
632
|
+
HTMLFormElement: false,
|
633
|
+
HTMLSelectElement: false,
|
634
|
+
MediaList: true, // TODO: Not spec compliant, should be false.
|
635
|
+
MimeTypeArray: false,
|
636
|
+
NamedNodeMap: false,
|
637
|
+
NodeList: true,
|
638
|
+
PaintRequestList: false,
|
639
|
+
Plugin: false,
|
640
|
+
PluginArray: false,
|
641
|
+
SVGLengthList: false,
|
642
|
+
SVGNumberList: false,
|
643
|
+
SVGPathSegList: false,
|
644
|
+
SVGPointList: false,
|
645
|
+
SVGStringList: false,
|
646
|
+
SVGTransformList: false,
|
647
|
+
SourceBufferList: false,
|
648
|
+
StyleSheetList: true, // TODO: Not spec compliant, should be false.
|
649
|
+
TextTrackCueList: false,
|
650
|
+
TextTrackList: false,
|
651
|
+
TouchList: false
|
652
|
+
};
|
653
|
+
|
654
|
+
for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
|
655
|
+
var NAME = collections[i];
|
656
|
+
var explicit = DOMIterables[NAME];
|
657
|
+
var Collection = global[NAME];
|
658
|
+
var proto = Collection && Collection.prototype;
|
659
|
+
var key;
|
660
|
+
if (proto) {
|
661
|
+
if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
|
662
|
+
if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
|
663
|
+
Iterators[NAME] = ArrayValues;
|
664
|
+
if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);
|
665
|
+
}
|
666
|
+
}
|
667
|
+
|
668
|
+
},{"./_global":14,"./_hide":16,"./_iterators":24,"./_object-keys":31,"./_redefine":33,"./_wks":44,"./es6.array.iterator":45}],47:[function(require,module,exports){
|
669
|
+
"use strict";
|
670
|
+
|
671
|
+
const {
|
672
|
+
Parser,
|
673
|
+
PROTOCOL_6,
|
674
|
+
PROTOCOL_7
|
675
|
+
} = require('./protocol');
|
676
|
+
|
677
|
+
const VERSION = "3.0.0-alpha.1";
|
678
|
+
|
679
|
+
class Connector {
|
680
|
+
constructor(options, WebSocket, Timer, handlers) {
|
681
|
+
this.options = options;
|
682
|
+
this.WebSocket = WebSocket;
|
683
|
+
this.Timer = Timer;
|
684
|
+
this.handlers = handlers;
|
685
|
+
const path = this.options.path ? `${this.options.path}` : 'livereload';
|
686
|
+
this._uri = `ws${this.options.https ? 's' : ''}://${this.options.host}:${this.options.port}/${path}`;
|
687
|
+
this._nextDelay = this.options.mindelay;
|
688
|
+
this._connectionDesired = false;
|
689
|
+
this.protocol = 0;
|
690
|
+
this.protocolParser = new Parser({
|
691
|
+
connected: protocol => {
|
692
|
+
this.protocol = protocol;
|
693
|
+
|
694
|
+
this._handshakeTimeout.stop();
|
695
|
+
|
696
|
+
this._nextDelay = this.options.mindelay;
|
697
|
+
this._disconnectionReason = 'broken';
|
698
|
+
return this.handlers.connected(this.protocol);
|
699
|
+
},
|
700
|
+
error: e => {
|
701
|
+
this.handlers.error(e);
|
702
|
+
return this._closeOnError();
|
703
|
+
},
|
704
|
+
message: message => {
|
705
|
+
return this.handlers.message(message);
|
706
|
+
}
|
707
|
+
});
|
708
|
+
this._handshakeTimeout = new this.Timer(() => {
|
709
|
+
if (!this._isSocketConnected()) {
|
710
|
+
return;
|
711
|
+
}
|
712
|
+
|
713
|
+
this._disconnectionReason = 'handshake-timeout';
|
714
|
+
return this.socket.close();
|
715
|
+
});
|
716
|
+
this._reconnectTimer = new this.Timer(() => {
|
717
|
+
if (!this._connectionDesired) {
|
718
|
+
return;
|
719
|
+
} // shouldn't hit this, but just in case
|
720
|
+
|
721
|
+
|
722
|
+
return this.connect();
|
723
|
+
});
|
724
|
+
this.connect();
|
725
|
+
}
|
726
|
+
|
727
|
+
_isSocketConnected() {
|
728
|
+
return this.socket && this.socket.readyState === this.WebSocket.OPEN;
|
729
|
+
}
|
730
|
+
|
731
|
+
connect() {
|
732
|
+
this._connectionDesired = true;
|
733
|
+
|
734
|
+
if (this._isSocketConnected()) {
|
735
|
+
return;
|
736
|
+
} // prepare for a new connection
|
737
|
+
|
738
|
+
|
739
|
+
this._reconnectTimer.stop();
|
740
|
+
|
741
|
+
this._disconnectionReason = 'cannot-connect';
|
742
|
+
this.protocolParser.reset();
|
743
|
+
this.handlers.connecting();
|
744
|
+
this.socket = new this.WebSocket(this._uri);
|
745
|
+
|
746
|
+
this.socket.onopen = e => this._onopen(e);
|
747
|
+
|
748
|
+
this.socket.onclose = e => this._onclose(e);
|
749
|
+
|
750
|
+
this.socket.onmessage = e => this._onmessage(e);
|
751
|
+
|
752
|
+
this.socket.onerror = e => this._onerror(e);
|
753
|
+
}
|
754
|
+
|
755
|
+
disconnect() {
|
756
|
+
this._connectionDesired = false;
|
757
|
+
|
758
|
+
this._reconnectTimer.stop(); // in case it was running
|
759
|
+
|
760
|
+
|
761
|
+
if (!this._isSocketConnected()) {
|
762
|
+
return;
|
763
|
+
}
|
764
|
+
|
765
|
+
this._disconnectionReason = 'manual';
|
766
|
+
return this.socket.close();
|
767
|
+
}
|
768
|
+
|
769
|
+
_scheduleReconnection() {
|
770
|
+
if (!this._connectionDesired) {
|
771
|
+
return;
|
772
|
+
} // don't reconnect after manual disconnection
|
773
|
+
|
774
|
+
|
775
|
+
if (!this._reconnectTimer.running) {
|
776
|
+
this._reconnectTimer.start(this._nextDelay);
|
777
|
+
|
778
|
+
this._nextDelay = Math.min(this.options.maxdelay, this._nextDelay * 2);
|
779
|
+
}
|
780
|
+
}
|
781
|
+
|
782
|
+
sendCommand(command) {
|
783
|
+
if (!this.protocol) {
|
784
|
+
return;
|
785
|
+
}
|
786
|
+
|
787
|
+
return this._sendCommand(command);
|
788
|
+
}
|
789
|
+
|
790
|
+
_sendCommand(command) {
|
791
|
+
return this.socket.send(JSON.stringify(command));
|
792
|
+
}
|
793
|
+
|
794
|
+
_closeOnError() {
|
795
|
+
this._handshakeTimeout.stop();
|
796
|
+
|
797
|
+
this._disconnectionReason = 'error';
|
798
|
+
return this.socket.close();
|
799
|
+
}
|
800
|
+
|
801
|
+
_onopen(e) {
|
802
|
+
this.handlers.socketConnected();
|
803
|
+
this._disconnectionReason = 'handshake-failed'; // start handshake
|
804
|
+
|
805
|
+
const hello = {
|
806
|
+
command: 'hello',
|
807
|
+
protocols: [PROTOCOL_6, PROTOCOL_7]
|
808
|
+
};
|
809
|
+
hello.ver = VERSION;
|
810
|
+
|
811
|
+
if (this.options.ext) {
|
812
|
+
hello.ext = this.options.ext;
|
813
|
+
}
|
814
|
+
|
815
|
+
if (this.options.extver) {
|
816
|
+
hello.extver = this.options.extver;
|
817
|
+
}
|
818
|
+
|
819
|
+
if (this.options.snipver) {
|
820
|
+
hello.snipver = this.options.snipver;
|
821
|
+
}
|
822
|
+
|
823
|
+
this._sendCommand(hello);
|
824
|
+
|
825
|
+
return this._handshakeTimeout.start(this.options.handshake_timeout);
|
826
|
+
}
|
827
|
+
|
828
|
+
_onclose(e) {
|
829
|
+
this.protocol = 0;
|
830
|
+
this.handlers.disconnected(this._disconnectionReason, this._nextDelay);
|
831
|
+
return this._scheduleReconnection();
|
832
|
+
}
|
833
|
+
|
834
|
+
_onerror(e) {}
|
835
|
+
|
836
|
+
_onmessage(e) {
|
837
|
+
return this.protocolParser.process(e.data);
|
838
|
+
}
|
839
|
+
|
840
|
+
}
|
841
|
+
|
842
|
+
;
|
843
|
+
exports.Connector = Connector;
|
844
|
+
|
845
|
+
},{"./protocol":52}],48:[function(require,module,exports){
|
846
|
+
"use strict";
|
847
|
+
|
848
|
+
const CustomEvents = {
|
849
|
+
bind(element, eventName, handler) {
|
850
|
+
if (element.addEventListener) {
|
851
|
+
return element.addEventListener(eventName, handler, false);
|
852
|
+
} else if (element.attachEvent) {
|
853
|
+
element[eventName] = 1;
|
854
|
+
return element.attachEvent('onpropertychange', function (event) {
|
855
|
+
if (event.propertyName === eventName) {
|
856
|
+
return handler();
|
857
|
+
}
|
858
|
+
});
|
859
|
+
} else {
|
860
|
+
throw new Error(`Attempt to attach custom event ${eventName} to something which isn't a DOMElement`);
|
861
|
+
}
|
862
|
+
},
|
863
|
+
|
864
|
+
fire(element, eventName) {
|
865
|
+
if (element.addEventListener) {
|
866
|
+
const event = document.createEvent('HTMLEvents');
|
867
|
+
event.initEvent(eventName, true, true);
|
868
|
+
return document.dispatchEvent(event);
|
869
|
+
} else if (element.attachEvent) {
|
870
|
+
if (element[eventName]) {
|
871
|
+
return element[eventName]++;
|
872
|
+
}
|
873
|
+
} else {
|
874
|
+
throw new Error(`Attempt to fire custom event ${eventName} on something which isn't a DOMElement`);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
|
878
|
+
};
|
879
|
+
exports.bind = CustomEvents.bind;
|
880
|
+
exports.fire = CustomEvents.fire;
|
881
|
+
|
882
|
+
},{}],49:[function(require,module,exports){
|
883
|
+
"use strict";
|
884
|
+
|
885
|
+
class LessPlugin {
|
886
|
+
constructor(window, host) {
|
887
|
+
this.window = window;
|
888
|
+
this.host = host;
|
889
|
+
}
|
890
|
+
|
891
|
+
reload(path, options) {
|
892
|
+
if (this.window.less && this.window.less.refresh) {
|
893
|
+
if (path.match(/\.less$/i)) {
|
894
|
+
return this.reloadLess(path);
|
895
|
+
}
|
896
|
+
|
897
|
+
if (options.originalPath.match(/\.less$/i)) {
|
898
|
+
return this.reloadLess(options.originalPath);
|
899
|
+
}
|
900
|
+
}
|
901
|
+
|
902
|
+
return false;
|
903
|
+
}
|
904
|
+
|
905
|
+
reloadLess(path) {
|
906
|
+
let link;
|
907
|
+
|
908
|
+
const links = (() => {
|
909
|
+
const result = [];
|
910
|
+
|
911
|
+
for (link of Array.from(document.getElementsByTagName('link'))) {
|
912
|
+
if (link.href && link.rel.match(/^stylesheet\/less$/i) || link.rel.match(/stylesheet/i) && link.type.match(/^text\/(x-)?less$/i)) {
|
913
|
+
result.push(link);
|
914
|
+
}
|
915
|
+
}
|
916
|
+
|
917
|
+
return result;
|
918
|
+
})();
|
919
|
+
|
920
|
+
if (links.length === 0) {
|
921
|
+
return false;
|
922
|
+
}
|
923
|
+
|
924
|
+
for (link of Array.from(links)) {
|
925
|
+
link.href = this.host.generateCacheBustUrl(link.href);
|
926
|
+
}
|
927
|
+
|
928
|
+
this.host.console.log('LiveReload is asking LESS to recompile all stylesheets');
|
929
|
+
this.window.less.refresh(true);
|
930
|
+
return true;
|
931
|
+
}
|
932
|
+
|
933
|
+
analyze() {
|
934
|
+
return {
|
935
|
+
disable: !!(this.window.less && this.window.less.refresh)
|
936
|
+
};
|
937
|
+
}
|
938
|
+
|
939
|
+
}
|
940
|
+
|
941
|
+
;
|
942
|
+
LessPlugin.identifier = 'less';
|
943
|
+
LessPlugin.version = '1.0';
|
944
|
+
module.exports = LessPlugin;
|
945
|
+
|
946
|
+
},{}],50:[function(require,module,exports){
|
947
|
+
"use strict";
|
948
|
+
|
949
|
+
require("core-js/modules/web.dom.iterable");
|
950
|
+
|
951
|
+
/* global alert */
|
952
|
+
const {
|
953
|
+
Connector
|
954
|
+
} = require('./connector');
|
955
|
+
|
956
|
+
const {
|
957
|
+
Timer
|
958
|
+
} = require('./timer');
|
959
|
+
|
960
|
+
const {
|
961
|
+
Options
|
962
|
+
} = require('./options');
|
963
|
+
|
964
|
+
const {
|
965
|
+
Reloader
|
966
|
+
} = require('./reloader');
|
967
|
+
|
968
|
+
const {
|
969
|
+
ProtocolError
|
970
|
+
} = require('./protocol');
|
971
|
+
|
972
|
+
class LiveReload {
|
973
|
+
constructor(window) {
|
974
|
+
this.window = window;
|
975
|
+
this.listeners = {};
|
976
|
+
this.plugins = [];
|
977
|
+
this.pluginIdentifiers = {}; // i can haz console?
|
978
|
+
|
979
|
+
this.console = this.window.console && this.window.console.log && this.window.console.error ? this.window.location.href.match(/LR-verbose/) ? this.window.console : {
|
980
|
+
log() {},
|
981
|
+
|
982
|
+
error: this.window.console.error.bind(this.window.console)
|
983
|
+
} : {
|
984
|
+
log() {},
|
985
|
+
|
986
|
+
error() {}
|
987
|
+
|
988
|
+
}; // i can haz sockets?
|
989
|
+
|
990
|
+
if (!(this.WebSocket = this.window.WebSocket || this.window.MozWebSocket)) {
|
991
|
+
this.console.error('LiveReload disabled because the browser does not seem to support web sockets');
|
992
|
+
return;
|
993
|
+
} // i can haz options?
|
994
|
+
|
995
|
+
|
996
|
+
if ('LiveReloadOptions' in window) {
|
997
|
+
this.options = new Options();
|
998
|
+
|
999
|
+
for (let k of Object.keys(window['LiveReloadOptions'] || {})) {
|
1000
|
+
const v = window['LiveReloadOptions'][k];
|
1001
|
+
this.options.set(k, v);
|
1002
|
+
}
|
1003
|
+
} else {
|
1004
|
+
this.options = Options.extract(this.window.document);
|
1005
|
+
|
1006
|
+
if (!this.options) {
|
1007
|
+
this.console.error('LiveReload disabled because it could not find its own <SCRIPT> tag');
|
1008
|
+
return;
|
1009
|
+
}
|
1010
|
+
} // i can haz reloader?
|
1011
|
+
|
1012
|
+
|
1013
|
+
this.reloader = new Reloader(this.window, this.console, Timer); // i can haz connection?
|
1014
|
+
|
1015
|
+
this.connector = new Connector(this.options, this.WebSocket, Timer, {
|
1016
|
+
connecting: () => {},
|
1017
|
+
socketConnected: () => {},
|
1018
|
+
connected: protocol => {
|
1019
|
+
if (typeof this.listeners.connect === 'function') {
|
1020
|
+
this.listeners.connect();
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
this.log(`LiveReload is connected to ${this.options.host}:${this.options.port} (protocol v${protocol}).`);
|
1024
|
+
return this.analyze();
|
1025
|
+
},
|
1026
|
+
error: e => {
|
1027
|
+
if (e instanceof ProtocolError) {
|
1028
|
+
if (typeof console !== 'undefined' && console !== null) {
|
1029
|
+
return console.log(`${e.message}.`);
|
1030
|
+
}
|
1031
|
+
} else {
|
1032
|
+
if (typeof console !== 'undefined' && console !== null) {
|
1033
|
+
return console.log(`LiveReload internal error: ${e.message}`);
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
},
|
1037
|
+
disconnected: (reason, nextDelay) => {
|
1038
|
+
if (typeof this.listeners.disconnect === 'function') {
|
1039
|
+
this.listeners.disconnect();
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
switch (reason) {
|
1043
|
+
case 'cannot-connect':
|
1044
|
+
return this.log(`LiveReload cannot connect to ${this.options.host}:${this.options.port}, will retry in ${nextDelay} sec.`);
|
1045
|
+
|
1046
|
+
case 'broken':
|
1047
|
+
return this.log(`LiveReload disconnected from ${this.options.host}:${this.options.port}, reconnecting in ${nextDelay} sec.`);
|
1048
|
+
|
1049
|
+
case 'handshake-timeout':
|
1050
|
+
return this.log(`LiveReload cannot connect to ${this.options.host}:${this.options.port} (handshake timeout), will retry in ${nextDelay} sec.`);
|
1051
|
+
|
1052
|
+
case 'handshake-failed':
|
1053
|
+
return this.log(`LiveReload cannot connect to ${this.options.host}:${this.options.port} (handshake failed), will retry in ${nextDelay} sec.`);
|
1054
|
+
|
1055
|
+
case 'manual': // nop
|
1056
|
+
|
1057
|
+
case 'error': // nop
|
1058
|
+
|
1059
|
+
default:
|
1060
|
+
return this.log(`LiveReload disconnected from ${this.options.host}:${this.options.port} (${reason}), reconnecting in ${nextDelay} sec.`);
|
1061
|
+
}
|
1062
|
+
},
|
1063
|
+
message: message => {
|
1064
|
+
switch (message.command) {
|
1065
|
+
case 'reload':
|
1066
|
+
return this.performReload(message);
|
1067
|
+
|
1068
|
+
case 'alert':
|
1069
|
+
return this.performAlert(message);
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
});
|
1073
|
+
this.initialized = true;
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
on(eventName, handler) {
|
1077
|
+
this.listeners[eventName] = handler;
|
1078
|
+
}
|
1079
|
+
|
1080
|
+
log(message) {
|
1081
|
+
return this.console.log(`${message}`);
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
performReload(message) {
|
1085
|
+
this.log(`LiveReload received reload request: ${JSON.stringify(message, null, 2)}`);
|
1086
|
+
return this.reloader.reload(message.path, {
|
1087
|
+
liveCSS: message.liveCSS != null ? message.liveCSS : true,
|
1088
|
+
liveImg: message.liveImg != null ? message.liveImg : true,
|
1089
|
+
reloadMissingCSS: message.reloadMissingCSS != null ? message.reloadMissingCSS : true,
|
1090
|
+
originalPath: message.originalPath || '',
|
1091
|
+
overrideURL: message.overrideURL || '',
|
1092
|
+
serverURL: `http://${this.options.host}:${this.options.port}`
|
1093
|
+
});
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
performAlert(message) {
|
1097
|
+
return alert(message.message);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
shutDown() {
|
1101
|
+
if (!this.initialized) {
|
1102
|
+
return;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
this.connector.disconnect();
|
1106
|
+
this.log('LiveReload disconnected.');
|
1107
|
+
return typeof this.listeners.shutdown === 'function' ? this.listeners.shutdown() : undefined;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
hasPlugin(identifier) {
|
1111
|
+
return !!this.pluginIdentifiers[identifier];
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
addPlugin(PluginClass) {
|
1115
|
+
if (!this.initialized) {
|
1116
|
+
return;
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
if (this.hasPlugin(PluginClass.identifier)) {
|
1120
|
+
return;
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
this.pluginIdentifiers[PluginClass.identifier] = true;
|
1124
|
+
const plugin = new PluginClass(this.window, {
|
1125
|
+
// expose internal objects for those who know what they're doing
|
1126
|
+
// (note that these are private APIs and subject to change at any time!)
|
1127
|
+
_livereload: this,
|
1128
|
+
_reloader: this.reloader,
|
1129
|
+
_connector: this.connector,
|
1130
|
+
// official API
|
1131
|
+
console: this.console,
|
1132
|
+
Timer,
|
1133
|
+
generateCacheBustUrl: url => this.reloader.generateCacheBustUrl(url)
|
1134
|
+
}); // API that PluginClass can/must provide:
|
1135
|
+
//
|
1136
|
+
// string PluginClass.identifier
|
1137
|
+
// -- required, globally-unique name of this plugin
|
1138
|
+
//
|
1139
|
+
// string PluginClass.version
|
1140
|
+
// -- required, plugin version number (format %d.%d or %d.%d.%d)
|
1141
|
+
//
|
1142
|
+
// plugin = new PluginClass(window, officialLiveReloadAPI)
|
1143
|
+
// -- required, plugin constructor
|
1144
|
+
//
|
1145
|
+
// bool plugin.reload(string path, { bool liveCSS, bool liveImg })
|
1146
|
+
// -- optional, attemp to reload the given path, return true if handled
|
1147
|
+
//
|
1148
|
+
// object plugin.analyze()
|
1149
|
+
// -- optional, returns plugin-specific information about the current document (to send to the connected server)
|
1150
|
+
// (LiveReload 2 server currently only defines 'disable' key in this object; return {disable:true} to disable server-side
|
1151
|
+
// compilation of a matching plugin's files)
|
1152
|
+
|
1153
|
+
this.plugins.push(plugin);
|
1154
|
+
this.reloader.addPlugin(plugin);
|
1155
|
+
}
|
1156
|
+
|
1157
|
+
analyze() {
|
1158
|
+
if (!this.initialized) {
|
1159
|
+
return;
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
if (!(this.connector.protocol >= 7)) {
|
1163
|
+
return;
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
const pluginsData = {};
|
1167
|
+
|
1168
|
+
for (let plugin of this.plugins) {
|
1169
|
+
var pluginData = (typeof plugin.analyze === 'function' ? plugin.analyze() : undefined) || {};
|
1170
|
+
pluginsData[plugin.constructor.identifier] = pluginData;
|
1171
|
+
pluginData.version = plugin.constructor.version;
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
this.connector.sendCommand({
|
1175
|
+
command: 'info',
|
1176
|
+
plugins: pluginsData,
|
1177
|
+
url: this.window.location.href
|
1178
|
+
});
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
;
|
1184
|
+
exports.LiveReload = LiveReload;
|
1185
|
+
|
1186
|
+
},{"./connector":47,"./options":51,"./protocol":52,"./reloader":53,"./timer":55,"core-js/modules/web.dom.iterable":46}],51:[function(require,module,exports){
|
1187
|
+
"use strict";
|
1188
|
+
|
1189
|
+
class Options {
|
1190
|
+
constructor() {
|
1191
|
+
this.https = false;
|
1192
|
+
this.host = null;
|
1193
|
+
this.port = 35729;
|
1194
|
+
this.snipver = null;
|
1195
|
+
this.ext = null;
|
1196
|
+
this.extver = null;
|
1197
|
+
this.mindelay = 1000;
|
1198
|
+
this.maxdelay = 60000;
|
1199
|
+
this.handshake_timeout = 5000;
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
set(name, value) {
|
1203
|
+
if (typeof value === 'undefined') {
|
1204
|
+
return;
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
if (!isNaN(+value)) {
|
1208
|
+
value = +value;
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
this[name] = value;
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
Options.extract = function (document) {
|
1217
|
+
for (let element of Array.from(document.getElementsByTagName('script'))) {
|
1218
|
+
var m, src;
|
1219
|
+
|
1220
|
+
if ((src = element.src) && (m = src.match(new RegExp(`^[^:]+://(.*)/z?livereload\\.js(?:\\?(.*))?$`)))) {
|
1221
|
+
var mm;
|
1222
|
+
const options = new Options();
|
1223
|
+
options.https = src.indexOf('https') === 0;
|
1224
|
+
|
1225
|
+
if (mm = m[1].match(new RegExp(`^([^/:]+)(?::(\\d+))?(\\/+.*)?$`))) {
|
1226
|
+
options.host = mm[1];
|
1227
|
+
|
1228
|
+
if (mm[2]) {
|
1229
|
+
options.port = parseInt(mm[2], 10);
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
if (m[2]) {
|
1234
|
+
for (let pair of m[2].split('&')) {
|
1235
|
+
var keyAndValue;
|
1236
|
+
|
1237
|
+
if ((keyAndValue = pair.split('=')).length > 1) {
|
1238
|
+
options.set(keyAndValue[0].replace(/-/g, '_'), keyAndValue.slice(1).join('='));
|
1239
|
+
}
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
return options;
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
return null;
|
1248
|
+
};
|
1249
|
+
|
1250
|
+
exports.Options = Options;
|
1251
|
+
|
1252
|
+
},{}],52:[function(require,module,exports){
|
1253
|
+
"use strict";
|
1254
|
+
|
1255
|
+
let PROTOCOL_6, PROTOCOL_7;
|
1256
|
+
exports.PROTOCOL_6 = PROTOCOL_6 = 'http://livereload.com/protocols/official-6';
|
1257
|
+
exports.PROTOCOL_7 = PROTOCOL_7 = 'http://livereload.com/protocols/official-7';
|
1258
|
+
|
1259
|
+
class ProtocolError {
|
1260
|
+
constructor(reason, data) {
|
1261
|
+
this.message = `LiveReload protocol error (${reason}) after receiving data: "${data}".`;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
}
|
1265
|
+
|
1266
|
+
;
|
1267
|
+
|
1268
|
+
class Parser {
|
1269
|
+
constructor(handlers) {
|
1270
|
+
this.handlers = handlers;
|
1271
|
+
this.reset();
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
reset() {
|
1275
|
+
this.protocol = null;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
process(data) {
|
1279
|
+
try {
|
1280
|
+
let message;
|
1281
|
+
|
1282
|
+
if (!this.protocol) {
|
1283
|
+
if (data.match(new RegExp(`^!!ver:([\\d.]+)$`))) {
|
1284
|
+
this.protocol = 6;
|
1285
|
+
} else if (message = this._parseMessage(data, ['hello'])) {
|
1286
|
+
if (!message.protocols.length) {
|
1287
|
+
throw new ProtocolError('no protocols specified in handshake message');
|
1288
|
+
} else if (Array.from(message.protocols).includes(PROTOCOL_7)) {
|
1289
|
+
this.protocol = 7;
|
1290
|
+
} else if (Array.from(message.protocols).includes(PROTOCOL_6)) {
|
1291
|
+
this.protocol = 6;
|
1292
|
+
} else {
|
1293
|
+
throw new ProtocolError('no supported protocols found');
|
1294
|
+
}
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
return this.handlers.connected(this.protocol);
|
1298
|
+
} else if (this.protocol === 6) {
|
1299
|
+
message = JSON.parse(data);
|
1300
|
+
|
1301
|
+
if (!message.length) {
|
1302
|
+
throw new ProtocolError('protocol 6 messages must be arrays');
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
const [command, options] = Array.from(message);
|
1306
|
+
|
1307
|
+
if (command !== 'refresh') {
|
1308
|
+
throw new ProtocolError('unknown protocol 6 command');
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
return this.handlers.message({
|
1312
|
+
command: 'reload',
|
1313
|
+
path: options.path,
|
1314
|
+
liveCSS: options.apply_css_live != null ? options.apply_css_live : true
|
1315
|
+
});
|
1316
|
+
} else {
|
1317
|
+
message = this._parseMessage(data, ['reload', 'alert']);
|
1318
|
+
return this.handlers.message(message);
|
1319
|
+
}
|
1320
|
+
} catch (e) {
|
1321
|
+
if (e instanceof ProtocolError) {
|
1322
|
+
return this.handlers.error(e);
|
1323
|
+
} else {
|
1324
|
+
throw e;
|
1325
|
+
}
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
_parseMessage(data, validCommands) {
|
1330
|
+
let message;
|
1331
|
+
|
1332
|
+
try {
|
1333
|
+
message = JSON.parse(data);
|
1334
|
+
} catch (e) {
|
1335
|
+
throw new ProtocolError('unparsable JSON', data);
|
1336
|
+
}
|
1337
|
+
|
1338
|
+
if (!message.command) {
|
1339
|
+
throw new ProtocolError('missing "command" key', data);
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
if (!validCommands.includes(message.command)) {
|
1343
|
+
throw new ProtocolError(`invalid command '${message.command}', only valid commands are: ${validCommands.join(', ')})`, data);
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
return message;
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
;
|
1352
|
+
exports.ProtocolError = ProtocolError;
|
1353
|
+
exports.Parser = Parser;
|
1354
|
+
|
1355
|
+
},{}],53:[function(require,module,exports){
|
1356
|
+
"use strict";
|
1357
|
+
|
1358
|
+
/* global CSSRule */
|
1359
|
+
const splitUrl = function (url) {
|
1360
|
+
let hash, index, params;
|
1361
|
+
|
1362
|
+
if ((index = url.indexOf('#')) >= 0) {
|
1363
|
+
hash = url.slice(index);
|
1364
|
+
url = url.slice(0, index);
|
1365
|
+
} else {
|
1366
|
+
hash = '';
|
1367
|
+
} // http://your.domain.com/path/to/combo/??file1.css,file2,css
|
1368
|
+
|
1369
|
+
|
1370
|
+
const comboSign = url.indexOf('??');
|
1371
|
+
|
1372
|
+
if (comboSign >= 0) {
|
1373
|
+
if (comboSign + 1 !== url.lastIndexOf('?')) {
|
1374
|
+
index = url.lastIndexOf('?');
|
1375
|
+
}
|
1376
|
+
} else {
|
1377
|
+
index = url.indexOf('?');
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
if (index >= 0) {
|
1381
|
+
params = url.slice(index);
|
1382
|
+
url = url.slice(0, index);
|
1383
|
+
} else {
|
1384
|
+
params = '';
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
return {
|
1388
|
+
url,
|
1389
|
+
params,
|
1390
|
+
hash
|
1391
|
+
};
|
1392
|
+
};
|
1393
|
+
|
1394
|
+
const pathFromUrl = function (url) {
|
1395
|
+
let path;
|
1396
|
+
({
|
1397
|
+
url
|
1398
|
+
} = splitUrl(url));
|
1399
|
+
|
1400
|
+
if (url.indexOf('file://') === 0) {
|
1401
|
+
path = url.replace(new RegExp(`^file://(localhost)?`), '');
|
1402
|
+
} else {
|
1403
|
+
// http : // hostname :8080 /
|
1404
|
+
path = url.replace(new RegExp(`^([^:]+:)?//([^:/]+)(:\\d*)?/`), '/');
|
1405
|
+
} // decodeURI has special handling of stuff like semicolons, so use decodeURIComponent
|
1406
|
+
|
1407
|
+
|
1408
|
+
return decodeURIComponent(path);
|
1409
|
+
};
|
1410
|
+
|
1411
|
+
const pickBestMatch = function (path, objects, pathFunc) {
|
1412
|
+
let score;
|
1413
|
+
let bestMatch = {
|
1414
|
+
score: 0
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
for (let object of objects) {
|
1418
|
+
score = numberOfMatchingSegments(path, pathFunc(object));
|
1419
|
+
|
1420
|
+
if (score > bestMatch.score) {
|
1421
|
+
bestMatch = {
|
1422
|
+
object,
|
1423
|
+
score
|
1424
|
+
};
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
if (bestMatch.score === 0) {
|
1429
|
+
return null;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
return bestMatch;
|
1433
|
+
};
|
1434
|
+
|
1435
|
+
var numberOfMatchingSegments = function (path1, path2) {
|
1436
|
+
// get rid of leading slashes and normalize to lower case
|
1437
|
+
path1 = path1.replace(/^\/+/, '').toLowerCase();
|
1438
|
+
path2 = path2.replace(/^\/+/, '').toLowerCase();
|
1439
|
+
|
1440
|
+
if (path1 === path2) {
|
1441
|
+
return 10000;
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
const comps1 = path1.split('/').reverse();
|
1445
|
+
const comps2 = path2.split('/').reverse();
|
1446
|
+
const len = Math.min(comps1.length, comps2.length);
|
1447
|
+
let eqCount = 0;
|
1448
|
+
|
1449
|
+
while (eqCount < len && comps1[eqCount] === comps2[eqCount]) {
|
1450
|
+
++eqCount;
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
return eqCount;
|
1454
|
+
};
|
1455
|
+
|
1456
|
+
const pathsMatch = (path1, path2) => numberOfMatchingSegments(path1, path2) > 0;
|
1457
|
+
|
1458
|
+
const IMAGE_STYLES = [{
|
1459
|
+
selector: 'background',
|
1460
|
+
styleNames: ['backgroundImage']
|
1461
|
+
}, {
|
1462
|
+
selector: 'border',
|
1463
|
+
styleNames: ['borderImage', 'webkitBorderImage', 'MozBorderImage']
|
1464
|
+
}];
|
1465
|
+
|
1466
|
+
class Reloader {
|
1467
|
+
constructor(window, console, Timer) {
|
1468
|
+
this.window = window;
|
1469
|
+
this.console = console;
|
1470
|
+
this.Timer = Timer;
|
1471
|
+
this.document = this.window.document;
|
1472
|
+
this.importCacheWaitPeriod = 200;
|
1473
|
+
this.plugins = [];
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
addPlugin(plugin) {
|
1477
|
+
return this.plugins.push(plugin);
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
analyze(callback) {}
|
1481
|
+
|
1482
|
+
reload(path, options) {
|
1483
|
+
this.options = options; // avoid passing it through all the funcs
|
1484
|
+
|
1485
|
+
if (!this.options.stylesheetReloadTimeout) {
|
1486
|
+
this.options.stylesheetReloadTimeout = 15000;
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
for (let plugin of Array.from(this.plugins)) {
|
1490
|
+
if (plugin.reload && plugin.reload(path, options)) {
|
1491
|
+
return;
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
if (options.liveCSS && path.match(/\.css(?:\.map)?$/i)) {
|
1496
|
+
if (this.reloadStylesheet(path)) {
|
1497
|
+
return;
|
1498
|
+
}
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
if (options.liveImg && path.match(/\.(jpe?g|png|gif)$/i)) {
|
1502
|
+
this.reloadImages(path);
|
1503
|
+
return;
|
1504
|
+
}
|
1505
|
+
|
1506
|
+
if (options.isChromeExtension) {
|
1507
|
+
this.reloadChromeExtension();
|
1508
|
+
return;
|
1509
|
+
}
|
1510
|
+
|
1511
|
+
return this.reloadPage();
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
reloadPage() {
|
1515
|
+
return this.window.document.location.reload();
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
reloadChromeExtension() {
|
1519
|
+
return this.window.chrome.runtime.reload();
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
reloadImages(path) {
|
1523
|
+
let img;
|
1524
|
+
const expando = this.generateUniqueString();
|
1525
|
+
|
1526
|
+
for (img of Array.from(this.document.images)) {
|
1527
|
+
if (pathsMatch(path, pathFromUrl(img.src))) {
|
1528
|
+
img.src = this.generateCacheBustUrl(img.src, expando);
|
1529
|
+
}
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
if (this.document.querySelectorAll) {
|
1533
|
+
for (let {
|
1534
|
+
selector,
|
1535
|
+
styleNames
|
1536
|
+
} of IMAGE_STYLES) {
|
1537
|
+
for (img of Array.from(this.document.querySelectorAll(`[style*=${selector}]`))) {
|
1538
|
+
this.reloadStyleImages(img.style, styleNames, path, expando);
|
1539
|
+
}
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
if (this.document.styleSheets) {
|
1544
|
+
return Array.from(this.document.styleSheets).map(styleSheet => this.reloadStylesheetImages(styleSheet, path, expando));
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
reloadStylesheetImages(styleSheet, path, expando) {
|
1549
|
+
let rules;
|
1550
|
+
|
1551
|
+
try {
|
1552
|
+
rules = (styleSheet || {}).cssRules;
|
1553
|
+
} catch (e) {}
|
1554
|
+
|
1555
|
+
if (!rules) {
|
1556
|
+
return;
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
for (let rule of Array.from(rules)) {
|
1560
|
+
switch (rule.type) {
|
1561
|
+
case CSSRule.IMPORT_RULE:
|
1562
|
+
this.reloadStylesheetImages(rule.styleSheet, path, expando);
|
1563
|
+
break;
|
1564
|
+
|
1565
|
+
case CSSRule.STYLE_RULE:
|
1566
|
+
for (let {
|
1567
|
+
styleNames
|
1568
|
+
} of IMAGE_STYLES) {
|
1569
|
+
this.reloadStyleImages(rule.style, styleNames, path, expando);
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
break;
|
1573
|
+
|
1574
|
+
case CSSRule.MEDIA_RULE:
|
1575
|
+
this.reloadStylesheetImages(rule, path, expando);
|
1576
|
+
break;
|
1577
|
+
}
|
1578
|
+
}
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
reloadStyleImages(style, styleNames, path, expando) {
|
1582
|
+
for (let styleName of styleNames) {
|
1583
|
+
const value = style[styleName];
|
1584
|
+
|
1585
|
+
if (typeof value === 'string') {
|
1586
|
+
const newValue = value.replace(new RegExp(`\\burl\\s*\\(([^)]*)\\)`), (match, src) => {
|
1587
|
+
if (pathsMatch(path, pathFromUrl(src))) {
|
1588
|
+
return `url(${this.generateCacheBustUrl(src, expando)})`;
|
1589
|
+
} else {
|
1590
|
+
return match;
|
1591
|
+
}
|
1592
|
+
});
|
1593
|
+
|
1594
|
+
if (newValue !== value) {
|
1595
|
+
style[styleName] = newValue;
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
reloadStylesheet(path) {
|
1602
|
+
// has to be a real array, because DOMNodeList will be modified
|
1603
|
+
let style;
|
1604
|
+
let link;
|
1605
|
+
|
1606
|
+
const links = (() => {
|
1607
|
+
const result = [];
|
1608
|
+
|
1609
|
+
for (link of Array.from(this.document.getElementsByTagName('link'))) {
|
1610
|
+
if (link.rel.match(/^stylesheet$/i) && !link.__LiveReload_pendingRemoval) {
|
1611
|
+
result.push(link);
|
1612
|
+
}
|
1613
|
+
}
|
1614
|
+
|
1615
|
+
return result;
|
1616
|
+
})(); // find all imported stylesheets
|
1617
|
+
|
1618
|
+
|
1619
|
+
const imported = [];
|
1620
|
+
|
1621
|
+
for (style of Array.from(this.document.getElementsByTagName('style'))) {
|
1622
|
+
if (style.sheet) {
|
1623
|
+
this.collectImportedStylesheets(style, style.sheet, imported);
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
for (link of Array.from(links)) {
|
1628
|
+
this.collectImportedStylesheets(link, link.sheet, imported);
|
1629
|
+
} // handle prefixfree
|
1630
|
+
|
1631
|
+
|
1632
|
+
if (this.window.StyleFix && this.document.querySelectorAll) {
|
1633
|
+
for (style of Array.from(this.document.querySelectorAll('style[data-href]'))) {
|
1634
|
+
links.push(style);
|
1635
|
+
}
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
this.console.log(`LiveReload found ${links.length} LINKed stylesheets, ${imported.length} @imported stylesheets`);
|
1639
|
+
const match = pickBestMatch(path, links.concat(imported), l => pathFromUrl(this.linkHref(l)));
|
1640
|
+
|
1641
|
+
if (match) {
|
1642
|
+
if (match.object.rule) {
|
1643
|
+
this.console.log(`LiveReload is reloading imported stylesheet: ${match.object.href}`);
|
1644
|
+
this.reattachImportedRule(match.object);
|
1645
|
+
} else {
|
1646
|
+
this.console.log(`LiveReload is reloading stylesheet: ${this.linkHref(match.object)}`);
|
1647
|
+
this.reattachStylesheetLink(match.object);
|
1648
|
+
}
|
1649
|
+
} else {
|
1650
|
+
if (this.options.reloadMissingCSS) {
|
1651
|
+
this.console.log(`LiveReload will reload all stylesheets because path '${path}' did not match any specific one. \
|
1652
|
+
To disable this behavior, set 'options.reloadMissingCSS' to 'false'.`);
|
1653
|
+
|
1654
|
+
for (link of Array.from(links)) {
|
1655
|
+
this.reattachStylesheetLink(link);
|
1656
|
+
}
|
1657
|
+
} else {
|
1658
|
+
this.console.log(`LiveReload will not reload path '${path}' because the stylesheet was not found on the page \
|
1659
|
+
and 'options.reloadMissingCSS' was set to 'false'.`);
|
1660
|
+
}
|
1661
|
+
}
|
1662
|
+
|
1663
|
+
return true;
|
1664
|
+
}
|
1665
|
+
|
1666
|
+
collectImportedStylesheets(link, styleSheet, result) {
|
1667
|
+
// in WebKit, styleSheet.cssRules is null for inaccessible stylesheets;
|
1668
|
+
// Firefox/Opera may throw exceptions
|
1669
|
+
let rules;
|
1670
|
+
|
1671
|
+
try {
|
1672
|
+
rules = (styleSheet || {}).cssRules;
|
1673
|
+
} catch (e) {}
|
1674
|
+
|
1675
|
+
if (rules && rules.length) {
|
1676
|
+
for (let index = 0; index < rules.length; index++) {
|
1677
|
+
const rule = rules[index];
|
1678
|
+
|
1679
|
+
switch (rule.type) {
|
1680
|
+
case CSSRule.CHARSET_RULE:
|
1681
|
+
continue;
|
1682
|
+
// do nothing
|
1683
|
+
|
1684
|
+
case CSSRule.IMPORT_RULE:
|
1685
|
+
result.push({
|
1686
|
+
link,
|
1687
|
+
rule,
|
1688
|
+
index,
|
1689
|
+
href: rule.href
|
1690
|
+
});
|
1691
|
+
this.collectImportedStylesheets(link, rule.styleSheet, result);
|
1692
|
+
break;
|
1693
|
+
|
1694
|
+
default:
|
1695
|
+
break;
|
1696
|
+
// import rules can only be preceded by charset rules
|
1697
|
+
}
|
1698
|
+
}
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
waitUntilCssLoads(clone, func) {
|
1703
|
+
let callbackExecuted = false;
|
1704
|
+
|
1705
|
+
const executeCallback = () => {
|
1706
|
+
if (callbackExecuted) {
|
1707
|
+
return;
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
callbackExecuted = true;
|
1711
|
+
return func();
|
1712
|
+
}; // supported by Chrome 19+, Safari 5.2+, Firefox 9+, Opera 9+, IE6+
|
1713
|
+
// http://www.zachleat.com/web/load-css-dynamically/
|
1714
|
+
// http://pieisgood.org/test/script-link-events/
|
1715
|
+
|
1716
|
+
|
1717
|
+
clone.onload = () => {
|
1718
|
+
this.console.log('LiveReload: the new stylesheet has finished loading');
|
1719
|
+
this.knownToSupportCssOnLoad = true;
|
1720
|
+
return executeCallback();
|
1721
|
+
};
|
1722
|
+
|
1723
|
+
if (!this.knownToSupportCssOnLoad) {
|
1724
|
+
// polling
|
1725
|
+
let poll;
|
1726
|
+
(poll = () => {
|
1727
|
+
if (clone.sheet) {
|
1728
|
+
this.console.log('LiveReload is polling until the new CSS finishes loading...');
|
1729
|
+
return executeCallback();
|
1730
|
+
} else {
|
1731
|
+
return this.Timer.start(50, poll);
|
1732
|
+
}
|
1733
|
+
})();
|
1734
|
+
} // fail safe
|
1735
|
+
|
1736
|
+
|
1737
|
+
return this.Timer.start(this.options.stylesheetReloadTimeout, executeCallback);
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
linkHref(link) {
|
1741
|
+
// prefixfree uses data-href when it turns LINK into STYLE
|
1742
|
+
return link.href || link.getAttribute('data-href');
|
1743
|
+
}
|
1744
|
+
|
1745
|
+
reattachStylesheetLink(link) {
|
1746
|
+
// ignore LINKs that will be removed by LR soon
|
1747
|
+
let clone;
|
1748
|
+
|
1749
|
+
if (link.__LiveReload_pendingRemoval) {
|
1750
|
+
return;
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
link.__LiveReload_pendingRemoval = true;
|
1754
|
+
|
1755
|
+
if (link.tagName === 'STYLE') {
|
1756
|
+
// prefixfree
|
1757
|
+
clone = this.document.createElement('link');
|
1758
|
+
clone.rel = 'stylesheet';
|
1759
|
+
clone.media = link.media;
|
1760
|
+
clone.disabled = link.disabled;
|
1761
|
+
} else {
|
1762
|
+
clone = link.cloneNode(false);
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
clone.href = this.generateCacheBustUrl(this.linkHref(link)); // insert the new LINK before the old one
|
1766
|
+
|
1767
|
+
const parent = link.parentNode;
|
1768
|
+
|
1769
|
+
if (parent.lastChild === link) {
|
1770
|
+
parent.appendChild(clone);
|
1771
|
+
} else {
|
1772
|
+
parent.insertBefore(clone, link.nextSibling);
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
return this.waitUntilCssLoads(clone, () => {
|
1776
|
+
let additionalWaitingTime;
|
1777
|
+
|
1778
|
+
if (/AppleWebKit/.test(navigator.userAgent)) {
|
1779
|
+
additionalWaitingTime = 5;
|
1780
|
+
} else {
|
1781
|
+
additionalWaitingTime = 200;
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
return this.Timer.start(additionalWaitingTime, () => {
|
1785
|
+
if (!link.parentNode) {
|
1786
|
+
return;
|
1787
|
+
}
|
1788
|
+
|
1789
|
+
link.parentNode.removeChild(link);
|
1790
|
+
clone.onreadystatechange = null;
|
1791
|
+
return this.window.StyleFix ? this.window.StyleFix.link(clone) : undefined;
|
1792
|
+
});
|
1793
|
+
}); // prefixfree
|
1794
|
+
}
|
1795
|
+
|
1796
|
+
reattachImportedRule({
|
1797
|
+
rule,
|
1798
|
+
index,
|
1799
|
+
link
|
1800
|
+
}) {
|
1801
|
+
const parent = rule.parentStyleSheet;
|
1802
|
+
const href = this.generateCacheBustUrl(rule.href);
|
1803
|
+
const media = rule.media.length ? [].join.call(rule.media, ', ') : '';
|
1804
|
+
const newRule = `@import url("${href}") ${media};`; // used to detect if reattachImportedRule has been called again on the same rule
|
1805
|
+
|
1806
|
+
rule.__LiveReload_newHref = href; // WORKAROUND FOR WEBKIT BUG: WebKit resets all styles if we add @import'ed
|
1807
|
+
// stylesheet that hasn't been cached yet. Workaround is to pre-cache the
|
1808
|
+
// stylesheet by temporarily adding it as a LINK tag.
|
1809
|
+
|
1810
|
+
const tempLink = this.document.createElement('link');
|
1811
|
+
tempLink.rel = 'stylesheet';
|
1812
|
+
tempLink.href = href;
|
1813
|
+
tempLink.__LiveReload_pendingRemoval = true; // exclude from path matching
|
1814
|
+
|
1815
|
+
if (link.parentNode) {
|
1816
|
+
link.parentNode.insertBefore(tempLink, link);
|
1817
|
+
} // wait for it to load
|
1818
|
+
|
1819
|
+
|
1820
|
+
return this.Timer.start(this.importCacheWaitPeriod, () => {
|
1821
|
+
if (tempLink.parentNode) {
|
1822
|
+
tempLink.parentNode.removeChild(tempLink);
|
1823
|
+
} // if another reattachImportedRule call is in progress, abandon this one
|
1824
|
+
|
1825
|
+
|
1826
|
+
if (rule.__LiveReload_newHref !== href) {
|
1827
|
+
return;
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
parent.insertRule(newRule, index);
|
1831
|
+
parent.deleteRule(index + 1); // save the new rule, so that we can detect another reattachImportedRule call
|
1832
|
+
|
1833
|
+
rule = parent.cssRules[index];
|
1834
|
+
rule.__LiveReload_newHref = href; // repeat again for good measure
|
1835
|
+
|
1836
|
+
return this.Timer.start(this.importCacheWaitPeriod, () => {
|
1837
|
+
// if another reattachImportedRule call is in progress, abandon this one
|
1838
|
+
if (rule.__LiveReload_newHref !== href) {
|
1839
|
+
return;
|
1840
|
+
}
|
1841
|
+
|
1842
|
+
parent.insertRule(newRule, index);
|
1843
|
+
return parent.deleteRule(index + 1);
|
1844
|
+
});
|
1845
|
+
});
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
generateUniqueString() {
|
1849
|
+
return `livereload=${Date.now()}`;
|
1850
|
+
}
|
1851
|
+
|
1852
|
+
generateCacheBustUrl(url, expando) {
|
1853
|
+
let hash, oldParams;
|
1854
|
+
|
1855
|
+
if (!expando) {
|
1856
|
+
expando = this.generateUniqueString();
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
({
|
1860
|
+
url,
|
1861
|
+
hash,
|
1862
|
+
params: oldParams
|
1863
|
+
} = splitUrl(url));
|
1864
|
+
|
1865
|
+
if (this.options.overrideURL) {
|
1866
|
+
if (url.indexOf(this.options.serverURL) < 0) {
|
1867
|
+
const originalUrl = url;
|
1868
|
+
url = this.options.serverURL + this.options.overrideURL + '?url=' + encodeURIComponent(url);
|
1869
|
+
this.console.log(`LiveReload is overriding source URL ${originalUrl} with ${url}`);
|
1870
|
+
}
|
1871
|
+
}
|
1872
|
+
|
1873
|
+
let params = oldParams.replace(/(\?|&)livereload=(\d+)/, (match, sep) => `${sep}${expando}`);
|
1874
|
+
|
1875
|
+
if (params === oldParams) {
|
1876
|
+
if (oldParams.length === 0) {
|
1877
|
+
params = `?${expando}`;
|
1878
|
+
} else {
|
1879
|
+
params = `${oldParams}&${expando}`;
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
|
1883
|
+
return url + params + hash;
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
}
|
1887
|
+
|
1888
|
+
;
|
1889
|
+
exports.Reloader = Reloader;
|
1890
|
+
|
1891
|
+
},{}],54:[function(require,module,exports){
|
1892
|
+
"use strict";
|
1893
|
+
|
1894
|
+
const CustomEvents = require('./customevents');
|
1895
|
+
|
1896
|
+
const LiveReload = window.LiveReload = new (require('./livereload').LiveReload)(window);
|
1897
|
+
|
1898
|
+
for (let k in window) {
|
1899
|
+
if (k.match(/^LiveReloadPlugin/)) {
|
1900
|
+
LiveReload.addPlugin(window[k]);
|
1901
|
+
}
|
1902
|
+
}
|
1903
|
+
|
1904
|
+
LiveReload.addPlugin(require('./less'));
|
1905
|
+
LiveReload.on('shutdown', () => delete window.LiveReload);
|
1906
|
+
LiveReload.on('connect', () => CustomEvents.fire(document, 'LiveReloadConnect'));
|
1907
|
+
LiveReload.on('disconnect', () => CustomEvents.fire(document, 'LiveReloadDisconnect'));
|
1908
|
+
CustomEvents.bind(document, 'LiveReloadShutDown', () => LiveReload.shutDown());
|
1909
|
+
|
1910
|
+
},{"./customevents":48,"./less":49,"./livereload":50}],55:[function(require,module,exports){
|
1911
|
+
"use strict";
|
1912
|
+
|
1913
|
+
class Timer {
|
1914
|
+
constructor(func) {
|
1915
|
+
this.func = func;
|
1916
|
+
this.running = false;
|
1917
|
+
this.id = null;
|
1918
|
+
|
1919
|
+
this._handler = () => {
|
1920
|
+
this.running = false;
|
1921
|
+
this.id = null;
|
1922
|
+
return this.func();
|
1923
|
+
};
|
1924
|
+
}
|
1925
|
+
|
1926
|
+
start(timeout) {
|
1927
|
+
if (this.running) {
|
1928
|
+
clearTimeout(this.id);
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
this.id = setTimeout(this._handler, timeout);
|
1932
|
+
this.running = true;
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
stop() {
|
1936
|
+
if (this.running) {
|
1937
|
+
clearTimeout(this.id);
|
1938
|
+
this.running = false;
|
1939
|
+
this.id = null;
|
1940
|
+
}
|
1941
|
+
}
|
1942
|
+
|
1943
|
+
}
|
1944
|
+
|
1945
|
+
;
|
1946
|
+
|
1947
|
+
Timer.start = (timeout, func) => setTimeout(func, timeout);
|
1948
|
+
|
1949
|
+
exports.Timer = Timer;
|
1950
|
+
|
1951
|
+
},{}]},{},[54]);
|