@buoy-gg/core 7.0.69 → 7.0.71
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/bin/buoy.js +6 -6
- package/bundlers/vite.d.ts +18 -6
- package/bundlers/vite.mjs +5 -5
- package/lib/commonjs/mountBuoy.js +1 -1
- package/lib/commonjs/mountBuoy.test.js +1 -1
- package/lib/commonjs/telemetry/installPing.js +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/mountBuoy.js +1 -1
- package/lib/module/mountBuoy.test.js +1 -1
- package/lib/module/telemetry/installPing.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/telemetry/installPing.d.ts +2 -2
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/telemetry/installPing.d.ts +2 -2
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/index.mjs +1 -1
- package/package.json +5 -5
package/bin/buoy.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";const http=require("node:http");const fs=require("node:fs");const path=require("node:path");const crypto=require("node:crypto");const{spawn}=require("node:child_process");const SITE=process.env.BUOY_SITE_URL||"https://buoy.gg";const LOGIN_TIMEOUT_MS=5*60*1e3;const ESC="\x1B[";const color=e=>n=>`${ESC}${e}m${n}${ESC}0m`;const cyan=color(36);const green=color(32);const red=color(31);const dim=color(2);const bold=color(1);const yellow=color(33);function log(e){process.stdout.write(`${e}
|
|
3
3
|
`)}function fail(e){process.stderr.write(`${red("x")} ${e}
|
|
4
|
-
`);process.exit(1)}function openBrowser(e){const n=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open";const
|
|
5
|
-
`}fs.writeFileSync(t,
|
|
4
|
+
`);process.exit(1)}function openBrowser(e){const n=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open";const i=process.platform==="win32"?["/c","start","",e]:[e];try{const o=spawn(n,i,{stdio:"ignore",detached:true});o.on("error",()=>{});o.unref()}catch{}}function listsDependency(e,n){try{const i=JSON.parse(fs.readFileSync(path.join(e,"package.json"),"utf8"));return Boolean(Object.assign({},i.dependencies,i.devDependencies)[n])}catch{return false}}function viteKeySnippet(e){if(listsDependency(e,"@buoy-gg/solid")){return{code:" <Buoy />",note:"Buoy for Solid reads VITE_BUOY_KEY for you. Reload the app."}}return{code:" <FloatingDevTools modules={modules} licenseKey={import.meta.env.VITE_BUOY_KEY} />",note:"Keep your existing tool modules and providers, then reload the web app."}}function detectEnvVarName(e){let n=null;try{const i=path.join(e,"package.json");if(fs.existsSync(i)){const t=JSON.parse(fs.readFileSync(i,"utf8"));const s=Object.assign({},t.dependencies,t.devDependencies);if(s.expo)return"EXPO_PUBLIC_BUOY_KEY";if(s.next)n="NEXT_PUBLIC_BUOY_KEY";else if(s.vite)n="VITE_BUOY_KEY"}if(fs.existsSync(path.join(e,"app.config.js"))||fs.existsSync(path.join(e,"app.config.ts"))){return"EXPO_PUBLIC_BUOY_KEY"}const o=path.join(e,"app.json");if(fs.existsSync(o)){const t=JSON.parse(fs.readFileSync(o,"utf8"));if(t&&t.expo)return"EXPO_PUBLIC_BUOY_KEY"}}catch{}return n||"BUOY_KEY"}function isMauiProject(e){try{return fs.readdirSync(e).filter(n=>n.endsWith(".csproj")).some(n=>/<UseMaui>\s*true\s*<\/UseMaui>/i.test(fs.readFileSync(path.join(e,n),"utf8")))}catch{return false}}const ANGULAR_KEY_HEADER="// Buoy key file. Do not commit this file.\n";function angularKeyFile(e,n){const i=path.join(e,"angular.json");if(!fs.existsSync(i))return null;const o=fs.readFileSync(i,"utf8").replace(/"(?:\\.|[^"\\])*"|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*/g,d=>d.startsWith('"')?d:" ").replace(/"(?:\\.|[^"\\])*"|,(\s*[}\]])/g,(d,p)=>p||d);const t=JSON.parse(o);const s=Object.entries(t.projects||{}).filter(([,d])=>d.projectType==="application");const r=n||t.defaultProject;const c=r?t.projects[r]:s.length===1?s[0][1]:null;if(!c||c.projectType!=="application")throw new Error("Pass --project <name> to pick one Angular app.");const a=path.resolve(e,c.sourceRoot||path.join(c.root||"","src"),"environments/buoy.ts");const u=path.relative(e,a);if(u.startsWith("..")||path.isAbsolute(u))throw new Error("The app source root must be in this workspace.");if(fs.existsSync(a)&&!fs.readFileSync(a,"utf8").startsWith(ANGULAR_KEY_HEADER)){throw new Error("The Buoy key file has your code in it. Move it before you run login.")}return u}function writeAngularKey(e,n,i,o){const t=angularKeyFile(e,o);if(!t)return null;const s=path.join(e,t);const r=JSON.stringify(n);const c=ANGULAR_KEY_HEADER+(i?'declare const ngDevMode: boolean | undefined;\nexport const BUOY_KEY = (typeof ngDevMode === "undefined" || ngDevMode) ? '+r+' : "";\n':"export const BUOY_KEY = "+r+";\n");fs.mkdirSync(path.dirname(s),{recursive:true});fs.writeFileSync(s,c,{mode:384});if(!fs.existsSync(path.join(e,".gitignore")))fs.writeFileSync(path.join(e,".gitignore"),"",{flag:"wx"});ensureGitignored(e,t);return t}function envFileFor(e,n,i=false){if(!i&&!["EXPO_PUBLIC_BUOY_KEY","VITE_BUOY_KEY","NEXT_PUBLIC_BUOY_KEY"].includes(e))return".env.local";return n==="pro"||n==="business"?".env.local":".env.development.local"}function removeEnvVar(e,n,i){const o=path.join(e,i);let t;try{t=fs.readFileSync(o,"utf8")}catch{return false}const s=new RegExp("^"+n+"=.*\\n?","m");if(!s.test(t))return false;fs.writeFileSync(o,t.replace(s,""),{mode:384});return true}function writeEnvVar(e,n,i,o=".env.local"){const t=path.join(e,o);let s="";try{s=fs.readFileSync(t,"utf8")}catch{}const r=`${n}=${i}`;const c=new RegExp("^"+n+"=.*$","m");if(c.test(s)){s=s.replace(c,r)}else{if(s&&!s.endsWith("\n"))s+="\n";s+=`${r}
|
|
5
|
+
`}fs.writeFileSync(t,s,{mode:384});return t}function ensureGitignored(e,n=".env.local"){const i=path.join(e,".gitignore");let o="";try{o=fs.readFileSync(i,"utf8")}catch{return false}const t=new RegExp("^"+n.replace(/\./g,"\\.")+"$","m");if(t.test(o)||n.startsWith(".env")&&/^\.env\*$|^\.env\*\.local$/m.test(o)||n.endsWith(".local")&&/^\*\.local$/m.test(o))return false;if(o&&!o.endsWith("\n"))o+="\n";o+=`
|
|
6
6
|
# Buoy license key (per developer - do not commit)
|
|
7
7
|
${n}
|
|
8
|
-
`;fs.writeFileSync(
|
|
9
|
-
${n}`));openBrowser(n)}})}async function checkSignIn(e){if(typeof e.checkAvailability==="function")return e.checkAvailability();return await e.isAvailable()?{state:"enabled"}:{state:"unknown"}}async function signInAndGetDevToken(e=loadSessionClient()){if(!e)return{fallback:{state:"unsupported",computerSignedIn:false}};const n=cliSession(e);const
|
|
10
|
-
No env file was changed.`);return}const r=o?"BUOY_KEY":detectEnvVarName(e);const c=isMauiProject(e);const a=envFileFor(r,t.devToken?"free":t.tier,c||!!o);const
|
|
8
|
+
`;fs.writeFileSync(i,o);return true}const KEY_NAMES=["BUOY_LICENSE_KEY","BUOY_KEY","EXPO_PUBLIC_BUOY_KEY","VITE_BUOY_KEY","NEXT_PUBLIC_BUOY_KEY","REACT_APP_BUOY_KEY"];function findProjectKey(e,n=process.env){for(const i of KEY_NAMES){if(n[i]!==void 0){const o=n[i].trim();return o?{name:i,source:"environment",value:o}:null}}for(const i of[".env.development.local",".env.local",".env"]){let o;try{o=fs.readFileSync(path.join(e,i),"utf8")}catch{continue}const t=new Map;for(const s of o.split(/\r?\n/)){const r=s.match(/^\s*(?:export\s+)?([A-Z_][A-Z_0-9]*)\s*=\s*(.*)$/);if(!r)continue;const c=r[2].trim();const a=c.match(/^(['"])(.*?)\1\s*(?:#.*)?$/);t.set(r[1],a?a[2]:c.split("#")[0].trim())}for(const s of KEY_NAMES){if(!t.has(s))continue;const r=t.get(s).trim();return r?{name:s,source:i,value:r}:null}}return null}function awaitKeyFromBrowser(){return new Promise((e,n)=>{const i=crypto.randomBytes(16).toString("hex");const o=http.createServer((t,s)=>{if(t.headers.origin===SITE){s.setHeader("Access-Control-Allow-Origin",SITE);s.setHeader("Access-Control-Allow-Headers","Content-Type");s.setHeader("Access-Control-Allow-Methods","POST, OPTIONS");s.setHeader("Access-Control-Allow-Private-Network","true")}if(t.method==="OPTIONS"){s.writeHead(204).end();return}if(t.method!=="POST"){s.writeHead(405).end();return}let r="";t.on("data",c=>{r+=c;if(r.length>4096)t.destroy()});t.on("end",()=>{let c={};try{c=JSON.parse(r)}catch{}if(c.state!==i||typeof c.key!=="string"||!c.key){s.writeHead(400).end();return}s.writeHead(200,{"Content-Type":"application/json"});s.end('{"ok":true}');o.close();e({key:c.key.trim(),tier:c.tier||"free",email:c.email||""})})});o.on("error",n);o.listen(0,"127.0.0.1",()=>{const{port:t}=o.address();const s=`${SITE}/cli/login?port=${t}&state=${i}`;log("");log(` Opening ${cyan(s)}`);log(dim(" If your browser did not open, paste that URL into a browser on this computer."));log("");log(dim(" Waiting for you to finish signing in..."));openBrowser(s)});setTimeout(()=>{o.close();n(new Error("Timed out waiting for the browser (5 minutes)."))},LOGIN_TIMEOUT_MS).unref()})}function loadSessionClient(){try{const e=require("@buoy-gg/license/headless");if(typeof e.createNodeSession!=="function")return null;return e}catch{return null}}function cliSession(e){return e.createNodeSession({audience:e.CLI_AUDIENCE,signinOrigin:SITE,openBrowser:n=>{log(`${cyan(">")} Opening ${dim(n.split("?")[0])} to sign in...`);log(dim(` If nothing opens, visit:
|
|
9
|
+
${n}`));openBrowser(n)}})}async function checkSignIn(e){if(typeof e.checkAvailability==="function")return e.checkAvailability();return await e.isAvailable()?{state:"enabled"}:{state:"unknown"}}async function signInAndGetDevToken(e=loadSessionClient()){if(!e)return{fallback:{state:"unsupported",computerSignedIn:false}};const n=cliSession(e);const i=await checkSignIn(n);if(i.state!=="enabled"){const t=await n.load().catch(()=>null);return{fallback:{...i,computerSignedIn:Boolean(t&&t.state==="active")}}}await n.signIn();const o=await n.devToken();if(!o.ok){throw new Error(`This computer is signed in to Buoy, but no dev token was made: ${o.detail}`)}return{result:{key:o.token,tier:o.tier,email:"",devToken:true}}}function fallbackWarning(e){if(!e)return null;if(e.state==="unknown"){return[`${yellow("!")} This computer could not be signed in. Node may not reach ${SITE}.`," A VPN, proxy or firewall may block it outside your browser."," Update @buoy-gg/license to see the exact reason."]}if(e.state!=="unreachable")return null;const n=[`${yellow("!")} Node could not reach ${SITE} (${e.detail}).`," A VPN, proxy or firewall may block it outside your browser."," The browser can still sign in this project, but not this computer."];if(e.hint)n.push(` ${e.hint}`);return n}function projectOnlyNotes(e,n){const i=e&&e.computerSignedIn?[" This login signed in only this project."," This computer keeps its earlier sign-in, which the MCP uses."," That may be a different account. Check with `npx buoy whoami`."]:[" Only this project is signed in. This computer is not,"," so `npx buoy whoami` will say so.",` The MCP reads the key from ${n} when it runs in this folder.`];if(e&&(e.state==="unreachable"||e.state==="unknown")){i.push(` The MCP checks keys with ${SITE} too, so it needs that to work.`)}return i}async function login(){const e=process.cwd();const n=process.argv.indexOf("--project");const i=n<0?void 0:process.argv[n+1];if(n>=0&&(!i||i.startsWith("--")))throw new Error("Pass a name after --project.");const o=angularKeyFile(e,i);let t;let s=null;try{const l=await signInAndGetDevToken();if(l.result){t=l.result}else{s=l.fallback;const h=fallbackWarning(s);if(h){log("");h.forEach(m=>log(m))}t=await awaitKeyFromBrowser()}}catch(l){fail(`${l.message}
|
|
10
|
+
No env file was changed.`);return}const r=o?"BUOY_KEY":detectEnvVarName(e);const c=isMauiProject(e);const a=envFileFor(r,t.devToken?"free":t.tier,c||!!o);const u=o?writeAngularKey(e,t.key,!!t.devToken||!["pro","business"].includes(t.tier),i):null;const d=writeEnvVar(e,r,t.key,a);const p=a===".env.local"?".env.development.local":".env.local";const y=removeEnvVar(e,r,p);const g=ensureGitignored(e,a);const f=path.relative(e,d)||a;log("");log(`${green("OK")} Signed in${t.email?" as "+bold(t.email):""} - ${bold(t.tier)} tier`);log(` Wrote ${cyan(r)} to ${cyan(f)}`);if(u)log(` Wrote the Angular key to ${cyan(u)}. Git ignores this file.`);if(t.devToken){log(dim(" It is a dev token: it works in dev builds and sims for 30 days. Then run npx buoy login again."));log(dim(" This computer is signed in to Buoy too. The MCP uses it. Sign out: npx buoy logout"))}else{projectOnlyNotes(s,f).forEach(l=>log(dim(l)))}if(y)log(dim(` Removed the old ${r} line from ${p}`));if(a===".env.development.local"){log(dim(" This file is loaded in development, keeping the key out of production builds."))}if(g)log(dim(` Added ${a} to .gitignore`));log("");log(" Use it in your app:");log("");if(u){log(dim(` Import BUOY_KEY from ${u.replace(/\.ts$/,"")}.`));log(dim(" Pass it as licenseKey in provideBuoy. Keep the dev guard."));log(dim(" Reload the app to use the key."))}else if(r==="VITE_BUOY_KEY"){const l=viteKeySnippet(e);log(cyan(l.code));log("");log(dim(` ${l.note}`))}else if(r==="NEXT_PUBLIC_BUOY_KEY"){log(cyan(" <FloatingDevTools modules={modules} licenseKey={process.env.NEXT_PUBLIC_BUOY_KEY} />"));log("");log(dim(" Restart next dev so it picks up the new variable."))}else if(c){log(dim(" Buoy for .NET MAUI reads BUOY_KEY from this file when the app builds."));log(dim(" Rebuild and run your app. Nothing to add to MauiProgram.cs."))}else{log(cyan(` Buoy.init({ licenseKey: ${r} });`));log("");log(dim(" Swift: pass the key through BuoyConfig.licenseKey in your development build."));log(dim(" Bare React Native does not load .env.local automatically; wire your existing env loader."))}log("")}async function logout(){const e=loadSessionClient();if(!e)fail("This version of Buoy cannot sign in or out. Update @buoy-gg/core.");const n=cliSession(e);const i=await n.load();await n.signOut();log(i.state==="active"?`${green("OK")} Signed out of Buoy on this computer.`:"This computer was not signed in.");log(dim(" Keys in your env files are not changed."))}async function whoami(e=process.cwd(),n=loadSessionClient()){if(!n)fail("This version of Buoy cannot sign in. Update @buoy-gg/core.");const i=await cliSession(n).load();const o=findProjectKey(e);const t=o&&typeof n.isDevToken==="function"&&n.isDevToken(o.value)?"a dev token":"a key";const s=o&&(o.source==="environment"?"your shell environment":o.source);const r=t==="a dev token"&&typeof n.checkDevToken==="function"?n.checkDevToken(o.value):null;const c=r&&!r.ok?r.message:null;if(i.state==="active"){log(`${green("Signed in")} - ${bold(i.claims.tier)} plan${i.grace?dim(" (offline, using the grace period)"):""}`);if(o)log(dim(` This project has ${t} in ${s} (${o.name}).`));if(c)log(` ${yellow("!")} ${c}`);return}if(!o){log("Not signed in. Run: npx buoy login");return}log("Not signed in on this computer.");log(`${green("This project")} has ${t} in ${cyan(s)} (${o.name}).`);if(c)log(` ${yellow("!")} ${c}`);log(dim(" Your app uses that key. The MCP can too, when it runs in this folder."));log(dim(" To sign in this computer as well, run npx buoy login when Node can reach buoy.gg."))}function help(){log(`
|
|
11
11
|
${bold("buoy")} - React Buoy CLI
|
|
12
12
|
|
|
13
13
|
${bold("Usage")}
|
|
@@ -37,4 +37,4 @@ ${n}
|
|
|
37
37
|
|
|
38
38
|
Docs: ${SITE}/buoy/latest/docs/installation
|
|
39
39
|
`)}if(require.main===module){const e=process.argv[2];if(e==="login"){login().catch(n=>fail(n.message))}else if(e==="logout"){logout().catch(n=>fail(n.message))}else if(e==="whoami"){whoami().catch(n=>fail(n.message))}else if(!e||e==="help"||e==="--help"||e==="-h"){help()}else{fail(`Unknown command: ${e}
|
|
40
|
-
Run \`npx buoy help\` to see what is available.`)}}module.exports={detectEnvVarName,angularKeyFile,writeAngularKey,envFileFor,isMauiProject,writeEnvVar,removeEnvVar,ensureGitignored,awaitKeyFromBrowser,signInAndGetDevToken,fallbackWarning,projectOnlyNotes,findProjectKey,whoami,KEY_NAMES};
|
|
40
|
+
Run \`npx buoy help\` to see what is available.`)}}module.exports={detectEnvVarName,viteKeySnippet,angularKeyFile,writeAngularKey,envFileFor,isMauiProject,writeEnvVar,removeEnvVar,ensureGitignored,awaitKeyFromBrowser,signInAndGetDevToken,fallbackWarning,projectOnlyNotes,findProjectKey,whoami,KEY_NAMES};
|
package/bundlers/vite.d.ts
CHANGED
|
@@ -2,11 +2,18 @@ export interface BuoyVitePluginOptions {
|
|
|
2
2
|
/** Installed tools to leave out, by package name, such as `['tv-remote']`. */
|
|
3
3
|
exclude?: string[];
|
|
4
4
|
/**
|
|
5
|
-
* Add
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Add Buoy's early hook ahead of index.html's first module script. Defaults
|
|
6
|
+
* to true: `@buoy-gg/solid/register` in an app that lists @buoy-gg/solid,
|
|
7
|
+
* otherwise `@buoy-gg/core/web/register`. 'react' or 'network' forces the
|
|
8
|
+
* full hook or `@buoy-gg/core/web/register-network`. Turn it off if you
|
|
9
|
+
* import a hook yourself in a page with no index.html.
|
|
8
10
|
*/
|
|
9
|
-
register?: boolean;
|
|
11
|
+
register?: boolean | 'react' | 'network';
|
|
12
|
+
/**
|
|
13
|
+
* Keep Buoy in a production build of a Solid app. Without it, Buoy imports
|
|
14
|
+
* resolve to their `buoy-disabled` builds and no early hook is added.
|
|
15
|
+
*/
|
|
16
|
+
enableInRelease?: boolean;
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
/**
|
|
@@ -17,7 +24,7 @@ export interface BuoyVitePluginOptions {
|
|
|
17
24
|
export declare function buoy(options?: BuoyVitePluginOptions): {
|
|
18
25
|
name: string;
|
|
19
26
|
enforce: 'pre';
|
|
20
|
-
config(config: any): any;
|
|
27
|
+
config(config: any, env?: { command: 'serve' | 'build'; mode?: string }): any;
|
|
21
28
|
configResolved(config: any): void;
|
|
22
29
|
configureServer(server: any): void;
|
|
23
30
|
closeBundle(): void;
|
|
@@ -32,5 +39,10 @@ export declare function findInstalledTools(root: string, options?: { exclude?: s
|
|
|
32
39
|
missingWeb: string[];
|
|
33
40
|
};
|
|
34
41
|
export declare function installedToolsModule(found: { id: string; key: string }[], options?: { assetList?: string }): string;
|
|
35
|
-
export declare function injectRegister(html: string): string | undefined;
|
|
42
|
+
export declare function injectRegister(html: string, hook?: string): string | undefined;
|
|
43
|
+
export declare function earlyHook(root: string, register?: boolean | 'react' | 'network'): string | undefined;
|
|
44
|
+
/** True when the app's package.json asks for Solid 2, where Buoy stays off for now. */
|
|
45
|
+
export declare function wantsSolid2(root: string): boolean;
|
|
46
|
+
export declare function disabledEntry(root: string, source: string): string | undefined;
|
|
47
|
+
export declare function solidLinksModule(root: string, found: { id: string; key: string }[]): string;
|
|
36
48
|
export declare function assetListUrl(base: string, filename: string, command: 'serve' | 'build'): string | undefined;
|
package/bundlers/vite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{existsSync as
|
|
2
|
-
`:"";return`${
|
|
3
|
-
${
|
|
1
|
+
import{existsSync as k,readFileSync as h}from"node:fs";import c from"node:path";const $=[["network","network"],["storage","storage"],["events","events"],["console","console"],["env","env"],["redux","redux"],["zustand","zustand"],["jotai","jotai"],["react-query","react-query"],["route-events","route-events"],["time-machine","time-machine"],["clock","clock"],["lifecycle","lifecycle"],["location","location"],["permissions","permissions"],["notifications","push-notifications"],["scenarios","scenarios"],["sentry","sentry"],["ask-buoy","ask-buoy"],["impersonate","impersonate"],["perf-monitor","perf-monitor"],["js-top","js-top"],["highlight-updates","highlight-updates"],["debug-borders","debug-borders"],["images","images"],["assets","assets"],["image-overlay","image-overlay"],["tv-remote","tv-remote"],["focus-inspector","focus-inspector"],["external-sync","external-sync"]];const v="@buoy-gg/core/web/installed-tools";const j="@buoy-gg/core/web/register";const R="@buoy-gg/core/web/register-network";const O="\0buoy:installed-tools";const D="@buoy-gg/solid";const L="@buoy-gg/solid/register";const C=["solid-js","solid-js/web","solid-js/store"];const N="#buoy-solid-auto";const I="\0buoy:solid-links";const E=["@buoy-gg/solid","@buoy-gg/solid/register","@buoy-gg/solid/router","@buoy-gg/solid/store","@buoy-gg/solid/highlights"];function x(o){for(let e=o;;e=c.dirname(e)){const n=c.join(e,"package.json");if(k(n))return n;if(c.dirname(e)===e)return void 0}}function S(o){const e=x(o);try{const n=e?JSON.parse(h(e,"utf8")):{};return{...n.dependencies,...n.devDependencies,...n.optionalDependencies,...n.peerDependencies}}catch{return{}}}export function wantsSolid2(o){const e=String(S(o)["solid-js"]??"");return e==="next"||/^[\s^~>=v]*2(?:\.|$)/.test(e)}export function earlyHook(o,e=true){if(e===false)return void 0;if(e==="react")return j;if(e==="network")return R;return S(o)[D]?L:j}export function disabledEntry(o,e){const[n,t,...s]=e.split("/");if(n!=="@buoy-gg"||!t)return void 0;const u=c.join(B(o,`${n}/${t}`)??"","package.json");if(!k(u))return void 0;try{const r=JSON.parse(h(u,"utf8")).exports?.[s.length?`./${s.join("/")}`:"."];const a=r&&typeof r==="object"?r["buoy-disabled"]:void 0;return typeof a==="string"?c.join(c.dirname(u),a):void 0}catch{return void 0}}function B(o,e){for(let n=o;;n=c.dirname(n)){const t=c.join(n,"node_modules",e);if(k(c.join(t,"package.json")))return t;if(c.dirname(n)===n)return void 0}}export function solidLinksModule(o,e){const n=S(o);const t=new Set(e.map(({key:r})=>r));const s=Boolean(n["@tanstack/solid-query"])&&t.has("react-query");const u=Boolean(n["@solidjs/router"])&&t.has("route-events");return[s||u?"import { useContext, getOwner } from 'solid-js';":"",s?"import { QueryClientContext } from '@tanstack/solid-query';":"",u?"import { RouterContext, useLocation, useCurrentMatches, useNavigate } from '@solidjs/router';":"","export function useBuoyLinks(options) {"," const links = {};",s?" const client = useContext(QueryClientContext);\n if (client) links.queryClient = client();":"",u?[" if (useContext(RouterContext)) {"," const location = useLocation(), matches = useCurrentMatches(), navigate = useNavigate(), owner = getOwner();"," links.router = () => import('@buoy-gg/solid/router').then((m) => m.connectBuoyRouter({ location, matches, navigate, routes: options.routes, owner }));"," }"].join("\n"):""," return links;","}",""].filter(Boolean).join("\n")}function J(o,e){for(let n=o;;n=c.dirname(n)){const t=c.join(n,"node_modules",e,"package.json");if(k(t)){try{return JSON.parse(h(t,"utf8"))}catch{return void 0}}if(c.dirname(n)===n)return void 0}}export function findInstalledTools(o,{exclude:e=[]}={}){const n=x(o);let t;try{const a=n?JSON.parse(h(n,"utf8")):{};const l={...a.dependencies,...a.devDependencies,...a.optionalDependencies,...a.peerDependencies};if(l["@buoy-gg/core"])t=new Set(Object.keys(l))}catch{}const s=new Set(e.map(a=>a.replace(/^@buoy-gg\//,"")));const u=[];const r=[];for(const[a,l]of $){const g=`@buoy-gg/${a}`;if(s.has(a)||s.has(l)||t&&!t.has(g))continue;const y=J(o,g);if(!y)continue;if(y.exports&&typeof y.exports==="object"&&y.exports["./web"])u.push({id:g,key:l});else r.push(g)}return{found:u,missingWeb:r}}export function installedToolsModule(o,{assetList:e}={}){const n=o.map(({id:r},a)=>`import * as t${a} from ${JSON.stringify(`${r}/web`)};`);const t=o.map(({key:r},a)=>`${JSON.stringify(r)}: t${a}`);const s=o.findIndex(({key:r})=>r==="assets");const u=e&&s!==-1?`t${s}.loadBrowserAssetManifest?.(${JSON.stringify(e)})?.catch?.(() => {});
|
|
2
|
+
`:"";return`${n.join("\n")}
|
|
3
|
+
${u}export const installedTools = { ${t.join(", ")} };
|
|
4
4
|
export const installedToolsFound = true;
|
|
5
|
-
`}function
|
|
6
|
-
${
|
|
5
|
+
`}function _(o){return o.replace(/<!--[\s\S]*?(?:-->|$)/g,e=>" ".repeat(e.length))}export function injectRegister(o,e=j){const n=`<script type="module">import ${JSON.stringify(e)};<\/script>`;const t=_(o).search(/<script\b[^>]*\btype\s*=\s*["']?module["']?[^>]*>/i);return t===-1?void 0:`${o.slice(0,t)}${n}
|
|
6
|
+
${o.slice(t)}`}function q(o,e){const n=x(o);const t=new Set(e.map(s=>s.replace(/^@buoy-gg\//,"")));try{const s=n?JSON.parse(h(n,"utf8")):{};const u={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies};return $.filter(([r,a])=>u[`@buoy-gg/${r}`]&&!t.has(r)&&!t.has(a)).map(([r])=>`@buoy-gg/${r}`).join()}catch{return""}}export function assetListUrl(o,e,n){const t=n==="serve"&&!/^(?:\/|[a-z]+:)/i.test(o)?"/":o;return/^(?:\/|[a-z]+:)/i.test(t)?`${t.endsWith("/")?t:`${t}/`}${e}`:void 0}export function buoy({exclude:o=[],register:e=true,enableInRelease:n=false}={}){let t={found:[],missingWeb:[]};let s=process.cwd();let u=e===false?void 0:j;let r=false;let a=false;let l;let g;let y;const w=()=>{clearInterval(y);y=void 0};return{name:"buoy",enforce:"pre",config(i,d){s=c.resolve(i.root??process.cwd());t=findInstalledTools(s,{exclude:o});const f=Boolean(S(s)[D]);a=f;const p=f&&wantsSolid2(s);if(p)console.warn("[buoy] This app uses Solid 2, and @buoy-gg/solid supports Solid 1.8 and 1.9 for now. Buoy is off, so your app still runs.");r=f&&(p||d?.command==="build"&&!n);u=r?void 0:earlyHook(s,e);const m=t.found.map(({id:b})=>`${b}/web`);if(!f){if(u)m.unshift(u);return{optimizeDeps:{exclude:[v],include:m}}}m.unshift("@buoy-gg/core/web","@buoy-gg/core/web/register-network","@buoy-gg/solid > @buoy-gg/shared-ui/web/utils");return{optimizeDeps:{exclude:[v,...E],include:m},resolve:{dedupe:C}}},configResolved(i){l=i.logger;const d=i.plugins.find(p=>p.name==="buoy-asset-manifest");g=d?assetListUrl(i.base,d.api?.filename??"buoy-assets.json",i.command):void 0;if(d&&!g)l.warn(`[buoy] base '${i.base}' is relative, so load the asset list yourself with loadBrowserAssetManifest().`);if(i.command!=="serve"||r)return;const f=t.found.map(({key:p})=>p).join(", ")||"none";l.info(`[buoy] tools: ${f}`);if(t.missingWeb.length)l.warn(`[buoy] these have no browser build; update them to the same release as @buoy-gg/core: ${t.missingWeb.join(", ")}`)},configureServer(i){const d=x(s);if(!d)return;const f=b=>b.map(({id:T})=>T).join();const p=()=>{if(f(findInstalledTools(s,{exclude:o}).found)===f(t.found))return false;w();void i.restart();return true};const m=()=>{w();if(q(s,o)===f(t.found))return;let b=0;y=setInterval(()=>{if(!p()&&++b>=120)w()},1e3)};i.watcher.add(d);i.watcher.on("change",b=>{if(c.resolve(b)===c.resolve(d)&&!p())m()});m()},closeBundle(){w()},resolveId(i){if(i===v)return O;if(i===N&&a)return I;if(r&&i.startsWith("@buoy-gg/"))return disabledEntry(s,i);return void 0},load(i){if(i===O)return installedToolsModule(t.found,{assetList:g});if(i===I)return solidLinksModule(s,t.found);return void 0},transformIndexHtml:{order:"pre",handler(i){if(!u)return i;const d=injectRegister(i,u);if(d===void 0)l?.warn(`[buoy] index.html has no module script, so the early hook wasn't added. Import '${u}' first in your entry file.`);return d??i}}}}export default buoy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mountBuoy=mountBuoy;var _client=require("react-dom/client");var _react=require("react");var _FloatingDevToolsWeb=require("./floatingMenu/FloatingDevTools.web.js");var _jsxRuntime=require("react/jsx-runtime");function mountBuoy({queryClient:t,...
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mountBuoy=mountBuoy;var _client=require("react-dom/client");var _react=require("react");var _FloatingDevToolsWeb=require("./floatingMenu/FloatingDevTools.web.js");var _installedTools=require("./installedTools.js");var _jsxRuntime=require("react/jsx-runtime");function mountBuoy({queryClient:t,...o}={}){const r=Object.values(o.modules??_installedTools.installedTools).find(s=>s.QueryClientProvider)?.QueryClientProvider;if(t&&!r)throw new Error("Add the react-query tool to modules to use queryClient.");const e=document.createElement("div");e.dataset.buoyMount="";document.body.appendChild(e);const n=(0,_client.createRoot)(e);const u=(0,_jsxRuntime.jsx)(_FloatingDevToolsWeb.FloatingDevTools,{...o});n.render(t?(0,_react.createElement)(r,{client:t},u):u);let l=true;return()=>{if(!l)return;l=false;n.unmount();e.remove()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _react=require("react");var _vitest=require("vitest");var _mountBuoy=require("./mountBuoy.js");var _reactQuery=require("@tanstack/react-query");var _jsxRuntime=require("react/jsx-runtime");_vitest.vi.mock("./floatingMenu/FloatingDevTools.web",()=>({FloatingDevTools:e=>(0,_jsxRuntime.jsxs)("span",{children:[e.environment,e.children]})}));_vitest.vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT",true);(0,_vitest.afterEach)(()=>{document.body.innerHTML=""});(0,_vitest.it)("mounts with the given props and removes its root on unmount",async()=>{let e;await(0,_react.act)(async()=>{e=(0,_mountBuoy.mountBuoy)({environment:"qa"})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("qa");await(0,_react.act)(async()=>e());(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")).toBeNull();(0,_vitest.expect)(()=>e()).not.toThrow()});(0,_vitest.it)("keeps other roots and app DOM when one mount is removed",async()=>{const e=document.createElement("main");document.body.append(e);let
|
|
1
|
+
"use strict";var _react=require("react");var _vitest=require("vitest");var _mountBuoy=require("./mountBuoy.js");var _reactQuery=require("@tanstack/react-query");var _jsxRuntime=require("react/jsx-runtime");const installed=_vitest.vi.hoisted(()=>({installedTools:{},installedToolsFound:false}));_vitest.vi.mock("./installedTools",()=>installed);_vitest.vi.mock("./floatingMenu/FloatingDevTools.web",()=>({FloatingDevTools:e=>(0,_jsxRuntime.jsxs)("span",{children:[e.environment,e.children]})}));_vitest.vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT",true);(0,_vitest.afterEach)(()=>{document.body.innerHTML="";installed.installedTools={}});(0,_vitest.it)("mounts with the given props and removes its root on unmount",async()=>{let e;await(0,_react.act)(async()=>{e=(0,_mountBuoy.mountBuoy)({environment:"qa"})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("qa");await(0,_react.act)(async()=>e());(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")).toBeNull();(0,_vitest.expect)(()=>e()).not.toThrow()});(0,_vitest.it)("keeps other roots and app DOM when one mount is removed",async()=>{const e=document.createElement("main");document.body.append(e);let o;let t;await(0,_react.act)(async()=>{o=(0,_mountBuoy.mountBuoy)({environment:"qa"});t=(0,_mountBuoy.mountBuoy)({environment:"dev"})});await(0,_react.act)(async()=>o());(0,_vitest.expect)(e.isConnected).toBe(true);(0,_vitest.expect)(document.querySelectorAll("[data-buoy-mount]")).toHaveLength(1);(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("dev");await(0,_react.act)(async()=>t())});(0,_vitest.it)("shares the app QueryClient with tool panels",async()=>{const e=new _reactQuery.QueryClient;e.setQueryData(["host"],"from Angular");function o(){return(0,_jsxRuntime.jsx)("b",{children:(0,_reactQuery.useQueryClient)().getQueryData(["host"])})}let t;await(0,_react.act)(async()=>{t=(0,_mountBuoy.mountBuoy)({queryClient:e,modules:{query:{QueryClientProvider:_reactQuery.QueryClientProvider}},children:(0,_jsxRuntime.jsx)(o,{})})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("from Angular");await(0,_react.act)(async()=>t())});(0,_vitest.it)("fails before adding a root when the Query provider is absent",()=>{(0,_vitest.expect)(()=>(0,_mountBuoy.mountBuoy)({queryClient:new _reactQuery.QueryClient})).toThrow("Add the react-query tool");(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")).toBeNull()});(0,_vitest.it)("finds the Query provider among the tools the buoy() plugin found",async()=>{installed.installedTools={"react-query":{QueryClientProvider:_reactQuery.QueryClientProvider}};const e=new _reactQuery.QueryClient;e.setQueryData(["host"],"from Solid");function o(){return(0,_jsxRuntime.jsx)("b",{children:(0,_reactQuery.useQueryClient)().getQueryData(["host"])})}let t;await(0,_react.act)(async()=>{t=(0,_mountBuoy.mountBuoy)({queryClient:e,children:(0,_jsxRuntime.jsx)(o,{})})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("from Solid");await(0,_react.act)(async()=>t())});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.__resetInstallPingForTests=__resetInstallPingForTests;exports.detectFramework=detectFramework;exports.sendInstallPing=sendInstallPing;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _version=require("../version.js");const STORAGE_KEY="@react_buoy_install";const ENDPOINT="https://buoy.gg/api/t";const PING_INTERVAL_MS=24*60*60*1e3;function uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;const n=t==="x"?e:e&3|8;return n.toString(16)})}async function readState(){try{const t=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(!t)return null;const e=JSON.parse(t);if(typeof e?.installId!=="string")return null;return{installId:e.installId,lastPingAt:typeof e.lastPingAt==="number"?e.lastPingAt:0}}catch{return null}}function announceOnce(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let sentThisSession=false;function detectFramework(){if(_reactNative.Platform.isTV)return"tv";if(_reactNative.Platform.OS!=="web")return"react-native";if((0,_license.isCapacitorNative)())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";return"web"}async function sendInstallPing(t){const e=typeof __DEV__!=="undefined"&&__DEV__;if(!e)return;if(!t.enabled)return;if(sentThisSession)return;sentThisSession=true;try{const n=await readState();const r=Date.now();if(n&&r-n.lastPingAt<PING_INTERVAL_MS)return;const a=n?.installId??uuid();if(!n)announceOnce();await _sharedUi.persistentStorage.setItem(STORAGE_KEY,JSON.stringify({installId:a,lastPingAt:r}));await fetch(ENDPOINT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installId:a,version:_version.SDK_VERSION,platform:_reactNative.Platform.OS,tier:t.tier,framework:detectFramework()})})}catch{}}function __resetInstallPingForTests(){sentThisSession=false}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.__resetInstallPingForTests=__resetInstallPingForTests;exports.detectFramework=detectFramework;exports.sendInstallPing=sendInstallPing;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _version=require("../version.js");const STORAGE_KEY="@react_buoy_install";const ENDPOINT="https://buoy.gg/api/t";const PING_INTERVAL_MS=24*60*60*1e3;function uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;const n=t==="x"?e:e&3|8;return n.toString(16)})}async function readState(){try{const t=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(!t)return null;const e=JSON.parse(t);if(typeof e?.installId!=="string")return null;return{installId:e.installId,lastPingAt:typeof e.lastPingAt==="number"?e.lastPingAt:0}}catch{return null}}function announceOnce(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let sentThisSession=false;function detectFramework(){if(_reactNative.Platform.isTV)return"tv";if(_reactNative.Platform.OS!=="web")return"react-native";if((0,_license.isCapacitorNative)())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";if(t==="solid")return"solid";return"web"}async function sendInstallPing(t){const e=typeof __DEV__!=="undefined"&&__DEV__;if(!e)return;if(!t.enabled)return;if(sentThisSession)return;sentThisSession=true;try{const n=await readState();const r=Date.now();if(n&&r-n.lastPingAt<PING_INTERVAL_MS)return;const a=n?.installId??uuid();if(!n)announceOnce();await _sharedUi.persistentStorage.setItem(STORAGE_KEY,JSON.stringify({installId:a,lastPingAt:r}));await fetch(ENDPOINT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installId:a,version:_version.SDK_VERSION,platform:_reactNative.Platform.OS,tier:t.tier,framework:detectFramework()})})}catch{}}function __resetInstallPingForTests(){sentThisSession=false}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.71";
|
package/lib/module/mountBuoy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createRoot as i}from"react-dom/client";import{createElement as s}from"react";import{FloatingDevTools as
|
|
1
|
+
"use strict";import{createRoot as i}from"react-dom/client";import{createElement as s}from"react";import{FloatingDevTools as l}from"./floatingMenu/FloatingDevTools.web.js";import{installedTools as c}from"./installedTools.js";import{jsx as a}from"react/jsx-runtime";export function mountBuoy({queryClient:t,...e}={}){const r=Object.values(e.modules??c).find(d=>d.QueryClientProvider)?.QueryClientProvider;if(t&&!r)throw new Error("Add the react-query tool to modules to use queryClient.");const o=document.createElement("div");o.dataset.buoyMount="";document.body.appendChild(o);const n=i(o);const m=a(l,{...e});n.render(t?s(r,{client:t},m):m);let u=true;return()=>{if(!u)return;u=false;n.unmount();o.remove()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{act as o}from"react";import{afterEach as
|
|
1
|
+
"use strict";import{act as o}from"react";import{afterEach as y,expect as t,it as l,vi as s}from"vitest";import{mountBuoy as r}from"./mountBuoy.js";import{QueryClient as i,QueryClientProvider as d,useQueryClient as m}from"@tanstack/react-query";import{jsxs as h,jsx as u}from"react/jsx-runtime";const c=s.hoisted(()=>({installedTools:{},installedToolsFound:false}));s.mock("./installedTools",()=>c);s.mock("./floatingMenu/FloatingDevTools.web",()=>({FloatingDevTools:e=>h("span",{children:[e.environment,e.children]})}));s.stubGlobal("IS_REACT_ACT_ENVIRONMENT",true);y(()=>{document.body.innerHTML="";c.installedTools={}});l("mounts with the given props and removes its root on unmount",async()=>{let e;await o(async()=>{e=r({environment:"qa"})});t(document.querySelector("[data-buoy-mount]")?.textContent).toBe("qa");await o(async()=>e());t(document.querySelector("[data-buoy-mount]")).toBeNull();t(()=>e()).not.toThrow()});l("keeps other roots and app DOM when one mount is removed",async()=>{const e=document.createElement("main");document.body.append(e);let a;let n;await o(async()=>{a=r({environment:"qa"});n=r({environment:"dev"})});await o(async()=>a());t(e.isConnected).toBe(true);t(document.querySelectorAll("[data-buoy-mount]")).toHaveLength(1);t(document.querySelector("[data-buoy-mount]")?.textContent).toBe("dev");await o(async()=>n())});l("shares the app QueryClient with tool panels",async()=>{const e=new i;e.setQueryData(["host"],"from Angular");function a(){return u("b",{children:m().getQueryData(["host"])})}let n;await o(async()=>{n=r({queryClient:e,modules:{query:{QueryClientProvider:d}},children:u(a,{})})});t(document.querySelector("[data-buoy-mount]")?.textContent).toBe("from Angular");await o(async()=>n())});l("fails before adding a root when the Query provider is absent",()=>{t(()=>r({queryClient:new i})).toThrow("Add the react-query tool");t(document.querySelector("[data-buoy-mount]")).toBeNull()});l("finds the Query provider among the tools the buoy() plugin found",async()=>{c.installedTools={"react-query":{QueryClientProvider:d}};const e=new i;e.setQueryData(["host"],"from Solid");function a(){return u("b",{children:m().getQueryData(["host"])})}let n;await o(async()=>{n=r({queryClient:e,children:u(a,{})})});t(document.querySelector("[data-buoy-mount]")?.textContent).toBe("from Solid");await o(async()=>n())});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Platform as r}from"react-native";import{persistentStorage as s}from"@buoy-gg/shared-ui";import{isCapacitorNative as u}from"@buoy-gg/license";import{SDK_VERSION as c}from"../version.js";const l="@react_buoy_install";const x="https://buoy.gg/api/t";const f=24*60*60*1e3;function p(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;const e=t==="x"?n:n&3|8;return e.toString(16)})}async function d(){try{const t=await s.getItem(l);if(!t)return null;const n=JSON.parse(t);if(typeof n?.installId!=="string")return null;return{installId:n.installId,lastPingAt:typeof n.lastPingAt==="number"?n.lastPingAt:0}}catch{return null}}function m(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let o=false;export function detectFramework(){if(r.isTV)return"tv";if(r.OS!=="web")return"react-native";if(u())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";return"web"}export async function sendInstallPing(t){const n=typeof __DEV__!=="undefined"&&__DEV__;if(!n)return;if(!t.enabled)return;if(o)return;o=true;try{const e=await d();const
|
|
1
|
+
"use strict";import{Platform as r}from"react-native";import{persistentStorage as s}from"@buoy-gg/shared-ui";import{isCapacitorNative as u}from"@buoy-gg/license";import{SDK_VERSION as c}from"../version.js";const l="@react_buoy_install";const x="https://buoy.gg/api/t";const f=24*60*60*1e3;function p(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;const e=t==="x"?n:n&3|8;return e.toString(16)})}async function d(){try{const t=await s.getItem(l);if(!t)return null;const n=JSON.parse(t);if(typeof n?.installId!=="string")return null;return{installId:n.installId,lastPingAt:typeof n.lastPingAt==="number"?n.lastPingAt:0}}catch{return null}}function m(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let o=false;export function detectFramework(){if(r.isTV)return"tv";if(r.OS!=="web")return"react-native";if(u())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";if(t==="solid")return"solid";return"web"}export async function sendInstallPing(t){const n=typeof __DEV__!=="undefined"&&__DEV__;if(!n)return;if(!t.enabled)return;if(o)return;o=true;try{const e=await d();const i=Date.now();if(e&&i-e.lastPingAt<f)return;const a=e?.installId??p();if(!e)m();await s.setItem(l,JSON.stringify({installId:a,lastPingAt:i}));await fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installId:a,version:c,platform:r.OS,tier:t.tier,framework:detectFramework()})})}catch{}}export function __resetInstallPingForTests(){o=false}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const SDK_VERSION="7.0.
|
|
1
|
+
"use strict";export const SDK_VERSION="7.0.71";
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
/**
|
|
27
27
|
* Which kind of app this is, so the dashboard can count each port on its own.
|
|
28
28
|
* `Platform.OS` alone says "web" for Angular, Capacitor and plain web alike,
|
|
29
|
-
* and "ios" for a TV app. A Capacitor shell wins over Angular: it is
|
|
30
|
-
* shell, and an Ionic Angular app is a Capacitor app first.
|
|
29
|
+
* and "ios" for a TV app. A Capacitor shell wins over Angular and Solid: it is
|
|
30
|
+
* the shell, and an Ionic Angular app is a Capacitor app first.
|
|
31
31
|
*/
|
|
32
32
|
export declare function detectFramework(): string;
|
|
33
33
|
/**
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.71";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
/**
|
|
27
27
|
* Which kind of app this is, so the dashboard can count each port on its own.
|
|
28
28
|
* `Platform.OS` alone says "web" for Angular, Capacitor and plain web alike,
|
|
29
|
-
* and "ios" for a TV app. A Capacitor shell wins over Angular: it is
|
|
30
|
-
* shell, and an Ionic Angular app is a Capacitor app first.
|
|
29
|
+
* and "ios" for a TV app. A Capacitor shell wins over Angular and Solid: it is
|
|
30
|
+
* the shell, and an Ionic Angular app is a Capacitor app first.
|
|
31
31
|
*/
|
|
32
32
|
export declare function detectFramework(): string;
|
|
33
33
|
/**
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.71";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/web/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as m,b as d,c,d as p,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-XA3PD6QG.mjs";import{$ as A,A as F,Aa as L,B as R,Ba as q,C as x,Ca as I,D as U,Da as W,E as j,Ea as
|
|
1
|
+
"use client";import{a as m,b as d,c,d as p,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-XA3PD6QG.mjs";import{$ as A,A as F,Aa as L,B as R,Ba as q,C as x,Ca as I,D as U,Da as W,E as j,Ea as J,F as K,Fa as O,G as V,Ga as G,H as X,Ha as z,I as N,Ia as Q,J as Z,Ja as Y,K as _,Ka as $,L as aa,La as sa,M as ea,Ma as oa,N as ta,Na as ra,O as la,Oa as ia,P as na,Pa as ua,Q as ma,R as da,S as ca,T as pa,U as Ca,V as ga,W as ya,X as fa,Y as Sa,Z as Ta,_ as va,a as ha,aa as ba,b as Da,ba as Ba,c as Pa,ca as ka,d as wa,da as Ea,e as Ha,ea as Ma,f as Aa,fa as Fa,g as La,ga as Ra,h as qa,ha as xa,i as Ia,ia as Ua,j as Wa,ja,k as Ja,ka as Ka,l as Oa,la as Va,m as Ga,ma as Xa,n as za,na as Na,o as Qa,oa as Za,p as Ya,pa as _a,q as $a,qa as as,r as ss,ra as es,s as os,sa as ts,t as rs,ta as ls,u as is,ua as ns,v as us,va as ms,w as ds,wa as cs,x as ps,xa as Cs,y as gs,ya as ys,z as fs,za as Ss}from"./chunks/chunk-RBPDZUHO.mjs";import"./chunks/chunk-Z6I7ZD34.mjs";import{c as Ts}from"./chunks/chunk-D2FYORGY.mjs";import{a as vs}from"./chunks/chunk-LOPXJLVB.mjs";import{useSettings as hs,useFloatingTools as bs,getToolLabel as Ds,getToolDescription as Bs,getToolColor as Ps,settingsColors as ks,settingsStyles as ws,dialColors as Es,dialStyles as Hs}from"@buoy-gg/floating-tools-react/web";import{LicenseManager as Ms}from"@buoy-gg/license/web";import{createRoot as As}from"react-dom/client";import{createElement as Fs}from"react";import{installedTools as Ls}from"@buoy-gg/core/web/installed-tools";import{jsx as Rs}from"react/jsx-runtime";function n({queryClient:s,...e}={}){let o=Object.values(e.modules??Ls).find(u=>u.QueryClientProvider)?.QueryClientProvider;if(s&&!o)throw new Error("Add the react-query tool to modules to use queryClient.");let a=document.createElement("div");a.dataset.buoyMount="",document.body.appendChild(a);let t=As(a),r=Rs(i,{...e});t.render(s?Fs(o,{client:s},r):r);let l=true;return()=>{l&&(l=false,t.unmount(),a.remove())}}vs(n,"mountBuoy");export{X as Activity,as as AlertCircle,N as AlertTriangle,D as AppHostProvider,P as AppOverlay,wa as Badge,es as BarChart3,is as BaseEventStore,ts as Bookmark,Z as Bug,Ia as Button,Ga as Card,_ as Check,aa as CheckCircle,$ as CheckSquare,ea as ChevronDown,ta as ChevronLeft,la as ChevronRight,na as ChevronUp,ma as Clock,ls as Cloud,Qa as CollapsibleSection,da as Copy,Wa as CopyButton,rs as DataViewer,ca as Database,w as DevToolsVisibilityProvider,S as DialMenu,La as DiffViewer,y as Divider,ns as Download,ms as Edit3,$a as EmptyState,os as EventStepperFooter,pa as Eye,Ca as EyeOff,ga as FileJson,ya as FileText,fa as Filter,Sa as FlaskConical,i as FloatingDevTools,g as FloatingTools,cs as GitBranch,Ta as Globe,Cs as HardDrive,va as Hash,ys as HelpCircle,Ss as Home,L as Image,A as Info,Aa as InfoRow,V as JsModal,ba as Key,Ba as Layers,Ms as LicenseManager,q as Link,ka as Lock,I as Maximize2,W as Minus,J as Palette,Ea as Pause,O as Pin,Ma as Play,Fa as Plus,Ra as Power,Ja as PowerToggle,xa as RefreshCw,us as RelativeTime,G as Route,Oa as Row,Ua as Search,ss as SearchBar,za as SectionHeader,z as Server,ja as Settings,T as SettingsModal,Ka as Shield,Q as Smartphone,Y as Square,Ha as StatusDot,Ya as TabSelector,sa as Timer,Va as Trash2,oa as Unlock,ra as Upload,Xa as User,f as UserStatus,ia as Users,Na as Wifi,Za as X,ua as XCircle,_a as Zap,M as appSyncAdapter,d as autoDiscoverWebPresets,c as autoDiscoverWithCustom,Ts as clearReleaseOptIn,K as copyToClipboard,k as createWebTool,H as createWebTools,m as defaultToolPresets,U as devToolsStorageKeys,Es as dialColors,Hs as dialStyles,ds as formatBytes,ps as formatDuration,gs as formatNumber,C as getEnabledTools,Ps as getToolColor,Bs as getToolDescription,Ds as getToolLabel,p as getToolsBySlot,b as isBuoyHoldingBackButton,Da as methodColor,n as mountBuoy,x as persistentStorage,F as safeStringify,ks as settingsColors,ws as settingsStyles,ha as statusColor,qa as toolTheme,fs as truncateMiddle,Pa as typeColor,B as useAppHost,E as useDevToolsVisibility,bs as useFloatingTools,R as usePersistedState,j as useSafeAreaInsets,hs as useSettings,h as useToolHeader,v as useToolHost};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/core",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.71",
|
|
4
4
|
"description": "Floating developer menu and account setup for React Native. Add tool packages and configure Desktop or MCP connections separately.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
],
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"react-devtools-core": "6.1.5",
|
|
92
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
93
|
-
"@buoy-gg/floating-tools-react": "^7.0.
|
|
94
|
-
"@buoy-gg/license": "^7.0.
|
|
95
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
92
|
+
"@buoy-gg/floating-tools-core": "^7.0.71",
|
|
93
|
+
"@buoy-gg/floating-tools-react": "^7.0.71",
|
|
94
|
+
"@buoy-gg/license": "^7.0.71",
|
|
95
|
+
"@buoy-gg/shared-ui": "^7.0.71"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"react": "*"
|