react-client 1.0.12 → 1.0.13
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/README.md +3 -3
- package/dist/cli/commands/dev.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ npm install
|
|
|
35
35
|
npm run dev
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
This launches the **custom dev server** —
|
|
38
|
+
This launches the **custom dev server** — built on **Connect + WebSocket + esbuild**, featuring:
|
|
39
39
|
- Instant rebuilds
|
|
40
40
|
- React Fast Refresh (HMR)
|
|
41
41
|
- Auto port detection & confirmation prompt
|
|
@@ -85,9 +85,9 @@ Each template is pre-configured for esbuild, HMR, and fast bootstrapping.
|
|
|
85
85
|
|
|
86
86
|
## 💎 Core Features
|
|
87
87
|
|
|
88
|
-
- ⚡ **Custom Dev Server
|
|
88
|
+
- ⚡ **Custom Dev Server** — Connect + WebSocket + esbuild
|
|
89
89
|
- 🔁 **React Fast Refresh (HMR)** — State-preserving reloads
|
|
90
|
-
- 💥 **
|
|
90
|
+
- 💥 **Overlay** — Syntax-highlighted stack frames, clickable file links (`vscode://file`)
|
|
91
91
|
- 🔍 **Source Map Stack Mapping** — Maps runtime errors to original TS/JS source lines
|
|
92
92
|
- 💬 **Auto Port Detection** — Prompts when default port 5173 is occupied
|
|
93
93
|
- 🧠 **Smart Config Loader** — Detects project root, compiles `.ts` configs dynamically
|
package/dist/cli/commands/dev.js
CHANGED
|
@@ -112,7 +112,11 @@ async function dev() {
|
|
|
112
112
|
});
|
|
113
113
|
// 2️⃣ Bare module resolver with memory cache
|
|
114
114
|
app.use('/@modules/', async (req, res, next) => {
|
|
115
|
-
|
|
115
|
+
let id = req.url?.replace(/^\/@modules\//, '');
|
|
116
|
+
if (!id)
|
|
117
|
+
return next();
|
|
118
|
+
// 🧩 Normalize: remove leading slashes that may appear (e.g. "/react")
|
|
119
|
+
id = id.replace(/^\/+/, '');
|
|
116
120
|
if (!id)
|
|
117
121
|
return next();
|
|
118
122
|
if (moduleCache.has(id)) {
|
|
@@ -153,7 +157,8 @@ async function dev() {
|
|
|
153
157
|
let code = await fs_extra_1.default.readFile(filePath, 'utf8');
|
|
154
158
|
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
155
159
|
// 🪄 Rewrite bare imports → /@modules/
|
|
156
|
-
|
|
160
|
+
// 🧩 Rewrite *only bare imports* like "react", not "./" or "/" or "../"
|
|
161
|
+
code = code.replace(/from\s+['"]((?![\.\/])[a-zA-Z0-9@/_-]+)['"]/g, (_match, dep) => `from "/@modules/${dep}"`);
|
|
157
162
|
let loader = 'js';
|
|
158
163
|
if (ext === '.ts')
|
|
159
164
|
loader = 'ts';
|