1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var tslib_1 = require("tslib");
|
---|
4 | var utils_1 = require("./utils");
|
---|
5 | var browser_1 = tslib_1.__importDefault(require("./browser"));
|
---|
6 | exports.default = (function (window, options) {
|
---|
7 | // use options from the current script tag data attribues
|
---|
8 | utils_1.addDataAttr(options, browser_1.default.currentScript(window));
|
---|
9 | if (options.isFileProtocol === undefined) {
|
---|
10 | options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol);
|
---|
11 | }
|
---|
12 | // Load styles asynchronously (default: false)
|
---|
13 | //
|
---|
14 | // This is set to `false` by default, so that the body
|
---|
15 | // doesn't start loading before the stylesheets are parsed.
|
---|
16 | // Setting this to `true` can result in flickering.
|
---|
17 | //
|
---|
18 | options.async = options.async || false;
|
---|
19 | options.fileAsync = options.fileAsync || false;
|
---|
20 | // Interval between watch polls
|
---|
21 | options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500);
|
---|
22 | options.env = options.env || (window.location.hostname == '127.0.0.1' ||
|
---|
23 | window.location.hostname == '0.0.0.0' ||
|
---|
24 | window.location.hostname == 'localhost' ||
|
---|
25 | (window.location.port &&
|
---|
26 | window.location.port.length > 0) ||
|
---|
27 | options.isFileProtocol ? 'development'
|
---|
28 | : 'production');
|
---|
29 | var dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash);
|
---|
30 | if (dumpLineNumbers) {
|
---|
31 | options.dumpLineNumbers = dumpLineNumbers[1];
|
---|
32 | }
|
---|
33 | if (options.useFileCache === undefined) {
|
---|
34 | options.useFileCache = true;
|
---|
35 | }
|
---|
36 | if (options.onReady === undefined) {
|
---|
37 | options.onReady = true;
|
---|
38 | }
|
---|
39 | if (options.relativeUrls) {
|
---|
40 | options.rewriteUrls = 'all';
|
---|
41 | }
|
---|
42 | });
|
---|
43 | //# sourceMappingURL=add-default-options.js.map |
---|