nuclie 1.0.2 → 1.0.3

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.
@@ -797,7 +797,7 @@ export async function startDevServer(cliCfg, existingServer) {
797
797
  }
798
798
  return;
799
799
  }
800
- if (url === '/@nuclie/client') {
800
+ if (url === '/@nuclie/client' || url === '/@nexxo/client') {
801
801
  const clientPath = path.resolve(__dirname, '../runtime/client.ts');
802
802
  try {
803
803
  const raw = await fs.readFile(clientPath, 'utf-8');
@@ -1148,12 +1148,32 @@ ${raw}
1148
1148
  res.end(data);
1149
1149
  }
1150
1150
  catch (e) {
1151
+ if (e.code === 'ENOENT') {
1152
+ if (url === '/service-worker.js') {
1153
+ // Serve a dummy service worker that forcibly unregisters itself
1154
+ // This fixes issues when a browser has strongly cached an old SW
1155
+ res.writeHead(200, { 'Content-Type': 'application/javascript' });
1156
+ res.end(`
1157
+ self.addEventListener('install', () => self.skipWaiting());
1158
+ self.addEventListener('activate', (e) => {
1159
+ e.waitUntil(self.registration.unregister().then(() => self.clients.claim()));
1160
+ });
1161
+ `);
1162
+ return;
1163
+ }
1164
+ // Just return 404 cleanly without blasting the console for every missing map or img
1165
+ if (!res.headersSent) {
1166
+ res.writeHead(404);
1167
+ res.end('Not found');
1168
+ }
1169
+ return;
1170
+ }
1151
1171
  log.error(`Request error: ${e.message}`, { category: 'server' });
1152
1172
  if (process.env.DEBUG || process.env.NODE_ENV === 'test') {
1153
1173
  console.error(e.stack);
1154
1174
  }
1155
1175
  else {
1156
- // Always show stack for request errors in dev mode for visibility
1176
+ // Always show stack for actual request errors (not 404s) in dev mode for visibility
1157
1177
  console.error(e);
1158
1178
  }
1159
1179
  const isJS = url.match(/\.(js|ts|tsx|jsx|mjs|vue|svelte|astro)/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuclie",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "⚡ Fast build tool with HMR, source maps, tree shaking, and module federation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -166,4 +166,4 @@
166
166
  "tsx": "^4.21.0",
167
167
  "typescript": "^5.4.2"
168
168
  }
169
- }
169
+ }