<commit_before>'use strict';

/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

include('build/filters');

const
	$C = require('collection.js'),
	Snakeskin = require('snakeskin'),
	escaper = require('escaper');

const componentsTree = module.exports = {
	getComponentPropAttrs(name) {
		name = name.camelize(false);

		if (!this[name]) {
			throw new Error(`The specified component "${name}" is not defined`);
		}

		return $C(this[name].props)
			.object(true)
			.to({})
			.reduce((map, el, key) => (map[`:${key}`] = key, map));
	}
};

const
	fs = require('fs'),
	path = require('upath'),
	glob = require('glob');

const
	{validators, resolve} = require('@pzlr/build-core'),
	{attachVIf} = include('build/filters/helpers');

const
	resources = [resolve.blockSync(), ...resolve.dependencies],
	components = `/**/@(${validators.blockTypeList.join('|')})-*.@(ts|js)`,
	files = $C(resources).reduce((arr, el) => arr.concat(glob.sync(path.join(el, components))), []).reverse();

const
	componentClassRgxp = /^\s*export\s+default\s+class\s+(([\s\S]*?)\s+extends\s+[\s\S]*?)\s*{/m,
	componentRgxp = /@component\(([^@]*?)\)\n+\s*export\s+/,
	propsRgxp = /^(\t+)@prop\s*\([^@]+?\)+\n+\1([ \w$]+)(?:\??: [ \w|&$?()[\]{}<>'"`:.]+?)?\s*(?:=|;$)/gm;

const
	genericRgxp = /<.*|\s.*/g,
	extendsRgxp = /\s+extends\s+/;

$C(files).forEach((el) => {
	const
		file = escaper.replace(fs.readFileSync(el, {encoding: 'utf-8'})),
		componentClass = componentClassRgxp.exec(file);

	const
		p = ((v) => v && new Function(`return ${escaper.paste(v[1]) || '{}'}`)())(componentClass && componentRgxp.exec(file));

	if (!p) {
		return;
	}

	const
		component = componentClass[2].replace(genericRgxp, ''),
		parent = componentClass[1].split(extendsRgxp).slice(-1)[0].replace(genericRgxp, '');

	const obj = componentsTree[component] = componentsTree[component] || {
		props: {},
		parent
	};

	if (p.functional != null) {
		obj.functional = p.functional;
	}

	if (p.inheritMods != null) {<commit_msg>Fixed @prop regexp<commit_after>'use strict';

/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

include('build/filters');

const
	$C = require('collection.js'),
	Snakeskin = require('snakeskin'),
	escaper = require('escaper');

const componentsTree = module.exports = {
	getComponentPropAttrs(name) {
		name = name.camelize(false);

		if (!this[name]) {
			throw new Error(`The specified component "${name}" is not defined`);
		}

		return $C(this[name].props)
			.object(true)
			.to({})
			.reduce((map, el, key) => (map[`:${key}`] = key, map));
	}
};

const
	fs = require('fs'),
	path = require('upath'),
	glob = require('glob');

const
	{validators, resolve} = require('@pzlr/build-core'),
	{attachVIf} = include('build/filters/helpers');

const
	resources = [resolve.blockSync(), ...resolve.dependencies],
	components = `/**/@(${validators.blockTypeList.join('|')})-*.@(ts|js)`,
	files = $C(resources).reduce((arr, el) => arr.concat(glob.sync(path.join(el, components))), []).reverse();

const
	componentClassRgxp = /^\s*export\s+default\s+class\s+(([\s\S]*?)\s+extends\s+[\s\S]*?)\s*{/m,
	componentRgxp = /@component\(([^@]*?)\)\n+\s*export\s+/,
	propsRgxp = /^(\t+)@prop\s*\([^@]+?\)+\n+\1([ \w$]+)(?:[\?!]?:\s*[ \w|&$?()\[\]{}<>'"`:.]+?)?\s*(?:=|;$)/gm;

const
	genericRgxp = /<.*|\s.*/g,
	extendsRgxp = /\s+extends\s+/;

$C(files).forEach((el) => {
	const
		file = escaper.replace(fs.readFileSync(el, {encoding: 'utf-8'})),
		componentClass = componentClassRgxp.exec(file);

	const
		p = ((v) => v && new Function(`return ${escaper.paste(v[1]) || '{}'}`)())(componentClass && componentRgxp.exec(file));

	if (!p) {
		return;
	}

	const
		component = componentClass[2].replace(genericRgxp, ''),
		parent = componentClass[1].split(extendsRgxp).slice(-1)[0].replace(genericRgxp, '');

	const obj = componentsTree[component] = componentsTree[component] || {
		props: {},
		parent
	};

	if (p.functional != null) {
		obj.functional = p.functional;
	}

	if (p.inheritMods != null) {
{'fraction_non_alphanumeric': 0.25089691461372876, 'fraction_numerical': 0.004783544606553456, 'mean_word_length': 4.488188976377953, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '892684', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1613, 'n_words': 252}