@webflow/webflow-cli 1.6.8 → 1.6.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @webflow/webflow-cli
2
2
 
3
+ ## 1.6.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Avoid prunning :root selector
8
+
3
9
  ## 1.6.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1011,7 +1011,7 @@ ${s.message}`,s}},Fsi={loadJs:Ssi,loadJsSync:Emt,loadJson:Tsi,loadYaml:ksi};V_e.
1011
1011
  .w-icon-file-upload-icon:before {
1012
1012
  content: "\\e903";
1013
1013
  }
1014
- `;function lHn(e,r,i){let s=["ClassSelector","AttributeSelector","IdSelector"],c=["type"];if(e.type==="Rule"&&(e.prelude.type==="SelectorList"&&(e.prelude.children=new t2().fromArray(e.prelude.children.toArray().filter(l=>{var h;let p="children"in l?(h=l.children)==null?void 0:h.first:null;return!p||!s.includes(p.type)?!1:p.type==="AttributeSelector"?!c.includes(p.name.name):!0}))),e.prelude.children.toArray().length===0&&i)){i.remove(r);return}}var Sot=e=>({name:"global",css:{__bootflow:{rule:e}},module:!1});function kot(e){if(t8.log(epe("Detected skipTagSelectors flag is enabled. Skipping global CSS tags.")),!e)return Sot("");let r=M4e(e==null?void 0:e.css,!0);try{let i=Cot(r);Aot(i,{enter:lHn});let s=Tot.default.format([wot(i),cHn].join(`
1014
+ `;function lHn(e,r,i){let s=["ClassSelector","AttributeSelector","IdSelector","PseudoClassSelector"],c=["type"],l=["root"];if(e.type==="Rule"&&(e.prelude.type==="SelectorList"&&(e.prelude.children=new t2().fromArray(e.prelude.children.toArray().filter(p=>{var g;let h="children"in p?(g=p.children)==null?void 0:g.first:null;return!h||!s.includes(h.type)?!1:h.type==="PseudoClassSelector"?l.includes(h.name):h.type==="AttributeSelector"?!c.includes(h.name.name):!0}))),e.prelude.children.toArray().length===0&&i)){i.remove(r);return}}var Sot=e=>({name:"global",css:{__bootflow:{rule:e}},module:!1});function kot(e){if(t8.log(epe("Detected skipTagSelectors flag is enabled. Skipping global CSS tags.")),!e)return Sot("");let r=M4e(e==null?void 0:e.css,!0);try{let i=Cot(r);Aot(i,{enter:lHn});let s=Tot.default.format([wot(i),cHn].join(`
1015
1015
 
1016
1016
  `).trim(),{parser:"css"});return Sot(s)}catch{return t8.log(PN("There was a problem skipping global tags from CSS. Falling back to normal global CSS.")),e}}function Fot(e){return e.reduce((r,i)=>(i.name==="global"?r.globalCss=i:r.rest.push(i),r),{rest:[]})}var MS=class extends Error{constructor(r){super(r)}},tCe=e=>t8.render({text:`${tpe("Something went wrong while trying to export your components:")} ${MA.red(e.message)}
