@jk2908/solas 0.5.0 → 0.5.2

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2 - 2026-06-06
4
+
5
+ - Fixed browser bundling regressions caused by exposing runtime creation through `Solas.Runtime.create(...)` in the shared `$` export path.
6
+ - Removed `Solas.Runtime.create(...)` and moved runtime selection to a server-only `createRuntime(...)` helper under internal runtimes.
7
+ - Updated plugin/runtime entry generation to call `createRuntime(...)` from `env/rsc`, keeping browser-reachable modules free of Node runtime imports.
8
+
9
+ ## 0.5.1 - 2026-06-06
10
+
11
+ - 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.
12
+ - Added an internal `getMimeTypeFromPath(...)` helper for Node runtime MIME resolution with a safe `application/octet-stream` fallback for unknown extensions.
13
+ - Removed obsolete `src/adapters/*` runtime adapter files so runtime selection now consistently uses the internal runtime implementations.
14
+
3
15
  ## 0.5.0 - 2026-06-06
4
16
 
5
17
  - Added runtime selection via `runtime: 'auto' | 'node' | 'bun'`, with `auto` choosing Bun when available and falling back to Node otherwise.
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import { writeMaps } from './internal/codegen/maps.js';
14
14
  import { writeTypes } from './internal/codegen/types.js';
15
15
  import { postbuild } from './internal/postbuild.js';
16
16
  import { collect as collectPublicFiles } from './internal/public-files.js';
17
+ import { createRuntime } from './internal/runtimes/create.js';
17
18
  import { Runtime } from './internal/runtimes/runtime.js';
18
19
  import { Solas } from './solas.js';
19
20
  const DEFAULT_CONFIG = {
@@ -33,7 +34,7 @@ function solas(c) {
33
34
  ...validatedConfig,
34
35
  runtime: validatedConfig.runtime ?? DEFAULT_CONFIG.runtime,
35
36
  };
36
- Runtime.runtime = Solas.Runtime.create(config.runtime);
37
+ Runtime.runtime = createRuntime(config.runtime);
37
38
  if (config.logger?.level)
38
39
  Logger.defaultLevel = config.logger.level;
39
40
  const logger = new Logger();
@@ -8,14 +8,14 @@ export function writeRSCEntry(config) {
8
8
  return source `
9
9
  ${AUTOGEN_MSG}
10
10
 
11
- import { createHandler, Runtime } from '${Solas.Config.PKG_NAME}/env/rsc'
11
+ import { createHandler, createRuntime, Runtime } from '${Solas.Config.PKG_NAME}/env/rsc'
12
12
  import { Solas } from '${Solas.Config.PKG_NAME}/$'
13
13
 
14
14
  import { manifest } from './manifest.js'
15
15
  import { importMap } from './maps.js'
16
16
  import { config } from './config.js'
17
17
 
18
- Runtime.runtime = Solas.Runtime.create(${runtime})
18
+ Runtime.runtime = createRuntime(${runtime})
19
19
  const runtimeManifest = await Solas.Runtime.loadManifest(Solas.Config.OUT_DIR)
20
20
 
21
21
  export default createHandler(config, manifest, importMap, runtimeManifest)
@@ -2,6 +2,7 @@ import type { ReactFormState } from 'react-dom/client';
2
2
  import type { ImportMap, Manifest, RuntimeConfig } from '../../types.js';
3
3
  import { Solas } from '../../solas.js';
4
4
  import { Metadata } from '../metadata.js';
5
+ export { createRuntime } from '../runtimes/create.js';
5
6
  export { Runtime } from '../runtimes/runtime.js';
6
7
  export type RscPayload = {
7
8
  returnValue?: {
@@ -17,6 +17,7 @@ import { processActionRequest } from '../server/actions.js';
17
17
  import DefaultErr from '../ui/defaults/error.js';
18
18
  import { RequestContext } from './request-context.js';
19
19
  import { getKnownDigest, isKnownError } from './utils.js';
20
+ export { createRuntime } from '../runtimes/create.js';
20
21
  export { Runtime } from '../runtimes/runtime.js';
21
22
  const logger = new Logger();
22
23
  const BASE_PATH = BasePath.normalise(import.meta.env.BASE_URL);
@@ -0,0 +1,4 @@
1
+ import type { Runtime } from '../../types.js';
2
+ import { RuntimeBun } from './bun.js';
3
+ import { RuntimeNode } from './node.js';
4
+ export declare function createRuntime(runtime: Runtime): RuntimeBun | RuntimeNode;
@@ -0,0 +1,9 @@
1
+ import { RuntimeBun } from './bun.js';
2
+ import { RuntimeNode } from './node.js';
3
+ export function createRuntime(runtime) {
4
+ if (runtime === 'bun' ||
5
+ (runtime === 'auto' && typeof globalThis.Bun !== 'undefined')) {
6
+ return new RuntimeBun();
7
+ }
8
+ return new RuntimeNode();
9
+ }
@@ -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 { lookup } from 'mime-types';
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 lookup(filePath) || 'application/octet-stream';
23
+ return getMimeTypeFromPath(filePath);
24
24
  }
25
25
  async write(filePath, content) {
26
26
  await fs.writeFile(filePath, content);
package/dist/solas.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { Prerender } from './internal/prerender.js';
2
- import type { PluginConfig, Runtime } from './types.js';
3
- import { Runtime as InternalRuntime } from './internal/runtimes/runtime.js';
2
+ import type { PluginConfig } from './types.js';
4
3
  export declare namespace Solas {
5
4
  interface Routes {
6
5
  }
@@ -36,7 +35,6 @@ export declare namespace Solas {
36
35
  artifacts: Prerender.Artifact.Manifest;
37
36
  publicFiles: ReadonlySet<string>;
38
37
  };
39
- function create(runtime: Runtime): InternalRuntime.Impl;
40
38
  function getManifestPath(outDir: string): string;
41
39
  function loadManifest(outDir: string): Promise<Manifest | null>;
42
40
  }
package/dist/solas.js CHANGED
@@ -1,5 +1,3 @@
1
- import { RuntimeBun } from './internal/runtimes/bun.js';
2
- import { RuntimeNode } from './internal/runtimes/node.js';
3
1
  import { Runtime as InternalRuntime } from './internal/runtimes/runtime.js';
4
2
  export { Solas };
5
3
  var Solas;
@@ -171,14 +169,6 @@ var Solas;
171
169
  Solas.getVersion = getVersion;
172
170
  let Runtime;
173
171
  (function (Runtime) {
174
- function create(runtime) {
175
- if (runtime === 'bun' ||
176
- (runtime === 'auto' && typeof globalThis.Bun !== 'undefined')) {
177
- return new RuntimeBun();
178
- }
179
- return new RuntimeNode();
180
- }
181
- Runtime.create = create;
182
172
  const manifestCache = new Map();
183
173
  function getManifestPath(outDir) {
184
174
  return [outDir, Config.GENERATED_DIR, Config.RUNTIME_MANIFEST]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/solas",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",
@@ -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;
@@ -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
- }
@@ -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
- }
@@ -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
- }