0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

195
web/node_modules/webpack-dev-server/bin/cli-flags.js generated vendored Normal file
View file

@ -0,0 +1,195 @@
'use strict';
const ADVANCED_GROUP = 'Advanced options:';
const DISPLAY_GROUP = 'Stats options:';
const SSL_GROUP = 'SSL options:';
const CONNECTION_GROUP = 'Connection options:';
const RESPONSE_GROUP = 'Response options:';
const BASIC_GROUP = 'Basic options:';
module.exports = {
devServer: [
{
name: 'bonjour',
type: Boolean,
describe: 'Broadcasts the server via ZeroConf networking on start',
},
{
name: 'lazy',
type: Boolean,
describe: 'Lazy',
},
{
name: 'liveReload',
type: Boolean,
defaultValue: true,
describe: 'Enables/Disables live reloading on changing files',
},
{
name: 'serveIndex',
type: Boolean,
describe: 'Enables/Disables serveIndex middleware',
defaultValue: true,
},
{
name: 'inline',
type: Boolean,
defaultValue: true,
describe:
'Inline mode (set to false to disable including client scripts like livereload)',
},
{
name: 'profile',
type: Boolean,
describe: 'Print compilation profile data for progress steps',
},
{
name: 'progress',
type: Boolean,
describe: 'Print compilation progress in percentage',
group: BASIC_GROUP,
},
{
name: 'hot-only',
type: Boolean,
describe: 'Do not refresh page if HMR fails',
group: ADVANCED_GROUP,
},
{
name: 'stdin',
type: Boolean,
describe: 'close when stdin ends',
},
{
name: 'open',
type: [String, Boolean],
describe:
'Open the default browser, or optionally specify a browser name',
},
{
name: 'useLocalIp',
type: Boolean,
describe: 'Open default browser with local IP',
},
{
name: 'open-page',
type: String,
describe: 'Open default browser with the specified page',
},
{
name: 'client-log-level',
type: String,
group: DISPLAY_GROUP,
defaultValue: 'info',
describe:
'Log level in the browser (trace, debug, info, warn, error or silent)',
},
{
name: 'https',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTPS',
},
{
name: 'http2',
type: Boolean,
group: SSL_GROUP,
describe: 'HTTP/2, must be used with HTTPS',
},
{
name: 'key',
type: String,
describe: 'Path to a SSL key.',
group: SSL_GROUP,
},
{
name: 'cert',
type: String,
describe: 'Path to a SSL certificate.',
group: SSL_GROUP,
},
{
name: 'cacert',
type: String,
describe: 'Path to a SSL CA certificate.',
group: SSL_GROUP,
},
{
name: 'pfx',
type: String,
describe: 'Path to a SSL pfx file.',
group: SSL_GROUP,
},
{
name: 'pfx-passphrase',
type: String,
describe: 'Passphrase for pfx file.',
group: SSL_GROUP,
},
{
name: 'content-base',
type: String,
describe: 'A directory or URL to serve HTML content from.',
group: RESPONSE_GROUP,
},
{
name: 'watch-content-base',
type: Boolean,
describe: 'Enable live-reloading of the content-base.',
group: RESPONSE_GROUP,
},
{
name: 'history-api-fallback',
type: Boolean,
describe: 'Fallback to /index.html for Single Page Applications.',
group: RESPONSE_GROUP,
},
{
name: 'compress',
type: Boolean,
describe: 'Enable gzip compression',
group: RESPONSE_GROUP,
},
// findPort is currently not set up
{
name: 'port',
type: Number,
describe: 'The port',
group: CONNECTION_GROUP,
},
{
name: 'disable-host-check',
type: Boolean,
describe: 'Will not check the host',
group: CONNECTION_GROUP,
},
{
name: 'socket',
type: String,
describe: 'Socket to listen',
group: CONNECTION_GROUP,
},
{
name: 'public',
type: String,
describe: 'The public hostname/ip address of the server',
group: CONNECTION_GROUP,
},
{
name: 'host',
type: String,
describe: 'The hostname/ip address the server will bind to',
group: CONNECTION_GROUP,
},
// use command-line-args "multiple" option, allowing the usage: --allowed-hosts host1 host2 host3
// instead of the old, comma-separated syntax: --allowed-hosts host1,host2,host3
{
name: 'allowed-hosts',
type: String,
describe:
'A list of hosts that are allowed to access the dev server, separated by spaces',
group: CONNECTION_GROUP,
multiple: true,
},
],
};

187
web/node_modules/webpack-dev-server/bin/options.js generated vendored Normal file
View file