1017
1017
  ${e==null?void 0:e.stack}`});function Pot(e){if(e.status>=200&&e.status<300){switch(e.status){case 206:t8.log(PN("You exceeded the limit of components and some components were not exported."));break;case 207:t8.log(PN("Certain components couldn't be exported due to an unexpected error."));break}return}switch(e.status){case 400:throw new MS("Something unexpected happened. Report a bug here: https://airtable.com/shr47EWPVsV9xCwOH");case 401:throw new MS("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new MS("You're not currently enrolled in the DevLink beta. You can apply for access here: https://webflow.com/devlink");default:throw new MS("Something went wrong. Try again later or report a bug here: https://airtable.com/shr47EWPVsV9xCwOH")}}async function pHn(e){try{let{siteId:r,host:i,authToken:s,components:c,cssModules:l}=e,p=new URLSearchParams({cssModules:l?"true":"false"});c&&p.append("components",encodeURIComponent(c));let h=`?${p.toString()}`,g=await IN(`${i}/devlink/${r}${h}`,{headers:{Authorization:`Bearer ${s}`},timeout:6e4});Pot(g);let v=await g.json();return v.components||v}catch(r){if(r instanceof MS)tCe(r),process.exit(1);else throw r}}async function dHn(e){try{let{siteId:r,host:i,authToken:s}=e,c=await IN(`${i}/devlink/${r}/engine`,{headers:{Authorization:`Bearer ${s}`},timeout:6e4});return Pot(c),await c.json()}catch(r){if(r instanceof MS)tCe(r),process.exit(1);else throw r}}async function rCe(e){let{rootDir:r}=e;t8.render({text:`Exporting components into ${e.rootDir}.`,showSpinner:!0});try{let[i,s]=await Promise.all([pHn(e),dHn(e)]),c=s;if(e.skipTagSelectors===!0){let{rest:l,globalCss:p}=Fot(i),h=kot(p);c.push(...l,h)}else c.push(...i);await OUe(c,e),t8.render({text:epe(`Succesfully exported components into ${r} folder.`),flushLogs:!0})}catch(i){i instanceof Error&&(tCe(i),FK(i))}}async function Not(e){cit();let r={...e&&e.length>0?{components:_be(e),overwriteModule:!1}:{overwriteModule:!0}},i=await ape(r);if(!i)return Oot.default.exit();await rCe(i)}var l2t=ol(require("http"));var p2t=ol($ut()),d2t=require("fs"),f2t=ol(require("path")),h2t=require("commander");var Qmt=ol(Udt()),lTe=require("commander"),Q_e=require("fs");var zmt=ol(Vmt()),Kmt=require("commander"),J_e=async(e,r)=>{let i=await toi(r);return{filepath:i.filepath,config:{publicDir:e,...i.config}}},toi=async e=>{let i=await(0,zmt.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return i||Kmt.program.error(`No ${e} file was found. Run this command within your extension folder.`),i};var Zmt=ol(Xmt()),X_e=ol(require("path")),coi=5*1024*1024,loi=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),e2t=async(e,r,i)=>{let{config:s,filepath:c}=await J_e(e,r),l=X_e.join(c,".."),p=!0,h=!1,g=b=>{let E=b.name,S=Zmt.default.lookup(E);return E==="index.html"&&(h=!0),E&&E.endsWith(".DS_Store")||!S?!1:loi.has(S)?b:(console.log(`Invalid file type: ${S} for file: ${E}`),p=!1,!1)},v=b=>{(0,Q_e.unlink)(i,E=>{E&&console.error(`Failed to delete file: ${E}`),lTe.program.error(b)})};return console.log(`Packaging the contents of the ${s.publicDir} folder into ${i}...`),new Promise(b=>{let E=(0,Qmt.default)("zip",{zlib:{level:9}}),S=(0,Q_e.createWriteStream)(X_e.join(l,i));S.on("close",()=>{b(void 0)}),E.directory(X_e.join(l,s.publicDir),!1,g),E.file(c,{name:r}),E.pipe(S),E.finalize(),E.on("warning",w=>{console.log(w)}),E.on("error",w=>{lTe.program.error(w.message)}),E.on("finish",()=>{if(!h){v("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!p){v("Bundling failed due to invalid file types");return}if(!E.pointer()||E.pointer()===0){v("Bundling failed with no output");return}if(E.pointer()>=coi){v("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${E.pointer()} total bytes written`),console.log(`Done! ${i} is ready for you to upload to your Webflow app.`)})})};var iT=ol(require("fs")),i4=ol(require("path"));var lae="webflow.json",t2t="index.html",r2t="bundle.zip",pTe="public",dTe="scaffolds",Z_e="default",n2t="./";var i2t="package.json",a2t="wf-placeholder-name",fTe=e=>JSON.stringify(e,null,2),s2t=e=>{let r="\u2500".repeat(e.length+2);return"\u256D"+r+`\u256E
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/webflow-cli",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "bin": {
6
6
  "webflow": "./dist/index.js"