mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 21:36:48 +08:00
* 🐛 (feature-flags.ts): update usage of process.env to import.meta.env for Vite compatibility 🔧 (vite.config.mts): replace process.env with import.meta.env in Vite configuration for better integration with Vite bundler * 🔧 (constants.ts): replace process.env with import.meta.env for Vite compatibility 🔧 (vite-env.d.ts): declare ImportMetaEnv and ImportMeta interfaces for Vite compatibility * ✨ (jest.config.js): Update Jest configuration to use a custom transformer for replacing import.meta.env with process.env for compatibility ✨ (transform-import-meta.js): Add custom Jest transformer to replace import.meta.env with process.env for compatibility with Jest testing framework * [autofix.ci] apply automated fixes --------- Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
23 lines
657 B
JavaScript
23 lines
657 B
JavaScript
// Custom Jest transformer to replace import.meta.env with process.env
|
|
const tsJest = require("ts-jest").default;
|
|
|
|
module.exports = {
|
|
createTransformer() {
|
|
const tsJestTransformer = tsJest.createTransformer();
|
|
|
|
return {
|
|
...tsJestTransformer,
|
|
process(sourceText, sourcePath, options) {
|
|
// Replace import.meta.env with process.env before ts-jest processes it
|
|
let modifiedSource = sourceText.replace(
|
|
/import\.meta\.env/g,
|
|
"process.env",
|
|
);
|
|
|
|
// Call the original ts-jest transformer
|
|
return tsJestTransformer.process(modifiedSource, sourcePath, options);
|
|
},
|
|
};
|
|
},
|
|
};
|