UNPKG

@nx/vite

Version:

The Nx Plugin for building and testing applications using Vite

50 lines (49 loc) 2.08 kB
"use strict"; Object.defineProperty(exports, "previewPostTargetTransformer", { enumerable: true, get: function() { return previewPostTargetTransformer; } }); const _utils = require("./utils"); function previewPostTargetTransformer(migrationLogs) { return (target, tree, projectDetails, inferredTargetConfiguration)=>{ const viteConfigPath = (0, _utils.getViteConfigPath)(tree, projectDetails.root); if (target.options) { removePropertiesFromTargetOptions(target.options, projectDetails.projectName, migrationLogs); } if (target.configurations) { for(const configurationName in target.configurations){ const configuration = target.configurations[configurationName]; removePropertiesFromTargetOptions(configuration, projectDetails.projectName, migrationLogs); } if (Object.keys(target.configurations).length === 0) { if ('defaultConfiguration' in target) { delete target.defaultConfiguration; } delete target.configurations; } if ('defaultConfiguration' in target && !target.configurations[target.defaultConfiguration]) { delete target.defaultConfiguration; } } return target; }; } function removePropertiesFromTargetOptions(targetOptions, projectName, migrationLogs) { if ('buildTarget' in targetOptions) { delete targetOptions.buildTarget; } if ('staticFilePath' in targetOptions) { delete targetOptions.staticFilePath; } if ('proxyConfig' in targetOptions) { migrationLogs.addLog({ executorName: '@nx/vite:preview-server', project: projectName, log: `Encountered 'proxyConfig' in project.json. You will need to copy the contents of this file to the 'server.proxy' property in your Vite config file.` }); delete targetOptions.proxyConfig; } } //# sourceMappingURL=preview-post-target-transformer.js.map