@constela/start 1.9.28 → 1.10.0
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.
|
@@ -2946,46 +2946,45 @@ h1 { color: #666; }
|
|
|
2946
2946
|
</body>
|
|
2947
2947
|
</html>`);
|
|
2948
2948
|
});
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
toJSON: () => ({
|
|
2949
|
+
let currentPort = port;
|
|
2950
|
+
const MAX_PORT_TRIES = 10;
|
|
2951
|
+
httpServer.setMaxListeners(MAX_PORT_TRIES + 1);
|
|
2952
|
+
const tryListen = () => {
|
|
2953
|
+
httpServer.once("error", (err) => {
|
|
2954
|
+
if (err.code === "EADDRINUSE" && currentPort < port + MAX_PORT_TRIES - 1) {
|
|
2955
|
+
currentPort++;
|
|
2956
|
+
tryListen();
|
|
2957
|
+
} else {
|
|
2958
|
+
reject(err);
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
httpServer.listen(currentPort, host, async () => {
|
|
2962
|
+
actualPort = currentPort;
|
|
2963
|
+
if (currentPort !== port) {
|
|
2964
|
+
console.warn(`Port ${port} is in use, using port ${currentPort} instead.`);
|
|
2965
|
+
}
|
|
2966
|
+
try {
|
|
2967
|
+
hmrServer = await createHMRServer({ port: 0 });
|
|
2968
|
+
watcher = await createWatcher({
|
|
2969
|
+
directory: absoluteRoutesDir,
|
|
2970
|
+
patterns: ["**/*.json"]
|
|
2971
|
+
});
|
|
2972
|
+
watcher.on("change", async (event) => {
|
|
2973
|
+
const projectRoot = process.cwd();
|
|
2974
|
+
const pageLoader = new JsonPageLoader(projectRoot);
|
|
2975
|
+
try {
|
|
2976
|
+
const relativePath = relative3(projectRoot, event.path).replace(/\\/g, "/");
|
|
2977
|
+
const pageInfo = await pageLoader.loadPage(relativePath);
|
|
2978
|
+
const program = await convertToCompiledProgram(pageInfo);
|
|
2979
|
+
if (hmrServer) {
|
|
2980
|
+
hmrServer.broadcastUpdate(event.path, program);
|
|
2981
|
+
}
|
|
2982
|
+
} catch (error) {
|
|
2983
|
+
if (hmrServer) {
|
|
2984
|
+
if (error instanceof ConstelaError) {
|
|
2985
|
+
hmrServer.broadcastError(event.path, [error]);
|
|
2986
|
+
} else {
|
|
2987
|
+
const genericError = {
|
|
2989
2988
|
code: "COMPILE_ERROR",
|
|
2990
2989
|
message: error instanceof Error ? error.message : String(error),
|
|
2991
2990
|
path: event.path,
|
|
@@ -2993,19 +2992,31 @@ h1 { color: #666; }
|
|
|
2993
2992
|
suggestion: void 0,
|
|
2994
2993
|
expected: void 0,
|
|
2995
2994
|
actual: void 0,
|
|
2996
|
-
context: void 0
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
2995
|
+
context: void 0,
|
|
2996
|
+
name: "ConstelaError",
|
|
2997
|
+
toJSON: () => ({
|
|
2998
|
+
code: "COMPILE_ERROR",
|
|
2999
|
+
message: error instanceof Error ? error.message : String(error),
|
|
3000
|
+
path: event.path,
|
|
3001
|
+
severity: "error",
|
|
3002
|
+
suggestion: void 0,
|
|
3003
|
+
expected: void 0,
|
|
3004
|
+
actual: void 0,
|
|
3005
|
+
context: void 0
|
|
3006
|
+
})
|
|
3007
|
+
};
|
|
3008
|
+
hmrServer.broadcastError(event.path, [genericError]);
|
|
3009
|
+
}
|
|
3000
3010
|
}
|
|
3001
3011
|
}
|
|
3002
|
-
}
|
|
3003
|
-
})
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
}
|
|
3012
|
+
});
|
|
3013
|
+
} catch (hmrError) {
|
|
3014
|
+
console.warn("HMR initialization failed:", hmrError);
|
|
3015
|
+
}
|
|
3016
|
+
resolve5();
|
|
3017
|
+
});
|
|
3018
|
+
};
|
|
3019
|
+
tryListen();
|
|
3009
3020
|
});
|
|
3010
3021
|
},
|
|
3011
3022
|
async close() {
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/start",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Meta-framework for Constela applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@tailwindcss/postcss": "^4.0.0",
|
|
45
45
|
"tailwindcss": "^4.0.0",
|
|
46
46
|
"ws": "^8.18.0",
|
|
47
|
-
"@constela/ai": "6.0.4",
|
|
48
47
|
"@constela/compiler": "0.15.20",
|
|
49
|
-
"@constela/router": "23.0.0",
|
|
50
|
-
"@constela/runtime": "5.0.6",
|
|
51
48
|
"@constela/core": "0.21.4",
|
|
52
|
-
"@constela/
|
|
49
|
+
"@constela/runtime": "5.0.6",
|
|
50
|
+
"@constela/ai": "6.0.4",
|
|
51
|
+
"@constela/server": "17.0.1",
|
|
52
|
+
"@constela/router": "23.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/ws": "^8.5.0",
|