UNPKG

10.7 kBJavaScriptView Raw
1// modules are defined as an array
2// [ module function, map of requires ]
3//
4// map of requires is short require name -> numeric require
5//
6// anything defined in a previous bundle is accessed via the
7// orig method which is the require for previous bundles
8parcelRequire = (function (modules, cache, entry, globalName) {
9 // Save the require from previous bundle to this closure if any
10 var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
11 var nodeRequire = typeof require === 'function' && require;
12
13 function newRequire(name, jumped) {
14 if (!cache[name]) {
15 if (!modules[name]) {
16 // if we cannot find the module within our internal map or
17 // cache jump to the current global require ie. the last bundle
18 // that was added to the page.
19 var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
20 if (!jumped && currentRequire) {
21 return currentRequire(name, true);
22 }
23
24 // If there are other bundles on this page the require from the
25 // previous one is saved to 'previousRequire'. Repeat this as
26 // many times as there are bundles until the module is found or
27 // we exhaust the require chain.
28 if (previousRequire) {
29 return previousRequire(name, true);
30 }
31
32 // Try the node require function if it exists.
33 if (nodeRequire && typeof name === 'string') {
34 return nodeRequire(name);
35 }
36
37 var err = new Error('Cannot find module \'' + name + '\'');
38 err.code = 'MODULE_NOT_FOUND';
39 throw err;
40 }
41
42 localRequire.resolve = resolve;
43 localRequire.cache = {};
44
45 var module = cache[name] = new newRequire.Module(name);
46
47 modules[name][0].call(module.exports, localRequire, module, module.exports, this);
48 }
49
50 return cache[name].exports;
51
52 function localRequire(x){
53 return newRequire(localRequire.resolve(x));
54 }
55
56 function resolve(x){
57 return modules[name][1][x] || x;
58 }
59 }
60
61 function Module(moduleName) {
62 this.id = moduleName;
63 this.bundle = newRequire;
64 this.exports = {};
65 }
66
67 newRequire.isParcelRequire = true;
68 newRequire.Module = Module;
69 newRequire.modules = modules;
70 newRequire.cache = cache;
71 newRequire.parent = previousRequire;
72 newRequire.register = function (id, exports) {
73 modules[id] = [function (require, module) {
74 module.exports = exports;
75 }, {}];
76 };
77
78 var error;
79 for (var i = 0; i < entry.length; i++) {
80 try {
81 newRequire(entry[i]);
82 } catch (e) {
83 // Save first error but execute all entries
84 if (!error) {
85 error = e;
86 }
87 }
88 }
89
90 if (entry.length) {
91 // Expose entry point to Node, AMD or browser globals
92 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
93 var mainExports = newRequire(entry[entry.length - 1]);
94
95 // CommonJS
96 if (typeof exports === "object" && typeof module !== "undefined") {
97 module.exports = mainExports;
98
99 // RequireJS
100 } else if (typeof define === "function" && define.amd) {
101 define(function () {
102 return mainExports;
103 });
104
105 // <script>
106 } else if (globalName) {
107 this[globalName] = mainExports;
108 }
109 }
110
111 // Override the current require with this new one
112 parcelRequire = newRequire;
113
114 if (error) {
115 // throw error from earlier, _after updating parcelRequire_
116 throw error;
117 }
118
119 return newRequire;
120})({"../../node_modules/parcel/src/builtins/bundle-url.js":[function(require,module,exports) {
121var bundleURL = null;
122
123function getBundleURLCached() {
124 if (!bundleURL) {
125 bundleURL = getBundleURL();
126 }
127
128 return bundleURL;
129}
130
131function getBundleURL() {
132 // Attempt to find the URL of the current script and use that as the base URL
133 try {
134 throw new Error();
135 } catch (err) {
136 var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);
137
138 if (matches) {
139 return getBaseURL(matches[0]);
140 }
141 }
142
143 return '/';
144}
145
146function getBaseURL(url) {
147 return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/, '$1') + '/';
148}
149
150exports.getBundleURL = getBundleURLCached;
151exports.getBaseURL = getBaseURL;
152},{}],"../../node_modules/parcel/src/builtins/css-loader.js":[function(require,module,exports) {
153var bundle = require('./bundle-url');
154
155function updateLink(link) {
156 var newLink = link.cloneNode();
157
158 newLink.onload = function () {
159 link.remove();
160 };
161
162 newLink.href = link.href.split('?')[0] + '?' + Date.now();
163 link.parentNode.insertBefore(newLink, link.nextSibling);
164}
165
166var cssTimeout = null;
167
168function reloadCSS() {
169 if (cssTimeout) {
170 return;
171 }
172
173 cssTimeout = setTimeout(function () {
174 var links = document.querySelectorAll('link[rel="stylesheet"]');
175
176 for (var i = 0; i < links.length; i++) {
177 if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
178 updateLink(links[i]);
179 }
180 }
181
182 cssTimeout = null;
183 }, 50);
184}
185
186module.exports = reloadCSS;
187},{"./bundle-url":"../../node_modules/parcel/src/builtins/bundle-url.js"}],"../../node_modules/parcel/src/builtins/hmr-runtime.js":[function(require,module,exports) {
188var global = arguments[3];
189var OVERLAY_ID = '__parcel__error__overlay__';
190var OldModule = module.bundle.Module;
191
192function Module(moduleName) {
193 OldModule.call(this, moduleName);
194 this.hot = {
195 data: module.bundle.hotData,
196 _acceptCallbacks: [],
197 _disposeCallbacks: [],
198 accept: function (fn) {
199 this._acceptCallbacks.push(fn || function () {});
200 },
201 dispose: function (fn) {
202 this._disposeCallbacks.push(fn);
203 }
204 };
205 module.bundle.hotData = null;
206}
207
208module.bundle.Module = Module;
209var checkedAssets, assetsToAccept;
210var parent = module.bundle.parent;
211
212if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
213 var hostname = "" || location.hostname;
214 var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
215 var ws = new WebSocket(protocol + '://' + hostname + ':' + "55215" + '/');
216
217 ws.onmessage = function (event) {
218 checkedAssets = {};
219 assetsToAccept = [];
220 var data = JSON.parse(event.data);
221
222 if (data.type === 'update') {
223 var handled = false;
224 data.assets.forEach(function (asset) {
225 if (!asset.isNew) {
226 var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);
227
228 if (didAccept) {
229 handled = true;
230 }
231 }
232 }); // Enable HMR for CSS by default.
233
234 handled = handled || data.assets.every(function (asset) {
235 return asset.type === 'css' && asset.generated.js;
236 });
237
238 if (handled) {
239 console.clear();
240 data.assets.forEach(function (asset) {
241 hmrApply(global.parcelRequire, asset);
242 });
243 assetsToAccept.forEach(function (v) {
244 hmrAcceptRun(v[0], v[1]);
245 });
246 } else if (location.reload) {
247 // `location` global exists in a web worker context but lacks `.reload()` function.
248 location.reload();
249 }
250 }
251
252 if (data.type === 'reload') {
253 ws.close();
254
255 ws.onclose = function () {
256 location.reload();
257 };
258 }
259
260 if (data.type === 'error-resolved') {
261 console.log('[parcel] ✨ Error resolved');
262 removeErrorOverlay();
263 }
264
265 if (data.type === 'error') {
266 console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
267 removeErrorOverlay();
268 var overlay = createErrorOverlay(data);
269 document.body.appendChild(overlay);
270 }
271 };
272}
273
274function removeErrorOverlay() {
275 var overlay = document.getElementById(OVERLAY_ID);
276
277 if (overlay) {
278 overlay.remove();
279 }
280}
281
282function createErrorOverlay(data) {
283 var overlay = document.createElement('div');
284 overlay.id = OVERLAY_ID; // html encode message and stack trace
285
286 var message = document.createElement('div');
287 var stackTrace = document.createElement('pre');
288 message.innerText = data.error.message;
289 stackTrace.innerText = data.error.stack;
290 overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
291 return overlay;
292}
293
294function getParents(bundle, id) {
295 var modules = bundle.modules;
296
297 if (!modules) {
298 return [];
299 }
300
301 var parents = [];
302 var k, d, dep;
303
304 for (k in modules) {
305 for (d in modules[k][1]) {
306 dep = modules[k][1][d];
307
308 if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
309 parents.push(k);
310 }
311 }
312 }
313
314 if (bundle.parent) {
315 parents = parents.concat(getParents(bundle.parent, id));
316 }
317
318 return parents;
319}
320
321function hmrApply(bundle, asset) {
322 var modules = bundle.modules;
323
324 if (!modules) {
325 return;
326 }
327
328 if (modules[asset.id] || !bundle.parent) {
329 var fn = new Function('require', 'module', 'exports', asset.generated.js);
330 asset.isNew = !modules[asset.id];
331 modules[asset.id] = [fn, asset.deps];
332 } else if (bundle.parent) {
333 hmrApply(bundle.parent, asset);
334 }
335}
336
337function hmrAcceptCheck(bundle, id) {
338 var modules = bundle.modules;
339
340 if (!modules) {
341 return;
342 }
343
344 if (!modules[id] && bundle.parent) {
345 return hmrAcceptCheck(bundle.parent, id);
346 }
347
348 if (checkedAssets[id]) {
349 return;
350 }
351
352 checkedAssets[id] = true;
353 var cached = bundle.cache[id];
354 assetsToAccept.push([bundle, id]);
355
356 if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
357 return true;
358 }
359
360 return getParents(global.parcelRequire, id).some(function (id) {
361 return hmrAcceptCheck(global.parcelRequire, id);
362 });
363}
364
365function hmrAcceptRun(bundle, id) {
366 var cached = bundle.cache[id];
367 bundle.hotData = {};
368
369 if (cached) {
370 cached.hot.data = bundle.hotData;
371 }
372
373 if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
374 cached.hot._disposeCallbacks.forEach(function (cb) {
375 cb(bundle.hotData);
376 });
377 }
378
379 delete bundle.cache[id];
380 bundle(id);
381 cached = bundle.cache[id];
382
383 if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
384 cached.hot._acceptCallbacks.forEach(function (cb) {
385 cb();
386 });
387
388 return true;
389 }
390}
391},{}]},{},["../../node_modules/parcel/src/builtins/hmr-runtime.js"], null)
392//# sourceMappingURL=/tachyons.49dc960e.js.map
\No newline at end of file