@joystick.js/cli-canary 0.0.0-canary.634 → 0.0.0-canary.635
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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 (
|
|
2
2
|
typeof window !== 'undefined' &&
|
|
3
3
|
window.__joystick_should_auto_mount__ === true &&
|
|
4
4
|
!window.__joystick_layout_url__ &&
|
|
@@ -7,11 +7,11 @@ import k from"chalk";import j from"fs";import r from"../../get_platform_safe_pat
|
|
|
7
7
|
joystick &&
|
|
8
8
|
joystick.mount
|
|
9
9
|
) {
|
|
10
|
-
joystick.mount(${
|
|
10
|
+
joystick.mount(${_}, window.__joystick_ssr_props__ || {}, document.getElementById('app'));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default ${
|
|
14
|
-
`),
|
|
13
|
+
export default ${_};
|
|
14
|
+
`),O=(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__ &&
|
|
@@ -29,5 +29,5 @@ import k from"chalk";import j from"fs";import r from"../../get_platform_safe_pat
|
|
|
29
29
|
})();
|
|
30
30
|
}
|
|
31
31
|
|
|
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)||[],
|
|
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};
|
package/package.json
CHANGED
|
@@ -91,16 +91,6 @@ const get_component_name = (default_export = null) => {
|
|
|
91
91
|
return default_export_parts?.pop();
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
const warn_invalid_component_file = (path = '') => {
|
|
95
|
-
console.log(" ");
|
|
96
|
-
console.warn(
|
|
97
|
-
chalk.yellowBright(
|
|
98
|
-
`All Joystick components in the /ui directory must have an export default statement (e.g., export default MyComponent, export default MyLayout, or export default MyPage). Please check the file at ${path}.`
|
|
99
|
-
)
|
|
100
|
-
);
|
|
101
|
-
console.log(" ");
|
|
102
|
-
};
|
|
103
|
-
|
|
104
94
|
const check_if_valid_component_file = (has_joystick_ui = false, default_export = null) => {
|
|
105
95
|
return has_joystick_ui && !!default_export;
|
|
106
96
|
};
|
|
@@ -145,12 +135,6 @@ const bootstrap_component = (build = {}) => {
|
|
|
145
135
|
const has_joystick_ui = check_if_has_joystick_ui(file_contents);
|
|
146
136
|
const default_export = get_default_export(file_contents);
|
|
147
137
|
const is_valid_component_file = check_if_valid_component_file(has_joystick_ui, default_export);
|
|
148
|
-
|
|
149
|
-
if (!is_valid_component_file) {
|
|
150
|
-
warn_invalid_component_file(build_args.path);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
138
|
const examples_before_replacement = get_examples_before_replacement(file_contents);
|
|
155
139
|
const component_name = get_component_name(default_export);
|
|
156
140
|
|