@jk2908/solas 0.5.0 → 0.5.1
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.
- package/CHANGELOG.md +6 -0
- package/dist/internal/runtimes/mime.d.ts +1 -0
- package/dist/internal/runtimes/mime.js +35 -0
- package/dist/internal/runtimes/node.js +2 -2
- package/package.json +1 -3
- package/dist/adapters/bun.d.ts +0 -12
- package/dist/adapters/bun.js +0 -39
- package/dist/adapters/node.d.ts +0 -11
- package/dist/adapters/node.js +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 - 2026-06-06
|
|
4
|
+
|
|
5
|
+
- Fixed production app bundling by removing the `mime-types` package dependency from Solas runtime paths, preventing client bundles from resolving `/node_modules/mime-types/*` imports.
|
|
6
|
+
- Added an internal `getMimeTypeFromPath(...)` helper for Node runtime MIME resolution with a safe `application/octet-stream` fallback for unknown extensions.
|
|
7
|
+
- Removed obsolete `src/adapters/*` runtime adapter files so runtime selection now consistently uses the internal runtime implementations.
|
|
8
|
+
|
|
3
9
|
## 0.5.0 - 2026-06-06
|
|
4
10
|
|
|
5
11
|
- Added runtime selection via `runtime: 'auto' | 'node' | 'bun'`, with `auto` choosing Bun when available and falling back to Node otherwise.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMimeTypeFromPath(filePath: string): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const MIME_BY_EXT = {
|
|
3
|
+
'.txt': 'text/plain; charset=utf-8',
|
|
4
|
+
'.css': 'text/css; charset=utf-8',
|
|
5
|
+
'.html': 'text/html; charset=utf-8',
|
|
6
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
7
|
+
'.mjs': 'text/javascript; charset=utf-8',
|
|
8
|
+
'.cjs': 'text/javascript; charset=utf-8',
|
|
9
|
+
'.json': 'application/json; charset=utf-8',
|
|
10
|
+
'.map': 'application/json; charset=utf-8',
|
|
11
|
+
'.xml': 'application/xml; charset=utf-8',
|
|
12
|
+
'.svg': 'image/svg+xml',
|
|
13
|
+
'.png': 'image/png',
|
|
14
|
+
'.jpg': 'image/jpeg',
|
|
15
|
+
'.jpeg': 'image/jpeg',
|
|
16
|
+
'.gif': 'image/gif',
|
|
17
|
+
'.webp': 'image/webp',
|
|
18
|
+
'.avif': 'image/avif',
|
|
19
|
+
'.ico': 'image/x-icon',
|
|
20
|
+
'.woff': 'font/woff',
|
|
21
|
+
'.woff2': 'font/woff2',
|
|
22
|
+
'.ttf': 'font/ttf',
|
|
23
|
+
'.otf': 'font/otf',
|
|
24
|
+
'.eot': 'application/vnd.ms-fontobject',
|
|
25
|
+
'.pdf': 'application/pdf',
|
|
26
|
+
'.wasm': 'application/wasm',
|
|
27
|
+
'.mp4': 'video/mp4',
|
|
28
|
+
'.webm': 'video/webm',
|
|
29
|
+
'.mp3': 'audio/mpeg',
|
|
30
|
+
'.ogg': 'audio/ogg',
|
|
31
|
+
};
|
|
32
|
+
export function getMimeTypeFromPath(filePath) {
|
|
33
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
34
|
+
return MIME_BY_EXT[ext] ?? 'application/octet-stream';
|
|
35
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
|
-
import {
|
|
3
|
+
import { getMimeTypeFromPath } from './mime.js';
|
|
4
4
|
import { RuntimeBase } from './runtime.js';
|
|
5
5
|
export class RuntimeNode extends RuntimeBase {
|
|
6
6
|
async exists(filePath) {
|
|
@@ -20,7 +20,7 @@ export class RuntimeNode extends RuntimeBase {
|
|
|
20
20
|
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
21
21
|
}
|
|
22
22
|
mimeType(filePath) {
|
|
23
|
-
return
|
|
23
|
+
return getMimeTypeFromPath(filePath);
|
|
24
24
|
}
|
|
25
25
|
async write(filePath, content) {
|
|
26
26
|
await fs.writeFile(filePath, content);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jk2908/solas",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A Vite + React meta-framework exploring streaming, Server Components, and partial prerendering. Designed for simplicity and lightness",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -86,13 +86,11 @@
|
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@vitejs/plugin-rsc": "^0.5.20",
|
|
89
|
-
"mime-types": "^3.0.2",
|
|
90
89
|
"oxc-parser": "^0.134.0",
|
|
91
90
|
"path-to-regexp": "^8.3.0"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
94
93
|
"@prettier/plugin-oxc": "^0.1.3",
|
|
95
|
-
"@types/mime-types": "^3.0.1",
|
|
96
94
|
"@typescript/native-preview": "^7.0.0-dev.20260224.1",
|
|
97
95
|
"network-information-types": "^0.1.1",
|
|
98
96
|
"oxfmt": "^0.35.0",
|
package/dist/adapters/bun.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RuntimeBase } from '../internal/runtimes/runtime.js';
|
|
2
|
-
export declare class RuntimeBun extends RuntimeBase {
|
|
3
|
-
readonly name: "bun";
|
|
4
|
-
readonly module: string;
|
|
5
|
-
exists(filePath: string): Promise<boolean>;
|
|
6
|
-
readText(filePath: string): Promise<string>;
|
|
7
|
-
readBuffer(filePath: string): Promise<ArrayBuffer>;
|
|
8
|
-
mimeType(filePath: string): string;
|
|
9
|
-
write(filePath: string, content: string | NodeJS.ArrayBufferView): Promise<void>;
|
|
10
|
-
hash(value: string): string;
|
|
11
|
-
}
|
|
12
|
-
export default function bunAdapter(): RuntimeBun;
|
package/dist/adapters/bun.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { RuntimeBase } from '../internal/runtimes/runtime.js';
|
|
2
|
-
import { Solas } from '../solas.js';
|
|
3
|
-
export class RuntimeBun extends RuntimeBase {
|
|
4
|
-
name = 'bun';
|
|
5
|
-
module = `${Solas.Config.PKG_NAME}/adapters/bun`;
|
|
6
|
-
async exists(filePath) {
|
|
7
|
-
return Bun.file(filePath).exists();
|
|
8
|
-
}
|
|
9
|
-
readText(filePath) {
|
|
10
|
-
return Bun.file(filePath).text();
|
|
11
|
-
}
|
|
12
|
-
readBuffer(filePath) {
|
|
13
|
-
return Bun.file(filePath).arrayBuffer();
|
|
14
|
-
}
|
|
15
|
-
mimeType(filePath) {
|
|
16
|
-
return Bun.file(filePath).type || 'application/octet-stream';
|
|
17
|
-
}
|
|
18
|
-
async write(filePath, content) {
|
|
19
|
-
// normalise wider arraybuffer views into a shape Bun.write accepts directly
|
|
20
|
-
await Bun.write(filePath, typeof content === 'string'
|
|
21
|
-
? content
|
|
22
|
-
: content instanceof Uint8Array
|
|
23
|
-
? content
|
|
24
|
-
: new Uint8Array(content.buffer, content.byteOffset, content.byteLength));
|
|
25
|
-
}
|
|
26
|
-
hash(value) {
|
|
27
|
-
const hash = Bun.hash(value);
|
|
28
|
-
// Bun.hash returns an integer-like value, so keep it in BigInt space and avoid
|
|
29
|
-
// precision loss. Clamp it to an unsigned 64-bit value before hex
|
|
30
|
-
// formatting. Pad to 16 chars to match the Node adapter
|
|
31
|
-
// output shape
|
|
32
|
-
return BigInt.asUintN(64, typeof hash === 'bigint' ? hash : BigInt(hash))
|
|
33
|
-
.toString(16)
|
|
34
|
-
.padStart(16, '0');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export default function bunAdapter() {
|
|
38
|
-
return new RuntimeBun();
|
|
39
|
-
}
|
package/dist/adapters/node.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RuntimeBase } from '../internal/runtimes/runtime.js';
|
|
2
|
-
export declare class RuntimeNode extends RuntimeBase {
|
|
3
|
-
readonly name: "node";
|
|
4
|
-
readonly module: string;
|
|
5
|
-
exists(filePath: string): Promise<boolean>;
|
|
6
|
-
readText(filePath: string): Promise<string>;
|
|
7
|
-
readBuffer(filePath: string): Promise<ArrayBuffer>;
|
|
8
|
-
mimeType(filePath: string): string;
|
|
9
|
-
write(filePath: string, content: string | NodeJS.ArrayBufferView): Promise<void>;
|
|
10
|
-
hash(value: string): string;
|
|
11
|
-
}
|
package/dist/adapters/node.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import { lookup } from 'mime-types';
|
|
4
|
-
import { RuntimeBase } from '../internal/runtimes/runtime.js';
|
|
5
|
-
import { Solas } from '../solas.js';
|
|
6
|
-
export class RuntimeNode extends RuntimeBase {
|
|
7
|
-
name = 'node';
|
|
8
|
-
module = `${Solas.Config.PKG_NAME}/adapters/node`;
|
|
9
|
-
async exists(filePath) {
|
|
10
|
-
try {
|
|
11
|
-
await fs.access(filePath);
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
readText(filePath) {
|
|
19
|
-
return fs.readFile(filePath, 'utf-8');
|
|
20
|
-
}
|
|
21
|
-
async readBuffer(filePath) {
|
|
22
|
-
const buffer = await fs.readFile(filePath);
|
|
23
|
-
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
24
|
-
}
|
|
25
|
-
mimeType(filePath) {
|
|
26
|
-
return lookup(filePath) || 'application/octet-stream';
|
|
27
|
-
}
|
|
28
|
-
async write(filePath, content) {
|
|
29
|
-
await fs.writeFile(filePath, content);
|
|
30
|
-
}
|
|
31
|
-
hash(value) {
|
|
32
|
-
return createHash('sha256').update(value).digest('hex').slice(0, 16);
|
|
33
|
-
}
|
|
34
|
-
}
|