flashts 1.0.1 → 1.0.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.
@@ -5,9 +5,10 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>FlashTS Playground</title>
8
+ <script type="module" crossorigin src="/assets/index-DM0EVhuB.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-BAlIRq-u.css">
8
10
  </head>
9
11
  <body>
10
12
  <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
13
  </body>
13
14
  </html>
package/package.json CHANGED
@@ -1,11 +1,20 @@
1
1
  {
2
2
  "name": "flashts",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "High-performance TypeScript/JavaScript Playground powered by Bun",
5
5
  "main": "server/index.ts",
6
6
  "bin": {
7
7
  "flashts": "./bin/cli.ts"
8
8
  },
9
+ "files": [
10
+ "bin",
11
+ "server",
12
+ "client/dist",
13
+ "README.md",
14
+ "LICENSE",
15
+ "CHANGELOG.md",
16
+ "CONTRIBUTING.md"
17
+ ],
9
18
  "readme": "README.md",
10
19
  "type": "module",
11
20
  "scripts": {
package/server/index.ts CHANGED
@@ -6,15 +6,17 @@ import { serveStatic } from "hono/bun";
6
6
 
7
7
  const app = new Hono();
8
8
 
9
+ const PACKAGE_ROOT = join(import.meta.dir, "..");
10
+
9
11
  // Enable CORS for the frontend
10
12
  app.use("/*", cors());
11
13
 
12
- // Ensure tmp directory exists
13
- const TMP_DIR = join(process.cwd(), "tmp");
14
+ // Ensure tmp directory exists in the package root or system temp
15
+ const TMP_DIR = join(PACKAGE_ROOT, "tmp");
14
16
  await mkdir(TMP_DIR, { recursive: true });
15
17
 
16
- // Serve static files from the client/dist directory
17
- app.use("/*", serveStatic({ root: "./client/dist" }));
18
+ // Serve static files from the client/dist directory relative to package root
19
+ app.use("/*", serveStatic({ root: join(PACKAGE_ROOT, "client/dist") }));
18
20
 
19
21
  app.get("/api/health", (c) => c.text("FlashTS API Active"));
20
22
 
@@ -86,7 +88,7 @@ app.post("/install", async (c) => {
86
88
 
87
89
  try {
88
90
  const proc = Bun.spawn(["bun", "add", pkgName], {
89
- cwd: process.cwd(),
91
+ cwd: PACKAGE_ROOT,
90
92
  stdout: "pipe",
91
93
  stderr: "pipe",
92
94
  });
@@ -107,7 +109,7 @@ app.post("/install", async (c) => {
107
109
 
108
110
  app.get("/dependencies", async (c) => {
109
111
  try {
110
- const pkgPath = join(process.cwd(), "package.json");
112
+ const pkgPath = join(PACKAGE_ROOT, "package.json");
111
113
  const pkgData = JSON.parse(await readFile(pkgPath, "utf-8"));
112
114
  return c.json(pkgData.dependencies || {});
113
115
  } catch (e) {
@@ -123,7 +125,7 @@ app.post("/uninstall", async (c) => {
123
125
 
124
126
  try {
125
127
  const proc = Bun.spawn(["bun", "remove", pkgName], {
126
- cwd: process.cwd(),
128
+ cwd: PACKAGE_ROOT,
127
129
  stdout: "pipe",
128
130
  stderr: "pipe",
129
131
  });
@@ -143,7 +145,7 @@ app.post("/uninstall", async (c) => {
143
145
  });
144
146
 
145
147
  async function getPackageTypeTree(pkgName: string) {
146
- const pkgDir = join(process.cwd(), "node_modules", pkgName);
148
+ const pkgDir = join(PACKAGE_ROOT, "node_modules", pkgName);
147
149
  const files: Record<string, string> = {};
148
150
 
149
151
  async function scan(dir: string, relativePath: string = "") {
@@ -172,7 +174,7 @@ async function getPackageTypeTree(pkgName: string) {
172
174
  const typesPkgName = pkgName.startsWith('@')
173
175
  ? pkgName.slice(1).replace('/', '__')
174
176
  : pkgName;
175
- const atTypesDir = join(process.cwd(), "node_modules", "@types", typesPkgName);
177
+ const atTypesDir = join(PACKAGE_ROOT, "node_modules", "@types", typesPkgName);
176
178
  await scan(atTypesDir);
177
179
  return files;
178
180
  } catch (e2) {