react-client 1.0.27 ā 1.0.30
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 +0 -2
- package/dist/cli/commands/build.js +48 -42
- package/dist/cli/commands/dev.js +561 -457
- package/dist/cli/commands/init.js +75 -70
- package/dist/cli/commands/preview.js +130 -124
- package/dist/cli/index.js +32 -32
- package/dist/cli/types.js +1 -3
- package/dist/index.js +2 -20
- package/dist/server/broadcastManager.js +9 -16
- package/dist/utils/loadConfig.js +70 -98
- package/dist/utils/string.js +1 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -91,7 +91,6 @@ Each template is pre-configured for esbuild, HMR, and fast bootstrapping.
|
|
|
91
91
|
- š **Source Map Stack Mapping** ā Maps runtime errors to original TS/JS source lines
|
|
92
92
|
- š¬ **Auto Port Detection** ā Prompts when default port 2202 is occupied
|
|
93
93
|
- š§ **Smart Config Loader** ā Detects project root, compiles `.ts` configs dynamically
|
|
94
|
-
- šØ **PrismJS Highlighting** ā For pretty overlay code frames
|
|
95
94
|
- š **Plugin Hook System** ā Extendable with `configResolved`, `transform`, `buildEnd`
|
|
96
95
|
|
|
97
96
|
---
|
|
@@ -104,7 +103,6 @@ Each template is pre-configured for esbuild, HMR, and fast bootstrapping.
|
|
|
104
103
|
2. **Connect** serves files and APIs (React Refresh runtime, overlay, source-map).
|
|
105
104
|
3. **WebSocket** pushes HMR updates and overlay messages.
|
|
106
105
|
4. **Chokidar** watches `/src` for changes and triggers rebuilds.
|
|
107
|
-
5. **Overlay UI** (via PrismJS) displays mapped stack frames with syntax highlighting.
|
|
108
106
|
|
|
109
107
|
---
|
|
110
108
|
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
import esbuild from 'esbuild';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import fs from 'fs-extra';
|
|
13
|
+
import chalk from 'chalk';
|
|
14
|
+
import { loadReactClientConfig } from '../../utils/loadConfig';
|
|
15
|
+
export default function build() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
const root = process.cwd();
|
|
19
|
+
const config = yield loadReactClientConfig(root);
|
|
20
|
+
const appRoot = path.resolve(root, config.root || '.');
|
|
21
|
+
const outDir = path.join(appRoot, ((_a = config.build) === null || _a === void 0 ? void 0 : _a.outDir) || '.react-client/build');
|
|
22
|
+
console.log(chalk.cyan(`\nšļø Building project...`));
|
|
23
|
+
console.log(chalk.gray(`Root: ${appRoot}`));
|
|
24
|
+
console.log(chalk.gray(`Output: ${outDir}\n`));
|
|
25
|
+
const entry = path.join(appRoot, 'src', 'main.tsx');
|
|
26
|
+
if (!fs.existsSync(entry)) {
|
|
27
|
+
console.error(chalk.red('ā Entry not found: src/main.tsx'));
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
yield fs.ensureDir(outDir);
|
|
31
|
+
try {
|
|
32
|
+
yield esbuild.build({
|
|
33
|
+
entryPoints: [entry],
|
|
34
|
+
bundle: true,
|
|
35
|
+
minify: true,
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
outdir: outDir,
|
|
38
|
+
define: { 'process.env.NODE_ENV': '"production"' },
|
|
39
|
+
loader: { '.ts': 'ts', '.tsx': 'tsx', '.js': 'jsx', '.jsx': 'jsx' },
|
|
40
|
+
});
|
|
41
|
+
console.log(chalk.green(`ā
Build completed successfully!`));
|
|
42
|
+
console.log(chalk.gray(`Output directory: ${outDir}`));
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
46
|
+
console.error('ā Build failed:', msg);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
}
|