<commit_before>import type { ValueParser } from 'postcss-value-parser';
import { applyUpdates, FileUpdate } from '../../lib/file-update.js';
import { AngularCompilerLib, HtmlAst, updateCssClassNames } from '../../lib/html-ast.js';
import { addForwardRule, commentNode, PostCssLib, PostCssScssLib, removeContainerIfEmpty, removeImportNode } from '../../lib/scss-ast.js';
import { mixinRegistry } from './mixin-registry.js';
import { commentSassFuncWithVar, updateColorMixin } from './updaters/color.js';
import { updateElevation } from './updaters/elevation.js';
import { updateGetSetFunctions } from './updaters/get-set.js';
import { updateIconSizing } from './updaters/icon-sizing.js';
import { removeIE11ThemeSupport } from './updaters/ie11.js';
import { updateMainImport } from './updaters/main-import.js';
import { replaceFuncMixinsWithoutInclude, replaceIncludedMixin } from './updaters/mixins.js';
import { removeScssPlaceholders } from './updaters/remove-scss-placeholder.js';
import { updateThemeMixin } from './updaters/theme.js';

export function migrateScssFile(content: string, postCss: PostCssLib, postCssScss: PostCssScssLib, postcssValueParser: ValueParser): string {
	const root = postCssScss.parse(content);

	root.walkAtRules('import', (rule) => {
		['@lucca-front/scss/src/mixins', '@lucca-front/icons/src/mixins', '@lucca-front/scss/src/icons', 'theming'].some((name) => removeImportNode(rule, name, postcssValueParser));
	});

	removeScssPlaceholders(root, postcssValueParser);
	removeIE11ThemeSupport(root, postcssValueParser);
	updateIconSizing(root, postCss, postcssValueParser);
	updateColorMixin(root, postcssValueParser);
	updateThemeMixin(root, postCss, postcssValueParser);
	updateGetSetFunctions(root, postCss, postcssValueParser);
	updateElevation(root, postCss, postcssValueParser);
	updateMainImport(root, postCss, postcssValueParser);
	commentSassFuncWithVar(root, postCss);
<commit_msg>fix(schematics): clean scss imports with a leading underscore<commit_after>import type { ValueParser } from 'postcss-value-parser';
import { applyUpdates, FileUpdate } from '../../lib/file-update.js';
import { AngularCompilerLib, HtmlAst, updateCssClassNames } from '../../lib/html-ast.js';
import { addForwardRule, commentNode, PostCssLib, PostCssScssLib, removeContainerIfEmpty, removeImportNode } from '../../lib/scss-ast.js';
import { mixinRegistry } from './mixin-registry.js';
import { commentSassFuncWithVar, updateColorMixin } from './updaters/color.js';
import { updateElevation } from './updaters/elevation.js';
import { updateGetSetFunctions } from './updaters/get-set.js';
import { updateIconSizing } from './updaters/icon-sizing.js';
import { removeIE11ThemeSupport } from './updaters/ie11.js';
import { updateMainImport } from './updaters/main-import.js';
import { replaceFuncMixinsWithoutInclude, replaceIncludedMixin } from './updaters/mixins.js';
import { removeScssPlaceholders } from './updaters/remove-scss-placeholder.js';
import { updateThemeMixin } from './updaters/theme.js';

export function migrateScssFile(content: string, postCss: PostCssLib, postCssScss: PostCssScssLib, postcssValueParser: ValueParser): string {
	const root = postCssScss.parse(content);

	root.walkAtRules('import', (rule) => {
		['@lucca-front/scss/src/mixins', '@lucca-front/icons/src/mixins', '@lucca-front/scss/src/_mixins', '@lucca-front/icons/src/_mixins', '@lucca-front/scss/src/icons', 'theming'].some((name) =>
			removeImportNode(rule, name, postcssValueParser),
		);
	});

	removeScssPlaceholders(root, postcssValueParser);
	removeIE11ThemeSupport(root, postcssValueParser);
	updateIconSizing(root, postCss, postcssValueParser);
	updateColorMixin(root, postcssValueParser);
	updateThemeMixin(root, postCss, postcssValueParser);
	updateGetSetFunctions(root, postCss, postcssValueParser);
	updateElevation(root, postCss, postcssValueParser);
	updateMainImport(root, postCss, postcssValueParser);
	commentSassFuncWithVar(root, postCss);

{'fraction_non_alphanumeric': 0.13975782038345105, 'fraction_numerical': 0.0030272452068617556, 'mean_word_length': 6.481132075471698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '4039987', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1273, 'n_words': 235}