feat: add modules/storage export and bundle config files
- Add `./modules/storage` package export pointing to `modules.storage.js` - Add `modules/*/config.js` to tsup build entries for server-only configs - Add `@zen/core/modules/storage` to external dependencies in tsup config - Add `src/modules/modules.storage.js` to the second tsup build target - Update storage handler to import via `@zen/core/modules/storage` alias - Rename unused `request` param to `_request` in `handleGetFile`
This commit is contained in:
@@ -133,6 +133,9 @@
|
||||
"./modules/actions": {
|
||||
"import": "./dist/modules/modules.actions.js"
|
||||
},
|
||||
"./modules/storage": {
|
||||
"import": "./dist/modules/modules.storage.js"
|
||||
},
|
||||
"./modules/posts/crud": {
|
||||
"import": "./dist/modules/posts/crud.js"
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { validateSession } from '../../../features/auth/lib/session.js';
|
||||
import { cookies } from 'next/headers';
|
||||
import { getSessionCookieName } from '../../../shared/lib/appConfig.js';
|
||||
import { getAllStoragePublicPrefixes } from '../../../../modules/modules.storage.js';
|
||||
import { getAllStoragePublicPrefixes } from '@zen/core/modules/storage';
|
||||
import { getFile } from '@zen/core/storage';
|
||||
|
||||
// Get cookie name from environment or use default
|
||||
@@ -18,7 +18,7 @@ const COOKIE_NAME = getSessionCookieName();
|
||||
* @param {string} fileKey - The file key/path in storage
|
||||
* @returns {Promise<Response|Object>} File response or error object
|
||||
*/
|
||||
export async function handleGetFile(request, fileKey) {
|
||||
export async function handleGetFile(_request, fileKey) {
|
||||
try {
|
||||
// Reject any path that contains traversal sequences, empty segments, or
|
||||
// absolute path indicators before splitting or passing to the storage backend.
|
||||
|
||||
+4
-2
@@ -28,10 +28,11 @@ export default defineConfig([
|
||||
'src/modules/init.js',
|
||||
'src/modules/pages.js',
|
||||
'src/modules/modules.metadata.js',
|
||||
// Module actions, API and CRUD (bundled to resolve relative imports)
|
||||
// Module actions, API, CRUD and server-only config (bundled to resolve relative imports)
|
||||
'src/modules/*/actions.js',
|
||||
'src/modules/*/api.js',
|
||||
'src/modules/*/crud.js',
|
||||
'src/modules/*/config.js',
|
||||
'src/shared/lib/metadata/index.js',
|
||||
],
|
||||
format: ['esm'],
|
||||
@@ -39,7 +40,7 @@ export default defineConfig([
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
external: ['react', 'react-dom', 'next', 'pg', 'dotenv', 'dotenv/config', 'resend', '@react-email/components', 'node-cron', 'readline', 'crypto', 'url', 'fs', 'path', 'net', 'dns', 'tls', '@zen/core/database', '@zen/core/email', '@zen/core/email/templates', '@zen/core/storage', '@zen/core/toast', '@zen/core/modules/actions', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner'],
|
||||
external: ['react', 'react-dom', 'next', 'pg', 'dotenv', 'dotenv/config', 'resend', '@react-email/components', 'node-cron', 'readline', 'crypto', 'url', 'fs', 'path', 'net', 'dns', 'tls', '@zen/core/database', '@zen/core/email', '@zen/core/email/templates', '@zen/core/storage', '@zen/core/toast', '@zen/core/modules/actions', '@zen/core/modules/storage', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner'],
|
||||
noExternal: [],
|
||||
bundle: true,
|
||||
banner: {
|
||||
@@ -63,6 +64,7 @@ export default defineConfig([
|
||||
'src/features/admin/navigation.server.js',
|
||||
'src/modules/page.js',
|
||||
'src/modules/modules.actions.js',
|
||||
'src/modules/modules.storage.js',
|
||||
],
|
||||
format: ['esm'],
|
||||
dts: false,
|
||||
|
||||
Reference in New Issue
Block a user