mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
21
webGl/my-threejs-test/node_modules/parcel/LICENSE
generated
vendored
Normal file
21
webGl/my-threejs-test/node_modules/parcel/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-present Devon Govett
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
66
webGl/my-threejs-test/node_modules/parcel/README.md
generated
vendored
Normal file
66
webGl/my-threejs-test/node_modules/parcel/README.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<p align="center">
|
||||
<a href="https://parceljs.org/" target="_blank">
|
||||
<img alt="Parcel" src="https://user-images.githubusercontent.com/19409/135924939-03845d0b-e7bb-414b-89b6-e627dfa9f614.png" width="749">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](#backers) [](#sponsors)
|
||||
[](https://dev.azure.com/devongovett/devongovett/_build/latest?definitionId=1)
|
||||
[](https://www.npmjs.com/package/parcel)
|
||||
[](https://www.npmjs.com/package/parcel)
|
||||
[](https://discord.gg/XSCzqGRuvr)
|
||||
[](https://twitter.com/parceljs)
|
||||
|
||||
Parcel is a zero configuration build tool for the web. It combines a great out-of-the-box development experience with a scalable architecture that can take your project from just getting started to massive production application.
|
||||
|
||||
## Features
|
||||
|
||||
- 😍 **Zero config** – Parcel supports many languages and file types out of the box, from web technologies like HTML, CSS, and JavaScript, to assets like images, fonts, videos, and more. It has a built-in dev server with hot reloading, beautiful error diagnostics, and much more. No configuration needed!
|
||||
- ⚡️ **Lightning fast** – Parcel's JavaScript compiler is written in Rust for native performance. Your code is built in parallel using worker threads, utilizing all of the cores on your machine. Everything is cached, so you never build the same code twice. It's like using watch mode, but even when you restart Parcel!
|
||||
- 🚀 **Automatic production optimization** – Parcel optimizes your whole app for production automatically. This includes tree-shaking and minifying your JavaScript, CSS, and HTML, resizing and optimizing images, content hashing, automatic code splitting, and much more.
|
||||
- 🎯 **Ship for any target** – Parcel automatically transforms your code for your target environments. From modern and legacy browser support, to zero config JSX and TypeScript compilation, Parcel makes it easy to build for any target – or many!
|
||||
- 🌍 **Scalable** – Parcel requires zero configuration to get started. But as your application grows and your build requirements become more complex, it's possible to extend Parcel in just about every way. A simple configuration format and powerful plugin system that's designed from the ground up for performance means Parcel can support projects of any size.
|
||||
|
||||
## Getting Started
|
||||
|
||||
See the following guides in our documentation on how to get started with Parcel.
|
||||
|
||||
* [Building a webapp with Parcel](https://parceljs.org/getting-started/webapp/)
|
||||
* [Building a library with Parcel](https://parceljs.org/getting-started/library/)
|
||||
* [Migrating from Parcel v1](https://parceljs.org/getting-started/migration/)
|
||||
|
||||
## Documentation
|
||||
|
||||
Read the docs at https://parceljs.org/docs/.
|
||||
|
||||
## Community
|
||||
|
||||
- ❓ Ask questions on [GitHub Discussions](https://github.com/parcel-bundler/parcel/discussions).
|
||||
- 💬 Join the community on [Discord](https://discord.gg/XSCzqGRuvr).
|
||||
- 📣 Stay up to date on new features and announcements on [Twitter](https://twitter.com/parceljs).
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute]](CONTRIBUTING.md).
|
||||
<a href="https://github.com/parcel-bundler/parcel/graphs/contributors"><img src="https://opencollective.com/parcel/contributors.svg?width=890" title="contributors" alt="contributors" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/parcel#backer)]
|
||||
|
||||
<a href="https://opencollective.com/parcel#backers" target="_blank"><img src="https://opencollective.com/parcel/backers.svg?width=890"></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/parcel#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/parcel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/parcel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/parcel/sponsor/9/avatar.svg"></a>
|
4
webGl/my-threejs-test/node_modules/parcel/lib/bin.js
generated
vendored
Normal file
4
webGl/my-threejs-test/node_modules/parcel/lib/bin.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('./cli');
|
462
webGl/my-threejs-test/node_modules/parcel/lib/cli.js
generated
vendored
Normal file
462
webGl/my-threejs-test/node_modules/parcel/lib/cli.js
generated
vendored
Normal file
@@ -0,0 +1,462 @@
|
||||
"use strict";
|
||||
|
||||
function _core() {
|
||||
const data = require("@parcel/core");
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _fs() {
|
||||
const data = require("@parcel/fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _diagnostic() {
|
||||
const data = _interopRequireDefault(require("@parcel/diagnostic"));
|
||||
_diagnostic = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _utils() {
|
||||
const data = require("@parcel/utils");
|
||||
_utils = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _events() {
|
||||
const data = require("@parcel/events");
|
||||
_events = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _logger() {
|
||||
const data = require("@parcel/logger");
|
||||
_logger = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _commander() {
|
||||
const data = _interopRequireDefault(require("commander"));
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _getPort() {
|
||||
const data = _interopRequireDefault(require("get-port"));
|
||||
_getPort = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _package = require("../package.json");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
const program = new (_commander().default.Command)();
|
||||
|
||||
// Exit codes in response to signals are traditionally
|
||||
// 128 + signal value
|
||||
// https://tldp.org/LDP/abs/html/exitcodes.html
|
||||
const SIGINT_EXIT_CODE = 130;
|
||||
async function logUncaughtError(e) {
|
||||
if (e instanceof _diagnostic().default) {
|
||||
for (let diagnostic of e.diagnostics) {
|
||||
let {
|
||||
message,
|
||||
codeframe,
|
||||
stack,
|
||||
hints,
|
||||
documentation
|
||||
} = await (0, _utils().prettyDiagnostic)(diagnostic);
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.red(message));
|
||||
if (codeframe || stack) {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error('');
|
||||
}
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(codeframe);
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(stack);
|
||||
if ((stack || codeframe) && hints.length > 0) {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error('');
|
||||
}
|
||||
for (let h of hints) {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.blue(h));
|
||||
}
|
||||
if (documentation) {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.magenta.bold(documentation));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error(e);
|
||||
}
|
||||
|
||||
// A hack to definitely ensure we logged the uncaught exception
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
const handleUncaughtException = async exception => {
|
||||
try {
|
||||
await logUncaughtError(exception);
|
||||
} catch (err) {
|
||||
console.error(exception);
|
||||
console.error(err);
|
||||
}
|
||||
process.exit(1);
|
||||
};
|
||||
process.on('unhandledRejection', handleUncaughtException);
|
||||
program.storeOptionsAsProperties();
|
||||
program.version(_package.version);
|
||||
|
||||
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
|
||||
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
|
||||
|
||||
const commonOptions = {
|
||||
'--no-cache': 'disable the filesystem cache',
|
||||
'--config <path>': 'specify which config to use. can be a path or a package name',
|
||||
'--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
|
||||
'--watch-dir <path>': 'set the root watch directory. defaults to nearest lockfile or source control dir.',
|
||||
'--no-source-maps': 'disable sourcemaps',
|
||||
'--target [name]': ['only build given target(s)', (val, list) => list.concat([val]), []],
|
||||
'--log-level <level>': new (_commander().default.Option)('--log-level <level>', 'set the log level').choices(['none', 'error', 'warn', 'info', 'verbose']),
|
||||
'--dist-dir <dir>': 'output directory to write to when unspecified by targets',
|
||||
'--no-autoinstall': 'disable autoinstall',
|
||||
'--profile': 'enable sampling build profiling',
|
||||
'--trace': 'enable build tracing',
|
||||
'-V, --version': 'output the version number',
|
||||
'--detailed-report [count]': ['print the asset timings and sizes in the build report', parseOptionInt],
|
||||
'--reporter <name>': ['additional reporters to run', (val, acc) => {
|
||||
acc.push(val);
|
||||
return acc;
|
||||
}, []]
|
||||
};
|
||||
var hmrOptions = {
|
||||
'--no-hmr': 'disable hot module replacement',
|
||||
'-p, --port <port>': ['set the port to serve on. defaults to $PORT or 1234', process.env.PORT],
|
||||
'--host <host>': 'set the host to listen on, defaults to listening on all interfaces',
|
||||
'--https': 'serves files over HTTPS',
|
||||
'--cert <path>': 'path to certificate to use with HTTPS',
|
||||
'--key <path>': 'path to private key to use with HTTPS',
|
||||
'--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT],
|
||||
'--hmr-host <host>': ['hot module replacement host', process.env.HMR_HOST]
|
||||
};
|
||||
function applyOptions(cmd, options) {
|
||||
for (let opt in options) {
|
||||
const option = options[opt];
|
||||
if (option instanceof _commander().default.Option) {
|
||||
cmd.addOption(option);
|
||||
} else {
|
||||
cmd.option(opt, ...(Array.isArray(option) ? option : [option]));
|
||||
}
|
||||
}
|
||||
}
|
||||
let serve = program.command('serve [input...]').description('starts a development server').option('--public-url <url>', 'the path prefix for absolute urls').option('--open [browser]', 'automatically open in specified browser, defaults to default browser').option('--watch-for-stdin', 'exit when stdin closes').option('--lazy [includes]', 'Build async bundles on demand, when requested in the browser. Defaults to all async bundles, unless a comma separated list of source file globs is provided. Only async bundles whose entry points match these globs will be built lazily').option('--lazy-exclude <excludes>', 'Can only be used in combination with --lazy. Comma separated list of source file globs, async bundles whose entry points match these globs will not be built lazily').action(runCommand);
|
||||
applyOptions(serve, hmrOptions);
|
||||
applyOptions(serve, commonOptions);
|
||||
let watch = program.command('watch [input...]').description('starts the bundler in watch mode').option('--public-url <url>', 'the path prefix for absolute urls').option('--no-content-hash', 'disable content hashing').option('--watch-for-stdin', 'exit when stdin closes').action(runCommand);
|
||||
applyOptions(watch, hmrOptions);
|
||||
applyOptions(watch, commonOptions);
|
||||
let build = program.command('build [input...]').description('bundles for production').option('--no-optimize', 'disable minification').option('--no-scope-hoist', 'disable scope-hoisting').option('--public-url <url>', 'the path prefix for absolute urls').option('--no-content-hash', 'disable content hashing').action(runCommand);
|
||||
applyOptions(build, commonOptions);
|
||||
program.command('help [command]').description('display help information for a command').action(function (command) {
|
||||
let cmd = program.commands.find(c => c.name() === command) || program;
|
||||
cmd.help();
|
||||
});
|
||||
program.on('--help', function () {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.log('');
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.log(' Run `' + _chalk().default.bold('parcel help <command>') + '` for more information on specific commands');
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.log('');
|
||||
});
|
||||
|
||||
// Override to output option description if argument was missing
|
||||
// $FlowFixMe[prop-missing]
|
||||
_commander().default.Command.prototype.optionMissingArgument = function (option) {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.error("error: option `%s' argument missing", option.flags);
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.log(program.createHelp().optionDescription(option));
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// Make serve the default command except for --help
|
||||
var args = process.argv;
|
||||
if (args[2] === '--help' || args[2] === '-h') args[2] = 'help';
|
||||
if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
|
||||
args.splice(2, 0, 'serve');
|
||||
}
|
||||
program.parse(args);
|
||||
function runCommand(...args) {
|
||||
run(...args).catch(handleUncaughtException);
|
||||
}
|
||||
async function run(entries, _opts,
|
||||
// using pre v7 Commander options as properties
|
||||
command) {
|
||||
if (entries.length === 0) {
|
||||
entries = ['.'];
|
||||
}
|
||||
entries = entries.map(entry => _path().default.resolve(entry));
|
||||
let Parcel = require('@parcel/core').default;
|
||||
let fs = new (_fs().NodeFS)();
|
||||
let options = await normalizeOptions(command, fs);
|
||||
let parcel = new Parcel({
|
||||
entries,
|
||||
defaultConfig: require.resolve('@parcel/config-default', {
|
||||
paths: [fs.cwd(), __dirname]
|
||||
}),
|
||||
shouldPatchConsole: false,
|
||||
...options
|
||||
});
|
||||
let disposable = new (_events().Disposable)();
|
||||
let unsubscribe;
|
||||
let isExiting;
|
||||
async function exit(exitCode = 0) {
|
||||
if (isExiting) {
|
||||
return;
|
||||
}
|
||||
isExiting = true;
|
||||
if (unsubscribe != null) {
|
||||
await unsubscribe();
|
||||
} else if (parcel.isProfiling) {
|
||||
await parcel.stopProfiling();
|
||||
}
|
||||
if (process.stdin.isTTY && process.stdin.isRaw) {
|
||||
// $FlowFixMe
|
||||
process.stdin.setRawMode(false);
|
||||
}
|
||||
disposable.dispose();
|
||||
process.exit(exitCode);
|
||||
}
|
||||
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
||||
if (process.stdin.isTTY) {
|
||||
// $FlowFixMe
|
||||
process.stdin.setRawMode(true);
|
||||
require('readline').emitKeypressEvents(process.stdin);
|
||||
let stream = process.stdin.on('keypress', async (char, key) => {
|
||||
if (!key.ctrl) {
|
||||
return;
|
||||
}
|
||||
switch (key.name) {
|
||||
case 'c':
|
||||
// Detect the ctrl+c key, and gracefully exit after writing the asset graph to the cache.
|
||||
// This is mostly for tools that wrap Parcel as a child process like yarn and npm.
|
||||
//
|
||||
// Setting raw mode prevents SIGINT from being sent in response to ctrl-c:
|
||||
// https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode
|
||||
//
|
||||
// We don't use the SIGINT event for this because when run inside yarn, the parent
|
||||
// yarn process ends before Parcel and it appears that Parcel has ended while it may still
|
||||
// be cleaning up. Handling events from stdin prevents this impression.
|
||||
//
|
||||
// When watching, a 0 success code is acceptable when Parcel is interrupted with ctrl-c.
|
||||
// When building, fail with a code as if we received a SIGINT.
|
||||
await exit(isWatching ? 0 : SIGINT_EXIT_CODE);
|
||||
break;
|
||||
case 'e':
|
||||
await (parcel.isProfiling ? parcel.stopProfiling() : parcel.startProfiling());
|
||||
break;
|
||||
case 'y':
|
||||
await parcel.takeHeapSnapshot();
|
||||
break;
|
||||
}
|
||||
});
|
||||
disposable.add(() => {
|
||||
stream.destroy();
|
||||
});
|
||||
}
|
||||
if (isWatching) {
|
||||
({
|
||||
unsubscribe
|
||||
} = await parcel.watch(err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
}));
|
||||
if (command.open && options.serveOptions) {
|
||||
await (0, _utils().openInBrowser)(`${options.serveOptions.https ? 'https' : 'http'}://${options.serveOptions.host || 'localhost'}:${options.serveOptions.port}`, command.open);
|
||||
}
|
||||
if (command.watchForStdin) {
|
||||
process.stdin.on('end', async () => {
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.log('STDIN closed, ending');
|
||||
await exit();
|
||||
});
|
||||
process.stdin.resume();
|
||||
}
|
||||
|
||||
// In non-tty cases, respond to SIGINT by cleaning up. Since we're watching,
|
||||
// a 0 success code is acceptable.
|
||||
process.on('SIGINT', () => exit());
|
||||
process.on('SIGTERM', () => exit());
|
||||
} else {
|
||||
try {
|
||||
await parcel.run();
|
||||
} catch (err) {
|
||||
// If an exception is thrown during Parcel.build, it is given to reporters in a
|
||||
// buildFailure event, and has been shown to the user.
|
||||
if (!(err instanceof _core().BuildError)) {
|
||||
await logUncaughtError(err);
|
||||
}
|
||||
await exit(1);
|
||||
}
|
||||
await exit();
|
||||
}
|
||||
}
|
||||
function parsePort(portValue) {
|
||||
let parsedPort = Number(portValue);
|
||||
|
||||
// Throw an error if port value is invalid...
|
||||
if (!Number.isInteger(parsedPort)) {
|
||||
throw new Error(`Port ${portValue} is not a valid integer.`);
|
||||
}
|
||||
return parsedPort;
|
||||
}
|
||||
function parseOptionInt(value) {
|
||||
const parsedValue = parseInt(value, 10);
|
||||
if (isNaN(parsedValue)) {
|
||||
throw new (_commander().default.InvalidOptionArgumentError)('Must be an integer.');
|
||||
}
|
||||
return parsedValue;
|
||||
}
|
||||
async function normalizeOptions(command, inputFS) {
|
||||
var _command$autoinstall, _command$sourceMaps;
|
||||
let nodeEnv;
|
||||
if (command.name() === 'build') {
|
||||
nodeEnv = process.env.NODE_ENV || 'production';
|
||||
// Autoinstall unless explicitly disabled or we detect a CI environment.
|
||||
command.autoinstall = !(command.autoinstall === false || process.env.CI);
|
||||
} else {
|
||||
nodeEnv = process.env.NODE_ENV || 'development';
|
||||
}
|
||||
|
||||
// Set process.env.NODE_ENV to a default if undefined so that it is
|
||||
// available in JS configs and plugins.
|
||||
process.env.NODE_ENV = nodeEnv;
|
||||
let https = !!command.https;
|
||||
if (command.cert && command.key) {
|
||||
https = {
|
||||
cert: command.cert,
|
||||
key: command.key
|
||||
};
|
||||
}
|
||||
let serveOptions = false;
|
||||
let {
|
||||
host
|
||||
} = command;
|
||||
|
||||
// Ensure port is valid and available
|
||||
let port = parsePort(command.port || '1234');
|
||||
let originalPort = port;
|
||||
if (command.name() === 'serve' || command.hmr) {
|
||||
try {
|
||||
port = await (0, _getPort().default)({
|
||||
port,
|
||||
host
|
||||
});
|
||||
} catch (err) {
|
||||
throw new (_diagnostic().default)({
|
||||
diagnostic: {
|
||||
message: `Could not get available port: ${err.message}`,
|
||||
origin: 'parcel',
|
||||
stack: err.stack
|
||||
}
|
||||
});
|
||||
}
|
||||
if (port !== originalPort) {
|
||||
let errorMessage = `Port "${originalPort}" could not be used`;
|
||||
if (command.port != null) {
|
||||
// Throw the error if the user defined a custom port
|
||||
throw new Error(errorMessage);
|
||||
} else {
|
||||
// Parcel logger is not set up at this point, so just use native INTERNAL_ORIGINAL_CONSOLE
|
||||
_logger().INTERNAL_ORIGINAL_CONSOLE.warn(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command.name() === 'serve') {
|
||||
let {
|
||||
publicUrl
|
||||
} = command;
|
||||
serveOptions = {
|
||||
https,
|
||||
port,
|
||||
host,
|
||||
publicUrl
|
||||
};
|
||||
}
|
||||
let hmrOptions = null;
|
||||
if (command.name() !== 'build' && command.hmr !== false) {
|
||||
let hmrport = command.hmrPort ? parsePort(command.hmrPort) : port;
|
||||
let hmrhost = command.hmrHost ? command.hmrHost : host;
|
||||
hmrOptions = {
|
||||
port: hmrport,
|
||||
host: hmrhost
|
||||
};
|
||||
}
|
||||
if (command.detailedReport === true) {
|
||||
command.detailedReport = '10';
|
||||
}
|
||||
let additionalReporters = [{
|
||||
packageName: '@parcel/reporter-cli',
|
||||
resolveFrom: __filename
|
||||
}, ...command.reporter.map(packageName => ({
|
||||
packageName,
|
||||
resolveFrom: _path().default.join(inputFS.cwd(), 'index')
|
||||
}))];
|
||||
if (command.trace) {
|
||||
additionalReporters.unshift({
|
||||
packageName: '@parcel/reporter-tracer',
|
||||
resolveFrom: __filename
|
||||
});
|
||||
}
|
||||
let mode = command.name() === 'build' ? 'production' : 'development';
|
||||
const normalizeIncludeExcludeList = input => {
|
||||
if (typeof input !== 'string') return [];
|
||||
return input.split(',').map(value => value.trim());
|
||||
};
|
||||
return {
|
||||
shouldDisableCache: command.cache === false,
|
||||
cacheDir: command.cacheDir,
|
||||
watchDir: command.watchDir,
|
||||
config: command.config,
|
||||
mode,
|
||||
hmrOptions,
|
||||
shouldContentHash: hmrOptions ? false : command.contentHash,
|
||||
serveOptions,
|
||||
targets: command.target.length > 0 ? command.target : null,
|
||||
shouldAutoInstall: (_command$autoinstall = command.autoinstall) !== null && _command$autoinstall !== void 0 ? _command$autoinstall : true,
|
||||
logLevel: command.logLevel,
|
||||
shouldProfile: command.profile,
|
||||
shouldTrace: command.trace,
|
||||
shouldBuildLazily: typeof command.lazy !== 'undefined',
|
||||
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
|
||||
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
||||
shouldBundleIncrementally: process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
||||
detailedReport: command.detailedReport != null ? {
|
||||
assetsPerBundle: parseInt(command.detailedReport, 10)
|
||||
} : null,
|
||||
env: {
|
||||
NODE_ENV: nodeEnv
|
||||
},
|
||||
additionalReporters,
|
||||
defaultTargetOptions: {
|
||||
shouldOptimize: command.optimize != null ? command.optimize : mode === 'production',
|
||||
sourceMaps: (_command$sourceMaps = command.sourceMaps) !== null && _command$sourceMaps !== void 0 ? _command$sourceMaps : true,
|
||||
shouldScopeHoist: command.scopeHoist,
|
||||
publicUrl: command.publicUrl,
|
||||
distDir: command.distDir
|
||||
}
|
||||
};
|
||||
}
|
44
webGl/my-threejs-test/node_modules/parcel/package.json
generated
vendored
Normal file
44
webGl/my-threejs-test/node_modules/parcel/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "parcel",
|
||||
"version": "2.12.0",
|
||||
"description": "Blazing fast, zero configuration web application bundler",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/parcel-bundler/parcel.git"
|
||||
},
|
||||
"bin": "lib/bin.js",
|
||||
"main": "lib/bin.js",
|
||||
"source": "src/bin.js",
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@parcel/config-default": "2.12.0",
|
||||
"@parcel/core": "2.12.0",
|
||||
"@parcel/diagnostic": "2.12.0",
|
||||
"@parcel/events": "2.12.0",
|
||||
"@parcel/fs": "2.12.0",
|
||||
"@parcel/logger": "2.12.0",
|
||||
"@parcel/package-manager": "2.12.0",
|
||||
"@parcel/reporter-cli": "2.12.0",
|
||||
"@parcel/reporter-dev-server": "2.12.0",
|
||||
"@parcel/reporter-tracer": "2.12.0",
|
||||
"@parcel/utils": "2.12.0",
|
||||
"chalk": "^4.1.0",
|
||||
"commander": "^7.0.0",
|
||||
"get-port": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.11",
|
||||
"@parcel/babel-register": "2.12.0"
|
||||
},
|
||||
"gitHead": "2059029ee91e5f03a273b0954d3e629d7375f986"
|
||||
}
|
6
webGl/my-threejs-test/node_modules/parcel/src/.eslintrc.json
generated
vendored
Normal file
6
webGl/my-threejs-test/node_modules/parcel/src/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@parcel/eslint-config",
|
||||
"rules": {
|
||||
"no-console": "off"
|
||||
}
|
||||
}
|
12
webGl/my-threejs-test/node_modules/parcel/src/bin.js
generated
vendored
Normal file
12
webGl/my-threejs-test/node_modules/parcel/src/bin.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
if (
|
||||
process.env.PARCEL_BUILD_ENV !== 'production' ||
|
||||
process.env.PARCEL_SELF_BUILD
|
||||
) {
|
||||
require('@parcel/babel-register');
|
||||
}
|
||||
|
||||
require('./cli');
|
513
webGl/my-threejs-test/node_modules/parcel/src/cli.js
generated
vendored
Normal file
513
webGl/my-threejs-test/node_modules/parcel/src/cli.js
generated
vendored
Normal file
@@ -0,0 +1,513 @@
|
||||
// @flow
|
||||
|
||||
import type {InitialParcelOptions} from '@parcel/types';
|
||||
import {BuildError} from '@parcel/core';
|
||||
import {NodeFS} from '@parcel/fs';
|
||||
import ThrowableDiagnostic from '@parcel/diagnostic';
|
||||
import {prettyDiagnostic, openInBrowser} from '@parcel/utils';
|
||||
import {Disposable} from '@parcel/events';
|
||||
import {INTERNAL_ORIGINAL_CONSOLE} from '@parcel/logger';
|
||||
import chalk from 'chalk';
|
||||
import commander from 'commander';
|
||||
import path from 'path';
|
||||
import getPort from 'get-port';
|
||||
import {version} from '../package.json';
|
||||
|
||||
const program = new commander.Command();
|
||||
|
||||
// Exit codes in response to signals are traditionally
|
||||
// 128 + signal value
|
||||
// https://tldp.org/LDP/abs/html/exitcodes.html
|
||||
const SIGINT_EXIT_CODE = 130;
|
||||
|
||||
async function logUncaughtError(e: mixed) {
|
||||
if (e instanceof ThrowableDiagnostic) {
|
||||
for (let diagnostic of e.diagnostics) {
|
||||
let {message, codeframe, stack, hints, documentation} =
|
||||
await prettyDiagnostic(diagnostic);
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(chalk.red(message));
|
||||
if (codeframe || stack) {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error('');
|
||||
}
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(codeframe);
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(stack);
|
||||
if ((stack || codeframe) && hints.length > 0) {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error('');
|
||||
}
|
||||
for (let h of hints) {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(chalk.blue(h));
|
||||
}
|
||||
if (documentation) {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(chalk.magenta.bold(documentation));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(e);
|
||||
}
|
||||
|
||||
// A hack to definitely ensure we logged the uncaught exception
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
const handleUncaughtException = async exception => {
|
||||
try {
|
||||
await logUncaughtError(exception);
|
||||
} catch (err) {
|
||||
console.error(exception);
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
process.on('unhandledRejection', handleUncaughtException);
|
||||
|
||||
program.storeOptionsAsProperties();
|
||||
program.version(version);
|
||||
|
||||
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
|
||||
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
|
||||
|
||||
const commonOptions = {
|
||||
'--no-cache': 'disable the filesystem cache',
|
||||
'--config <path>':
|
||||
'specify which config to use. can be a path or a package name',
|
||||
'--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
|
||||
'--watch-dir <path>':
|
||||
'set the root watch directory. defaults to nearest lockfile or source control dir.',
|
||||
'--no-source-maps': 'disable sourcemaps',
|
||||
'--target [name]': [
|
||||
'only build given target(s)',
|
||||
(val, list) => list.concat([val]),
|
||||
[],
|
||||
],
|
||||
'--log-level <level>': new commander.Option(
|
||||
'--log-level <level>',
|
||||
'set the log level',
|
||||
).choices(['none', 'error', 'warn', 'info', 'verbose']),
|
||||
'--dist-dir <dir>':
|
||||
'output directory to write to when unspecified by targets',
|
||||
'--no-autoinstall': 'disable autoinstall',
|
||||
'--profile': 'enable sampling build profiling',
|
||||
'--trace': 'enable build tracing',
|
||||
'-V, --version': 'output the version number',
|
||||
'--detailed-report [count]': [
|
||||
'print the asset timings and sizes in the build report',
|
||||
parseOptionInt,
|
||||
],
|
||||
'--reporter <name>': [
|
||||
'additional reporters to run',
|
||||
(val, acc) => {
|
||||
acc.push(val);
|
||||
return acc;
|
||||
},
|
||||
[],
|
||||
],
|
||||
};
|
||||
|
||||
var hmrOptions = {
|
||||
'--no-hmr': 'disable hot module replacement',
|
||||
'-p, --port <port>': [
|
||||
'set the port to serve on. defaults to $PORT or 1234',
|
||||
process.env.PORT,
|
||||
],
|
||||
'--host <host>':
|
||||
'set the host to listen on, defaults to listening on all interfaces',
|
||||
'--https': 'serves files over HTTPS',
|
||||
'--cert <path>': 'path to certificate to use with HTTPS',
|
||||
'--key <path>': 'path to private key to use with HTTPS',
|
||||
'--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT],
|
||||
'--hmr-host <host>': ['hot module replacement host', process.env.HMR_HOST],
|
||||
};
|
||||
|
||||
function applyOptions(cmd, options) {
|
||||
for (let opt in options) {
|
||||
const option = options[opt];
|
||||
if (option instanceof commander.Option) {
|
||||
cmd.addOption(option);
|
||||
} else {
|
||||
cmd.option(opt, ...(Array.isArray(option) ? option : [option]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let serve = program
|
||||
.command('serve [input...]')
|
||||
.description('starts a development server')
|
||||
.option('--public-url <url>', 'the path prefix for absolute urls')
|
||||
.option(
|
||||
'--open [browser]',
|
||||
'automatically open in specified browser, defaults to default browser',
|
||||
)
|
||||
.option('--watch-for-stdin', 'exit when stdin closes')
|
||||
.option(
|
||||
'--lazy [includes]',
|
||||
'Build async bundles on demand, when requested in the browser. Defaults to all async bundles, unless a comma separated list of source file globs is provided. Only async bundles whose entry points match these globs will be built lazily',
|
||||
)
|
||||
.option(
|
||||
'--lazy-exclude <excludes>',
|
||||
'Can only be used in combination with --lazy. Comma separated list of source file globs, async bundles whose entry points match these globs will not be built lazily',
|
||||
)
|
||||
.action(runCommand);
|
||||
|
||||
applyOptions(serve, hmrOptions);
|
||||
applyOptions(serve, commonOptions);
|
||||
|
||||
let watch = program
|
||||
.command('watch [input...]')
|
||||
.description('starts the bundler in watch mode')
|
||||
.option('--public-url <url>', 'the path prefix for absolute urls')
|
||||
.option('--no-content-hash', 'disable content hashing')
|
||||
.option('--watch-for-stdin', 'exit when stdin closes')
|
||||
.action(runCommand);
|
||||
|
||||
applyOptions(watch, hmrOptions);
|
||||
applyOptions(watch, commonOptions);
|
||||
|
||||
let build = program
|
||||
.command('build [input...]')
|
||||
.description('bundles for production')
|
||||
.option('--no-optimize', 'disable minification')
|
||||
.option('--no-scope-hoist', 'disable scope-hoisting')
|
||||
.option('--public-url <url>', 'the path prefix for absolute urls')
|
||||
.option('--no-content-hash', 'disable content hashing')
|
||||
.action(runCommand);
|
||||
|
||||
applyOptions(build, commonOptions);
|
||||
|
||||
program
|
||||
.command('help [command]')
|
||||
.description('display help information for a command')
|
||||
.action(function (command) {
|
||||
let cmd = program.commands.find(c => c.name() === command) || program;
|
||||
cmd.help();
|
||||
});
|
||||
|
||||
program.on('--help', function () {
|
||||
INTERNAL_ORIGINAL_CONSOLE.log('');
|
||||
INTERNAL_ORIGINAL_CONSOLE.log(
|
||||
' Run `' +
|
||||
chalk.bold('parcel help <command>') +
|
||||
'` for more information on specific commands',
|
||||
);
|
||||
INTERNAL_ORIGINAL_CONSOLE.log('');
|
||||
});
|
||||
|
||||
// Override to output option description if argument was missing
|
||||
// $FlowFixMe[prop-missing]
|
||||
commander.Command.prototype.optionMissingArgument = function (option) {
|
||||
INTERNAL_ORIGINAL_CONSOLE.error(
|
||||
"error: option `%s' argument missing",
|
||||
option.flags,
|
||||
);
|
||||
INTERNAL_ORIGINAL_CONSOLE.log(program.createHelp().optionDescription(option));
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// Make serve the default command except for --help
|
||||
var args = process.argv;
|
||||
if (args[2] === '--help' || args[2] === '-h') args[2] = 'help';
|
||||
|
||||
if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
|
||||
args.splice(2, 0, 'serve');
|
||||
}
|
||||
|
||||
program.parse(args);
|
||||
|
||||
function runCommand(...args) {
|
||||
run(...args).catch(handleUncaughtException);
|
||||
}
|
||||
|
||||
async function run(
|
||||
entries: Array<string>,
|
||||
_opts: any, // using pre v7 Commander options as properties
|
||||
command: any,
|
||||
) {
|
||||
if (entries.length === 0) {
|
||||
entries = ['.'];
|
||||
}
|
||||
|
||||
entries = entries.map(entry => path.resolve(entry));
|
||||
|
||||
let Parcel = require('@parcel/core').default;
|
||||
let fs = new NodeFS();
|
||||
let options = await normalizeOptions(command, fs);
|
||||
let parcel = new Parcel({
|
||||
entries,
|
||||
defaultConfig: require.resolve('@parcel/config-default', {
|
||||
paths: [fs.cwd(), __dirname],
|
||||
}),
|
||||
shouldPatchConsole: false,
|
||||
...options,
|
||||
});
|
||||
|
||||
let disposable = new Disposable();
|
||||
let unsubscribe: () => Promise<mixed>;
|
||||
let isExiting;
|
||||
async function exit(exitCode: number = 0) {
|
||||
if (isExiting) {
|
||||
return;
|
||||
}
|
||||
|
||||
isExiting = true;
|
||||
if (unsubscribe != null) {
|
||||
await unsubscribe();
|
||||
} else if (parcel.isProfiling) {
|
||||
await parcel.stopProfiling();
|
||||
}
|
||||
|
||||
if (process.stdin.isTTY && process.stdin.isRaw) {
|
||||
// $FlowFixMe
|
||||
process.stdin.setRawMode(false);
|
||||
}
|
||||
|
||||
disposable.dispose();
|
||||
process.exit(exitCode);
|
||||
}
|
||||
|
||||
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
||||
if (process.stdin.isTTY) {
|
||||
// $FlowFixMe
|
||||
process.stdin.setRawMode(true);
|
||||
require('readline').emitKeypressEvents(process.stdin);
|
||||
|
||||
let stream = process.stdin.on('keypress', async (char, key) => {
|
||||
if (!key.ctrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (key.name) {
|
||||
case 'c':
|
||||
// Detect the ctrl+c key, and gracefully exit after writing the asset graph to the cache.
|
||||
// This is mostly for tools that wrap Parcel as a child process like yarn and npm.
|
||||
//
|
||||
// Setting raw mode prevents SIGINT from being sent in response to ctrl-c:
|
||||
// https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode
|
||||
//
|
||||
// We don't use the SIGINT event for this because when run inside yarn, the parent
|
||||
// yarn process ends before Parcel and it appears that Parcel has ended while it may still
|
||||
// be cleaning up. Handling events from stdin prevents this impression.
|
||||
//
|
||||
// When watching, a 0 success code is acceptable when Parcel is interrupted with ctrl-c.
|
||||
// When building, fail with a code as if we received a SIGINT.
|
||||
await exit(isWatching ? 0 : SIGINT_EXIT_CODE);
|
||||
break;
|
||||
case 'e':
|
||||
await (parcel.isProfiling
|
||||
? parcel.stopProfiling()
|
||||
: parcel.startProfiling());
|
||||
break;
|
||||
case 'y':
|
||||
await parcel.takeHeapSnapshot();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
disposable.add(() => {
|
||||
stream.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
if (isWatching) {
|
||||
({unsubscribe} = await parcel.watch(err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
}));
|
||||
|
||||
if (command.open && options.serveOptions) {
|
||||
await openInBrowser(
|
||||
`${options.serveOptions.https ? 'https' : 'http'}://${
|
||||
options.serveOptions.host || 'localhost'
|
||||
}:${options.serveOptions.port}`,
|
||||
command.open,
|
||||
);
|
||||
}
|
||||
|
||||
if (command.watchForStdin) {
|
||||
process.stdin.on('end', async () => {
|
||||
INTERNAL_ORIGINAL_CONSOLE.log('STDIN closed, ending');
|
||||
|
||||
await exit();
|
||||
});
|
||||
process.stdin.resume();
|
||||
}
|
||||
|
||||
// In non-tty cases, respond to SIGINT by cleaning up. Since we're watching,
|
||||
// a 0 success code is acceptable.
|
||||
process.on('SIGINT', () => exit());
|
||||
process.on('SIGTERM', () => exit());
|
||||
} else {
|
||||
try {
|
||||
await parcel.run();
|
||||
} catch (err) {
|
||||
// If an exception is thrown during Parcel.build, it is given to reporters in a
|
||||
// buildFailure event, and has been shown to the user.
|
||||
if (!(err instanceof BuildError)) {
|
||||
await logUncaughtError(err);
|
||||
}
|
||||
await exit(1);
|
||||
}
|
||||
|
||||
await exit();
|
||||
}
|
||||
}
|
||||
|
||||
function parsePort(portValue: string): number {
|
||||
let parsedPort = Number(portValue);
|
||||
|
||||
// Throw an error if port value is invalid...
|
||||
if (!Number.isInteger(parsedPort)) {
|
||||
throw new Error(`Port ${portValue} is not a valid integer.`);
|
||||
}
|
||||
|
||||
return parsedPort;
|
||||
}
|
||||
|
||||
function parseOptionInt(value) {
|
||||
const parsedValue = parseInt(value, 10);
|
||||
if (isNaN(parsedValue)) {
|
||||
throw new commander.InvalidOptionArgumentError('Must be an integer.');
|
||||
}
|
||||
return parsedValue;
|
||||
}
|
||||
|
||||
async function normalizeOptions(
|
||||
command,
|
||||
inputFS,
|
||||
): Promise<InitialParcelOptions> {
|
||||
let nodeEnv;
|
||||
if (command.name() === 'build') {
|
||||
nodeEnv = process.env.NODE_ENV || 'production';
|
||||
// Autoinstall unless explicitly disabled or we detect a CI environment.
|
||||
command.autoinstall = !(command.autoinstall === false || process.env.CI);
|
||||
} else {
|
||||
nodeEnv = process.env.NODE_ENV || 'development';
|
||||
}
|
||||
|
||||
// Set process.env.NODE_ENV to a default if undefined so that it is
|
||||
// available in JS configs and plugins.
|
||||
process.env.NODE_ENV = nodeEnv;
|
||||
|
||||
let https = !!command.https;
|
||||
if (command.cert && command.key) {
|
||||
https = {
|
||||
cert: command.cert,
|
||||
key: command.key,
|
||||
};
|
||||
}
|
||||
|
||||
let serveOptions = false;
|
||||
let {host} = command;
|
||||
|
||||
// Ensure port is valid and available
|
||||
let port = parsePort(command.port || '1234');
|
||||
let originalPort = port;
|
||||
if (command.name() === 'serve' || command.hmr) {
|
||||
try {
|
||||
port = await getPort({port, host});
|
||||
} catch (err) {
|
||||
throw new ThrowableDiagnostic({
|
||||
diagnostic: {
|
||||
message: `Could not get available port: ${err.message}`,
|
||||
origin: 'parcel',
|
||||
stack: err.stack,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (port !== originalPort) {
|
||||
let errorMessage = `Port "${originalPort}" could not be used`;
|
||||
if (command.port != null) {
|
||||
// Throw the error if the user defined a custom port
|
||||
throw new Error(errorMessage);
|
||||
} else {
|
||||
// Parcel logger is not set up at this point, so just use native INTERNAL_ORIGINAL_CONSOLE
|
||||
INTERNAL_ORIGINAL_CONSOLE.warn(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command.name() === 'serve') {
|
||||
let {publicUrl} = command;
|
||||
|
||||
serveOptions = {
|
||||
https,
|
||||
port,
|
||||
host,
|
||||
publicUrl,
|
||||
};
|
||||
}
|
||||
|
||||
let hmrOptions = null;
|
||||
if (command.name() !== 'build' && command.hmr !== false) {
|
||||
let hmrport = command.hmrPort ? parsePort(command.hmrPort) : port;
|
||||
let hmrhost = command.hmrHost ? command.hmrHost : host;
|
||||
|
||||
hmrOptions = {port: hmrport, host: hmrhost};
|
||||
}
|
||||
|
||||
if (command.detailedReport === true) {
|
||||
command.detailedReport = '10';
|
||||
}
|
||||
|
||||
let additionalReporters = [
|
||||
{packageName: '@parcel/reporter-cli', resolveFrom: __filename},
|
||||
...(command.reporter: Array<string>).map(packageName => ({
|
||||
packageName,
|
||||
resolveFrom: path.join(inputFS.cwd(), 'index'),
|
||||
})),
|
||||
];
|
||||
|
||||
if (command.trace) {
|
||||
additionalReporters.unshift({
|
||||
packageName: '@parcel/reporter-tracer',
|
||||
resolveFrom: __filename,
|
||||
});
|
||||
}
|
||||
|
||||
let mode = command.name() === 'build' ? 'production' : 'development';
|
||||
|
||||
const normalizeIncludeExcludeList = (input?: string): string[] => {
|
||||
if (typeof input !== 'string') return [];
|
||||
return input.split(',').map(value => value.trim());
|
||||
};
|
||||
return {
|
||||
shouldDisableCache: command.cache === false,
|
||||
cacheDir: command.cacheDir,
|
||||
watchDir: command.watchDir,
|
||||
config: command.config,
|
||||
mode,
|
||||
hmrOptions,
|
||||
shouldContentHash: hmrOptions ? false : command.contentHash,
|
||||
serveOptions,
|
||||
targets: command.target.length > 0 ? command.target : null,
|
||||
shouldAutoInstall: command.autoinstall ?? true,
|
||||
logLevel: command.logLevel,
|
||||
shouldProfile: command.profile,
|
||||
shouldTrace: command.trace,
|
||||
shouldBuildLazily: typeof command.lazy !== 'undefined',
|
||||
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
|
||||
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
||||
shouldBundleIncrementally:
|
||||
process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
||||
detailedReport:
|
||||
command.detailedReport != null
|
||||
? {
|
||||
assetsPerBundle: parseInt(command.detailedReport, 10),
|
||||
}
|
||||
: null,
|
||||
env: {
|
||||
NODE_ENV: nodeEnv,
|
||||
},
|
||||
additionalReporters,
|
||||
defaultTargetOptions: {
|
||||
shouldOptimize:
|
||||
command.optimize != null ? command.optimize : mode === 'production',
|
||||
sourceMaps: command.sourceMaps ?? true,
|
||||
shouldScopeHoist: command.scopeHoist,
|
||||
publicUrl: command.publicUrl,
|
||||
distDir: command.distDir,
|
||||
},
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user