/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ const fs = require('fs'); const webpack = require('webpack'); const fancyLog = require('fancy-log'); const ansiColors = require('ansi-colors'); const { Mangler } = require('../build/lib/mangleTypeScript'); /** * Map of project paths to mangled file contents * * @type {Map>} */ const mangleMap = new Map(); /** * @param {string} projectPath */ function getMangledFileContents(projectPath) { let entry = mangleMap.get(projectPath); if (!entry) { const log = (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data); log(`Mangling ${projectPath}`); const ts2tsMangler = new Mangler(projectPath, log); entry = ts2tsMangler.computeNewFileContents(); mangleMap.set(projectPath, entry); } return entry; } /** * @type {webpack.LoaderDefinitionFunction} */ module.exports = async function (source, sourceMap, meta) { return source; // {{SQL CARBON EDIT}} skip mangling };