[{"data":1,"prerenderedAt":541},["ShallowReactive",2],{"navigation":3,"\u002Fguide\u002Fclient\u002Fadvanced":208,"\u002Fguide\u002Fclient\u002Fadvanced-surround":536},[4,98,175],{"title":5,"path":6,"stem":7,"children":8,"icon":97},"Guide","\u002Fguide","1.guide\u002F1.index",[9,12,17,22,46,61,79],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-house",{"title":13,"path":14,"stem":15,"icon":16},"Installation","\u002Fguide\u002Finstallation","1.guide\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Quick start","\u002Fguide\u002Fquick-start","1.guide\u002F3.quick-start","i-lucide-rocket",{"title":23,"path":24,"stem":25,"children":26,"icon":45},"Server","\u002Fguide\u002Fserver","1.guide\u002F4.server\u002F1.index",[27,30,35,40],{"title":28,"path":24,"stem":25,"icon":29},"Usage","i-lucide-server",{"title":31,"path":32,"stem":33,"icon":34},"Config file","\u002Fguide\u002Fserver\u002Fconfig-file","1.guide\u002F4.server\u002F2.config-file","i-lucide-file-cog",{"title":36,"path":37,"stem":38,"icon":39},"Options","\u002Fguide\u002Fserver\u002Foptions","1.guide\u002F4.server\u002F3.options","i-lucide-settings",{"title":41,"path":42,"stem":43,"icon":44},"Advanced","\u002Fguide\u002Fserver\u002Fadvanced","1.guide\u002F4.server\u002F4.advanced","i-lucide-flask-conical",false,{"title":47,"path":48,"stem":49,"children":50,"icon":45},"Client","\u002Fguide\u002Fclient","1.guide\u002F5.client\u002F1.index",[51,53,58],{"title":28,"path":48,"stem":49,"icon":52},"i-lucide-monitor-smartphone",{"title":54,"path":55,"stem":56,"icon":57},"Live queries","\u002Fguide\u002Fclient\u002Flive-queries","1.guide\u002F5.client\u002F2.live-queries","i-lucide-radio",{"title":41,"path":59,"stem":60,"icon":44},"\u002Fguide\u002Fclient\u002Fadvanced","1.guide\u002F5.client\u002F3.advanced",{"title":62,"path":63,"stem":64,"children":65,"icon":45},"Development socket","\u002Fguide\u002Fsocket","1.guide\u002F6.socket\u002F1.index",[66,68,71,74],{"title":28,"path":63,"stem":64,"icon":67},"i-lucide-plug",{"title":36,"path":69,"stem":70,"icon":39},"\u002Fguide\u002Fsocket\u002Foptions","1.guide\u002F6.socket\u002F2.options",{"title":41,"path":72,"stem":73,"icon":44},"\u002Fguide\u002Fsocket\u002Fadvanced","1.guide\u002F6.socket\u002F3.advanced",{"title":75,"path":76,"stem":77,"icon":78},"PGlite in dev, Postgres in prod","\u002Fguide\u002Fsocket\u002Fdevelopment-only","1.guide\u002F6.socket\u002F4.development-only","i-lucide-cloud-upload",{"title":80,"path":81,"stem":82,"children":83,"icon":45},"DevTools & tooling","\u002Fguide\u002Fdevtools","1.guide\u002F7.devtools\u002F1.index",[84,87,92],{"title":85,"path":81,"stem":82,"icon":86},"DevTools tab","i-lucide-wrench",{"title":88,"path":89,"stem":90,"icon":91},"Actions","\u002Fguide\u002Fdevtools\u002Factions","1.guide\u002F7.devtools\u002F2.actions","i-lucide-zap",{"title":93,"path":94,"stem":95,"icon":96},"Terminal","\u002Fguide\u002Fdevtools\u002Fterminal","1.guide\u002F7.devtools\u002F3.terminal","i-lucide-square-terminal","i-lucide-book-open",{"title":99,"icon":100,"path":101,"stem":102,"children":103,"page":45},"Recipes","i-lucide-chef-hat","\u002Frecipes","2.recipes",[104,116,138,159,171],{"title":105,"path":106,"stem":107,"children":108,"icon":45},"Migrations","\u002Frecipes\u002Fmigrations","2.recipes\u002F1.migrations\u002F1.index",[109,111],{"title":28,"path":106,"stem":107,"icon":110},"i-lucide-database-backup",{"title":112,"path":113,"stem":114,"icon":115},"Edited migrations","\u002Frecipes\u002Fmigrations\u002Fedited-migrations","2.recipes\u002F1.migrations\u002F2.edited-migrations","i-lucide-file-diff",{"title":117,"path":118,"stem":119,"children":120,"icon":45},"Testing","\u002Frecipes\u002Ftesting","2.recipes\u002F2.testing\u002F1.index",[121,123,128,133],{"title":28,"path":118,"stem":119,"icon":122},"i-lucide-test-tube",{"title":124,"path":125,"stem":126,"icon":127},"Isolation","\u002Frecipes\u002Ftesting\u002Fisolation","2.recipes\u002F2.testing\u002F2.isolation","i-lucide-git-fork",{"title":129,"path":130,"stem":131,"icon":132},"vitest","\u002Frecipes\u002Ftesting\u002Fvitest","2.recipes\u002F2.testing\u002F3.vitest","i-simple-icons-vitest",{"title":134,"path":135,"stem":136,"icon":137},"@nuxt\u002Ftest-utils","\u002Frecipes\u002Ftesting\u002Fnuxt-test-utils","2.recipes\u002F2.testing\u002F4.nuxt-test-utils","i-simple-icons-nuxt",{"title":139,"path":140,"stem":141,"children":142,"icon":45},"Deploy","\u002Frecipes\u002Fdeploy","2.recipes\u002F3.deploy\u002F1.index",[143,144,149,154],{"title":139,"path":140,"stem":141},{"title":145,"path":146,"stem":147,"icon":148},"Any Postgres","\u002Frecipes\u002Fdeploy\u002Fpostgres","2.recipes\u002F3.deploy\u002F2.postgres","i-lucide-database",{"title":150,"path":151,"stem":152,"icon":153},"Netlify","\u002Frecipes\u002Fdeploy\u002Fnetlify","2.recipes\u002F3.deploy\u002F3.netlify","i-simple-icons-netlify",{"title":155,"path":156,"stem":157,"icon":158},"Neon","\u002Frecipes\u002Fdeploy\u002Fneon","2.recipes\u002F3.deploy\u002F4.neon","i-simple-icons-neon",{"title":160,"path":161,"stem":162,"children":163,"icon":45},"Outside Nuxt","\u002Frecipes\u002Foutside-nuxt","2.recipes\u002F4.outside-nuxt\u002F1.index",[164,167],{"title":165,"path":161,"stem":162,"icon":166},"Config and provider","i-lucide-package",{"title":168,"path":169,"stem":170,"icon":67},"Socket server","\u002Frecipes\u002Foutside-nuxt\u002Fsocket","2.recipes\u002F4.outside-nuxt\u002F2.socket",{"title":172,"path":173,"stem":174,"icon":67},"Nitro's useDatabase","\u002Frecipes\u002Fnitro-database","2.recipes\u002F5.nitro-database",{"title":176,"icon":177,"path":178,"stem":179,"children":180,"page":45},"Reference","i-lucide-code-xml","\u002Freference","3.reference",[181,185,189,193,198,203],{"title":182,"path":183,"stem":184,"icon":34},"Config files","\u002Freference\u002Fconfig-files","3.reference\u002F1.config-files",{"title":186,"path":187,"stem":188,"icon":39},"Module options","\u002Freference\u002Fmodule-options","3.reference\u002F2.module-options",{"title":190,"path":191,"stem":192,"icon":67},"Socket options","\u002Freference\u002Fsocket-options","3.reference\u002F3.socket-options",{"title":194,"path":195,"stem":196,"icon":197},"Exports","\u002Freference\u002Fexports","3.reference\u002F4.exports","i-lucide-boxes",{"title":199,"path":200,"stem":201,"icon":202},"Hooks","\u002Freference\u002Fhooks","3.reference\u002F5.hooks","i-lucide-anchor",{"title":204,"path":205,"stem":206,"icon":207},"Environment","\u002Freference\u002Fenvironment","3.reference\u002F6.environment","i-lucide-variable",{"id":209,"title":41,"body":210,"description":529,"extension":530,"links":531,"meta":532,"navigation":533,"path":59,"seo":534,"stem":60,"__hash__":535},"docs\u002F1.guide\u002F5.client\u002F3.advanced.md",{"type":211,"value":212,"toc":521},"minimark",[213,222,229,342,369,373,379,443,461,465,480,497,501,504,508,517],[214,215,217,218],"h2",{"id":216},"explicit-imports-pgliteclient","Explicit imports: ",[219,220,221],"code",{},"#pglite\u002Fclient",[223,224,225,226,228],"p",{},"Everything the client side auto-imports is also exported by ",[219,227,221],{},":",[230,231,236],"pre",{"className":232,"code":233,"language":234,"meta":235,"style":235},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import {\n  definePGliteClientConfig,\n  pglite,\n  useLiveIncrementalQuery,\n  useLiveQuery,\n  usePGlite,\n} from '#pglite\u002Fclient'\nimport type { PGliteClientConfig, PGliteClientInstanceFor } from '#pglite\u002Fclient'\n","ts","",[219,237,238,251,261,269,277,285,293,311],{"__ignoreMap":235},[239,240,243,247],"span",{"class":241,"line":242},"line",1,[239,244,246],{"class":245},"s7zQu","import",[239,248,250],{"class":249},"sMK4o"," {\n",[239,252,254,258],{"class":241,"line":253},2,[239,255,257],{"class":256},"sTEyZ","  definePGliteClientConfig",[239,259,260],{"class":249},",\n",[239,262,264,267],{"class":241,"line":263},3,[239,265,266],{"class":256},"  pglite",[239,268,260],{"class":249},[239,270,272,275],{"class":241,"line":271},4,[239,273,274],{"class":256},"  useLiveIncrementalQuery",[239,276,260],{"class":249},[239,278,280,283],{"class":241,"line":279},5,[239,281,282],{"class":256},"  useLiveQuery",[239,284,260],{"class":249},[239,286,288,291],{"class":241,"line":287},6,[239,289,290],{"class":256},"  usePGlite",[239,292,260],{"class":249},[239,294,296,299,302,305,308],{"class":241,"line":295},7,[239,297,298],{"class":249},"}",[239,300,301],{"class":245}," from",[239,303,304],{"class":249}," '",[239,306,221],{"class":307},"sfazB",[239,309,310],{"class":249},"'\n",[239,312,314,316,319,322,325,328,331,334,336,338,340],{"class":241,"line":313},8,[239,315,246],{"class":245},[239,317,318],{"class":245}," type",[239,320,321],{"class":249}," {",[239,323,324],{"class":256}," PGliteClientConfig",[239,326,327],{"class":249},",",[239,329,330],{"class":256}," PGliteClientInstanceFor",[239,332,333],{"class":249}," }",[239,335,301],{"class":245},[239,337,304],{"class":249},[239,339,221],{"class":307},[239,341,310],{"class":249},[223,343,344,347,348,351,352,355,356,355,359,362,363,368],{},[219,345,346],{},"pglite"," is the provider behind ",[219,349,350],{},"usePGlite()",", with the same ",[219,353,354],{},"use()"," \u002F ",[219,357,358],{},"instance",[219,360,361],{},"close()"," as ",[364,365,367],"a",{"href":366},"\u002Fguide\u002Fserver\u002Fadvanced#the-provider","on the server",".",[214,370,372],{"id":371},"data-directories","Data directories",[223,374,375,378],{},[219,376,377],{},"dataDir"," decides where the browser keeps the data:",[380,381,382,399],"table",{},[383,384,385],"thead",{},[386,387,388,393,396],"tr",{},[389,390,391],"th",{},[219,392,377],{},[389,394,395],{},"Storage",[389,397,398],{},"Notes",[400,401,402,417,430],"tbody",{},[386,403,404,411,414],{},[405,406,407,408],"td",{},"unset or ",[219,409,410],{},"memory:\u002F\u002F",[405,412,413],{},"memory",[405,415,416],{},"Gone on reload.",[386,418,419,424,427],{},[405,420,421],{},[219,422,423],{},"idb:\u002F\u002F\u003Cname>",[405,425,426],{},"IndexedDB",[405,428,429],{},"Persistent, widely supported. One name per app.",[386,431,432,437,440],{},[405,433,434],{},[219,435,436],{},"opfs-ahp:\u002F\u002F\u003Cname>",[405,438,439],{},"Origin Private File System",[405,441,442],{},"Persistent and faster; workers only, which is where it runs here.",[223,444,445,446,449,450,453,454,460],{},"Set it in the config file, or in ",[219,447,448],{},"nuxt.config.ts"," under ",[219,451,452],{},"pglite.client.options.dataDir"," when it does not depend on code. See ",[364,455,459],{"href":456,"rel":457},"https:\u002F\u002Fpglite.dev\u002Fdocs\u002Ffilesystems",[458],"nofollow","PGlite's filesystems"," for the trade-offs.",[214,462,464],{"id":463},"the-worker-and-tabs","The worker and tabs",[223,466,467,468,475,476,479],{},"The instance is a ",[364,469,472],{"href":470,"rel":471},"https:\u002F\u002Fpglite.dev\u002Fdocs\u002Fmulti-tab-worker",[458],[219,473,474],{},"PGliteWorker",": every tab of your app starts the worker, one of them is elected to run the database, and the others forward their queries to it. When that tab closes, another one takes over. You do not have to do anything for this; it is why ",[219,477,478],{},"init"," runs in each tab and should be repeatable.",[223,481,482,485,486,489,490,493,494,496],{},[219,483,484],{},"extensions"," load inside the worker. ",[219,487,488],{},"clientExtensions"," load on each tab's main thread; their functions (",[219,491,492],{},"pg.live.query()",", …) are available on the instance ",[219,495,350],{}," returns.",[214,498,500],{"id":499},"vite-only","Vite only",[223,502,503],{},"The worker, its WebAssembly and its data file are wired for Vite, Nuxt's default builder. Enabling the client side with webpack or Rspack fails at startup with a message saying so. The module also excludes PGlite and the packages your client config imports from Vite's dependency pre-bundling, which would otherwise separate PGlite from its WebAssembly.",[214,505,507],{"id":506},"starting-early","Starting early",[223,509,510,513,514,516],{},[219,511,512],{},"pglite.client.eager: true"," starts the worker as soon as the app loads, instead of on the first ",[219,515,350],{},". Useful when the first query is on the critical path; wasteful when most pages never touch the database.",[518,519,520],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":235,"searchDepth":242,"depth":253,"links":522},[523,525,526,527,528],{"id":216,"depth":253,"text":524},"Explicit imports: #pglite\u002Fclient",{"id":371,"depth":253,"text":372},{"id":463,"depth":253,"text":464},{"id":499,"depth":253,"text":500},{"id":506,"depth":253,"text":507},"Explicit imports, data directories, the worker and the Vite requirement.","md",null,{},{"icon":44},{"title":41,"description":529},"aYVxz4oDQaZBg_8nkSrLW9GA-_eV7Cui2xBIpmLx5Jo",[537,539],{"title":54,"path":55,"stem":56,"description":538,"icon":57,"children":-1},"Components that follow the data, with useLiveQuery and useLiveIncrementalQuery.",{"title":28,"path":63,"stem":64,"description":540,"icon":67,"children":-1},"Serve the development database over the Postgres wire protocol, and connect anything that speaks Postgres to it.",1791474260603]