@ikas/storefront-next 5.0.3 → 5.0.4
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
|
-
import{__awaiter as n,__generator as
|
|
1
|
+
import{__awaiter as n,__generator as t}from"../../../ext/tslib/tslib.es6.js";import e from"path";import{createFile as o,deleteDirContent as r}from"../../../utils/fs.js";import{IkasThemeJsonPageType as c}from"@ikas/storefront-models";import{PAGE_INFO as i,CHECKOUT_COMPONENT_ID as s}from"../pages/info.js";import{findAllByKey as a}from"../../../utils/helper.js";import u from"lodash/uniq";var p=function(){function p(){}return p.generate=function(o,c,i){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,r(e.join(c||process.cwd(),"src","components","__generated__"))];case 1:return t.sent(),[4,p.generateAllPageComponentImportsFiles(o,c,i)];case 2:return(n=t.sent())?[4,p.generateAllComponentImportsFileForEditor(o,c)]:[3,4];case 3:n=t.sent(),t.label=4;case 4:return[2,n]}}))}))},p.generateAllPageComponentImportsFiles=function(e,o,r){return n(this,void 0,void 0,(function(){var n,c,s,a,u;return t(this,(function(t){switch(t.label){case 0:n=!0,c=0,s=i,t.label=1;case 1:return c<s.length?(a=s[c],(u=n)?[4,p.generatePageComponentImportsFileWithInfo(a,e,o,r)]:[3,3]):[3,5];case 2:u=t.sent(),t.label=3;case 3:n=u,t.label=4;case 4:return c++,[3,1];case 5:return[2,n]}}))}))},p.generatePageComponentImportsFileWithInfo=function(e,o,r,c){return n(this,void 0,void 0,(function(){var n,i,f,m;return t(this,(function(t){switch(t.label){case 0:if(e.isCheckout||e.isEditor)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),n=o.components,i=[],e.pageTypes.forEach((function(t){var e=o.pages.filter((function(n){return n.type===t}));e.length&&e.forEach((function(t){var e,o=t.components;(null===(e=t.specifications)||void 0===e?void 0:e.length)&&t.specifications.forEach((function(n){o.push.apply(o,n.components)})),i.push.apply(i,o.map((function(n){return n.componentId}))),o.forEach((function(t){var e=n.find((function(n){return n.id===t.componentId}));if(e){var o=a(e.commonPropValues||t.propValues,"componentId");i.push.apply(i,o)}})),null==c||c.forEach((function(n){var t=a(n,"componentId");i.push.apply(i,t)}))}))})),i=u(i),f=n.filter((function(n){return i.includes(n.id)&&n.id!==s})),[4,p.generateComponentImportsFile(f,e,r)];case 2:return[2,t.sent()];case 3:return m=t.sent(),console.error(m),[2,!1];case 4:return[2]}}))}))},p.generatePageComponentImportsFileWithType=function(n,t,e){if(n!==c.CHECKOUT){try{var o=i.find((function(t){return t.pageTypes.includes(n)}));if(o)return p.generatePageComponentImportsFileWithInfo(o,t,e)}catch(n){console.error(n)}return!1}},p.generateComponentImportsFile=function(n,t,r){try{var c="";return n.filter((function(n){return"checkout"!==n.id})).forEach((function(n,t){c+="import Component".concat(t,' from "src/components/').concat(n.dir,'";\r\n')})),c+="\n const Components = {\n ".concat(n.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n };\n "),c+="\r\n",c+="export default Components;",o(e.join(r||process.cwd(),"src","components","__generated__","pages"),t.path.replace("tsx","ts"),c)}catch(n){return console.error(n),!1}},p.generateAllComponentImportsFileForEditor=function(r,c){return n(this,void 0,void 0,(function(){var n,i,s,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n='import dynamic from "next/dynamic";\r\n',n+='import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n',n+="\r\n",n+="\r\n",(i=r.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,e){n+="const Component".concat(e,' = dynamic(() => import("../').concat(t.dir,'"), { loading: () => <IkasEditorComponentLoader /> });\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(i.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",s=e.join(c||process.cwd(),"src","components","__generated__"),[4,o(s,"editor.tsx",n)];case 1:return[2,t.sent()];case 2:return a=t.sent(),console.error(a),[2,!1];case 3:return[2]}}))}))},p.generateAllComponentImportsFile=function(r,c){return n(this,void 0,void 0,(function(){var n,i,s,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n="",(i=r.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,e){n+="import Component".concat(e,' from "../').concat(t.dir,'";\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(i.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",s=e.join(c||process.cwd(),"src","components","__generated__"),[4,o(s,"index.tsx",n)];case 1:return[2,t.sent()];case 2:return a=t.sent(),console.error(a),[2,!1];case 3:return[2]}}))}))},p}();export{p as ComponentImportsGenerator};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^5.0.
|
|
21
|
-
"@ikas/storefront-providers": "^5.0.
|
|
22
|
-
"@ikas/storefront-models": "^5.0.
|
|
23
|
-
"@ikas/storefront-api": "^5.0.
|
|
24
|
-
"@ikas/storefront-assets": "^5.0.
|
|
20
|
+
"@ikas/storefront-config": "^5.0.4",
|
|
21
|
+
"@ikas/storefront-providers": "^5.0.4",
|
|
22
|
+
"@ikas/storefront-models": "^5.0.4",
|
|
23
|
+
"@ikas/storefront-api": "^5.0.4",
|
|
24
|
+
"@ikas/storefront-assets": "^5.0.4",
|
|
25
25
|
"axios": "^0.26.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"adm-zip": "^0.5.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^5.0.
|
|
32
|
-
"@ikas/storefront-config": "^5.0.
|
|
33
|
-
"@ikas/storefront-providers": "^5.0.
|
|
34
|
-
"@ikas/storefront-models": "^5.0.
|
|
35
|
-
"@ikas/storefront-api": "^5.0.
|
|
36
|
-
"@ikas/storefront-assets": "^5.0.
|
|
31
|
+
"@ikas/storefront-cmd": "^5.0.4",
|
|
32
|
+
"@ikas/storefront-config": "^5.0.4",
|
|
33
|
+
"@ikas/storefront-providers": "^5.0.4",
|
|
34
|
+
"@ikas/storefront-models": "^5.0.4",
|
|
35
|
+
"@ikas/storefront-api": "^5.0.4",
|
|
36
|
+
"@ikas/storefront-assets": "^5.0.4",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
38
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
39
39
|
"@rollup/plugin-json": "^4.1.0",
|