flashts 1.0.8 → 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.
- package/CHANGELOG.md +6 -8
- package/bin/cli.ts +2 -2
- package/package.json +2 -5
- package/server/index.ts +32 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
All notable changes to FlashTS will be documented in this file.
|
|
4
|
-
|
|
5
|
-
## [1.0.8] - 2026-01-25
|
|
1
|
+
## [1.0.9] - 2026-01-25
|
|
6
2
|
|
|
7
3
|
### Fixed
|
|
8
4
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
5
|
+
- **Vite Stability**: Reverted to standard Vite (v6) from rolldown-vite to improve production reliability and module resolution.
|
|
6
|
+
- **Robust Path Resolution**: Implemented dynamic path detection using `Bun.resolveSync` to find Vite and its plugins, making the CLI resilient to different installation structures (npm, pnpm, yarn).
|
|
7
|
+
- **Module Resolution**: Fixed `ReferenceError` and improved module alias configuration in the generated `vite.config.ts`.
|
|
8
|
+
|
|
9
|
+
## [1.0.8] - 2026-01-25
|
|
12
10
|
|
|
13
11
|
## [1.0.7] - 2026-01-25
|
|
14
12
|
|
package/bin/cli.ts
CHANGED
|
@@ -10,7 +10,7 @@ const program = new Command();
|
|
|
10
10
|
program
|
|
11
11
|
.name("flashts")
|
|
12
12
|
.description("FlashTS: High-performance TypeScript Playground CLI")
|
|
13
|
-
.version("1.0.
|
|
13
|
+
.version("1.0.9")
|
|
14
14
|
.option("-p, --port <number>", "Port to run the server on", "3000")
|
|
15
15
|
.option("-s, --share", "Generate a shareable public link")
|
|
16
16
|
.option("--no-open", "Do not open the browser automatically")
|
|
@@ -45,7 +45,7 @@ program
|
|
|
45
45
|
|
|
46
46
|
const packageRoot = join(import.meta.dir, "..");
|
|
47
47
|
|
|
48
|
-
console.log(`\n⚡ ${pc.bold(pc.cyan("FlashTS"))} ${pc.dim("v1.0.
|
|
48
|
+
console.log(`\n⚡ ${pc.bold(pc.cyan("FlashTS"))} ${pc.dim("v1.0.9")}`);
|
|
49
49
|
console.log(`${pc.green("➜")} Local: ${pc.cyan(`http://localhost:${port}`)}`);
|
|
50
50
|
|
|
51
51
|
// Start the server process
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flashts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "High-performance TypeScript/JavaScript Playground powered by Bun",
|
|
5
5
|
"main": "server/index.ts",
|
|
6
6
|
"bin": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-dom": "^19.2.0",
|
|
45
45
|
"react-resizable-panels": "^4.4.1",
|
|
46
46
|
"tailwind-merge": "^3.4.0",
|
|
47
|
-
"vite": "
|
|
47
|
+
"vite": "^6.0.11",
|
|
48
48
|
"@vitejs/plugin-react": "^5.1.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -62,9 +62,6 @@
|
|
|
62
62
|
"typescript": "~5.9.3",
|
|
63
63
|
"typescript-eslint": "^8.46.4"
|
|
64
64
|
},
|
|
65
|
-
"overrides": {
|
|
66
|
-
"vite": "npm:rolldown-vite@7.2.5"
|
|
67
|
-
},
|
|
68
65
|
"keywords": [
|
|
69
66
|
"typescript",
|
|
70
67
|
"playground",
|
package/server/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { cors } from "hono/cors";
|
|
3
|
-
import { join } from "path";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
4
|
import { mkdir, readdir, readFile, rm } from "fs/promises";
|
|
5
5
|
import { serveStatic } from "hono/bun";
|
|
6
6
|
import { streamText } from "hono/streaming";
|
|
@@ -293,9 +293,35 @@ app.post("/preview/start", async (c) => {
|
|
|
293
293
|
const normalizedPackageRoot = join(PACKAGE_ROOT).replace(/\\/g, '/');
|
|
294
294
|
const nodeModulesPath = join(PACKAGE_ROOT, "node_modules").replace(/\\/g, '/');
|
|
295
295
|
|
|
296
|
+
// Robust path resolution using Bun's resolver
|
|
297
|
+
const resolvePath = (mod: string) => {
|
|
298
|
+
try {
|
|
299
|
+
const res = Bun.resolveSync(mod, PACKAGE_ROOT);
|
|
300
|
+
return res.replace(/\\/g, '/');
|
|
301
|
+
} catch (e) {
|
|
302
|
+
// Fallback to manual join if resolve fails (though resolveSync is preferred)
|
|
303
|
+
return join(PACKAGE_ROOT, "node_modules", mod).replace(/\\/g, '/');
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const reactPath = resolvePath("react");
|
|
308
|
+
const reactDomPath = resolvePath("react-dom");
|
|
309
|
+
const reactPluginPath = resolvePath("@vitejs/plugin-react");
|
|
310
|
+
const viteModulePath = resolvePath("vite");
|
|
311
|
+
|
|
312
|
+
// Find the actual vite binary
|
|
313
|
+
let viteBin = join(PACKAGE_ROOT, "node_modules", "vite", "bin", "vite.js");
|
|
314
|
+
try {
|
|
315
|
+
// Try to resolve the binary via package.json of vite
|
|
316
|
+
const vitePkgPath = Bun.resolveSync("vite/package.json", PACKAGE_ROOT);
|
|
317
|
+
const vitePkg = JSON.parse(await readFile(vitePkgPath, "utf-8"));
|
|
318
|
+
const binPath = typeof vitePkg.bin === 'string' ? vitePkg.bin : vitePkg.bin.vite;
|
|
319
|
+
viteBin = join(dirname(vitePkgPath), binPath);
|
|
320
|
+
} catch (e) {}
|
|
321
|
+
|
|
296
322
|
const viteConfigActual = `
|
|
297
|
-
import { defineConfig } from '
|
|
298
|
-
import react from '
|
|
323
|
+
import { defineConfig } from 'file:///${viteModulePath}';
|
|
324
|
+
import react from 'file:///${reactPluginPath}';
|
|
299
325
|
|
|
300
326
|
export default defineConfig({
|
|
301
327
|
plugins: [
|
|
@@ -330,9 +356,9 @@ export default defineConfig({
|
|
|
330
356
|
],
|
|
331
357
|
resolve: {
|
|
332
358
|
alias: {
|
|
333
|
-
'react': '
|
|
334
|
-
'react-dom': '
|
|
335
|
-
'@vitejs/plugin-react': '
|
|
359
|
+
'react': 'file:///${reactPath}',
|
|
360
|
+
'react-dom': 'file:///${reactDomPath}',
|
|
361
|
+
'@vitejs/plugin-react': 'file:///${reactPluginPath}'
|
|
336
362
|
}
|
|
337
363
|
},
|
|
338
364
|
root: '.',
|
|
@@ -348,7 +374,6 @@ export default defineConfig({
|
|
|
348
374
|
`;
|
|
349
375
|
await Bun.write(join(sessionDir, "vite.config.ts"), viteConfigActual);
|
|
350
376
|
|
|
351
|
-
const viteBin = join(PACKAGE_ROOT, "node_modules", "vite", "bin", "vite.js");
|
|
352
377
|
const proc = Bun.spawn([process.execPath, viteBin, "--port", String(vitePort), "--strictPort", "--host", "localhost"], {
|
|
353
378
|
cwd: sessionDir,
|
|
354
379
|
stdout: "pipe",
|