@fugood/bricks-cli 2.26.0-beta.2 → 2.26.0-beta.20

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/lib/9320.js CHANGED
@@ -1,3 +1,24 @@
1
- export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={65650(e,t,r){e.exports=r(78942).Symbol},87379(e,t,r){var o=r(65650),n=r(8870),s=r(29005),i=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):s(e)}},86403(e,t,r){var o=r(62945),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},74967(e){e.exports="object"==typeof global&&global&&global.Object===Object&&global},8870(e,t,r){var o=r(65650),n=Object.prototype,s=n.hasOwnProperty,i=n.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var o=!0}catch(e){}var n=i.call(e);return o&&(t?e[a]=r:delete e[a]),n}},29005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78942(e,t,r){var o=r(74967),n="object"==typeof self&&self&&self.Object===Object&&self;e.exports=o||n||Function("return this")()},62945(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},12784(e,t,r){var o=r(41580),n=r(94495),s=r(6131),i=Math.max,a=Math.min;e.exports=function(e,t,r){var c,u,l,p,h,d,f=0,v=!1,m=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(t){var r=c,o=u;return c=u=void 0,f=t,p=e.apply(o,r)}function b(e){var r=e-d,o=e-f;return void 0===d||r>=t||r<0||m&&o>=l}function _(){var e,r,o,s=n();if(b(s))return x(s);h=setTimeout(_,(e=s-d,r=s-f,o=t-e,m?a(o,l-r):o))}function x(e){return(h=void 0,y&&c)?g(e):(c=u=void 0,p)}function w(){var e,r=n(),o=b(r);if(c=arguments,u=this,d=r,o){if(void 0===h)return f=e=d,h=setTimeout(_,t),v?g(e):p;if(m)return clearTimeout(h),h=setTimeout(_,t),g(d)}return void 0===h&&(h=setTimeout(_,t)),p}return t=s(t)||0,o(r)&&(v=!!r.leading,l=(m="maxWait"in r)?i(s(r.maxWait)||0,t):l,y="trailing"in r?!!r.trailing:y),w.cancel=function(){void 0!==h&&clearTimeout(h),f=0,c=d=u=h=void 0},w.flush=function(){return void 0===h?p:x(n())},w}},41580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},80547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},51187(e,t,r){var o=r(87379),n=r(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},94495(e,t,r){var o=r(78942);e.exports=function(){return o.Date.now()}},6131(e,t,r){var o=r(86403),n=r(41580),s=r(51187),i=0/0,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return i;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var r=c.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):a.test(e)?i:+e}},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var o=r(3634),n=r(70604),s=r(78243),i=r(5523);e.exports=function(e){return o(e)||n(e)||s(e)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},75720(e,t,r){r.d(t,{p:()=>a,sh:()=>l});var o=r(90250),n=r(99436),s=r(31421),i=r(73024),a=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,i.existsSync)(e)?[process.execPath,e]:[process.execPath]};class c{_cwd=void 0;_mode="default";_throw=!0;_env=void 0;_promise=null;constructor(e){this.args=e}cwd(e){return this._cwd=e,this}quiet(){return this._mode="quiet",this}nothrow(){return this._throw=!1,this}env(e){return this._env={...this._env,...e},this}text(){var e=this;return n(function*(){return"default"===e._mode&&(e._mode="text"),(yield e.run()).stdout.toString("utf8")})()}then(e,t){return this.run().then(e,t)}run(){return this._promise||(this._promise=this.exec()),this._promise}exec(){var e=this;return n(function*(){var t=o(e.args),r=t[0],n=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o})(t).slice(1);if(!r)throw Error("sh: empty command");var i="default"===e._mode?["inherit","pipe","pipe"]:"quiet"===e._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],a=e._env?{...process.env,...e._env}:void 0,c=(0,s.spawn)(r,n,{cwd:e._cwd,stdio:i,env:a}),u=[],l=[];c.stdout?.on("data",t=>{u.push(t),"default"===e._mode&&process.stdout.write(t)}),c.stderr?.on("data",t=>{l.push(t),"default"===e._mode&&process.stderr.write(t)});var p=yield new Promise((e,t)=>{c.on("error",t),c.on("close",t=>e(t??0))}),h=Buffer.concat(u),d=Buffer.concat(l);if(0!==p&&e._throw){var f=Error(`sh: command failed with exit ${p}: ${e.args.join(" ")}`);throw f.exitCode=p,f.stdout=h,f.stderr=d,f}return{exitCode:p,stdout:h,stderr:d}})()}}var u=/\s/;function l(e,...t){var r,o,n,s,i,a=(r=[],o="",n=!1,s=()=>{n&&(r.push(o),o="",n=!1)},i=e=>{o+=e,n=!0},(e.forEach((e,r)=>{for(var o=0;o<e.length;o++){var n=e[o];u.test(n)?s():i(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&s(),i(String(e))});i(String(e))}})(t[r])}),s(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),p=a.tokens,h=a.initialCwd,d=new c(p);return h&&d.cwd(h),d}},16749(e,t,r){r.d(t,{W:()=>i});var o=r(73024),n=r(76760),s=r(73136);function i(e){var t=(0,n.dirname)((0,s.fileURLToPath)(e)),r=[(0,n.join)(t,"simulator-main.mjs"),(0,n.join)(t,"..","simulator-main.mjs"),(0,n.join)((0,n.dirname)(process.execPath),"simulator-main.mjs")];for(var i of r)if((0,o.existsSync)(i))return i;throw Error(`Unable to locate the simulator entry (simulator-main.mjs). Probed paths:
1
+ export const __rspack_esm_id=9320;export const __rspack_esm_ids=[9320];export const __webpack_modules__={65650(e,t,r){e.exports=r(78942).Symbol},87379(e,t,r){var o=r(65650),n=r(8870),s=r(29005),i=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):s(e)}},86403(e,t,r){var o=r(62945),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},74967(e){e.exports="object"==typeof global&&global&&global.Object===Object&&global},8870(e,t,r){var o=r(65650),n=Object.prototype,s=n.hasOwnProperty,i=n.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var o=!0}catch(e){}var n=i.call(e);return o&&(t?e[a]=r:delete e[a]),n}},29005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78942(e,t,r){var o=r(74967),n="object"==typeof self&&self&&self.Object===Object&&self;e.exports=o||n||Function("return this")()},62945(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},12784(e,t,r){var o=r(41580),n=r(94495),s=r(6131),i=Math.max,a=Math.min;e.exports=function(e,t,r){var u,c,l,p,h,d,f=0,v=!1,y=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function x(t){var r=u,o=c;return u=c=void 0,f=t,p=e.apply(o,r)}function b(e){var r=e-d,o=e-f;return void 0===d||r>=t||r<0||y&&o>=l}function g(){var e,r,o,s=n();if(b(s))return w(s);h=setTimeout(g,(e=s-d,r=s-f,o=t-e,y?a(o,l-r):o))}function w(e){return(h=void 0,m&&u)?x(e):(u=c=void 0,p)}function _(){var e,r=n(),o=b(r);if(u=arguments,c=this,d=r,o){if(void 0===h)return f=e=d,h=setTimeout(g,t),v?x(e):p;if(y)return clearTimeout(h),h=setTimeout(g,t),x(d)}return void 0===h&&(h=setTimeout(g,t)),p}return t=s(t)||0,o(r)&&(v=!!r.leading,l=(y="maxWait"in r)?i(s(r.maxWait)||0,t):l,m="trailing"in r?!!r.trailing:m),_.cancel=function(){void 0!==h&&clearTimeout(h),f=0,u=d=c=h=void 0},_.flush=function(){return void 0===h?p:w(n())},_}},41580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},80547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},51187(e,t,r){var o=r(87379),n=r(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},94495(e,t,r){var o=r(78942);e.exports=function(){return o.Date.now()}},6131(e,t,r){var o=r(86403),n=r(41580),s=r(51187),i=0/0,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return i;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var r=u.test(e);return r||c.test(e)?l(e.slice(2),r?2:8):a.test(e)?i:+e}},5018(e){e.exports=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},44668(e,t,r){var o=r(56347);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var o=r(3634),n=r(70604),s=r(78243),i=r(5523);e.exports=function(e){return o(e)||n(e)||s(e)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},23878(e,t,r){var o=r(14319).default;e.exports=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=o(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},56347(e,t,r){var o=r(14319).default,n=r(23878);e.exports=function(e){var t=n(e,"string");return"symbol"==o(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},14319(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},75720(e,t,r){r.d(t,{p:()=>p,sh:()=>f});var o,n,s=r(90250),i=r(99436),a=r(5018),u=r(44668),c=r(31421),l=r(73024),p=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,l.existsSync)(e)?[process.execPath,e]:[process.execPath]},h=u(function e(t){a(this,e),this._cwd=void 0,this._mode="default",this._throw=!0,this._env=void 0,this._promise=null,this.args=t},[{key:"cwd",value:function(e){return this._cwd=e,this}},{key:"quiet",value:function(){return this._mode="quiet",this}},{key:"nothrow",value:function(){return this._throw=!1,this}},{key:"env",value:function(e){return this._env={...this._env,...e},this}},{key:"text",value:(o=i(function*(){return"default"===this._mode&&(this._mode="text"),(yield this.run()).stdout.toString("utf8")}),function(){return o.apply(this,arguments)})},{key:"then",value:function(e,t){return this.run().then(e,t)}},{key:"run",value:function(){return this._promise||(this._promise=this.exec()),this._promise}},{key:"exec",value:(n=i(function*(){var e=s(this.args),t=e[0],r=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o})(e).slice(1);if(!t)throw Error("sh: empty command");var o="default"===this._mode?["inherit","pipe","pipe"]:"quiet"===this._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],n=this._env?{...process.env,...this._env}:void 0,i=(0,c.spawn)(t,r,{cwd:this._cwd,stdio:o,env:n}),a=[],u=[];i.stdout?.on("data",e=>{a.push(e),"default"===this._mode&&process.stdout.write(e)}),i.stderr?.on("data",e=>{u.push(e),"default"===this._mode&&process.stderr.write(e)});var l=yield new Promise((e,t)=>{i.on("error",t),i.on("close",(t,r)=>e({code:t,signal:r}))}),p=l.code,h=l.signal,d=p??1,f=Buffer.concat(a),v=Buffer.concat(u);if(0!==d&&this._throw){var y=h?`signal ${h}`:`exit ${d}`,m=Error(`sh: command failed with ${y}: ${this.args.join(" ")}`);throw m.exitCode=d,m.stdout=f,m.stderr=v,m}return{exitCode:d,stdout:f,stderr:v}}),function(){return n.apply(this,arguments)})}]),d=/\s/;function f(e,...t){var r,o,n,s,i,a=(r=[],o="",n=!1,s=()=>{n&&(r.push(o),o="",n=!1)},i=e=>{o+=e,n=!0},(e.forEach((e,r)=>{for(var o=0;o<e.length;o++){var n=e[o];d.test(n)?s():i(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&s(),i(String(e))});i(String(e))}})(t[r])}),s(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),u=a.tokens,c=a.initialCwd,l=new h(u);return c&&l.cwd(c),l}},16749(e,t,r){r.d(t,{W:()=>i});var o=r(73024),n=r(76760),s=r(73136);function i(e){var t=(0,n.dirname)((0,s.fileURLToPath)(e)),r=[(0,n.join)(t,"simulator-main.mjs"),(0,n.join)(t,"..","simulator-main.mjs"),(0,n.join)((0,n.dirname)(process.execPath),"simulator-main.mjs")];for(var i of r)if((0,o.existsSync)(i))return i;throw Error(`Unable to locate the simulator entry (simulator-main.mjs). Probed paths:
2
2
  ${r.map(e=>` - ${e}`).join("\n")}
3
- If you installed the standalone bricks binary, re-run the installer to restore the simulator assets.`)}},7931(e,t,r){r.r(t),r.d(t,{simulator:()=>h});var o=r(99436),n=r(31421),s=r(51455),i=r(73024),a=r(80481),c=r(57975),u=r(12784),l=r(75720),p=r(16749);function h(){return d.apply(this,arguments)}function d(){return(d=o(function*(e=[]){var t,r=(0,c.parseArgs)({args:e,options:{"skip-typecheck":{type:"boolean"},"clear-cache":{type:"boolean"},screenshot:{type:"boolean"},"screenshot-delay":{type:"string"},"screenshot-width":{type:"string"},"screenshot-height":{type:"string"},"screenshot-path":{type:"string"},"screenshot-no-headless":{type:"boolean"},"show-menu":{type:"boolean"},"test-id":{type:"string"},"test-title-like":{type:"string"},"no-keep-open":{type:"boolean"},"cdp-port":{type:"string"},"no-cdp":{type:"boolean"},"capture-plan":{type:"string"}},strict:!0,allowPositionals:!0}).values,h=process.cwd(),d=JSON.parse((yield(0,s.readFile)(`${h}/application.json`,"utf8"))),f=[];r["clear-cache"]&&f.push("--clear-cache");var v=!0;if(r.screenshot&&(f.push("--take-screenshot"),f.push(JSON.stringify({delay:Number(r["screenshot-delay"])||1e3,width:Number(r["screenshot-width"])||600,height:Number(r["screenshot-height"])||480,path:r["screenshot-path"]||`${h}/screenshot.jpg`,noHeadless:r["screenshot-no-headless"]??!1})),v=!r["no-keep-open"]),r["capture-plan"]&&(f.push("--capture-plan",r["capture-plan"]),v=!1),r["show-menu"]&&f.push("--show-menu"),r["test-id"]&&f.push("--test-id",r["test-id"]),r["test-title-like"]&&f.push("--test-title-like",r["test-title-like"]),r["no-keep-open"]&&f.push("--no-keep-open"),!r["no-cdp"]){var m=parseInt(r["cdp-port"]||"",10)||19852;f.push("--cdp-port",String(m))}var y=!r["skip-typecheck"],g=(t=o(function*(){yield(0,l.sh)`${(0,l.p)()} ctor compile ${y?[]:["--no-check"]}`}),function(){return t.apply(this,arguments)});yield g();var b=null;if(v){var _=u(g,500);b=(0,i.watch)(`${h}/subspaces`,{recursive:!0},(e,t)=>{console.log(`Detected ${e} in ${t}`),_()})}var x=`${h}/.bricks/devtools.json`,w=()=>{try{(0,i.unlinkSync)(x)}catch{}};try{var j=JSON.parse((yield(0,s.readFile)(x,"utf8")));if(j.pid){try{process.kill(j.pid)}catch{}w()}}catch{}var S=(0,p.W)("file:///Users/jhen/workspace/mybigday-bricks/packages/bricks-cli/src/ctor/tools/simulator.js"),k=(0,n.spawn)("bunx",["--bun","electron",S,...f],{env:{...process.env,BRICKS_STAGE:d.stage||"production"},stdio:["inherit","pipe","inherit"]});(0,a.createInterface)({input:k.stdout}).on("line",e=>{if(e.startsWith("[TEST_RESULT_TOON]"))return void console.log(e.replace("[TEST_RESULT_TOON]",""));if(e){var t=e.match(/^CDP server: ws:\/\/localhost:(\d+)/);if(t){var r={port:parseInt(t[1],10),pid:k.pid,address:"localhost",name:`${d.name||"Unnamed"} (CTOR Simulator)`,startedAt:new Date().toISOString()};(0,s.writeFile)(x,JSON.stringify(r,null,2))}console.log(e)}}),yield new Promise(e=>{k.on("close",()=>e())}),w(),b&&b.close()})).apply(this,arguments)}}};
3
+ If you installed the standalone bricks binary, re-run the installer to restore the simulator assets.`)}},7931(e,t,r){r.r(t),r.d(t,{simulator:()=>d});var o=r(99436),n=r(31421),s=r(51455),i=r(73024),a=r(80481),u=r(57975),c=r(12784),l=r(75720),p=r(16749),h=`Usage: bricks ctor simulator [options]
4
+
5
+ Compile the project and run it in the web-preview Simulator. Without
6
+ --no-keep-open the Simulator stays open and reloads on source changes.
7
+
8
+ Options:
9
+ --test-id <id> Run the Automation test with this id
10
+ --test-title-like <text> Run the Automation test whose title contains the text
11
+ --screenshot Take a screenshot (see the --screenshot-* options)
12
+ --screenshot-path <file> Screenshot file (default: ./screenshot.jpg)
13
+ --screenshot-delay <ms> Wait before the screenshot (default: 1000)
14
+ --screenshot-width <px> Screenshot width (default: 600)
15
+ --screenshot-height <px> Screenshot height (default: 480)
16
+ --screenshot-no-headless Show the window during the screenshot
17
+ --no-keep-open Exit after the test / screenshot
18
+ --cdp-port <port> DevTools (CDP) port (default: 19852)
19
+ --no-cdp Do not start the DevTools (CDP) server
20
+ --skip-typecheck Compile without the type check
21
+ --clear-cache Clear the preview cache at start
22
+ --show-menu Show the preview menu
23
+ -h, --help Show this help
24
+ `;function d(){return f.apply(this,arguments)}function f(){return(f=o(function*(e=[]){var t,r=(0,u.parseArgs)({args:e,options:{help:{type:"boolean",short:"h"},"skip-typecheck":{type:"boolean"},"clear-cache":{type:"boolean"},screenshot:{type:"boolean"},"screenshot-delay":{type:"string"},"screenshot-width":{type:"string"},"screenshot-height":{type:"string"},"screenshot-path":{type:"string"},"screenshot-no-headless":{type:"boolean"},"show-menu":{type:"boolean"},"test-id":{type:"string"},"test-title-like":{type:"string"},"no-keep-open":{type:"boolean"},"cdp-port":{type:"string"},"no-cdp":{type:"boolean"},"capture-plan":{type:"string"}},strict:!0,allowPositionals:!0}).values;if(r.help)return void process.stdout.write(h);var d=process.cwd(),f=JSON.parse((yield(0,s.readFile)(`${d}/application.json`,"utf8"))),v=[];r["clear-cache"]&&v.push("--clear-cache");var y=!0;if(r.screenshot&&(v.push("--take-screenshot"),v.push(JSON.stringify({delay:Number(r["screenshot-delay"])||1e3,width:Number(r["screenshot-width"])||600,height:Number(r["screenshot-height"])||480,path:r["screenshot-path"]||`${d}/screenshot.jpg`,noHeadless:r["screenshot-no-headless"]??!1})),y=!r["no-keep-open"]),r["capture-plan"]&&(v.push("--capture-plan",r["capture-plan"]),y=!1),r["show-menu"]&&v.push("--show-menu"),r["test-id"]&&v.push("--test-id",r["test-id"]),r["test-title-like"]&&v.push("--test-title-like",r["test-title-like"]),r["no-keep-open"]&&v.push("--no-keep-open"),!r["no-cdp"]){var m=parseInt(r["cdp-port"]||"",10)||19852;v.push("--cdp-port",String(m))}var x=!r["skip-typecheck"],b=(t=o(function*(){yield(0,l.sh)`${(0,l.p)()} ctor compile ${x?[]:["--no-check"]}`}),function(){return t.apply(this,arguments)});yield b();var g=null;if(y){var w=c(b,500);g=(0,i.watch)(`${d}/subspaces`,{recursive:!0},(e,t)=>{console.log(`Detected ${e} in ${t}`),w()})}var _=`${d}/.bricks/devtools.json`,k=()=>{try{(0,i.unlinkSync)(_)}catch{}};try{var S=JSON.parse((yield(0,s.readFile)(_,"utf8")));if(S.pid){try{process.kill(S.pid)}catch{}k()}}catch{}var j=(0,p.W)("file:///Users/jhen/workspace/mybigday-bricks/packages/bricks-cli/src/ctor/tools/simulator.js"),T=(0,n.spawn)("bunx",["--bun","electron",j,...v],{env:{...process.env,BRICKS_STAGE:f.stage||"production"},stdio:["inherit","pipe","inherit"]});(0,a.createInterface)({input:T.stdout}).on("line",e=>{if(e.startsWith("[TEST_RESULT_TOON]"))return void console.log(e.replace("[TEST_RESULT_TOON]",""));if(e){var t=e.match(/^CDP server: ws:\/\/localhost:(\d+)/);if(t){var r={port:parseInt(t[1],10),pid:T.pid,address:"localhost",name:`${f.name||"Unnamed"} (CTOR Simulator)`,startedAt:new Date().toISOString()};(0,s.writeFile)(_,JSON.stringify(r,null,2))}console.log(e)}});try{var O=yield new Promise((e,t)=>{T.on("error",t),T.on("close",(t,r)=>e({code:t,signal:r}))}),$=O.code,E=O.signal;if(0!==$)throw Error(`Simulator exited with ${E?`signal ${E}`:`code ${$}`}`)}finally{k(),g&&g.close()}})).apply(this,arguments)}}};
package/lib/9387.js CHANGED
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export const __webpack_modules__={75149(t,r,e){e.d(r,{P:()=>i});var a=e(79657),o=e(64007);function i(t){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!t.startsWith("https://"))return a.Ay;var e=new o(r);return(t,r={})=>(0,a.Ay)(t,{...r,agent:e})}},30182(t,r,e){e.r(r),e.d(r,{BANK_PROPERTY_META_VALUES:()=>i.YC,createBankClient:()=>c,resolveBankEndpoint:()=>n,validateBankPropertyMeta:()=>i.jR});var a=e(99436),o=e(75149),i=e(31596),p={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},n=t=>{if(process.env.BRICKS_BANK_ENDPOINT)return process.env.BRICKS_BANK_ENDPOINT;var r=p[t];if(r)return r;try{var e=new URL(t).hostname;if("localhost"===e||"127.0.0.1"===e)return"http://localhost:8080"}catch{}throw Error(`Cannot derive the Data Bank endpoint from ${t}; set BRICKS_BANK_ENDPOINT to override`)},s=`
1
+ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export const __webpack_modules__={75149(r,t,e){e.d(t,{P:()=>p});var a=e(79657),o=e(64007);function p(r){var t=process.env.HTTPS_PROXY||process.env.https_proxy;if(!t||!r.startsWith("https://"))return a.Ay;var e=new o(t);return(r,t={})=>(0,a.Ay)(r,{...t,agent:e})}},30182(r,t,e){e.r(t),e.d(t,{BANK_PROPERTY_META_VALUES:()=>p.YC,createBankClient:()=>f,resolveBankEndpoint:()=>n,validateBankPropertyMeta:()=>p.jR});var a=e(99436),o=e(75149),p=e(31596),i={"https://display.bricks.tools":"https://bank.bricks.tools","https://display-beta.bricks.tools":"https://bank-beta.bricks.tools"},n=r=>{if(process.env.BRICKS_BANK_ENDPOINT)return process.env.BRICKS_BANK_ENDPOINT;var t=i[r];if(t)return t;try{var e=new URL(r).hostname;if("localhost"===e||"127.0.0.1"===e)return"http://localhost:8080"}catch{}throw Error(`Cannot derive the Data Bank endpoint from ${r}; set BRICKS_BANK_ENDPOINT to override`)},s=`
2
2
  propertyId
3
3
  meta
4
4
  definition
@@ -9,7 +9,7 @@ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export co
9
9
  lastUpdateKey
10
10
  createAt
11
11
  updateAt
12
- `,l={InSubspace:"IN_SUBSPACE",Global:"GLOBAL"},d={IN_SUBSPACE:"InSubspace",GLOBAL:"Global"},u=t=>void 0===t?void 0:JSON.stringify(t),y=t=>t&&d[t.meta]?{...t,meta:d[t.meta]}:t,c=({endpoint:t,spacename:r,spacekey:e})=>{var p,n=`${t}/api/graphql`,d=(0,o.P)(t),c=(p=a(function*(t,a){var o,i=yield d(n,{method:"POST",headers:{"content-type":"application/json",SPACENAME:r,SPACEKEY:e},body:JSON.stringify({query:t,variables:a})}),p=yield i.text();try{o=JSON.parse(p)}catch{o=null}if(o?.errors?.length)throw Error(o.errors.map(({message:t})=>t).join("\n"));if(!i.ok){var s=Error(`Data Bank API error (${i.status}): ${p.trim()}`);throw 403===i.status&&(s.isBankAuthError=!0),s}return o?.data||{}}),function(t,r){return p.apply(this,arguments)});return{listProperties(){return a(function*({keyword:t,meta:r,ids:e}={}){return(0,i.jR)(r),((yield c(`#graphql
12
+ `,l={InSubspace:"IN_SUBSPACE",Global:"GLOBAL"},d={IN_SUBSPACE:"InSubspace",GLOBAL:"Global"},y=r=>void 0===r?void 0:JSON.stringify(r),u=r=>r&&d[r.meta]?{...r,meta:d[r.meta]}:r,c=(r,t)=>{var e=r[t];if(null!==e&&!Array.isArray(e))throw Error(`Invalid Data Bank API response: expected ${t} to be an array or null`);return(e||[]).map(u)},f=({endpoint:r,spacename:t,spacekey:e})=>{var i,n=`${r}/api/graphql`,d=(0,o.P)(r),u=(i=a(function*(r,a){var o,p=yield d(n,{method:"POST",headers:{"content-type":"application/json",SPACENAME:t,SPACEKEY:e},body:JSON.stringify({query:r,variables:a})}),i=yield p.text();try{o=JSON.parse(i)}catch{if(p.ok)throw Error(`Invalid Data Bank API response (${p.status}): expected JSON`)}if(o?.errors?.length)throw Error(o.errors.map(({message:r})=>r).join("\n"));if(!p.ok){var s=Error(`Data Bank API error (${p.status}): ${i.trim()}`);throw 403===p.status&&(s.isBankAuthError=!0),s}if(!o?.data||"object"!=typeof o.data||Array.isArray(o.data))throw Error("Invalid Data Bank API response: expected a data object");return o.data}),function(r,t){return i.apply(this,arguments)});return{listProperties(){return a(function*({keyword:r,meta:t,ids:e}={}){return(0,p.jR)(t),c((yield u(`#graphql
13
13
  query(
14
14
  $filterUpdateHashes: [PropertyFilterUpdateHash!]
15
15
  $filterMeta: String
@@ -21,12 +21,12 @@ export const __rspack_esm_id=9387;export const __rspack_esm_ids=[9387];export co
21
21
  filterKeyword: $filterKeyword
22
22
  ) { ${s} }
23
23
  }
