前端代码
This commit is contained in:
62
node_modules/browser-sync/dist/args.js
generated
vendored
Normal file
62
node_modules/browser-sync/dist/args.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
/**
|
||||
* The purpose of this function is
|
||||
* to handle back-backwards compatibility
|
||||
* @param {Object} args
|
||||
* @returns {{config: {}, cb: *}}
|
||||
*/
|
||||
module.exports = function (args) {
|
||||
var config = {};
|
||||
var cb;
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (isFilesArg(args[0])) {
|
||||
config.files = args[0];
|
||||
}
|
||||
else if (typeof args[0] === "function") {
|
||||
cb = args[0];
|
||||
}
|
||||
else {
|
||||
config = args[0];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// if second is a function, first MUST be config
|
||||
if (typeof args[1] === "function") {
|
||||
config = args[0] || {};
|
||||
cb = args[1];
|
||||
}
|
||||
else {
|
||||
if (args[1] === null || args[1] === undefined) {
|
||||
config = args[0];
|
||||
}
|
||||
else {
|
||||
// finally, second arg could be a plain object for config
|
||||
config = args[1] || {};
|
||||
if (!config.files) {
|
||||
config.files = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
config = args[1] || {};
|
||||
if (!config.files) {
|
||||
config.files = args[0];
|
||||
}
|
||||
cb = args[2];
|
||||
}
|
||||
return {
|
||||
config: config,
|
||||
cb: cb
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Files args were only ever strings or arrays
|
||||
* @param arg
|
||||
* @returns {*|boolean}
|
||||
*/
|
||||
function isFilesArg(arg) {
|
||||
return Array.isArray(arg) || typeof arg === "string";
|
||||
}
|
||||
//# sourceMappingURL=args.js.map
|
1
node_modules/browser-sync/dist/args.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/args.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"args.js","sourceRoot":"","sources":["../lib/args.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;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AAC,CAAC,CAAC,CAAC;aAC1B;YAED,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;KACpB;IAED,OAAO;QACH,MAAM,EAAE,MAAM;QACd,EAAE,EAAE,EAAE;KACT,CAAC;AACN,CAAC,CAAC;AAEF;;;;GAIG;AACH,SAAS,UAAU,CAAC,GAAG;IACnB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACzD,CAAC"}
|
60
node_modules/browser-sync/dist/async-tasks.js
generated
vendored
Normal file
60
node_modules/browser-sync/dist/async-tasks.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
var async = require("./async");
|
||||
module.exports = [
|
||||
{
|
||||
step: "Finding an empty port",
|
||||
fn: async.getEmptyPort
|
||||
},
|
||||
{
|
||||
step: "Getting an extra port for Proxy",
|
||||
fn: async.getExtraPortForProxy
|
||||
},
|
||||
{
|
||||
step: "Checking online status",
|
||||
fn: async.getOnlineStatus
|
||||
},
|
||||
{
|
||||
step: "Resolve user plugins from options",
|
||||
fn: async.resolveInlineUserPlugins
|
||||
},
|
||||
{
|
||||
step: "Set Urls and other options that rely on port/online status",
|
||||
fn: async.setOptions
|
||||
},
|
||||
{
|
||||
step: "Setting Internal Events",
|
||||
fn: async.setInternalEvents
|
||||
},
|
||||
{
|
||||
step: "Setting file watchers",
|
||||
fn: async.setFileWatchers
|
||||
},
|
||||
{
|
||||
step: "Merging middlewares from core + plugins",
|
||||
fn: async.mergeMiddlewares
|
||||
},
|
||||
{
|
||||
step: "Starting the Server",
|
||||
fn: async.startServer
|
||||
},
|
||||
{
|
||||
step: "Starting the HTTPS Tunnel",
|
||||
fn: async.startTunnel
|
||||
},
|
||||
{
|
||||
step: "Starting the web-socket server",
|
||||
fn: async.startSockets
|
||||
},
|
||||
{
|
||||
step: "Starting the UI",
|
||||
fn: async.startUi
|
||||
},
|
||||
{
|
||||
step: "Merge UI settings",
|
||||
fn: async.mergeUiSettings
|
||||
},
|
||||
{
|
||||
step: "Init user plugins",
|
||||
fn: async.initUserPlugins
|
||||
}
|
||||
];
|
||||
//# sourceMappingURL=async-tasks.js.map
|
1
node_modules/browser-sync/dist/async-tasks.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/async-tasks.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-tasks.js","sourceRoot":"","sources":["../lib/async-tasks.js"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAE/B,MAAM,CAAC,OAAO,GAAG;IACb;QACI,IAAI,EAAE,uBAAuB;QAC7B,EAAE,EAAE,KAAK,CAAC,YAAY;KACzB;IACD;QACI,IAAI,EAAE,iCAAiC;QACvC,EAAE,EAAE,KAAK,CAAC,oBAAoB;KACjC;IACD;QACI,IAAI,EAAE,wBAAwB;QAC9B,EAAE,EAAE,KAAK,CAAC,eAAe;KAC5B;IACD;QACI,IAAI,EAAE,mCAAmC;QACzC,EAAE,EAAE,KAAK,CAAC,wBAAwB;KACrC;IACD;QACI,IAAI,EAAE,4DAA4D;QAClE,EAAE,EAAE,KAAK,CAAC,UAAU;KACvB;IACD;QACI,IAAI,EAAE,yBAAyB;QAC/B,EAAE,EAAE,KAAK,CAAC,iBAAiB;KAC9B;IACD;QACI,IAAI,EAAE,uBAAuB;QAC7B,EAAE,EAAE,KAAK,CAAC,eAAe;KAC5B;IACD;QACI,IAAI,EAAE,yCAAyC;QAC/C,EAAE,EAAE,KAAK,CAAC,gBAAgB;KAC7B;IACD;QACI,IAAI,EAAE,qBAAqB;QAC3B,EAAE,EAAE,KAAK,CAAC,WAAW;KACxB;IACD;QACI,IAAI,EAAE,2BAA2B;QACjC,EAAE,EAAE,KAAK,CAAC,WAAW;KACxB;IACD;QACI,IAAI,EAAE,gCAAgC;QACtC,EAAE,EAAE,KAAK,CAAC,YAAY;KACzB;IACD;QACI,IAAI,EAAE,iBAAiB;QACvB,EAAE,EAAE,KAAK,CAAC,OAAO;KACpB;IACD;QACI,IAAI,EAAE,mBAAmB;QACzB,EAAE,EAAE,KAAK,CAAC,eAAe;KAC5B;IACD;QACI,IAAI,EAAE,mBAAmB;QACzB,EAAE,EAAE,KAAK,CAAC,eAAe;KAC5B;CACJ,CAAC"}
|
304
node_modules/browser-sync/dist/async.js
generated
vendored
Normal file
304
node_modules/browser-sync/dist/async.js
generated
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
"use strict";
|
||||
var _ = require("./lodash.custom");
|
||||
var Immutable = require("immutable");
|
||||
var utils = require("./utils");
|
||||
var pluginUtils = require("./plugins");
|
||||
var connectUtils = require("./connect-utils");
|
||||
var chalk = require("chalk");
|
||||
module.exports = {
|
||||
/**
|
||||
* BrowserSync needs at least 1 free port.
|
||||
* It will check the one provided in config
|
||||
* and keep incrementing until an available one is found.
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
getEmptyPort: function (bs, done) {
|
||||
utils.getPorts(bs.options, function (err, port) {
|
||||
if (err) {
|
||||
return utils.fail(true, err, bs.cb);
|
||||
}
|
||||
bs.debug("Found a free port: %s", chalk.magenta(port));
|
||||
done(null, {
|
||||
options: {
|
||||
port: port
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* If the running mode is proxy, we'll use a separate port
|
||||
* for the Browsersync web-socket server. This is to eliminate any issues
|
||||
* with trying to proxy web sockets through to the users server.
|
||||
* @param bs
|
||||
* @param done
|
||||
*/
|
||||
getExtraPortForProxy: function (bs, done) {
|
||||
/**
|
||||
* An extra port is not needed in snippet/server mode
|
||||
*/
|
||||
if (bs.options.get("mode") !== "proxy") {
|
||||
return done();
|
||||
}
|
||||
/**
|
||||
* Web socket support is disabled by default
|
||||
*/
|
||||
if (!bs.options.getIn(["proxy", "ws"])) {
|
||||
return done();
|
||||
}
|
||||
/**
|
||||
* Use 1 higher than server port by default...
|
||||
*/
|
||||
var socketPort = bs.options.get("port") + 1;
|
||||
/**
|
||||
* Or use the user-defined socket.port option instead
|
||||
*/
|
||||
if (bs.options.hasIn(["socket", "port"])) {
|
||||
socketPort = bs.options.getIn(["socket", "port"]);
|
||||
}
|
||||
utils.getPort(bs.options.get("listen", "localhost"), socketPort, null, function (err, port) {
|
||||
if (err) {
|
||||
return utils.fail(true, err, bs.cb);
|
||||
}
|
||||
done(null, {
|
||||
optionsIn: [
|
||||
{
|
||||
path: ["socket", "port"],
|
||||
value: port
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Some features require an internet connection.
|
||||
* If the user did not provide either `true` or `false`
|
||||
* for the online option, we will attempt to resolve www.google.com
|
||||
* as a way of determining network connectivity
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
getOnlineStatus: function (bs, done) {
|
||||
if (_.isUndefined(bs.options.get("online")) &&
|
||||
_.isUndefined(process.env.TESTING)) {
|
||||
require("dns").resolve("www.google.com", function (err) {
|
||||
var online = false;
|
||||
if (err) {
|
||||
bs.debug("Could not resolve www.google.com, setting %s", chalk.magenta("online: false"));
|
||||
}
|
||||
else {
|
||||
bs.debug("Resolved www.google.com, setting %s", chalk.magenta("online: true"));
|
||||
online = true;
|
||||
}
|
||||
done(null, {
|
||||
options: {
|
||||
online: online
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Try to load plugins that were given in options
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
resolveInlineUserPlugins: function (bs, done) {
|
||||
var plugins = bs.options
|
||||
.get("plugins")
|
||||
.map(pluginUtils.resolvePlugin)
|
||||
.map(pluginUtils.requirePlugin);
|
||||
plugins.forEach(function (plugin) {
|
||||
if (plugin.get("errors").size) {
|
||||
return logPluginError(plugin);
|
||||
}
|
||||
var jsPlugin = plugin.toJS();
|
||||
jsPlugin.options = jsPlugin.options || {};
|
||||
jsPlugin.options.moduleName = jsPlugin.moduleName;
|
||||
bs.registerPlugin(jsPlugin.module, jsPlugin.options);
|
||||
});
|
||||
function logPluginError(plugin) {
|
||||
utils.fail(true, plugin.getIn(["errors", 0]), bs.cb);
|
||||
}
|
||||
done();
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
setOptions: function (bs, done) {
|
||||
done(null, {
|
||||
options: {
|
||||
urls: utils.getUrlOptions(bs.options),
|
||||
snippet: connectUtils.enabled(bs.options)
|
||||
? connectUtils.scriptTags(bs.options)
|
||||
: false,
|
||||
scriptPaths: Immutable.fromJS(connectUtils.clientScript(bs.options, true)),
|
||||
files: bs.pluginManager.hook("files:watch", bs.options.get("files"), bs.pluginManager.pluginOptions)
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
setInternalEvents: function (bs, done) {
|
||||
require("./internal-events")(bs);
|
||||
done();
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
setFileWatchers: function (bs, done) {
|
||||
done(null, {
|
||||
instance: {
|
||||
watchers: bs.pluginManager.get("file:watcher")(bs)
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
mergeMiddlewares: function (bs, done) {
|
||||
done(null, {
|
||||
options: {
|
||||
middleware: bs.pluginManager.hook("server:middleware", bs.options.get("middleware"))
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
startServer: function (bs, done) {
|
||||
var server = bs.pluginManager.get("server")(bs);
|
||||
done(null, {
|
||||
instance: {
|
||||
server: server.server,
|
||||
app: server.app
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
startTunnel: function (bs, done) {
|
||||
if (bs.options.get("tunnel") && bs.options.get("online")) {
|
||||
var localTunnel = require("./tunnel");
|
||||
localTunnel(bs, function (err, tunnel) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
else {
|
||||
return done(null, {
|
||||
optionsIn: [
|
||||
{
|
||||
path: ["urls", "tunnel"],
|
||||
value: tunnel.url
|
||||
}
|
||||
],
|
||||
instance: {
|
||||
tunnel: tunnel
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
startSockets: function (bs, done) {
|
||||
var clientEvents = bs.pluginManager.hook("client:events", bs.options.get("clientEvents").toJS());
|
||||
// Start the socket, needs an existing server.
|
||||
var io = bs.pluginManager.get("socket")(bs.server, clientEvents, bs);
|
||||
done(null, {
|
||||
instance: {
|
||||
io: io
|
||||
},
|
||||
options: {
|
||||
clientEvents: Immutable.fromJS(clientEvents)
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
startUi: function (bs, done) {
|
||||
var PLUGIN_NAME = "UI";
|
||||
var userPlugins = bs.getUserPlugins();
|
||||
var ui = bs.pluginManager.get(PLUGIN_NAME);
|
||||
var uiOpts = bs.options.get("ui");
|
||||
if (!uiOpts || uiOpts.get("enabled") === false) {
|
||||
return done();
|
||||
}
|
||||
// if user provided a UI, use it instead
|
||||
if (userPlugins.some(function (item) {
|
||||
return item.name === PLUGIN_NAME;
|
||||
})) {
|
||||
uiOpts = bs.options
|
||||
.get("ui")
|
||||
.mergeDeep(Immutable.fromJS(bs.pluginManager.pluginOptions[PLUGIN_NAME]));
|
||||
}
|
||||
/**
|
||||
* Append the 'listen' option
|
||||
*/
|
||||
const opts = uiOpts.update(uiOpts => {
|
||||
const listen = bs.options.get("listen");
|
||||
if (listen) {
|
||||
return uiOpts.set("listen", listen);
|
||||
}
|
||||
return uiOpts;
|
||||
});
|
||||
return ui(opts.toJS(), bs, function (err, ui) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
done(null, {
|
||||
instance: {
|
||||
ui: ui
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
mergeUiSettings: function (bs, done) {
|
||||
if (!bs.ui) {
|
||||
return done();
|
||||
}
|
||||
done(null, {
|
||||
options: {
|
||||
urls: bs.options.get("urls").merge(bs.ui.options.get("urls"))
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {Function} done
|
||||
*/
|
||||
initUserPlugins: function (bs, done) {
|
||||
bs.pluginManager.initUserPlugins(bs);
|
||||
done(null, {
|
||||
options: {
|
||||
userPlugins: bs.getUserPlugins()
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=async.js.map
|
1
node_modules/browser-sync/dist/async.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/async.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
216
node_modules/browser-sync/dist/bin.js
generated
vendored
Normal file
216
node_modules/browser-sync/dist/bin.js
generated
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BsErrorTypes = exports.BsErrorLevels = void 0;
|
||||
const startOpts = require("../cli-options/opts.start.json");
|
||||
const reloadOpts = require("../cli-options/opts.reload.json");
|
||||
const recipeOpts = require("../cli-options/opts.recipe.json");
|
||||
const chalk = require("chalk");
|
||||
const pkg = require("../package.json");
|
||||
const utils = require("./utils");
|
||||
const path_1 = require("path");
|
||||
const fs_1 = require("fs");
|
||||
const logger_1 = require("./logger");
|
||||
const cli_options_1 = require("./cli/cli-options");
|
||||
var BsErrorLevels;
|
||||
(function (BsErrorLevels) {
|
||||
BsErrorLevels["Fatal"] = "Fatal";
|
||||
})(BsErrorLevels = exports.BsErrorLevels || (exports.BsErrorLevels = {}));
|
||||
var BsErrorTypes;
|
||||
(function (BsErrorTypes) {
|
||||
BsErrorTypes["PathNotFound"] = "PathNotFound";
|
||||
BsErrorTypes["HostAndListenIncompatible"] = "HostAndListenIncompatible";
|
||||
})(BsErrorTypes = exports.BsErrorTypes || (exports.BsErrorTypes = {}));
|
||||
/**
|
||||
* Handle cli input
|
||||
*/
|
||||
if (!module.parent) {
|
||||
runFromCli();
|
||||
}
|
||||
function freshYargs() {
|
||||
return require("yargs")(process.argv.slice(2));
|
||||
}
|
||||
function runFromCli() {
|
||||
const yargs = freshYargs()
|
||||
.command("start", "Start the server")
|
||||
.command("init", "Create a configuration file")
|
||||
.command("reload", "Send a reload event over HTTP protocol")
|
||||
.command("recipe", "Generate the files for a recipe")
|
||||
.version(pkg.version)
|
||||
.help(false)
|
||||
.epilogue([
|
||||
"For help running a certain command, type <command> --help",
|
||||
" $0 start --help",
|
||||
"",
|
||||
"You can run a static server by providing a path(s) directly",
|
||||
" $0 app/src app/tmp",
|
||||
"",
|
||||
"If the directory contains a 'index.html' file, you can omit any input",
|
||||
" $0",
|
||||
"",
|
||||
"You can run the proxy in this manner too",
|
||||
" $0 https://example.com",
|
||||
"",
|
||||
"To run a proxy, whilst also serving static files",
|
||||
" $0 https://example.com htdocs/themes/example"
|
||||
].join("\n"));
|
||||
const argv = yargs.argv;
|
||||
const input = argv._;
|
||||
const command = input[0];
|
||||
const valid = ["start", "init", "reload", "recipe"];
|
||||
if (valid.indexOf(command) > -1) {
|
||||
return handleIncoming(command, freshYargs());
|
||||
}
|
||||
if (input.length) {
|
||||
return handleNoCommand(argv, input, freshYargs());
|
||||
}
|
||||
if ((0, fs_1.existsSync)("index.html")) {
|
||||
return handleNoCommand(argv, ["."], freshYargs());
|
||||
}
|
||||
yargs.showHelp();
|
||||
}
|
||||
/**
|
||||
* Feature: If no command was specified, try to do the 'right thing'
|
||||
*
|
||||
* If paths were given, start the server
|
||||
* eg: browser-sync app/code app/design
|
||||
* is equal to: browser-sync start --server app/code app/design
|
||||
*
|
||||
* eg: browser-sync http://example.com
|
||||
* is equal to: browser-sync start --proxy http://example.com
|
||||
*
|
||||
* eg: browser-sync http://example.com themes/example
|
||||
* is equal to: browser-sync start --proxy http://example.com --ss themes/example
|
||||
*
|
||||
* @param argv
|
||||
* @param input
|
||||
* @returns {any}
|
||||
*/
|
||||
function handleNoCommand(argv, input, yargs) {
|
||||
const processed = processStart(yargs);
|
||||
const paths = input.map(path => {
|
||||
const resolved = (0, path_1.resolve)(path);
|
||||
const isUrl = /^https?:\/\//.test(path);
|
||||
return {
|
||||
isUrl,
|
||||
userInput: path,
|
||||
resolved,
|
||||
errors: isUrl ? [] : pathErrors(path, resolved)
|
||||
};
|
||||
});
|
||||
const withErrors = paths.filter(item => item.errors.length);
|
||||
const withoutErrors = paths.filter(item => item.errors.length === 0);
|
||||
if (withErrors.length) {
|
||||
withErrors.forEach(item => {
|
||||
logger_1.logger.unprefixed("error", (0, cli_options_1.printErrors)(item.errors));
|
||||
});
|
||||
return process.exit(1);
|
||||
}
|
||||
const serveStaticPaths = withoutErrors
|
||||
.filter(item => item.isUrl === false)
|
||||
.map(item => item.resolved);
|
||||
const urls = withoutErrors
|
||||
.filter(item => item.isUrl === true)
|
||||
.map(item => item.userInput);
|
||||
/**
|
||||
* If a URL was given, switch to proxy mode and use
|
||||
* any other paths as serveStatic options
|
||||
*/
|
||||
if (urls.length) {
|
||||
const proxy = urls[0];
|
||||
const config = Object.assign(Object.assign({}, processed), { proxy, serveStatic: serveStaticPaths });
|
||||
return handleCli({ cli: { flags: config, input: ["start"] } });
|
||||
}
|
||||
/**
|
||||
* if NO urls were given switch directly to server mode
|
||||
* @type {{server: {baseDir: any}}}
|
||||
*/
|
||||
const config = Object.assign(Object.assign({}, processed), { server: { baseDir: serveStaticPaths } });
|
||||
return handleCli({ cli: { flags: config, input: ["start"] } });
|
||||
}
|
||||
/**
|
||||
* @param {{cli: object, [whitelist]: array, [cb]: function}} opts
|
||||
* @returns {*}
|
||||
*/
|
||||
function handleCli(opts) {
|
||||
opts.cb = opts.cb || utils.defaultCallback;
|
||||
const m = require(`./cli/command.${opts.cli.input[0]}`);
|
||||
if (m.default) {
|
||||
return m.default(opts);
|
||||
}
|
||||
return m(opts);
|
||||
}
|
||||
exports.default = handleCli;
|
||||
function processStart(yargs) {
|
||||
return yargs
|
||||
.usage("Usage: $0 start [options]")
|
||||
.options(startOpts)
|
||||
.example("$0 start -s app", "- Use the App directory to serve files")
|
||||
.example("$0 start -p www.bbc.co.uk", "- Proxy an existing website")
|
||||
.default("cwd", () => process.cwd())
|
||||
.argv;
|
||||
}
|
||||
/**
|
||||
* @param {string} command
|
||||
* @param {object} yargs
|
||||
* @param cwd
|
||||
*/
|
||||
function handleIncoming(command, yargs) {
|
||||
let out;
|
||||
if (command === "start") {
|
||||
out = processStart(yargs);
|
||||
}
|
||||
if (command === "init") {
|
||||
out = yargs
|
||||
.usage("Usage: $0 init")
|
||||
.example("$0 init")
|
||||
.default("cwd", () => process.cwd())
|
||||
.help().argv;
|
||||
}
|
||||
if (command === "reload") {
|
||||
out = yargs
|
||||
.usage("Usage: $0 reload")
|
||||
.options(reloadOpts)
|
||||
.example("$0 reload")
|
||||
.example("$0 reload --port 4000")
|
||||
.default("cwd", () => process.cwd())
|
||||
.argv;
|
||||
}
|
||||
if (command === "recipe") {
|
||||
out = yargs
|
||||
.usage("Usage: $0 recipe <recipe-name>")
|
||||
.option(recipeOpts)
|
||||
.example("$0 recipe ls", "list the recipes")
|
||||
.example("$0 recipe gulp.sass", "use the gulp.sass recipe")
|
||||
.default("cwd", () => process.cwd())
|
||||
.argv;
|
||||
}
|
||||
if (out.help) {
|
||||
return yargs.showHelp();
|
||||
}
|
||||
handleCli({ cli: { flags: out, input: out._ } });
|
||||
}
|
||||
function pathErrors(input, resolved) {
|
||||
if (!(0, fs_1.existsSync)(resolved)) {
|
||||
return [
|
||||
{
|
||||
type: BsErrorTypes.PathNotFound,
|
||||
level: BsErrorLevels.Fatal,
|
||||
errors: [
|
||||
{
|
||||
error: new Error(`Path not found: ${input}`),
|
||||
meta() {
|
||||
return [
|
||||
`Your Input: ${chalk.yellow(input)}`,
|
||||
`CWD: ${chalk.yellow(process.cwd())}`,
|
||||
`Resolved to: ${chalk.yellow(resolved)}`
|
||||
];
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
//# sourceMappingURL=bin.js.map
|
1
node_modules/browser-sync/dist/bin.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/bin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
566
node_modules/browser-sync/dist/browser-sync.js
generated
vendored
Normal file
566
node_modules/browser-sync/dist/browser-sync.js
generated
vendored
Normal file
@ -0,0 +1,566 @@
|
||||
"use strict";
|
||||
var hooks = require("./hooks");
|
||||
var asyncTasks = require("./async-tasks");
|
||||
var config = require("./config");
|
||||
var connectUtils = require("./connect-utils");
|
||||
var utils = require("./utils");
|
||||
var logger = require("./logger");
|
||||
var chalk = require("chalk");
|
||||
var eachSeries = utils.eachSeries;
|
||||
var _ = require("./lodash.custom");
|
||||
var EE = require("easy-extender");
|
||||
/**
|
||||
* Required internal plugins.
|
||||
* Any of these can be overridden by deliberately
|
||||
* causing a name-clash.
|
||||
*/
|
||||
var defaultPlugins = {
|
||||
logger: logger,
|
||||
socket: require("./sockets"),
|
||||
"file:watcher": require("./file-watcher"),
|
||||
server: require("./server"),
|
||||
tunnel: require("./tunnel"),
|
||||
"client:script": require("browser-sync-client"),
|
||||
UI: require("browser-sync-ui")
|
||||
};
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
var BrowserSync = function (emitter) {
|
||||
var bs = this;
|
||||
bs.cwd = process.cwd();
|
||||
bs.active = false;
|
||||
bs.paused = false;
|
||||
bs.config = config;
|
||||
bs.utils = utils;
|
||||
bs.events = bs.emitter = emitter;
|
||||
bs._userPlugins = [];
|
||||
bs._reloadQueue = [];
|
||||
bs._cleanupTasks = [];
|
||||
bs._browserReload = false;
|
||||
// Plugin management
|
||||
bs.pluginManager = new EE(defaultPlugins, hooks);
|
||||
};
|
||||
/**
|
||||
* Call a user-options provided callback
|
||||
* @param name
|
||||
*/
|
||||
BrowserSync.prototype.callback = function (name) {
|
||||
var bs = this;
|
||||
var cb = bs.options.getIn(["callbacks", name]);
|
||||
if (_.isFunction(cb)) {
|
||||
cb.apply(bs.publicInstance, _.toArray(arguments).slice(1));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Map} options
|
||||
* @param {Function} cb
|
||||
* @returns {BrowserSync}
|
||||
*/
|
||||
BrowserSync.prototype.init = function (options, cb) {
|
||||
/**
|
||||
* Safer access to `this`
|
||||
* @type {BrowserSync}
|
||||
*/
|
||||
var bs = this;
|
||||
/**
|
||||
* Set user-provided callback, or assign a noop
|
||||
* @type {Function}
|
||||
*/
|
||||
bs.cb = cb || utils.defaultCallback;
|
||||
/**
|
||||
* Verify provided config.
|
||||
* Some options are not compatible and will cause us to
|
||||
* end the process.
|
||||
*/
|
||||
if (!utils.verifyConfig(options, bs.cb)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Save a reference to the original options
|
||||
* @type {Map}
|
||||
* @private
|
||||
*/
|
||||
bs._options = options;
|
||||
/**
|
||||
* Set additional options that depend on what the
|
||||
* user may of provided
|
||||
* @type {Map}
|
||||
*/
|
||||
bs.options = options;
|
||||
/**
|
||||
* Kick off default plugins.
|
||||
*/
|
||||
bs.pluginManager.init();
|
||||
/**
|
||||
* Create a base logger & debugger.
|
||||
*/
|
||||
bs.logger = bs.pluginManager.get("logger")(bs.events, bs);
|
||||
bs.debugger = bs.logger.clone({ useLevelPrefixes: true });
|
||||
bs.debug = bs.debugger.debug;
|
||||
/**
|
||||
* Run each setup task in sequence
|
||||
*/
|
||||
eachSeries(asyncTasks, taskRunner(bs), tasksComplete(bs));
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
* Run 1 setup task.
|
||||
* Each task is a pure function.
|
||||
* They can return options or instance properties to set,
|
||||
* but they cannot set them directly.
|
||||
* @param {BrowserSync} bs
|
||||
* @returns {Function}
|
||||
*/
|
||||
function taskRunner(bs) {
|
||||
return function (item, cb) {
|
||||
bs.debug("-> %s", chalk.yellow("Starting Step: " + item.step));
|
||||
/**
|
||||
* Execute the current task.
|
||||
*/
|
||||
item.fn(bs, executeTask);
|
||||
function executeTask(err, out) {
|
||||
/**
|
||||
* Exit early if any task returned an error.
|
||||
*/
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
/**
|
||||
* Act on return values (such as options to be set,
|
||||
* or instance properties to be set
|
||||
*/
|
||||
if (out) {
|
||||
handleOut(bs, out);
|
||||
}
|
||||
bs.debug("+ %s", chalk.green("Step Complete: " + item.step));
|
||||
cb();
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param bs
|
||||
* @param out
|
||||
*/
|
||||
function handleOut(bs, out) {
|
||||
/**
|
||||
* Set a single/many option.
|
||||
*/
|
||||
if (out.options) {
|
||||
setOptions(bs, out.options);
|
||||
}
|
||||
/**
|
||||
* Any options returned that require path access?
|
||||
*/
|
||||
if (out.optionsIn) {
|
||||
out.optionsIn.forEach(function (item) {
|
||||
bs.setOptionIn(item.path, item.value);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Any instance properties returned?
|
||||
*/
|
||||
if (out.instance) {
|
||||
Object.keys(out.instance).forEach(function (key) {
|
||||
bs[key] = out.instance[key];
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Update the options Map
|
||||
* @param bs
|
||||
* @param options
|
||||
*/
|
||||
function setOptions(bs, options) {
|
||||
/**
|
||||
* If multiple options were set, act on the immutable map
|
||||
* in an efficient way
|
||||
*/
|
||||
if (Object.keys(options).length > 1) {
|
||||
bs.setMany(function (item) {
|
||||
Object.keys(options).forEach(function (key) {
|
||||
item.set(key, options[key]);
|
||||
return item;
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(options).forEach(function (key) {
|
||||
bs.setOption(key, options[key]);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* At this point, ALL async tasks have completed
|
||||
* @param {BrowserSync} bs
|
||||
* @returns {Function}
|
||||
*/
|
||||
function tasksComplete(bs) {
|
||||
return function (err) {
|
||||
if (err) {
|
||||
bs.logger.setOnce("useLevelPrefixes", true).error(err.message);
|
||||
}
|
||||
/**
|
||||
* Set active flag
|
||||
*/
|
||||
bs.active = true;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
bs.events.emit("init", bs);
|
||||
/**
|
||||
* This is no-longer needed as the Callback now only resolves
|
||||
* when everything (including slow things, like the tunnel) is ready.
|
||||
* It's here purely for backwards compatibility.
|
||||
* @deprecated
|
||||
*/
|
||||
bs.events.emit("service:running", {
|
||||
options: bs.options,
|
||||
baseDir: bs.options.getIn(["server", "baseDir"]),
|
||||
type: bs.options.get("mode"),
|
||||
port: bs.options.get("port"),
|
||||
url: bs.options.getIn(["urls", "local"]),
|
||||
urls: bs.options.get("urls").toJS(),
|
||||
tunnel: bs.options.getIn(["urls", "tunnel"])
|
||||
});
|
||||
/**
|
||||
* Call any option-provided callbacks
|
||||
*/
|
||||
bs.callback("ready", null, bs);
|
||||
/**
|
||||
* Finally, call the user-provided callback given as last arg
|
||||
*/
|
||||
bs.cb(null, bs);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param module
|
||||
* @param opts
|
||||
* @param cb
|
||||
*/
|
||||
BrowserSync.prototype.registerPlugin = function (module, opts, cb) {
|
||||
var bs = this;
|
||||
bs.pluginManager.registerPlugin(module, opts, cb);
|
||||
if (module["plugin:name"]) {
|
||||
bs._userPlugins.push(module);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Get a plugin by name
|
||||
* @param name
|
||||
*/
|
||||
BrowserSync.prototype.getUserPlugin = function (name) {
|
||||
var bs = this;
|
||||
var items = bs.getUserPlugins(function (item) {
|
||||
return item["plugin:name"] === name;
|
||||
});
|
||||
if (items && items.length) {
|
||||
return items[0];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* @param {Function} [filter]
|
||||
*/
|
||||
BrowserSync.prototype.getUserPlugins = function (filter) {
|
||||
var bs = this;
|
||||
filter =
|
||||
filter ||
|
||||
function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Transform Plugins option
|
||||
*/
|
||||
bs.userPlugins = bs._userPlugins.filter(filter).map(function (plugin) {
|
||||
return {
|
||||
name: plugin["plugin:name"],
|
||||
active: plugin._enabled,
|
||||
opts: bs.pluginManager.pluginOptions[plugin["plugin:name"]]
|
||||
};
|
||||
});
|
||||
return bs.userPlugins;
|
||||
};
|
||||
/**
|
||||
* Get middleware
|
||||
* @returns {*}
|
||||
*/
|
||||
BrowserSync.prototype.getMiddleware = function (type) {
|
||||
var types = {
|
||||
connector: connectUtils.socketConnector(this.options)
|
||||
};
|
||||
if (type in types) {
|
||||
return function (req, res) {
|
||||
res.setHeader("Content-Type", "text/javascript");
|
||||
res.end(types[type]);
|
||||
};
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Shortcut for pushing a file-serving middleware
|
||||
* onto the stack
|
||||
* @param {String} path
|
||||
* @param {{type: string, content: string}} props
|
||||
*/
|
||||
var _serveFileCount = 0;
|
||||
BrowserSync.prototype.serveFile = function (path, props) {
|
||||
var bs = this;
|
||||
var mode = bs.options.get("mode");
|
||||
var entry = {
|
||||
handle: function (req, res) {
|
||||
res.setHeader("Content-Type", props.type);
|
||||
res.end(props.content);
|
||||
},
|
||||
id: "Browsersync - " + _serveFileCount++,
|
||||
route: path
|
||||
};
|
||||
bs._addMiddlewareToStack(entry);
|
||||
};
|
||||
/**
|
||||
* Add middlewares on the fly
|
||||
*/
|
||||
BrowserSync.prototype._addMiddlewareToStack = function (entry) {
|
||||
var bs = this;
|
||||
/**
|
||||
* additional middlewares are always appended -1,
|
||||
* this is to allow the proxy middlewares to remain,
|
||||
* and the directory index to remain in serveStatic/snippet modes
|
||||
*/
|
||||
bs.app.stack.splice(bs.app.stack.length - 1, 0, entry);
|
||||
};
|
||||
var _addMiddlewareCount = 0;
|
||||
BrowserSync.prototype.addMiddleware = function (route, handle, opts) {
|
||||
var bs = this;
|
||||
if (!bs.app) {
|
||||
return;
|
||||
}
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
opts.id = "bs-mw-" + _addMiddlewareCount++;
|
||||
}
|
||||
if (route === "*") {
|
||||
route = "";
|
||||
}
|
||||
var entry = {
|
||||
id: opts.id,
|
||||
route: route,
|
||||
handle: handle
|
||||
};
|
||||
if (opts.override) {
|
||||
entry.override = true;
|
||||
}
|
||||
bs.options = bs.options.update("middleware", function (mw) {
|
||||
if (bs.options.get("mode") === "proxy") {
|
||||
return mw.insert(mw.size - 1, entry);
|
||||
}
|
||||
return mw.concat(entry);
|
||||
});
|
||||
bs.resetMiddlewareStack();
|
||||
};
|
||||
/**
|
||||
* Remove middlewares on the fly
|
||||
* @param {String} id
|
||||
* @returns {Server}
|
||||
*/
|
||||
BrowserSync.prototype.removeMiddleware = function (id) {
|
||||
var bs = this;
|
||||
if (!bs.app) {
|
||||
return;
|
||||
}
|
||||
bs.options = bs.options.update("middleware", function (mw) {
|
||||
return mw.filter(function (mw) {
|
||||
return mw.id !== id;
|
||||
});
|
||||
});
|
||||
bs.resetMiddlewareStack();
|
||||
};
|
||||
/**
|
||||
* Middleware for socket connection (external usage)
|
||||
* @param opts
|
||||
* @returns {*}
|
||||
*/
|
||||
BrowserSync.prototype.getSocketConnector = function (opts) {
|
||||
var bs = this;
|
||||
return function (req, res) {
|
||||
res.setHeader("Content-Type", "text/javascript");
|
||||
res.end(bs.getExternalSocketConnector(opts));
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Socket connector as a string
|
||||
* @param {Object} opts
|
||||
* @returns {*}
|
||||
*/
|
||||
BrowserSync.prototype.getExternalSocketConnector = function (opts) {
|
||||
var bs = this;
|
||||
return connectUtils.socketConnector(bs.options.withMutations(function (item) {
|
||||
item.set("socket", item.get("socket").merge(opts));
|
||||
if (!bs.options.getIn(["proxy", "ws"])) {
|
||||
item.set("mode", "snippet");
|
||||
}
|
||||
}));
|
||||
};
|
||||
/**
|
||||
* Callback helper
|
||||
* @param name
|
||||
*/
|
||||
BrowserSync.prototype.getOption = function (name) {
|
||||
this.debug("Getting option: {magenta:%s", name);
|
||||
return this.options.get(name);
|
||||
};
|
||||
/**
|
||||
* Callback helper
|
||||
* @param path
|
||||
*/
|
||||
BrowserSync.prototype.getOptionIn = function (path) {
|
||||
this.debug("Getting option via path: {magenta:%s", path);
|
||||
return this.options.getIn(path);
|
||||
};
|
||||
/**
|
||||
* @returns {BrowserSync.options}
|
||||
*/
|
||||
BrowserSync.prototype.getOptions = function () {
|
||||
return this.options;
|
||||
};
|
||||
/**
|
||||
* @returns {BrowserSync.options}
|
||||
*/
|
||||
BrowserSync.prototype.getLogger = logger.getLogger;
|
||||
/**
|
||||
* @param {String} name
|
||||
* @param {*} value
|
||||
* @returns {BrowserSync.options|*}
|
||||
*/
|
||||
BrowserSync.prototype.setOption = function (name, value, opts) {
|
||||
var bs = this;
|
||||
opts = opts || {};
|
||||
bs.debug("Setting Option: {cyan:%s} - {magenta:%s", name, value.toString());
|
||||
bs.options = bs.options.set(name, value);
|
||||
if (!opts.silent) {
|
||||
bs.events.emit("options:set", {
|
||||
path: name,
|
||||
value: value,
|
||||
options: bs.options
|
||||
});
|
||||
}
|
||||
return this.options;
|
||||
};
|
||||
/**
|
||||
* @param path
|
||||
* @param value
|
||||
* @param opts
|
||||
* @returns {Map|*|BrowserSync.options}
|
||||
*/
|
||||
BrowserSync.prototype.setOptionIn = function (path, value, opts) {
|
||||
var bs = this;
|
||||
opts = opts || {};
|
||||
bs.debug("Setting Option: {cyan:%s} - {magenta:%s", path.join("."), value.toString());
|
||||
bs.options = bs.options.setIn(path, value);
|
||||
if (!opts.silent) {
|
||||
bs.events.emit("options:set", {
|
||||
path: path,
|
||||
value: value,
|
||||
options: bs.options
|
||||
});
|
||||
}
|
||||
return bs.options;
|
||||
};
|
||||
/**
|
||||
* Set multiple options with mutations
|
||||
* @param fn
|
||||
* @param opts
|
||||
* @returns {Map|*}
|
||||
*/
|
||||
BrowserSync.prototype.setMany = function (fn, opts) {
|
||||
var bs = this;
|
||||
opts = opts || {};
|
||||
bs.debug("Setting multiple Options");
|
||||
bs.options = bs.options.withMutations(fn);
|
||||
if (!opts.silent) {
|
||||
bs.events.emit("options:set", { options: bs.options.toJS() });
|
||||
}
|
||||
return this.options;
|
||||
};
|
||||
BrowserSync.prototype.addRewriteRule = function (rule) {
|
||||
var bs = this;
|
||||
bs.options = bs.options.update("rewriteRules", function (rules) {
|
||||
return rules.concat(rule);
|
||||
});
|
||||
bs.resetMiddlewareStack();
|
||||
};
|
||||
BrowserSync.prototype.removeRewriteRule = function (id) {
|
||||
var bs = this;
|
||||
bs.options = bs.options.update("rewriteRules", function (rules) {
|
||||
return rules.filter(function (rule) {
|
||||
return rule.id !== id;
|
||||
});
|
||||
});
|
||||
bs.resetMiddlewareStack();
|
||||
};
|
||||
BrowserSync.prototype.setRewriteRules = function (rules) {
|
||||
var bs = this;
|
||||
bs.options = bs.options.update("rewriteRules", function (_) {
|
||||
return rules;
|
||||
});
|
||||
bs.resetMiddlewareStack();
|
||||
};
|
||||
/**
|
||||
* Add a new rewrite rule to the stack
|
||||
* @param {Object} rule
|
||||
*/
|
||||
BrowserSync.prototype.resetMiddlewareStack = function () {
|
||||
var bs = this;
|
||||
var middlewares = require("./server/utils").getMiddlewares(bs, bs.options);
|
||||
bs.app.stack = middlewares;
|
||||
};
|
||||
/**
|
||||
* @param fn
|
||||
*/
|
||||
BrowserSync.prototype.registerCleanupTask = function (fn) {
|
||||
this._cleanupTasks.push(fn);
|
||||
};
|
||||
/**
|
||||
* Instance Cleanup
|
||||
*/
|
||||
BrowserSync.prototype.cleanup = function (cb) {
|
||||
var bs = this;
|
||||
if (!bs.active) {
|
||||
return;
|
||||
}
|
||||
// Remove all event listeners
|
||||
if (bs.events) {
|
||||
bs.debug("Removing event listeners...");
|
||||
bs.events.removeAllListeners();
|
||||
}
|
||||
// Close any core file watchers
|
||||
if (bs.watchers) {
|
||||
Object.keys(bs.watchers).forEach(function (key) {
|
||||
bs.watchers[key].watchers.forEach(function (watcher) {
|
||||
watcher.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
// Run any additional clean up tasks
|
||||
bs._cleanupTasks.forEach(function (fn) {
|
||||
if (_.isFunction(fn)) {
|
||||
fn(bs);
|
||||
}
|
||||
});
|
||||
// Reset the flag
|
||||
bs.debug("Setting {magenta:active: false");
|
||||
bs.active = false;
|
||||
bs.paused = false;
|
||||
bs.pluginManager.plugins = {};
|
||||
bs.pluginManager.pluginOptions = {};
|
||||
bs.pluginManager.defaultPlugins = defaultPlugins;
|
||||
bs._userPlugins = [];
|
||||
bs.userPlugins = [];
|
||||
bs._reloadTimer = undefined;
|
||||
bs._reloadQueue = [];
|
||||
bs._cleanupTasks = [];
|
||||
if (_.isFunction(cb)) {
|
||||
cb(null, bs);
|
||||
}
|
||||
};
|
||||
module.exports = BrowserSync;
|
||||
//# sourceMappingURL=browser-sync.js.map
|
1
node_modules/browser-sync/dist/browser-sync.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/browser-sync.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
50
node_modules/browser-sync/dist/cli/cli-info.js
generated
vendored
Normal file
50
node_modules/browser-sync/dist/cli/cli-info.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var config = require("../config");
|
||||
var logger = require("../logger").logger;
|
||||
var fs = require("fs");
|
||||
var _ = require("../lodash.custom");
|
||||
var path = require("path");
|
||||
var chalk = require("chalk");
|
||||
var info = {
|
||||
/**
|
||||
* Version info
|
||||
* @param {Object} pjson
|
||||
* @returns {String}
|
||||
*/
|
||||
getVersion: function (pjson) {
|
||||
console.log(pjson.version);
|
||||
return pjson.version;
|
||||
},
|
||||
/**
|
||||
* Retrieve the config file
|
||||
* @returns {*}
|
||||
* @private
|
||||
* @param filePath
|
||||
*/
|
||||
getConfigFile: function (filePath) {
|
||||
return require(path.resolve(filePath));
|
||||
},
|
||||
/**
|
||||
* Generate an example Config file.
|
||||
*/
|
||||
makeConfig: function (cwd, cb) {
|
||||
var opts = require(path.join(__dirname, "..", config.configFile));
|
||||
var userOpts = {};
|
||||
var ignore = ["excludedFileTypes", "injectFileTypes", "snippetOptions"];
|
||||
Object.keys(opts).forEach(function (key) {
|
||||
if (!_.includes(ignore, key)) {
|
||||
userOpts[key] = opts[key];
|
||||
}
|
||||
});
|
||||
var file = fs.readFileSync(config.template, "utf8");
|
||||
file = file.replace("//OPTS", JSON.stringify(userOpts, null, 4));
|
||||
fs.writeFile(path.resolve(cwd, config.userFile), file, function () {
|
||||
logger.info("Config file created %s", chalk.magenta(config.userFile));
|
||||
logger.info("To use it, in the same directory run: " +
|
||||
chalk.cyan("browser-sync start --config bs-config.js"));
|
||||
cb();
|
||||
});
|
||||
}
|
||||
};
|
||||
module.exports = info;
|
||||
//# sourceMappingURL=cli-info.js.map
|
1
node_modules/browser-sync/dist/cli/cli-info.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/cli-info.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"cli-info.js","sourceRoot":"","sources":["../../lib/cli/cli-info.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAClC,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;AAEzC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC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C;QAEjE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE;YACnD,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACtE,MAAM,CAAC,IAAI,CACP,wCAAwC;gBACpC,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAC7D,CAAC;YACF,EAAE,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC"}
|
110
node_modules/browser-sync/dist/cli/cli-options.js
generated
vendored
Normal file
110
node_modules/browser-sync/dist/cli/cli-options.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.printErrors = exports.makeFilesArg = exports.explodeFilesArg = exports.merge = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const addToFilesOption_1 = require("./transforms/addToFilesOption");
|
||||
const addDefaultIgnorePatterns_1 = require("./transforms/addDefaultIgnorePatterns");
|
||||
const copyCLIIgnoreToWatchOptions_1 = require("./transforms/copyCLIIgnoreToWatchOptions");
|
||||
const handleExtensionsOption_1 = require("./transforms/handleExtensionsOption");
|
||||
const handleFilesOption_1 = require("./transforms/handleFilesOption");
|
||||
const handleGhostModeOption_1 = require("./transforms/handleGhostModeOption");
|
||||
const handlePortsOption_1 = require("./transforms/handlePortsOption");
|
||||
const handleProxyOption_1 = require("./transforms/handleProxyOption");
|
||||
const handleServerOption_1 = require("./transforms/handleServerOption");
|
||||
const appendServerIndexOption_1 = require("./transforms/appendServerIndexOption");
|
||||
const appendServerDirectoryOption_1 = require("./transforms/appendServerDirectoryOption");
|
||||
const addCwdToWatchOptions_1 = require("./transforms/addCwdToWatchOptions");
|
||||
const options_1 = require("../options");
|
||||
const handleHostOption_1 = require("./transforms/handleHostOption");
|
||||
const _ = require("../lodash.custom");
|
||||
const defaultConfig = require("../default-config");
|
||||
const immDefs = (0, immutable_1.fromJS)(defaultConfig);
|
||||
function merge(input) {
|
||||
const merged = immDefs.mergeDeep(input);
|
||||
const transforms = [
|
||||
addToFilesOption_1.addToFilesOption,
|
||||
addCwdToWatchOptions_1.addCwdToWatchOptions,
|
||||
addDefaultIgnorePatterns_1.addDefaultIgnorePatterns,
|
||||
copyCLIIgnoreToWatchOptions_1.copyCLIIgnoreToWatchOptions,
|
||||
handleServerOption_1.handleServerOption,
|
||||
appendServerIndexOption_1.appendServerIndexOption,
|
||||
appendServerDirectoryOption_1.appendServerDirectoryOption,
|
||||
handleProxyOption_1.handleProxyOption,
|
||||
handlePortsOption_1.handlePortsOption,
|
||||
handleHostOption_1.handleHostOption,
|
||||
handleGhostModeOption_1.handleGhostModeOption,
|
||||
handleFilesOption_1.handleFilesOption,
|
||||
handleExtensionsOption_1.handleExtensionsOption,
|
||||
options_1.setMode,
|
||||
options_1.setScheme,
|
||||
options_1.setStartPath,
|
||||
options_1.setProxyWs,
|
||||
options_1.setServerOpts,
|
||||
options_1.liftExtensionsOptionFromCli,
|
||||
options_1.setNamespace,
|
||||
options_1.fixSnippetIgnorePaths,
|
||||
options_1.fixSnippetIncludePaths,
|
||||
options_1.fixRewriteRules,
|
||||
options_1.setMiddleware,
|
||||
options_1.setOpen,
|
||||
options_1.setUiPort
|
||||
];
|
||||
const output = transforms.reduce((acc, item) => {
|
||||
const [current, currentErrors] = acc;
|
||||
const [result, errors] = item.call(null, current);
|
||||
return [result, [...currentErrors, ...errors]];
|
||||
}, [merged, []]);
|
||||
return output;
|
||||
}
|
||||
exports.merge = merge;
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
function explodeFilesArg(string) {
|
||||
return string.split(",").map(item => item.trim());
|
||||
}
|
||||
exports.explodeFilesArg = explodeFilesArg;
|
||||
/**
|
||||
* @param value
|
||||
* @returns {{globs: Array, objs: Array}}
|
||||
*/
|
||||
function makeFilesArg(value) {
|
||||
let globs = [];
|
||||
let objs = [];
|
||||
if (_.isString(value)) {
|
||||
globs = globs.concat(explodeFilesArg(value));
|
||||
}
|
||||
if (immutable_1.List.isList(value) && value.size) {
|
||||
value.forEach(function (value) {
|
||||
if (_.isString(value)) {
|
||||
globs.push(value);
|
||||
}
|
||||
else {
|
||||
if (immutable_1.Map.isMap(value)) {
|
||||
objs.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
globs: globs,
|
||||
objs: objs
|
||||
};
|
||||
}
|
||||
exports.makeFilesArg = makeFilesArg;
|
||||
function printErrors(errors) {
|
||||
return errors
|
||||
.map(error => [
|
||||
`Error Type: ${error.type}`,
|
||||
`Error Level: ${error.level}`,
|
||||
error.errors.map(item => [
|
||||
`Error Message: ${item.error.message}`,
|
||||
item.meta ? item.meta().join("\n") : ""
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n"))
|
||||
].join("\n"))
|
||||
.join("\n\n");
|
||||
}
|
||||
exports.printErrors = printErrors;
|
||||
//# sourceMappingURL=cli-options.js.map
|
1
node_modules/browser-sync/dist/cli/cli-options.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/cli-options.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"cli-options.js","sourceRoot":"","sources":["../../lib/cli/cli-options.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,oEAAiE;AACjE,oFAAiF;AACjF,0FAAuF;AACvF,gFAA6E;AAC7E,sEAAmE;AACnE,8EAA2E;AAC3E,sEAAmE;AACnE,sEAAmE;AACnE,wEAAqE;AACrE,kFAA+E;AAC/E,0FAAuF;AACvF,4EAAyE;AACzE,wCAcoB;AAEpB,oEAAiE;AAEjE,MAAM,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,OAAO,CAAC,m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SACA,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAjBD,kCAiBC"}
|
14
node_modules/browser-sync/dist/cli/command.init.js
generated
vendored
Normal file
14
node_modules/browser-sync/dist/cli/command.init.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
var info = require("./cli-info");
|
||||
/**
|
||||
* $ browser-sync init
|
||||
*
|
||||
* This command will generate a configuration
|
||||
* file in the current directory
|
||||
*
|
||||
* @param opts
|
||||
*/
|
||||
module.exports = function (opts) {
|
||||
info.makeConfig(process.cwd(), opts.cb);
|
||||
};
|
||||
//# sourceMappingURL=command.init.js.map
|
1
node_modules/browser-sync/dist/cli/command.init.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/command.init.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.init.js","sourceRoot":"","sources":["../../lib/cli/command.init.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,IAAI;IAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
62
node_modules/browser-sync/dist/cli/command.recipe.js
generated
vendored
Normal file
62
node_modules/browser-sync/dist/cli/command.recipe.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
var logger = require("../logger").logger;
|
||||
var chalk = require("chalk");
|
||||
/**
|
||||
* $ browser-sync recipe <name> <options>
|
||||
*
|
||||
* This command will copy a recipe into either the current directory
|
||||
* or one given with the --output flag
|
||||
*
|
||||
* @param opts
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (opts) {
|
||||
var path = require("path");
|
||||
var fs = require("fs-extra");
|
||||
var input = opts.cli.input.slice(1);
|
||||
var resolved = require.resolve("bs-recipes");
|
||||
var dir = path.dirname(resolved);
|
||||
var logRecipes = function () {
|
||||
var dirs = fs.readdirSync(path.join(dir, "recipes"));
|
||||
logger.info("Install one of the following with %s\n", chalk.cyan('browser-sync recipe <name>'));
|
||||
dirs.forEach(function (name) {
|
||||
console.log(" " + name);
|
||||
});
|
||||
};
|
||||
if (!input.length) {
|
||||
logger.info("No recipe name provided!");
|
||||
logRecipes();
|
||||
return opts.cb();
|
||||
}
|
||||
if (opts.cli.input[1] === "ls") {
|
||||
logRecipes();
|
||||
return opts.cb();
|
||||
}
|
||||
input = input[0];
|
||||
var flags = opts.cli.flags;
|
||||
var output = flags.output
|
||||
? path.resolve(flags.output)
|
||||
: path.join(process.cwd(), input);
|
||||
var targetDir = path.join(dir, "recipes", input);
|
||||
if (fs.existsSync(output)) {
|
||||
return opts.cb(new Error("Target folder exists remove it first and then try again"));
|
||||
}
|
||||
if (fs.existsSync(targetDir)) {
|
||||
fs.copy(targetDir, output, function (err) {
|
||||
if (err) {
|
||||
opts.cb(err);
|
||||
}
|
||||
else {
|
||||
logger.info("Recipe copied into %s", chalk.cyan(output));
|
||||
logger.info("Next, inside that folder, run %s", chalk.cyan("npm i && npm start"));
|
||||
opts.cb(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
logger.info("Recipe %s not found. The following are available though", chalk.cyan(input));
|
||||
logRecipes();
|
||||
opts.cb();
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=command.recipe.js.map
|
1
node_modules/browser-sync/dist/cli/command.recipe.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/command.recipe.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.recipe.js","sourceRoot":"","sources":["../../lib/cli/command.recipe.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;AACzC,IAAI,KAAK,GAAI,OA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AAM,GAAG,KAAK,CAAC,MAAM;QACrB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAEjD,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,IAAI,CAAC,EAAE,CACV,IAAI,KAAK,CAAC,yDAAyD,CAAC,CACvE,CAAC;KACL;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC1B,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,UAAS,GAAG;YACnC,IAAI,GAAG,EAAE;gBACL,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;aAChB;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBACzD,MAAM,CAAC,IAAI,CACP,kCAAkC,EAClC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CACnC,CAAC;gBACF,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;aACjB;QACL,CAAC,CAAC,CAAC;KACN;SAAM;QACH,MAAM,CAAC,IAAI,CACP,yDAAyD,EACzD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CACpB,CAAC;QACF,UAAU,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,EAAE,CAAC;KACb;AACL,CAAC,CAAC"}
|
41
node_modules/browser-sync/dist/cli/command.reload.js
generated
vendored
Normal file
41
node_modules/browser-sync/dist/cli/command.reload.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
/**
|
||||
* $ browser-sync reload <options>
|
||||
*
|
||||
* This commands starts the Browsersync servers
|
||||
* & Optionally UI.
|
||||
*
|
||||
* @param opts
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (opts) {
|
||||
var flags = opts.cli.flags;
|
||||
if (!flags.url) {
|
||||
flags.url = "http://localhost:" + (flags.port || 3000);
|
||||
}
|
||||
var proto = require("../http-protocol");
|
||||
var scheme = flags.url.match(/^https/) ? "https" : "http";
|
||||
var args = { method: "reload" };
|
||||
if (flags.files) {
|
||||
args.args = flags.files;
|
||||
}
|
||||
var url = proto.getUrl(args, flags.url);
|
||||
if (scheme === "https") {
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
}
|
||||
require(scheme)
|
||||
.get(url, function (res) {
|
||||
res.on("data", function () {
|
||||
if (res.statusCode === 200) {
|
||||
opts.cb(null, res);
|
||||
}
|
||||
});
|
||||
})
|
||||
.on("error", function (err) {
|
||||
if (err.code === "ECONNREFUSED") {
|
||||
err.message = "Browsersync not running at " + flags.url;
|
||||
}
|
||||
return opts.cb(err);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=command.reload.js.map
|
1
node_modules/browser-sync/dist/cli/command.reload.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/command.reload.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.reload.js","sourceRoot":"","sources":["../../lib/cli/command.reload.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,IAAI;IAC1B,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;QACZ,KAAK,CAAC,GAAG,GAAG,mBAAmB,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;KAC1D;IACD,IAAI,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxC,IAAI,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,IAAI,IAAI,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAEhC,IAAI,KAAK,CAAC,KAAK,EAAE;QACb,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC;KAC3B;IAED,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,IAAI,MAAM,KAAK,OAAO,EAAE;QACpB,OAAO,CAAC,GAAG,CAAC,4BAA4B,GAAG,GAAG,CAAC;KAClD;IAED,OAAO,CAAC,MAAM,CAAC;SACV,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG;QAClB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE;YACX,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,EAAE;gBACxB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aACtB;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;SACD,EAAE,CAAC,OAAO,EAAE,UAAS,GAAG;QACrB,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE;YAC7B,GAAG,CAAC,OAAO,GAAG,6BAA6B,GAAG,KAAK,CAAC,GAAG,CAAC;SAC3D;QACD,OAAO,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACX,CAAC,CAAC"}
|
98
node_modules/browser-sync/dist/cli/command.start.js
generated
vendored
Normal file
98
node_modules/browser-sync/dist/cli/command.start.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fs_1 = require("fs");
|
||||
const immutable_1 = require("immutable");
|
||||
const utils = require("../utils");
|
||||
const cli_options_1 = require("./cli-options");
|
||||
const _ = require("../lodash.custom");
|
||||
/**
|
||||
* $ browser-sync start <options>
|
||||
*
|
||||
* This commands starts the Browsersync servers
|
||||
* & Optionally UI.
|
||||
*
|
||||
* @param opts
|
||||
* @returns {Function}
|
||||
*/
|
||||
function default_1(opts) {
|
||||
const flags = preprocessFlags(opts.cli.flags);
|
||||
const cwd = flags.cwd || process.cwd();
|
||||
const maybepkg = path.resolve(cwd, "package.json");
|
||||
let input = flags;
|
||||
if (flags.config) {
|
||||
const maybeconf = path.resolve(cwd, flags.config);
|
||||
if ((0, fs_1.existsSync)(maybeconf)) {
|
||||
const conf = require(maybeconf);
|
||||
input = _.merge({}, conf, flags);
|
||||
}
|
||||
else {
|
||||
utils.fail(true, new Error(`Configuration file '${flags.config}' not found`), opts.cb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((0, fs_1.existsSync)(maybepkg)) {
|
||||
const pkg = require(maybepkg);
|
||||
if (pkg["browser-sync"]) {
|
||||
console.log("> Configuration obtained from package.json");
|
||||
input = _.merge({}, pkg["browser-sync"], flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
return require("../")
|
||||
.create("cli")
|
||||
.init(input, opts.cb);
|
||||
}
|
||||
exports.default = default_1;
|
||||
/**
|
||||
* @param flags
|
||||
* @returns {*}
|
||||
*/
|
||||
function preprocessFlags(flags) {
|
||||
return [
|
||||
stripUndefined,
|
||||
legacyFilesArgs,
|
||||
removeWatchBooleanWhenFalse
|
||||
].reduce((flags, fn) => fn.call(null, flags), flags);
|
||||
}
|
||||
/**
|
||||
* Incoming undefined values are problematic as
|
||||
* they interfere with Immutable.Map.mergeDeep
|
||||
* @param subject
|
||||
* @returns {*}
|
||||
*/
|
||||
function stripUndefined(subject) {
|
||||
return Object.keys(subject).reduce((acc, key) => {
|
||||
const value = subject[key];
|
||||
if (typeof value === "undefined") {
|
||||
return acc;
|
||||
}
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
/**
|
||||
* @param flags
|
||||
* @returns {*}
|
||||
*/
|
||||
function legacyFilesArgs(flags) {
|
||||
if (flags.files && flags.files.length) {
|
||||
flags.files = flags.files.reduce((acc, item) => acc.concat((0, cli_options_1.explodeFilesArg)(item)), []);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
/**
|
||||
* `watch` is a CLI boolean so should be removed if false to
|
||||
* allow config to set watch: true
|
||||
* @param flags
|
||||
* @returns {any}
|
||||
*/
|
||||
function removeWatchBooleanWhenFalse(flags) {
|
||||
if (flags.watch === false) {
|
||||
return (0, immutable_1.fromJS)(flags)
|
||||
.delete("watch")
|
||||
.toJS();
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
//# sourceMappingURL=command.start.js.map
|
1
node_modules/browser-sync/dist/cli/command.start.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/command.start.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.start.js","sourceRoot":"","sources":["../../lib/cli/command.start.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,2BAAgC;AAChC,yCAAmC;AACnC,kCAAkC;AAClC,+CAAgD;AAChD,MAAM,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,mBAAwB,IAAI;IACxB,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACnD,IAAI,KAAK,GAAG,KAAK,CAAC;IAElB,IAAI,KAAK,CAAC,MAAM,EAAE;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QA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G,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAC9B,OAAO,GAAG,CAAC;SACd;QACD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACjB,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAK;IAC1B,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;QACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAC5B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,6BAAe,EAAC,IAAI,CAAC,CAAC,EAChD,EAAE,CACL,CAAC;KACL;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAAC,KAAK;IACtC,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE;QACvB,OAAO,IAAA,kBAAM,EAAC,KAAK,CAAC;aACf,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,EAAE,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
11
node_modules/browser-sync/dist/cli/transforms/addCwdToWatchOptions.js
generated
vendored
Normal file
11
node_modules/browser-sync/dist/cli/transforms/addCwdToWatchOptions.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addCwdToWatchOptions = void 0;
|
||||
function addCwdToWatchOptions(incoming) {
|
||||
const output = incoming.updateIn(["watchOptions", "cwd"], watchCwd => {
|
||||
return watchCwd || incoming.get("cwd");
|
||||
});
|
||||
return [output, []];
|
||||
}
|
||||
exports.addCwdToWatchOptions = addCwdToWatchOptions;
|
||||
//# sourceMappingURL=addCwdToWatchOptions.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/addCwdToWatchOptions.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/addCwdToWatchOptions.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"addCwdToWatchOptions.js","sourceRoot":"","sources":["../../../lib/cli/transforms/addCwdToWatchOptions.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAAC,QAAuB;IACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,EAAE;QACjE,OAAO,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AAND,oDAMC"}
|
30
node_modules/browser-sync/dist/cli/transforms/addDefaultIgnorePatterns.js
generated
vendored
Normal file
30
node_modules/browser-sync/dist/cli/transforms/addDefaultIgnorePatterns.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addDefaultIgnorePatterns = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const defaultIgnorePatterns = [
|
||||
/node_modules/,
|
||||
/bower_components/,
|
||||
".sass-cache",
|
||||
".vscode",
|
||||
".git",
|
||||
".idea"
|
||||
];
|
||||
function addDefaultIgnorePatterns(incoming) {
|
||||
if (!incoming.get("watch")) {
|
||||
return [incoming, []];
|
||||
}
|
||||
const output = incoming.update("watchOptions", watchOptions => {
|
||||
const userIgnored = (0, immutable_1.List)([])
|
||||
.concat(watchOptions.get("ignored"))
|
||||
.filter(Boolean)
|
||||
.toSet();
|
||||
const merged = userIgnored.merge(defaultIgnorePatterns);
|
||||
return watchOptions.merge({
|
||||
ignored: merged.toList()
|
||||
});
|
||||
});
|
||||
return [output, []];
|
||||
}
|
||||
exports.addDefaultIgnorePatterns = addDefaultIgnorePatterns;
|
||||
//# sourceMappingURL=addDefaultIgnorePatterns.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/addDefaultIgnorePatterns.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/addDefaultIgnorePatterns.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"addDefaultIgnorePatterns.js","sourceRoot":"","sources":["../../../lib/cli/transforms/addDefaultIgnorePatterns.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAGjC,MAAM,qBAAqB,GAAG;IAC1B,cAAc;IACd,kBAAkB;IAClB,aAAa;IACb,SAAS;IACT,MAAM;IACN,OAAO;CACV,CAAC;AAEF,SAAgB,wBAAwB,CACpC,QAAuB;IAEvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACxB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACzB;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE;QAC1D,MAAM,WAAW,GAAG,IAAA,gBAAI,EAAC,EAAE,CAAC;aACvB,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;aACnC,MAAM,CAAC,OAAO,CAAC;aACf,KAAK,EAAE,CAAC;QAEb,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAExD,OAAO,YAAY,CAAC,KAAK,CAAC;YACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;SAC3B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AArBD,4DAqBC"}
|
48
node_modules/browser-sync/dist/cli/transforms/addToFilesOption.js
generated
vendored
Normal file
48
node_modules/browser-sync/dist/cli/transforms/addToFilesOption.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addToFilesOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
function addToFilesOption(incoming) {
|
||||
if (!incoming.get("watch")) {
|
||||
return [incoming, []];
|
||||
}
|
||||
let serverPaths = [];
|
||||
const fromServeStatic = incoming.get("serveStatic", (0, immutable_1.List)([])).toArray();
|
||||
const ssPaths = fromServeStatic.reduce((acc, ss) => {
|
||||
if (typeof ss === "string") {
|
||||
return acc.concat(ss);
|
||||
}
|
||||
if (ss.dir && typeof ss.dir === "string") {
|
||||
return acc.concat(ss);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
ssPaths.forEach(p => serverPaths.push(p));
|
||||
const server = incoming.get("server");
|
||||
if (server) {
|
||||
if (server === true) {
|
||||
serverPaths.push(".");
|
||||
}
|
||||
if (typeof server === "string") {
|
||||
serverPaths.push(server);
|
||||
}
|
||||
if (immutable_1.List.isList(server) && server.every(x => typeof x === "string")) {
|
||||
server.forEach(s => serverPaths.push(s));
|
||||
}
|
||||
if (immutable_1.Map.isMap(server)) {
|
||||
const baseDirProp = server.get("baseDir");
|
||||
const baseDirs = (0, immutable_1.List)([])
|
||||
.concat(baseDirProp)
|
||||
.filter(Boolean);
|
||||
baseDirs.forEach(s => serverPaths.push(s));
|
||||
}
|
||||
}
|
||||
const output = incoming.update("files", files => {
|
||||
return (0, immutable_1.List)([])
|
||||
.concat(files, serverPaths)
|
||||
.filter(Boolean);
|
||||
});
|
||||
return [output, []];
|
||||
}
|
||||
exports.addToFilesOption = addToFilesOption;
|
||||
//# sourceMappingURL=addToFilesOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/addToFilesOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/addToFilesOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"addToFilesOption.js","sourceRoot":"","sources":["../../../lib/cli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OAAO,CAAC,KAAK,QAAQ,CAAC,EAAE;YACjE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5C;QACD,IAAI,eAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YACnB,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,EAAE,CAAC;iBACpB,MAAM,CAAC,WAAW,CAAC;iBACnB,MAAM,CAAC,OAAO,CAAC,CAAC;YACrB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;KACJ;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;QAC5C,OAAO,IAAA,gBAAI,EAAC,EAAE,CAAC;aACV,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC;aAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AA9CD,4CA8CC"}
|
16
node_modules/browser-sync/dist/cli/transforms/appendServerDirectoryOption.js
generated
vendored
Normal file
16
node_modules/browser-sync/dist/cli/transforms/appendServerDirectoryOption.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.appendServerDirectoryOption = void 0;
|
||||
function appendServerDirectoryOption(incoming) {
|
||||
if (!incoming.get("server"))
|
||||
return [incoming, []];
|
||||
if (incoming.get("directory")) {
|
||||
return [
|
||||
incoming.setIn(["server", "directory"], incoming.has("directory")),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.appendServerDirectoryOption = appendServerDirectoryOption;
|
||||
//# sourceMappingURL=appendServerDirectoryOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/appendServerDirectoryOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/appendServerDirectoryOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"appendServerDirectoryOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/appendServerDirectoryOption.ts"],"names":[],"mappings":";;;AAEA,SAAgB,2BAA2B,CACvC,QAAuB;IAEvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACnD,IAAI,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QAC3B,OAAO;YACH,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClE,EAAE;SACL,CAAC;KACL;IACD,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAXD,kEAWC"}
|
14
node_modules/browser-sync/dist/cli/transforms/appendServerIndexOption.js
generated
vendored
Normal file
14
node_modules/browser-sync/dist/cli/transforms/appendServerIndexOption.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.appendServerIndexOption = void 0;
|
||||
function appendServerIndexOption(incoming) {
|
||||
if (!incoming.get("server"))
|
||||
return [incoming, []];
|
||||
const value = incoming.get("index");
|
||||
if (value) {
|
||||
return [incoming.setIn(["server", "index"], value), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.appendServerIndexOption = appendServerIndexOption;
|
||||
//# sourceMappingURL=appendServerIndexOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/appendServerIndexOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/appendServerIndexOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"appendServerIndexOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/appendServerIndexOption.ts"],"names":[],"mappings":";;;AAEA,SAAgB,uBAAuB,CACnC,QAAuB;IAEvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,KAAK,EAAE;QACP,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;KAC3D;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAXD,0DAWC"}
|
15
node_modules/browser-sync/dist/cli/transforms/copyCLIIgnoreToWatchOptions.js
generated
vendored
Normal file
15
node_modules/browser-sync/dist/cli/transforms/copyCLIIgnoreToWatchOptions.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.copyCLIIgnoreToWatchOptions = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
function copyCLIIgnoreToWatchOptions(incoming) {
|
||||
if (!incoming.get("ignore")) {
|
||||
return [incoming, []];
|
||||
}
|
||||
const output = incoming.updateIn(["watchOptions", "ignored"], (0, immutable_1.List)([]), ignored => {
|
||||
return (0, immutable_1.List)([]).concat(ignored, incoming.get("ignore"));
|
||||
});
|
||||
return [output, []];
|
||||
}
|
||||
exports.copyCLIIgnoreToWatchOptions = copyCLIIgnoreToWatchOptions;
|
||||
//# sourceMappingURL=copyCLIIgnoreToWatchOptions.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/copyCLIIgnoreToWatchOptions.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/copyCLIIgnoreToWatchOptions.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"copyCLIIgnoreToWatchOptions.js","sourceRoot":"","sources":["../../../lib/cli/transforms/copyCLIIgnoreToWatchOptions.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAGjC,SAAgB,2BAA2B,CACvC,QAAuB;IAEvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACzB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACzB;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAC5B,CAAC,cAAc,EAAE,SAAS,CAAC,EAC3B,IAAA,gBAAI,EAAC,EAAE,CAAC,EACR,OAAO,CAAC,EAAE;QACN,OAAO,IAAA,gBAAI,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,CAAC,CACJ,CAAC;IAEF,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AAfD,kEAeC"}
|
21
node_modules/browser-sync/dist/cli/transforms/handleExtensionsOption.js
generated
vendored
Normal file
21
node_modules/browser-sync/dist/cli/transforms/handleExtensionsOption.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleExtensionsOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const cli_options_1 = require("../cli-options");
|
||||
const _ = require("../../lodash.custom");
|
||||
function handleExtensionsOption(incoming) {
|
||||
const value = incoming.get("extensions");
|
||||
if (_.isString(value)) {
|
||||
const split = (0, cli_options_1.explodeFilesArg)(value);
|
||||
if (split.length) {
|
||||
return [incoming.set("extensions", (0, immutable_1.List)(split)), []];
|
||||
}
|
||||
}
|
||||
if (immutable_1.List.isList(value)) {
|
||||
return [incoming.set("extensions", value), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.handleExtensionsOption = handleExtensionsOption;
|
||||
//# sourceMappingURL=handleExtensionsOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleExtensionsOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleExtensionsOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleExtensionsOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleExtensionsOption.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AACjC,gDAIwB;AAExB,MAAM,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEzC,SAAgB,sBAAsB,CAClC,QAAuB;IAEvB,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,KAAK,GAAG,IAAA,6BAAe,EAAC,KAAK,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,MAAM,EAAE;YACd,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,IAAA,gBAAI,EAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACxD;KACJ;IACD,IAAI,gBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;KAClD;IACD,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAdD,wDAcC"}
|
24
node_modules/browser-sync/dist/cli/transforms/handleFilesOption.js
generated
vendored
Normal file
24
node_modules/browser-sync/dist/cli/transforms/handleFilesOption.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleFilesOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const cli_options_1 = require("../cli-options");
|
||||
function handleFilesOption(incoming) {
|
||||
const value = incoming.get("files");
|
||||
const namespaces = {
|
||||
core: {
|
||||
globs: [],
|
||||
objs: []
|
||||
}
|
||||
};
|
||||
const processed = (0, cli_options_1.makeFilesArg)(value);
|
||||
if (processed.globs.length) {
|
||||
namespaces.core.globs = processed.globs;
|
||||
}
|
||||
if (processed.objs.length) {
|
||||
namespaces.core.objs = processed.objs;
|
||||
}
|
||||
return [incoming.set("files", (0, immutable_1.fromJS)(namespaces)), []];
|
||||
}
|
||||
exports.handleFilesOption = handleFilesOption;
|
||||
//# sourceMappingURL=handleFilesOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleFilesOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleFilesOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleFilesOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleFilesOption.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AACnC,gDAA8E;AAG9E,SAAgB,iBAAiB,CAAC,QAAuB;IACrD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,UAAU,GAAoB;QAChC,IAAI,EAAE;YACF,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE;SACX;KACJ,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,0BAAY,EAAC,KAAK,CAAC,CAAC;IAEtC,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE;QACxB,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;KAC3C;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE;QACvB,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;KACzC;IAED,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,kBAAM,EAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC;AApBD,8CAoBC"}
|
58
node_modules/browser-sync/dist/cli/transforms/handleGhostModeOption.js
generated
vendored
Normal file
58
node_modules/browser-sync/dist/cli/transforms/handleGhostModeOption.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleGhostModeOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
function handleGhostModeOption(incoming) {
|
||||
const value = incoming.get("ghostMode");
|
||||
var trueAll = {
|
||||
clicks: true,
|
||||
scroll: true,
|
||||
forms: {
|
||||
submit: true,
|
||||
inputs: true,
|
||||
toggles: true
|
||||
}
|
||||
};
|
||||
var falseAll = {
|
||||
clicks: false,
|
||||
scroll: false,
|
||||
forms: {
|
||||
submit: false,
|
||||
inputs: false,
|
||||
toggles: false
|
||||
}
|
||||
};
|
||||
if (value === false || value === "false") {
|
||||
return [incoming.set("ghostMode", (0, immutable_1.fromJS)(falseAll)), []];
|
||||
}
|
||||
if (value === true || value === "true") {
|
||||
return [incoming.set("ghostMode", (0, immutable_1.fromJS)(trueAll)), []];
|
||||
}
|
||||
if (value.get("forms") === false) {
|
||||
return [
|
||||
incoming.set("ghostMode", value.withMutations(function (map) {
|
||||
map.set("forms", (0, immutable_1.fromJS)({
|
||||
submit: false,
|
||||
inputs: false,
|
||||
toggles: false
|
||||
}));
|
||||
})),
|
||||
[]
|
||||
];
|
||||
}
|
||||
if (value.get("forms") === true) {
|
||||
return [
|
||||
incoming.set("ghostMode", value.withMutations(function (map) {
|
||||
map.set("forms", (0, immutable_1.fromJS)({
|
||||
submit: true,
|
||||
inputs: true,
|
||||
toggles: true
|
||||
}));
|
||||
})),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.handleGhostModeOption = handleGhostModeOption;
|
||||
//# sourceMappingURL=handleGhostModeOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleGhostModeOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleGhostModeOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleGhostModeOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleGhostModeOption.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AAGnC,SAAgB,qBAAqB,CACjC,QAAuB;IAEvB,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,OAAO,GAAG;QACV,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE;YACH,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;SAChB;KACJ,CAAC;IAEF,IAAI,QAAQ,GAAG;QACX,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE;YACH,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,KAAK;SACjB;KACJ,CAAC;IAEF,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO,EAAE;QACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,IAAA,kBAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC5D;IAED,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,EAAE;QACpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,IAAA,kBAAM,EAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC3D;IAED,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE;QAC9B,OAAO;YACH,QAAQ,CAAC,GAAG,CACR,WAAW,EACX,KAAK,CAAC,aAAa,CAAC,UAAS,GAAG;gBAC5B,GAAG,CAAC,GAAG,CACH,OAAO,EACP,IAAA,kBAAM,EAAC;oBACH,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE,KAAK;iBACjB,CAAC,CACL,CAAC;YACN,CAAC,CAAC,CACL;YACD,EAAE;SACL,CAAC;KACL;IAED,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;QAC7B,OAAO;YACH,QAAQ,CAAC,GAAG,CACR,WAAW,EACX,KAAK,CAAC,aAAa,CAAC,UAAS,GAAG;gBAC5B,GAAG,CAAC,GAAG,CACH,OAAO,EACP,IAAA,kBAAM,EAAC;oBACH,MAAM,EAAE,IAAI;oBACZ,MAAM,EAAE,IAAI;oBACZ,OAAO,EAAE,IAAI;iBAChB,CAAC,CACL,CAAC;YACN,CAAC,CAAC,CACL;YACD,EAAE;SACL,CAAC;KACL;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAvED,sDAuEC"}
|
38
node_modules/browser-sync/dist/cli/transforms/handleHostOption.js
generated
vendored
Normal file
38
node_modules/browser-sync/dist/cli/transforms/handleHostOption.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleHostOption = void 0;
|
||||
const bin_1 = require("../../bin");
|
||||
function handleHostOption(incoming) {
|
||||
const host = incoming.get("host");
|
||||
const listen = incoming.get("listen");
|
||||
if (host && listen) {
|
||||
if (host !== listen) {
|
||||
return [
|
||||
incoming,
|
||||
[
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
error: new Error("Cannot specify both `host` and `listen` options"),
|
||||
meta() {
|
||||
return [
|
||||
"",
|
||||
"Tip: Use just the `listen` option *only* if you want to bind only to a particular host."
|
||||
];
|
||||
}
|
||||
}
|
||||
],
|
||||
level: bin_1.BsErrorLevels.Fatal,
|
||||
type: bin_1.BsErrorTypes.HostAndListenIncompatible
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
// whenever we have have both `host` + `listen` options,
|
||||
// we remove the 'host' to prevent complication further down the line
|
||||
return [incoming.delete("host"), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.handleHostOption = handleHostOption;
|
||||
//# sourceMappingURL=handleHostOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleHostOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleHostOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleHostOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleHostOption.ts"],"names":[],"mappings":";;;AACA,mCAAwD;AAExD,SAAgB,gBAAgB,CAAC,QAAuB;IACpD,MAAM,IAAI,GAAkB,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,MAAM,GAAkB,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErD,IAAI,IAAI,IAAI,MAAM,EAAE;QAChB,IAAI,IAAI,KAAK,MAAM,EAAE;YACjB,OAAO;gBACH,QAAQ;gBACR;oBACI;wBACI,MAAM,EAAE;4BACJ;gCACI,KAAK,EAAE,IAAI,KAAK,CACZ,iDAAiD,CACpD;gCACD,IAAI;oCACA,OAAO;wCACH,EAAE;wCACF,mGAAmG;qCACtG,CAAC;gCACN,CAAC;6BACJ;yBACJ;wBACD,KAAK,EAAE,mBAAa,CAAC,KAAK;wBAC1B,IAAI,EAAE,kBAAY,CAAC,yBAAyB;qBAC/C;iBACJ;aACJ,CAAC;SACL;QAED,wDAAwD;QACxD,qEAAqE;QACrE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;KACxC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AApCD,4CAoCC"}
|
28
node_modules/browser-sync/dist/cli/transforms/handlePortsOption.js
generated
vendored
Normal file
28
node_modules/browser-sync/dist/cli/transforms/handlePortsOption.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handlePortsOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
function handlePortsOption(incoming) {
|
||||
const value = incoming.get("ports");
|
||||
if (!value)
|
||||
return [incoming, []];
|
||||
const obj = { min: null, max: null };
|
||||
if (typeof value === "string") {
|
||||
if (~value.indexOf(",")) {
|
||||
const segs = value.split(",");
|
||||
obj.min = parseInt(segs[0], 10);
|
||||
obj.max = parseInt(segs[1], 10);
|
||||
}
|
||||
else {
|
||||
obj.min = parseInt(value, 10);
|
||||
obj.max = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.min = value.get("min");
|
||||
obj.max = value.get("max") || null;
|
||||
}
|
||||
return [incoming.set("ports", (0, immutable_1.Map)(obj)), []];
|
||||
}
|
||||
exports.handlePortsOption = handlePortsOption;
|
||||
//# sourceMappingURL=handlePortsOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handlePortsOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handlePortsOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handlePortsOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handlePortsOption.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAIhC,SAAgB,iBAAiB,CAAC,QAAuB;IACrD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAElC,MAAM,GAAG,GAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAElD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACrB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC9B,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChC,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACnC;aAAM;YACH,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9B,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC;SAClB;KACJ;SAAM;QACH,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;KACtC;IAED,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,eAAG,EAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AArBD,8CAqBC"}
|
39
node_modules/browser-sync/dist/cli/transforms/handleProxyOption.js
generated
vendored
Normal file
39
node_modules/browser-sync/dist/cli/transforms/handleProxyOption.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleProxyOption = void 0;
|
||||
const url = require("url");
|
||||
const immutable_1 = require("immutable");
|
||||
function handleProxyOption(incoming) {
|
||||
let value = incoming.get("proxy");
|
||||
let mw;
|
||||
let target;
|
||||
if (!value || value === true) {
|
||||
return [incoming, []];
|
||||
}
|
||||
if (typeof value !== "string") {
|
||||
target = value.get("target");
|
||||
mw = value.get("middleware");
|
||||
}
|
||||
else {
|
||||
target = value;
|
||||
value = (0, immutable_1.Map)({});
|
||||
}
|
||||
if (!target.match(/^(https?):\/\//)) {
|
||||
target = "http://" + target;
|
||||
}
|
||||
const parsedUrl = url.parse(target);
|
||||
if (!parsedUrl.port) {
|
||||
parsedUrl.port = "80";
|
||||
}
|
||||
const out = {
|
||||
target: parsedUrl.protocol + "//" + parsedUrl.host,
|
||||
url: (0, immutable_1.Map)(parsedUrl)
|
||||
};
|
||||
if (mw) {
|
||||
out.middleware = mw;
|
||||
}
|
||||
const proxyOutput = value.mergeDeep(out);
|
||||
return [incoming.set("proxy", proxyOutput), []];
|
||||
}
|
||||
exports.handleProxyOption = handleProxyOption;
|
||||
//# sourceMappingURL=handleProxyOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleProxyOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleProxyOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleProxyOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleProxyOption.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAC3B,yCAAgC;AAIhC,SAAgB,iBAAiB,CAAC,QAAuB;IACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC;IACP,IAAI,MAAM,CAAC;IAEX,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,EAAE;QAC1B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACzB;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;KAChC;SAAM;QACH,MAAM,GAAG,KAAK,CAAC;QACf,KAAK,GAAG,IAAA,eAAG,EAAC,EAAE,CAAC,CAAC;KACnB;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;QACjC,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;KAC/B;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEpC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;QACjB,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;KACzB;IAED,MAAM,GAAG,GAAqB;QAC1B,MAAM,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,IAAI;QAClD,GAAG,EAAE,IAAA,eAAG,EAAC,SAAS,CAAC;KACtB,CAAC;IAEF,IAAI,EAAE,EAAE;QACJ,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;KACvB;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAvCD,8CAuCC"}
|
40
node_modules/browser-sync/dist/cli/transforms/handleServerOption.js
generated
vendored
Normal file
40
node_modules/browser-sync/dist/cli/transforms/handleServerOption.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handleServerOption = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
function handleServerOption(incoming) {
|
||||
const value = incoming.get("server");
|
||||
if (value === false) {
|
||||
return [incoming, []];
|
||||
}
|
||||
// server: true
|
||||
if (value === true) {
|
||||
const obj = {
|
||||
baseDir: ["./"]
|
||||
};
|
||||
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []];
|
||||
}
|
||||
// server: "./app"
|
||||
if (typeof value === "string") {
|
||||
const obj = {
|
||||
baseDir: [value]
|
||||
};
|
||||
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []];
|
||||
}
|
||||
if (immutable_1.List.isList(value)) {
|
||||
const obj = {
|
||||
baseDir: value
|
||||
};
|
||||
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []];
|
||||
}
|
||||
if (immutable_1.Map.isMap(value)) {
|
||||
const dirs = (0, immutable_1.List)([])
|
||||
.concat(value.get("baseDir", "./"))
|
||||
.filter(Boolean);
|
||||
const merged = value.merge({ baseDir: dirs });
|
||||
return [incoming.set("server", merged), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.handleServerOption = handleServerOption;
|
||||
//# sourceMappingURL=handleServerOption.js.map
|
1
node_modules/browser-sync/dist/cli/transforms/handleServerOption.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/cli/transforms/handleServerOption.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"handleServerOption.js","sourceRoot":"","sources":["../../../lib/cli/transforms/handleServerOption.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAG9C,SAAgB,kBAAkB,CAAC,QAAuB;IACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,KAAK,KAAK,KAAK,EAAE;QACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACzB;IAED,eAAe;IACf,IAAI,KAAK,KAAK,IAAI,EAAE;QAChB,MAAM,GAAG,GAAkB;YACvB,OAAO,EAAE,CAAC,IAAI,CAAC;SAClB,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,kBAAM,EAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACpD;IAED,kBAAkB;IAClB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,MAAM,GAAG,GAAkB;YACvB,OAAO,EAAE,CAAC,KAAK,CAAC;SACnB,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,kBAAM,EAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACpD;IAED,IAAI,gBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QACpB,MAAM,GAAG,GAAkB;YACvB,OAAO,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,kBAAM,EAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACpD;IAED,IAAI,eAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,EAAE,CAAC;aAChB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aAClC,MAAM,CAAC,OAAO,CAAC,CAAC;QAErB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;KAC/C;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAxCD,gDAwCC"}
|
31
node_modules/browser-sync/dist/config.js
generated
vendored
Normal file
31
node_modules/browser-sync/dist/config.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var path = require("path");
|
||||
/**
|
||||
* @type {{controlPanel: {jsFile: string, baseDir: *}, socketIoScript: string, configFile: string, client: {shims: string}}}
|
||||
*/
|
||||
module.exports = {
|
||||
controlPanel: {
|
||||
jsFile: "/js/app.js",
|
||||
baseDir: path.join(__dirname, "control-panel")
|
||||
},
|
||||
templates: {
|
||||
scriptTag: path.join(__dirname, "..", "templates/script-tags.html"),
|
||||
scriptTagSimple: path.join(__dirname, "..", "templates/script-tags-simple.html"),
|
||||
connector: path.join(__dirname, "..", "templates/connector.tmpl")
|
||||
},
|
||||
socketIoScript: "/public/socket.io.min.1.6.0.js",
|
||||
configFile: "default-config.js",
|
||||
userFile: "bs-config.js",
|
||||
template: path.join(__dirname, "..", "templates/cli-template.js"),
|
||||
httpProtocol: {
|
||||
path: "/__browser_sync__"
|
||||
},
|
||||
client: {
|
||||
shims: "/client/client-shims.js"
|
||||
},
|
||||
errors: {
|
||||
"server+proxy": "Invalid config. You cannot specify both server & proxy options.",
|
||||
"proxy+https": "Invalid config. You set https: true, but your proxy target doesn't reflect this."
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=config.js.map
|
1
node_modules/browser-sync/dist/config.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/config.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"config.js","sourceRoot":"","sources":["../lib/config.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B;;GAEG;AACH,MAAM,CAAC,OAAO,GAAG;IACb,YAAY,EAAE;QACV,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC;KACjD;IACD,SAAS,EAAE;QACP,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,4BAA4B,CAAC;QACnE,eAAe,EAAE,IAAI,CAAC,IAAI,CACtB,SAAS,EACT,IAAI,EACJ,mCAAmC,CACtC;QACD,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,0BAA0B,CAAC;KACpE;IACD,cAAc,EAAE,gCAAgC;IAChD,UAAU,EAAE,mBAAmB;IAC/B,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,2BAA2B,CAAC;IACjE,YAAY,EAAE;QACV,IAAI,EAAE,mBAAmB;KAC5B;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,yBAAyB;KACnC;IACD,MAAM,EAAE;QACJ,cAAc,EACV,iEAAiE;QACrE,aAAa,EACT,kFAAkF;KACzF;CACJ,CAAC"}
|
226
node_modules/browser-sync/dist/connect-utils.js
generated
vendored
Normal file
226
node_modules/browser-sync/dist/connect-utils.js
generated
vendored
Normal file
@ -0,0 +1,226 @@
|
||||
"use strict";
|
||||
var _ = require("./lodash.custom");
|
||||
var fs = require("fs");
|
||||
var config = require("./config");
|
||||
function getPath(options, relative, port) {
|
||||
if (options.get("mode") === "snippet") {
|
||||
return options.get("scheme") + "://HOST:" + port + relative;
|
||||
}
|
||||
else {
|
||||
return "//HOST:" + port + relative;
|
||||
}
|
||||
}
|
||||
var connectUtils = {
|
||||
/**
|
||||
* Allow users to disable the Browsersync snippet
|
||||
* @param {Immutable.Map} options
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
enabled: function (options) {
|
||||
const userValue = options.get("snippet");
|
||||
if (typeof userValue === "boolean") {
|
||||
return userValue;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
* @param {Immutable.Map} options
|
||||
* @returns {String}
|
||||
*/
|
||||
scriptTags: function (options) {
|
||||
var scriptPath = this.clientScript(options);
|
||||
var async = options.getIn(["snippetOptions", "async"]);
|
||||
var scriptDomain = options.getIn(["script", "domain"]);
|
||||
/**
|
||||
* Generate the [src] attribute based on user options
|
||||
*/
|
||||
var scriptSrc = (function () {
|
||||
if (options.get("localOnly")) {
|
||||
return [
|
||||
options.get("scheme"),
|
||||
"://localhost:",
|
||||
options.get("port"),
|
||||
scriptPath
|
||||
].join("");
|
||||
}
|
||||
/**
|
||||
* First, was "scriptPath" set? if so the user wanted full control over the
|
||||
* script tag output
|
||||
*
|
||||
*/
|
||||
if (_.isFunction(options.get("scriptPath"))) {
|
||||
return options
|
||||
.get("scriptPath")
|
||||
.apply(null, getScriptArgs(options, scriptPath));
|
||||
}
|
||||
/**
|
||||
* Next, if "script.domain" was given, allow that + the path to the JS file
|
||||
* eg:
|
||||
* script.domain=localhost:3000
|
||||
* -> localhost:3000/browser-sync/browser-sync-client.js
|
||||
*/
|
||||
if (scriptDomain) {
|
||||
if (_.isFunction(scriptDomain)) {
|
||||
return scriptDomain.call(null, options) + scriptPath;
|
||||
}
|
||||
if (scriptDomain.match(/\{port\}/)) {
|
||||
return (scriptDomain.replace("{port}", options.get("port")) +
|
||||
scriptPath);
|
||||
}
|
||||
return scriptDomain + scriptPath;
|
||||
}
|
||||
/**
|
||||
* Now if server or proxy, use dynamic script
|
||||
* eg:
|
||||
* browser-sync start --server
|
||||
* ->
|
||||
* "HOST:3000/browser-sync/browser-sync-client.js".replace("HOST", location.hostname)
|
||||
*/
|
||||
if (options.get("server") || options.get("proxy")) {
|
||||
return scriptPath;
|
||||
}
|
||||
/**
|
||||
* Final use case is snippet mode
|
||||
* -> "http://HOST:3000/browser-sync/browser-sync-client.js".replace("HOST", location.hostname)
|
||||
* -> "//HOST:3000/browser-sync/browser-sync-client.js".replace("HOST", location.hostname)"
|
||||
*/
|
||||
return getPath(options, scriptPath, options.get("port"));
|
||||
})();
|
||||
/**
|
||||
* Decide which template shall be used to generate the script tags
|
||||
*/
|
||||
var template = (function () {
|
||||
if (scriptDomain || options.get("localOnly")) {
|
||||
return config.templates.scriptTagSimple;
|
||||
}
|
||||
return config.templates.scriptTag;
|
||||
})();
|
||||
/**
|
||||
* Finally read the template file from disk and replace
|
||||
* the dynamic values.
|
||||
*/
|
||||
return fs
|
||||
.readFileSync(template, "utf8")
|
||||
.replace("%script%", scriptSrc)
|
||||
.replace("%async%", async ? "async" : "");
|
||||
},
|
||||
/**
|
||||
* @param {Map} options
|
||||
* @returns {String}
|
||||
*/
|
||||
socketConnector: function (options) {
|
||||
var socket = options.get("socket");
|
||||
var template = fs.readFileSync(config.templates.connector, "utf-8");
|
||||
var url = connectUtils.getConnectionUrl(options);
|
||||
/**
|
||||
* ***Backwards compatibility***. While `socket.path` is technically a
|
||||
* socketIoClientConfig property, it's been documented previously
|
||||
* as a top-level option, so must stay.
|
||||
*/
|
||||
var clientConfig = socket.get("socketIoClientConfig").merge({
|
||||
path: socket.get("path")
|
||||
});
|
||||
template = template
|
||||
.replace("%config%", JSON.stringify(clientConfig.toJS()))
|
||||
.replace("%options%", JSON.stringify(options))
|
||||
.replace("%url%", url);
|
||||
return template;
|
||||
},
|
||||
/**
|
||||
* @param {Object} socketOpts
|
||||
* @param {Map} options
|
||||
* @returns {String|Function}
|
||||
*/
|
||||
getNamespace: function (socketOpts, options) {
|
||||
var namespace = socketOpts.namespace;
|
||||
if (typeof namespace === "function") {
|
||||
return namespace(options);
|
||||
}
|
||||
if (!namespace.match(/^\//)) {
|
||||
namespace = "/" + namespace;
|
||||
}
|
||||
return namespace;
|
||||
},
|
||||
/**
|
||||
* @param {Map} options
|
||||
* @returns {string}
|
||||
*/
|
||||
getConnectionUrl: function (options) {
|
||||
var socketOpts = options.get("socket").toJS();
|
||||
var namespace = connectUtils.getNamespace(socketOpts, options);
|
||||
var protocol = "";
|
||||
var withHostnamePort = "'{protocol}' + location.hostname + ':{port}{ns}'";
|
||||
var withHost = "'{protocol}' + location.host + '{ns}'";
|
||||
var withDomain = "'{domain}{ns}'";
|
||||
var port = options.get("port");
|
||||
// default use-case is server/proxy
|
||||
var string = withHost;
|
||||
if (options.get("mode") !== "server") {
|
||||
protocol = options.get("scheme") + "://";
|
||||
string = withHostnamePort;
|
||||
}
|
||||
if (options.get("mode") === "proxy" && options.getIn(["proxy", "ws"])) {
|
||||
port = options.getIn(["socket", "port"]);
|
||||
}
|
||||
/**
|
||||
* Ensure socket.domain is always a string (for noop replacements later)
|
||||
*/
|
||||
socketOpts.domain = (function () {
|
||||
if (options.get("localOnly")) {
|
||||
string = withDomain;
|
||||
return [
|
||||
options.get("scheme"),
|
||||
"://localhost:",
|
||||
options.get("port")
|
||||
].join("");
|
||||
}
|
||||
if (socketOpts.domain) {
|
||||
string = withDomain;
|
||||
/**
|
||||
* User provided a function
|
||||
*/
|
||||
if (_.isFunction(socketOpts.domain)) {
|
||||
return socketOpts.domain.call(null, options);
|
||||
}
|
||||
/**
|
||||
* User provided a string
|
||||
*/
|
||||
if (_.isString(socketOpts.domain)) {
|
||||
return socketOpts.domain;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
})();
|
||||
return string
|
||||
.replace("{protocol}", protocol)
|
||||
.replace("{port}", port)
|
||||
.replace("{domain}", socketOpts.domain.replace("{port}", port))
|
||||
.replace("{ns}", namespace);
|
||||
},
|
||||
/**
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [both]
|
||||
*/
|
||||
clientScript: function (options, both) {
|
||||
var prefix = options.getIn(["socket", "clientPath"]);
|
||||
var script = prefix + "/browser-sync-client.js";
|
||||
var versioned = prefix + "/browser-sync-client.js?v=" + options.get("version");
|
||||
if (both) {
|
||||
return {
|
||||
path: script,
|
||||
versioned: versioned
|
||||
};
|
||||
}
|
||||
return versioned;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param options
|
||||
* @returns {*[]}
|
||||
*/
|
||||
function getScriptArgs(options, scriptPath) {
|
||||
var abspath = options.get("scheme") + "://HOST:" + options.get("port") + scriptPath;
|
||||
return [scriptPath, options.get("port"), options.set("absolute", abspath)];
|
||||
}
|
||||
module.exports = connectUtils;
|
||||
//# sourceMappingURL=connect-utils.js.map
|
1
node_modules/browser-sync/dist/connect-utils.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/connect-utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
557
node_modules/browser-sync/dist/default-config.js
generated
vendored
Normal file
557
node_modules/browser-sync/dist/default-config.js
generated
vendored
Normal file
@ -0,0 +1,557 @@
|
||||
/**
|
||||
* @module BrowserSync.options
|
||||
*/
|
||||
module.exports = {
|
||||
/**
|
||||
* Browsersync includes a user-interface that is accessed via a separate port.
|
||||
* The UI allows to controls all devices, push sync updates and much more.
|
||||
* @property ui
|
||||
* @type Object
|
||||
* @param {Number} [port=3001]
|
||||
* @since 2.0.0
|
||||
* @default false
|
||||
*/
|
||||
ui: {
|
||||
port: 3001
|
||||
},
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either
|
||||
* be injected into the page (CSS & images) or will cause all browsers to do
|
||||
* a full-page refresh.
|
||||
* @property files
|
||||
* @type Array|String
|
||||
* @default false
|
||||
*/
|
||||
files: false,
|
||||
/**
|
||||
* Specify which file events to respond to.
|
||||
* Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir`
|
||||
* @property watchEvents
|
||||
* @type Array
|
||||
* @default ["change"]
|
||||
* @since 2.18.8
|
||||
*/
|
||||
watchEvents: ["change"],
|
||||
/**
|
||||
* Watch files automatically - this should be used as an
|
||||
* alternative to the `files` option. When this option is used, some directories
|
||||
* will be ignored automatically such as `node_modules` `bower_components` `.sass-cache`
|
||||
* `.vscode` `.git` `.idea`
|
||||
*
|
||||
* @property watch
|
||||
* @type Boolean
|
||||
* @default false
|
||||
* @since 2.23.0
|
||||
*/
|
||||
watch: false,
|
||||
/**
|
||||
* Patterns for any watchers to ignore. Anything provided here
|
||||
* will end up inside `watchOptions.ignored`
|
||||
* @property ignore
|
||||
* @type Array
|
||||
* @default []
|
||||
* @since 2.23.0
|
||||
*/
|
||||
ignore: [],
|
||||
/**
|
||||
* Serve an index.html file for all non-asset routes. Useful
|
||||
* when using client-routers
|
||||
* @property single
|
||||
* @type Boolean
|
||||
* @default false
|
||||
* @since 2.23.0
|
||||
*/
|
||||
single: false,
|
||||
/**
|
||||
* File watching options that get passed along to [Chokidar](https://github.com/paulmillr/chokidar).
|
||||
* Check their docs for available options
|
||||
* @property watchOptions
|
||||
* @type Object
|
||||
* @default undefined
|
||||
* @since 2.6.0
|
||||
*/
|
||||
watchOptions: {
|
||||
ignoreInitial: true
|
||||
/*
|
||||
persistent: true,
|
||||
|
||||
ignored: '*.txt',
|
||||
followSymlinks: true,
|
||||
cwd: '.',
|
||||
|
||||
usePolling: true,
|
||||
alwaysStat: false,
|
||||
depth: undefined,
|
||||
interval: 100,
|
||||
|
||||
ignorePermissionErrors: false,
|
||||
atomic: true
|
||||
*/
|
||||
},
|
||||
/**
|
||||
* Use the built-in static server for basic HTML/JS/CSS websites.
|
||||
* @property server
|
||||
* @type Object|Boolean
|
||||
* @default false
|
||||
*/
|
||||
server: false,
|
||||
/**
|
||||
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
|
||||
* @property proxy
|
||||
* @type String|Object|Boolean
|
||||
* @param {String} [target]
|
||||
* @param {Boolean} [ws] - Enable websocket proxying
|
||||
* @param {Function|Array} [middleware]
|
||||
* @param {Function} [reqHeaders]
|
||||
* @param {Array} [proxyReq]
|
||||
* @param {Array} [proxyRes]
|
||||
* @default false
|
||||
*/
|
||||
proxy: false,
|
||||
/**
|
||||
* @property port
|
||||
* @type Number
|
||||
* @default 3000
|
||||
*/
|
||||
port: 3000,
|
||||
/**
|
||||
* @property middleware
|
||||
* @type Function|Array
|
||||
* @default false
|
||||
*/
|
||||
middleware: false,
|
||||
/**
|
||||
* Add additional directories from which static
|
||||
* files should be served. Should only be used in `proxy` or `snippet`
|
||||
* mode.
|
||||
* @property serveStatic
|
||||
* @type Array
|
||||
* @default []
|
||||
* @since 2.8.0
|
||||
*/
|
||||
serveStatic: [],
|
||||
/**
|
||||
* Options that are passed to the serve-static middleware
|
||||
* when you use the string[] syntax: eg: `serveStatic: ['./app']`. Please see
|
||||
* [serve-static](https://github.com/expressjs/serve-static) for details
|
||||
*
|
||||
* @property serveStaticOptions
|
||||
* @type Object
|
||||
* @since 2.17.0
|
||||
*/
|
||||
/**
|
||||
* Enable https for localhost development. **Note** - this is not needed for proxy
|
||||
* option as it will be inferred from your target url.
|
||||
* @property https
|
||||
* @type Boolean
|
||||
* @default undefined
|
||||
* @since 1.3.0
|
||||
*/
|
||||
/**
|
||||
* Override http module to allow using 3rd party server modules (such as http2)
|
||||
* *Note*: these modules are not included in the Browsersync package - you need
|
||||
* to 'npm install' any that you'd like to use.
|
||||
* @property httpModule
|
||||
* @type string
|
||||
* @default undefined
|
||||
* @since 2.18.0
|
||||
*/
|
||||
/**
|
||||
* Current working directory
|
||||
* @property cwd
|
||||
* @type String
|
||||
* @since 2.23.0
|
||||
*/
|
||||
/**
|
||||
* Register callbacks via a regular option - this can be used
|
||||
* to get access the Browsersync instance in situations where you
|
||||
* cannot provide a callback via the normal API (for example, in a Gruntfile)
|
||||
*
|
||||
* **Note**: Only the `ready` callback is currently supported here.
|
||||
*
|
||||
* @property callbacks
|
||||
* @type Object
|
||||
* @param {Function} ready
|
||||
*/
|
||||
/**
|
||||
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
|
||||
* @property ghostMode
|
||||
* @param {Boolean} [clicks=true]
|
||||
* @param {Boolean} [scroll=true]
|
||||
* @param {Boolean} [location=true]
|
||||
* @param {Boolean} [forms=true]
|
||||
* @param {Boolean} [forms.submit=true]
|
||||
* @param {Boolean} [forms.inputs=true]
|
||||
* @param {Boolean} [forms.toggles=true]
|
||||
* @type Object
|
||||
*/
|
||||
ghostMode: {
|
||||
clicks: true,
|
||||
scroll: true,
|
||||
location: true,
|
||||
forms: {
|
||||
submit: true,
|
||||
inputs: true,
|
||||
toggles: true
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Can be either "info", "debug", "warn", or "silent"
|
||||
* @property logLevel
|
||||
* @type String
|
||||
* @default info
|
||||
*/
|
||||
logLevel: "info",
|
||||
/**
|
||||
* Change the console logging prefix. Useful if you're creating your
|
||||
* own project based on Browsersync
|
||||
* @property logPrefix
|
||||
* @type String
|
||||
* @default Browsersync
|
||||
* @since 1.5.1
|
||||
*/
|
||||
logPrefix: "Browsersync",
|
||||
/**
|
||||
* @property logConnections
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
logConnections: false,
|
||||
/**
|
||||
* @property logFileChanges
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
logFileChanges: true,
|
||||
/**
|
||||
* Log the snippet to the console when you're in snippet mode (no proxy/server)
|
||||
* @property logSnippet
|
||||
* @type: Boolean
|
||||
* @default true
|
||||
* @since 1.5.2
|
||||
*/
|
||||
logSnippet: true,
|
||||
/**
|
||||
* You can prevent Browsersync from injecting the connection snippet
|
||||
* by passing `snippet: false`.
|
||||
* @property snippet
|
||||
* @type Boolean
|
||||
* @default undefined
|
||||
*/
|
||||
/**
|
||||
* You can control how the snippet is injected
|
||||
* onto each page via a custom regex + function.
|
||||
* You can also provide patterns for certain urls
|
||||
* that should be ignored from the snippet injection.
|
||||
* @property snippetOptions
|
||||
* @since 2.0.0
|
||||
* @param {Boolean} [async] - should the script tags have the async attribute?
|
||||
* @param {Array} [blacklist]
|
||||
* @param {Array} [whitelist]
|
||||
* @param {RegExp} [rule.match=/$/]
|
||||
* @param {Function} [rule.fn=Function]
|
||||
* @type Object
|
||||
*/
|
||||
snippetOptions: {
|
||||
async: true,
|
||||
whitelist: [],
|
||||
blacklist: [],
|
||||
rule: {
|
||||
match: /<body[^>]*>/i,
|
||||
fn: function (snippet, match) {
|
||||
return match + snippet;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Add additional HTML rewriting rules.
|
||||
* @property rewriteRules
|
||||
* @since 2.4.0
|
||||
* @type Array
|
||||
* @default false
|
||||
*/
|
||||
rewriteRules: [],
|
||||
/**
|
||||
* @property tunnel
|
||||
* @type String|Boolean
|
||||
* @default null
|
||||
*/
|
||||
/**
|
||||
* Some features of Browsersync (such as `xip` & `tunnel`) require an internet connection, but if you're
|
||||
* working offline, you can reduce start-up time by setting this option to `false`
|
||||
* @property online
|
||||
* @type Boolean
|
||||
* @default undefined
|
||||
*/
|
||||
/**
|
||||
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
|
||||
* Can be `true`, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false`
|
||||
* @property open
|
||||
* @type Boolean|String
|
||||
* @default true
|
||||
*/
|
||||
open: "local",
|
||||
/**
|
||||
* @property browser
|
||||
* @type String|Array
|
||||
* @default default
|
||||
*/
|
||||
browser: "default",
|
||||
/**
|
||||
* Add HTTP access control (CORS) headers to assets served by Browsersync.
|
||||
* @property cors
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @since 2.16.0
|
||||
*/
|
||||
cors: false,
|
||||
/**
|
||||
* Requires an internet connection - useful for services such as [Typekit](https://typekit.com/)
|
||||
* as it allows you to configure domains such as `*.xip.io` in your kit settings
|
||||
* @property xip
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
xip: false,
|
||||
hostnameSuffix: false,
|
||||
/**
|
||||
* Reload each browser when Browsersync is restarted.
|
||||
* @property reloadOnRestart
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
reloadOnRestart: false,
|
||||
/**
|
||||
* The small pop-over notifications in the browser are not always needed/wanted.
|
||||
* @property notify
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
notify: true,
|
||||
/**
|
||||
* @property scrollProportionally
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
scrollProportionally: true,
|
||||
/**
|
||||
* @property scrollThrottle
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
scrollThrottle: 0,
|
||||
/**
|
||||
* Decide which technique should be used to restore
|
||||
* scroll position following a reload.
|
||||
* Can be `window.name` or `cookie`
|
||||
* @property scrollRestoreTechnique
|
||||
* @type String
|
||||
* @default 'window.name'
|
||||
*/
|
||||
scrollRestoreTechnique: "window.name",
|
||||
/**
|
||||
* Sync the scroll position of any element
|
||||
* on the page. Add any amount of CSS selectors
|
||||
* @property scrollElements
|
||||
* @type Array
|
||||
* @default []
|
||||
* @since 2.9.0
|
||||
*/
|
||||
scrollElements: [],
|
||||
/**
|
||||
* Sync the scroll position of any element
|
||||
* on the page - where any scrolled element
|
||||
* will cause all others to match scroll position.
|
||||
* This is helpful when a breakpoint alters which element
|
||||
* is actually scrolling
|
||||
* @property scrollElementMapping
|
||||
* @type Array
|
||||
* @default []
|
||||
* @since 2.9.0
|
||||
*/
|
||||
scrollElementMapping: [],
|
||||
/**
|
||||
* Time, in milliseconds, to wait before
|
||||
* instructing the browser to reload/inject following a
|
||||
* file change event
|
||||
* @property reloadDelay
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
reloadDelay: 0,
|
||||
/**
|
||||
* Wait for a specified window of event-silence before
|
||||
* sending any reload events.
|
||||
* @property reloadDebounce
|
||||
* @type Number
|
||||
* @default 0
|
||||
* @since 2.6.0
|
||||
*/
|
||||
reloadDebounce: 500,
|
||||
/**
|
||||
* Emit only the first event during sequential time windows
|
||||
* of a specified duration.
|
||||
* @property reloadThrottle
|
||||
* @type Number
|
||||
* @default 0
|
||||
* @since 2.13.0
|
||||
*/
|
||||
reloadThrottle: 0,
|
||||
/**
|
||||
* User provided plugins
|
||||
* @property plugins
|
||||
* @type Array
|
||||
* @default []
|
||||
* @since 2.6.0
|
||||
*/
|
||||
plugins: [],
|
||||
/**
|
||||
* @property injectChanges
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
injectChanges: true,
|
||||
/**
|
||||
* @property startPath
|
||||
* @type String|Null
|
||||
* @default null
|
||||
*/
|
||||
startPath: null,
|
||||
/**
|
||||
* Whether to minify client script, or not.
|
||||
* @property minify
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
minify: true,
|
||||
/**
|
||||
* @property host
|
||||
* @type String
|
||||
* @default null
|
||||
*/
|
||||
host: null,
|
||||
/**
|
||||
* Specify a host to listen on. Use this if you want to
|
||||
* prevent binding to all interfaces.
|
||||
*
|
||||
* Note: When you specify this option, it overrides the 'host' option
|
||||
* @property listen
|
||||
* @type String
|
||||
* @default undefined
|
||||
*/
|
||||
/**
|
||||
* Support environments where dynamic hostnames are not required
|
||||
* (ie: electron)
|
||||
* @property localOnly
|
||||
* @type Boolean
|
||||
* @default false
|
||||
* @since 2.14.0
|
||||
*/
|
||||
localOnly: false,
|
||||
/**
|
||||
* @property codeSync
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
codeSync: true,
|
||||
/**
|
||||
* @property timestamps
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
timestamps: true,
|
||||
clientEvents: [
|
||||
"scroll",
|
||||
"scroll:element",
|
||||
"input:text",
|
||||
"input:toggles",
|
||||
"form:submit",
|
||||
"form:reset",
|
||||
"click"
|
||||
],
|
||||
/**
|
||||
* Alter the script path for complete control over where the Browsersync
|
||||
* Javascript is served from. Whatever you return from this function
|
||||
* will be used as the script path.
|
||||
* @property scriptPath
|
||||
* @default undefined
|
||||
* @since 1.5.0
|
||||
* @type Function
|
||||
*/
|
||||
/**
|
||||
* Configure the Socket.IO path and namespace & domain to avoid collisions.
|
||||
* @property socket
|
||||
* @param {String} [path="/browser-sync/socket.io"]
|
||||
* @param {String} [clientPath="/browser-sync"]
|
||||
* @param {String|Function} [namespace="/browser-sync"]
|
||||
* @param {String|Function} [domain=undefined]
|
||||
* @param {String|Function} [port=undefined]
|
||||
* @param {Object} [clients.heartbeatTimeout=5000]
|
||||
* @since 1.6.2
|
||||
* @type Object
|
||||
*/
|
||||
socket: {
|
||||
socketIoOptions: {
|
||||
log: false
|
||||
},
|
||||
socketIoClientConfig: {
|
||||
reconnectionAttempts: 50
|
||||
},
|
||||
path: "/browser-sync/socket.io",
|
||||
clientPath: "/browser-sync",
|
||||
namespace: "/browser-sync",
|
||||
clients: {
|
||||
heartbeatTimeout: 5000
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Configure the script domain
|
||||
* @property script
|
||||
* @param {String|Function} [domain=undefined]
|
||||
* @since 2.14.0
|
||||
* @type Object
|
||||
*/
|
||||
tagNames: {
|
||||
less: "link",
|
||||
scss: "link",
|
||||
css: "link",
|
||||
jpg: "img",
|
||||
jpeg: "img",
|
||||
png: "img",
|
||||
svg: "img",
|
||||
gif: "img",
|
||||
js: "script"
|
||||
},
|
||||
injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp", "map"],
|
||||
injectNotification: false,
|
||||
excludedFileTypes: [
|
||||
"js",
|
||||
"css",
|
||||
"pdf",
|
||||
"map",
|
||||
"svg",
|
||||
"ico",
|
||||
"woff",
|
||||
"json",
|
||||
"eot",
|
||||
"ttf",
|
||||
"png",
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"webp",
|
||||
"gif",
|
||||
"mp4",
|
||||
"mp3",
|
||||
"3gp",
|
||||
"ogg",
|
||||
"ogv",
|
||||
"webm",
|
||||
"m4a",
|
||||
"flv",
|
||||
"wmv",
|
||||
"avi",
|
||||
"swf",
|
||||
"scss"
|
||||
]
|
||||
};
|
||||
//# sourceMappingURL=default-config.js.map
|
1
node_modules/browser-sync/dist/default-config.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/default-config.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"default-config.js","sourceRoot":"","sources":["../lib/default-config.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,GAAG;IACb;;;;;;;;OAQG;IACH,EAAE,EAAE;QACA,IAAI,EAAE,IAAI;KACb;IAED;;;;;;;OAOG;IACH,KAAK,EAAE,KAAK;IAEZ;;;;;;;OAOG;IACH,WAAW,EAAE,CAAC,QAAQ,CAAC;IAEvB;;;;;;;;;;OAUG;IACH,KAAK,EAAE,KAAK;IAEZ;;;;;;;OAOG;IACH,MAAM,EAAE,EAAE;IAEV;;;;;;;OAOG;IACH,MAAM,EAAE,KAAK;IAEb;;;;;;;OAOG;IACH,YAAY,EAAE;QACV,aAAa,EAAE,IAAI;QACnB;;;;;;;;;;;;;;WAcG;KACN;IAED;;;;;OAKG;IACH,MAAM,EAAE,KAAK;IAEb;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,KAAK;IAEZ;;;;OAIG;IACH,IAAI,EAAE,IAAI;IAEV;;;;OAIG;IACH,UAAU,E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,KAAK;QACV,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,QAAQ;KACf;IAED,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;IAC3E,kBAAkB,EAAE,KAAK;IACzB,iBAAiB,EAAE;QACf,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;KACT;CACJ,CAAC"}
|
90
node_modules/browser-sync/dist/file-event-handler.js
generated
vendored
Normal file
90
node_modules/browser-sync/dist/file-event-handler.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
var utils = require("./utils");
|
||||
/**
|
||||
* Apply the operators that apply to the 'file:changed' event
|
||||
* @param {Rx.Observable} subject
|
||||
* @param options
|
||||
* @return {Rx.Observable<{type: string, files: Array<any>}>}
|
||||
*/
|
||||
function fileChanges(subject, options) {
|
||||
const operators = [
|
||||
{
|
||||
option: "reloadThrottle",
|
||||
fnName: "throttle"
|
||||
},
|
||||
{
|
||||
option: "reloadDelay",
|
||||
fnName: "delay"
|
||||
}
|
||||
];
|
||||
const scheduler = options.getIn(["debug", "scheduler"]);
|
||||
/**
|
||||
* Create a stream buffered/debounced stream of events
|
||||
*/
|
||||
const initial = getAggregatedDebouncedStream(subject, options, scheduler);
|
||||
return applyOperators(operators, initial, options, scheduler).map(function (items) {
|
||||
const paths = items.map(x => x.path);
|
||||
if (utils.willCauseReload(paths, options.get("injectFileTypes").toJS())) {
|
||||
return {
|
||||
type: "reload",
|
||||
files: items
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "inject",
|
||||
files: items
|
||||
};
|
||||
});
|
||||
}
|
||||
module.exports.fileChanges = fileChanges;
|
||||
/**
|
||||
* Apply the operators that apply to the 'browser:reload' event
|
||||
* @param {Rx.Observable} subject
|
||||
* @param options
|
||||
* @returns {Rx.Observable}
|
||||
*/
|
||||
function applyReloadOperators(subject, options) {
|
||||
var operators = [
|
||||
{
|
||||
option: "reloadDebounce",
|
||||
fnName: "debounce"
|
||||
},
|
||||
{
|
||||
option: "reloadThrottle",
|
||||
fnName: "throttle"
|
||||
},
|
||||
{
|
||||
option: "reloadDelay",
|
||||
fnName: "delay"
|
||||
}
|
||||
];
|
||||
return applyOperators(operators, subject, options, options.getIn(["debug", "scheduler"]));
|
||||
}
|
||||
module.exports.applyReloadOperators = applyReloadOperators;
|
||||
/**
|
||||
* @param items
|
||||
* @param subject
|
||||
* @param options
|
||||
* @param scheduler
|
||||
*/
|
||||
function applyOperators(items, subject, options, scheduler) {
|
||||
return items.reduce(function (subject, item) {
|
||||
var value = options.get(item.option);
|
||||
if (value > 0) {
|
||||
return subject[item.fnName].call(subject, value, scheduler);
|
||||
}
|
||||
return subject;
|
||||
}, subject);
|
||||
}
|
||||
/**
|
||||
* @param subject
|
||||
* @param options
|
||||
* @param scheduler
|
||||
*/
|
||||
function getAggregatedDebouncedStream(subject, options, scheduler) {
|
||||
return subject
|
||||
.filter(function (x) {
|
||||
return options.get("watchEvents").indexOf(x.event) > -1;
|
||||
})
|
||||
.buffer(subject.debounce(options.get("reloadDebounce"), scheduler));
|
||||
}
|
||||
//# sourceMappingURL=file-event-handler.js.map
|
1
node_modules/browser-sync/dist/file-event-handler.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/file-event-handler.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-event-handler.js","sourceRoot":"","sources":["../lib/file-event-handler.js"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAA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AC;IAEF,OAAO,cAAc,CACjB,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CACxC,CAAC;AACN,CAAC;AACD,MAAM,CAAC,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAE3D;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS;IACtD,OAAO,KAAK,CAAC,MAAM,CAAC,UAAS,OAAO,EAAE,IAAI;QACtC,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;SAC/D;QACD,OAAO,OAAO,CAAC;IACnB,CAAC,EAAE,OAAO,CAAC,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,4BAA4B,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS;IAC7D,OAAO,OAAO;SACT,MAAM,CAAC,UAAS,CAAC;QACd,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5E,CAAC"}
|
56
node_modules/browser-sync/dist/file-utils.js
generated
vendored
Normal file
56
node_modules/browser-sync/dist/file-utils.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var _ = require("./lodash.custom");
|
||||
var fileUtils = {
|
||||
/**
|
||||
* React to file-change events that occur on "core" namespace only
|
||||
* @param bs
|
||||
* @param data
|
||||
*/
|
||||
changedFile: function (bs, data) {
|
||||
/**
|
||||
* If the event property is undefined, infer that it's a 'change'
|
||||
* event due the fact this handler is for emitter.emit("file:changed")
|
||||
*/
|
||||
if (_.isUndefined(data.event)) {
|
||||
data.event = "change";
|
||||
}
|
||||
/**
|
||||
* Chokidar always sends an 'event' property - which could be
|
||||
* `add` `unlink` etc etc so we need to check for that and only
|
||||
* respond to 'change', for now.
|
||||
*/
|
||||
if (bs.options.get("watchEvents").indexOf(data.event) > -1) {
|
||||
if (!bs.paused && data.namespace === "core") {
|
||||
bs.events.emit("file:reload", fileUtils.getFileInfo(data, bs.options));
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param data
|
||||
* @param options
|
||||
* @returns {{assetFileName: *, fileExtension: String}}
|
||||
*/
|
||||
getFileInfo: function (data, options) {
|
||||
data.ext = require("path")
|
||||
.extname(data.path)
|
||||
.slice(1);
|
||||
data.basename = require("path").basename(data.path);
|
||||
var obj = {
|
||||
ext: data.ext,
|
||||
path: data.path,
|
||||
basename: data.basename,
|
||||
event: data.event,
|
||||
type: "inject"
|
||||
};
|
||||
// RELOAD page
|
||||
if (!_.includes(options.get("injectFileTypes").toJS(), obj.ext)) {
|
||||
obj.url = obj.path;
|
||||
obj.type = "reload";
|
||||
}
|
||||
obj.path = data.path;
|
||||
obj.log = data.log;
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
module.exports = fileUtils;
|
||||
//# sourceMappingURL=file-utils.js.map
|
1
node_modules/browser-sync/dist/file-utils.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/file-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-utils.js","sourceRoot":"","sources":["../lib/file-utils.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEnC,IAAI,SAAS,GAAG;IACZ;;;;OAIG;IACH,WAAW,E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GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC;SACvB;QAED,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QAEnB,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC"}
|
73
node_modules/browser-sync/dist/file-watcher.js
generated
vendored
Normal file
73
node_modules/browser-sync/dist/file-watcher.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
var _ = require("./lodash.custom");
|
||||
var utils = require("./utils");
|
||||
var Rx = require("rx");
|
||||
/**
|
||||
* Plugin interface
|
||||
* @returns {*|function(this:exports)}
|
||||
*/
|
||||
module.exports.plugin = function (bs) {
|
||||
var options = bs.options;
|
||||
var emitter = bs.emitter;
|
||||
var defaultWatchOptions = options.get("watchOptions").toJS();
|
||||
return options.get("files").reduce(function (map, glob, namespace) {
|
||||
/**
|
||||
* Default CB when not given
|
||||
* @param event
|
||||
* @param path
|
||||
*/
|
||||
var fn = function (event, path) {
|
||||
emitter.emit("file:changed", {
|
||||
event: event,
|
||||
path: path,
|
||||
namespace: namespace
|
||||
});
|
||||
};
|
||||
var jsItem = glob.toJS();
|
||||
if (jsItem.globs.length) {
|
||||
var watcher = watch(jsItem.globs, defaultWatchOptions, fn);
|
||||
map[namespace] = {
|
||||
watchers: [watcher]
|
||||
};
|
||||
}
|
||||
if (jsItem.objs.length) {
|
||||
jsItem.objs.forEach(function (item) {
|
||||
if (!_.isFunction(item.fn)) {
|
||||
item.fn = fn;
|
||||
}
|
||||
var watcher = watch(item.match, item.options || defaultWatchOptions, item.fn.bind(bs.publicInstance));
|
||||
if (!map[namespace]) {
|
||||
map[namespace] = {
|
||||
watchers: [watcher]
|
||||
};
|
||||
}
|
||||
else {
|
||||
map[namespace].watchers.push(watcher);
|
||||
}
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}, {});
|
||||
};
|
||||
/**
|
||||
* @param patterns
|
||||
* @param opts
|
||||
* @param cb
|
||||
* @returns {*}
|
||||
*/
|
||||
function watch(patterns, opts, cb) {
|
||||
if (typeof opts === "function") {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
var watcher = require("chokidar").watch(patterns, opts);
|
||||
if (_.isFunction(cb)) {
|
||||
watcher.on("all", cb);
|
||||
}
|
||||
// watcher.on('ready', () => {
|
||||
// console.log(watcher.getWatched());
|
||||
// });
|
||||
return watcher;
|
||||
}
|
||||
module.exports.watch = watch;
|
||||
//# sourceMappingURL=file-watcher.js.map
|
1
node_modules/browser-sync/dist/file-watcher.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/file-watcher.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../lib/file-watcher.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnC,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC/B,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB;;;GAGG;AACH,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,UAAS,EAAE;IAC/B,IAAI,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;IACzB,IAAI,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;IAEzB,IAAI,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC;IAE7D,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAS,GAAG,EAAE,IAAI,EAAE,SAAS;QAC5D;;;;WAIG;QACH,IAAI,EAAE,GAAG,UAAS,KAAK,EAAE,IAAI;YACzB,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;gBACzB,KAA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;QAC5B,EAAE,GAAG,IAAI,CAAC;QACV,IAAI,GAAG,EAAE,CAAC;KACb;IAED,IAAI,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAExD,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;KACzB;IAED,8BAA8B;IAC9B,yCAAyC;IACzC,MAAM;IAEN,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC"}
|
84
node_modules/browser-sync/dist/hooks.js
generated
vendored
Normal file
84
node_modules/browser-sync/dist/hooks.js
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
var _ = require("./lodash.custom");
|
||||
var Immutable = require("immutable");
|
||||
var snippetUtils = require("./snippet").utils;
|
||||
module.exports = {
|
||||
/**
|
||||
*
|
||||
* @this {BrowserSync}
|
||||
* @returns {String}
|
||||
*/
|
||||
"client:js": function (hooks, data) {
|
||||
var js = snippetUtils.getClientJs(data.port, data.options);
|
||||
return hooks.reduce(function (acc, hook) {
|
||||
if (typeof hook === "function") {
|
||||
return acc.concat(hook);
|
||||
}
|
||||
return acc.concat(String(hook));
|
||||
}, [js]);
|
||||
},
|
||||
/**
|
||||
* @this {BrowserSync}
|
||||
* @returns {Array}
|
||||
*/
|
||||
"client:events": function (hooks, clientEvents) {
|
||||
hooks.forEach(function (hook) {
|
||||
var result = hook(this);
|
||||
if (Array.isArray(result)) {
|
||||
clientEvents = _.union(clientEvents, result);
|
||||
}
|
||||
else {
|
||||
clientEvents.push(result);
|
||||
}
|
||||
}, this);
|
||||
return clientEvents;
|
||||
},
|
||||
/**
|
||||
* @returns {Array}
|
||||
*/
|
||||
"server:middleware": function (hooks, initial) {
|
||||
initial = initial || [];
|
||||
_.each(hooks, function (hook) {
|
||||
var result = hook(this);
|
||||
if (Array.isArray(result)) {
|
||||
result.forEach(function (res) {
|
||||
if (_.isFunction(res)) {
|
||||
initial = initial.push(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (_.isFunction(result)) {
|
||||
initial = initial.push(result);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
return initial;
|
||||
},
|
||||
/**
|
||||
* @param {Array} hooks
|
||||
* @param {Map|List} initial
|
||||
* @param pluginOptions
|
||||
* @returns {any}
|
||||
*/
|
||||
"files:watch": function (hooks, initial, pluginOptions) {
|
||||
var opts;
|
||||
if (pluginOptions) {
|
||||
opts = Immutable.fromJS(pluginOptions);
|
||||
opts.forEach(function (value, key) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
var files = value.get("files");
|
||||
if (files) {
|
||||
var fileArg = require("./cli/cli-options").makeFilesArg(files);
|
||||
if (fileArg) {
|
||||
initial = initial.set(key, Immutable.fromJS(fileArg));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return initial;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=hooks.js.map
|
1
node_modules/browser-sync/dist/hooks.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/hooks.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../lib/hooks.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC;AAE9C,MAAM,CAAC,OAAO,GAAG;IACb;;;;OAIG;IACH,WAAW,EAAE,UAAS,KAAK,EAAE,IAAI;QAC7B,IAAI,EAAE,GAAG,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OA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,EAAE;oBACtB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBAClC;aACJ;QACL,CAAC,EACD,IAAI,CACP,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IACD;;;;;OAKG;IACH,aAAa,EAAE,UAAS,KAAK,EAAE,OAAO,EAAE,aAAa;QACjD,IAAI,IAAI,CAAC;QAET,IAAI,aAAa,EAAE;YACf,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,UAAS,KAAK,EAAE,GAAG;gBAC5B,IAAI,CAAC,KAAK,EAAE;oBACR,OAAO;iBACV;gBACD,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC/B,IAAI,KAAK,EAAE;oBACP,IAAI,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,YAAY,CACnD,KAAK,CACR,CAAC;oBACF,IAAI,OAAO,EAAE;wBACT,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;qBACzD;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAC"}
|
101
node_modules/browser-sync/dist/http-protocol.js
generated
vendored
Normal file
101
node_modules/browser-sync/dist/http-protocol.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
var proto = exports;
|
||||
var instanceMethods = ["exit", "notify", "pause", "resume"];
|
||||
var getBody = require("raw-body");
|
||||
const { parseParams, serializeParams } = require("./utils");
|
||||
const permittedSocketEvents = [
|
||||
"file:reload",
|
||||
"browser:reload",
|
||||
"browser:notify",
|
||||
"browser:location",
|
||||
"options:set"
|
||||
];
|
||||
/**
|
||||
* Does the requested method expect an instance of BrowserSync
|
||||
* or raw access to the emitter?
|
||||
* @param method
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function methodRequiresInstance(method) {
|
||||
return instanceMethods.indexOf(method) > -1;
|
||||
}
|
||||
/**
|
||||
* Use BrowserSync options + querystring to create a
|
||||
* full HTTP/HTTTPS url.
|
||||
*
|
||||
* Eg. http://localhost:3000/__browser_sync__?method=reload
|
||||
* Eg. http://localhost:3000/__browser_sync__?method=reload&args=core.css
|
||||
* Eg. http://localhost:3000/__browser_sync__?method=reload&args=core.css&args=core.min
|
||||
*
|
||||
* @param args
|
||||
* @param url
|
||||
* @returns {string}
|
||||
*/
|
||||
proto.getUrl = function (args, url) {
|
||||
return [
|
||||
url,
|
||||
require("./config").httpProtocol.path,
|
||||
"?",
|
||||
serializeParams(args).toString()
|
||||
].join("");
|
||||
};
|
||||
/**
|
||||
* Return a middleware for handling the requests
|
||||
* @param {BrowserSync} bs
|
||||
* @returns {Function}
|
||||
*/
|
||||
proto.middleware = function (bs) {
|
||||
return function (req, res) {
|
||||
if (req.method === "POST") {
|
||||
return getBody(req, function (err, body) {
|
||||
if (err) {
|
||||
const output = ["Error: could not parse JSON."];
|
||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
||||
return res.end(output.join("\n"));
|
||||
}
|
||||
try {
|
||||
const [name, payload] = JSON.parse(body.toString());
|
||||
bs.io.sockets.emit(name, payload);
|
||||
return res.end(`Browsersync HTTP Protocol received: ${name} ${JSON.stringify(payload)}`);
|
||||
}
|
||||
catch (e) {
|
||||
const output = [`Error: ${e.message}`];
|
||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
||||
return res.end(output.join("\n"));
|
||||
}
|
||||
});
|
||||
}
|
||||
var split = req.url.split("?");
|
||||
var params = parseParams(split[1]);
|
||||
var output;
|
||||
if (!Object.keys(params).length) {
|
||||
output = [
|
||||
"Error: No Parameters were provided.",
|
||||
"Example: http://localhost:3000/__browser_sync__?method=reload&args=core.css"
|
||||
];
|
||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
||||
res.end(output.join("\n"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var bsOrEmitter = methodRequiresInstance(params.method)
|
||||
? bs
|
||||
: bs.events;
|
||||
require("./public/" + params.method)(bsOrEmitter).apply(null, [
|
||||
params.args
|
||||
]);
|
||||
output = [
|
||||
"Called public API method `.%s()`".replace("%s", params.method),
|
||||
"With args: " + JSON.stringify(params.args)
|
||||
];
|
||||
res.end(output.join("\n"));
|
||||
}
|
||||
catch (e) {
|
||||
res.writeHead(404, { "Content-Type": "text/plain" });
|
||||
res.write("Public API method `" + params.method + "` not found.");
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=http-protocol.js.map
|
1
node_modules/browser-sync/dist/http-protocol.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/http-protocol.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"http-protocol.js","sourceRoot":"","sources":["../lib/http-protocol.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,eAAe,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5D,IAAI,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAClC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5D,MAAM,qBAAqB,GAAG;IAC1B,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;CAChB,CAAC;AAEF;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,MAAM;IAClC,OAAO,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,KAAK,CAAC,MAAM,GAAG,UAAS,IAAI,EAAE,GAAG;IAC7B,OAAO;QACH,GAAG;QACH,OAAO,CAA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E,GAAG,CAAC,GAAG,EAAE,CAAC;YAEV,OAAO;SACV;IACL,CAAC,CAAC;AACN,CAAC,CAAC"}
|
349
node_modules/browser-sync/dist/index.js
generated
vendored
Normal file
349
node_modules/browser-sync/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,349 @@
|
||||
#! /usr/bin/env node
|
||||
"use strict";
|
||||
/**
|
||||
* @module BrowserSync
|
||||
*/
|
||||
var pjson = require("../package.json");
|
||||
var BrowserSync = require("./browser-sync");
|
||||
var publicUtils = require("./public/public-utils");
|
||||
var events = require("events");
|
||||
var chalk = require("chalk");
|
||||
var PassThrough = require("stream").PassThrough;
|
||||
var logger = require("eazy-logger").Logger({
|
||||
useLevelPrefixes: true
|
||||
});
|
||||
var singleton = false;
|
||||
var singletonPlugins = [];
|
||||
var instances = [];
|
||||
/**
|
||||
* @type {boolean|EventEmitter}
|
||||
*/
|
||||
var singletonEmitter = false;
|
||||
module.exports = initSingleton;
|
||||
/**
|
||||
* Create a Browsersync instance
|
||||
* @method create
|
||||
* @param {String} name an identifier that can used for retrieval later
|
||||
*/
|
||||
/**
|
||||
* Get a single instance by name. This is useful if you have your
|
||||
* build scripts in separate files
|
||||
* @method get
|
||||
* @param {String} name
|
||||
* @returns {Object|Boolean}
|
||||
*/
|
||||
module.exports.get = function (name) {
|
||||
var instance = getSingle(name);
|
||||
if (instance) {
|
||||
return instance;
|
||||
}
|
||||
throw new Error("An instance with the name `%s` was not found.".replace("%s", name));
|
||||
};
|
||||
/**
|
||||
* Check if an instance has been created.
|
||||
* @method has
|
||||
* @param {String} name
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
module.exports.has = function (name) {
|
||||
var instance = getSingle(name);
|
||||
if (instance) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet
|
||||
* mode depending on your use-case.
|
||||
* @method init
|
||||
* @param {Object} [config] This is the main configuration for your Browsersync instance and can contain any of the [available options]({{site.links.options}})
|
||||
* If you do not pass a config an argument for configuration, Browsersync will still run; but it will be in the `snippet` mode
|
||||
* @param {Function} [cb] If you pass a callback function, it will be called when Browsersync has completed all setup tasks and is ready to use. This
|
||||
* is useful when you need to wait for information (for example: urls, port etc) or perform other tasks synchronously.
|
||||
* @returns {BrowserSync}
|
||||
*/
|
||||
module.exports.init = initSingleton;
|
||||
/**
|
||||
* Register a plugin. Must implement at least a 'plugin' method that returns a
|
||||
* callable function.
|
||||
*
|
||||
* @method use
|
||||
* @param {String} name The name of the plugin
|
||||
* @param {Object} module The object to be `required`.
|
||||
* @param {Function} [cb] A callback function that will return any errors.
|
||||
*/
|
||||
module.exports.use = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
singletonPlugins.push({
|
||||
args: args
|
||||
});
|
||||
};
|
||||
/**
|
||||
* The `reload` method will inform all browsers about changed files and will either cause the browser to refresh, or inject the files where possible.
|
||||
*
|
||||
* @method reload
|
||||
* @param {String|Array|Object} [arg] The file or files to be reloaded.
|
||||
* @returns {*}
|
||||
*/
|
||||
module.exports.reload = noop("reload");
|
||||
/**
|
||||
* The `stream` method returns a transform stream and can act once or on many files.
|
||||
*
|
||||
* @method stream
|
||||
* @param {Object} [opts] Configuration for the stream method
|
||||
* @param {Object} [opts.match] Resulting files to reload. The path is from the
|
||||
* root of the site (not the root of your project). You can use '**' to recurse
|
||||
* directories.
|
||||
* @param {Object} [opts.once] Only reload on the first changed file in the stream.
|
||||
* @since 2.6.0
|
||||
* @returns {*}
|
||||
*/
|
||||
module.exports.stream = noop("stream");
|
||||
/**
|
||||
* Helper method for browser notifications
|
||||
*
|
||||
* @method notify
|
||||
* @param {String|HTML} msg Can be a simple message such as 'Connected' or HTML
|
||||
* @param {Number} [timeout] How long the message will remain in the browser. @since 1.3.0
|
||||
*/
|
||||
module.exports.notify = noop("notify");
|
||||
/**
|
||||
* This method will close any running server, stop file watching & exit the current process.
|
||||
*
|
||||
* @method exit
|
||||
*/
|
||||
module.exports.exit = noop("exit");
|
||||
/**
|
||||
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
|
||||
* @method watch
|
||||
* @param {string} patterns Glob patterns for files to watch
|
||||
* @param {object} [opts] Options to be passed to Chokidar - check what's available in [their docs](https://github.com/paulmillr/chokidar#getting-started)
|
||||
* @param {function} [fn] Callback function for each event.
|
||||
* @since 2.6.0
|
||||
*/
|
||||
module.exports.watch = noop("watch");
|
||||
/**
|
||||
* Method to pause file change events
|
||||
*
|
||||
* @method pause
|
||||
*/
|
||||
module.exports.pause = noop("pause");
|
||||
/**
|
||||
* Method to resume paused watchers
|
||||
*
|
||||
* @method resume
|
||||
*/
|
||||
module.exports.resume = noop("resume");
|
||||
/**
|
||||
* Add properties fo
|
||||
*/
|
||||
Object.defineProperties(module.exports, {
|
||||
/**
|
||||
* The internal Event Emitter used by the running Browsersync instance (if there is one).
|
||||
* You can use this to emit your own events, such as changed files, logging etc.
|
||||
*
|
||||
* @property emitter
|
||||
*/
|
||||
emitter: {
|
||||
get: function () {
|
||||
if (!singletonEmitter) {
|
||||
singletonEmitter = newEmitter();
|
||||
return singletonEmitter;
|
||||
}
|
||||
return singletonEmitter;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
|
||||
*
|
||||
* @property active
|
||||
*/
|
||||
active: {
|
||||
get: getSingletonValue.bind(null, "active")
|
||||
},
|
||||
/**
|
||||
* A simple true/false flag to determine if the current instance is paused
|
||||
*
|
||||
* @property paused
|
||||
*/
|
||||
paused: {
|
||||
get: getSingletonValue.bind(null, "paused")
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Event emitter factory
|
||||
* @returns {EventEmitter}
|
||||
*/
|
||||
function newEmitter() {
|
||||
var emitter = new events.EventEmitter();
|
||||
emitter.setMaxListeners(20);
|
||||
return emitter;
|
||||
}
|
||||
/**
|
||||
* Get the singleton's emitter, or a new one.
|
||||
* @returns {EventEmitter}
|
||||
*/
|
||||
function getSingletonEmitter() {
|
||||
if (singletonEmitter) {
|
||||
return singletonEmitter;
|
||||
}
|
||||
singletonEmitter = newEmitter();
|
||||
return singletonEmitter;
|
||||
}
|
||||
/**
|
||||
* Helper to allow methods to be called on the module export
|
||||
* before there's a running instance
|
||||
* @param {String} name
|
||||
* @returns {Function}
|
||||
*/
|
||||
function noop(name) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (singleton) {
|
||||
return singleton[name].apply(singleton, args);
|
||||
}
|
||||
else {
|
||||
if (publicUtils.isStreamArg(name, args)) {
|
||||
return new PassThrough({ objectMode: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Create a single instance when module export is used directly via browserSync({});
|
||||
* This is mostly for back-compatibility, for also for the nicer api.
|
||||
* This will never be removed to ensure we never break user-land, but
|
||||
* we should discourage it's use.
|
||||
* @returns {*}
|
||||
*/
|
||||
function initSingleton() {
|
||||
var instance;
|
||||
if (instances.length) {
|
||||
instance = instances.filter(function (item) {
|
||||
return item.name === "singleton";
|
||||
});
|
||||
if (instance.length) {
|
||||
logger.error(chalk.yellow("You tried to start Browsersync twice!"), "To create multiple instances, use", chalk.cyan("browserSync.create().init()"));
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
singleton = create("singleton", getSingletonEmitter());
|
||||
if (singletonPlugins.length) {
|
||||
singletonPlugins.forEach(function (obj) {
|
||||
singleton.instance.registerPlugin.apply(singleton.instance, obj.args);
|
||||
});
|
||||
}
|
||||
singleton.init.apply(null, args);
|
||||
return singleton;
|
||||
}
|
||||
/**
|
||||
* @param {String} prop
|
||||
* @returns {Object|Boolean}
|
||||
*/
|
||||
function getSingletonValue(prop) {
|
||||
var single = getSingle("singleton");
|
||||
if (single) {
|
||||
return single[prop];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Get a single instance by name
|
||||
* @param {String} name
|
||||
* @returns {Object|Boolean}
|
||||
*/
|
||||
function getSingle(name) {
|
||||
if (instances.length) {
|
||||
var match = instances.filter(function (item) {
|
||||
return item.name === name;
|
||||
});
|
||||
if (match.length) {
|
||||
return match[0];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Create an instance of Browsersync
|
||||
* @param {String} [name]
|
||||
* @param {EventEmitter} [emitter]
|
||||
* @returns {{init: *, exit: (exit|exports), notify: *, reload: *, cleanup: *, emitter: (Browsersync.events|*), use: *}}
|
||||
*/
|
||||
/**
|
||||
* Reset the state of the module.
|
||||
* (should only be needed for test environments)
|
||||
*/
|
||||
module.exports.reset = function () {
|
||||
instances.forEach(function (item) {
|
||||
item.cleanup();
|
||||
});
|
||||
instances = [];
|
||||
singletonPlugins = [];
|
||||
singletonEmitter = false;
|
||||
singleton = false;
|
||||
};
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
module.exports.instances = instances;
|
||||
/**
|
||||
* Create an instance of Browsersync
|
||||
* @param {String} [name]
|
||||
* @param {EventEmitter} [emitter]
|
||||
* @returns {{init: *, exit: (exit|exports), notify: *, reload: *, cleanup: *, emitter: (Browsersync.events|*), use: *}}
|
||||
*/
|
||||
module.exports.create = create;
|
||||
function create(name, emitter) {
|
||||
name = name || new Date().getTime();
|
||||
emitter = emitter || newEmitter();
|
||||
var browserSync = new BrowserSync(emitter);
|
||||
var instance = {
|
||||
name: name,
|
||||
instance: browserSync,
|
||||
exit: require("./public/exit")(browserSync),
|
||||
notify: require("./public/notify")(browserSync),
|
||||
pause: require("./public/pause")(browserSync),
|
||||
resume: require("./public/resume")(browserSync),
|
||||
reload: require("./public/reload")(emitter),
|
||||
stream: require("./public/stream")(emitter),
|
||||
cleanup: browserSync.cleanup.bind(browserSync),
|
||||
use: browserSync.registerPlugin.bind(browserSync),
|
||||
getOption: browserSync.getOption.bind(browserSync),
|
||||
emitter: browserSync.events,
|
||||
watch: require("./file-watcher").watch
|
||||
};
|
||||
browserSync.publicInstance = instance;
|
||||
instance.init = require("./public/init")(browserSync, name, pjson);
|
||||
Object.defineProperty(instance, "active", {
|
||||
get: function () {
|
||||
return browserSync.active;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "paused", {
|
||||
get: function () {
|
||||
return browserSync.paused;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Access to client-side socket for emitting events
|
||||
*
|
||||
* @property sockets
|
||||
*/
|
||||
Object.defineProperty(instance, "sockets", {
|
||||
get: function () {
|
||||
if (!browserSync.active) {
|
||||
return {
|
||||
emit: function () { },
|
||||
on: function () { }
|
||||
};
|
||||
}
|
||||
else {
|
||||
return browserSync.io.sockets;
|
||||
}
|
||||
}
|
||||
});
|
||||
instances.push(instance);
|
||||
return instance;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/browser-sync/dist/index.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
110
node_modules/browser-sync/dist/internal-events.js
generated
vendored
Normal file
110
node_modules/browser-sync/dist/internal-events.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
var utils = require("./utils");
|
||||
var fileUtils = require("./file-utils");
|
||||
var Rx = require("rx");
|
||||
var fromEvent = Rx.Observable.fromEvent;
|
||||
var fileHandler = require("./file-event-handler");
|
||||
module.exports = function (bs) {
|
||||
var events = {
|
||||
/**
|
||||
* File reloads
|
||||
* @param data
|
||||
*/
|
||||
"file:reload": function (data) {
|
||||
bs.io.sockets.emit("file:reload", data);
|
||||
},
|
||||
/**
|
||||
* Browser Reloads
|
||||
*/
|
||||
"browser:reload": function () {
|
||||
bs.io.sockets.emit("browser:reload");
|
||||
},
|
||||
/**
|
||||
* Browser Notify
|
||||
* @param data
|
||||
*/
|
||||
"browser:notify": function (data) {
|
||||
bs.io.sockets.emit("browser:notify", data);
|
||||
},
|
||||
/**
|
||||
* Things that happened after the service is running
|
||||
* @param data
|
||||
*/
|
||||
"service:running": function (data) {
|
||||
var mode = bs.options.get("mode");
|
||||
var open = bs.options.get("open");
|
||||
if (mode === "proxy" ||
|
||||
mode === "server" ||
|
||||
open === "ui" ||
|
||||
open === "ui-external") {
|
||||
utils.openBrowser(data.url, bs.options, bs);
|
||||
}
|
||||
// log about any file watching
|
||||
if (bs.watchers) {
|
||||
bs.events.emit("file:watching", bs.watchers);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Option setting
|
||||
* @param data
|
||||
*/
|
||||
"options:set": function (data) {
|
||||
if (bs.io) {
|
||||
bs.io.sockets.emit("options:set", data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Plugin configuration setting
|
||||
* @param data
|
||||
*/
|
||||
"plugins:configure": function (data) {
|
||||
if (data.active) {
|
||||
bs.pluginManager.enablePlugin(data.name);
|
||||
}
|
||||
else {
|
||||
bs.pluginManager.disablePlugin(data.name);
|
||||
}
|
||||
bs.setOption("userPlugins", bs.getUserPlugins());
|
||||
},
|
||||
"plugins:opts": function (data) {
|
||||
if (bs.pluginManager.pluginOptions[data.name]) {
|
||||
bs.pluginManager.pluginOptions[data.name] = data.opts;
|
||||
bs.setOption("userPlugins", bs.getUserPlugins());
|
||||
}
|
||||
}
|
||||
};
|
||||
Object.keys(events).forEach(function (event) {
|
||||
bs.events.on(event, events[event]);
|
||||
});
|
||||
var reloader = fileHandler
|
||||
.applyReloadOperators(fromEvent(bs.events, "_browser:reload"), bs.options)
|
||||
.subscribe(function () {
|
||||
bs.events.emit("browser:reload");
|
||||
});
|
||||
var coreNamespacedWatchers = fromEvent(bs.events, "file:changed")
|
||||
.filter(function () {
|
||||
return bs.options.get("codeSync");
|
||||
})
|
||||
.filter(function (x) {
|
||||
return x.namespace === "core";
|
||||
});
|
||||
var handler = fileHandler
|
||||
.fileChanges(coreNamespacedWatchers, bs.options)
|
||||
.subscribe(function (x) {
|
||||
if (x.type === "reload") {
|
||||
bs.events.emit("browser:reload", x);
|
||||
}
|
||||
if (x.type === "inject") {
|
||||
x.files.forEach(function (data) {
|
||||
if (!bs.paused && data.namespace === "core") {
|
||||
bs.events.emit("file:reload", fileUtils.getFileInfo(data, bs.options));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
bs.registerCleanupTask(function () {
|
||||
handler.dispose();
|
||||
reloader.dispose();
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=internal-events.js.map
|
1
node_modules/browser-sync/dist/internal-events.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/internal-events.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"internal-events.js","sourceRoot":"","sources":["../lib/internal-events.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC/B,IAAI,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AACxC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;AACxC,IAAI,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,GAAG,UAAS,EAAE;IACxB,IAAI,MAAM,GAAG;QACT;;;WAGG;QACH,aAAa,EAAE,UAAS,IAAI;YACxB,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD;;WAEG;QACH,gBAAgB,EAAE;YACd,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzC,CAAC;QACD;;;WAGG;QACH,gBAAgB,EAAE,UAAS,IAAI;YAC3B,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;QACD;;;WAGG;QACH,iBAAiB,EAAE,UAAS,IAAI;YAC5B,IAAI,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,EAAE;oBACzC,EAAE,CAAC,MAAM,CAAC,IAAI,CACV,aAAa,EACb,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAC1C,CAAC;iBACL;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEP,EAAE,CAAC,mBAAmB,CAAC;QACnB,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,QAAQ,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
4260
node_modules/browser-sync/dist/lodash.custom.js
generated
vendored
Normal file
4260
node_modules/browser-sync/dist/lodash.custom.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/browser-sync/dist/lodash.custom.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/lodash.custom.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
246
node_modules/browser-sync/dist/logger.js
generated
vendored
Normal file
246
node_modules/browser-sync/dist/logger.js
generated
vendored
Normal file
@ -0,0 +1,246 @@
|
||||
"use strict";
|
||||
var messages = require("./connect-utils");
|
||||
var utils = require("./utils");
|
||||
var _ = require("./lodash.custom");
|
||||
var chalk = require("chalk");
|
||||
var template = (prefix) => "[" + chalk.blue(prefix) + "] ";
|
||||
var logger = require("eazy-logger").Logger({
|
||||
useLevelPrefixes: false
|
||||
});
|
||||
module.exports.logger = logger;
|
||||
/**
|
||||
* @param name
|
||||
* @returns {*}
|
||||
*/
|
||||
module.exports.getLogger = function (name) {
|
||||
return logger.clone(function (config) {
|
||||
config.prefix = config.prefix + template(name);
|
||||
return config;
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Logging Callbacks
|
||||
*/
|
||||
module.exports.callbacks = {
|
||||
/**
|
||||
* Log when file-watching has started
|
||||
* @param {BrowserSync} bs
|
||||
* @param data
|
||||
*/
|
||||
"file:watching": function (bs, data) {
|
||||
if (Object.keys(data).length) {
|
||||
logger.info("Watching files...");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Log when a file changes
|
||||
* @param {BrowserSync} bs
|
||||
* @param data
|
||||
*/
|
||||
"file:reload": function (bs, data) {
|
||||
if (canLogFileChange(bs, data)) {
|
||||
if (data.path[0] === "*") {
|
||||
return logger.info(chalk.cyan("Reloading files that match: %s"), chalk.magenta(data.path));
|
||||
}
|
||||
logger.info(chalk.cyan("File event [%s] : %s"), data.event, chalk.magenta(data.path));
|
||||
}
|
||||
},
|
||||
/**
|
||||
*
|
||||
*/
|
||||
"service:exit": function () {
|
||||
logger.debug("Exiting...");
|
||||
},
|
||||
/**
|
||||
*
|
||||
*/
|
||||
"browser:reload": function (bs, data = {}) {
|
||||
if (canLogFileChange(bs)) {
|
||||
if (data.files && data.files.length > 1) {
|
||||
return logger.info(chalk.cyan(`Reloading Browsers... (buffered %s events)`), data.files.length);
|
||||
}
|
||||
logger.info(chalk.cyan("Reloading Browsers..."));
|
||||
}
|
||||
},
|
||||
/**
|
||||
*
|
||||
*/
|
||||
"browser:error": function () {
|
||||
logger.error("Couldn't open browser (if you are using BrowserSync in a " +
|
||||
"headless environment, you might want to set the %s option to %s)", chalk.cyan("open"), chalk.cyan("false"));
|
||||
},
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param data
|
||||
*/
|
||||
"stream:changed": function (bs, data) {
|
||||
if (canLogFileChange(bs)) {
|
||||
var changed = data.changed;
|
||||
logger.info(chalk.cyan("%s %s changed (%s)"), changed.length, changed.length > 1 ? "files" : "file", chalk.magenta(changed.join(", ")));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Client connected logging
|
||||
* @param {BrowserSync} bs
|
||||
* @param data
|
||||
*/
|
||||
"client:connected": function (bs, data) {
|
||||
var uaString = utils.getUaString(data.ua);
|
||||
var msg = chalk.cyan("Browser Connected: %s, version: %s");
|
||||
var method = "info";
|
||||
if (!bs.options.get("logConnections")) {
|
||||
method = "debug";
|
||||
}
|
||||
logger.log(method, msg, chalk.magenta(uaString.name), chalk.magenta(uaString.version));
|
||||
},
|
||||
/**
|
||||
* Main logging when the service is running
|
||||
* @param {BrowserSync} bs
|
||||
* @param data
|
||||
*/
|
||||
"service:running": function (bs, data) {
|
||||
const type = data.type;
|
||||
if (bs.options.get("json")) {
|
||||
return console.log(JSON.stringify({
|
||||
"service:running": {
|
||||
options: bs.options.toJS()
|
||||
}
|
||||
}));
|
||||
}
|
||||
if (type === "server") {
|
||||
var baseDir = bs.options.getIn(["server", "baseDir"]);
|
||||
logUrls(bs.options.get("urls").toJS());
|
||||
if (baseDir) {
|
||||
if (utils.isList(baseDir)) {
|
||||
baseDir.forEach(serveFiles);
|
||||
}
|
||||
else {
|
||||
serveFiles(baseDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type === "proxy") {
|
||||
logger.info("Proxying: %s", chalk.cyan(bs.options.getIn(["proxy", "target"])));
|
||||
logUrls(bs.options.get("urls").toJS());
|
||||
}
|
||||
if (type === "snippet") {
|
||||
if (bs.options.get("logSnippet")) {
|
||||
logger.info(chalk.bold(`Copy the following snippet into your website, just before the closing ${chalk.cyan('</body>')} tag`));
|
||||
logger.unprefixed("info", messages.scriptTags(bs.options));
|
||||
}
|
||||
logUrls(bs.options
|
||||
.get("urls")
|
||||
.filter(function (value, key) {
|
||||
return key.slice(0, 2) === "ui";
|
||||
})
|
||||
.toJS());
|
||||
}
|
||||
function serveFiles(base) {
|
||||
logger.info("Serving files from: %s", chalk.magenta(base));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Plugin interface for BrowserSync
|
||||
* @param {EventEmitter} emitter
|
||||
* @param {BrowserSync} bs
|
||||
* @returns {Object}
|
||||
*/
|
||||
module.exports.plugin = function (emitter, bs) {
|
||||
var logPrefix = bs.options.get("logPrefix");
|
||||
var logLevel = bs.options.get("logLevel");
|
||||
// Should set logger level here!
|
||||
logger.setLevel(logLevel);
|
||||
if (logPrefix) {
|
||||
if (_.isFunction(logPrefix)) {
|
||||
logger.setPrefix(logPrefix);
|
||||
}
|
||||
else {
|
||||
logger.setPrefix(template(logPrefix));
|
||||
}
|
||||
}
|
||||
_.each(exports.callbacks, function (func, event) {
|
||||
emitter.on(event, func.bind(this, bs));
|
||||
});
|
||||
return logger;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param urls
|
||||
*/
|
||||
function logUrls(urls) {
|
||||
var keys = Object.keys(urls);
|
||||
var longestName = 0;
|
||||
var longesturl = 0;
|
||||
var offset = 2;
|
||||
if (!keys.length) {
|
||||
return;
|
||||
}
|
||||
var names = keys.map(function (key) {
|
||||
if (key.length > longestName) {
|
||||
longestName = key.length;
|
||||
}
|
||||
if (urls[key].length > longesturl) {
|
||||
longesturl = urls[key].length;
|
||||
}
|
||||
return key;
|
||||
});
|
||||
var underline = getChars(longestName + offset + longesturl + 1, "-");
|
||||
var underlined = false;
|
||||
logger.info(chalk.bold("Access URLs:"));
|
||||
logger.unprefixed("info", " %s", chalk.grey(underline));
|
||||
keys.forEach(function (key, i) {
|
||||
var keyname = getKeyName(key);
|
||||
logger.unprefixed("info", " %s: %s", getPadding(key.length, longestName + offset) + keyname, chalk.magenta(urls[key]));
|
||||
if (!underlined && names[i + 1] && names[i + 1].indexOf("ui") > -1) {
|
||||
underlined = true;
|
||||
logger.unprefixed("info", " %s", chalk.grey(underline));
|
||||
}
|
||||
});
|
||||
logger.unprefixed("info", " %s", chalk.grey(underline));
|
||||
}
|
||||
/**
|
||||
* @param {Number} len
|
||||
* @param {Number} max
|
||||
* @returns {string}
|
||||
*/
|
||||
function getPadding(len, max) {
|
||||
return new Array(max - (len + 1)).join(" ");
|
||||
}
|
||||
/**
|
||||
* @param {Number} len
|
||||
* @param {String} char
|
||||
* @returns {string}
|
||||
*/
|
||||
function getChars(len, char) {
|
||||
return new Array(len).join(char);
|
||||
}
|
||||
/**
|
||||
* Transform url-key names into something more presentable
|
||||
* @param key
|
||||
* @returns {string}
|
||||
*/
|
||||
function getKeyName(key) {
|
||||
if (key.indexOf("ui") > -1) {
|
||||
if (key === "ui") {
|
||||
return "UI";
|
||||
}
|
||||
if (key === "ui-external") {
|
||||
return "UI External";
|
||||
}
|
||||
}
|
||||
return key.substr(0, 1).toUpperCase() + key.substring(1);
|
||||
}
|
||||
/**
|
||||
* Determine if file changes should be logged
|
||||
* @param bs
|
||||
* @param data
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function canLogFileChange(bs, data) {
|
||||
if (data && data.log === false) {
|
||||
return false;
|
||||
}
|
||||
return bs.options.get("logFileChanges");
|
||||
}
|
||||
//# sourceMappingURL=logger.js.map
|
1
node_modules/browser-sync/dist/logger.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/logger.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
245
node_modules/browser-sync/dist/options.js
generated
vendored
Normal file
245
node_modules/browser-sync/dist/options.js
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setUiPort = exports.setMiddleware = exports.fixSnippetIncludePaths = exports.fixSnippetIgnorePaths = exports.fixRewriteRules = exports.liftExtensionsOptionFromCli = exports.setServerOpts = exports.setNamespace = exports.setStartPath = exports.setScheme = exports.setMode = exports.setOpen = exports.setProxyWs = void 0;
|
||||
const _ = require("./lodash.custom");
|
||||
const Immutable = require("immutable");
|
||||
const defaultConfig = require("./default-config");
|
||||
/**
|
||||
* Move top-level ws options to proxy.ws
|
||||
* This is to allow it to be set from the CLI
|
||||
* @param incoming
|
||||
*/
|
||||
function setProxyWs(incoming) {
|
||||
if (incoming.get("ws") && incoming.get("mode") === "proxy") {
|
||||
return [incoming.setIn(["proxy", "ws"], true), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.setProxyWs = setProxyWs;
|
||||
/**
|
||||
* @param incoming
|
||||
*/
|
||||
function setOpen(incoming) {
|
||||
return [
|
||||
incoming.update("open", function (open) {
|
||||
if (incoming.get("mode") === "snippet") {
|
||||
if (open !== "ui" && open !== "ui-external") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return open;
|
||||
}),
|
||||
[]
|
||||
];
|
||||
}
|
||||
exports.setOpen = setOpen;
|
||||
/**
|
||||
* Set the running mode
|
||||
* @param incoming
|
||||
*/
|
||||
function setMode(incoming) {
|
||||
const output = incoming.set("mode", (function () {
|
||||
if (incoming.get("server")) {
|
||||
return "server";
|
||||
}
|
||||
if (incoming.get("proxy")) {
|
||||
return "proxy";
|
||||
}
|
||||
return "snippet";
|
||||
})());
|
||||
return [output, []];
|
||||
}
|
||||
exports.setMode = setMode;
|
||||
/**
|
||||
* @param incoming
|
||||
*/
|
||||
function setScheme(incoming) {
|
||||
var scheme = "http";
|
||||
if (incoming.getIn(["server", "https"])) {
|
||||
scheme = "https";
|
||||
}
|
||||
if (incoming.get("https")) {
|
||||
scheme = "https";
|
||||
}
|
||||
if (incoming.getIn(["proxy", "url", "protocol"])) {
|
||||
if (incoming.getIn(["proxy", "url", "protocol"]) === "https:") {
|
||||
scheme = "https";
|
||||
}
|
||||
}
|
||||
return [incoming.set("scheme", scheme), []];
|
||||
}
|
||||
exports.setScheme = setScheme;
|
||||
/**
|
||||
* @param incoming
|
||||
*/
|
||||
function setStartPath(incoming) {
|
||||
if (incoming.get("proxy")) {
|
||||
var path = incoming.getIn(["proxy", "url", "path"]);
|
||||
if (path !== "/") {
|
||||
return [incoming.set("startPath", path), []];
|
||||
}
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.setStartPath = setStartPath;
|
||||
/**
|
||||
* @param incoming
|
||||
*/
|
||||
function setNamespace(incoming) {
|
||||
var namespace = incoming.getIn(["socket", "namespace"]);
|
||||
if (_.isFunction(namespace)) {
|
||||
return [
|
||||
incoming.setIn(["socket", "namespace"], namespace(defaultConfig.socket.namespace)),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.setNamespace = setNamespace;
|
||||
/**
|
||||
* @param incoming
|
||||
*/
|
||||
function setServerOpts(incoming) {
|
||||
if (!incoming.get("server")) {
|
||||
return [incoming, []];
|
||||
}
|
||||
var indexarg = incoming.getIn(["server", "index"]) || "index.html";
|
||||
var optPath = ["server", "serveStaticOptions"];
|
||||
if (!incoming.getIn(optPath)) {
|
||||
return [
|
||||
incoming.setIn(optPath, Immutable.Map({
|
||||
index: indexarg
|
||||
})),
|
||||
[]
|
||||
];
|
||||
}
|
||||
if (!incoming.hasIn(optPath.concat(["index"]))) {
|
||||
return [incoming.setIn(optPath.concat(["index"]), indexarg), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.setServerOpts = setServerOpts;
|
||||
function liftExtensionsOptionFromCli(incoming) {
|
||||
// cli extensions
|
||||
var optPath = ["server", "serveStaticOptions"];
|
||||
if (incoming.get("extensions")) {
|
||||
return [
|
||||
incoming.setIn(optPath.concat(["extensions"]), incoming.get("extensions")),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.liftExtensionsOptionFromCli = liftExtensionsOptionFromCli;
|
||||
/**
|
||||
* Back-compat fixes for rewriteRules being set to a boolean
|
||||
*/
|
||||
function fixRewriteRules(incoming) {
|
||||
return [
|
||||
incoming.update("rewriteRules", function (rr) {
|
||||
return Immutable.List([])
|
||||
.concat(rr)
|
||||
.filter(Boolean);
|
||||
}),
|
||||
[]
|
||||
];
|
||||
}
|
||||
exports.fixRewriteRules = fixRewriteRules;
|
||||
function fixSnippetIgnorePaths(incoming) {
|
||||
var ignorePaths = incoming.getIn(["snippetOptions", "ignorePaths"]);
|
||||
if (ignorePaths) {
|
||||
if (_.isString(ignorePaths)) {
|
||||
ignorePaths = [ignorePaths];
|
||||
}
|
||||
ignorePaths = ignorePaths.map(ensureSlash);
|
||||
return [
|
||||
incoming.setIn(["snippetOptions", "blacklist"], Immutable.List(ignorePaths)),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.fixSnippetIgnorePaths = fixSnippetIgnorePaths;
|
||||
function fixSnippetIncludePaths(incoming) {
|
||||
var includePaths = incoming.getIn(["snippetOptions", "whitelist"]);
|
||||
if (includePaths) {
|
||||
includePaths = includePaths.map(ensureSlash);
|
||||
return [
|
||||
incoming.setIn(["snippetOptions", "whitelist"], Immutable.List(includePaths)),
|
||||
[]
|
||||
];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.fixSnippetIncludePaths = fixSnippetIncludePaths;
|
||||
/**
|
||||
* Enforce paths to begin with a forward slash
|
||||
*/
|
||||
function ensureSlash(item) {
|
||||
if (item[0] !== "/") {
|
||||
return "/" + item;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function setMiddleware(incoming) {
|
||||
var mw = getMiddlwares(incoming);
|
||||
return [incoming.set("middleware", mw), []];
|
||||
}
|
||||
exports.setMiddleware = setMiddleware;
|
||||
/**
|
||||
* top-level option, or given as part of the proxy/server option
|
||||
* @param item
|
||||
* @returns {*}
|
||||
*/
|
||||
function getMiddlwares(item) {
|
||||
var mw = item.get("middleware");
|
||||
var serverMw = item.getIn(["server", "middleware"]);
|
||||
var proxyMw = item.getIn(["proxy", "middleware"]);
|
||||
var list = Immutable.List([]);
|
||||
if (mw) {
|
||||
return listMerge(list, mw);
|
||||
}
|
||||
if (serverMw) {
|
||||
return listMerge(list, serverMw);
|
||||
}
|
||||
if (proxyMw) {
|
||||
return listMerge(list, proxyMw);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* @param item
|
||||
* @returns {*}
|
||||
*/
|
||||
function isList(item) {
|
||||
return Immutable.List.isList(item);
|
||||
}
|
||||
/**
|
||||
* @param list
|
||||
* @param item
|
||||
* @returns {*}
|
||||
*/
|
||||
function listMerge(list, item) {
|
||||
if (_.isFunction(item)) {
|
||||
list = list.push(item);
|
||||
}
|
||||
if (isList(item) && item.size) {
|
||||
list = list.merge(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* @param incoming
|
||||
* @returns {*}
|
||||
*/
|
||||
function setUiPort(incoming) {
|
||||
if (incoming.get("uiPort")) {
|
||||
return [incoming.setIn(["ui", "port"], incoming.get("uiPort")), []];
|
||||
}
|
||||
return [incoming, []];
|
||||
}
|
||||
exports.setUiPort = setUiPort;
|
||||
//# sourceMappingURL=options.js.map
|
1
node_modules/browser-sync/dist/options.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/options.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
172
node_modules/browser-sync/dist/plugins.js
generated
vendored
Normal file
172
node_modules/browser-sync/dist/plugins.js
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
var Immutable = require("immutable");
|
||||
var Map = Immutable.Map;
|
||||
var isMap = Immutable.Map.isMap;
|
||||
var List = Immutable.List;
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
const { parseParams } = require("./utils");
|
||||
var Plugin = Immutable.Record({
|
||||
moduleName: "",
|
||||
name: "",
|
||||
active: true,
|
||||
module: undefined,
|
||||
options: Map({}),
|
||||
via: "inline",
|
||||
dir: process.cwd(),
|
||||
init: undefined,
|
||||
errors: List([])
|
||||
});
|
||||
/**
|
||||
* Accept a string/object
|
||||
* and resolve it into the plugin format above
|
||||
* @param item
|
||||
* @returns {*}
|
||||
*/
|
||||
function resolvePlugin(item) {
|
||||
/**
|
||||
* Handle when string was given, such as plugins: ['bs-html-injector']
|
||||
*/
|
||||
if (typeof item === "string") {
|
||||
return getFromString(item);
|
||||
}
|
||||
if (!isMap(item)) {
|
||||
return new Plugin().mergeDeep({
|
||||
errors: [new Error("Plugin not supported in this format")]
|
||||
});
|
||||
}
|
||||
if (item.has("module")) {
|
||||
var nameOrObj = item.get("module");
|
||||
var options = item.get("options");
|
||||
/**
|
||||
* The 'module' key can be a string, this allows
|
||||
* inline plugin references, but with options
|
||||
* eg:
|
||||
*
|
||||
* bs.init({
|
||||
* plugins: [
|
||||
* {
|
||||
* module: './myjs-file.js'
|
||||
* options: {
|
||||
* files: "*.html"
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* });
|
||||
*/
|
||||
if (typeof nameOrObj === "string") {
|
||||
return getFromString(nameOrObj).mergeDeep({
|
||||
options: options
|
||||
});
|
||||
}
|
||||
/**
|
||||
* If the plugin was given completely inline (because it needs options)
|
||||
* eg:
|
||||
*
|
||||
* bs.init({
|
||||
* plugins: [
|
||||
* {
|
||||
* module: {
|
||||
* plugin: function() {
|
||||
* console.log('My plugin code')
|
||||
* }
|
||||
* },
|
||||
* options: {
|
||||
* files: "*.html"
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* })
|
||||
*/
|
||||
if (Immutable.Map.isMap(nameOrObj)) {
|
||||
return new Plugin({
|
||||
module: nameOrObj,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If a module was given directly. For example, ater calling require.
|
||||
*
|
||||
* eg:
|
||||
* var myplugin = require('./some-js');
|
||||
* bs.init({plugins: [myplugin]});
|
||||
*/
|
||||
if (item.has("plugin")) {
|
||||
return new Plugin({
|
||||
module: item
|
||||
});
|
||||
}
|
||||
/**
|
||||
* If we reach here, the plugin option was used incorrectly
|
||||
*/
|
||||
return new Plugin().mergeDeep({
|
||||
errors: [new Error("Plugin was not configured correctly")]
|
||||
});
|
||||
}
|
||||
module.exports.resolvePlugin = resolvePlugin;
|
||||
/**
|
||||
* Load a plugin from disk
|
||||
* @param item
|
||||
* @returns {*}
|
||||
*/
|
||||
function requirePlugin(item) {
|
||||
/**
|
||||
* if the "module" property already exists and
|
||||
* is not a string, then we bail and don't bother looking
|
||||
* for the file
|
||||
*/
|
||||
if (item.get("module") && typeof item.get("module") !== "string") {
|
||||
return item;
|
||||
}
|
||||
try {
|
||||
/**
|
||||
* Try a raw node require() call - this will be how
|
||||
* regular "npm installed" plugins wil work
|
||||
*/
|
||||
var maybe = require.resolve(item.get("name"));
|
||||
return item.set("module", require(maybe));
|
||||
}
|
||||
catch (e) {
|
||||
/**
|
||||
* If require threw an MODULE_NOT_FOUND error, try again
|
||||
* by resolving from cwd. This is needed since cli
|
||||
* users will not add ./ to the front of a path (which
|
||||
* node requires to resolve from cwd)
|
||||
*/
|
||||
if (e.code === "MODULE_NOT_FOUND") {
|
||||
var maybe = path.resolve(process.cwd(), item.get("name"));
|
||||
if (fs.existsSync(maybe)) {
|
||||
return item.set("module", require(maybe));
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* Finally return a plugin that contains the error
|
||||
* this will be picked up later and discarded
|
||||
*/
|
||||
return item.update("errors", function (errors) {
|
||||
return errors.concat(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
module.exports.requirePlugin = requirePlugin;
|
||||
function getFromString(string) {
|
||||
/**
|
||||
* We allow query strings for plugins, so always split on ?
|
||||
*/
|
||||
var split = string.split("?");
|
||||
var outGoing = new Plugin({
|
||||
moduleName: split[0],
|
||||
name: split[0]
|
||||
});
|
||||
if (split.length > 1) {
|
||||
return outGoing.update("options", function (opts) {
|
||||
const parsed = parseParams(split[1]);
|
||||
return opts.mergeDeep(parsed);
|
||||
});
|
||||
}
|
||||
return outGoing;
|
||||
}
|
||||
//# sourceMappingURL=plugins.js.map
|
1
node_modules/browser-sync/dist/plugins.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/plugins.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../lib/plugins.js"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;AACxB,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;AAChC,IAAI,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAC1B,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,E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AAC,CAAC;aAC7C;iBAAM;gBACH;;;mBAGG;gBACH,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAS,MAAM;oBACxC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC5B,CAAC,CAAC,CAAC;aACN;SACJ;QACD,MAAM,CAAC,CAAC;KACX;AACL,CAAC;AACD,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;AAE7C,SAAS,aAAa,CAAC,MAAM;IACzB;;OAEG;IACH,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9B,IAAI,QAAQ,GAAG,IAAI,MAAM,CAAC;QACtB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;QACpB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;KACjB,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAClB,OAAO,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,UAAS,IAAI;YAC3C,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;KACN;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
15
node_modules/browser-sync/dist/public/exit.js
generated
vendored
Normal file
15
node_modules/browser-sync/dist/public/exit.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @param {BrowserSync} browserSync
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (browserSync) {
|
||||
function exit() {
|
||||
if (browserSync.active) {
|
||||
browserSync.events.emit("service:exit");
|
||||
browserSync.cleanup();
|
||||
}
|
||||
}
|
||||
return exit;
|
||||
};
|
||||
//# sourceMappingURL=exit.js.map
|
1
node_modules/browser-sync/dist/public/exit.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/exit.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../lib/public/exit.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,WAAW;IACjC,SAAS,IAAI;QACT,IAAI,WAAW,CAAC,MAAM,EAAE;YACpB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACxC,WAAW,CAAC,OAAO,EAAE,CAAC;SACzB;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
|
33
node_modules/browser-sync/dist/public/init.js
generated
vendored
Normal file
33
node_modules/browser-sync/dist/public/init.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var _ = require("../lodash.custom");
|
||||
const cli_options_1 = require("../cli/cli-options");
|
||||
/**
|
||||
* @param {BrowserSync} browserSync
|
||||
* @param {String} [name] - instance name
|
||||
* @param {Object} pjson
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (browserSync, name, pjson) {
|
||||
return function () {
|
||||
/**
|
||||
* Handle new + old signatures for init.
|
||||
*/
|
||||
var args = require("../args")(_.toArray(arguments));
|
||||
/**
|
||||
* If the current instance is already running, just return an error
|
||||
*/
|
||||
if (browserSync.active) {
|
||||
return args.cb(new Error(`Instance: ${name} is already running!`));
|
||||
}
|
||||
// Env specific items
|
||||
args.config.version = pjson.version;
|
||||
args.config.cwd = args.config.cwd || process.cwd();
|
||||
const [opts, errors] = (0, cli_options_1.merge)(args.config);
|
||||
if (errors.length) {
|
||||
return args.cb(new Error((0, cli_options_1.printErrors)(errors)));
|
||||
}
|
||||
return browserSync.init(opts, args.cb);
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=init.js.map
|
1
node_modules/browser-sync/dist/public/init.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/init.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../lib/public/init.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACpC,oDAAwD;AAExD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,WAAW,EAAE,IAAI,EAAE,KAAK;IAC9C,OAAO;QACH;;WAEG;QACH,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QAEpD;;WAEG;QACH,IAAI,WAAW,CAAC,MAAM,EAAE;YACpB,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,aAAa,IAAI,sBAAsB,CAAC,CAAC,CAAC;SACtE;QAED,qBAAqB;QACrB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAEnD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAA,mBAAK,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,MAAM,CAAC,MAAM,EAAE;YACf,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,IAAA,yBAAW,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAClD;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;AACN,CAAC,CAAC"}
|
17
node_modules/browser-sync/dist/public/notify.js
generated
vendored
Normal file
17
node_modules/browser-sync/dist/public/notify.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @param {BrowserSync} browserSync
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (browserSync) {
|
||||
return function (msg, timeout) {
|
||||
if (msg) {
|
||||
browserSync.events.emit("browser:notify", {
|
||||
message: msg,
|
||||
timeout: timeout || 2000,
|
||||
override: true
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=notify.js.map
|
1
node_modules/browser-sync/dist/public/notify.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/notify.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../lib/public/notify.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,WAAW;IACjC,OAAO,UAAS,GAAG,EAAE,OAAO;QACxB,IAAI,GAAG,EAAE;YACL,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACtC,OAAO,EAAE,GAAG;gBACZ,OAAO,EAAE,OAAO,IAAI,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;SACN;IACL,CAAC,CAAC;AACN,CAAC,CAAC"}
|
11
node_modules/browser-sync/dist/public/pause.js
generated
vendored
Normal file
11
node_modules/browser-sync/dist/public/pause.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @param {BrowserSync} browserSync
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (browserSync) {
|
||||
return function () {
|
||||
browserSync.paused = true;
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=pause.js.map
|
1
node_modules/browser-sync/dist/public/pause.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/pause.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"pause.js","sourceRoot":"","sources":["../../lib/public/pause.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,WAAW;IACjC,OAAO;QACH,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC;IAC9B,CAAC,CAAC;AACN,CAAC,CAAC"}
|
59
node_modules/browser-sync/dist/public/public-utils.js
generated
vendored
Normal file
59
node_modules/browser-sync/dist/public/public-utils.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var _ = require("../lodash.custom");
|
||||
module.exports = {
|
||||
/**
|
||||
* Emit the internal `file:change` event
|
||||
* @param {EventEmitter} emitter
|
||||
* @param {string} path
|
||||
* @param {boolean} [log]
|
||||
*/
|
||||
emitChangeEvent: function emitChangeEvent(emitter, path, log) {
|
||||
emitter.emit("file:changed", {
|
||||
path: path,
|
||||
log: log,
|
||||
namespace: "core",
|
||||
event: "change"
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Emit the internal `browser:reload` event
|
||||
* @param {EventEmitter} emitter
|
||||
*/
|
||||
emitBrowserReload: function emitChangeEvent(emitter) {
|
||||
emitter.emit("_browser:reload");
|
||||
},
|
||||
/**
|
||||
* Emit the internal `stream:changed` event
|
||||
* @param {EventEmitter} emitter
|
||||
* @param {Array} changed
|
||||
*/
|
||||
emitStreamChangedEvent: function (emitter, changed) {
|
||||
emitter.emit("stream:changed", { changed: changed });
|
||||
},
|
||||
/**
|
||||
* This code handles the switch between .reload & .stream
|
||||
* since 2.6.0
|
||||
* @param name
|
||||
* @param args
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isStreamArg: function (name, args) {
|
||||
if (name === "stream") {
|
||||
return true;
|
||||
}
|
||||
if (name !== "reload") {
|
||||
return false;
|
||||
}
|
||||
var firstArg = args[0];
|
||||
/**
|
||||
* If here, it's reload with args
|
||||
*/
|
||||
if (_.isObject(firstArg)) {
|
||||
if (!Array.isArray(firstArg) && Object.keys(firstArg).length) {
|
||||
return firstArg.stream === true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=public-utils.js.map
|
1
node_modules/browser-sync/dist/public/public-utils.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/public-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"public-utils.js","sourceRoot":"","sources":["../../lib/public/public-utils.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEpC,MAAM,CAAC,OAAO,GAAG;IACb;;;;;OAKG;IACH,eAAe,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG;QACxD,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACzB,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,MAAM;YACjB,KAAK,EAAE,QAAQ;SAClB,CAAC,CAAC;IACP,CAAC;IACD;;;OAGG;IACH,iBAAiB,EAAE,SAAS,eAAe,CAAC,OAAO;QAC/C,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;IACD;;;;OAIG;IACH,sBAAsB,EAAE,UAAS,OAAO,EAAE,OAAO;QAC7C,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IACD;;;;;;OAMG;IACH,WAAW,EAAE,UAAS,IAAI,EAAE,IAAI;QAC5B,IAAI,IAAI,KAAK,QAAQ,EAAE;YACnB,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACnB,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEvB;;WAEG;QACH,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;gBAC1D,OAAO,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC;aACnC;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAC"}
|
60
node_modules/browser-sync/dist/public/reload.js
generated
vendored
Normal file
60
node_modules/browser-sync/dist/public/reload.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var utils = require("../utils");
|
||||
var publicUtils = require("./public-utils");
|
||||
var _ = require("../lodash.custom");
|
||||
var defaultConfig = require("../default-config");
|
||||
var stream = require("./stream");
|
||||
/**
|
||||
* @param emitter
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (emitter) {
|
||||
/**
|
||||
* Inform browsers about file changes.
|
||||
*
|
||||
* eg: reload("core.css")
|
||||
*/
|
||||
function browserSyncReload(opts) {
|
||||
/**
|
||||
* BACKWARDS COMPATIBILITY:
|
||||
* Passing an object as the only arg to the `reload`
|
||||
* method with at *least* the key-value pair of {stream: true},
|
||||
* was only ever used for streams support - so it's safe to check
|
||||
* for that signature here and defer to the
|
||||
* dedicated `.stream()` method instead.
|
||||
*/
|
||||
if (_.isObject(opts)) {
|
||||
if (!Array.isArray(opts) && Object.keys(opts).length) {
|
||||
if (opts.stream === true) {
|
||||
return stream(emitter)(opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handle single string paths such as
|
||||
* reload("core.css")
|
||||
*/
|
||||
if (typeof opts === "string" && opts !== "undefined") {
|
||||
return publicUtils.emitChangeEvent(emitter, opts, true);
|
||||
}
|
||||
/**
|
||||
* Handle an array of file paths such as
|
||||
* reload(["core.css, "ie.css"])
|
||||
*/
|
||||
if (Array.isArray(opts)) {
|
||||
return opts.forEach(function (filepath) {
|
||||
publicUtils.emitChangeEvent(emitter, filepath, true);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* At this point the argument given was neither an object,
|
||||
* array or string so we simply perform a reload. This is to
|
||||
* allow the following syntax to work as expected
|
||||
*
|
||||
* reload();
|
||||
*/
|
||||
return publicUtils.emitBrowserReload(emitter);
|
||||
}
|
||||
return browserSyncReload;
|
||||
};
|
||||
//# sourceMappingURL=reload.js.map
|
1
node_modules/browser-sync/dist/public/reload.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/reload.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../lib/public/reload.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAChC,IAAI,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC5C,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACpC,IAAI,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjD,IAAI,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,OAAO;IAC7B;;;;OAIG;IACH,SAAS,iBAAiB,CAAC,IAAI;QAC3B;;;;;;;WAOG;QACH,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;gBAClD,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;oBACtB,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;iBAChC;aACJ;SACJ;QAED;;;WAGG;QACH,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,WAAW,EAAE;YAClD,OAAO,WAAW,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;SAC3D;QAED;;;WAGG;QACH,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAS,QAAQ;gBACjC,WAAW,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;SACN;QAED;;;;;;WAMG;QACH,OAAO,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAC"}
|
11
node_modules/browser-sync/dist/public/resume.js
generated
vendored
Normal file
11
node_modules/browser-sync/dist/public/resume.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @param {BrowserSync} browserSync
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (browserSync) {
|
||||
return function () {
|
||||
browserSync.paused = false;
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=resume.js.map
|
1
node_modules/browser-sync/dist/public/resume.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/resume.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../lib/public/resume.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG,UAAS,WAAW;IACjC,OAAO;QACH,WAAW,CAAC,MAAM,GAAG,KAAK,CAAC;IAC/B,CAAC,CAAC;AACN,CAAC,CAAC"}
|
80
node_modules/browser-sync/dist/public/stream.js
generated
vendored
Normal file
80
node_modules/browser-sync/dist/public/stream.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
var path = require("path");
|
||||
var micromatch = require("micromatch");
|
||||
var utils = require("./public-utils");
|
||||
/**
|
||||
* @param emitter
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function (emitter) {
|
||||
/**
|
||||
* Return a transform/through stream that listens to file
|
||||
* paths and fires internal Browsersync events.
|
||||
* @param {{once: boolean, match: string|array}} [opts]
|
||||
* @returns {Stream.Transform}
|
||||
*/
|
||||
function browserSyncThroughStream(opts) {
|
||||
opts = opts || {};
|
||||
var emitted = false;
|
||||
var Transform = require("stream").Transform;
|
||||
var reload = new Transform({ objectMode: true });
|
||||
var changed = [];
|
||||
reload._transform = function (file, encoding, next) {
|
||||
var stream = this;
|
||||
/**
|
||||
* End is always called to send the current file down
|
||||
* stream. Browsersync never acts upon a stream,
|
||||
* we only `listen` to it.
|
||||
*/
|
||||
function end() {
|
||||
stream.push(file); // always send the file down-stream
|
||||
next();
|
||||
}
|
||||
/**
|
||||
* If {match: <pattern>} was provided, test the
|
||||
* current filepath against it
|
||||
*/
|
||||
if (opts.match) {
|
||||
if (!micromatch(file.path, opts.match, { dot: true }).length) {
|
||||
return end();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* if {once: true} provided, emit the reload event for the
|
||||
* first file only
|
||||
*/
|
||||
if (opts.once === true && !emitted) {
|
||||
utils.emitBrowserReload(emitter);
|
||||
emitted = true;
|
||||
}
|
||||
else {
|
||||
// handle multiple
|
||||
if (opts.once === true && emitted) {
|
||||
}
|
||||
else {
|
||||
if (file.path) {
|
||||
emitted = true;
|
||||
utils.emitChangeEvent(emitter, file.path, false);
|
||||
changed.push(path.basename(file.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
end();
|
||||
};
|
||||
/**
|
||||
* When this current operation has finished, emit the
|
||||
* steam:changed event so that any loggers can pick up it
|
||||
* @param next
|
||||
* @private
|
||||
*/
|
||||
reload._flush = function (next) {
|
||||
if (changed.length) {
|
||||
utils.emitStreamChangedEvent(emitter, changed);
|
||||
}
|
||||
next();
|
||||
};
|
||||
return reload;
|
||||
}
|
||||
return browserSyncThroughStream;
|
||||
};
|
||||
//# sourceMappingURL=stream.js.map
|
1
node_modules/browser-sync/dist/public/stream.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/public/stream.js.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C,OAAO,CAAC,CAAC;gBAEjC,OAAO,GAAG,IAAI,CAAC;aAClB;iBAAM;gBACH,kBAAkB;gBAElB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,EAAE;iBAClC;qBAAM;oBACH,IAAI,IAAI,CAAC,IAAI,EAAE;wBACX,OAAO,GAAG,IAAI,CAAC;wBACf,KAAK,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;wBACjD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;qBAC1C;iBACJ;aACJ;YAED,GAAG,EAAE,CAAC;QACV,CAAC,CAAC;QAEF;;;;;WAKG;QACH,MAAM,CAAC,MAAM,GAAG,UAAS,IAAI;YACzB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,KAAK,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,IAAI,EAAE,CAAC;QACX,CAAC,CAAC;QAEF,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO,wBAAwB,CAAC;AACpC,CAAC,CAAC"}
|
112
node_modules/browser-sync/dist/runner.js
generated
vendored
Normal file
112
node_modules/browser-sync/dist/runner.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.npmRunner = exports.shRunner = exports.bsRunner = exports.execRunner = void 0;
|
||||
const Rx = require("rx");
|
||||
const types_1 = require("./types");
|
||||
/**
|
||||
* @param {import("./types").RunnerOption} runner
|
||||
*/
|
||||
function execRunner(runner) {
|
||||
return Rx.Observable.concat(runner.run.map(r => {
|
||||
if ("bs" in r) {
|
||||
return bsRunner(r);
|
||||
}
|
||||
if ("sh" in r) {
|
||||
let cmd;
|
||||
if (typeof r.sh === "string") {
|
||||
cmd = r.sh;
|
||||
}
|
||||
else if ("cmd" in r.sh) {
|
||||
cmd = r.sh.cmd;
|
||||
}
|
||||
else {
|
||||
return Rx.Observable.throw(new Error("invalid `sh` config"));
|
||||
}
|
||||
return shRunner(r, {
|
||||
cmd: cmd
|
||||
});
|
||||
}
|
||||
if ("npm" in r) {
|
||||
return npmRunner(r);
|
||||
}
|
||||
throw new Error("unreachable");
|
||||
}));
|
||||
}
|
||||
exports.execRunner = execRunner;
|
||||
/**
|
||||
* @param {import("./types").Runner} runner
|
||||
*/
|
||||
function bsRunner(runner) {
|
||||
if (!("bs" in runner))
|
||||
throw new Error("unreachable");
|
||||
/** @type {import("./types").BsSideEffect[]} */
|
||||
const effects = [];
|
||||
if (runner.bs === "inject") {
|
||||
effects.push({
|
||||
type: "inject",
|
||||
files: runner.files.map(f => {
|
||||
return {
|
||||
path: f,
|
||||
event: "bs-runner"
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
else if (runner.bs === "reload") {
|
||||
effects.push({
|
||||
type: "reload",
|
||||
files: []
|
||||
});
|
||||
}
|
||||
return Rx.Observable.concat(Rx.Observable.just((0, types_1.toRunnerNotification)({
|
||||
status: "start",
|
||||
effects: [],
|
||||
runner
|
||||
})), Rx.Observable.just((0, types_1.toRunnerNotification)({
|
||||
status: "end",
|
||||
effects: effects,
|
||||
runner
|
||||
})));
|
||||
}
|
||||
exports.bsRunner = bsRunner;
|
||||
/**
|
||||
* @param {import("./types").Runner} runner
|
||||
* @param {object} params
|
||||
* @param {string} params.cmd
|
||||
*/
|
||||
function shRunner(runner, params) {
|
||||
return Rx.Observable.concat(Rx.Observable.just((0, types_1.toRunnerNotification)({ status: "start", effects: [], runner })), Rx.Observable.just((0, types_1.toRunnerNotification)({ status: "end", effects: [], runner })));
|
||||
}
|
||||
exports.shRunner = shRunner;
|
||||
/**
|
||||
* @param {import("./types").Runner} runner
|
||||
*/
|
||||
function npmRunner(runner) {
|
||||
if (!("npm" in runner))
|
||||
throw new Error("unreachble");
|
||||
return Rx.Observable.just(runner).flatMap(runner => {
|
||||
try {
|
||||
const runAll = require("npm-run-all");
|
||||
const runAllRunner = runAll(runner.npm, {
|
||||
parallel: false,
|
||||
stdout: process.stdout,
|
||||
stdin: process.stdin,
|
||||
stderr: process.stderr
|
||||
});
|
||||
const p = runAllRunner.then(results => {
|
||||
if (results.some(r => r.code !== 0))
|
||||
throw new Error("failed");
|
||||
return results;
|
||||
});
|
||||
return Rx.Observable.fromPromise(p).map(results => {
|
||||
return (0, types_1.toRunnerNotification)({ status: "end", effects: [], runner });
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
console.log("e", e);
|
||||
return Rx.Observable.throw(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.npmRunner = npmRunner;
|
||||
//# sourceMappingURL=runner.js.map
|
1
node_modules/browser-sync/dist/runner.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/runner.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../lib/runner.js"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,mCAA+C;AAE/C;;GAEG;AACH,SAAgB,UAAU,CAAC,MAAM;IAC7B,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,CACvB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACf,IAAI,IAAI,IAAI,CAAC,EAAE;YACX,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;SACtB;QACD,IAAI,IAAI,IAAI,CAAC,EAAE;YACX,IAAI,GAAG,CAAC;YACR,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,EAAE;gBAC1B,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;aACd;iBAAM,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE,EAAE;gBACtB,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;aAClB;iBAAM;gBACH,OAAO,EAA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AAC,CAAC;gBAC/D,OAAO,OAAO,CAAC;YACnB,CAAC,CAAC,CAAC;YACH,OAAO,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBAC9C,OAAO,IAAA,4BAAoB,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACxE,CAAC,CAAC,CAAC;SACN;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACpB,OAAO,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAvBD,8BAuBC"}
|
76
node_modules/browser-sync/dist/server/index.js
generated
vendored
Normal file
76
node_modules/browser-sync/dist/server/index.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
var enableDestroy = require("server-destroy");
|
||||
var _ = require("../lodash.custom");
|
||||
/**
|
||||
* Browsersync server
|
||||
* Three available modes: Snippet, Server or Proxy
|
||||
*/
|
||||
module.exports.plugin = function (bs) {
|
||||
var debug = bs.debug;
|
||||
var proxy = bs.options.get("proxy");
|
||||
var type = bs.options.get("mode");
|
||||
var bsServer = createServer(bs);
|
||||
if (type === "server" || type === "snippet") {
|
||||
debug("Static Server running ({magenta:%s}) ...", bs.options.get("scheme"));
|
||||
}
|
||||
if (proxy) {
|
||||
debug("Proxy running, proxing: {magenta:%s}", proxy.get("target"));
|
||||
}
|
||||
if (bsServer) {
|
||||
/**
|
||||
* Allow server to be destroyed gracefully
|
||||
*/
|
||||
enableDestroy(bsServer.server);
|
||||
/**
|
||||
* Listen on the available port
|
||||
*/
|
||||
bsServer.server.listen(bs.options.get("port"), bs.options.get("listen"));
|
||||
/**
|
||||
* Hack to deal with https://github.com/socketio/socket.io/issues/1602#issuecomment-224270022
|
||||
*/
|
||||
bs.registerCleanupTask(function () {
|
||||
if (bs.io && bs.io.sockets) {
|
||||
setCloseReceived(bs.io.sockets);
|
||||
}
|
||||
if (bs.ui && bs.ui.socket) {
|
||||
setCloseReceived(bs.ui.socket);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Destroy the server on cleanup
|
||||
*/
|
||||
bs.registerCleanupTask(function () {
|
||||
bsServer.server.destroy();
|
||||
});
|
||||
}
|
||||
function setCloseReceived(io) {
|
||||
Object.keys(io.sockets).forEach(function (key) {
|
||||
_.set(io.sockets[key], "conn.transport.socket._closeReceived", true);
|
||||
});
|
||||
}
|
||||
debug("Running mode: %s", type.toUpperCase());
|
||||
return {
|
||||
server: bsServer.server,
|
||||
app: bsServer.app
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Launch the server for serving the client JS plus static files
|
||||
* @param {BrowserSync} bs
|
||||
* @returns {{staticServer: (http.Server), proxyServer: (http.Server)}}
|
||||
*/
|
||||
function createServer(bs) {
|
||||
var proxy = bs.options.get("proxy");
|
||||
var server = bs.options.get("server");
|
||||
if (!proxy && !server) {
|
||||
return require("./snippet-server")(bs);
|
||||
}
|
||||
if (proxy) {
|
||||
return require("./proxy-server")(bs);
|
||||
}
|
||||
if (server) {
|
||||
return require("./static-server")(bs);
|
||||
}
|
||||
}
|
||||
module.exports.createServer = createServer;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/browser-sync/dist/server/index.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/server/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/server/index.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC9C,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,UAAS,E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,CAAC;QAC9B,CAAC,CAAC,CAAC;KACN;IAED,SAAS,gBAAgB,CAAC,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAS,GAAG;YACxC,CAAC,CAAC,GAAG,CACD,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EACf,sCAAsC,EACtC,IAAI,CACP,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAE9C,OAAO;QACH,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,EAAE,QAAQ,CAAC,GAAG;KACpB,CAAC;AACN,CAAC,CAAC;AAEF;;;;GAIG;AACH,SAAS,YAAY,CAAC,EAAE;IACpB,IAAI,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEtC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;QACnB,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;KAC1C;IAED,IAAI,KAAK,EAAE;QACP,OAAO,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC;KACxC;IAED,IAAI,MAAM,EAAE;QACR,OAAO,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;KACzC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
180
node_modules/browser-sync/dist/server/proxy-server.js
generated
vendored
Normal file
180
node_modules/browser-sync/dist/server/proxy-server.js
generated
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
var httpProxy = require("http-proxy");
|
||||
var utils = require("./utils");
|
||||
var proxyUtils = require("./proxy-utils");
|
||||
var Immutable = require("immutable");
|
||||
var Map = require("immutable").Map;
|
||||
var List = require("immutable").List;
|
||||
/**
|
||||
* Default options that are passed along to http-proxy
|
||||
*/
|
||||
var defaultHttpProxyOptions = Map({
|
||||
/**
|
||||
* This ensures targets are more likely to
|
||||
* accept each request
|
||||
*/
|
||||
changeOrigin: true,
|
||||
/**
|
||||
* This handles redirects
|
||||
*/
|
||||
autoRewrite: true,
|
||||
/**
|
||||
* This allows our self-signed certs to be used for development
|
||||
*/
|
||||
secure: false,
|
||||
ws: true
|
||||
});
|
||||
var defaultCookieOptions = Map({
|
||||
stripDomain: true
|
||||
});
|
||||
var ProxyOption = Immutable.Record({
|
||||
route: "",
|
||||
target: "",
|
||||
rewriteRules: true,
|
||||
/**
|
||||
* Functions to be called on proxy request
|
||||
* with args [proxyReq, req, res, options]
|
||||
*/
|
||||
proxyReq: List([]),
|
||||
/**
|
||||
* Functions to be called on proxy response
|
||||
* with args [proxyRes, req, res]
|
||||
*/
|
||||
proxyRes: List([]),
|
||||
/**
|
||||
* Functions to be called on proxy response
|
||||
* with args [proxyReq, req, socket, options, head]
|
||||
*/
|
||||
proxyReqWs: List([]),
|
||||
errHandler: undefined,
|
||||
url: Map({}),
|
||||
proxyOptions: Map(defaultHttpProxyOptions),
|
||||
cookies: Map(defaultCookieOptions),
|
||||
ws: false,
|
||||
middleware: List([]),
|
||||
reqHeaders: undefined
|
||||
});
|
||||
/**
|
||||
* @param {BrowserSync} bs
|
||||
* @param {String} scripts
|
||||
* @returns {*}
|
||||
*/
|
||||
module.exports = function createProxyServer(bs) {
|
||||
var opt = new ProxyOption().mergeDeep(bs.options.get("proxy"));
|
||||
var proxy = httpProxy.createProxyServer(opt
|
||||
.get("proxyOptions")
|
||||
.set("target", opt.get("target"))
|
||||
.toJS());
|
||||
var target = opt.get("target");
|
||||
var proxyReq = getProxyReqFunctions(opt.get("proxyReq"), opt, bs);
|
||||
var proxyRes = getProxyResFunctions(opt.get("proxyRes"), opt);
|
||||
var proxyResWs = opt.get("proxyReqWs");
|
||||
bs.options = bs.options.update("middleware", function (mw) {
|
||||
return mw.concat({
|
||||
id: "Browsersync Proxy",
|
||||
route: opt.get("route"),
|
||||
handle: function (req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: target
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
var app = utils.getBaseApp(bs);
|
||||
/**
|
||||
* @type {*|{server, app}}
|
||||
*/
|
||||
var browserSyncServer = utils.getServer(app, bs.options);
|
||||
browserSyncServer.proxy = proxy;
|
||||
if (opt.get("ws")) {
|
||||
// debug(`+ ws upgrade for: ${x.get("target")}`);
|
||||
browserSyncServer.server.on("upgrade", function (req, socket, head) {
|
||||
proxy.ws(req, socket, head);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Add any user provided functions for proxyReq, proxyReqWs and proxyRes
|
||||
*/
|
||||
applyFns("proxyReq", proxyReq);
|
||||
applyFns("proxyRes", proxyRes);
|
||||
applyFns("proxyReqWs", proxyResWs);
|
||||
/**
|
||||
* Handle Proxy errors
|
||||
*/
|
||||
proxy.on("error", function (err) {
|
||||
if (typeof opt.get("errHandler") === "function") {
|
||||
opt.get("errHandler").call(null, err);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Apply functions to proxy events
|
||||
* @param {string} name - the name of the http-proxy event
|
||||
* @param {Array} fns - functions to call on each event
|
||||
*/
|
||||
function applyFns(name, fns) {
|
||||
if (!List.isList(fns))
|
||||
fns = [fns];
|
||||
proxy.on(name, function () {
|
||||
var args = arguments;
|
||||
fns.forEach(function (fn) {
|
||||
if (typeof fn === "function") {
|
||||
fn.apply(null, args);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return browserSyncServer;
|
||||
};
|
||||
/**
|
||||
* @param resFns
|
||||
* @returns {*}
|
||||
*/
|
||||
function getProxyResFunctions(resFns, opt) {
|
||||
if (opt.getIn(["cookies", "stripDomain"])) {
|
||||
return resFns.push(proxyUtils.checkCookies);
|
||||
}
|
||||
return resFns;
|
||||
}
|
||||
/**
|
||||
* @param reqFns
|
||||
* @returns {*}
|
||||
*/
|
||||
function getProxyReqFunctions(reqFns, opt, bs) {
|
||||
var reqHeaders = opt.getIn(["reqHeaders"]);
|
||||
if (!reqHeaders) {
|
||||
return reqFns;
|
||||
}
|
||||
/**
|
||||
* Back-compat for old `reqHeaders` option here a
|
||||
* function was given that returned an object
|
||||
* where key:value was header-name:header-value
|
||||
* This didn't really work as it clobbered all other headers,
|
||||
* but it remains for the unlucky few who used it.
|
||||
*/
|
||||
if (typeof reqHeaders === "function") {
|
||||
var output = reqHeaders.call(bs, opt.toJS());
|
||||
if (Object.keys(output).length) {
|
||||
return reqFns.concat(function (proxyReq) {
|
||||
Object.keys(output).forEach(function (key) {
|
||||
proxyReq.setHeader(key, output[key]);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Now, if {key:value} given, set the each header
|
||||
*
|
||||
* eg: reqHeaders: {
|
||||
* 'is-dev': 'true'
|
||||
* }
|
||||
*/
|
||||
if (Map.isMap(reqHeaders)) {
|
||||
return reqFns.concat(function (proxyReq) {
|
||||
reqHeaders.forEach(function (value, key) {
|
||||
proxyReq.setHeader(key, value);
|
||||
});
|
||||
});
|
||||
}
|
||||
return reqFns;
|
||||
}
|
||||
//# sourceMappingURL=proxy-server.js.map
|
1
node_modules/browser-sync/dist/server/proxy-server.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/server/proxy-server.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"proxy-server.js","sourceRoot":"","sources":["../../lib/server/proxy-server.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,IAAI,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACtC,IAAI,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC/B,IAAI,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC1C,IAAI,SAAS,GAAG,OA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C,YAAY,CAAC,CAAC;KAC/C;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;IACzC,IAAI,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAE3C,IAAI,CAAC,UAAU,EAAE;QACb,OAAO,MAAM,CAAC;KACjB;IAED;;;;;;OAMG;IACH,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;QAClC,IAAI,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE;YAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,UAAS,QAAQ;gBAClC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAS,GAAG;oBACpC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACN;KACJ;IAED;;;;;;OAMG;IACH,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QACvB,OAAO,MAAM,CAAC,MAAM,CAAC,UAAS,QAAQ;YAClC,UAAU,CAAC,OAAO,CAAC,UAAS,KAAK,EAAE,GAAG;gBAClC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
134
node_modules/browser-sync/dist/server/proxy-utils.js
generated
vendored
Normal file
134
node_modules/browser-sync/dist/server/proxy-utils.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
var url = require("url");
|
||||
module.exports.rewriteLinks = function (userServer) {
|
||||
var host = userServer.hostname;
|
||||
var string = host;
|
||||
var port = userServer.port;
|
||||
if (host && port) {
|
||||
if (parseInt(port, 10) !== 80) {
|
||||
string = host + ":" + port;
|
||||
}
|
||||
}
|
||||
var reg = new RegExp(
|
||||
// a simple, but exact match
|
||||
"https?:\\\\/\\\\/" +
|
||||
string +
|
||||
"|" +
|
||||
// following ['"] + exact
|
||||
"('|\")\\/\\/" +
|
||||
string +
|
||||
"|" +
|
||||
// exact match with optional trailing slash
|
||||
"https?://" +
|
||||
string +
|
||||
"(?!:)(/)?" +
|
||||
"|" +
|
||||
// following ['"] + exact + possible multiple (imr srcset etc)
|
||||
"('|\")(https?://|/|\\.)?" +
|
||||
string +
|
||||
"(?!:)(/)?(.*?)(?=[ ,'\"\\s])", "g");
|
||||
return {
|
||||
match: reg,
|
||||
//match: new RegExp("https?:\\\\/\\\\/" + string + "|https?://" + string + "(\/)?|('|\")(https?://|/|\\.)?" + string + "(\/)?(.*?)(?=[ ,'\"\\s])", "g"),
|
||||
//match: new RegExp("https?:\\\\?/\\\\?/" + string + "(\/)?|('|\")(https?://|\\\\?/|\\.)?" + string + "(\/)?(.*?)(?=[ ,'\"\\s])", "g"),
|
||||
//match: new RegExp('https?://' + string + '(\/)?|(\'|")(https?://|/|\\.)?' + string + '(\/)?(.*?)(?=[ ,\'"\\s])', 'g'),
|
||||
//match: new RegExp("https?:\\\\/\\\\/" + string, "g"),
|
||||
fn: function (req, res, match) {
|
||||
var proxyUrl = req.headers["host"];
|
||||
/**
|
||||
* Reject subdomains
|
||||
*/
|
||||
if (match[0] === ".") {
|
||||
return match;
|
||||
}
|
||||
var captured = match[0] === "'" || match[0] === '"' ? match[0] : "";
|
||||
/**
|
||||
* allow http https
|
||||
* @type {string}
|
||||
*/
|
||||
var pre = "//";
|
||||
if (match[0] === "'" || match[0] === '"') {
|
||||
match = match.slice(1);
|
||||
}
|
||||
/**
|
||||
* parse the url
|
||||
* @type {number|*}
|
||||
*/
|
||||
var out = url.parse(match);
|
||||
/**
|
||||
* If host not set, just do a simple replace
|
||||
*/
|
||||
if (!out.host) {
|
||||
string = string.replace(/^(\/)/, "");
|
||||
return captured + match.replace(string, proxyUrl);
|
||||
}
|
||||
/**
|
||||
* Only add trailing slash if one was
|
||||
* present in the original match
|
||||
*/
|
||||
if (out.path === "/") {
|
||||
if (match.slice(-1) === "/") {
|
||||
out.path = "/";
|
||||
}
|
||||
else {
|
||||
out.path = "";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Finally append all of parsed url
|
||||
*/
|
||||
return [
|
||||
captured,
|
||||
pre,
|
||||
proxyUrl,
|
||||
out.path || "",
|
||||
out.hash || ""
|
||||
].join("");
|
||||
}
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Remove 'domain' from any cookies
|
||||
* @param {Object} res
|
||||
*/
|
||||
module.exports.checkCookies = function checkCookies(res) {
|
||||
if (typeof res.headers["set-cookie"] !== "undefined") {
|
||||
res.headers["set-cookie"] = res.headers["set-cookie"].map(function (item) {
|
||||
return rewriteCookies(item);
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Remove the domain from any cookies.
|
||||
* @param rawCookie
|
||||
* @returns {string}
|
||||
*/
|
||||
function rewriteCookies(rawCookie) {
|
||||
var objCookie = (function () {
|
||||
// simple parse function (does not remove quotes)
|
||||
var obj = {};
|
||||
var pairs = rawCookie.split(/; */);
|
||||
pairs.forEach(function (pair) {
|
||||
var eqIndex = pair.indexOf("=");
|
||||
// skip things that don't look like key=value
|
||||
if (eqIndex < 0) {
|
||||
return;
|
||||
}
|
||||
var key = pair.substr(0, eqIndex).trim();
|
||||
obj[key] = pair.substr(eqIndex + 1, pair.length).trim();
|
||||
});
|
||||
return obj;
|
||||
})();
|
||||
var pairs = Object.keys(objCookie)
|
||||
.filter(function (item) {
|
||||
return item.toLowerCase() !== "domain";
|
||||
})
|
||||
.map(function (key) {
|
||||
return key + "=" + objCookie[key];
|
||||
});
|
||||
if (rawCookie.match(/httponly/i)) {
|
||||
pairs.push("HttpOnly");
|
||||
}
|
||||
return pairs.join("; ");
|
||||
}
|
||||
module.exports.rewriteCookies = rewriteCookies;
|
||||
//# sourceMappingURL=proxy-utils.js.map
|
1
node_modules/browser-sync/dist/server/proxy-utils.js.map
generated
vendored
Normal file
1
node_modules/browser-sync/dist/server/proxy-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"proxy-utils.js","sourceRoot":"","sources":["../../lib/server/proxy-utils.js"],"names":[],"mappings":"AAAA,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzB,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,UAAS,UAAU;IAC7C,IAAI,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;IAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAE3B,IAAI,IAAI,IAAI,IAAI,EAAE;QACd,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3B,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;SAC9B;KACJ;IAED,IAAI,GAAG,GAAG,IAAI,MAAM;IAChB,4BAA4B;IAC5B,mBAAmB;QACf,MAAM;QACN,GAAG;QACH,yBAAyB;QACzB,cAAc;QACd,MAAM;QACN,GAAG;QACH,2CAA2C;QAC3C,WAAW;QACX,MAAM;QACN,WAAW;QACX,GAAG;QACH,8DAA8D;QAC9D,0BAA0B;QAC1B,MAAM;QACN,8BAA8B,EAClC,GAAG,CACN,CAAC;IAEF,OAAO;QACH,KAAK,EAAE,GAAG;QACV,wJAAwJ;QACxJ,uIAAuI;QACvI,wHAAwH;QACxH,uDAAuD;QACvD,EAAE,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,KAAK;YACxB,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YA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