Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/laravel-mix/src/ drwxrwxr-x | |
| Viewing file: Select action/file-type: const babel = require('@babel/core');
/**
* @typedef {string|string[]} BabelTargetsBrowserslist
* @typedef {Record<string,string> & {browsers: BabelTargetsBrowserslist}} BabelTargetsPerEngine
* @typedef {BabelTargetsBrowserslist | BabelTargetsPerEngine} BabelTargets
*/
/**
* @typedef {object} AdditionalBabelOptions
* @property {boolean} [cacheDirectory]
* @property {BabelTargets} [targets]
*/
/** @typedef {import("@babel/core").TransformOptions & AdditionalBabelOptions} BabelOptions */
class BabelConfig {
/**
*
* @param {import("./Mix")} [mix]
*/
constructor(mix) {
this.mix = mix || global.Mix;
}
/**
* Generate the appropriate Babel configuration for the build.
*
* @deprecated
*/
static generate() {
return new BabelConfig().generate();
}
/**
* Generate the appropriate Babel configuration for the build.
*/
generate() {
return this.mergeAll([
this.default(),
this.getCustomConfig(this.mix.config.babelConfig),
{
root: this.mix.paths.root(),
babelrc: true,
configFile: true,
babelrcRoots: ['.', this.mix.paths.root()]
}
]);
}
/**
* Fetch the user's .babelrc config file, if any.
*
* @param {string} path
* @deprecated
*/
fetchBabelRc(path) {
const File = require('./File');
return File.exists(path) ? JSON.parse(File.find(path).read()) : {};
}
/**
* Get the babel config setup when using mix.babelConfig()
*
* @internal
* @param {import('@babel/core').TransformOptions} customOptions
*/
getCustomConfig(customOptions) {
const config = babel.loadPartialConfig(customOptions);
return config ? config.options : {};
}
/**
* Merge babel configs
*
* @param {BabelOptions[]} configs
*/
mergeAll(configs) {
const options = configs.reduce((prev, current) => {
const presets = [...(prev.presets || []), ...(current.presets || [])].map(
preset => babel.createConfigItem(preset, { type: 'preset' })
);
const plugins = [...(prev.plugins || []), ...(current.plugins || [])].map(
preset => babel.createConfigItem(preset, { type: 'plugin' })
);
return Object.assign(prev, current, { presets, plugins });
});
options.plugins = this.filterConfigItems(options.plugins || []);
options.presets = this.filterConfigItems(options.presets || []);
return options;
}
/**
* Filter merged presets or plugins
*
* @internal
* @param {import("@babel/core").PluginItem[]} items
* @returns {import("@babel/core").PluginItem[]}
*/
filterConfigItems(items) {
/**
*
* @param {import("@babel/core").PluginItem[]} unique
* @param {import("@babel/core").PluginItem} item
* @returns
*/
function dedupe(unique, item) {
if (item.file != null) {
const toDeleteIndex = unique.findIndex(
element =>
element.file && element.file.resolved === item.file.resolved
);
if (toDeleteIndex >= 0) {
unique.splice(toDeleteIndex, 1);
}
}
return [...unique, item];
}
return items.reduce((unique, configItem) => dedupe(unique, configItem), []);
}
/** @deprecated */
static default() {
return new BabelConfig().default();
}
/**
* Fetch the default Babel configuration.
*
* @internal
* @returns {BabelOptions}
*/
default() {
return {
cacheDirectory: true,
presets: [
['@babel/preset-env', { modules: false, forceAllTransforms: true }]
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread',
[
'@babel/plugin-transform-runtime',
{
helpers: false
}
]
]
};
}
}
module.exports = BabelConfig;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]-- |