@ -0,0 +1,187 @@
'use strict';
/* eslint-disable
multiline-ternary,
space-before-function-paren
*/
const ADVANCED_GROUP = 'Advanced options:';
const DISPLAY_GROUP = 'Stats options:';
const SSL_GROUP = 'SSL options:';
const CONNECTION_GROUP = 'Connection options:';
const RESPONSE_GROUP = 'Response options:';
const BASIC_GROUP = 'Basic options:';
const options = {
bonjour: {
type: 'boolean',
describe: 'Broadcasts the server via ZeroConf networking on start',
},
lazy: {
type: 'boolean',
describe: 'Lazy',
},
liveReload: {
type: 'boolean',
describe: 'Enables/Disables live reloading on changing files',
default: true,
},
serveIndex: {
type: 'boolean',
describe: 'Enables/Disables serveIndex middleware',
default: true,
},
inline: {
type: 'boolean',
default: true,
describe:
'Inline mode (set to false to disable including client scripts like livereload)',
},
profile: {
type: 'boolean',
describe: 'Print compilation profile data for progress steps',
},
progress: {
type: 'boolean',
describe: 'Print compilation progress in percentage',
group: BASIC_GROUP,
},
'hot-only': {
type: 'boolean',
describe: 'Do not refresh page if HMR fails',
group: ADVANCED_GROUP,
},
stdin: {
type: 'boolean',
describe: 'close when stdin ends',
},
open: {
type: 'string',
describe: 'Open the default browser, or optionally specify a browser name',
},
useLocalIp: {
type: 'boolean',
describe: 'Open default browser with local IP',
},
'open-page': {
type: 'string',
describe: 'Open default browser with the specified page',
requiresArg: true,
},
color: {
type: 'boolean',
alias: 'colors',
default: function supportsColor() {
// Use `require('supports-color').stdout` for supports-color >= 5.0.0.
// See https://github.com/webpack/webpack-dev-server/pull/1555.
return require('supports-color').stdout;
},
group: DISPLAY_GROUP,
describe: 'Enables/Disables colors on the console',
},
info: {
type: 'boolean',
group: DISPLAY_GROUP,
default: true,
describe: 'Info',
},
quiet: {
type: 'boolean',
group: DISPLAY_GROUP,
describe: 'Quiet',
},
'client-log-level': {
type: 'string',
group: DISPLAY_GROUP,
default: 'info',
describe:
'Log level in the browser (trace, debug, info, warn, error or silent)',
},
https: {
type: 'boolean',
group: SSL_GROUP,
describe: 'HTTPS',
},
http2: {
type: 'boolean',
group: SSL_GROUP,
describe: 'HTTP/2, must be used with HTTPS',
},
key: {
type: 'string',
describe: 'Path to a SSL key.',
group: SSL_GROUP,
},
cert: {
type: 'string',
describe: 'Path to a SSL certificate.',
group: SSL_GROUP,
},
cacert: {
type: 'string',
describe: 'Path to a SSL CA certificate.',
group: SSL_GROUP,
},
pfx: {
type: 'string',
describe: 'Path to a SSL pfx file.',
group: SSL_GROUP,
},
'pfx-passphrase': {
type: 'string',
describe: 'Passphrase for pfx file.',
group: SSL_GROUP,
},
'content-base': {
type: 'string',
describe: 'A directory or URL to serve HTML content from.',
group: RESPONSE_GROUP,
},
'watch-content-base': {
type: 'boolean',
describe: 'Enable live-reloading of the content-base.',
group: RESPONSE_GROUP,
},
'history-api-fallback': {
type: 'boolean',
describe: 'Fallback to /index.html for Single Page Applications.',
group: RESPONSE_GROUP,
},
compress: {
type: 'boolean',
describe: 'Enable gzip compression',
group: RESPONSE_GROUP,
},
port: {
describe: 'The port',
group: CONNECTION_GROUP,
},
'disable-host-check': {
type: 'boolean',
describe: 'Will not check the host',
group: CONNECTION_GROUP,
},
socket: {
type: 'String',
describe: 'Socket to listen',
group: CONNECTION_GROUP,
},
public: {
type: 'string',
describe: 'The public hostname/ip address of the server',
group: CONNECTION_GROUP,
},
host: {
type: 'string',
default: 'localhost',
describe: 'The hostname/ip address the server will bind to',
group: CONNECTION_GROUP,
},
'allowed-hosts': {
type: 'string',
describe:
'A comma-delimited string of hosts that are allowed to access the dev server',
group: CONNECTION_GROUP,
},
};
module.exports = options;

