hyperspan 1.0.7 → 1.0.9

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 +2 -2
  2. package/src/server.ts +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperspan",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Hyperspan CLI - for @hyperspan/framework",
5
5
  "type": "module",
6
6
  "public": true,
@@ -33,7 +33,7 @@
33
33
  "test": "bun test"
34
34
  },
35
35
  "dependencies": {
36
- "@hyperspan/framework": "^1.0.13",
36
+ "@hyperspan/framework": "^1.0.14",
37
37
  "bun-plugin-tailwind": "^0.1.2",
38
38
  "commander": "^14.0.3",
39
39
  "degit": "^2.8.4"
package/src/server.ts CHANGED
@@ -131,17 +131,24 @@ export async function addDirectoryAsRoutes(
131
131
  plugins: [tailwind],
132
132
  entrypoints: [filePath],
133
133
  outdir: buildDir,
134
- naming: `${relativeAppPath}/${path.endsWith('/') ? path + 'index' : path}-[hash].[ext]`,
134
+ naming: `${relativeAppPath}/${filePath.split('/').pop()}-[hash].[ext]`,
135
135
  minify: IS_PROD,
136
136
  format: 'esm',
137
137
  target: 'node',
138
+ // Only extract CSS — don't bundle framework packages or component files.
139
+ // Under bun --watch, bundling @hyperspan/* causes EISDIR path collisions.
140
+ external: ['@hyperspan/*', '*.vue', '*.svelte', '*.tsx', '*.jsx'],
138
141
  });
139
142
 
140
143
  // Move CSS files to the public directory
141
144
  for (const output of buildResult.outputs) {
142
145
  if (output.path.endsWith('.css')) {
143
- const cssFileName = output.path.split('/').pop()!;
144
- await Bun.write(join(cssPublicDir, cssFileName), Bun.file(output.path));
146
+ // Use content hash for filename so that we don't duplicate CSS files with the same content (helps browser caching).
147
+ const contentHash = output.hash;
148
+ const cssFileName = `${contentHash}.css`;
149
+ const cssOutputFile = Bun.file(output.path);
150
+ await Bun.write(join(cssPublicDir, cssFileName), cssOutputFile);
151
+ cssOutputFile.delete();
145
152
  cssFiles.push(cssFileName);
146
153
  }
147
154
  }