@joystick.js/cli-canary 0.0.0-canary.666 → 0.0.0-canary.668

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.
@@ -1 +1 @@
1
- const e=[{path:"css",regex:new RegExp(/^css\//)},{path:"i18n",regex:new RegExp(/^i18n\//)},{path:"public",regex:new RegExp(/^public\//)},{path:"private",regex:new RegExp(/^private\//)},{path:"index.html",regex:new RegExp(/^index.html/)},{path:"index.css",regex:new RegExp(/^index.css/)},{path:"package.json",regex:new RegExp(/^package.json/)},{path:"package-lock.json",regex:new RegExp(/^package-lock.json/)},{path:"settings.development.json",regex:new RegExp(/^settings.development.json/)},{path:"settings.staging.json",regex:new RegExp(/^settings.staging.json/)},{path:"settings.test.json",regex:new RegExp(/^settings.test.json/)},{path:"settings.production.json",regex:new RegExp(/^settings.production.json/)},{path:".html",regex:new RegExp(/^([0-9a-zA-Z-._])+.html/)}];var t=e;export{t as default};
1
+ const e=[{path:"css",regex:new RegExp(process.platform==="win32"?/^css\\/:/^css\//)},{path:"i18n",regex:new RegExp(process.platform==="win32"?/^i18n\\/:/^i18n\//)},{path:"public",regex:new RegExp(process.platform==="win32"?/^public\\/:/^public\//)},{path:"private",regex:new RegExp(process.platform==="win32"?/^private\\/:/^private\//)},{path:"index.html",regex:new RegExp(/^index.html/)},{path:"index.css",regex:new RegExp(/^index.css/)},{path:"package.json",regex:new RegExp(/^package.json/)},{path:"package-lock.json",regex:new RegExp(/^package-lock.json/)},{path:"settings.development.json",regex:new RegExp(/^settings.development.json/)},{path:"settings.staging.json",regex:new RegExp(/^settings.staging.json/)},{path:"settings.test.json",regex:new RegExp(/^settings.test.json/)},{path:"settings.production.json",regex:new RegExp(/^settings.production.json/)},{path:".html",regex:new RegExp(/^([0-9a-zA-Z-._])+.html/)}];var t=e;export{t as default};
@@ -1 +1 @@
1
- import i from"./copy_paths.js";const r=(t="")=>i.some(e=>(console.log(e,t),e.regex.test(t))),c=(t="")=>t==="js",n=(t="")=>{const e=t?.split(".")?.pop(),o=c(e),s=r(t);return!o||o&&s?"copy_file":"build_file"};var p=n;export{p as default};
1
+ import s from"./copy_paths.js";const r=(t="")=>s.some(e=>e.regex.test(t)),c=(t="")=>t==="js",_=(t="")=>{const e=t?.split(".")?.pop(),i=c(e),o=r(t);return!i||i&&o?"copy_file":"build_file"};var p=_;export{p 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 l 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:p,copyFile:D,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()},O=async(e={})=>{switch(console.log(e),e?.operation){case"add_directory":return p(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return o(e,{is_build_file:!0});case"copy_file":return await p(m(`.joystick/build/${e?.path}`),{recursive:!0}),await D(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}},$=(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?.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":l(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":l(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 b(e);case"delete_directory":return $(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 O(_),_?.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
+ 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,n=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 n({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 n(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}`),n(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}),n(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 o=0;o<_?.after_run_tasks?.length;o+=1){const d=_?.after_run_tasks[o];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)=>{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(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};
1
+ const e=async(t="")=>(await(process.platform==="win32"?import(`file://${t}`):import(t)))?.default;var o=e;export{o as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.666",
4
+ "version": "0.0.0-canary.668",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -1,8 +1,8 @@
1
1
  const copy_paths = [
2
- { path: "css", regex: new RegExp(/^css\//) },
3
- { path: "i18n", regex: new RegExp(/^i18n\//) },
4
- { path: "public", regex: new RegExp(/^public\//) },
5
- { path: "private", regex: new RegExp(/^private\//) },
2
+ { path: "css", regex: new RegExp(process.platform === 'win32' ? /^css\\/ : /^css\//) },
3
+ { path: "i18n", regex: new RegExp(process.platform === 'win32' ? /^i18n\\/ : /^i18n\//) },
4
+ { path: "public", regex: new RegExp(process.platform === 'win32' ? /^public\\/ : /^public\//) },
5
+ { path: "private", regex: new RegExp(process.platform === 'win32' ? /^private\\/ : /^private\//) },
6
6
  { path: "index.html", regex: new RegExp(/^index.html/) },
7
7
  { path: "index.css", regex: new RegExp(/^index.css/) },
8
8
  { path: "package.json", regex: new RegExp(/^package.json/) },
@@ -2,7 +2,6 @@ import copy_paths from "./copy_paths.js";
2
2
 
3
3
  const check_if_is_copy_path = (path = '') => {
4
4
  return copy_paths.some((file_to_copy) => {
5
- console.log(file_to_copy, path);
6
5
  return file_to_copy.regex.test(path);
7
6
  });
8
7
  };
@@ -57,7 +57,6 @@ const handle_build_files = async (job = {}, options = {}) => {
57
57
  };
58
58
 
59
59
  const run_job = async (job = {}) => {
60
- console.log(job);
61
60
  switch(job?.operation) {
62
61
  case 'add_directory':
63
62
  return mkdir(`.joystick/build/${job?.path}`, { recursive: true });
@@ -193,7 +192,6 @@ const watch_for_changes = (after_run_functions = {}, watch_for_changes_options =
193
192
  file_watcher.on('error', (error) => console.error(error));
194
193
 
195
194
  file_watcher.on('all', (event, path) => {
196
- console.log({ path });
197
195
  file_watcher_jobs.push({
198
196
  event: transform_chokidar_event(event),
199
197
  path,
@@ -1,5 +1,4 @@
1
1
  const dynamic_import = async (path = '') => {
2
- console.log(process.platform === 'win32' ? `file://${path}` : path);
3
2
  const file = await import(process.platform === 'win32' ? `file://${path}` : path);
4
3
  return file?.default;
5
4
  };