mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 11:50:14 +01:00
🧑💻 refactor: Secure Field Selection for 2FA & API Build Sourcemap (#9087)
* refactor: `packages/api` build scripts for better inline debugging * refactor: Explicitly select secure fields as no longer returned by default, exclude backupCodes from user data retrieval in authentication and 2FA processes * refactor: Backup Codes UI to not expect backup codes, only regeneration * refactor: Ensure secure fields are deleted from user data in getUserController
This commit is contained in:
parent
50b7bd6643
commit
3547873bc4
15 changed files with 82 additions and 31 deletions
|
|
@ -15,12 +15,15 @@
|
|||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "npm run clean && rollup -c --bundleConfigAsCjs",
|
||||
"build:watch": "rollup -c -w --bundleConfigAsCjs",
|
||||
"build:dev": "npm run clean && NODE_ENV=development rollup -c --bundleConfigAsCjs",
|
||||
"build:watch": "NODE_ENV=development rollup -c -w --bundleConfigAsCjs",
|
||||
"build:watch:prod": "rollup -c -w --bundleConfigAsCjs",
|
||||
"test": "jest --coverage --watch",
|
||||
"test:ci": "jest --coverage --ci",
|
||||
"verify": "npm run test:ci",
|
||||
"b:clean": "bun run rimraf dist",
|
||||
"b:build": "bun run b:clean && bun run rollup -c --silent --bundleConfigAsCjs",
|
||||
"b:build:dev": "bun run b:clean && NODE_ENV=development bun run rollup -c --silent --bundleConfigAsCjs",
|
||||
"start:everything-sse": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/examples/everything/sse.ts",
|
||||
"start:everything": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/demo/everything.ts",
|
||||
"start:filesystem": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/demo/filesystem.ts",
|
||||
|
|
@ -45,7 +48,6 @@
|
|||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^15.1.0",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/bun": "^1.2.15",
|
||||
"@types/diff": "^6.0.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// rollup.config.js
|
||||
import { readFileSync } from 'fs';
|
||||
import json from '@rollup/plugin-json';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
|
|
@ -10,13 +9,18 @@ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|||
|
||||
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
||||
|
||||
/**
|
||||
* Check if we're in development mode
|
||||
*/
|
||||
const isDevelopment = process.env.NODE_ENV === 'development';
|
||||
|
||||
const plugins = [
|
||||
peerDepsExternal(),
|
||||
resolve({
|
||||
preferBuiltins: true,
|
||||
}),
|
||||
replace({
|
||||
__IS_DEV__: process.env.NODE_ENV === 'development',
|
||||
__IS_DEV__: isDevelopment,
|
||||
preventAssignment: true,
|
||||
}),
|
||||
commonjs({
|
||||
|
|
@ -24,12 +28,18 @@ const plugins = [
|
|||
requireReturnsDefault: 'auto',
|
||||
}),
|
||||
typescript({
|
||||
tsconfig: './tsconfig.json',
|
||||
tsconfig: './tsconfig.build.json',
|
||||
outDir: './dist',
|
||||
sourceMap: true,
|
||||
inlineSourceMap: true,
|
||||
/**
|
||||
* Remove inline sourcemaps - they conflict with external sourcemaps
|
||||
*/
|
||||
inlineSourceMap: false,
|
||||
/**
|
||||
* Always include source content in sourcemaps for better debugging
|
||||
*/
|
||||
inlineSources: true,
|
||||
}),
|
||||
terser(),
|
||||
json(),
|
||||
];
|
||||
|
||||
|
|
@ -41,6 +51,20 @@ const cjsBuild = {
|
|||
sourcemap: true,
|
||||
exports: 'named',
|
||||
entryFileNames: '[name].js',
|
||||
/**
|
||||
* Always include sources in sourcemap for better debugging
|
||||
*/
|
||||
sourcemapExcludeSources: false,
|
||||
/**
|
||||
* Use absolute paths in sourcemaps for better IDE support
|
||||
*/
|
||||
sourcemapPathTransform: (relativeSourcePath) => {
|
||||
/**
|
||||
* Convert to absolute path for better debugger support
|
||||
*/
|
||||
const path = require('path');
|
||||
return path.resolve(relativeSourcePath);
|
||||
},
|
||||
},
|
||||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})],
|
||||
preserveSymlinks: true,
|
||||
|
|
|
|||
12
packages/api/tsconfig.build.json
Normal file
12
packages/api/tsconfig.build.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"declarationMap": true
|
||||
},
|
||||
"exclude": ["node_modules", "dist", "types", "src/**/*.test.ts", "src/**/*.spec.ts"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue