forked from jantimon/html-webpack-plugin
/
bundle.js
389 lines (347 loc) · 9.96 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 636:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 656:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var pug = __webpack_require__(79);
function template(locals) {var pug_html = "", pug_mixins = {}, pug_interp;;
var locals_for_with = (locals || {});
(function (time) {
pug_html = pug_html + "\u003C!-- this partial is used for frontend and backend--\u003E\u003Cdiv class=\"time\"\u003E \u003Cb\u003ECurrent time\u003C\u002Fb\u003E\u003Cp\u003E" + (pug.escape(null == (pug_interp = time.toISOString()) ? "" : pug_interp)) + "\u003C\u002Fp\u003E\u003C\u002Fdiv\u003E\u003Cimg src=\"#{require('.\u002Flogo.png')}\"\u003E";
}.call(this, "time" in locals_for_with ?
locals_for_with.time :
typeof time !== 'undefined' ? time : undefined));
;;return pug_html;};
module.exports = template;
/***/ }),
/***/ 79:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var pug_has_own_property = Object.prototype.hasOwnProperty;
/**
* Merge two attribute objects giving precedence
* to values in object `b`. Classes are special-cased
* allowing for arrays and merging/joining appropriately
* resulting in a string.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api private
*/
exports.merge = pug_merge;
function pug_merge(a, b) {
if (arguments.length === 1) {
var attrs = a[0];
for (var i = 1; i < a.length; i++) {
attrs = pug_merge(attrs, a[i]);
}
return attrs;
}
for (var key in b) {
if (key === 'class') {
var valA = a[key] || [];
a[key] = (Array.isArray(valA) ? valA : [valA]).concat(b[key] || []);
} else if (key === 'style') {
var valA = pug_style(a[key]);
valA = valA && valA[valA.length - 1] !== ';' ? valA + ';' : valA;
var valB = pug_style(b[key]);
valB = valB && valB[valB.length - 1] !== ';' ? valB + ';' : valB;
a[key] = valA + valB;
} else {
a[key] = b[key];
}
}
return a;
}
/**
* Process array, object, or string as a string of classes delimited by a space.
*
* If `val` is an array, all members of it and its subarrays are counted as
* classes. If `escaping` is an array, then whether or not the item in `val` is
* escaped depends on the corresponding item in `escaping`. If `escaping` is
* not an array, no escaping is done.
*
* If `val` is an object, all the keys whose value is truthy are counted as
* classes. No escaping is done.
*
* If `val` is a string, it is counted as a class. No escaping is done.
*
* @param {(Array.<string>|Object.<string, boolean>|string)} val
* @param {?Array.<string>} escaping
* @return {String}
*/
exports.classes = pug_classes;
function pug_classes_array(val, escaping) {
var classString = '',
className,
padding = '',
escapeEnabled = Array.isArray(escaping);
for (var i = 0; i < val.length; i++) {
className = pug_classes(val[i]);
if (!className) continue;
escapeEnabled && escaping[i] && (className = pug_escape(className));
classString = classString + padding + className;
padding = ' ';
}
return classString;
}
function pug_classes_object(val) {
var classString = '',
padding = '';
for (var key in val) {
if (key && val[key] && pug_has_own_property.call(val, key)) {
classString = classString + padding + key;
padding = ' ';
}
}
return classString;
}
function pug_classes(val, escaping) {
if (Array.isArray(val)) {
return pug_classes_array(val, escaping);
} else if (val && typeof val === 'object') {
return pug_classes_object(val);
} else {
return val || '';
}
}
/**
* Convert object or string to a string of CSS styles delimited by a semicolon.
*
* @param {(Object.<string, string>|string)} val
* @return {String}
*/
exports.style = pug_style;
function pug_style(val) {
if (!val) return '';
if (typeof val === 'object') {
var out = '';
for (var style in val) {
/* istanbul ignore else */
if (pug_has_own_property.call(val, style)) {
out = out + style + ':' + val[style] + ';';
}
}
return out;
} else {
return val + '';
}
}
/**
* Render the given attribute.
*
* @param {String} key
* @param {String} val
* @param {Boolean} escaped
* @param {Boolean} terse
* @return {String}
*/
exports.attr = pug_attr;
function pug_attr(key, val, escaped, terse) {
if (
val === false ||
val == null ||
(!val && (key === 'class' || key === 'style'))
) {
return '';
}
if (val === true) {
return ' ' + (terse ? key : key + '="' + key + '"');
}
var type = typeof val;
if (
(type === 'object' || type === 'function') &&
typeof val.toJSON === 'function'
) {
val = val.toJSON();
}
if (typeof val !== 'string') {
val = JSON.stringify(val);
if (!escaped && val.indexOf('"') !== -1) {
return ' ' + key + "='" + val.replace(/'/g, ''') + "'";
}
}
if (escaped) val = pug_escape(val);
return ' ' + key + '="' + val + '"';
}
/**
* Render the given attributes object.
*
* @param {Object} obj
* @param {Object} terse whether to use HTML5 terse boolean attributes
* @return {String}
*/
exports.attrs = pug_attrs;
function pug_attrs(obj, terse) {
var attrs = '';
for (var key in obj) {
if (pug_has_own_property.call(obj, key)) {
var val = obj[key];
if ('class' === key) {
val = pug_classes(val);
attrs = pug_attr(key, val, false, terse) + attrs;
continue;
}
if ('style' === key) {
val = pug_style(val);
}
attrs += pug_attr(key, val, false, terse);
}
}
return attrs;
}
/**
* Escape the given string of `html`.
*
* @param {String} html
* @return {String}
* @api private
*/
var pug_match_html = /["&<>]/;
exports.escape = pug_escape;
function pug_escape(_html) {
var html = '' + _html;
var regexResult = pug_match_html.exec(html);
if (!regexResult) return _html;
var result = '';
var i, lastIndex, escape;
for (i = regexResult.index, lastIndex = 0; i < html.length; i++) {
switch (html.charCodeAt(i)) {
case 34:
escape = '"';
break;
case 38:
escape = '&';
break;
case 60:
escape = '<';
break;
case 62:
escape = '>';
break;
default:
continue;
}
if (lastIndex !== i) result += html.substring(lastIndex, i);
lastIndex = i + 1;
result += escape;
}
if (lastIndex !== i) return result + html.substring(lastIndex, i);
else return result;
}
/**
* Re-throw the given `err` in context to the
* the pug in `filename` at the given `lineno`.
*
* @param {Error} err
* @param {String} filename
* @param {String} lineno
* @param {String} str original source
* @api private
*/
exports.rethrow = pug_rethrow;
function pug_rethrow(err, filename, lineno, str) {
if (!(err instanceof Error)) throw err;
if ((typeof window != 'undefined' || !filename) && !str) {
err.message += ' on line ' + lineno;
throw err;
}
var context, lines, start, end;
try {
str = str || __webpack_require__(993).readFileSync(filename, {encoding: 'utf8'});
context = 3;
lines = str.split('\n');
start = Math.max(lineno - context, 0);
end = Math.min(lines.length, lineno + context);
} catch (ex) {
err.message +=
' - could not read from ' + filename + ' (' + ex.message + ')';
pug_rethrow(err, null, lineno);
return;
}
// Error context
context = lines
.slice(start, end)
.map(function(line, i) {
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ') + curr + '| ' + line;
})
.join('\n');
// Alter exception message
err.path = filename;
try {
err.message =
(filename || 'Pug') +
':' +
lineno +
'\n' +
context +
'\n\n' +
err.message;
} catch (e) {}
throw err;
}
/***/ }),
/***/ 993:
/***/ (() => {
/* (ignored) */
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
__webpack_require__(636);
// Use the same template for the frontend code
var template = __webpack_require__(656);
setInterval(function () {
var div = document.getElementById('main');
div.innerHTML = template({ time: new Date() });
div.style.color = 'navy';
}, 1000);
})();
/******/ })()
;