builder.io 1.1.13-17 → 1.1.13-18

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/cli/index.cjs CHANGED
@@ -1438,7 +1438,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
1438
1438
  </script>
1439
1439
  </body>
1440
1440
  </html>
1441
- `)}async function QI(e,t){let n=await Sx(e),r=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,n).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,r.length?r[0].name:"")}var XI=require("os");async function ZI(e,t){let n=new URL("/cli-auth","https://builder.io");n.searchParams.set("client_id",e.getClientId()),n.searchParams.set("host",await e.getDeviceId()),n.searchParams.set("response_type","code"),n.searchParams.set("cli","true");let r=new URL(si,e.devToolsServerUrl);r.searchParams.set(hc,(0,XI.platform)()),r.searchParams.set(_c,process.versions.node);let i=e.getFrameworks();return i.length>0&&(n.searchParams.set(Wi,i[0].name),r.searchParams.set(Wi,i[0].name)),n.searchParams.set("redirect_url",r.href),n.searchParams.set("preview_url",t),n.href}async function tO(e,t,n,r){try{if(!e)return ls(n,r,400,"Builder context closed");let i=O7(n);if(i.pathname===Hd){if(n.method==="POST"){let s=await I7(n);if(s)try{let o=await YI(e,JSON.parse(s));return eO(n,r,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let a={errors:[String(o.message||o)]};return eO(n,r,500,a)}}else if(n.method==="OPTIONS"){let s={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},o=n.headers.origin;o&&o!=="null"?nO(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",r.writeHead(200,s),r.end();return}return ls(n,r,405,`${Hd} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===Vd)return R7(n,r,200,await WI(e));if(i.pathname===eE){let s=i.searchParams.get(Kd);return s?A7(r,302,await ZI(e,s)):ls(n,r,400,`Missing ${Kd} querystring`)}return i.pathname===si?N7(n,r,200,await JI(e)):i.pathname===ai?(e.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{t.close(s=>{e.debug(`Dev Tools Server Closed Error: ${s}`)})}catch(s){e.debug(`Error closing devtools server: ${s}`)}},20),ls(n,r,200,"Closing Dev Tools Server")):ls(n,r,404,"Not found")}catch(i){return console.error("Dev Server Error",i),ls(n,r,500,`Dev Server Error: ${i}`)}}function eO(e,t,n,r){Fd(e,t,n,"application/json",JSON.stringify(r))}function R7(e,t,n,r){Fd(e,t,n,"application/javascript",r)}function N7(e,t,n,r){Fd(e,t,n,"text/html",r)}function ls(e,t,n,r){Fd(e,t,n,"text/plain",r)}function Fd(e,t,n,r,i){let s={"Content-Type":`${r}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.1.12"},o=e.headers.origin;o&&o!=="null"?nO(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",t.writeHead(n,s),t.end(i)}function nO(e){return e.hostname==="localhost"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function A7(e,t,n){e.writeHead(t,{Location:n}),e.end()}async function I7(e){let t="";for await(let n of e)t+=n;return t}function O7(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function rO(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await P7(e),n=(0,kd.createServer)((i,s)=>{tO(e,n,i,s)}),r=()=>new Promise((i,s)=>{n.listening?(e.debug(`closing devtools server on port ${t}`),n.close(o=>{e=null,o?(e.debug(`error closing devtools server on port ${t}`),s(o)):(e&&e.debug(`closed devtools server on port ${t}`),i())})):(e.debug(`devtools server on port ${t} not listening`),i())});return process.once("SIGTERM",r),process.once("SIGINT",r),process.env.CI!=="true"&&process.stdin.on("end",r),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:i=>{e.debug(`set devtools context on server ${t}`),e=i},close:async()=>{globalThis.__builderDevToolsServer=null,await r()}},new Promise(i=>{n.listen(t,()=>{e.debug(`started devtools server on port ${t}`),i(globalThis.__builderDevToolsServer)})})}function P7(e){return new Promise(t=>{let n=e.port;try{(0,kd.request)({hostname:"localhost",port:n,path:ai,method:"GET"},i=>{i.on("end",()=>{e.debug(`${ai} - Response ended`),t(n)})}).on("error",i=>{e.debug(`${ai} - No response ${i}`),t(n)}).end()}catch(r){e.debug(`${ai} - Error ${r}`),t(n)}})}async function Vb(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},n=e.getFrameworks().map(s=>s.name).join(", ");t.debug(`create devtools ${iO} [${n}]`);let r=await rO(t);return t.devToolsServerUrl=r.url,t.port=r.port,{getUrl:()=>t.devToolsServerUrl}}var iO="1.1.12";var aO=G(require("chokidar"),1);function cO(e){let t=e.match(/builder\.io\/content\/([^?]+)\?codeSession=([^&]+)&sid=([^\s]+)/);return t?{contentId:t[1],sessionKey:t[2],snippetId:t[3]}:{}}async function F7(e,t,n){let r=await(0,sO.glob)("**/*",{cwd:e,ignore:["node_modules/**"],nodir:!0}),i=[];for(let s of r){let o=(0,hn.resolve)(e,s);try{let a=(0,_n.readFileSync)(o,"utf-8");if(a.includes("This code was generated by Builder.io")){let c=cO(a);if(t&&n&&(c.contentId!==t||c.sessionKey!==n))continue;i.push({path:s,code:a,name:s.split("/").pop()||"",timestamp:(0,_n.statSync)(o).mtime.getTime(),snippetId:c.snippetId})}}catch(a){console.error(`Error reading file ${o}:`,a)}}return i}function k7(e,t){let n=cO(e);return n.contentId===t.contentId&&n.sessionKey===t.sessionKey}function oO(e,t,n){let r=aO.default.watch(e,{ignored:["**/node_modules/**","**/.git/**","**/dist/**","**/build/**"],persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:500},ignorePermissionErrors:!0}),i=async o=>{let a=(0,hn.relative)(e,o);try{let c=(0,_n.readFileSync)(o,"utf-8");if(k7(c,t.snippet)){let u=t.writtenFiles.find(l=>l.path===a);u?(u.code=c,u.timestamp=Date.now()):t.writtenFiles.push({path:a,code:c,timestamp:Date.now(),name:a.split("/").pop()||""}),t.timeStamp=Date.now(),n(t)}}catch(c){console.debug(`Error reading file ${o}:`,c)}};r.on("add",async o=>{U.info(`File added: ${o}`),await i(o)}).on("change",async o=>{U.info(`File changed: ${o}`),await i(o)}).on("unlink",o=>{U.info(`File deleted: ${o}`);let a=(0,hn.relative)(e,o);t.writtenFiles=t.writtenFiles.filter(c=>c.path!==a),t.timeStamp=Date.now(),n(t)}).on("unlinkDir",o=>{U.info(`Folder deleted: ${o}`);let a=(0,hn.relative)(e,o);t.writtenFiles=t.writtenFiles.filter(c=>!c.path.startsWith(a)),t.timeStamp=Date.now(),n(t)}).on("ready",()=>{console.debug("Initial scan complete. Ready for changes.")}).on("error",o=>{console.error(`Watcher error: ${o}`)}),r.on("raw",async(o,a,c)=>{if(o==="renamed"){U.info(`File renamed: ${c.oldPath} -> ${a}`);let u=c.oldPath?(0,hn.relative)(e,c.oldPath):void 0,l=a?(0,hn.relative)(e,a):void 0;if(u&&l){let d=t.writtenFiles.find(p=>p.path===u);d&&(d.path=l,t.timeStamp=Date.now(),n(t))}}});let s=()=>{r.close()};return process.on("SIGINT",s),process.on("SIGTERM",s),s}async function uO(e,t){e.debug("builder sync server init");let n=await Ui(e),r=t,i=()=>{};r&&setTimeout(()=>{i=oO(process.cwd(),r,s=>{r=s})},1e3),await Vb({...n,getPastSyncInfo:({sessionKey:s,since:o})=>!r||s!==r.snippet.sessionKey?r:{...r,hasChanged:r.timeStamp>o},resyncSnippet:async s=>{i();let o=await zb({path:r?.pathInput,snippet:s.snippet,cwd:process.cwd()});return o&&(r=o,i=oO(process.cwd(),r,a=>{r=a})),r},getClientId:()=>"builder-sync-cli",closeAppServer:async()=>{},restartAppServer:async()=>{e.debug("restart server")},enableAppWatch:async s=>s,...e})}async function zb(e){let t=e.snippetId,n=e.snippet||null;if(!n&&t&&(n=await jb(t)),!n)throw new Error(`No snippet found for id ${t}`);let r=await F7(process.cwd(),n.contentId,n.sessionKey),i=r.filter(c=>c.snippetId===n.id);if(i.length>0){let c=Math.max(...i.map(u=>u.timestamp||0));return{snippet:n,writtenFiles:i,pathInput:e.path||".",timeStamp:c}}for(let c of r){let u=(0,hn.resolve)(process.cwd(),c.path);try{(0,_n.unlinkSync)(u),U.info(`Deleted old file: ${u}`);let l=(0,hn.dirname)(u);(0,_n.readdirSync)(l).length===0&&((0,_n.rmdirSync)(l),U.info(`Deleted empty folder: ${l}`))}catch(l){U.error(`Error cleaning up file ${u}: ${l}`)}}let s=Gb(n.framework||"react"),o=e.path||await Ft({message:"Where should we copy the files?",initialValue:s,validate(c){if(c.length===0)return"File path is required!";if(c[0]!==".")return"Please enter a relative path."}});Fe(o)&&(de("Cancelled sync"),process.exit(0));let a=await Od(n,n.files,o);return U.success("All files have been written successfully."),{snippet:n,writtenFiles:a,pathInput:o,timeStamp:Date.now()+500}}function M7(){Md.init("ac35e3108919035e7d150a2450a07405",{logLevel:Md.Types.LogLevel.None,flushIntervalMillis:500}),bn.init({dsn:"https://3252dddc08dbb5bf406dc33bf3c13633@o117565.ingest.sentry.io/4505630794448896",tracesSampleRate:1,integrations:[new bn.Integrations.Http({tracing:!0}),...bn.autoDiscoverNodePerformanceMonitoringIntegrations()]})}async function L7(e){e.debug("builder dev tools cli init");let t=await(0,lO.createDevTools)(e);await(0,pO.createDevToolsServer)({...t,getClientId:()=>"builder-dev-tools-cli",closeAppServer:async()=>{},restartAppServer:async()=>{e.debug("restart server")},enableAppWatch:async n=>n,...e})}var mO=()=>process.exit(0);process.on("SIGINT",mO);process.on("SIGTERM",mO);async function B7(){M7();try{let e=await(0,dO.createDevToolsNodeSys)({getRootDir:()=>process.cwd(),ignoreMissingConfig:!0}),t=(0,fO.default)(process.argv.slice(2),{string:["figmaToken","privateKey"],boolean:["help","ci","force","printJson"]}),n=t._[0];if(n==="figma"){let r=t._[1];try{await AI(e,r,t)}catch(i){bn.captureException(i),console.error("Cannot run figma command",i),process.exit(1)}}else if(n==="add"){let r=Kb(process.cwd(),process.argv.slice(2));await kI(r)}else if(n==="sync"){let r=Kb(process.cwd(),process.argv.slice(2)),i=await zb(r);uO(e,i).then(()=>{console.info("Builder dev tools is running")}).catch(s=>{bn.captureException(s),console.error("Cannot start builder dev tools",s)})}else n==="publish"||n==="migrate"||n==="generate"?(de("Command not found, do you mean `npx builder.io figma "+n+"`?"),process.exit(1)):L7(e).then(()=>{console.info("Builder dev tools is running")}).catch(r=>{bn.captureException(r),console.error("Cannot start builder dev tools",r)})}catch(e){bn.captureException(e),console.error("error"),process.exit(1)}}B7();
1441
+ `)}async function QI(e,t){let n=await Sx(e),r=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,n).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,r.length?r[0].name:"")}var XI=require("os");async function ZI(e,t){let n=new URL("/cli-auth","https://builder.io");n.searchParams.set("client_id",e.getClientId()),n.searchParams.set("host",await e.getDeviceId()),n.searchParams.set("response_type","code"),n.searchParams.set("cli","true");let r=new URL(si,e.devToolsServerUrl);r.searchParams.set(hc,(0,XI.platform)()),r.searchParams.set(_c,process.versions.node);let i=e.getFrameworks();return i.length>0&&(n.searchParams.set(Wi,i[0].name),r.searchParams.set(Wi,i[0].name)),n.searchParams.set("redirect_url",r.href),n.searchParams.set("preview_url",t),n.href}async function tO(e,t,n,r){try{if(!e)return ls(n,r,400,"Builder context closed");let i=O7(n);if(i.pathname===Hd){if(n.method==="POST"){let s=await I7(n);if(s)try{let o=await YI(e,JSON.parse(s));return eO(n,r,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let a={errors:[String(o.message||o)]};return eO(n,r,500,a)}}else if(n.method==="OPTIONS"){let s={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},o=n.headers.origin;o&&o!=="null"?nO(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",r.writeHead(200,s),r.end();return}return ls(n,r,405,`${Hd} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===Vd)return R7(n,r,200,await WI(e));if(i.pathname===eE){let s=i.searchParams.get(Kd);return s?A7(r,302,await ZI(e,s)):ls(n,r,400,`Missing ${Kd} querystring`)}return i.pathname===si?N7(n,r,200,await JI(e)):i.pathname===ai?(e.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{t.close(s=>{e.debug(`Dev Tools Server Closed Error: ${s}`)})}catch(s){e.debug(`Error closing devtools server: ${s}`)}},20),ls(n,r,200,"Closing Dev Tools Server")):ls(n,r,404,"Not found")}catch(i){return console.error("Dev Server Error",i),ls(n,r,500,`Dev Server Error: ${i}`)}}function eO(e,t,n,r){Fd(e,t,n,"application/json",JSON.stringify(r))}function R7(e,t,n,r){Fd(e,t,n,"application/javascript",r)}function N7(e,t,n,r){Fd(e,t,n,"text/html",r)}function ls(e,t,n,r){Fd(e,t,n,"text/plain",r)}function Fd(e,t,n,r,i){let s={"Content-Type":`${r}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.1.12"},o=e.headers.origin;o&&o!=="null"?nO(new URL(o))&&(s["Access-Control-Allow-Origin"]=o):s["Access-Control-Allow-Origin"]="*",t.writeHead(n,s),t.end(i)}function nO(e){return e.hostname==="localhost"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function A7(e,t,n){e.writeHead(t,{Location:n}),e.end()}async function I7(e){let t="";for await(let n of e)t+=n;return t}function O7(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function rO(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await P7(e),n=(0,kd.createServer)((i,s)=>{tO(e,n,i,s)}),r=()=>new Promise((i,s)=>{n.listening?(e.debug(`closing devtools server on port ${t}`),n.close(o=>{e=null,o?(e.debug(`error closing devtools server on port ${t}`),s(o)):(e&&e.debug(`closed devtools server on port ${t}`),i())})):(e.debug(`devtools server on port ${t} not listening`),i())});return process.once("SIGTERM",r),process.once("SIGINT",r),process.env.CI!=="true"&&process.stdin.on("end",r),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:i=>{e.debug(`set devtools context on server ${t}`),e=i},close:async()=>{globalThis.__builderDevToolsServer=null,await r()}},new Promise(i=>{n.listen(t,()=>{e.debug(`started devtools server on port ${t}`),i(globalThis.__builderDevToolsServer)})})}function P7(e){return new Promise(t=>{let n=e.port;try{(0,kd.request)({hostname:"localhost",port:n,path:ai,method:"GET"},i=>{i.on("end",()=>{e.debug(`${ai} - Response ended`),t(n)})}).on("error",i=>{e.debug(`${ai} - No response ${i}`),t(n)}).end()}catch(r){e.debug(`${ai} - Error ${r}`),t(n)}})}async function Vb(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},n=e.getFrameworks().map(s=>s.name).join(", ");t.debug(`create devtools ${iO} [${n}]`);let r=await rO(t);return t.devToolsServerUrl=r.url,t.port=r.port,{getUrl:()=>t.devToolsServerUrl}}var iO="1.1.12";var aO=G(require("chokidar"),1);function cO(e){let t=e.match(/builder\.io\/content\/([^?]+)\?codeSession=([^&]+)&sid=([^\s]+)/);return t?{contentId:t[1],sessionKey:t[2],snippetId:t[3]}:{}}async function F7(e,t,n){let r=await(0,sO.glob)("**/*",{cwd:e,ignore:["node_modules/**"],nodir:!0}),i=[];for(let s of r){let o=(0,hn.resolve)(e,s);try{let a=(0,_n.readFileSync)(o,"utf-8");if(a.includes("This code was generated by Builder.io")){let c=cO(a);if(t&&n&&(c.contentId!==t||c.sessionKey!==n))continue;i.push({path:s,code:a,name:s.split("/").pop()||"",timestamp:(0,_n.statSync)(o).mtime.getTime(),snippetId:c.snippetId})}}catch(a){console.error(`Error reading file ${o}:`,a)}}return i}function k7(e,t){let n=cO(e);return n.contentId===t.contentId&&n.sessionKey===t.sessionKey}function oO(e,t,n){let r=aO.default.watch(e,{ignored:["**/node_modules/**","**/.git/**","**/dist/**","**/build/**"],persistent:!0,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:500},ignorePermissionErrors:!0,followSymlinks:!1}),i=async o=>{let a=(0,hn.relative)(e,o);try{let c=(0,_n.readFileSync)(o,"utf-8");if(k7(c,t.snippet)){let u=t.writtenFiles.find(l=>l.path===a);u?(u.code=c,u.timestamp=Date.now()):t.writtenFiles.push({path:a,code:c,timestamp:Date.now(),name:a.split("/").pop()||""}),t.timeStamp=Date.now(),n(t)}}catch(c){console.debug(`Error reading file ${o}:`,c)}};r.on("add",async o=>{U.info(`File added: ${o}`),await i(o)}).on("change",async o=>{U.info(`File changed: ${o}`),await i(o)}).on("unlink",o=>{U.info(`File deleted: ${o}`);let a=(0,hn.relative)(e,o);t.writtenFiles=t.writtenFiles.filter(c=>c.path!==a),t.timeStamp=Date.now(),n(t)}).on("unlinkDir",o=>{U.info(`Folder deleted: ${o}`);let a=(0,hn.relative)(e,o);t.writtenFiles=t.writtenFiles.filter(c=>!c.path.startsWith(a)),t.timeStamp=Date.now(),n(t)}).on("ready",()=>{console.debug("Initial scan complete. Ready for changes.")}).on("error",o=>{console.error(`Watcher error: ${o}`)}),r.on("raw",async(o,a,c)=>{if(o==="renamed"){U.info(`File renamed: ${c.oldPath} -> ${a}`);let u=c.oldPath?(0,hn.relative)(e,c.oldPath):void 0,l=a?(0,hn.relative)(e,a):void 0;if(u&&l){let d=t.writtenFiles.find(p=>p.path===u);d&&(d.path=l,t.timeStamp=Date.now(),n(t))}}});let s=async()=>{await r.close()};return process.on("SIGINT",s),process.on("SIGTERM",s),s}async function uO(e,t){e.debug("builder sync server init");let n=await Ui(e),r=t,i=()=>Promise.resolve();r&&setTimeout(()=>{i=oO(process.cwd(),r,s=>{r=s})},1e3),await Vb({...n,getPastSyncInfo:({sessionKey:s,since:o})=>!r||s!==r.snippet.sessionKey?r:{...r,hasChanged:r.timeStamp>o},resyncSnippet:async s=>{await i();let o=await zb({path:r?.pathInput,snippet:s.snippet,cwd:process.cwd()});return o&&(r=o,i=oO(process.cwd(),r,a=>{r=a})),r},getClientId:()=>"builder-sync-cli",closeAppServer:async()=>{await i()},restartAppServer:async()=>{e.debug("restart server")},enableAppWatch:async s=>s,...e})}async function zb(e){let t=e.snippetId,n=e.snippet||null;if(!n&&t&&(n=await jb(t)),!n)throw new Error(`No snippet found for id ${t}`);let r=await F7(process.cwd(),n.contentId,n.sessionKey),i=r.filter(c=>c.snippetId===n.id);if(i.length>0){let c=Math.max(...i.map(u=>u.timestamp||0));return{snippet:n,writtenFiles:i,pathInput:e.path||".",timeStamp:c}}for(let c of r){let u=(0,hn.resolve)(process.cwd(),c.path);try{(0,_n.unlinkSync)(u),U.info(`Deleted old file: ${u}`);let l=(0,hn.dirname)(u);(0,_n.readdirSync)(l).length===0&&((0,_n.rmdirSync)(l),U.info(`Deleted empty folder: ${l}`))}catch(l){U.error(`Error cleaning up file ${u}: ${l}`)}}let s=Gb(n.framework||"react"),o=e.path||await Ft({message:"Where should we copy the files?",initialValue:s,validate(c){if(c.length===0)return"File path is required!";if(c[0]!==".")return"Please enter a relative path."}});Fe(o)&&(de("Cancelled sync"),process.exit(0));let a=await Od(n,n.files,o);return U.success("All files have been written successfully."),{snippet:n,writtenFiles:a,pathInput:o,timeStamp:Date.now()+500}}function M7(){Md.init("ac35e3108919035e7d150a2450a07405",{logLevel:Md.Types.LogLevel.None,flushIntervalMillis:500}),bn.init({dsn:"https://3252dddc08dbb5bf406dc33bf3c13633@o117565.ingest.sentry.io/4505630794448896",tracesSampleRate:1,integrations:[new bn.Integrations.Http({tracing:!0}),...bn.autoDiscoverNodePerformanceMonitoringIntegrations()]})}async function L7(e){e.debug("builder dev tools cli init");let t=await(0,lO.createDevTools)(e);await(0,pO.createDevToolsServer)({...t,getClientId:()=>"builder-dev-tools-cli",closeAppServer:async()=>{},restartAppServer:async()=>{e.debug("restart server")},enableAppWatch:async n=>n,...e})}var mO=()=>process.exit(0);process.on("SIGINT",mO);process.on("SIGTERM",mO);async function B7(){M7();try{let e=await(0,dO.createDevToolsNodeSys)({getRootDir:()=>process.cwd(),ignoreMissingConfig:!0}),t=(0,fO.default)(process.argv.slice(2),{string:["figmaToken","privateKey"],boolean:["help","ci","force","printJson"]}),n=t._[0];if(n==="figma"){let r=t._[1];try{await AI(e,r,t)}catch(i){bn.captureException(i),console.error("Cannot run figma command",i),process.exit(1)}}else if(n==="add"){let r=Kb(process.cwd(),process.argv.slice(2));await kI(r)}else if(n==="sync"){let r=Kb(process.cwd(),process.argv.slice(2)),i=await zb(r);uO(e,i).then(()=>{console.info("Builder dev tools is running")}).catch(s=>{bn.captureException(s),console.error("Cannot start builder dev tools",s)})}else n==="publish"||n==="migrate"||n==="generate"?(de("Command not found, do you mean `npx builder.io figma "+n+"`?"),process.exit(1)):L7(e).then(()=>{console.info("Builder dev tools is running")}).catch(r=>{bn.captureException(r),console.error("Cannot start builder dev tools",r)})}catch(e){bn.captureException(e),console.error("error"),process.exit(1)}}B7();
1442
1442
  /*! Bundled license information:
1443
1443
 
1444
1444
  cookie/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "builder.io",
3
- "version": "1.1.13-17",
3
+ "version": "1.1.13-18",
4
4
  "description": "Add and Sync Builder.io code snippets to an application",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,6 +5,6 @@ export declare function extractSignatureInfo(content: string): {
5
5
  snippetId?: string;
6
6
  };
7
7
  export declare function findBuilderFiles(basePath: string, targetContentId: string, targetSessionKey: string): Promise<FileNode[]>;
8
- export declare function watchDirectory(basePath: string, syncInfo: SyncInfo, onChange: (updatedSyncInfo: SyncInfo) => void): () => void;
8
+ export declare function watchDirectory(basePath: string, syncInfo: SyncInfo, onChange: (updatedSyncInfo: SyncInfo) => void): () => Promise<void>;
9
9
  export declare function setupSyncServer(sys: DevToolsSys, initialSyncInfo?: SyncInfo): Promise<void>;
10
10
  export declare function syncCommand(opts: AddCliOptions): Promise<SyncInfo | undefined>;