@jhits/dashboard 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -2
  2. package/src/config.ts +56 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhits/dashboard",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A comprehensive dashboard system built to manage custom built websites - plugin based SaaS system.",
5
5
  "main": "./src/index.tsx",
6
6
  "types": "./src/index.tsx",
@@ -30,7 +30,9 @@
30
30
  }
31
31
  },
32
32
  "scripts": {
33
- "lint": "eslint"
33
+ "lint": "eslint",
34
+ "type-check": "tsc --noEmit",
35
+ "type-check:all": "bash ../check-types.sh"
34
36
  },
35
37
  "dependencies": {
36
38
  "@jhits/plugin-blog": "^0.0.1",
package/src/config.ts CHANGED
@@ -79,7 +79,7 @@ async function ensureDashboardRoutes() {
79
79
  writeFileSync(catchAllPath, `// Auto-generated by @jhits/dashboard - do not edit manually
80
80
  export { default } from '@jhits/dashboard/catch-all';
81
81
  `);
82
- } catch (error) {
82
+ } catch {
83
83
  // Silently fail - routes might already exist or be manually created
84
84
  }
85
85
  }
@@ -138,7 +138,7 @@ function findJhitsPackages(): string[] {
138
138
 
139
139
  // Always include the base @jhits pattern for any other packages
140
140
  return jhitsPackages.length > 0 ? jhitsPackages : ['@jhits'];
141
- } catch (error) {
141
+ } catch {
142
142
  // Fallback to wildcard on any error
143
143
  console.warn('[withJhitsDashboard] Could not read package.json, using @jhits wildcard');
144
144
  return ['@jhits'];
@@ -162,7 +162,7 @@ export function withJhitsDashboard(nextConfig: NextConfig = {}): NextConfig {
162
162
  try {
163
163
  ensureDashboardRoutes();
164
164
  // ensureUserManagementRoutes(); // Disabled - routes are handled by plugin-users via plugin router
165
- } catch (error) {
165
+ } catch {
166
166
  // Ignore errors - routes might already exist
167
167
  }
168
168
  }
@@ -209,15 +209,64 @@ export function withJhitsDashboard(nextConfig: NextConfig = {}): NextConfig {
209
209
  net: false,
210
210
  tls: false,
211
211
  crypto: false,
212
+ stream: false,
213
+ util: false,
214
+ url: false,
215
+ http: false,
216
+ https: false,
217
+ zlib: false,
218
+ os: false,
219
+ buffer: false,
220
+ process: false,
221
+ // WASI modules
222
+ wasi_snapshot_preview1: false,
212
223
  };
213
224
 
214
- // Prevent server-only plugins from being bundled into client
215
- // plugin-dep is server-only and should never be imported by client code
225
+ // Prevent server-only packages from being bundled into client
226
+ const serverOnlyPackages = [
227
+ '@jhits/plugin-dep',
228
+ 'nodemailer',
229
+ 'mongodb',
230
+ 'bcrypt',
231
+ 'bcryptjs',
232
+ 'jsonwebtoken',
233
+ ];
234
+
216
235
  config.externals = config.externals || [];
217
236
  if (Array.isArray(config.externals)) {
218
- config.externals.push('@jhits/plugin-dep');
237
+ config.externals.push(...serverOnlyPackages);
219
238
  } else if (typeof config.externals === 'object') {
220
- config.externals['@jhits/plugin-dep'] = '@jhits/plugin-dep';
239
+ serverOnlyPackages.forEach((pkg) => {
240
+ config.externals[pkg] = pkg;
241
+ });
242
+ } else if (typeof config.externals === 'function') {
243
+ const originalExternals = config.externals;
244
+ config.externals = (
245
+ context: string,
246
+ request: string,
247
+ callback: (err?: Error | null, result?: string) => void
248
+ ) => {
249
+ if (serverOnlyPackages.includes(request)) {
250
+ return callback(null, `commonjs ${request}`);
251
+ }
252
+ return originalExternals(context, request, callback);
253
+ };
254
+ }
255
+
256
+ // Ignore server-only plugin files using IgnorePlugin
257
+ // This prevents webpack from trying to bundle server-only files
258
+ try {
259
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
260
+ const webpack = require('webpack');
261
+ config.plugins = config.plugins || [];
262
+ config.plugins.push(
263
+ new webpack.IgnorePlugin({
264
+ resourceRegExp: /^@jhits\/plugin-dep\/src\/(actions|router|index\.server)$/,
265
+ })
266
+ );
267
+ } catch {
268
+ // webpack might not be available in all contexts (e.g., Turbopack)
269
+ // This is fine - the externals and browser field should handle it
221
270
  }
222
271
  }
223
272
  return config;