167
web/node_modules/webpack-dev-server/bin/webpack-dev-server.js generated vendored Executable file
View file

@ -0,0 +1,167 @@
#!/usr/bin/env node
'use strict';
/* eslint-disable no-shadow, no-console */
const fs = require('fs');
const net = require('net');
const debug = require('debug')('webpack-dev-server');
const importLocal = require('import-local');
const yargs = require('yargs');
const webpack = require('webpack');
const Server = require('../lib/Server');
const setupExitSignals = require('../lib/utils/setupExitSignals');
const colors = require('../lib/utils/colors');
const processOptions = require('../lib/utils/processOptions');
const createLogger = require('../lib/utils/createLogger');
const getVersions = require('../lib/utils/getVersions');
const options = require('./options');
let server;
const serverData = {
server: null,
};
// we must pass an object that contains the server object as a property so that
// we can update this server property later, and setupExitSignals will be able to
// recognize that the server has been instantiated, because we will set
// serverData.server to the new server object.
setupExitSignals(serverData);
// Prefer the local installation of webpack-dev-server
if (importLocal(__filename)) {
debug('Using local install of webpack-dev-server');
return;
}
try {
require.resolve('webpack-cli');
} catch (err) {
console.error('The CLI moved into a separate package: webpack-cli');
console.error(
"Please install 'webpack-cli' in addition to webpack itself to use the CLI"
);
console.error('-> When using npm: npm i -D webpack-cli');
console.error('-> When using yarn: yarn add -D webpack-cli');
process.exitCode = 1;
}
yargs.usage(
`${getVersions()}\nUsage: https://webpack.js.org/configuration/dev-server/`
);
// webpack-cli@3.3 path : 'webpack-cli/bin/config/config-yargs'
let configYargsPath;
try {
require.resolve('webpack-cli/bin/config/config-yargs');
configYargsPath = 'webpack-cli/bin/config/config-yargs';
} catch (e) {
configYargsPath = 'webpack-cli/bin/config-yargs';
}
// eslint-disable-next-line import/no-extraneous-dependencies
// eslint-disable-next-line import/no-dynamic-require
require(configYargsPath)(yargs);
// It is important that this is done after the webpack yargs config,
// so it overrides webpack's version info.
yargs.version(getVersions());
yargs.options(options);
const argv = yargs.argv;
// webpack-cli@3.3 path : 'webpack-cli/bin/utils/convert-argv'
let convertArgvPath;
try {
require.resolve('webpack-cli/bin/utils/convert-argv');
convertArgvPath = 'webpack-cli/bin/utils/convert-argv';
} catch (e) {
convertArgvPath = 'webpack-cli/bin/convert-argv';
}
// eslint-disable-next-line import/no-extraneous-dependencies
// eslint-disable-next-line import/no-dynamic-require
const config = require(convertArgvPath)(yargs, argv, {
outputFilename: '/bundle.js',
});
function startDevServer(config, options) {
const log = createLogger(options);
let compiler;
try {
compiler = webpack(config);
} catch (err) {
if (err instanceof webpack.WebpackOptionsValidationError) {
log.error(colors.error(options.stats.colors, err.message));
// eslint-disable-next-line no-process-exit
process.exit(1);
}
throw err;
}
try {
server = new Server(compiler, options, log);
serverData.server = server;
} catch (err) {
if (err.name === 'ValidationError') {
log.error(colors.error(options.stats.colors, err.message));
// eslint-disable-next-line no-process-exit
process.exit(1);
}
throw err;
}
if (options.socket) {
server.listeningApp.on('error', (e) => {
if (e.code === 'EADDRINUSE') {
const clientSocket = new net.Socket();
clientSocket.on('error', (err) => {
if (err.code === 'ECONNREFUSED') {
// No other server listening on this socket so it can be safely removed
fs.unlinkSync(options.socket);
server.listen(options.socket, options.host, (error) => {
if (error) {
throw error;
}
});
}
});
clientSocket.connect({ path: options.socket }, () => {
throw new Error('This socket is already used');
});
}
});
server.listen(options.socket, options.host, (err) => {
if (err) {
throw err;
}
// chmod 666 (rw rw rw)
const READ_WRITE = 438;
fs.chmod(options.socket, READ_WRITE, (err) => {
if (err) {
throw err;
}
});
});
} else {
server.listen(options.port, options.host, (err) => {
if (err) {
throw err;
}
});
}
}
processOptions(config, argv, (config, options) => {
startDevServer(config, options);
});