npm and error messages

This commit is contained in:
2018-10-27 03:51:47 -05:00
parent 692ab70565
commit 025a403027
29601 changed files with 2759363 additions and 14 deletions

127
node_modules/laravel-mix/src/builder/Entry.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
class Entry {
/**
* Create a new Entry instance.
*/
constructor() {
this.structure = {};
this.base = '';
}
/**
* Fetch the underlying entry structure.
*/
get() {
return this.structure;
}
/**
* Get the object keys for the structure.
*/
keys() {
return Object.keys(this.structure);
}
/**
* Add a key key-val pair to the structure.
*
* @param {string} key
* @param {mixed} val
*/
add(key, val) {
this.structure[key] = (this.structure[key] || []).concat(val);
return this;
}
/**
* Add a new key-val pair, based on a given output path.
*
* @param {mixed} val
* @param {Object} output
* @param {Object} fallback
*/
addFromOutput(val, output, fallback) {
output = this.normalizePath(output, fallback);
return this.add(this.createName(output), val);
}
/**
* Add a vendor extraction.
*
* @param {Object} extraction
*/
addExtraction(extraction) {
if (!Mix.bundlingJavaScript && !extraction.output) {
throw new Error(
'Please provide an output path as the second argument to mix.extract().'
);
}
let vendorPath = extraction.output
? new File(extraction.output)
.pathFromPublic(Config.publicPath)
.replace(/\.js$/, '')
.replace(/\\/g, '/')
: path.join(this.base, 'vendor').replace(/\\/g, '/');
this.add(vendorPath, extraction.libs);
return vendorPath;
}
/**
* Add a default entry script to the structure.
*/
addDefault() {
this.add(
'mix',
new File(path.resolve(__dirname, 'mock-entry.js')).path()
);
}
/**
* Build the proper entry name, based on a given output.
*
* @param {Object} output
*/
createName(output) {
let name = output
.pathFromPublic(Config.publicPath)
.replace(/\.js$/, '')
.replace(/\\/g, '/');
this.base = path.parse(name).dir;
return name;
}
/**
* Normalize the given output path.
*
* @param {Object} output
* @param {Object} fallback
*/
normalizePath(output, fallback) {
// All output paths need to start at the project's public dir.
if (!output.pathFromPublic().startsWith('/' + Config.publicPath)) {
output = new File(
path.join(Config.publicPath, output.pathFromPublic())
);
}
// If the output points to a directory, we'll grab a file name from the fallback src.
if (output.isDirectory()) {
output = new File(
path.join(
output.filePath,
fallback.nameWithoutExtension() + '.js'
)
);
}
return output;
}
}
module.exports = Entry;

133
node_modules/laravel-mix/src/builder/WebpackConfig.js generated vendored Normal file
View File

@@ -0,0 +1,133 @@
let webpack = require('webpack');
let webpackDefaultConfig = require('./webpack-default');
let Entry = require('./Entry');
let webpackRules = require('./webpack-rules');
let webpackPlugins = require('./webpack-plugins');
process.noDeprecation = true;
class WebpackConfig {
/**
* Create a new instance.
*/
constructor() {
this.webpackConfig = webpackDefaultConfig();
}
/**
* Build the Webpack configuration object.
*/
build() {
this.buildEntry()
.buildOutput()
.buildRules()
.buildPlugins()
.buildResolving()
.mergeCustomConfig();
Mix.dispatch('configReady', this.webpackConfig);
return this.webpackConfig;
}
/**
* Build the entry object.
*/
buildEntry() {
let entry = new Entry();
if (! Mix.bundlingJavaScript) {
entry.addDefault();
}
Mix.dispatch('loading-entry', entry);
this.webpackConfig.entry = entry.get();
return this;
}
/**
* Build the output object.
*/
buildOutput() {
let http = process.argv.includes('--https') ? 'https' : 'http';
if (Mix.isUsing('hmr')) {
this.webpackConfig.devServer.host = Config.hmrOptions.host;
this.webpackConfig.devServer.port = Config.hmrOptions.port;
}
this.webpackConfig.output = {
path: path.resolve(Mix.isUsing('hmr') ? '/' : Config.publicPath),
filename: '[name].js',
chunkFilename: '[name].js',
publicPath: Mix.isUsing('hmr')
? http +
'://' +
Config.hmrOptions.host +
':' +
Config.hmrOptions.port +
'/'
: '/'
};
return this;
}
/**
* Build the rules array.
*/
buildRules() {
this.webpackConfig.module.rules = this.webpackConfig.module.rules.concat(
webpackRules()
);
Mix.dispatch('loading-rules', this.webpackConfig.module.rules);
return this;
}
/**
* Build the plugins array.
*/
buildPlugins() {
this.webpackConfig.plugins = this.webpackConfig.plugins.concat(
webpackPlugins()
);
Mix.dispatch('loading-plugins', this.webpackConfig.plugins);
return this;
}
/**
* Build the resolve object.
*/
buildResolving() {
this.webpackConfig.resolve = {
extensions: ['*', '.js', '.jsx', '.vue'],
alias: {
vue$: 'vue/dist/vue.common.js'
}
};
return this;
}
/**
* Merge the user's custom Webpack configuration.
*/
mergeCustomConfig() {
if (Config.webpackConfig) {
this.webpackConfig = require('webpack-merge').smart(
this.webpackConfig,
Config.webpackConfig
);
}
}
}
module.exports = WebpackConfig;

