nav tabs on admin dashboard
This commit is contained in:
152
node_modules/webpack-dev-server/lib/OptionsValidationError.js
generated
vendored
152
node_modules/webpack-dev-server/lib/OptionsValidationError.js
generated
vendored
@@ -1,152 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-param-reassign: 'off' */
|
||||
|
||||
const optionsSchema = require('./optionsSchema.json');
|
||||
|
||||
const indent = (str, prefix, firstLine) => {
|
||||
if (firstLine) {
|
||||
return prefix + str.replace(/\n(?!$)/g, `\n${prefix}`);
|
||||
}
|
||||
return str.replace(/\n(?!$)/g, `\n${prefix}`);
|
||||
};
|
||||
|
||||
const getSchemaPart = (path, parents, additionalPath) => {
|
||||
parents = parents || 0;
|
||||
path = path.split('/');
|
||||
path = path.slice(0, path.length - parents);
|
||||
if (additionalPath) {
|
||||
additionalPath = additionalPath.split('/');
|
||||
path = path.concat(additionalPath);
|
||||
}
|
||||
let schemaPart = optionsSchema;
|
||||
for (let i = 1; i < path.length; i++) {
|
||||
const inner = schemaPart[path[i]];
|
||||
if (inner) { schemaPart = inner; }
|
||||
}
|
||||
return schemaPart;
|
||||
};
|
||||
|
||||
const getSchemaPartText = (schemaPart, additionalPath) => {
|
||||
if (additionalPath) {
|
||||
for (let i = 0; i < additionalPath.length; i++) {
|
||||
const inner = schemaPart[additionalPath[i]];
|
||||
if (inner) { schemaPart = inner; }
|
||||
}
|
||||
}
|
||||
while (schemaPart.$ref) schemaPart = getSchemaPart(schemaPart.$ref);
|
||||
let schemaText = OptionsValidationError.formatSchema(schemaPart); // eslint-disable-line
|
||||
if (schemaPart.description) { schemaText += `\n${schemaPart.description}`; }
|
||||
return schemaText;
|
||||
};
|
||||
|
||||
class OptionsValidationError extends Error {
|
||||
constructor(validationErrors) {
|
||||
super();
|
||||
|
||||
if (Error.hasOwnProperty('captureStackTrace')) { // eslint-disable-line
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
this.name = 'WebpackDevServerOptionsValidationError';
|
||||
|
||||
this.message = `${'Invalid configuration object. ' +
|
||||
'webpack-dev-server has been initialised using a configuration object that does not match the API schema.\n'}${
|
||||
validationErrors.map(err => ` - ${indent(OptionsValidationError.formatValidationError(err), ' ', false)}`).join('\n')}`;
|
||||
this.validationErrors = validationErrors;
|
||||
}
|
||||
|
||||
static formatSchema(schema, prevSchemas) {
|
||||
prevSchemas = prevSchemas || [];
|
||||
|
||||
const formatInnerSchema = (innerSchema, addSelf) => {
|
||||
if (!addSelf) return OptionsValidationError.formatSchema(innerSchema, prevSchemas);
|
||||
if (prevSchemas.indexOf(innerSchema) >= 0) return '(recursive)';
|
||||
return OptionsValidationError.formatSchema(innerSchema, prevSchemas.concat(schema));
|
||||
};
|
||||
|
||||
if (schema.type === 'string') {
|
||||
if (schema.minLength === 1) { return 'non-empty string'; } else if (schema.minLength > 1) { return `string (min length ${schema.minLength})`; }
|
||||
return 'string';
|
||||
} else if (schema.type === 'boolean') {
|
||||
return 'boolean';
|
||||
} else if (schema.type === 'number') {
|
||||
return 'number';
|
||||
} else if (schema.type === 'object') {
|
||||
if (schema.properties) {
|
||||
const required = schema.required || [];
|
||||
return `object { ${Object.keys(schema.properties).map((property) => {
|
||||
if (required.indexOf(property) < 0) return `${property}?`;
|
||||
return property;
|
||||
}).concat(schema.additionalProperties ? ['...'] : []).join(', ')} }`;
|
||||
}
|
||||
if (schema.additionalProperties) {
|
||||
return `object { <key>: ${formatInnerSchema(schema.additionalProperties)} }`;
|
||||
}
|
||||
return 'object';
|
||||
} else if (schema.type === 'array') {
|
||||
return `[${formatInnerSchema(schema.items)}]`;
|
||||
}
|
||||
|
||||
switch (schema.instanceof) {
|
||||
case 'Function':
|
||||
return 'function';
|
||||
case 'RegExp':
|
||||
return 'RegExp';
|
||||
default:
|
||||
}
|
||||
|
||||
if (schema.$ref) return formatInnerSchema(getSchemaPart(schema.$ref), true);
|
||||
if (schema.allOf) return schema.allOf.map(formatInnerSchema).join(' & ');
|
||||
if (schema.oneOf) return schema.oneOf.map(formatInnerSchema).join(' | ');
|
||||
if (schema.anyOf) return schema.anyOf.map(formatInnerSchema).join(' | ');
|
||||
if (schema.enum) return schema.enum.map(item => JSON.stringify(item)).join(' | ');
|
||||
return JSON.stringify(schema, 0, 2);
|
||||
}
|
||||
|
||||
static formatValidationError(err) {
|
||||
const dataPath = `configuration${err.dataPath}`;
|
||||
if (err.keyword === 'additionalProperties') {
|
||||
return `${dataPath} has an unknown property '${err.params.additionalProperty}'. These properties are valid:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'oneOf' || err.keyword === 'anyOf') {
|
||||
if (err.children && err.children.length > 0) {
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}\n` +
|
||||
`Details:\n${err.children.map(e => ` * ${indent(OptionsValidationError.formatValidationError(e), ' ', false)}`).join('\n')}`;
|
||||
}
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'enum') {
|
||||
if (err.parentSchema && err.parentSchema.enum && err.parentSchema.enum.length === 1) {
|
||||
return `${dataPath} should be ${getSchemaPartText(err.parentSchema)}`;
|
||||
}
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'allOf') {
|
||||
return `${dataPath} should be:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'type') {
|
||||
switch (err.params.type) {
|
||||
case 'object':
|
||||
return `${dataPath} should be an object.`;
|
||||
case 'string':
|
||||
return `${dataPath} should be a string.`;
|
||||
case 'boolean':
|
||||
return `${dataPath} should be a boolean.`;
|
||||
case 'number':
|
||||
return `${dataPath} should be a number.`;
|
||||
case 'array':
|
||||
return `${dataPath} should be an array:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
default:
|
||||
}
|
||||
return `${dataPath} should be ${err.params.type}:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'instanceof') {
|
||||
return `${dataPath} should be an instance of ${getSchemaPartText(err.parentSchema)}.`;
|
||||
} else if (err.keyword === 'required') {
|
||||
const missingProperty = err.params.missingProperty.replace(/^\./, '');
|
||||
return `${dataPath} misses the property '${missingProperty}'.\n${getSchemaPartText(err.parentSchema, ['properties', missingProperty])}`;
|
||||
} else if (err.keyword === 'minLength' || err.keyword === 'minItems') {
|
||||
if (err.params.limit === 1) { return `${dataPath} should not be empty.`; }
|
||||
return `${dataPath} ${err.message}`;
|
||||
}
|
||||
// eslint-disable-line no-fallthrough
|
||||
return `${dataPath} ${err.message} (${JSON.stringify(err, 0, 2)}).\n${getSchemaPartText(err.parentSchema)}`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OptionsValidationError;
|
||||
1581
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
1581
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
File diff suppressed because it is too large
Load Diff
336
node_modules/webpack-dev-server/lib/optionsSchema.json
generated
vendored
336
node_modules/webpack-dev-server/lib/optionsSchema.json
generated
vendored
@@ -1,336 +0,0 @@
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"hot": {
|
||||
"description": "Enables Hot Module Replacement.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"hotOnly": {
|
||||
"description": "Enables Hot Module Replacement without page refresh as fallback.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"lazy": {
|
||||
"description": "Disables watch mode and recompiles bundle only on a request.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"bonjour": {
|
||||
"description": "Publishes the ZeroConf DNS service",
|
||||
"type": "boolean"
|
||||
},
|
||||
"host": {
|
||||
"description": "The host the server listens to.",
|
||||
"type": "string"
|
||||
},
|
||||
"allowedHosts": {
|
||||
"description": "Specifies which hosts are allowed to access the dev server.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"filename": {
|
||||
"description": "The filename that needs to be requested in order to trigger a recompile (only in lazy mode).",
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"publicPath": {
|
||||
"description": "URL path where the webpack files are served from.",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"description": "The port the server listens to.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"socket": {
|
||||
"description": "The Unix socket to listen to (instead of on a host).",
|
||||
"type": "string"
|
||||
},
|
||||
"watchOptions": {
|
||||
"description": "Options for changing the watch behavior.",
|
||||
"type": "object"
|
||||
},
|
||||
"headers": {
|
||||
"description": "Response headers that are added to each response.",
|
||||
"type": "object"
|
||||
},
|
||||
"clientLogLevel": {
|
||||
"description": "Controls the log messages shown in the browser.",
|
||||
"enum": [
|
||||
"none",
|
||||
"info",
|
||||
"warning",
|
||||
"error"
|
||||
]
|
||||
},
|
||||
"overlay": {
|
||||
"description": "Shows an error overlay in browser.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errors": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"warnings": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"progress": {
|
||||
"description": "Shows compilation progress in browser console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"key": {
|
||||
"description": "The contents of a SSL key.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert": {
|
||||
"description": "The contents of a SSL certificate.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ca": {
|
||||
"description": "The contents of a SSL CA certificate.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfx": {
|
||||
"description": "The contents of a SSL pfx file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfxPassphrase": {
|
||||
"description": "The passphrase to a (SSL) PFX file.",
|
||||
"type": "string"
|
||||
},
|
||||
"requestCert": {
|
||||
"description": "Enables request for client certificate. This is passed directly to the https server.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"inline": {
|
||||
"description": "Enable inline mode to include client scripts in bundle (CLI-only).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableHostCheck": {
|
||||
"description": "Disable the Host header check (Security).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"public": {
|
||||
"description": "The public hostname/ip address of the server.",
|
||||
"type": "string"
|
||||
},
|
||||
"https": {
|
||||
"description": "Enable HTTPS for server.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contentBase": {
|
||||
"description": "A directory to serve files non-webpack files from.",
|
||||
"anyOf": [
|
||||
{
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
false
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"watchContentBase": {
|
||||
"description": "Watches the contentBase directory for changes.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"open": {
|
||||
"description": "Let the CLI open your browser with the URL.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"useLocalIp": {
|
||||
"description": "Let the browser open with your local IP.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"openPage": {
|
||||
"description": "Let the CLI open your browser to a specific page on the site.",
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"description": "The order of which the features will be triggered.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"compress": {
|
||||
"description": "Gzip compression for all requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"proxy": {
|
||||
"description": "Proxy requests to another server.",
|
||||
"anyOf": [
|
||||
{
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"historyApiFallback": {
|
||||
"description": "404 fallback to a specified file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"staticOptions": {
|
||||
"description": "Options for static files served with contentBase.",
|
||||
"type": "object"
|
||||
},
|
||||
"setup": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"before": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes before webpack-dev-middleware will be added.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"after": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes after webpack-dev-middleware got added.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"stats": {
|
||||
"description": "Decides what bundle information is displayed.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"none",
|
||||
"errors-only",
|
||||
"minimal",
|
||||
"normal",
|
||||
"verbose"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"reporter": {
|
||||
"description": "Customize what the console displays when compiling.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"reportTime": {
|
||||
"description": "Report time before and after compiling in console displays.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"noInfo": {
|
||||
"description": "Hide all info messages on console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"quiet": {
|
||||
"description": "Hide all messages on console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"serverSideRender": {
|
||||
"description": "Expose stats for server side rendering (experimental).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"index": {
|
||||
"description": "The filename that is considered the index file.",
|
||||
"type": "string"
|
||||
},
|
||||
"log": {
|
||||
"description": "Customize info logs for webpack-dev-middleware.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"warn": {
|
||||
"description": "Customize warn logs for webpack-dev-middleware.",
|
||||
"instanceof": "Function"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
8
node_modules/webpack-dev-server/lib/polyfills.js
generated
vendored
8
node_modules/webpack-dev-server/lib/polyfills.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* polyfills for Node 4.8.x users */
|
||||
|
||||
// internal-ip@2.x uses [].includes
|
||||
const includes = require('array-includes');
|
||||
|
||||
includes.shim();
|
||||
40
node_modules/webpack-dev-server/lib/util/addDevServerEntrypoints.js
generated
vendored
40
node_modules/webpack-dev-server/lib/util/addDevServerEntrypoints.js
generated
vendored
@@ -1,40 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-param-reassign: 'off' */
|
||||
|
||||
const createDomain = require('./createDomain');
|
||||
|
||||
module.exports = function addDevServerEntrypoints(webpackOptions, devServerOptions, listeningApp) {
|
||||
if (devServerOptions.inline !== false) {
|
||||
// we're stubbing the app in this method as it's static and doesn't require
|
||||
// a listeningApp to be supplied. createDomain requires an app with the
|
||||
// address() signature.
|
||||
const app = listeningApp || {
|
||||
address() {
|
||||
return { port: devServerOptions.port };
|
||||
}
|
||||
};
|
||||
const domain = createDomain(devServerOptions, app);
|
||||
const devClient = [`${require.resolve('../../client/')}?${domain}`];
|
||||
|
||||
if (devServerOptions.hotOnly) { devClient.push('webpack/hot/only-dev-server'); } else if (devServerOptions.hot) { devClient.push('webpack/hot/dev-server'); }
|
||||
|
||||
const prependDevClient = (entry) => {
|
||||
if (typeof entry === 'function') {
|
||||
return () => Promise.resolve(entry()).then(prependDevClient);
|
||||
}
|
||||
if (typeof entry === 'object' && !Array.isArray(entry)) {
|
||||
const entryClone = {};
|
||||
Object.keys(entry).forEach((key) => {
|
||||
entryClone[key] = devClient.concat(entry[key]);
|
||||
});
|
||||
return entryClone;
|
||||
}
|
||||
return devClient.concat(entry);
|
||||
};
|
||||
|
||||
[].concat(webpackOptions).forEach((wpOpt) => {
|
||||
wpOpt.entry = prependDevClient(wpOpt.entry);
|
||||
});
|
||||
}
|
||||
};
|
||||
23
node_modules/webpack-dev-server/lib/util/createDomain.js
generated
vendored
23
node_modules/webpack-dev-server/lib/util/createDomain.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const url = require('url');
|
||||
const internalIp = require('internal-ip');
|
||||
|
||||
|
||||
module.exports = function createDomain(options, listeningApp) {
|
||||
const protocol = options.https ? 'https' : 'http';
|
||||
const appPort = listeningApp ? listeningApp.address().port : 0;
|
||||
const port = options.socket ? 0 : appPort;
|
||||
const hostname = options.useLocalIp ? internalIp.v4() : options.host;
|
||||
|
||||
// use explicitly defined public url (prefix with protocol if not explicitly given)
|
||||
if (options.public) {
|
||||
return /^[a-zA-Z]+:\/\//.test(options.public) ? `${options.public}` : `${protocol}://${options.public}`;
|
||||
}
|
||||
// the formatted domain (url without path) of the webpack server
|
||||
return url.format({
|
||||
protocol,
|
||||
hostname,
|
||||
port
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user