@ivogt/rsc-router 0.0.0-experimental.7 → 0.0.0-experimental.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivogt/rsc-router",
3
- "version": "0.0.0-experimental.7",
3
+ "version": "0.0.0-experimental.8",
4
4
  "type": "module",
5
5
  "description": "Type-safe RSC router with partial rendering support",
6
6
  "author": "Ivo Todorov",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "./vite": {
57
57
  "types": "./src/vite/index.ts",
58
- "import": "./src/vite/index.ts"
58
+ "import": "./dist/vite/index.js"
59
59
  },
60
60
  "./types": {
61
61
  "types": "./src/vite/version.d.ts"
@@ -89,6 +89,7 @@
89
89
  },
90
90
  "files": [
91
91
  "src",
92
+ "dist",
92
93
  "README.md"
93
94
  ],
94
95
  "peerDependencies": {
@@ -117,11 +118,13 @@
117
118
  "@types/react-dom": "^19.2.3",
118
119
  "react": "^19.2.1",
119
120
  "react-dom": "^19.2.1",
121
+ "esbuild": "^0.27.0",
120
122
  "tinyexec": "^0.3.2",
121
123
  "typescript": "^5.3.0",
122
124
  "vitest": "^2.1.8"
123
125
  },
124
126
  "scripts": {
127
+ "build": "pnpm dlx esbuild src/vite/index.ts --bundle --format=esm --outfile=dist/vite/index.js --platform=node --packages=external",
125
128
  "typecheck": "tsc --noEmit",
126
129
  "test": "playwright test",
127
130
  "test:ui": "playwright test --ui",
@@ -5,47 +5,20 @@
5
5
  * appropriate aliases and exclude lists for Vite configuration.
6
6
  */
7
7
 
8
- import { existsSync, readFileSync } from "node:fs";
9
- import { resolve, dirname } from "node:path";
10
- import { fileURLToPath } from "node:url";
11
-
12
- // Get the directory of this file to find package.json
13
- const __dirname = dirname(fileURLToPath(import.meta.url));
14
-
15
- /**
16
- * Read the package name from package.json
17
- * This allows the name to change without updating hardcoded strings
18
- */
19
- function getPackageName(): string {
20
- try {
21
- // Navigate from src/vite/ to package root
22
- const packageJsonPath = resolve(__dirname, "../../package.json");
23
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
24
- return packageJson.name;
25
- } catch {
26
- // Fallback to known name if package.json read fails
27
- return "@ivogt/rsc-router";
28
- }
29
- }
8
+ import { existsSync } from "node:fs";
9
+ import { resolve } from "node:path";
10
+ import packageJson from "../../package.json" with { type: "json" };
30
11
 
31
12
  /**
32
13
  * The canonical name used in virtual entries (without scope)
33
14
  */
34
15
  const VIRTUAL_PACKAGE_NAME = "rsc-router";
35
16
 
36
- /**
37
- * Cached package name from package.json
38
- */
39
- let _packageName: string | null = null;
40
-
41
17
  /**
42
18
  * Get the published package name (e.g., "@ivogt/rsc-router")
43
19
  */
44
20
  export function getPublishedPackageName(): string {
45
- if (_packageName === null) {
46
- _packageName = getPackageName();
47
- }
48
- return _packageName;
21
+ return packageJson.name;
49
22
  }
50
23
 
51
24
  /**