24
- `,{filterUpdateHashes:e?.map(t=>({propertyId:t,value:""})),filterMeta:r,filterKeyword:t})).properties||[]).map(y)}).apply(this,arguments)},getProperty(t){var r=this;return a(function*(){return(yield r.listProperties({ids:[t]})).find(r=>r.propertyId===t)||null})()},updateProperties:(t,r)=>a(function*(){if(!t?.length)throw Error("No properties to update.");var e=t.map(t=>{var r=t.meta||"InSubspace";return(0,i.jR)(r),{propertyId:t.propertyId,meta:l[r],definition:u(t.definition),newDefinitionFallback:u(t.newDefinitionFallback),value:u(t.value),updateNote:t.updateNote||"Updated via bricks-cli",upsert:!1!==t.upsert,tags:t.tags}});return((yield c(`#graphql
24
+ `,{filterUpdateHashes:e?.map(r=>({propertyId:r,value:""})),filterMeta:t,filterKeyword:r})),"properties")}).apply(this,arguments)},getProperty(r){var t=this;return a(function*(){return(yield t.listProperties({ids:[r]})).find(t=>t.propertyId===r)||null})()},updateProperties:(r,t)=>a(function*(){if(!r?.length)throw Error("No properties to update.");var e=r.map(r=>{var t=r.meta||"InSubspace";return(0,p.jR)(t),{propertyId:r.propertyId,meta:l[t],definition:y(r.definition),newDefinitionFallback:y(r.newDefinitionFallback),value:y(r.value),updateNote:r.updateNote||"Updated via bricks-cli",upsert:!1!==r.upsert,tags:r.tags}});return c((yield u(`#graphql
25
25
  mutation($properties: [PropertyInput!]!, $dontNotify: Boolean) {
26
26
  updateProperty(properties: $properties, dontNotify: $dontNotify) { ${s} }
27
27
  }
28
- `,{properties:e,dontNotify:r})).updateProperty||[]).map(y)})(),removeProperty:t=>a(function*(){return(yield c(`#graphql
28
+ `,{properties:e,dontNotify:t})),"updateProperty")})(),removeProperty:r=>a(function*(){var t=yield u(`#graphql
29
29
  mutation($propertyId: String!) {
30
30
  removeProperty(propertyId: $propertyId)
31
31
  }
32
- `,{propertyId:t})).removeProperty??!1})()}}}};
32
+ `,{propertyId:r});if(null!==t.removeProperty&&"boolean"!=typeof t.removeProperty)throw Error("Invalid Data Bank API response: expected removeProperty to be a boolean or null");return t.removeProperty??!1})()}}}};