@joystick.js/cli-canary 0.0.0-canary.1633 → 0.0.0-canary.1635

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,3 +1,3 @@
1
- import c from"esbuild";import d from"esbuild-plugin-svg";import s from"./plugins/index.js";import f from"./get_code_frame.js";import p from"../build/minify_file.js";import h from"./on_warn.js";import b from"../path_exists.js";const w=async(r={},e="")=>{const t=r?.errors&&r?.errors[0],o=await b(e)?await f(e,{line:t?.location?.line,column:t?.location?.column}):null;return await h({file:e,stack:r?.stack,line:t?.location?.line,column:t?.location?.column,snippet:o,lineWithError:t?.location?.lineText?.trim(),message:t?.text}),o},v=(r={})=>{const e=r?.message?.split(":");return e[2]&&e[2]?.includes("No loader")?e[3]&&e[3]?.replace(`
1
+ import u from"esbuild";import d from"esbuild-plugin-svg";import s from"./plugins/index.js";import f from"./get_code_frame.js";import p from"../build/minify_file.js";import h from"./on_warn.js";import b from"../path_exists.js";const w=async(r={},e="")=>{const t=r?.errors&&r?.errors[0],o=await b(e)?await f(e,{line:t?.location?.line,column:t?.location?.column}):null;return await h({file:e,stack:r?.stack,line:t?.location?.line,column:t?.location?.column,snippet:o,lineWithError:t?.location?.lineText?.trim(),message:t?.text}),o},v=(r={})=>{const e=r?.message?.split(":");return e[2]&&e[2]?.includes("No loader")?e[3]&&e[3]?.replace(`
2
2
  `,"")||"":e[1]&&e[1]?.replace(`
3
- `,"")||""},u=async(r={})=>{const e=v(r),t=await w(r,e);return{success:!1,path:e,error:{stack:r?.stack,snippet:t}}},g=(r=[],e={})=>c.build({allowOverwrite:!0,platform:"node",format:"esm",bundle:!1,entryPoints:r?.map(t=>t.path),entryNames:"[dir]/[name]",outdir:e?.output_path||"./.joystick/build",outbase:"./",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},logLevel:"silent",plugins:[s.warn_node_environment,s.generate_file_dependency_map]}).catch(t=>{console.warn("NODE",t)}),y=(r=[],e={})=>c.build({allowOverwrite:!0,target:"es2020",platform:"browser",format:"esm",bundle:!0,entryPoints:r?.map(t=>t.path),entryNames:"[dir]/[name]",outbase:"./",outdir:e?.output_path||"./.joystick/build",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},logLevel:"silent",loader:{".svg":"text"},plugins:[s.warn_node_environment,s.generate_file_dependency_map,s.bootstrap_component,d()]}).catch(t=>{console.warn("BROWSER",t)}),N=async r=>{const e=[".DS_Store"],t=r?.files?.filter(n=>!e?.some(i=>n?.path?.includes(i)))?.filter(n=>n?.platform==="node"),o=r?.files?.filter(n=>!e?.some(i=>n?.path?.includes(i)))?.filter(n=>n?.platform==="browser");let l=[],a=[];t?.length>0&&(l=[await g(t,r).then(()=>({success:!0})).catch(n=>u(n))]),o?.length>0&&(a=[await y(o,r).then(()=>({success:!0})).catch(n=>u(n))]);const m=l?.some(n=>!n?.success),_=a?.some(n=>!n?.success);return m||_?Promise.reject([...l,...a]):(r?.environment&&r?.environment!=="development"&&await Promise.all([...o,...t].map(n=>p(`${r?.output_path||"./.joystick/build"}/${n.path}`))),[...l,...a])};var x=N;export{x as default};
3
+ `,"")||""},c=async(r={})=>{const e=v(r),t=await w(r,e);return{success:!1,path:e,error:{stack:r?.stack,snippet:t}}},g=(r=[],e={})=>u.build({allowOverwrite:!0,platform:"node",format:"esm",bundle:!1,sourcemap:!0,entryPoints:r?.map(t=>t.path),entryNames:"[dir]/[name]",outdir:e?.output_path||"./.joystick/build",outbase:"./",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},logLevel:"silent",plugins:[s.warn_node_environment,s.generate_file_dependency_map]}).catch(t=>{console.warn("NODE",t)}),y=(r=[],e={})=>u.build({allowOverwrite:!0,target:"es2020",platform:"browser",format:"esm",bundle:!0,sourcemap:!0,entryPoints:r?.map(t=>t.path),entryNames:"[dir]/[name]",outbase:"./",outdir:e?.output_path||"./.joystick/build",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},logLevel:"silent",loader:{".svg":"text"},plugins:[s.warn_node_environment,s.generate_file_dependency_map,s.bootstrap_component,d()]}).catch(t=>{console.warn("BROWSER",t)}),N=async r=>{const e=[".DS_Store"],t=r?.files?.filter(n=>!e?.some(i=>n?.path?.includes(i)))?.filter(n=>n?.platform==="node"),o=r?.files?.filter(n=>!e?.some(i=>n?.path?.includes(i)))?.filter(n=>n?.platform==="browser");let l=[],a=[];t?.length>0&&(l=[await g(t,r).then(()=>({success:!0})).catch(n=>c(n))]),o?.length>0&&(a=[await y(o,r).then(()=>({success:!0})).catch(n=>c(n))]);const m=l?.some(n=>!n?.success),_=a?.some(n=>!n?.success);return m||_?Promise.reject([...l,...a]):(r?.environment&&r?.environment!=="development"&&await Promise.all([...o,...t].map(n=>p(`${r?.output_path||"./.joystick/build"}/${n.path}`))),[...l,...a])};var x=N;export{x as default};
@@ -1,4 +1,4 @@
1
- import"chalk";import k from"fs";import r from"../../get_platform_safe_path.js";import c from"../../constants.js";import j from"./set_component_id.js";import E from"../../path_exists.js";const{readFile:f,writeFile:g}=k.promises,x=(t="",o=[])=>{for(let _=0;_<o?.length;_+=1){const n=o[_];t=t.replace(`%example:${_}%`,n)}},$=(t="",o="",_="")=>t.replace(`${o};`,`if (
1
+ import"chalk";import k from"fs";import r from"../../get_platform_safe_path.js";import c from"../../constants.js";import j from"./set_component_id.js";import E from"../../path_exists.js";const{readFile:f,writeFile:g}=k.promises,x=(t="",o=[])=>{for(let _=0;_<o?.length;_+=1){const n=o[_];t=t.replace(`%example:${_}%`,n)}},O=(t="",o="",_="")=>t.replace(`${o};`,`if (
2
2
  typeof window !== 'undefined' &&
3
3
  window.__joystick_should_auto_mount__ === true &&
4
4
  !window.__joystick_layout_url__ &&
@@ -11,7 +11,7 @@ import"chalk";import k from"fs";import r from"../../get_platform_safe_path.js";i
11
11
  }
12
12
 
13
13
  export default ${_};
14
- `),O=(t="",o="",_="")=>t.replace(`${o};`,`if (
14
+ `),$=(t="",o="",_="")=>t.replace(`${o};`,`if (
15
15
  typeof window !== 'undefined' &&
16
16
  window.__joystick_should_auto_mount__ === true &&
17
17
  window.__joystick_layout_url__ &&
@@ -30,4 +30,4 @@ import"chalk";import k from"fs";import r from"../../get_platform_safe_path.js";i
30
30
  }
31
31
 
32
32
  export default ${_};
33
- `),X=(t="")=>t.replace(c.JOYSTICK_COMMENT_REGEX,""),y=(t="")=>{let o=0;return t.replace(c.EXAMPLE_CODE_REGEX,()=>`%example:${o++}%`)},w=(t="")=>t.match(c.EXAMPLE_CODE_REGEX)||[],P=(t=null)=>(t&&t.split(" ")||[])?.pop(),R=(t=!1,o=null)=>t&&!!o,C=(t="")=>{const o=t.match(c.EXPORT_DEFAULT_REGEX)||[];return o&&o[0]},h=(t="")=>{const o=t.match(c.JOYSTICK_UI_REGEX)||[];return!!o&&!!o[0]},u=(t="",o={})=>[r(t)].some(_=>o.path.includes(_)),G=(t="")=>[r("ui/"),r("email/")].some(o=>t.includes(o)),I=(t={})=>{t.onLoad({filter:/\.js$/},async(o={})=>{const _=u("ui/layouts",o),n=u("ui/pages",o),p=u("email/",o);if(_||n||p){let e=await f(r(o.path),"utf-8");const l=h(e),i=C(e),s=R(l,i),m=w(e),a=P(i);return e=y(e),e=X(e),e=a&&_?O(e,i,a):e,e=a&&n?$(e,i,a):e,x(e,m),{contents:e,loader:"js"}}}),t.onEnd(()=>new Promise(async o=>{for(let _=0;_<t?.initialOptions?.entryPoints?.length;_+=1){const n=t?.initialOptions?.entryPoints[_],p=G(n),d=await E(`${t?.initialOptions?.outdir}/${n}`);if(p&&d){let e=await f(`${t?.initialOptions?.outdir}/${n}`,"utf-8");const l=h(e),i=w(e);if(e=y(e),l){e=await j(e);for(let s=0;s<i?.length;s+=1){const m=i[s];e=e.replace(`%example:${s}%`,m)}await g(`${t?.initialOptions?.outdir}/${n}`,e)}}}o()}))};var B=I;export{B as default};
33
+ `),X=(t="")=>t.replace(c.JOYSTICK_COMMENT_REGEX,""),y=(t="")=>{let o=0;return t.replace(c.EXAMPLE_CODE_REGEX,()=>`%example:${o++}%`)},w=(t="")=>t.match(c.EXAMPLE_CODE_REGEX)||[],P=(t=null)=>(t&&t.split(" ")||[])?.pop(),R=(t=!1,o=null)=>t&&!!o,C=(t="")=>{const o=t.match(c.EXPORT_DEFAULT_REGEX)||[];return o&&o[0]},h=(t="")=>{const o=t.match(c.JOYSTICK_UI_REGEX)||[];return!!o&&!!o[0]},u=(t="",o={})=>[r(t)].some(_=>o.path.includes(_)),D=(t="")=>[r("ui/"),r("email/")].some(o=>t.includes(o)),G=(t={})=>{t.onLoad({filter:/\.js$/},async(o={})=>{const _=u("ui/layouts",o),n=u("ui/pages",o),p=u("email/",o);if(_||n||p){let e=await f(r(o.path),"utf-8");const l=h(e),i=C(e),s=R(l,i),m=w(e),a=P(i);return e=y(e),e=X(e),e=a&&_?$(e,i,a):e,e=a&&n?O(e,i,a):e,x(e,m),{contents:e,loader:"js"}}}).catch(o=>{console.log("ON LOAD",o)}),t.onEnd(()=>new Promise(async o=>{for(let _=0;_<t?.initialOptions?.entryPoints?.length;_+=1){const n=t?.initialOptions?.entryPoints[_],p=D(n),d=await E(`${t?.initialOptions?.outdir}/${n}`);if(p&&d){let e=await f(`${t?.initialOptions?.outdir}/${n}`,"utf-8");const l=h(e),i=w(e);if(e=y(e),l){e=await j(e);for(let s=0;s<i?.length;s+=1){const m=i[s];e=e.replace(`%example:${s}%`,m)}await g(`${t?.initialOptions?.outdir}/${n}`,e)}}}o()})).catch(o=>{console.log("ON END",o)})};var v=G;export{v as default};
@@ -1 +1 @@
1
- import p from"fs";import o from"../../get_platform_safe_path.js";import m from"./update_file_map.js";const{readFile:n}=p.promises,s=(a={})=>{a.onLoad({filter:/\.js$/},async e=>{if(!["node_modules",".joystick","?","commonjsHelpers.js"].some(t=>o(e.path).includes(t))){const t=await n(o(e.path),"utf-8");await m(o(e.path),t)}})};var c=s;export{c as default};
1
+ import p from"fs";import t from"../../get_platform_safe_path.js";import m from"./update_file_map.js";const{readFile:n}=p.promises,s=(a={})=>{a.onLoad({filter:/\.js$/},async o=>{if(!["node_modules",".joystick","?","commonjsHelpers.js"].some(e=>t(o.path).includes(e))){const e=await n(t(o.path),"utf-8");await m(t(o.path),e)}}).catch(o=>{console.log("GFDM ON LOAD",o)})};var r=s;export{r as default};
@@ -1,3 +1,3 @@
1
- import n from"fs";import t from"chalk";const{readFile:r}=n.promises,a=(e={})=>{e.onLoad({filter:/\.js$/},async(o={})=>{(await r(o.path,"utf-8"))?.match(/process.env.NODE_ENV\s+=\s/gi)?.length&&console.warn(t.yellowBright(`
1
+ import n from"fs";import t from"chalk";const{readFile:a}=n.promises,r=(e={})=>{e.onLoad({filter:/\.js$/},async(o={})=>{(await a(o.path,"utf-8"))?.match(/process.env.NODE_ENV\s+=\s/gi)?.length&&console.warn(t.yellowBright(`
2
2
  [WARNING] process.env.NODE_ENV should only be set via a CLI flag in development or via external environment variables in production.
3
- `))})};var c=a;export{c as default};
3
+ `))}).catch(o=>{console.log("WNE",o)})};var c=r;export{c as default};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.1633",
5
- "canary_version": "0.0.0-canary.1632",
4
+ "version": "0.0.0-canary.1635",
5
+ "canary_version": "0.0.0-canary.1634",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -23,7 +23,7 @@
23
23
  "ava": "^6.0.1",
24
24
  "chalk": "^5.3.0",
25
25
  "chokidar": "^3.5.3",
26
- "esbuild": "^0.19.9",
26
+ "esbuild": "^0.23.1",
27
27
  "esbuild-plugin-svg": "^0.1.0",
28
28
  "form-data": "^4.0.0",
29
29
  "inquirer": "^9.2.12",
@@ -61,7 +61,7 @@ const handle_build_for_node = (node_paths = [], options = {}) => {
61
61
  platform: "node",
62
62
  format: "esm",
63
63
  bundle: false,
64
- // sourcemap: true,
64
+ sourcemap: true,
65
65
  entryPoints: node_paths?.map((file) => file.path),
66
66
  entryNames: '[dir]/[name]',
67
67
  outdir: options?.output_path || "./.joystick/build",
@@ -86,7 +86,7 @@ const handle_build_for_browser = (browser_paths = [], options = {}) => {
86
86
  platform: "browser",
87
87
  format: "esm",
88
88
  bundle: true,
89
- // sourcemap: true,
89
+ sourcemap: true,
90
90
  entryPoints: browser_paths?.map((file) => file.path),
91
91
  entryNames: '[dir]/[name]',
92
92
  outbase: './',
@@ -154,6 +154,8 @@ const bootstrap_component = (build = {}) => {
154
154
  loader: "js",
155
155
  };
156
156
  }
157
+ }).catch((error) => {
158
+ console.log('ON LOAD', error);
157
159
  });
158
160
 
159
161
  build.onEnd(() => {
@@ -185,6 +187,8 @@ const bootstrap_component = (build = {}) => {
185
187
 
186
188
  resolve();
187
189
  });
190
+ }).catch((error) => {
191
+ console.log('ON END', error);
188
192
  });
189
193
  };
190
194
 
@@ -14,6 +14,8 @@ const generate_file_dependency_map = (build = {}) => {
14
14
  const code = await readFile(get_platform_safe_path(args.path), "utf-8");
15
15
  await update_file_map(get_platform_safe_path(args.path), code);
16
16
  }
17
+ }).catch((error) => {
18
+ console.log('GFDM ON LOAD', error);
17
19
  });
18
20
  };
19
21
 
@@ -14,6 +14,8 @@ const warn_node_environment = (build = {}) => {
14
14
  )
15
15
  );
16
16
  }
17
+ }).catch((error) => {
18
+ console.log('WNE', error);
17
19
  });
18
20
  };
19
21