0
node_modules/laravel-mix/src/builder/mock-entry.js generated vendored Normal file
View File

View File

@@ -0,0 +1,43 @@
module.exports = function() {
return {
context: Mix.paths.root(),
entry: {},
output: {},
module: { rules: [] },
plugins: [],
stats: {
hash: false,
version: false,
timings: false,
children: false,
errorDetails: false,
chunks: false,
modules: false,
reasons: false,
source: false,
publicPath: false
},
performance: {
hints: false
},
devtool: Config.sourcemaps,
devServer: {
headers: {
'Access-Control-Allow-Origin': '*'
},
contentBase: path.resolve(Config.publicPath),
historyApiFallback: true,
noInfo: true,
compress: true,
quiet: true
}
};
};

View File

@@ -0,0 +1,72 @@
let webpack = require('webpack');
let FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
let MixDefinitionsPlugin = require('../webpackPlugins/MixDefinitionsPlugin');
let BuildCallbackPlugin = require('../webpackPlugins/BuildCallbackPlugin');
let CustomTasksPlugin = require('../webpackPlugins/CustomTasksPlugin');
let ManifestPlugin = require('../webpackPlugins/ManifestPlugin');
let MockEntryPlugin = require('../webpackPlugins/MockEntryPlugin');
let UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = function() {
let plugins = [];
// If the user didn't declare any JS compilation, we still need to
// use a temporary script to force a compile. This plugin will
// handle the process of deleting the compiled script.
if (!Mix.bundlingJavaScript) {
plugins.push(new MockEntryPlugin());
}
// Activate better error feedback in the console.
plugins.push(
new FriendlyErrorsWebpackPlugin({ clearConsole: Config.clearConsole })
);
// Add support for webpack 3 scope hoisting.
if (Mix.inProduction()) {
plugins.push(new webpack.optimize.ModuleConcatenationPlugin());
}
// Activate support for Mix_ .env definitions.
plugins.push(
MixDefinitionsPlugin.build({
NODE_ENV: Mix.inProduction()
? 'production'
: process.env.NODE_ENV || 'development'
})
);
if (!Mix.components.get('version') && Mix.isUsing('hmr')) {
plugins.push(new webpack.NamedModulesPlugin());
}
// Add some general Webpack loader options.
plugins.push(
new webpack.LoaderOptionsPlugin({
minimize: Mix.inProduction(),
options: {
context: __dirname,
output: { path: './' }
}
})
);
// If we're in production environment, with Uglification turned on, we'll
// clean up and minify all of the user's JS and CSS automatically.
if (Mix.inProduction() && Config.uglify) {
plugins.push(new UglifyJSPlugin(Config.uglify));
}
// Handle all custom, non-webpack tasks.
plugins.push(new ManifestPlugin());
// Handle all custom, non-webpack tasks.
plugins.push(new CustomTasksPlugin());
// Notify the rest of our app when Webpack has finished its build.
plugins.push(
new BuildCallbackPlugin(stats => Mix.dispatch('build', stats))
);
return plugins;
};

86
node_modules/laravel-mix/src/builder/webpack-rules.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
module.exports = function() {
let rules = [];
// Add support for loading HTML files.
rules.push({
test: /\.html$/,
loaders: ['html-loader']
});
// Add support for loading images.
rules.push({
// only include svg that doesn't have font in the path or file name by using negative lookahead
test: /(\.(png|jpe?g|gif)$|^((?!font).)*\.svg$)/,
loaders: [
{
loader: 'file-loader',
options: {
name: path => {
if (!/node_modules|bower_components/.test(path)) {
return (
Config.fileLoaderDirs.images +
'/[name].[ext]?[hash]'
);
}
return (
Config.fileLoaderDirs.images +
'/vendor/' +
path
.replace(/\\/g, '/')
.replace(
/((.*(node_modules|bower_components))|images|image|img|assets)\//g,
''
) +
'?[hash]'
);
},
publicPath: Config.resourceRoot
}
},
{
loader: 'img-loader',
options: Config.imgLoaderOptions
}
]
});
// Add support for loading fonts.
rules.push({
test: /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/,
loader: 'file-loader',
options: {
name: path => {
if (!/node_modules|bower_components/.test(path)) {
return Config.fileLoaderDirs.fonts + '/[name].[ext]?[hash]';
}
return (
Config.fileLoaderDirs.fonts +
'/vendor/' +
path
.replace(/\\/g, '/')
.replace(
/((.*(node_modules|bower_components))|fonts|font|assets)\//g,
''
) +
'?[hash]'
);
},
publicPath: Config.resourceRoot
}
});
// Add support for loading cursor files.
rules.push({
test: /\.(cur|ani)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
publicPath: Config.resourceRoot
}
});
return rules;
};