@joystick.js/cli-canary 0.0.0-canary.604 → 0.0.0-canary.606
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/dist/lib/development_server/hmr_server.js +1 -1
- package/dist/lib/development_server/watch_for_changes/node_paths.js +1 -1
- package/dist/lib/development_server/watch_for_changes/watch_paths.js +1 -1
- package/package.json +1 -1
- package/src/lib/development_server/hmr_server.js +2 -11
- package/src/lib/development_server/watch_for_changes/node_paths.js +1 -0
- package/src/lib/development_server/watch_for_changes/watch_paths.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import p from"query-string";import{WebSocketServer as i}from"ws";import g from"../generate_id.js";import N from"./get_translations.js";process.title="joystick_hmr";var E=(()=>{const r=new i({port:parseInt(process.env.PORT,10)+1,path:"/_joystick/hmr"});process.on("message",async c=>{const e=JSON.parse(c);if(typeof process.HMR_CONNECTIONS=="object"&&e?.type){const t=Object.values(process.HMR_CONNECTIONS);for(let n=0;n<t?.length;n+=1){const s=t[n];if(s?.connection?.send){if(e?.type==="BUILD_ERROR")return s.connection.send(JSON.stringify({type:"BUILD_ERROR"}));if(e?.type==="FILE_CHANGE")return s.connection.send(JSON.stringify({type:"FILE_CHANGE",settings:e?.settings?{global:e?.settings?.global,public:e?.settings?.public}:null,i18n:e?.i18n_change?await N("./.joystick/build",s?.page_component_path,{headers:{"accept-language":s?.browser_language},context:{user:{language:s?.user_language}}}):null,index_html_changed:e?.index_html_change,index_css_changed:e?.index_css_change,index_client_changed:e?.index_client_change}))}}}}),r.on("connection",function(e,t={}){const n=g(16),[s,a]=t?.url?.split("?"),o=p.parse(a);process.HMR_CONNECTIONS={...process.HMR_CONNECTIONS||{},[n]:{connection:e,browser_language:o?.browser_language,user_language:o?.user_language,page_component_path:o?.page_component_path}},console.log(process.HMR_CONNECTIONS),Object.keys(process.HMR_CONNECTIONS||{})?.length>0&&process.send({type:"HAS_HMR_CONNECTIONS"}),e.on("message",_=>{JSON.parse(_)?.type==="HMR_UPDATE_COMPLETE"&&process.send({type:"HMR_UPDATE_COMPLETE"})}),e.on("close",()=>{process.HMR_CONNECTIONS[n]&&(delete process.HMR_CONNECTIONS[n],Object.keys(process.HMR_CONNECTIONS||{})?.length===0&&process.send({type:"HAS_NO_HMR_CONNECTIONS"}))})})})();export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./get_platform_safe_path.js";var o=[e("api/"),e("cronJobs/"),e("cron_jobs/"),e("fixtures/"),e("lib/node"),e("queues/"),e("routes/"),e("tests/"),e("uploaders/"),e("websockets/"),"index.server.js"];export{o as default};
|
|
1
|
+
import e from"./get_platform_safe_path.js";var o=[e("api/"),e("cronJobs/"),e("cron_jobs/"),e("fixtures/"),e("indexes/"),e("lib/node"),e("queues/"),e("routes/"),e("tests/"),e("uploaders/"),e("websockets/"),"index.server.js"];export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"../../build/copy_paths.js";const a=[{path:"api"},{path:"cronJobs"},{path:"cron_jobs"},{path:"email"},{path:"fixtures"},{path:"lib"},{path:"queues"},{path:"routes"},{path:"ui"},{path:"uploaders"},{path:"websockets"},{path:"index.client.js"},{path:"index.server.js"},...t];var
|
|
1
|
+
import t from"../../build/copy_paths.js";const a=[{path:"api"},{path:"cronJobs"},{path:"cron_jobs"},{path:"email"},{path:"fixtures"},{path:"indexes"},{path:"lib"},{path:"queues"},{path:"routes"},{path:"ui"},{path:"uploaders"},{path:"websockets"},{path:"index.client.js"},{path:"index.server.js"},...t];var e=a;export{e as default};
|
package/package.json
CHANGED
|
@@ -21,15 +21,11 @@ export default (() => {
|
|
|
21
21
|
const connection = connections[i];
|
|
22
22
|
|
|
23
23
|
if (connection?.connection?.send) {
|
|
24
|
-
console.log({ parsed_message });
|
|
25
|
-
|
|
26
24
|
if (parsed_message?.type === 'BUILD_ERROR') {
|
|
27
|
-
console.log('SEND BUILD ERROR');
|
|
28
25
|
return connection.connection.send(JSON.stringify({ type: 'BUILD_ERROR' }));
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
if (parsed_message?.type === 'FILE_CHANGE') {
|
|
32
|
-
console.log('SEND FILE CHANGE');
|
|
33
29
|
return connection.connection.send(
|
|
34
30
|
JSON.stringify({
|
|
35
31
|
type: "FILE_CHANGE",
|
|
@@ -70,10 +66,11 @@ export default (() => {
|
|
|
70
66
|
browser_language: connection_params?.browser_language,
|
|
71
67
|
user_language: connection_params?.user_language,
|
|
72
68
|
page_component_path: connection_params?.page_component_path,
|
|
73
|
-
watchlist: [],
|
|
74
69
|
},
|
|
75
70
|
};
|
|
76
71
|
|
|
72
|
+
console.log(process.HMR_CONNECTIONS);
|
|
73
|
+
|
|
77
74
|
if (Object.keys(process.HMR_CONNECTIONS || {})?.length > 0) {
|
|
78
75
|
process.send({ type: "HAS_HMR_CONNECTIONS" });
|
|
79
76
|
}
|
|
@@ -84,12 +81,6 @@ export default (() => {
|
|
|
84
81
|
if (parsed_message?.type === "HMR_UPDATE_COMPLETE") {
|
|
85
82
|
process.send({ type: "HMR_UPDATE_COMPLETE" });
|
|
86
83
|
}
|
|
87
|
-
|
|
88
|
-
if (parsed_message?.type === "HMR_WATCHLIST") {
|
|
89
|
-
process.HMR_CONNECTIONS[connection_id]?.watchlist?.push(
|
|
90
|
-
...(parsed_message?.tags || [])
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
84
|
});
|
|
94
85
|
|
|
95
86
|
websocket_connection.on("close", () => {
|
|
@@ -5,6 +5,7 @@ export default [
|
|
|
5
5
|
get_platform_safe_path("cronJobs/"),
|
|
6
6
|
get_platform_safe_path("cron_jobs/"),
|
|
7
7
|
get_platform_safe_path("fixtures/"),
|
|
8
|
+
get_platform_safe_path("indexes/"),
|
|
8
9
|
get_platform_safe_path("lib/node"),
|
|
9
10
|
get_platform_safe_path("queues/"),
|
|
10
11
|
get_platform_safe_path("routes/"),
|