@joystick.js/cli-canary 0.0.0-canary.662 → 0.0.0-canary.664
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/index.js +1 -1
- package/dist/lib/dynamic_import.js +1 -1
- package/package.json +1 -1
- package/src/lib/development_server/hmr_server.js +1 -1
- package/src/lib/development_server/watch_for_changes/index.js +1 -0
- package/src/lib/dynamic_import.js +2 -1
|
@@ -1 +1 @@
|
|
|
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 u=(()=>{const a=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];s?.connection?.send&&(e?.type==="BUILD_ERROR"&&s.connection.send(JSON.stringify({type:"BUILD_ERROR"})),e?.type==="FILE_CHANGE"&&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("
|
|
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 u=(()=>{const a=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];s?.connection?.send&&(e?.type==="BUILD_ERROR"&&s.connection.send(JSON.stringify({type:"BUILD_ERROR"})),e?.type==="FILE_CHANGE"&&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})))}}}),a.on("connection",function(e,t={}){const n=g(16),[s,r]=t?.url?.split("?"),o=p.parse(r);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}},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{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"chokidar";import h from"fs";import{dirname as m}from"path";import y from"../../build/build_files.js";import g from"../../debounce.js";import c from"./get_after_run_tasks.js";import k from"./get_file_codependencies.js";import p from"../../build/get_file_operation.js";import v from"../../build/get_path_platform.js";import w from"../../types.js";import R from"./watch_paths.js";const{mkdir:l,copyFile:b,rm:u}=h.promises,
|
|
1
|
+
import f from"chokidar";import h from"fs";import{dirname as m}from"path";import y from"../../build/build_files.js";import g from"../../debounce.js";import c from"./get_after_run_tasks.js";import k from"./get_file_codependencies.js";import p from"../../build/get_file_operation.js";import v from"../../build/get_path_platform.js";import w from"../../types.js";import R from"./watch_paths.js";const{mkdir:l,copyFile:b,rm:u}=h.promises,o=async(e={},a={})=>{const s=process.initial_build_complete?await k(e?.path):[];if(a?.is_build_file&&await y({files:[{path:e?.path,platform:v(e?.path)}]}).catch((r=[])=>{if(!process.initial_build_complete&&r?.length>0&&process.exit(0),process.initial_build_complete&&r?.length>0)throw process.app_server_process.send(JSON.stringify({type:"BUILD_ERROR",paths:r.filter(({success:t})=>!t)})),process.hmr_server_process.send(JSON.stringify({type:"BUILD_ERROR"})),new Error("BUILD_ERROR")}),s?.length>0)for(let r=0;r<s?.length;r+=1){const t=s[r];await o({path:t},a)}return Promise.resolve()},D=async(e={})=>{switch(e?.operation){case"add_directory":return l(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return o(e,{is_build_file:!0});case"copy_file":return await l(m(`.joystick/build/${e?.path}`),{recursive:!0}),await b(e?.path,`.joystick/build/${e?.path}`),o(e,{is_build_file:!1});case"delete_directory":return u(`.joystick/build/${e?.path}`,{recursive:!0});case"delete_file":return await u(`.joystick/build/${e?.path}`,{recursive:!0}),o(e,{is_build_file:!1});default:return!0}},O=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?c(e?.path):["start_app_server","start_hmr_server"]}),$=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?c(e?.path):["start_app_server","start_hmr_server"]}),E=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?c(e?.path):["start_app_server","start_hmr_server"]}),B=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":p(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?c(e?.path):["start_app_server","start_hmr_server"]}),I=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":p(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?c(e?.path):["start_app_server","start_hmr_server"]}),L=(e={})=>{switch(e?.event){case"add_file":return I(e);case"change_file":return B(e);case"delete_file":return E(e);case"add_directory":return $(e);case"delete_directory":return O(e)}},S=async(e=[],a={})=>{try{const s=new Set([]);for(let t=0;t<e?.length;t+=1){const i=e[t],_=L(i);if(await D(_),_?.after_run_tasks)for(let n=0;n<_?.after_run_tasks?.length;n+=1){const d=_?.after_run_tasks[n];s.add(d)}}const r=Array.from(s);for(let t=0;t<r?.length;t+=1){const i=r[t];w.is_function(a[i])&&await a[i](e)}}catch{}},U=(e="")=>{switch(e){case"add":return"add_file";case"change":return"change_file";case"unlink":return"delete_file";case"addDir":return"add_directory";case"unlinkDir":return"delete_directory"}},x=(e={},a={})=>{const s=f.watch([...R,...a?.custom_copy_paths||[]].map(({path:t})=>t),{ignored:".joystick"});let r=[];process.initial_build_complete=!1,s.on("error",t=>console.error(t)),s.on("all",(t,i)=>{console.log({path:i}),r.push({event:U(t),path:i,is_custom_copy_path:a?.custom_copy_paths?.length?a?.custom_copy_paths.some(_=>i.includes(_?.path)):!1}),g(async()=>{await S(r,e),process.initial_build_complete=!0,r=[]},100)})};var M=x;export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=async(
|
|
1
|
+
const e=async(o="")=>(console.log(process.platform==="win32"?`file://${o}`:o),(await(process.platform==="win32"?import(`file://${o}`):import(o)))?.default);var l=e;export{l as default};
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ export default (() => {
|
|
|
33
33
|
global: parsed_message?.settings?.global,
|
|
34
34
|
public: parsed_message?.settings?.public,
|
|
35
35
|
} : null,
|
|
36
|
-
i18n: parsed_message?.i18n_change ? await get_translations('
|
|
36
|
+
i18n: parsed_message?.i18n_change ? await get_translations('.joystick/build', connection?.page_component_path, {
|
|
37
37
|
headers: {
|
|
38
38
|
'accept-language': connection?.browser_language,
|
|
39
39
|
},
|
|
@@ -192,6 +192,7 @@ const watch_for_changes = (after_run_functions = {}, watch_for_changes_options =
|
|
|
192
192
|
file_watcher.on('error', (error) => console.error(error));
|
|
193
193
|
|
|
194
194
|
file_watcher.on('all', (event, path) => {
|
|
195
|
+
console.log({ path });
|
|
195
196
|
file_watcher_jobs.push({
|
|
196
197
|
event: transform_chokidar_event(event),
|
|
197
198
|
path,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const dynamic_import = async (path = '') => {
|
|
1
|
+
const dynamic_import = async (path = '') => {
|
|
2
|
+
console.log(process.platform === 'win32' ? `file://${path}` : path);
|
|
2
3
|
const file = await import(process.platform === 'win32' ? `file://${path}` : path);
|
|
3
4
|
return file?.default;
|
|
4
5
|
};
|