[
  {
    "path": ".github/FUNDING.yml",
    "content": "# Enables \"Sponsor\" button on project\n\ngithub: lupas\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "content": "---\nname: Bug report\nabout: Report a bug report to help us improve the module.\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n<!-- **IMPORTANT!**\nBefore reporting a bug, please make sure that you have read through our and the Firebase documentation and you think your problem is indeed an issue related to our module. -->\n\n### Version\n@nuxtjs/firebase: <!-- ex: 5.0.7 -->\nfirebase: <!-- ex: 7.9.3 -->\nnuxt: <!-- ex: 2.10.2 -->\n\n### Reproduction Link\n<!-- A minimal test case on https://template.nuxtjs.org/ or GitHub repository that can reproduce the bug. -->\n\n### Steps to reproduce\n\n\n### What is Expected?\n\n\n### What is actually happening?\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: StackOverflow\n    url: https://stackoverflow.com/questions/tagged/firebase+nuxt.js\n    about: Ask general Nuxt & Firebase questions not specifically related to this module on StackOverflow.\n  - name: Nuxt Community Discord\n    url: https://discord.nuxtjs.org/\n    about: Asking more specific questions about the module on Discord.\n  - name: nuxt-firebase Documentation\n    url: https://firebase.nuxtjs.org/\n    about: Check our documentation before reporting issues or questions.\n  - name: Firebase Documentation\n    url: https://firebase.google.com/docs/web/setup\n    about: Make sure to study the Firebase documentation before asking questions, too.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea or enhancement for this project.\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n### Is your feature request related to a problem? Please describe.\n<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->\n\n### Describe the solution you'd like\n<!-- A clear and concise description of what you want to happen. -->\n\n### Describe alternatives you've considered\n<!-- A clear and concise description of any alternative solutions or features you've considered. -->\n\n### Additional context\n<!-- Add any other context or screenshots about the feature request here. -->\n"
  },
  {
    "path": ".gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Node template\n# Logs\n/logs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# next.js build output\n.next\n\n# nuxt.js build output\n.nuxt\n\n# Nuxt generate\ndist\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless\n\n# IDE / Editor\n.idea\n\n\n\n# macOS\n.DS_Store\n\n# Vim swap files\n*.swp\n\n**/demo/static/*sw.js\n**/demo/static/sw.js\n\ncache"
  },
  {
    "path": ".opensource/README.md",
    "content": "The `/.opensource/project.json` file is needed for the module to be featured on https://firebaseopensource.com.\n"
  },
  {
    "path": ".opensource/project.json",
    "content": "{\n  \"name\": \"Nuxt Firebase-Module\",\n  \"platforms\": [\n    \"Web\"\n  ],\n  \"content\": \"README.md\",\n  \"pages\": [],\n  \"tabs\": [\n    {\n      \"title\": \"Full Documentation\",\n      \"href\": \"https://firebase.nuxtjs.org/\"\n    },\n    {\n      \"title\": \"Nuxt.js (v2), Firestore & SSR\",\n      \"href\": \"https://medium.com/@pascalluther/nuxt-js-v2-firestore-ssr-938d8fb7d2b0\"\n    }\n  ]\n}"
  },
  {
    "path": ".prettierrc.json",
    "content": "{\n  \"semi\": false,\n  \"arrowParens\": \"always\",\n  \"singleQuote\": true,\n  \"bracketSpacing\": false\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"git.ignoreLimitWarning\": true\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018-present Pascal Luther\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n  <img src=\"./packages/docs/static/preview.png\" alt=\"nuxt-firebase logo\">\n</p>\n\n[![](https://david-dm.org/nuxt-community/firebase-module/status.svg?style=flat-square)](https://david-dm.org/nuxt-community/i18n-module)\n[![](https://snyk.io/test/github/nuxt-community/firebase-module/badge.svg?style=flat-square)](https://snyk.io/test/github/nuxt-community/firebase-module)\n[![](https://img.shields.io/npm/v/@nuxtjs/firebase/latest.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/firebase)\n[![](https://img.shields.io/npm/dt/@nuxtjs/firebase.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/firebase)\n\n> Easily integrate Firebase into your Nuxt project.\n\n## IMPORTANT!\n\n> ### ⚠️ **Nuxt 3 not supported ⚠️**:\n>\n> This module was written for Nuxt 2 and does currently not support Nuxt 3.\n> There are currently no plans to support Nuxt 3 in the near future in this module.\n> However, you can take a look at [VueFire Nuxt module for Nuxt 3 support](https://vuefire.vuejs.org/nuxt/getting-started.html)\n\n> ### ℹ️ **Modular Mode (Firebase v9+) ℹ️**:\n>\n> This module does not support the new modular syntax from Firebase v9+.\n>\n> If you plan to use the new modular mode of Version 9, we advise you to implement Firebase manually as described in the following [medium article](https://lupas.medium.com/firebase-9-beta-nuxt-js-981cf3dac910).\n>\n> It is currently unclear when, and if, this module will support the new modular mode. See [discussion](https://github.com/nuxt-community/firebase-module/issues/597).\n\n## Links\n\n- 📘 [Documentation](https://firebase.nuxtjs.org/)\n- 🔖 [Release notes](https://github.com/nuxt-community/firebase-module/releases)\n- 👥 [Community](https://discord.nuxtjs.org/)\n\n## Quick Setup\n\nMake sure you are using Nuxt 2 and have Firebase v8 installed in your project.\n\n```bash\nyarn add firebase # OR npm i firebase\n```\n\nInstall the module via NPM or Yarn:\n\n```bash\nyarn add @nuxtjs/firebase # OR npm i @nuxtjs/firebase\n```\n\n## Quick Config\n\nAdd the following to your nuxt.config.js.\n\nSee all configuration options [here](https://firebase.nuxtjs.org/guide/options/).\n\n```js\nmodules: [\n    [\n      '@nuxtjs/firebase',\n      {\n        config: {\n          apiKey: '<apiKey>',\n          authDomain: '<authDomain>',\n          projectId: '<projectId>',\n          storageBucket: '<storageBucket>',\n          messagingSenderId: '<messagingSenderId>',\n          appId: '<appId>',\n          measurementId: '<measurementId>'\n        },\n        services: {\n          auth: true // Just as example. Can be any other service.\n        }\n      }\n    ]\n  ],\n```\n\n## Quick Usage\n\nNow you can use all Firebase services with `this.$fire.auth`, `this.$fire.firestore`, `this.$fire.messaging` etc. (see list [here](https://firebase.nuxtjs.org/guide/usage/)).\n\nExample:\n\n```js\ntry {\n  await this.$fire.auth.createUserWithEmailAndPassword('foo@foo.foo', 'test')\n} catch (e) {\n  handleError(e)\n}\n```\n\n## Guidelines for issues & feature requests\n\n- Use the GitHub issue search — check if the issue or feature request has already been reported.\n- Check if the issue has been fixed — try to reproduce it using the latest master or development branch in the repository.\n- Isolate the problem — create a reduced test case and a live example.\n\nA good issue shouldn't leave others needing to chase you up for more information. Please **try to be as detailed as possible** in your report. What is your environment? What steps will reproduce the issue? What versions are you using? What would you expect to be the outcome? All these details will help people to fix any potential bugs.\n\nIf you have difficulties that are most likely not bugs or if you just have a simple questions, please ask them in the [Nuxt Discord server](https://discord.nuxtjs.org) instead.\n\nIf your issue does not suffice these guidelines, it might be closed immediately.\n\n## License\n\nMIT - [Nuxt-Community](https://github.com/nuxt-community) - [Pascal Luther](https://github.com/lupas)\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"@nuxtjs/firebase-monorepo\",\n  \"keywords\": [\n    \"firebase\",\n    \"firestore\",\n    \"google\",\n    \"googleauthentication\",\n    \"nuxt\",\n    \"realtimedatabase\"\n  ],\n  \"homepage\": \"https://firebase.nuxtjs.org/\",\n  \"repository\": \"nuxt-community/firebase-module\",\n  \"license\": \"MIT\",\n  \"author\": \"Pascal Luther\",\n  \"workspaces\": [\n    \"packages/**\"\n  ],\n  \"scripts\": {\n    \"heroku:setup\": \"heroku login && heroku git:remote -a nuxt-fire-demo\",\n    \"heroku:deploy\": \"git subtree push --prefix packages/demo heroku HEAD:master\"\n  }\n}\n"
  },
  {
    "path": "packages/demo/.eslintrc.js",
    "content": "module.exports = {\n  root: true,\n  env: {\n    browser: true,\n    node: true,\n  },\n  extends: [\n    '@nuxtjs/eslint-config-typescript',\n    'prettier',\n    'prettier/vue',\n    'plugin:prettier/recommended',\n    'plugin:nuxt/recommended',\n  ],\n  plugins: ['prettier'],\n  // add your custom rules here\n  rules: {},\n}\n"
  },
  {
    "path": "packages/demo/.firebaserc",
    "content": "{\n  \"projects\": {\n    \"nuxt-fire-demo\": \"nuxt-fire-demo\",\n    \"default\": \"nuxt-fire-demo\"\n  }\n}\n"
  },
  {
    "path": "packages/demo/.prettierrc.js",
    "content": "module.exports = {\n  singleQuote: true,\n  arrowParens: 'always',\n  semi: false\n}\n"
  },
  {
    "path": "packages/demo/Procfile",
    "content": "web: nuxt start"
  },
  {
    "path": "packages/demo/README.md",
    "content": "# 🔥 Nuxt-Fire Demo\n\n<p align=\"center\"><img align=\"center\" height=\"300px\" src=\"https://nuxt-fire-demo.firebaseapp.com/logo_text.png\"/></p>\n\n> Example project using [nuxt-community/firebase-module](https://github.com/nuxt-community/firebase-module) to integrate Firebase into Nuxt.\n\n## Demo\n\n### [Live Demo](https://nuxt-fire-demo.herokuapp.com)\n\n## Build Setup\n\n```bash\n# cd to src\n$ cd src\n\n# install dependencies\n$ npm i\n\n# start firebase emulators\n$ npm run emulators\n\n# serve with hot reload at localhost:3000\n$ npm run dev\n```\n\nFor detailed explanation on how things work, checkout [nuxt-community/firebase-module](https://github.com/nuxt-community/firebase-module).\n\n## Issues\n\nIf you have any issues with nuxt-firebase, please ask the question in [nuxt-community/firebase-module/issues](https://github.com/nuxt-community/firebase-module/issues).\n"
  },
  {
    "path": "packages/demo/components/Btn.vue",
    "content": "<template>\n  <button\n    class=\"text-white font-bold py-2 px-4 rounded\"\n    :class=\"{\n      'bg-blue-500': !disabled && !loading,\n      'hover:bg-blue-700': !disabled && !loading,\n      'bg-gray-600': disabled || loading,\n      'cursor-not-allowed': disabled,\n      'cursor-wait': loading,\n    }\"\n    :disabled=\"disabled\"\n    @click=\"$emit('click')\"\n  >\n    <slot v-if=\"!loading\" />\n    <div v-else>Loading...</div>\n  </button>\n</template>\n\n<script>\nexport default {\n  props: {\n    disabled: {\n      type: Boolean,\n      default: false,\n    },\n    loading: {\n      type: Boolean,\n      default: false,\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\" scoped></style>\n"
  },
  {
    "path": "packages/demo/components/Codeblock.vue",
    "content": "<template>\n  <div>\n    <div class=\"prism\">\n      <pre\n        class=\"line-numbers\"\n        :class=\"`language-${lang}`\"\n      ><code><slot></slot></code></pre>\n    </div>\n  </div>\n</template>\n\n<script>\n/* eslint-disable no-template-curly-in-string */\n/* eslint-disable no-undef */\n\nimport Prism from 'prismjs'\nimport 'prismjs/themes/prism-tomorrow.css'\n\nexport default {\n  props: {\n    lang: {\n      type: String,\n      default: 'js',\n    },\n  },\n  mounted() {\n    Prism.highlightAll()\n  },\n}\n</script>\n\n<style scoped></style>\n"
  },
  {
    "path": "packages/demo/components/Form.vue",
    "content": "<template>\n  <div class=\"bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4\">\n    <slot />\n  </div>\n</template>\n\n<script>\nexport default {}\n</script>\n\n<style lang=\"scss\" scoped></style>\n"
  },
  {
    "path": "packages/demo/components/Logo/FirebaseLogo.vue",
    "content": "<template>\n  <svg\n      :width=\"width\"\n      :height=\"height\"\n      viewBox=\"0 0 256 351\"\n      version=\"1.1\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n      preserveAspectRatio=\"xMidYMid\"\n    >\n      <defs>\n        <path\n          d=\"M1.25273437,280.731641 L2.85834533,277.600858 L102.211177,89.0833546 L58.0613266,5.6082033 C54.3920011,-1.28304578 45.0741245,0.473674398 43.8699203,8.18789086 L1.25273437,280.731641 Z\"\n          id=\"path-1\"\n        ></path>\n        <filter\n          x=\"-50%\"\n          y=\"-50%\"\n          width=\"200%\"\n          height=\"200%\"\n          filterUnits=\"objectBoundingBox\"\n          id=\"filter-2\"\n        >\n          <feGaussianBlur\n            stdDeviation=\"17.5\"\n            in=\"SourceAlpha\"\n            result=\"shadowBlurInner1\"\n          ></feGaussianBlur>\n          <feOffset\n            dx=\"0\"\n            dy=\"0\"\n            in=\"shadowBlurInner1\"\n            result=\"shadowOffsetInner1\"\n          ></feOffset>\n          <feComposite\n            in=\"shadowOffsetInner1\"\n            in2=\"SourceAlpha\"\n            operator=\"arithmetic\"\n            k2=\"-1\"\n            k3=\"1\"\n            result=\"shadowInnerInner1\"\n          ></feComposite>\n          <feColorMatrix\n            values=\"0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.06 0\"\n            type=\"matrix\"\n            in=\"shadowInnerInner1\"\n          ></feColorMatrix>\n        </filter>\n        <path\n          d=\"M134.417103,148.974235 L166.455722,116.161738 L134.417104,55.1546874 C131.374828,49.3635911 123.983911,48.7568362 120.973828,54.5646483 L103.26875,88.6738296 L102.739423,90.4175473 L134.417103,148.974235 Z\"\n          id=\"path-3\"\n        ></path>\n        <filter\n          x=\"-50%\"\n          y=\"-50%\"\n          width=\"200%\"\n          height=\"200%\"\n          filterUnits=\"objectBoundingBox\"\n          id=\"filter-4\"\n        >\n          <feGaussianBlur\n            stdDeviation=\"3.5\"\n            in=\"SourceAlpha\"\n            result=\"shadowBlurInner1\"\n          ></feGaussianBlur>\n          <feOffset\n            dx=\"1\"\n            dy=\"-9\"\n            in=\"shadowBlurInner1\"\n            result=\"shadowOffsetInner1\"\n          ></feOffset>\n          <feComposite\n            in=\"shadowOffsetInner1\"\n            in2=\"SourceAlpha\"\n            operator=\"arithmetic\"\n            k2=\"-1\"\n            k3=\"1\"\n            result=\"shadowInnerInner1\"\n          ></feComposite>\n          <feColorMatrix\n            values=\"0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.09 0\"\n            type=\"matrix\"\n            in=\"shadowInnerInner1\"\n          ></feColorMatrix>\n        </filter>\n      </defs>\n      <g>\n        <path\n          d=\"M0,282.99762 L2.12250746,280.0256 L102.527363,89.5119284 L102.739423,87.4951323 L58.478806,4.35817711 C54.7706269,-2.60604179 44.3313035,-0.845245771 43.1143483,6.95065473 L0,282.99762 Z\"\n          fill=\"#FFC24A\"\n        ></path>\n        <g>\n          <use fill=\"#FFA712\" fill-rule=\"evenodd\" xlink:href=\"#path-1\"></use>\n          <use\n            fill=\"black\"\n            fill-opacity=\"1\"\n            filter=\"url(#filter-2)\"\n            xlink:href=\"#path-1\"\n          ></use>\n        </g>\n        <path\n          d=\"M135.004975,150.380704 L167.960199,116.629461 L134.995423,53.6993114 C131.866109,47.7425353 123.128817,47.7253411 120.032618,53.6993112 L102.421015,87.2880848 L102.421015,90.1487443 L135.004975,150.380704 Z\"\n          fill=\"#F4BD62\"\n        ></path>\n        <g>\n          <use fill=\"#FFA50E\" fill-rule=\"evenodd\" xlink:href=\"#path-3\"></use>\n          <use\n            fill=\"black\"\n            fill-opacity=\"1\"\n            filter=\"url(#filter-4)\"\n            xlink:href=\"#path-3\"\n          ></use>\n        </g>\n        <polygon\n          fill=\"#F6820C\"\n          points=\"0 282.99762 0.962097168 282.030396 4.45771144 280.60956 132.935323 152.60956 134.563025 148.178595 102.513123 87.1048584\"\n        ></polygon>\n        <path\n          d=\"M139.120971,347.551268 L255.395916,282.703666 L222.191698,78.2093373 C221.153051,71.8112478 213.303658,69.2818149 208.724314,73.8694368 L0.000254726368,282.997875 L115.608454,347.545536 C122.914643,351.624979 131.812872,351.62689 139.120971,347.551268\"\n          fill=\"#FDE068\"\n        ></path>\n        <path\n          d=\"M254.354084,282.159837 L221.401937,79.2179369 C220.371175,72.8684188 213.843792,70.2409553 209.299213,74.79375 L1.28945312,282.600785 L115.627825,346.509458 C122.878548,350.557931 131.709226,350.559827 138.961846,346.515146 L254.354084,282.159837 Z\"\n          fill=\"#FCCA3F\"\n        ></path>\n        <path\n          d=\"M139.120907,345.64082 C131.812808,349.716442 122.914579,349.714531 115.60839,345.635089 L0.93134768,282.014551 L0.000191044776,282.997875 L115.60839,347.545536 C122.914579,351.624979 131.812808,351.62689 139.120907,347.551268 L255.395853,282.703666 L255.111196,280.951785 L139.120907,345.64082 Z\"\n          fill=\"#EEAB37\"\n        ></path>\n      </g>\n    </svg>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  data() {\n    return {\n      size: 0.3\n    }\n  },\n  computed: {\n    height(): string {\n      return `${this.size * 351}px`\n    },\n    width(): string {\n      return `${this.size * 256}px`\n    }\n  }\n})\n</script>\n\n<style scoped>\n\t.st10{fill:#00C58E;}\n\t.st11{fill:#2F495E;}\n\t.st12{fill:#108775;}\n</style>\n"
  },
  {
    "path": "packages/demo/components/Logo/NuxtLogo.vue",
    "content": "<template>\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 400 400\" style=\"enable-background:new 0 0 400 400;\" xml:space=\"preserve\">\n<g transform=\"translate(0 50)\">\n\t<path class=\"st10\" d=\"M227.9,83.5l-13.7,24.1l-46.8-82.4l-143.7,253H121c0,13.3,10.6,24.1,23.7,24.1h-121\n\t\tc-8.5,0-16.3-4.6-20.5-12.1s-4.2-16.6,0-24.1l143.7-253C151.1,5.6,159,1,167.4,1c8.5,0,16.3,4.6,20.5,12.1L227.9,83.5z\"/>\n\t<path class=\"st11\" d=\"M331.7,266.1l-90.1-158.6l-13.7-24.1l-13.7,24.1l-90,158.6c-4.2,7.5-4.2,16.6,0,24.1s12.1,12.1,20.5,12.1\n\t\th166.4c8.5,0,16.3-4.6,20.5-12S335.9,273.6,331.7,266.1L331.7,266.1z M144.7,278.2l83.2-146.5l83.2,146.5H144.7L144.7,278.2z\"/>\n\t<path class=\"st12\" d=\"M396,290.2c-4.2,7.5-12.1,12.1-20.5,12.1h-64.4c13.1,0,23.7-10.8,23.7-24.1h40.7L260.1,75l-18.5,32.6\n\t\tl-13.7-24.1L239.6,63c4.2-7.5,12.1-12.1,20.5-12.1c8.5,0,16.3,4.6,20.5,12.1L396,266.1C400.3,273.6,400.3,282.8,396,290.2z\"/>\n</g>\n</svg>\n\n</template>\n\n<script>\n    export default {\n        \n    }\n</script>\n\n<style scoped>\n\t.st10{fill:#00C58E;}\n\t.st11{fill:#2F495E;}\n\t.st12{fill:#108775;}\n</style>"
  },
  {
    "path": "packages/demo/components/Logo/index.vue",
    "content": "<template>\n  <div class=\"LogoWrapper\">\n    <FirebaseLogo class=\"FirebaseLogo\" />\n    <NuxtLogo class=\"NuxtLogo\" />\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\nimport FirebaseLogo from './FirebaseLogo.vue'\nimport NuxtLogo from './NuxtLogo.vue'\n\nexport default Vue.extend({\n  components: {\n    FirebaseLogo,\n    NuxtLogo\n  }\n})\n</script>\n\n<style>\n.LogoWrapper {\n  display: inline-block;\n  position: relative;\n  overflow: hidden;\n  width: 245px;\n}\n\n.FirebaseLogo {\n  position: absolute;\n  top: -50px;\n  right: -80px;\n  animation: goleft 0.5s linear forwards 2s;\n}\n\n@keyframes goleft {\n  100% {\n    right: 10px;\n    top: 20px;\n  }\n}\n</style>\n"
  },
  {
    "path": "packages/demo/components/ServiceTitle.vue",
    "content": "<template>\n  <h3 class=\"text-3xl mb-5\">\n    {{ title }}\n  </h3>\n</template>\n\n<script>\nexport default {\n  props: {\n    title: {\n      type: String,\n      required: true,\n    },\n  },\n}\n</script>\n"
  },
  {
    "path": "packages/demo/components/SubTitle.vue",
    "content": "<template>\n  <h3 class=\"text-2xl mb-5\">\n    {{ title }}\n  </h3>\n</template>\n\n<script>\nexport default {\n  props: {\n    title: {\n      type: String,\n      required: true,\n    },\n  },\n}\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Analytics.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Analytics\" />\n    <div class=\"links\">\n      <Btn @click=\"logEvent()\">Log Event</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync logEvent() {\n  try {\n    await this.$fire.analytics.logEvent('analytics_button_clicked')\n  } catch (e) {\n    alert(e)\n  }\n}\n    </pre\n          >\n        </Codeblock>\n      </client-only>\n      <p class=\"mt-1\">This will log an event in Firebase Analytics.</p>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    async logEvent() {\n      try {\n        await this.$fire.analytics.logEvent('analytics_button_clicked')\n        alert(\"Event 'analytics_button_clicked' logged to Google Analytics\")\n      } catch (e) {\n        alert(e)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/AppCheck.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase AppCheck\" />\n    <div class=\"links\">\n      <Btn @click=\"appCheck()\">Activate AppCheck</Btn>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    appCheck() {\n      if (process.client) {\n        this.$fire.appCheck.activate('RECAPTCHA V3 SITE KEY')\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Auth.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Authentication\" />\n    <SubTitle title=\"SignUp / LogIn\" />\n    <form v-if=\"!isLoggedIn\" onsubmit=\"return false;\">\n      <div class=\"mb-4\">\n        <label class=\"block text-gray-700 text-sm font-bold mb-2\" for=\"email\">\n          Email\n        </label>\n        <input\n          v-model=\"formData.email\"\n          class=\"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline\"\n          placeholder=\"Email\"\n          type=\"email\"\n          autocomplete=\"username\"\n        />\n      </div>\n      <div class=\"mb-4\">\n        <label class=\"block text-gray-700 text-sm font-bold mb-2\" for=\"email\">\n          Password\n        </label>\n        <input\n          v-model=\"formData.password\"\n          class=\"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline\"\n          placeholder=\"Password\"\n          type=\"password\"\n          autocomplete=\"current-password\"\n        />\n      </div>\n      <Btn @click=\"createUser\">Register</Btn>\n      <Btn @click=\"signInUser\">Sign In</Btn>\n    </form>\n    <div v-else>\n      <p>You are logged in with {{ authUser.email }}.</p>\n      <Btn color=\"primary\" outlined @click=\"logout\">Logout</Btn>\n    </div>\n    <client-only>\n      <Codeblock>\n        <pre>\nasync createUser() {\n  try { \n    await this.$fire.auth.createUserWithEmailAndPassword('foo@foo.foo', 'test')\n  } catch (e) { \n    alert(e) \n  }\n}\n        </pre>\n      </Codeblock>\n    </client-only>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\nimport { mapState, mapGetters } from 'vuex'\n\nexport default Vue.extend({\n  computed: {\n    ...mapState({\n      authUser: (state: any) => state.authUser,\n    }),\n    ...mapGetters({\n      isLoggedIn: 'isLoggedIn',\n    }),\n  },\n  // fetch() {\n  //   // INFO -> this.$fire.auth user etc. are accessible\n  //   // INFO -> this.$store.state.authUser is accessible even on server-side\n  // },\n  data: () => ({\n    formData: {\n      email: '',\n      password: '',\n    },\n  }),\n  methods: {\n    async createUser() {\n      try {\n        await this.$fire.auth.createUserWithEmailAndPassword(\n          this.formData.email,\n          this.formData.password\n        )\n      } catch (e) {\n        alert(e)\n      }\n    },\n    async signInUser() {\n      try {\n        await this.$fire.auth.signInWithEmailAndPassword(\n          this.formData.email,\n          this.formData.password\n        )\n      } catch (e) {\n        alert(e)\n      }\n    },\n    async logout() {\n      try {\n        await this.$fire.auth.signOut()\n      } catch (e) {\n        alert(e)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Firestore.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Firestore\" />\n    <div class=\"links\">\n      <Btn @click=\"writeToFirestore()\">Write to Firestore</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync writeToFirestore() {\n  const messageRef = this.$fire.firestore.collection('message').doc('message')\n  try {\n    await messageRef.set({\n      message: 'Nuxt-Fire with Firestore rocks!'\n    })\n  } catch (e) {\n  alert(e)\n  return\n  }\n  alert('Success.')\n}\n      </pre\n          >\n        </Codeblock>\n      </client-only>\n      <Btn @click=\"readFromFirestore()\">Read from Firestore</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync readFromFirestore() {\n  const messageRef = this.$fire.firestore.collection('message').doc('message')\n  try {\n    const messageDoc = await messageRef.get()\n    alert(messageDoc.data().message)\n  } catch (e) {\n  alert(e)\n  return\n  }\n}</pre\n          >\n        </Codeblock>\n      </client-only>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    async writeToFirestore() {\n      const messageRef = this.$fire.firestore\n        .collection('message')\n        .doc('message')\n      try {\n        await messageRef.set({\n          message: 'Nuxt-Fire with Firestore rocks!',\n        })\n      } catch (e) {\n        alert(e)\n        return\n      }\n      alert('Success.')\n    },\n    async readFromFirestore() {\n      const messageRef = this.$fire.firestore\n        .collection('message')\n        .doc('message')\n      try {\n        const snapshot = await messageRef.get()\n        const doc = snapshot.data()\n        if (!doc) {\n          alert('Document does not exist.')\n          return\n        }\n        alert(doc.message)\n      } catch (e) {\n        alert(e)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Functions.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Functions\" />\n    <div class=\"links\">\n      <Btn :loading=\"loading\" @click=\"callTestFunction()\"\n        >Call Test Function</Btn\n      >\n      <p class=\"mt-1\">Might take some seconds.</p>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync callTestFunction() {\n  try {\n    const res = await this.$fire.functions.httpsCallable('testFunction')()\n    alert(res.data)\n  } catch (e) {\n    alert(e)\n    return\n  }\n}</pre\n          >\n        </Codeblock>\n      </client-only>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  data: () => ({\n    loading: false,\n  }),\n  methods: {\n    async callTestFunction() {\n      this.loading = true\n      try {\n        const res = await this.$fire.functions.httpsCallable('testFunction')()\n        alert(res.data.message)\n      } catch (e) {\n        alert(e)\n      } finally {\n        this.loading = false\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Messaging.vue",
    "content": "<template>\n  <div>\n    <div>\n      <ServiceTitle title=\"Firebase Messaging\" />\n\n      <Btn :disabled=\"listenersStarted\" @click=\"startListeners\"\n        >Start Listeners</Btn\n      >\n      <Btn\n        :disabled=\"permissionGranted || !listenersStarted\"\n        class=\"mb-1\"\n        @click=\"requestPermission\"\n      >\n        Request Permission\n      </Btn>\n      <Btn\n        :disabled=\"!listenersStarted || !permissionGranted || idToken !== ''\"\n        :loading=\"loading\"\n        class=\"mb-1\"\n        @click=\"getIdToken\"\n      >\n        Get ID Token\n      </Btn>\n      <Btn :disabled=\"idToken === ''\" class=\"mb-1\" @click=\"sendTestMessage\">\n        Send Test Push Message\n      </Btn>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  data() {\n    return {\n      listenersStarted: false,\n      permissionGranted: false,\n      idToken: '',\n      loading: false,\n    }\n  },\n  methods: {\n    async requestPermission() {\n      try {\n        const permission = await Notification.requestPermission()\n        this.permissionGranted = permission === 'granted'\n      } catch (e) {\n        console.error(e)\n      }\n    },\n    async getIdToken() {\n      this.loading = true\n      let currentToken\n      try {\n        currentToken = await this.$fire.messaging.getToken()\n      } catch (e) {\n        console.error('An error occurred while retrieving token. ', e)\n        this.idToken = ''\n        this.loading = false\n      }\n\n      if (currentToken) {\n        this.idToken = currentToken\n      } else {\n        // Show permission request.\n        console.info(\n          'No Instance ID token available. Request permission to generate one.'\n        )\n        // Show permission UI.\n        // updateUIForPushPermissionRequired();\n        this.idToken = ''\n      }\n      alert(`The id token is: ${this.idToken}`)\n      this.loading = false\n    },\n    startListeners() {\n      this.startOnMessageListener()\n\n      this.listenersStarted = true\n    },\n    startOnMessageListener() {\n      this.$fire.messaging.onMessage((payload: any) => {\n        console.info('Message received. ', payload)\n      })\n    },\n\n    sendTestMessage() {\n      try {\n        setTimeout(() => {\n          // wait 5 seconds so you have time to switch away from the page to test the service-worker\n          this.$fire.functions.httpsCallable('sendTestPushMessage')({\n            token: this.idToken,\n          })\n        }, 5000)\n      } catch (e) {\n        alert(e)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Performance.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Performance\" />\n    <div class=\"links\">\n      <Btn @click=\"checkPerformance()\">{{\n        traceStarted ? 'In Progress' : 'Start Trace'\n      }}</Btn>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  data() {\n    return {\n      traceStarted: false,\n    }\n  },\n  methods: {\n    checkPerformance() {\n      const trace = this.$fire.performance.trace('testTrace')\n      trace.start()\n      this.traceStarted = true\n      console.info('Firebase Performance Trace Start')\n      const ctx = this\n      setTimeout(function () {\n        for (let step = 0; step < 100; step++) {\n          // Runs x times\n        }\n        trace.stop()\n        console.info('Firebase Performance Trace Stop')\n        ctx.traceStarted = false\n      }, 2000)\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/RealTimeDatabase.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Realtime Database\" />\n    <div class=\"links\">\n      <Btn @click=\"writeToRealtimeDb()\">Write to Realtime DB</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync writeToRealtimeDb() {\n  const messageRef = this.$fire.database.ref('message')\n  try {\n    await messageRef.set({\n      message: 'Nuxt-Fire with Firebase Realtime Database rocks!'\n    })\n  } catch (e) {\n    alert(e)\n    return\n  }\n  alert('Success.')\n}</pre\n          >\n        </Codeblock>\n      </client-only>\n      <Btn @click=\"readFromRealtimeDb()\">Read from Realtime DB</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync readFromRealtimeDb() {\n  const messageRef = this.$fire.database.ref('message')\n  try {\n    const snapshot = await messageRef.once('value')\n    alert(snapshot.val().message)\n  } catch (e) {\n    alert(e)\n    return\n  }\n}</pre\n          >\n        </Codeblock>\n      </client-only>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    async writeToRealtimeDb() {\n      const messageRef = this.$fire.database.ref('message')\n      try {\n        await messageRef.set({\n          message: 'Nuxt-Fire with Firebase Realtime Database rocks!',\n        })\n      } catch (e) {\n        alert(e)\n        return\n      }\n      alert('Success.')\n    },\n    async readFromRealtimeDb() {\n      const messageRef = this.$fire.database.ref('message')\n      try {\n        const snapshot = await messageRef.once('value')\n        alert(snapshot.val().message)\n      } catch (e) {\n        alert(e)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/RemoteConfig.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase RemoteConfig\" />\n    <div class=\"links\">\n      <Btn @click=\"readRemoteConfig()\">Reads Remote Config</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync readRemoteConfig() {\n  try {\n    await this.$fire.remoteConfig.fetchAndActivate();\n  } catch (e) {\n  alert(e);\n  return;\n  }\n  const exampleMessage = await this.$fire.remoteConfig.getValue(\"exampleMessage\");\n  alert(\n  `Success. Read RemoteConfig parameter 'exampleMessage' is: ${exampleMessage._value}`\n  );\n}\n</pre\n          >\n        </Codeblock>\n      </client-only>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    async readRemoteConfig() {\n      try {\n        await this.$fire.remoteConfig.fetchAndActivate()\n      } catch (e) {\n        alert(e)\n        return\n      }\n      console.info(this.$fire.remoteConfig)\n      const exampleMessage: any = await this.$fire.remoteConfig.getValue(\n        'exampleMessage'\n      )\n      alert(\n        `Success. Read RemoteConfig parameter 'exampleMessage' is: ${exampleMessage._value}`\n      )\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/Storage.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Firebase Storage\" />\n    <div class=\"links\">\n      <Btn @click=\"uploadFile()\">Upload File</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync uploadFile() {\n  const storageRef = this.$fire.storage.ref().child('message.txt')\n  const message = 'Nuxt-Fire with Firebase Storage rocks!'\n  try {\n    const snapshot = await storageRef.putString(message)\n    alert('File uploaded.')\n  } catch (e) {\n    alert(e.message)\n  }\n}\n      </pre\n          >\n        </Codeblock>\n      </client-only>\n      <Btn @click=\"getFileUrl()\">Get File URL</Btn>\n      <client-only>\n        <Codeblock>\n          <pre>\nasync getFileUrl() {\n  const storageRef = this.$fire.storage.ref().child('message.txt')\n  try {\n    const url = await storageRef.getDownloadURL()\n    alert(`The file can be found here: ${url}`)\n  } catch (e) {\n    alert(e.message)\n  }\n}\n      </pre\n          >\n        </Codeblock>\n      </client-only>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  methods: {\n    async uploadFile() {\n      const storageRef = this.$fire.storage.ref().child('message.txt')\n      const message = 'Nuxt-Fire with Firebase Storage rocks!'\n      try {\n        const snapshot = await storageRef.putString(message)\n        alert('File uploaded.')\n      } catch (e: any) {\n        alert(e.message)\n      }\n    },\n    async getFileUrl() {\n      const storageRef = this.$fire.storage.ref().child('message.txt')\n      try {\n        const url = await storageRef.getDownloadURL()\n        alert(`The file can be found here: ${url}`)\n      } catch (e: any) {\n        alert(e.message)\n      }\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/components/examples/VuexStore.vue",
    "content": "<template>\n  <div>\n    <ServiceTitle title=\"Vuex Store\" />\n    <p class=\"mb-2\">\n      Tests if fireXXX objects can be accessed in a vuex store action.\n    </p>\n    <div class=\"links\">\n      <Btn @click=\"checkVuexStore()\">Test Vuex Store</Btn>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\n\nexport default Vue.extend({\n  data() {\n    return {\n      traceStarted: false,\n    }\n  },\n  methods: {\n    checkVuexStore() {\n      this.$store.dispatch('checkVuexStore')\n    },\n  },\n})\n</script>\n"
  },
  {
    "path": "packages/demo/firebase.json",
    "content": "{\n  \"hosting\": {\n    \"public\": \"dist\",\n    \"ignore\": [\n      \"firebase.json\",\n      \"**/.*\",\n      \"**/node_modules/**\"\n    ],\n    \"rewrites\": [\n      {\n        \"source\": \"**\",\n        \"destination\": \"/index.html\"\n      }\n    ]\n  },\n  \"emulators\": {\n    \"functions\": {\n      \"port\": 12345\n    },\n    \"firestore\": {\n      \"port\": 8080\n    },\n    \"database\": {\n      \"port\": 9000\n    },\n    \"hosting\": {\n      \"port\": 5000\n    },\n    \"auth\": {\n      \"port\": 9099\n    },\n    \"storage\": {\n      \"port\": 9199\n    },\n    \"ui\": {\n      \"enabled\": true\n    }\n  },\n  \"storage\": {\n    \"rules\": \"storage.rules\"\n  }\n}\n"
  },
  {
    "path": "packages/demo/functions/.gitignore",
    "content": "node_modules/"
  },
  {
    "path": "packages/demo/functions/index.js",
    "content": "const functions = require('firebase-functions')\nconst admin = require('firebase-admin')\nadmin.initializeApp()\nconst messaging = admin.messaging()\n\nexports.testFunction = functions.https.onCall(() => {\n  console.info('Test Function triggered')\n  return { message: \"Yeaaahh it's working!\" }\n})\n\nexports.sendTestPushMessage = functions.https.onCall(async (data) => {\n  // As defined in https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages\n  const image =\n    'https://avatars2.githubusercontent.com/u/4020037?s=460&u=c5f9c131d565202d8e530295b130239edd25768d&v=4'\n  const message = {\n    name: 'testPushMessage',\n    data: {},\n    notification: {\n      title: `Test Push Message`,\n      body: 'If you get this, it worked.',\n      image,\n    },\n    android: {},\n    webpush: {\n      notification: {\n        // Adds the image to the push notificationm\n        icon: image,\n        // Adds actions to the push notification\n        actions: [\n          {\n            action: 'goToLupasGithub',\n            title: 'Github: lupas',\n            icon: '',\n          },\n          {\n            action: 'goToModuleGithub',\n            title: 'Firebase Module',\n            icon: '',\n          },\n        ],\n      },\n      fcm_options: {\n        // Adds a link to be opened when clicked on the push notification\n        link: 'https://nuxt-fire-demo.herokuapp.com/',\n      },\n    },\n    apns: {\n      fcm_options: {},\n    },\n    fcm_options: {},\n    token: data.token,\n  }\n  try {\n    await messaging.send(message)\n  } catch (e) {\n    console.error(`Did not work to send a message to token ${message.token}`)\n    console.error(e)\n  }\n})\n"
  },
  {
    "path": "packages/demo/functions/package.json",
    "content": "{\n  \"name\": \"functions\",\n  \"description\": \"Cloud Functions for Firebase\",\n  \"scripts\": {\n    \"serve\": \"firebase serve --only functions\",\n    \"shell\": \"firebase functions:shell\",\n    \"start\": \"npm run shell\",\n    \"deploy\": \"firebase deploy --only functions\",\n    \"logs\": \"firebase functions:log\",\n    \"emulate\": \"firebase emulators:start --only functions\"\n  },\n  \"engines\": {\n    \"node\": \"12\"\n  },\n  \"dependencies\": {\n    \"firebase-admin\": \"^10.0.1\",\n    \"firebase-functions\": \"^3.11.0\"\n  },\n  \"devDependencies\": {\n    \"firebase-functions-test\": \"^0.3.3\"\n  },\n  \"private\": true\n}\n"
  },
  {
    "path": "packages/demo/layouts/default.vue",
    "content": "<template>\n  <div class=\"container py-8\">\n    <main class=\"max-w-full\">\n      <Nuxt />\n    </main>\n  </div>\n</template>\n\n<style></style>\n"
  },
  {
    "path": "packages/demo/middleware/testMiddleware.ts",
    "content": "import { Middleware } from '@nuxt/types'\n\nconst testMiddleware: Middleware = ({ app, store }) => {\n  if (app.$fire.auth) {\n    // If user is logged in, store.state.authUser will be filled.\n    // INFO -> Firebase Services can be accessed with app.$fire.auth (etc.) in Middleware.\n  }\n}\n\nexport default testMiddleware\n"
  },
  {
    "path": "packages/demo/nuxt.config.ts",
    "content": "import { NuxtConfig } from '@nuxt/types'\n\nconst isDev = process.env.NODE_ENV === 'development'\nconst useEmulators = false // manually change if emulators needed\n\nconst config: NuxtConfig = {\n  head: {\n    title: 'nuxt-firebase-demo',\n    meta: [\n      { charset: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { hid: 'description', name: 'description', content: '' },\n    ],\n    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],\n  },\n\n  components: true,\n\n  buildModules: [\n    '@nuxt/typescript-build',\n    '@nuxtjs/tailwindcss',\n    '@nuxtjs/firebase',\n  ],\n\n  firebase: {\n    lazy: false,\n    config: {\n      apiKey: 'AIzaSyDa-YwgWTp2GDyVYEfv-XLb62100_HoEvU',\n      authDomain: 'nuxt-fire-demo.firebaseapp.com',\n      projectId: 'nuxt-fire-demo',\n      storageBucket: 'nuxt-fire-demo.appspot.com',\n      messagingSenderId: '807370470428',\n      appId: '1:807370470428:web:26da98c86c3fd352',\n      measurementId: 'G-XT6PVC1D4X',\n    },\n    onFirebaseHosting: false,\n    terminateDatabasesAfterGenerate: true,\n    services: {\n      auth: {\n        initialize: {\n          onAuthStateChangedAction: 'onAuthStateChanged',\n        },\n        ssr: true,\n        emulatorPort: isDev && useEmulators ? 9099 : undefined,\n        disableEmulatorWarnings: false,\n      },\n      firestore: {\n        memoryOnly: false,\n        enablePersistence: true,\n        emulatorPort: isDev && useEmulators ? 8080 : undefined,\n      },\n      functions: {\n        emulatorPort: isDev && useEmulators ? 12345 : undefined,\n      },\n      storage: {\n        emulatorPort: isDev && useEmulators ? 9199 : undefined,\n        emulatorHost: 'localhost',\n      },\n      database: {\n        emulatorPort: isDev && useEmulators ? 9000 : undefined,\n      },\n      performance: true,\n      analytics: true,\n      remoteConfig: {\n        settings: {\n          fetchTimeoutMillis: 60000,\n          minimumFetchIntervalMillis: 43200000,\n        },\n        defaultConfig: {\n          welcome_message: 'Welcome',\n        },\n      },\n      // breaks the app with 'app.$fire.firestore.collection is not a function':\n      appCheck: true,\n      messaging: {\n        createServiceWorker: true,\n        actions: [\n          {\n            action: 'goToLupasGithub',\n            url: 'https://github.com/lupas',\n          },\n          {\n            action: 'goToModuleGithub',\n            url: 'https://github.com/nuxt-community/firebase-module',\n          },\n        ],\n        fcmPublicVapidKey:\n          'BL_xoiuOe5vbb2vJkCNnuswn03NwCsyCkJUgRbuQA5tpg7J4E4z50MO8b-wrrad6fcysYAaFjHqU7D9o0oCWL8w',\n      },\n    },\n  },\n\n  modules: ['@nuxtjs/pwa'],\n  // plugins: ['~/plugins/lazyMode'],\n\n  build: {},\n\n  /*\n   ** Nuxt.js Middleware\n   */\n  router: {\n    middleware: ['testMiddleware'],\n  },\n\n  pwa: {\n    workbox: {\n      importScripts: ['/firebase-auth-sw.js'],\n      // by default the workbox module will not install the service worker in dev environment to avoid conflicts with HMR\n      // only set this true for testing and remember to always clear your browser cache in development\n      dev: process.env.NODE_ENV === 'development',\n    },\n  },\n}\nexport default config\n"
  },
  {
    "path": "packages/demo/package.json",
    "content": "{\n  \"name\": \"nuxt-firebase-demo\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"nuxt\",\n    \"build\": \"nuxt build\",\n    \"start\": \"nuxt start\",\n    \"generate\": \"nuxt generate\",\n    \"lint:js\": \"eslint --ext .js,.vue --ignore-path .gitignore .\",\n    \"lint\": \"npm run lint:js\",\n    \"emulators\": \"firebase emulators:start\"\n  },\n  \"dependencies\": {\n    \"@nuxtjs/pwa\": \"^3.3.3\",\n    \"core-js\": \"^3.19.2\",\n    \"firebase\": \"^9.6.2\",\n    \"firebase-admin\": \"^10.0.1\",\n    \"nuxt\": \"^2.15.8\",\n    \"prismjs\": \"^1.25.0\",\n    \"vue-prism-component\": \"^2.0.0\",\n    \"@nuxtjs/firebase\": \"^8.2.0\"\n  },\n  \"devDependencies\": {\n    \"@nuxt/types\": \"^2.15.8\",\n    \"@nuxt/typescript-build\": \"^2.1.0\",\n    \"@nuxtjs/eslint-config\": \"^8.0.0\",\n    \"@nuxtjs/eslint-config-typescript\": \"^8.0.0\",\n    \"@nuxtjs/eslint-module\": \"^3.0.2\",\n    \"@nuxtjs/tailwindcss\": \"^4.2.1\",\n    \"babel-eslint\": \"^10.1.0\",\n    \"eslint\": \"^8.1.0\",\n    \"eslint-config-prettier\": \"^8.3.0\",\n    \"eslint-plugin-nuxt\": \"^3.1.0\",\n    \"eslint-plugin-prettier\": \"^4.0.0\",\n    \"prettier\": \"^2.8.4\"\n  }\n}\n"
  },
  {
    "path": "packages/demo/pages/index.vue",
    "content": "<template>\n  <div class=\"max-w-full\">\n    <Logo />\n    <h1 class=\"text-5xl text-opacity-75 text-gray-900 font-bold\">\n      @nuxtjs/firebase\n    </h1>\n    <h2 class=\"text-3xl uppercase text-opacity-75 text-gray-900 font-semibold\">\n      demo\n    </h2>\n    <p>\n      by\n      <a href=\"https://twitter.com/pascalluther\" target=\"_blank\"\n        >Pascal Luther</a\n      >\n      / <a href=\"https://github.com/lupas\" target=\"_blank\">@lupas</a>\n    </p>\n    <div v-for=\"component in exampleComponents\" :key=\"component.__file\">\n      <hr class=\"mt-5 mb-5\" />\n      <component :is=\"component\"></component>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue'\nimport Logo from '~/components/Logo/index.vue'\nimport Auth from '~/components/examples/Auth.vue'\nimport Firestore from '~/components/examples/Firestore.vue'\nimport Functions from '~/components/examples/Functions.vue'\nimport RealTimeDatabase from '~/components/examples/RealTimeDatabase.vue'\nimport Storage from '~/components/examples/Storage.vue'\nimport Performance from '~/components/examples/Performance.vue'\nimport VuexStore from '~/components/examples/VuexStore.vue'\nimport Analytics from '~/components/examples/Analytics.vue'\nimport RemoteConfig from '~/components/examples/RemoteConfig.vue'\nimport Messaging from '~/components/examples/Messaging.vue'\nimport AppCheck from '~/components/examples/AppCheck.vue'\n\nexport default Vue.extend({\n  components: {\n    Logo,\n    Auth,\n    Firestore,\n    Functions,\n    RealTimeDatabase,\n    Storage,\n    Performance,\n    VuexStore,\n    Analytics,\n    RemoteConfig,\n    Messaging,\n    AppCheck,\n  },\n  async asyncData({ app }) {\n    // INFO -> app.$fire.firestore etc. are accessible\n    const messageRef = app.$fire.firestore.collection('message').doc('message')\n    try {\n      const snapshot = await messageRef.get()\n      const doc = snapshot.data()\n      if (!doc) {\n        // console.info('Document does not exist.')\n        return\n      }\n      // console.info(doc.message)\n    } catch (e) {\n      console.error(e)\n    }\n  },\n  data: () => ({\n    exampleComponents: [\n      Auth,\n      Firestore,\n      Functions,\n      RealTimeDatabase,\n      Storage,\n      Performance,\n      Analytics,\n      RemoteConfig,\n      Messaging,\n      VuexStore,\n      AppCheck,\n    ],\n  }),\n})\n</script>\n\n<style>\n.container {\n  margin: 0 auto;\n  min-height: 100vh;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n}\n</style>\n"
  },
  {
    "path": "packages/demo/plugins/lazyMode.js",
    "content": "export default async (context) => {\n  await context.$fire.databaseReady()\n  await context.$fire.firestoreReady()\n  await context.$fire.storageReady()\n  await context.$fire.functionsReady()\n  if (process.client) {\n    await context.$fire.authReady()\n    await context.$fireAuthStore.subscribe()\n    await context.$fire.messagingReady()\n    await context.$fire.performanceReady()\n    await context.$fire.analyticsReady()\n    await context.$fire.remoteConfigReady()\n  }\n}\n"
  },
  {
    "path": "packages/demo/storage.rules",
    "content": "rules_version = '2';\nservice firebase.storage {\n  match /b/{bucket}/o {\n    match /{allPaths=**} {\n      allow read, write: if true;\n    }\n  }\n}\n"
  },
  {
    "path": "packages/demo/store/actions.js",
    "content": "export default {\n  async nuxtServerInit({ dispatch }, ctx) {\n    // INFO -> Nuxt-fire Objects can be accessed in nuxtServerInit action via this.$fire___, ctx.$fire___ and ctx.app.$fire___'\n\n    /** Get the VERIFIED authUser on the server */\n    if (ctx.res && ctx.res.locals && ctx.res.locals.user) {\n      const { allClaims: claims, ...authUser } = ctx.res.locals.user\n\n      console.info(\n        'Auth User verified on server-side. User: ',\n        authUser,\n        'Claims:',\n        claims\n      )\n\n      await dispatch('onAuthStateChanged', {\n        authUser,\n        claims,\n      })\n    }\n  },\n\n  async onAuthStateChanged({ commit }, { authUser }) {\n    if (!authUser) {\n      commit('RESET_STORE')\n      return\n    }\n    if (authUser && authUser.getIdToken) {\n      try {\n        const idToken = await authUser.getIdToken(true)\n        console.info('idToken', idToken)\n      } catch (e) {\n        console.error(e)\n      }\n    }\n    commit('SET_AUTH_USER', { authUser })\n  },\n\n  checkVuexStore(ctx) {\n    if (this.$fire.auth === null) {\n      throw 'Vuex Store example not working - this.$fire.auth cannot be accessed.'\n    }\n\n    alert(\n      'Success. Nuxt-fire Objects can be accessed in store actions via this.$fire___'\n    )\n  },\n}\n"
  },
  {
    "path": "packages/demo/store/getters.js",
    "content": "export default {\n  isLoggedIn: (state) => {\n    try {\n      return state.authUser.uid !== null\n    } catch {\n      return false\n    }\n  }\n}\n"
  },
  {
    "path": "packages/demo/store/mutations.js",
    "content": "import initialState from './state'\n\nexport default {\n  RESET_STORE: (state) => {\n    Object.assign(state, initialState())\n  },\n\n  SET_AUTH_USER: (state, { authUser }) => {\n    state.authUser = {\n      uid: authUser.uid,\n      email: authUser.email\n    }\n  }\n}\n"
  },
  {
    "path": "packages/demo/store/state.js",
    "content": "export default () => ({\n  authUser: null\n})\n"
  },
  {
    "path": "packages/demo/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2018\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Node\",\n    \"lib\": [\n      \"ESNext\",\n      \"ESNext.AsyncIterable\",\n      \"DOM\"\n    ],\n    \"esModuleInterop\": true,\n    \"allowJs\": true,\n    \"sourceMap\": true,\n    \"strict\": true,\n    \"noEmit\": true,\n    \"experimentalDecorators\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\n        \"./*\"\n      ],\n      \"@/*\": [\n        \"./*\"\n      ]\n    },\n    \"types\": [\n      \"@types/node\",\n      \"@nuxt/types\",\n      \"@nuxtjs/firebase\"\n    ]\n  },\n  \"exclude\": [\n    \"node_modules\",\n    \".nuxt\",\n    \"dist\"\n  ]\n}\n"
  },
  {
    "path": "packages/demo/vue-shim.d.ts",
    "content": "declare module '*.vue' {\n  import Vue from 'vue'\n  export default Vue\n}\n"
  },
  {
    "path": "packages/docs/README.md",
    "content": "# @nuxtjs/firebase-docs\n\n## Setup\n\nInstall dependencies:\n\n```bash\nnpm i\n```\n\n## Development\n\n```bash\nnpm run dev\n```\n\n## Static Generation\n\nThis will create the `.vitepress/dist` directory for publishing to static hosting:\n\n```bash\nnpm run build\n```\n"
  },
  {
    "path": "packages/docs/docs/.vitepress/config.ts",
    "content": "import {defineConfig, DefaultTheme} from 'vitepress'\nimport {version} from '../../package.json'\nimport {\n  twitter,\n  github,\n  headTitle,\n  headDescription,\n  ogImage,\n  ogUrl,\n} from './meta'\nimport sidebar from './navigation/sidebar'\n\nexport default defineConfig({\n  lang: 'en-US',\n  title: headTitle,\n  description: headDescription,\n  appearance: 'dark',\n  head: [\n    ['meta', {name: 'theme-color', content: '#ffe183'}],\n    ['link', {rel: 'icon', href: '/icon.png', type: 'image/png'}],\n    [\n      'link',\n      {\n        rel: 'alternate icon',\n        href: '/favicon.ico',\n        type: 'image/png',\n        sizes: '16x16',\n      },\n    ],\n    [\n      'meta',\n      {\n        name: 'author',\n        content: `Pascal Luther`,\n      },\n    ],\n    [\n      'meta',\n      {\n        name: 'keywords',\n        content: 'nuxt, nuxtjs, firebase',\n      },\n    ],\n    ['meta', {property: 'og:title', content: headTitle}],\n    ['meta', {property: 'og:description', content: headDescription}],\n    ['meta', {property: 'og:url', content: ogUrl}],\n    ['meta', {property: 'og:image', content: ogImage}],\n    ['meta', {name: 'twitter:title', content: headTitle}],\n    ['meta', {name: 'twitter:description', content: headDescription}],\n    ['link', {rel: 'mask-icon', href: '/icon.png', color: '#ffffff'}],\n    [\n      'link',\n      {\n        rel: 'apple-touch-icon',\n        href: '/apple-touch-icon.png',\n        sizes: '180x180',\n      },\n    ],\n  ],\n\n  themeConfig: {\n    logo: '/icon.png',\n\n    outline: [2, 3],\n\n    socialLinks: [\n      {icon: 'twitter', link: twitter},\n      {icon: 'github', link: github},\n    ],\n\n    footer: {\n      copyright: 'Copyright © 2019-PRESENT Pascal Luther',\n    },\n\n    algolia: {\n      appId: '9F70EYJ2LK',\n      apiKey: 'cf7ef157f34e96340604d0d75a6fbc1c', // Public Read-Only API Key\n      indexName: 'nuxtjs_firebase',\n    },\n\n    carbonAds: {\n      code: 'CE7D62JL',\n      placement: 'firebasenuxtjsorg',\n    },\n\n    nav: [\n      {text: 'Guide', link: '/guide/'},\n      {\n        text: `v${version}`,\n        items: [\n          {\n            text: 'Release Notes',\n            link: 'https://github.com/nuxt-community/firebase-module/releases',\n          },\n        ],\n      },\n    ],\n\n    sidebar: sidebar,\n  },\n})\n"
  },
  {
    "path": "packages/docs/docs/.vitepress/meta.ts",
    "content": "// noinspection ES6PreferShortImport: IntelliJ IDE hint to avoid warning to use `~/contributors`, will fail on build if changed\n\n/* Texts */\nexport const headTitle = \"Nuxt Firebase\";\nexport const headSubtitle = \"Nuxt Firebase\";\nexport const headDescription = \"XXX\";\n\n/* CDN fonts and styles */\nexport const googleapis = \"https://fonts.googleapis.com\";\nexport const gstatic = \"https://fonts.gstatic.com\";\nexport const font = `${googleapis}/css2?family=Readex+Pro:wght@200;400;600&display=swap`;\n\n/* vitepress head */\nexport const ogUrl = \"https://firebase.nuxtjs.org\";\nexport const ogImage = `${ogUrl}og.png`;\n\n/* GitHub and social links */\nexport const github = \"https://github.com/nuxt-community/firebase-module\";\nexport const releases = \"https://github.com/vuejs/vuefire/releases\";\n\nexport const twitter = \"https://twitter.com/nuxt_js\";\n\n/* Avatar/Image/Sponsors servers */\nexport const preconnectLinks = [googleapis, gstatic];\nexport const preconnectHomeLinks = [googleapis, gstatic];\n\n/* PWA runtime caching urlPattern regular expressions */\nexport const pwaFontsRegex = new RegExp(`^${googleapis}/.*`, \"i\");\nexport const pwaFontStylesRegex = new RegExp(`^${gstatic}/.*`, \"i\");\n// eslint-disable-next-line prefer-regex-literals\nexport const githubusercontentRegex = new RegExp(\n  \"^https://((i.ibb.co)|((raw|user-images).githubusercontent.com))/.*\",\n  \"i\"\n);\n"
  },
  {
    "path": "packages/docs/docs/.vitepress/navigation/sidebar.ts",
    "content": "import {DefaultTheme} from 'vitepress'\n\nconst sidebar: DefaultTheme.Sidebar = {\n  '/': [\n    {\n      text: 'Guide',\n      items: [\n        {\n          text: 'Introduction',\n          link: '/guide/',\n        },\n        {\n          text: 'Getting Started',\n          link: '/guide/getting-started',\n        },\n        {\n          text: 'Options',\n          link: '/guide/options',\n        },\n        {\n          text: 'Usage',\n          link: '/guide/usage',\n        },\n      ],\n    },\n    {\n      text: 'Service Options',\n      items: [\n        {\n          text: '(All Services)',\n          link: '/service-options/all-services',\n        },\n        {\n          text: 'appCheck',\n          link: '/service-options/app-check',\n        },\n        {\n          text: 'auth',\n          link: '/service-options/auth',\n        },\n        {\n          text: 'firestore',\n          link: '/service-options/firestore',\n        },\n        {\n          text: 'database',\n          link: '/service-options/database',\n        },\n        {\n          text: 'storage',\n          link: '/service-options/storage',\n        },\n        {\n          text: 'functions',\n          link: '/service-options/functions',\n        },\n        {\n          text: 'performance',\n          link: '/service-options/performance',\n        },\n        {\n          text: 'analytics',\n          link: '/service-options/analytics',\n        },\n        {\n          text: 'messaging',\n          link: '/service-options/messaging',\n        },\n        {\n          text: 'remote-config',\n          link: '/service-options/remote-config',\n        },\n      ],\n    },\n    {\n      text: 'Tutorials',\n      items: [\n        {\n          text: 'Firebase Auth with SSR',\n          link: '/tutorials/ssr',\n        },\n        {\n          text: 'Usage with vuexfire',\n          link: '/tutorials/vuexfire',\n        },\n        {\n          text: 'Usage with Typescript',\n          link: '/tutorials/typescript',\n        },\n      ],\n    },\n    {\n      text: 'Community',\n      items: [\n        {\n          text: 'Demo',\n          link: '/community/demo',\n        },\n        {\n          text: 'Links',\n          link: '/community/links',\n        },\n        {\n          text: 'FAQ',\n          link: '/community/faq',\n        },\n      ],\n    },\n  ],\n}\n\nexport default sidebar\n"
  },
  {
    "path": "packages/docs/docs/.vitepress/style/vars.css",
    "content": "/**\n * Colors\n * -------------------------------------------------------------------------- */\n\n/* 50: '#fff8e1',\n 100: '#ffedb3',\n 200: '#ffe183',\n 300: '#ffd650',\n 400: '#ffcb29',\n 500: '#ffc309',\n 600: '#ffb401',\n 700: '#ffa200',\n 800: '#ff9100',\n 900: '#ff7100', */\n\n:root {\n  --vp-c-brand: #00dc82;\n  --vp-c-brand-light: #03ee8c;\n  --vp-c-accent: #f78200;\n  --c-gradient-1: #00dc82;\n  --c-gradient-2: #f78200;\n}\n\n/**\n * Component: Button\n * -------------------------------------------------------------------------- */\n\n:root {\n  --vp-button-brand-border: var(--vp-c-brand-light);\n  --vp-button-brand-text: var(--vp-c-text-dark-1);\n  --vp-button-brand-bg: var(--vp-c-brand);\n  --vp-button-brand-hover-border: var(--vp-c-brand-light);\n  --vp-button-brand-hover-text: var(--vp-c-text-dark-1);\n  --vp-button-brand-hover-bg: var(--vp-c-brand-light);\n  --vp-button-brand-active-border: var(--vp-c-brand-light);\n  --vp-button-brand-active-text: var(--vp-c-text-dark-1);\n  --vp-button-brand-active-bg: var(--vp-button-brand-bg);\n}\n\n/**\n * Component: Home\n * -------------------------------------------------------------------------- */\n\n:root {\n  --vp-home-hero-name-color: transparent;\n  --vp-home-hero-name-background: -webkit-linear-gradient(\n    120deg,\n    var(--c-gradient-1) 25%,\n    var(--c-gradient-2)\n  );\n  --vp-home-hero-image-background-image: linear-gradient(\n    -45deg,\n    var(--vp-c-brand) 30%,\n    var(--vp-c-accent)\n  );\n  --vp-home-hero-image-filter: blur(30px);\n}\n\n@media (min-width: 640px) {\n  :root {\n    --vp-home-hero-image-filter: blur(56px);\n  }\n}\n\n@media (min-width: 960px) {\n  :root {\n    --vp-home-hero-image-filter: blur(72px);\n  }\n}\n\n/**\n * Component: Algolia\n * -------------------------------------------------------------------------- */\n\n.DocSearch {\n  --docsearch-primary-color: var(--vp-c-brand) !important;\n}\n\n.dark-only {\n  display: none;\n}\n\n.dark .dark-only {\n  display: block;\n}\n\n.dark .light-only {\n  display: none;\n}\n"
  },
  {
    "path": "packages/docs/docs/.vitepress/theme/index.ts",
    "content": "import Theme from \"vitepress/theme\";\nimport \"../style/vars.css\";\nimport { h } from \"vue\";\n\nexport default {\n  ...Theme,\n  Layout() {\n    return h(Theme.Layout, null, {});\n  },\n};\n"
  },
  {
    "path": "packages/docs/docs/community/demo.md",
    "content": "# Demo\n\nCheck out the [Demo](https://nuxt-fire-demo.herokuapp.com/) by [lupas](https://github.com/lupas) and its [GitHub Repo](https://github.com/lupas/nuxt-firebase-demo) for example code.\n"
  },
  {
    "path": "packages/docs/docs/community/faq.md",
    "content": "# FAQ\n\nCreate an [issue](https://github.com/nuxt-community/firebase-module/issues) if you have a question and we might add it to the FAQ.\n\n## Firestore: Using \"array-contains\" or \"array-contains-any\" does not work\n\nIf you are using `array-contains` or `array-contains-any` you might run into the followig error:\n\n> Function Query.where() called with invalid data. Unsupported field value: a custom Array object\n\nThis issue is not coming from this module but is specific to using Firebase together with Nuxt. You can get rid of this error message by setting `runInNewContext` to `false` like so:\n\n::: code-group\n\n```js [nuxt.config.js]\nrender: {\n  bundleRenderer: {\n    runInNewContext: false\n  }\n},\n```\n\n:::\n\n## How to add Firebase Polyfills?\n\nIf you want to add Firebase polyfills, you need to ceate a plugin and import the required polyfills like so:\n\n1. Creating `/plugins/polyfills.js` containing:\n\n::: code-group\n\n```js [polyfills.js]\n// Import all polyfills\nimport '@firebase/polyfill'\n\n// Import specific polyfills:\nimport '@firebase/polyfill/node_modules/core-js/features/object/values'\n```\n\n:::\n\n2. Add to your nuxt.config.js:\n\n::: code-group\n\n```js [nuxt.config.js]\nplugins: [\n  { src: '~plugins/polyfills', mode: 'client' },\n],\n```\n\n:::\n\n> References:  \n> [Issue #307](https://github.com/nuxt-community/firebase-module/issues/307)  \n> [Stack Overflow Question](https://stackoverflow.com/questions/62308061/nuxt-firebase-ie-11-object-doesnt-support-property-or-method-values/64062207#64062207)\n\n## How to use this module in SSR mode together with Strapi?\n\nFor Strapi to work together with this module, you need to ignore the Strapi API routes by adding them to the [ignorePaths](https://firebase.nuxtjs.org/service-options/auth#ignorepaths) config like so:\n\n```js\nauth: {\n  ssr: {\n    // ...\n    ignorePaths: ['/api/'] // or /^api\\//\n  }\n}\n```\n\n> References:  \n> [Issue #292](https://github.com/nuxt-community/firebase-module/issues/292)\n\n## Nuxt Generate warns with \"Nuxt Generate finished but did not exit\"\n\nThis warning happens because either Firestore or the RealtimeDb are not terminated at the end of Nuxt Generate.\n\nTo get rid of this warning, you can terminate the services by extending the `generate:done` hook in your `nuxt.config.js` like so:\n\n::: code-group\n\n```js [nuxt.config.js]\nhooks: {\n  generate: {\n    async done(builder) {\n      const appModule = await import('./.nuxt/firebase/app.js')\n      const { session } = await appModule.default(\n        builder.options.firebase.config,\n        {\n          res: null,\n        }\n      )\n      try {\n        session.database().goOffline()\n      } catch (e) { }\n      try {\n        session.firestore().terminate()\n      } catch (e) { }\n    },\n  },\n},\n```\n\n:::\n\n> References:  \n> [Issue #93](https://github.com/nuxt-community/firebase-module/issues/93)\n"
  },
  {
    "path": "packages/docs/docs/community/links.md",
    "content": "# Links\n\nCollection of Links related to this module:\n\n### Articles\n\n- [Nuxt.js (v2), Firestore & SSR 🔥](https://medium.com/@pascalluther/nuxt-js-v2-firestore-ssr-938d8fb7d2b0?)  \n  Medium Article about integrating Firestore with Nuxt.js v2.\n\n- [Nuxt.js (v1), Firestore & SSR 🔥](https://medium.com/@pascalluther/nuxt-js-v1-firestore-and-ssr-73e3140574fc?) Medium Article about integrating Firestore with Nuxt.js v1.\n\n- [@nuxtjs/firebase social auth](https://dev.to/rodrigopv/nuxtjs-firebase-social-auth-3afe)  \n  Article about how to integrate social auth with nuxtjs/firebase\n\n### Videos\n\n- [Nuxt Firebase로 블로그 만들어보기 12 파이어베이스 인증해보기](https://www.youtube.com/watch?v=Zd6PSfgH3t4) Tutorial video on how to integrate Firebase Auth with nuxt-fire (in Korean)\n"
  },
  {
    "path": "packages/docs/docs/guide/getting-started.md",
    "content": "# Getting Started\n\n## Requirements\n\nMake sure you are using Nuxt 2 and have Firebase v8 installed in your project.\n\n::: code-group\n\n```bash [yarn]\nyarn add firebase@^8\n```\n\n```bash [npm]\nnpm install firebase@^8\n```\n\n:::\n\n::: danger IMPORTANT - Nuxt 3 not supported!\n\nThis module was written for **Nuxt 2** and does currently not support Nuxt 3. There are currently **no plans** to support Nuxt 3 in the near future in this module. However, you can take a look at VueFire Nuxt module for Nuxt 3 support\n\n:::\n\n## Install\n\nInstall the module via NPM or Yarn.\n\n::: code-group\n\n```bash [yarn]\nyarn add @nuxtjs/firebase\n```\n\n```bash [npm]\nnpm install @nuxtjs/firebase\n```\n\n:::\n\n## Configure\n\nAdd the below code to your **nuxt.config.js** modules array and adjust it according to your needs.\n\nVisit the [config section](/guide/options#config) for a detailed overview about each configuration.\n\n### Example Configuration\n\n::: code-group\n\n```js [nuxt.config.js]\nmodules: [\n    [\n      '@nuxtjs/firebase',\n      {\n        config: {\n          apiKey: '<apiKey>',\n          authDomain: '<authDomain>',\n          projectId: '<projectId>',\n          storageBucket: '<storageBucket>',\n          messagingSenderId: '<messagingSenderId>',\n          appId: '<appId>',\n          measurementId: '<measurementId>'\n        },\n        services: {\n          auth: true // Just as example. Can be any other service.\n        }\n      }\n    ]\n  ],\n```\n\n:::\n\nSee list of all available services [here](/guide/options#services).\n\nYou can also separate the config from the module array by using the **firebase** object:\n\n::: code-group\n\n```js [nuxt.config.js]\nmodules: ['@nuxtjs/firebase'],\n\nfirebase: {\n   // options\n}\n```\n\n:::\n"
  },
  {
    "path": "packages/docs/docs/guide/index.md",
    "content": "# Nuxt Firebase\n\n<img src=\"/preview-dark.png\" class=\"dark-only\"/>\n<img src=\"/preview.png\" class=\"light-only\"/>\n\n::: danger IMPORTANT - Nuxt 3 not supported!\n\nThis module was written for **Nuxt 2** and does currently not support Nuxt 3. There are currently **no plans** to support Nuxt 3 in the near future in this module. However, you can take a look at VueFire Nuxt module for Nuxt 3 support\n\n:::\n\n::: warning Modular Mode (Firebase v9+)\n\nThis module does NOT support the new modular syntax from Firebase v9+.\n\nIf you plan to use the new modular mode of Version 9, we advise you to implement Firebase manually as described in the following medium article.\n\nIt is currently unclear when, and if, this module will support the new modular mode. See discussion.\n\n:::\n\n## What is this?\n\nThe Nuxt.js Firebase Module is a module that helps you integrate the Firebase JavaScript SDK into your application with ease. By simply configuring this module in your nuxt.config.js file, you can use all Firebase Services throughout your app.\n\nBy importing each individual Firebase service dynamically this module reduces bundle sizes and improves performance of your Nuxt.js app with Firebase.\n\nThe module additionally adds other perks such as a plugin that automated the setup of onAuthStateChanged() for Firebase Authentication or other helper functions that make your life with Firebase easier.\n\n## How does it work?\n\nThe module adds a plugin to your Nuxt.js application that handles the initialization of each Firebase service (Authentication, Firestore, etc.). It then injects these services into the global context which makes them easily available throughout your application.\n"
  },
  {
    "path": "packages/docs/docs/guide/options.md",
    "content": "# Options\n\n## config <Badge type=\"tip\" text=\"Required\" />\n\nYour firebase config snippet and other Firebase specific parameters. You can retrieve this information from your Firebase project's overview page:\n\n`https://console.firebase.google.com/project/<your-project-id>/overview`\n\n::: code-group\n\n```js [nuxt.config.js]\nconfig: {\n  // REQUIRED: Official config for firebase.initializeApp(config):\n  apiKey: '<apiKey>',\n  authDomain: '<authDomain>',\n  projectId: '<projectId>',\n  storageBucket: '<storageBucket>',\n  messagingSenderId: '<messagingSenderId>',\n  appId: '<appId>',\n  measurementId: '<measurementId>'\n}\n```\n\n:::\n\n::: info\n\nCan be defined **per NODE_ENV environment** if put in child-objects `config.production` and `config.development`, meaning that e.g. `config.production` gets loaded when `NODE_ENV === 'production'`.\n\nYou can also specify multiple custom environments as mentioned in the [customEnv](/guide/options#customenv) option below.\n\n:::\n\n## services <Badge type=\"tip\" text=\"Required\" />\n\nBy default, **NO** Firebase products are initialized. To initialize a specific service, set its services flag to `true` or create a child object and name the key after the service.\n\nAvailable services:\n\n::: code-group\n\n```js [nuxt.config.js]\nservices: {\n  auth: true,\n  firestore: true,\n  functions: true,\n  storage: true,\n  database: true,\n  messaging: true,\n  performance: true,\n  appCheck: true,\n  analytics: true,\n  remoteConfig: true,\n```\n\n:::\n\nEach service has advanced options that you can configure. See the **service options** section for more details.\n\n## customEnv\n\n- Type: `Boolean`\n- Default: `false`\n\nBy default, the Firebase config will be chosen either directly from the **config-object** or from a **child-object named after the current NODE_ENV environment variable**.\n\nIf set to `true`, however, the module will determine the environment based on the environment variable called `FIRE_ENV`, which you can define yourself. This gives you the flexibility to define as many different Firebase configs as you like, independent of your NODE_ENV.\n\n::: danger\n\nIf you decide to turn on this option, you need to define `process.env.FIRE_ENV` in your code and additionally add the following code to your `nuxt.config.js` to make sure that the environment variable gets passed from server to client.\n\n::: danger\n\n::: code-group\n\n```js [nuxt.config.js]\nenv: {\n  FIRE_ENV: process.env.FIRE_ENV\n}\n```\n\n:::\n\nAfter that, you can set FIRE_ENV to anything you like...\n\n```js[package.json]\n\"scripts\": {\n  \"serveFoo\": \"FIRE_ENV=foofoofoo nuxt\",\n  \"serveFaa\": \"FIRE_ENV=faafaafaa nuxt\",\n}\n```\n\nAnd then add your config to the module options:\n\n::: code-group\n\n```js [nuxt.config.js]\n// within the module's config\nconfig: {\n  foofoofoo: {\n    apiKey: '<apiKey>',\n    authDomain: '<authDomain>',\n    databaseURL: '<databaseURL>', // Optional\n    projectId: '<projectId>',\n    storageBucket: '<storageBucket>',\n    messagingSenderId: '<messagingSenderId>',\n    appId: '<appId>',\n    measurementId: '<measurementId>'\n  },\n  faafaafaa: {\n    //\n  }\n}\n```\n\n:::\n\n## onFirebaseHosting\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\nIf your application is hosted on Firebase hosting, you can enable this flag in order to load the newest Firebase scripts in the service workers directly from there instead of www.gstatic.com.\n\n## lazy\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\nThis allows lazy loading of all Firebase services.\n\nWhen set to `true`, all services are NOT loaded until you manually load them where needed. We additionally inject the following props for each activated service into the context:\n\n| Firebase Service  | Shortcut                  |\n| ----------------- | ------------------------- |\n| Authentication    | $fire.authReady()         |\n| Realtime Database | $fire.databaseReady()     |\n| Firestore         | $fire.firestoreReady()    |\n| Storage           | $fire.storageReady()      |\n| Functions         | $fire.functionsReady()    |\n| Messaging         | $fire.messagingReady()    |\n| Performance       | $fire.performanceReady()  |\n| Analytics         | $fire.analyticsReady()    |\n| Remote Config     | $fire.remoteConfigReady() |\n| App Check         | $fire.appCheckReady()     |\n\nSimply call the `await this.$fire.serviceNameReady()` function before you access `this.$fire.serviceName` and the service gets dynamically loaded only when needed.\n\nIf the services was already loaded previously, the service does not get loaded a second time.\n\n**Example:**\n\n```js\n// 1. Load the service\nawait this.$fire.authReady()\n\n// 2. Use the service\nawait this.$fire.auth.createUserWithEmailAndPassword('foo@foo.foo', 'test')\n```\n\n::: danger Be aware\n\nYou can either enabled lazy loading for all services or none.\n\n:::\n\n## injectModule\n\n- Type: `Boolean` or `Object`\n- Default: `true`\n\nWhether to inject the entire [Firebase module](/guide/usage#firemodule) as `this.$fireModule` or not.\n\n## terminateDatabasesAfterGenerate\n\n- Type: `Boolean`\n- Default: `false`\n\nTerminates the Firebase RealTime Database and Firestore after `nuxt generate` has been run. This fixes the below warning by Nuxt and speeds up generate time:\n\n> The command 'nuxt generate' finished but did not exit after 5s\n> This is most likely not caused by a bug in Nuxt\n> Make sure to cleanup all timers and listeners you or your plugins/modules start.\n> Nuxt will now force exit\n>\n> DeprecationWarning: Starting with Nuxt version 3 this will be a fatal error\n"
  },
  {
    "path": "packages/docs/docs/guide/usage.md",
    "content": "# Usage\n\n## General Usage\n\nThis module injects two main utilities into your context, `$fire` and `$fireModule`.\n\nYou can access these in almost any context using `app.$fire`/`app.$fireModule` or `this.$fire`/`this.$fireModule` - including store actions.\n\n::: danger Understand the difference!\n\nWhile `$fire` contains the initialized service instances, `$fireModule` gives you access to the (not-initialized) **Firebase** module itself with all its static methods.\n\n:::\n\n### $fire\n\n`$fire` gives you access to the initialized service instances:\n\n| Firebase Service  | Shortcut           | Client/Server   |\n| ----------------- | ------------------ | --------------- |\n| Authentication    | $fire.auth         | Client + Server |\n| Realtime Database | $fire.database     | Client + Server |\n| Firestore         | $fire.firestore    | Client + Server |\n| Storage           | $fire.storage      | Client + Server |\n| Functions         | $fire.functions    | Client + Server |\n| Messaging         | $fire.messaging    | Client-only     |\n| Performance       | $fire.performance  | Client-only     |\n| Analytics         | $fire.analytics    | Client-only     |\n| Remote Config     | $fire.remoteConfig | Client-only     |\n\nSee [Firebase's official docs](https://firebase.google.com/docs/) for more usage information.\n\n::: warning Be aware\n\nPlease be aware that some services are not available on server-side. In universal code, you can wrap your code in `if (process.client) {}` so it only gets executed on the client-side.\n\n:::\n\n### $fireModule\n\n`$fireModule` gives you access to the **Firebase** modules themselves with all their static methods.\n\n| Firebase Module       | Shortcut                 |\n| --------------------- | ------------------------ |\n| firebase.auth         | $fireModule.auth         |\n| firebase.database     | $fireModule.database     |\n| firebase.firestore    | $fireModule.firestore    |\n| firebase.storage      | $fireModule.storage      |\n| firebase.functions    | $fireModule.functions    |\n| firebase.messaging    | $fireModule.messaging    |\n| firebase.performance  | $fireModule.performance  |\n| firebase.analytics    | $fireModule.analytics    |\n| firebase.remoteConfig | $fireModule.remoteConfig |\n\n## Examples\n\nAccess Firebase Authentication in a component method:\n\n```js\nexport default {\n  methods: {\n    async createUser() {\n      try {\n        await this.$fire.auth.createUserWithEmailAndPassword(\n          'foo@foo.foo',\n          'test'\n        )\n      } catch (e) {\n        handleError(e)\n      }\n    },\n  },\n}\n```\n\nAccess Firestore and it's Object in a vuex store action:\n\n```js\nexport default {\n  async randomVuexAction({commit, state, rootState}, userId) {\n    const ref = this.$fire.firestore.collection('users').doc(userId)\n    try {\n      await exerciseRef.update({\n        [`randomFoo.FooFoo`]: this.$fireModule.firestore.FieldValue.delete(),\n      })\n    } catch (e) {\n      return Promise.reject(e)\n    }\n  },\n}\n```\n"
  },
  {
    "path": "packages/docs/docs/index.md",
    "content": "---\nlayout: 'home'\n\ntitle: Nuxt Firebase\ntitleTemplate: Easily integrate Firebase into your Nuxt project\n\nhero:\n  name: Nuxt Firebase\n  text: Documentation\n  tagline: Easily integrate Firebase into your Nuxt project\n  image:\n    src: /icon.png\n    alt: Nuxt Firebase Logo\n  actions:\n    - theme: brand\n      text: Get Started\n      link: /guide/\n    - theme: alt\n      text: View on GitHub\n      link: https://github.com/nuxt-community/firebase-module\n\nfeatures:\n  - title: Simple Setup\n    details: Minimal setup required to integrate all Firebase services into your Nuxt.js application.\n  - title: Performant\n    details: The module uses dynamic imports of each individual Firebase service to reduce bundle sizes and  improve performance.\n  - title: Additional Features\n    details: Enjoy the benefits of additional features such as automated setup of .onAuthStateChanged() for Firebase Authentication and more.\n---\n"
  },
  {
    "path": "packages/docs/docs/public/service-worker.js",
    "content": "// force clearing previous service worker\nself.addEventListener('install', function (e) {\n  self.skipWaiting()\n})\n\nself.addEventListener('activate', function (e) {\n  self.registration\n    .unregister()\n    .then(function () {\n      return self.clients.matchAll()\n    })\n    .then(function (clients) {\n      clients.forEach((client) => client.navigate(client.url))\n    })\n})\n"
  },
  {
    "path": "packages/docs/docs/service-options/all-services.md",
    "content": "# All Services\n\nAll services have the following options:\n\n::: code-group\n\n```js [nuxt.config.js]\n[serviceName]: {\n  static: false, // default\n  preload: false, // default\n  chunkName: process.env.NODE_ENV !== 'production' ? `firebase-${serviceName}` : '[id]' // default\n}\n```\n\n:::\n\n## static\n\nBy default, each service gets imported dynamically, which splits them into separate chunks. If `static = true` however, we import them statically, so the services are bundled into `vendors.app.js`.\n\n```js\n// static: false (default)\nawait import 'firebase/auth'\n// static: true\nimport 'firebase/auth'\n```\n\n## preload\n\nPreloads dynamically loaded services. More information [here](https://webpack.js.org/guides/code-splitting/#prefetchingpreloading-modules).\n\n::: warning Be aware\n\nOnly applies if `static === false`.\n\n:::\n\n## chunkName\n\nBy default, the dynamically imported services are named `vendors.firebase-${serviceName}.js` in development mode, and `[id]` in production mode (`process.env.NODE_ENV === 'production'`). If you want to change this behaviour, you can do so with this option.\n\n::: warning Be aware\n\nOnly applies if `static === false`.\n\n:::\n"
  },
  {
    "path": "packages/docs/docs/service-options/analytics.md",
    "content": "# analytics\n\n::: danger Client-only\n\nMake sure to wrap universal code in `if (process.client) {}`.\n\n:::\n\nInitializes **Firebase Analytics** and makes it available via `$fire.analytics` and `$fireModule.analytics`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nanalytics: {\n  collectionEnabled: true // default\n}\n```\n\n:::\n\n## collectionEnabled\n\nAllows to disable analytics collection. Usefull to disable analytics in development mode or before fullfillment of legal obligation.\n\nCan be enabled back via `$fireAnalytics.setAnalyticsCollectionEnabled(true)`.\n"
  },
  {
    "path": "packages/docs/docs/service-options/app-check.md",
    "content": "# appCheck\n\n::: danger Client-only\n\nMake sure to wrap universal code in `if (process.client) {}`.\n\n:::\n\nInitializes **Firebase App Check** and makes it available via `$fire.appCheck` and `$fireModule.appCheck`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nappCheck: {\n  debugToken: false, // default\n}\n```\n\n:::\n"
  },
  {
    "path": "packages/docs/docs/service-options/auth.md",
    "content": "# auth\n\nInitializes **Firebase Authentication** and makes it available via `$fire.auth` and `$fireModule.auth`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nauth: {\n  persistence: 'local', // default\n  initialize: {\n    onAuthStateChangedMutation: 'ON_AUTH_STATE_CHANGED_MUTATION',\n    onAuthStateChangedAction: 'onAuthStateChangedAction',\n    subscribeManually: false\n  },\n  ssr: false, // default\n  emulatorPort: 9099,\n  emulatorHost: 'http://localhost',\n}\n```\n\n:::\n\n## persistence\n\nSet firebase auth persistence, see [here](https://firebase.google.com/docs/auth/web/auth-state-persistence).\n\n## initialize\n\nThis sets up an `onAuthStateChanged()` and/or `onIdTokenChanged()` listener and hooks them up to the vuex store.\n\nJust add a mutation/action to your vuex store ([as seen below](#onauthstatechangedmutation)) that handles what to do with the authUser object (e.g. save it to the state or get user data from FireStore) and then define the name of the action/mutation in the `firebase.services.auth.initialize` configuration as above.\n\n::: info\n\nYou can also use namespaces for your store actions/mutations like so: `onAuthStateChangedAction: 'namespaceName/actionName'`.\n\n:::\n\nWhen `onAuthStateChanged()` or `onIdTokenChanged()` get triggered by Firebase, the defined mutation/action will be called with the `authUser` and `claims` attributes as [as seen below](#onauthstatechangedmutation)\n\nTo unsubscribe from both listeners simply call the `$fireAuthStore.unsubscribe()` function.\n\n::: warning Be aware\n\nThis does not work in _lazy-mode_, since auth is not initialized. If you want to use this option in lazy-mode, call the _authReady()_ function in a separate plugin.\n\n:::\n\n### onAuthStateChangedMutation\n\n```js\nON_AUTH_STATE_CHANGED_MUTATION: (state, {authUser, claims}) => {\n  if (!authUser) {\n    // claims = null\n    // perform logout operations\n  } else {\n    // Do something with the authUser and the claims object...\n  }\n}\n```\n\n::: warning Be aware\n\nDo not save the `authUser` directly to the store, since this will save an object reference to the state which gets directly updated by Firebase Auth periodically and therefore throws a `vuex` error if `strict != false`.\n\n```js\nexport const mutations = {\n  ON_AUTH_STATE_CHANGED_MUTATION: (state, {authUser, claims}) => {\n    // Don't do this:\n    state.user = authUser\n\n    // Do this:\n    const {uid, email, emailVerified} = authUser\n    state.user = {uid, email, emailVerified}\n  },\n}\n```\n\n:::\n\n### onAuthStateChangedAction\n\n```js\nonAuthStateChangedAction: (ctx, {authUser, claims}) => {\n  if (!authUser) {\n    // claims = null\n    // Perform logout operations\n  } else {\n    // Do something with the authUser and the claims object...\n  }\n}\n```\n\n### onIdTokenChangedAction\n\nSame as `onAuthStateChangedAction`, but also gets triggered when the idToken changes (e.g. expires).\n\n::: warning Be aware\nThe Firebase SDK automatically refreshed your id token, so this option shall only be used if you use the idToken for custom authentication scenarios.\n:::\n\n### onIdTokenChangedMutation\n\nSame as `onAuthStateChangedMutation`, but also gets triggered when the idToken changes (e.g. expires).\n\n::: warning Be aware\nThe Firebase SDK automatically refreshed your id token, so this option shall only be used if you use the idToken for custom authentication scenarios.\n:::\n\n### subscribeManually\n\nBy settings `subscribeManually: true`, the `onAuthStateChanged()` listener won't be set up until you call it manually:\n\n```js\n// e.g. in a seperate Plugin\nthis.$fireAuthStore.subscribe()\n```\n\nThis is needed in case you need to start other plugins _after_ Firebase is initialized but _before_ `onAuthStateChanged()` is set up.\n\n::: info Example:\n\nFor example with the Sentry module, you migth want to set some user-related information in Sentry each time `onAuthStateChanged` is triggered. In that case, Sentry needs to be setup before `onAuthStateChanged()`.\n\nYou can achieve this by manually calling `this.$fireAuthStore.subscribe()` after Sentry has been initialized.\n:::\n\n## ssr\n\nThis sets up SSR ready functionality with minimal effort.\n\nIf `ssr = true`, the module generates a service worker that refreshes the Firebase Auth idToken and sends it with each request to the server if the user is logged in, as described [here](https://firebase.google.com/docs/auth/web/service-worker-sessions).\n\nThe option further adds a plugin that checks on server side if the token is valid and then injects a simplified [`admin.auth.UserRecord`](https://firebase.google.com/docs/reference/admin/node/admin.auth.UserRecord) into the context variable `res.locals.user`.\n\nThe simplified user record contains the following properties:\n\n- `uid`: The users uid\n- `email`: The users email\n- `emailVerified`: If the email was verified\n- `displayName`: The users display name\n- `allClaims`: All claims from the [admin.auth.DecodedIdToken](https://firebase.google.com/docs/reference/admin/node/admin.auth.DecodedIdToken)\n\nThe injected user can be used by context aware life cycle hooks on the server side (e.g. the store action `nuxtServerInit`).\n\nA tutorial on how to set this up can be found [here](/tutorials/ssr).\n\n::: info Please Note\n\nThis <u>does not authenticate the Firebase Client SDK on the server</u>. While you will be able to know if a user is logged in or not and have access to its simplified properties, you <u>won't be able to do authenticated calls</u> on server-side.\n\nThis means that all calls on server-side (e.g. fetching data via Firestore in fetch-hooks), which are protected by security rules, will still fail with <i>insufficient privileges.</i>\n\nReason for this is that the Firebase JS SDK is a client-side library that is not built for authenticating multiple users. See the [serverlogin](/service-options/auth#serverlogin) option for an <b>experimental</b> approach to solve this issue.\n\n:::\n\n### ignorePaths\n\nThe service worker session automatically ignores external resources, static files and HMR calls.\nIf you need to ignore additional routes, define them here.\n\n::: code-group\n\n```js [nuxt.config.js]\nauth: {\n  ssr: {\n    ignorePaths: [\n      '/admin', // path is ignored if url.pathname.startsWith('/admin')\n      /^api/, // path is ignored if url.pathname without the leading slash (/) matches the RegExp\n    ]\n  }\n}\n```\n\n:::\n\n### credential\n\n<!-- <experimental-alert></experimental-alert> -->\n\nEnables Firebase admin authorization.\n\n::: code-group\n\n```js [nuxt.config.js]\nauth: {\n  ssr: {\n    // retrieved credentials from GOOGLE_APPLICATION_CREDENTIALS env variable\n    credential: true\n\n    // provide the path to the service account file\n    // CAREFUL - don't deploy to publicly accessible location!\n    credential: '/absolute/path/to/serviceAccount.json'\n\n    // nuxt aliases are supported\n    credential: '~/assets/serviceAccount.json'\n  }\n}\n```\n\n:::\n\nIf you want additional information on the user the module can inject a full [`admin.auth.UserRecord`](https://firebase.google.com/docs/reference/admin/node/admin.auth.UserRecord) into the `ctx.res.locals.user` property.\n\nThe `allClaims` property is set in addition to the default user record properties.\n\nTo enable this you can authorize the firebase admin by [generating a service account key](https://firebase.google.com/docs/admin/setup#initialize-sdk) and link to it with this configuration.\n\n::: danger\n\n**NEVER deploy your service account key to a publicly accessible location**\n\nThe service account key file is highly sensitive as it grants full access to your firebase project.\n\nIn production always prefer providing the path to the key file through the `GOOGLE_APPLICATION_CREDENTIALS` environment variable (`auth.ssr.credential = true`) and store the key file in a location which is not exposed by your webserver.\n\n:::\n\n### serverLogin\n\n<!-- <experimental-alert></experimental-alert> -->\n\nEnables server side Firebase client SDK login.\n\n::: code-group\n\n```js [nuxt.config.js]\nauth: {\n  ssr: {\n    // Set 'credential' as described above.\n\n    serverLogin: true\n    // or\n    serverLogin: {\n      // Takes a duration in milliseconds\n      sessionLifetime: 0 // default (session is kept only for the duration of the request)\n      // Takes a duration in milliseconds\n      loginDelay: 50 // default (20 queries per second = minimum recommended delay)\n    }\n  }\n}\n```\n\n:::\n\nOnce you have properly setup the admin sdk via the [credential option](#credential) you can enable server side login to use firebase services on the server, e.g. to perform store hydration on page load.\n\nSimply set `auth.ssr.serverLogin = true`.\n\nThe module creates a separate firebase app/session for every authenticated user to avoid authorization context leakage.\n\nYou can configure the session lifetime with `auth.ssr.serverLogin.sessionLifetime`\n\n::: warning Be aware\n\n**Programmatic server implementation**\n\nIf you are using an external server implementation to start nuxt programmatically:\n\n- The `@nuxtjs/firebase` module has to be included in your server package (`yarn add @nuxtjs/firebase`).\n- Make sure to initialize the nuxt build outside of the server request callback for session management to work properly:\n\n  ```js\n  import express from 'express'\n  import {Nuxt} from 'nuxt'\n\n  const server = express()\n\n  // do this outside of the server callback so the nuxt build is kept in memory\n  const nuxt = new Nuxt({\n    dev: false,\n    buildDir: '.nuxt',\n  })\n\n  server.use(async (req, res, next) => {\n    // this will resolve immediately after the first render\n    await nuxt.ready()\n\n    nuxt.render(req, res, next)\n  })\n  ```\n\n:::\n\n::: danger\n\n**Do not use this feature for high traffic sites**\n\nThis module provides this feature to facilitate data hydration in SSR calls.\n\nHowever, the client SDK is not intended for use on a server.\n\nAuthentication is rate limited by IP for security reasons by Firebase. The base limit is 20 QPS / IP (as of March 2020) and a couple dozen logins per user per 10 minutes, but it’s subject to change as needed, without notice by Firebase.\n\nTry to reduce the need for SSR by providing pre-rendered pages ([`nuxt generate`](https://nuxtjs.org/guide#static-generated-pre-rendering-)) through static hosting and only fall back on SSR for authenticated and dynamic routes.\n\nIf you run into rate limiting issues try adjusting the `serverLogin.loginDelay` configuration.\n\n:::\n\n::: danger\n\n**Do not use the Client SDK in API Operations**\n\nIf you have an API which is served over Nuxt SSR:\n\n1. Please ensure it does not use `firebase` client sdk functionality (e.g. `auth`, `firestore`, `storage`, ...).  \n   Instead use the corresponding functionality of a fully authenticated `firebase-admin` instance.\n2. Add the API base path (e.g. `'/api/'`) to the [`auth.ssr.ignorePaths`](#ignorepaths) configuration.\n\n::: warning Be aware\n\n## emulatorPort\n\n- Type: `Integer`\n- Default: `null`\n\nSets up `useEmulator(\"http://localhost:EMULATOR_PORT\")` to point to an Authentication emulator running locally instead of the production one.\n\nMore information in the official Firebase [Guide to connect your app to the Authentication Emulator](https://firebase.google.com/docs/emulator-suite/connect_auth).\n\n::: info\nTo not use the emulator in production you can do the following:\n\n```js\nemulatorPort: process.env.NODE_ENV === 'development' ? 9099 : undefined\n```\n\n:::\n\n## emulatorHost\n\n- Type: `String`\n- Default: `http://localhost`,\n\nChanges the host used for the Authentication emulator. Only applies if the emulatorPort is set.\n\n## disableEmulatorWarnings\n\n- Type: `Boolean`\n- Default: false\n\nDisables the auth emulators warning messages, see [here](https://github.com/firebase/firebase-tools/issues/2773).\n\n## Example of SignIn with a provider Google\n\n```js\ntry {\n  const provider = new this.$fireModule.auth.GoogleAuthProvider()\n  const user = await this.$fire.auth.signInWithPopup(provider)\n  console.log(user) // here you can do what you want with the user data\n  this.$router.push('/') // that return from firebase\n} catch (e) {\n  // handle the error\n}\n```\n\nThe same code with work with facebook as well just change it to `FacebookAuthProvider`\nFull example is [here](https://dev.to/rodrigopv/nuxtjs-firebase-social-auth-3afe).\n"
  },
  {
    "path": "packages/docs/docs/service-options/database.md",
    "content": "# database\n\nInitializes **Firebase Realtime Database** and makes it available via `$fire.database` and `$fireModule.database`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\ndatabase: {\n  emulatorPort: 9000,\n  emulatorHost: 'localhost',\n}\n```\n\n:::\n\n## emulatorPort\n\n- Type: `Integer`\n- Default: `null`\n\nSets up `useEmulator(\"localhost\", EMULATOR_PORT)` to point to a RealtimeDatabase emulator running locally.\n\nMore information in the official Firebase [Emulator Docs](https://firebase.google.com/docs/emulator-suite/connect_rtdb).\n\n::: info\nTo not use the emulator in production you can do the following:\n\n```js\nemulatorPort: process.env.NODE_ENV === 'development' ? 9000 : undefined\n```\n\n:::\n\n## emulatorHost\n\n- Type: `String`\n- Default: `localhost`,\n\nChanges the host used for the emulator. Only applies if the emulatorPort is set.\n"
  },
  {
    "path": "packages/docs/docs/service-options/firestore.md",
    "content": "# firestore\n\nInitializes **Firebase Firestore** and makes it available via `$fire.firestore` and `$fireModule.firestore`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nfirestore: {\n  memoryOnly: false, // default\n  chunkName: process.env.NODE_ENV !== 'production' ? 'firebase-auth' : '[id]', // default\n  enablePersistence: true,\n  emulatorPort: 8080,\n  emulatorHost: 'localhost',\n  settings: {\n    // Firestore Settings - currently only works in SPA mode\n  }\n}\n```\n\n:::\n\n## memoryOnly\n\nWith this flag set to true, the _memory-only_ build is loaded as mentioned [here](https://firebase.google.com/support/release-notes/js#version_7130_-_march_26_2020).\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n## enablePersistence\n\nEnables persistence in web apps.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nfirestore: {\n  // ...\n  enablePersistence: true\n}\n\n// or\n\nfirestore: {\n  // ...\n  enablePersistence: {\n    /**\n     * Whether to synchronize the in-memory state of multiple tabs. Setting this\n     * to 'true' in all open tabs enables shared access to local persistence,\n     * shared execution of queries and latency-compensated local document updates\n     * across all connected instances.\n     *\n     * To enable this mode, `synchronizeTabs:true` needs to be set globally in all\n     * active tabs. If omitted or set to 'false', `enablePersistence()` will fail\n     * in all but the first tab.\n     */\n    synchronizeTabs: true\n  }\n}\n```\n\n:::\n\nMore information [here](https://firebase.google.com/docs/firestore/manage-data/enable-offline).\n\n## emulatorPort\n\n- Type: `Integer`\n- Default: `null`\n\nSets up `useEmulator(\"localhost\", EMULATOR_PORT)` to point to a Firestore emulator running locally.\n\nMore information in the official Firebase [Emulator Docs](https://firebase.google.com/docs/emulator-suite/connect_firestore).\n\n::: info\n\nTo not use the emulator in production you can do the following:\n\n```js\nemulatorPort: process.env.NODE_ENV === 'development' ? 8080 : undefined\n```\n\n:::\n\n## emulatorHost\n\n- Type: `String`\n- Default: `localhost`,\n\nChanges the host used for the emulator. Only applies if the emulatorPort is set.\n\n## settings\n\nAdds settings to your Firebase initialization, e.g. `host` or `ssl`.\nSee more [here](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Settings).\n\n::: warning Important\n\nWhen using settings() in Universal mode (see [this issue](https://github.com/nuxt-community/firebase-module/issues/116)), you need to set `runInNewContext` to `false` in your nuxt.config.js like so:\n\n::: code-group\n\n```js [nuxt.config.js]\n// Add this to your nuxt.config.js\nrender: {\n  bundleRenderer: {\n    runInNewContext: false\n  }\n},\n```\n\n:::\n\n:::\n"
  },
  {
    "path": "packages/docs/docs/service-options/functions.md",
    "content": "# functions\n\nInitializes **Firebase Functions** and makes it available via `$fire.functions` and `$fireModule.functions`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nfunctions: {\n  location: 'us-central1',\n  emulatorPort: 12345,\n  emulatorHost: 'http://10.10.10.3',\n}\n```\n\n:::\n\n## location\n\n- Type: `String`\n- Default: `us-central1`\n\nMore information [here](https://firebase.google.com/docs/functions/locations).\n\n## emulatorPort\n\n- Type: `Integer`\n- Default: `null`\n\nSets up `useFunctionsEmulator(\"http://localhost:EMULATOR_PORT\")` to point to a Cloud Functions emulator running locally instead of the production one.\n\nMore information in the official Firebase [API Docs](<https://firebase.google.com/docs/reference/android/com/google/firebase/functions/FirebaseFunctions.html#useFunctionsEmulator(java.lang.String)>) and [Functions Docs](https://firebase.google.com/docs/functions/local-emulator).\n\n## emulatorHost\n\n- Type: `String`\n- Default: `http://localhost`,\n\nChanges the host used for the Cloud Functions emulator. Only applies if the emulatorPort is set.\n"
  },
  {
    "path": "packages/docs/docs/service-options/messaging.md",
    "content": "# messaging\n\n::: danger Client-only\n\nMake sure to wrap universal code in `if (process.client) {}`.\n\n:::\n\nInitializes **Firebase Messaging** and makes it available via `$fire.messaging` and `$fireModule.messaging`.\nMessage payload is expected as defined by Firebase [here](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#WebpushConfig).\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nmessaging: {\n  createServiceWorker: false,\n  actions: [\n    {\n      action: 'randomName',\n      url: 'randomUrl'\n    }\n  ],\n  fcmPublicVapidKey: '<publicVapidKey>' // OPTIONAL : Sets vapid key for FCM after initialization\n}\n```\n\n:::\n\n## createServiceWorker\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\nSetting the **createServiceWorker** flag to true automatically creates a service worker called `firebase-messaging-sw.js` in your static folder. The service worker is fully configured for FCM with the newest Firebase scripts.\n\n## actions\n\n> Only works if `createServiceWorker === true`\n\nAn array of actions for which a `notificationClick` handler should be registered in the service worker that opens the defined url for the specific action sent by the payload.\n\n```js\n{\n  action: 'randomName',\n  url: 'randomUrl'\n}\n```\n\nMake sure to define the action in your payload like so:\n\n```js\nconst message = {\n  // ...\n  webpush: {\n    notification: {\n      actions: [\n        {\n          action: 'randomName',\n          title: 'Go to URL',\n        },\n      ],\n    },\n  },\n  // ...\n}\nawait messaging.send(message)\n```\n\n## inject\n\n> Only works if `createServiceWorker === true`\n\nInjects a string (or an entire code snippet) at the end of the messaging service worker. This allows you to extend the service worker to your liking.\n\n#### Simple example:\n\n::: code-group\n\n```js [nuxt.config.js]\n...\ninject: 'console.log(\"This is the end of the service worker.\")',\n...\n```\n\n:::\n\n#### Advanced example:\n\n::: code-group\n\n```js [nuxt.config.js]\nconst fs = require('fs')\n...\ninject: fs.readFileSync('./javascriptFileWithCodeToBeInjected.js', 'utf8'),\n...\n```\n\n:::\n\n## fcmPublicVapidKey\n\nAllows FCM to use the VAPID key credential when sending message requests to different push services, see more [here](https://firebase.google.com/docs/cloud-messaging/js/client).\n"
  },
  {
    "path": "packages/docs/docs/service-options/performance.md",
    "content": "# performance\n\n::: danger Client-only\n\nMake sure to wrap universal code in `if (process.client) {}`.\n\n:::\n\nInitializes **Firebase Performance** and makes it available via `$fire.performance` and `$fireModule.performance`.\n\n- Type: `Boolean`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nperformance: true\n```\n\n:::\n\nCurrently, there are no advanced options available.\n"
  },
  {
    "path": "packages/docs/docs/service-options/remote-config.md",
    "content": "# remoteConfig\n\n::: danger Client-only\n\nMake sure to wrap universal code in `if (process.client) {}`.\n\n:::\n\nInitializes **Firebase Remote Config** and makes it available via `$fire.remoteConfig` and `$fireModule.remoteConfig`.\n\n- Type: `Boolean` or `Object`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nremoteConfig: {\n  settings: {\n    fetchTimeoutMillis: 60000, // default\n    minimumFetchIntervalMillis: 43200000, // default\n  },\n  defaultConfig: {\n    'welcome_message': 'Welcome'\n  }\n}\n```\n\n:::\n"
  },
  {
    "path": "packages/docs/docs/service-options/storage.md",
    "content": "# storage\n\nInitializes **Firebase Storage** and makes it available via `$fire.storage` and `$fireModule.storage`.\n\n- Type: `Boolean`\n- Default: `false`\n\n::: code-group\n\n```js [nuxt.config.js]\nstorage: {\n  emulatorPort: 9199,\n  emulatorHost: 'localhost',\n}\n```\n\n:::\n\n## emulatorPort\n\n- Type: `Integer`\n- Default: `null`\n\nSets up `useEmulator(\"localhost:EMULATOR_PORT\")` to point to an Storage emulator running locally instead of the production one.\n\nMore information in the official Firebase [Guide to connect your app to the Cloud Storage Emulator](https://firebase.google.com/docs/emulator-suite/connect_storage).\n\n::: info\n\nTo not use the emulator in production you can do the following:\n\n```js\nemulatorPort: process.env.NODE_ENV === 'development' ? 9199 : undefined\n```\n\n:::\n\n## emulatorHost\n\n- Type: `String`\n- Default: `localhost`,\n\nChanges the host used for the Storage emulator. Only applies if the emulatorPort is set.\n"
  },
  {
    "path": "packages/docs/docs/tutorials/ssr.md",
    "content": "# Firebase Auth with SSR\n\nThis module provides an option for the easy setup of **server-side authentication** as described in [this article](https://firebase.google.com/docs/auth/web/service-worker-sessions) of the official Documentation.\n\n::: info Please Note:\n\nThis **does not authenticate the Firebase Client SDK on the server**. While you will be able to know if a user is logged in or not and have access to its simplified properties, you **won't be able to do authenticated calls** on server-side.\n\nThis means that all calls on server-side (e.g. fetching data via Firestore in fetch-hooks), which are protected by security rules, will still fail with _insufficient privileges._\n\nReason for this is that the Firebase JS SDK is a client-side library that is not built for authenticating multiple users. See steps 4 and 5 for an **experimental** approach to solve this issue.\n\n:::\n\n## Step 0 - Install Dependencies\n\nInstall `firebase-admin` and `@nuxtjs/pwa`:\n\n::: code-group\n\n```bash [yarn]\nyarn add firebase-admin @nuxtjs/pwa\n```\n\n```bash [npm]\nnpm install firebase-admin @nuxtjs/pwa\n```\n\n:::\n\n## Step 1 - Enable SSR functionality and configure workbox to include the auth service worker\n\nUse the [auth.ssr option](/service-options/auth#ssr).\n\nIn `nuxt.config.js`:\n\n::: code-group\n\n```js [nuxt.config.js]\nmodule.exports = {\n  // ...\n  modules: [\n    // ...\n    '@nuxtjs/pwa',\n    '@nuxtjs/firebase'\n  ],\n  firebase: {\n    // ...\n    services: {\n      auth: {\n        ssr: true\n      }\n      // ...\n    }\n  },\n  pwa: {\n    // disable the modules you don't need\n    meta: false,\n    icon: false,\n    // if you omit a module key form configuration sensible defaults will be applied\n    // manifest: false,\n\n    workbox: {\n      importScripts: [\n        // ...\n        '/firebase-auth-sw.js'\n      ],\n      // by default the workbox module will not install the service worker in dev environment to avoid conflicts with HMR\n      // only set this true for testing and remember to always clear your browser cache in development\n      dev: process.env.NODE_ENV === 'development',\n    }\n  }\n},\n```\n\n:::\n\n## Step 2 - Setup Mutations and/or Actions to handle User authentication\n\nIf you don't rely on a full `firebase.User` object you can reuse the client action/mutation configured for [`auth.initialize`](/service-options/auth#initialize).  \nSee [Step 3](#step-3---retrieve-the-server-user) to verify if required properties are present.\n\nExample action:\n\n```js\nasync onAuthStateChangedAction({ commit, dispatch }, { authUser, claims }) {\n  if (!authUser) {\n    await dispatch('cleanupAction')\n\n    return\n  }\n\n  // you can request additional fields if they are optional (e.g. photoURL)\n  const { uid, email, emailVerified, displayName, photoURL } = authUser\n\n  commit('SET_USER', {\n    uid,\n    email,\n    emailVerified,\n    displayName,\n    photoURL, // results in photoURL being undefined for server auth\n    // use custom claims to control access (see https://firebase.google.com/docs/auth/admin/custom-claims)\n    isAdmin: claims.custom_claim\n  })\n}\n```\n\nExample mutation:\n\n```js\nON_AUTH_STATE_CHANGED_MUTATION(state, { authUser, claims }) {\n  // you can request additional fields if they are optional (e.g. photoURL)\n  const { uid, email, emailVerified, displayName, photoURL } = authUser\n\n  state.authUser = {\n    uid,\n    displayName,\n    email,\n    emailVerified,\n    photoURL: photoURL || null, // results in photoURL being null for server auth\n    // use custom claims to control access (see https://firebase.google.com/docs/auth/admin/custom-claims)\n    isAdmin: claims.custom_claim\n  }\n}\n```\n\n## Step 3 - Retrieve the server user\n\nIn the nuxtServerInit action in your vuex store you can now access the authUser under the `res.locals.user` property as shown below.\n\n::: warning Be aware\n\nThe server user object is not a full `firebase.User`, since it is reproduced from the user claims, it provides only the following properties:\n\n- `uid`: The users uid\n- `email`: The users email\n- `emailVerified`: If the email was verified\n- `displayName`: The users display name\n- `allClaims`: All claims from the [admin.auth.DecodedIdToken](https://firebase.google.com/docs/reference/admin/node/admin.auth.DecodedIdToken)\n- `idToken`: The current idToken\n\n:::\n\n```js\n// Store action called nuxtServerInit:\nasync nuxtServerInit({ dispatch, commit }, { res }) {\n  if (res && res.locals && res.locals.user) {\n    const { allClaims: claims, idToken: token, ...authUser } = res.locals.user\n\n    await dispatch('onAuthStateChangedAction', {\n      authUser,\n      claims,\n      token\n    })\n\n    // or\n\n    commit('ON_AUTH_STATE_CHANGED_MUTATION', { authUser, claims, token })\n  }\n}\n```\n\nThat's it. You receive a server-verified authUser object and can do with it whatever you want in nuxtServerInit.\n\n## Step 4 - (Experimental) Authorize the admin SDK\n\n<!-- <experimental-alert></experimental-alert> -->\n\nIf you [authorize the admin SDK](/service-options/auth#firebase-admin-authorization) the authUser will be augmented to a full [`admin.auth.UserRecord`](https://firebase.google.com/docs/reference/admin/node/admin.auth.UserRecord) with an additional `allClaims` property.\n\n## Step 5 - (Experimental) Enable server side client SDK login\n\n<!-- <experimental-alert></experimental-alert> -->\n\nIf you need client SDK services for hydration on page load you can enable this feature in the [options](/service-options/auth#server-side-firebase-client-sdk-login).\n"
  },
  {
    "path": "packages/docs/docs/tutorials/typescript.md",
    "content": "# Usage with Typescript\n\nThe module comes with types by providing a declaration file (`index.d.ts`) within the npm package.\n\nAll you need to do is to include \"@nuxtjs/firebase\" in your tsconfig.json types like so:\n\n```jsonc\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"types\": [\n      \"node\",\n      \"@nuxt/types\",\n      // ...\n      \"@nuxtjs/firebase\"\n    ]\n  }\n}\n```\n\nDon't forget to restart your IDE (e.g. VSCODE) after adding the types.\n\n[nuxt-fire-demo](https://github.com/lupas/nuxt-fire-demo) shows working examples of nuxt-fire with Typescript.\n"
  },
  {
    "path": "packages/docs/docs/tutorials/vuexfire.md",
    "content": "# Usage with vuexfire\n\nVuexfire and this module work very well together.\n\nThis [example](https://github.com/lupas/nuxt-fire-vuexfire-example) shows how to use these two packages together, working with SSR.\n"
  },
  {
    "path": "packages/docs/package.json",
    "content": "{\n  \"name\": \"@nuxtjs/firebase-docs\",\n  \"version\": \"8.2.2\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"directories\": {\n    \"doc\": \"docs\"\n  },\n  \"scripts\": {\n    \"dev\": \"vitepress dev docs\",\n    \"build\": \"vitepress build docs\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"vitepress\": \"^1.0.0-alpha.51\",\n    \"vue\": \"^3.2.47\"\n  },\n  \"dependencies\": {\n    \"focus-visible\": \"^5.2.0\",\n    \"sass\": \"^1.58.3\"\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/.editorconfig",
    "content": "# editorconfig.org\nroot = true\n\n[*]\nindent_size = 2\nindent_style = space\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "packages/firebase-module/.eslintignore",
    "content": "# Common\nnode_modules\ndist\n.nuxt\ncoverage\n\n# Plugin\nlib/plugins/*.js\nlib/plugins/services/*.js\nlib/serverMiddleware/*.js\nlib/sw-templates/*.js\ntypes/index.d.ts\n"
  },
  {
    "path": "packages/firebase-module/.eslintrc.js",
    "content": "module.exports = {\n  root: true,\n  parserOptions: {\n    parser: 'babel-eslint'\n  },\n  extends: [\n    'prettier',\n    'prettier/vue',\n    'plugin:prettier/recommended',\n    '@nuxtjs'\n  ]\n}\n"
  },
  {
    "path": "packages/firebase-module/.gitignore",
    "content": "node_modules\n*.iml\n.idea\n*.log*\n.nuxt*\n.vscode\n.DS_Store\ncoverage\ndist\n\nyarn.lock\n!docs/yarn.lock\nsw.*\n.husky"
  },
  {
    "path": "packages/firebase-module/.prettierrc.js",
    "content": "module.exports = {\n  singleQuote: true,\n  arrowParens: 'always',\n  semi: false,\n}\n"
  },
  {
    "path": "packages/firebase-module/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n### [8.2.2](https://github.com/nuxt-community/firebase-module/compare/v8.2.0...v8.2.2) (2022-01-24)\n\n## [8.2.0](https://github.com/nuxt-community/firebase-module/compare/v8.1.1...v8.2.0) (2022-01-11)\n\n\n### Features\n\n* **demo:** added appcheck to demop ([f62bfc1](https://github.com/nuxt-community/firebase-module/commit/f62bfc19291fa35692f8dbb03976515876ad096a))\n\n\n### Bug Fixes\n\n* add lazy load to app check and fix collection is not a function (by eljias) ([6c0c1d1](https://github.com/nuxt-community/firebase-module/commit/6c0c1d11bf480bae0601db236f809a5bdedfd7e3))\n\n### [8.1.1](https://github.com/nuxt-community/firebase-module/compare/v8.1.0...v8.1.1) (2021-12-02)\n\n## [8.1.0](https://github.com/nuxt-community/firebase-module/compare/v8.0.0...v8.1.0) (2021-11-30)\n\n### Features\n\n- updated readme ([93ca96b](https://github.com/nuxt-community/firebase-module/commit/93ca96bd59356b108647e216192f85dbcf74629e))\n\n### Bug Fixes\n\n- fixed import error in terminateDatabasesInGenerateHooks ([326af38](https://github.com/nuxt-community/firebase-module/commit/326af3863334a3ae62fb510af19e3cff8fa2bf84))\n\n## [8.0.0](https://github.com/nuxt-community/firebase-module/compare/v8.0.1...v8.0.0) (2021-10-30)\n\n### [7.6.1](https://github.com/nuxt-community/firebase-module/compare/v7.6.0...v7.6.1) (2021-06-11)\n\n### Features\n\n- add storage emulators ([348900d](https://github.com/nuxt-community/firebase-module/commit/348900d4fc86da1ff3166fe20b4c902e4f13df8d))\n- **docs:** Updated to use docus ([e629931](https://github.com/nuxt-community/firebase-module/commit/e629931cef9bad76ff2a4427c67df720285f9a38))\n\n### Bug Fixes\n\n- add type for $fireAuthStore ([bacdae9](https://github.com/nuxt-community/firebase-module/commit/bacdae907201a20432603983541f0327d9223702))\n- **docs:** Minor fixes & color update ([2631eb6](https://github.com/nuxt-community/firebase-module/commit/2631eb6e4104f2fc8a9a8aec8cb91972026f2a55))\n- **docs:** Nuxt down to 2.14.11 ([6978c43](https://github.com/nuxt-community/firebase-module/commit/6978c434814c7567fb0dcd89fd814845d6f1a941))\n- **docs:** Use bebel preset-env 7.12.7 ([5b48d8f](https://github.com/nuxt-community/firebase-module/commit/5b48d8f57972668b6f0be11ebecb9570d752f602))\n- **docs:** use nuxt v 2.14.12 for docs ([549e35e](https://github.com/nuxt-community/firebase-module/commit/549e35e44b6d089f6a3d3faa175a0fc3d999366d))\n\n## [7.5.0](https://github.com/nuxt-community/firebase-module/compare/v7.4.1...v7.5.0) (2021-02-18)\n\n### Features\n\n- **terminatedatabasesaftergenerate:** added 'terminateDatabasesAfterGenerate' config ([4df37a7](https://github.com/nuxt-community/firebase-module/commit/4df37a7add07caa711d556fc00c331ffe66e164e)), closes [#451](https://github.com/nuxt-community/firebase-module/issues/451)\n\n### Bug Fixes\n\n- **config:** made \"databaseUrl\" config value optional ([fbb4a7d](https://github.com/nuxt-community/firebase-module/commit/fbb4a7d92be913a81905a36405ee6cc80bdf2a67)), closes [#458](https://github.com/nuxt-community/firebase-module/issues/458)\n- **firestore:** call useEmulator after enablePersistence to fix \"already started\" issue ([bc16b45](https://github.com/nuxt-community/firebase-module/commit/bc16b45a712e3c6400f7c9f8fa1af4233679b46c)), closes [#451](https://github.com/nuxt-community/firebase-module/issues/451)\n\n### [7.4.1](https://github.com/nuxt-community/firebase-module/compare/v7.4.0...v7.4.1) (2021-01-20)\n\n### Bug Fixes\n\n- **auth:** fixes build error appearing when auth.initialize is not set ([71c3fb0](https://github.com/nuxt-community/firebase-module/commit/71c3fb024fe0795cfa67f4230dd1634acb785ac1)), closes [#446](https://github.com/nuxt-community/firebase-module/issues/446)\n\n## [7.4.0](https://github.com/nuxt-community/firebase-module/compare/v7.3.3...v7.4.0) (2021-01-19)\n\n### Features\n\n- **auth:** added onIdTokenChanged() handlers to auth.initialize ([fcf0846](https://github.com/nuxt-community/firebase-module/commit/fcf08463621b36e597dc31d9c542c46632a5beb9)), closes [#411](https://github.com/nuxt-community/firebase-module/issues/411)\n\n### [7.3.3](https://github.com/nuxt-community/firebase-module/compare/v7.3.2...v7.3.3) (2021-01-18)\n\n### Bug Fixes\n\n- **forceinject:** fixed issue in lazy-mode that did not allow to initialize services in nuxt plugins ([c5b5cb3](https://github.com/nuxt-community/firebase-module/commit/c5b5cb34148bda432d1320567cf5a9118bb394b0)), closes [#366](https://github.com/nuxt-community/firebase-module/issues/366)\n\n### [7.3.2](https://github.com/nuxt-community/firebase-module/compare/v7.3.1...v7.3.2) (2021-01-17)\n\n### Bug Fixes\n\n- **forceinject:** fixed forceInject failing when ...ready() is called in a plugin in lazy mode ([c15222f](https://github.com/nuxt-community/firebase-module/commit/c15222fb3374aa7abadac9ed59c7fd4935d9d19a)), closes [#366](https://github.com/nuxt-community/firebase-module/issues/366)\n\n### [7.3.1](https://github.com/nuxt-community/firebase-module/compare/v7.3.0...v7.3.1) (2021-01-17)\n\n### Bug Fixes\n\n- **lazy:** fixed fireModule not being injected if ready() functions are only called in V-components ([3f37365](https://github.com/nuxt-community/firebase-module/commit/3f37365dfa5091244569710f3865c00018468e71)), closes [#366](https://github.com/nuxt-community/firebase-module/issues/366)\n\n## [7.3.0](https://github.com/nuxt-community/firebase-module/compare/v7.2.3...v7.3.0) (2020-12-28)\n\n### Features\n\n- **messaging sw:** allow users to inject a string into the messaging sw ([7e6174f](https://github.com/nuxt-community/firebase-module/commit/7e6174fc50aebc88f48228630580b9ede88fdcb1))\n\n### [7.2.3](https://github.com/nuxt-community/firebase-module/compare/v7.2.2...v7.2.3) (2020-12-28)\n\n### [7.2.2](https://github.com/nuxt-community/firebase-module/compare/v7.2.1...v7.2.2) (2020-12-23)\n\n### Bug Fixes\n\n- **auth:** fixed issue where Firestore did not work in SSR because of Auth not being initialized ([9482f16](https://github.com/nuxt-community/firebase-module/commit/9482f1650c31050265febd558d79d345791100d5))\n- **firestore-emulator:** fixed issue that caused useEmulator to be triggered multiple times in SSR ([ebac666](https://github.com/nuxt-community/firebase-module/commit/ebac6669524100fe303e4ba30a69b332f241fb85)), closes [#390](https://github.com/nuxt-community/firebase-module/issues/390)\n- **messaging:** fixed error with onFirebaseHosting in sw trying to load scripts from /\\_\\_/ on lh ([383b9cd](https://github.com/nuxt-community/firebase-module/commit/383b9cdeb10c26233c4f8e73f0cedda31d7486d6)), closes [#379](https://github.com/nuxt-community/firebase-module/issues/379)\n\n### [7.2.1](https://github.com/nuxt-community/firebase-module/compare/v7.2.0...v7.2.1) (2020-12-22)\n\n### Bug Fixes\n\n~~\\* **auth**: fixed 'auth' being initialized on server-side, which lead to a memory leak in SSR mode (daa9b9e), closes #399~~\n\n⚠️⚠️⚠️ Release had a bug, please upgrade to v7.2.2. ⚠️⚠️\n\n## [7.2.0](https://github.com/nuxt-community/firebase-module/compare/v7.1.2...v7.2.0) (2020-12-22)\n\n### Features\n\n- **auth:** added disableEmulatorWarnings option ([1de60b9](https://github.com/nuxt-community/firebase-module/commit/1de60b9c3cd4ea22df28beaf3a3646a8315fb5e6)), closes [#415](https://github.com/nuxt-community/firebase-module/issues/415)\n\n### [7.1.2](https://github.com/nuxt-community/firebase-module/compare/v7.1.1...v7.1.2) (2020-12-08)\n\n### Bug Fixes\n\n- **types:** fixed fcmPublicVapidKey not correctly placed in .d.ts ([0c5c4a7](https://github.com/nuxt-community/firebase-module/commit/0c5c4a7077009294e60797dc3d4d0923bb907cf3))\n\n### [7.1.1](https://github.com/nuxt-community/firebase-module/compare/v7.1.0...v7.1.1) (2020-11-14)\n\n### Bug Fixes\n\n- **auth-emulator-ssr:** call useEmulator in auth ssr service-worker, if emulator is in use ([004e696](https://github.com/nuxt-community/firebase-module/commit/004e696e90c0be06573a9038439fb910efaee84f))\n\n## [7.0.0](https://github.com/nuxt-community/firebase-module/compare/v6.1.1...v7.0.0) (2020-10-31)\n\n## [7.1.0](https://github.com/nuxt-community/firebase-module/compare/v7.0.2...v7.1.0) (2020-11-05)\n\n### Features\n\n- **emulators:** added options to connect to emulators for Firestore & RealtimeDB ([c724e1c](https://github.com/nuxt-community/firebase-module/commit/c724e1c3245620a62f54529b3929ea79f75c938f))\n\n### [7.0.2](https://github.com/nuxt-community/firebase-module/compare/v7.0.1...v7.0.2) (2020-11-05)\n\n### Bug Fixes\n\n- **messaging:** fixed \"actions\" not properly passed to messaging-sw ([53d48f7](https://github.com/nuxt-community/firebase-module/commit/53d48f7db7c2b2af5bbf9870a19e01804053f139))\n- found action is always first action ([31d0586](https://github.com/nuxt-community/firebase-module/commit/31d058611786b514e085f48d71f44120ef83559c))\n\n## [7.0.1](https://github.com/nuxt-community/firebase-module/compare/v7.0.0...v7.0.1) (2020-11-05)\n\n### Bug Fixes\n\n- **types:** added missing types (emulatorHost etc.) ([2a76c6b](https://github.com/nuxt-community/firebase-module/commit/eec46c5ea92561076c4d6013750c0b708dbd981f))\n\n## [7.0.0](https://github.com/nuxt-community/firebase-module/compare/v6.1.1...v7.0.0) (2020-10-31)\n\n### Features\n\n- **analytics.issupported:** added check whether browser supports Firebase Analytics before init ([52ec6ef](https://github.com/nuxt-community/firebase-module/commit/52ec6efa6c1cfbd0ddaac4a73676f948da4d807e))\n- **auth:** added initialize.subscribeManually and removed \"helper\" function ([91ad279](https://github.com/nuxt-community/firebase-module/commit/91ad2792f142f7fcf22f0775242dc7330e485230))\n- **firebase-v8:** updated code to work with Firebase v8+ ([4ae48b5](https://github.com/nuxt-community/firebase-module/commit/4ae48b51bc35f007c89bcc46febeded30f288893))\n- **functions:** added emulatorHost option to Firebase Functions ([08db302](https://github.com/nuxt-community/firebase-module/commit/08db302013fdac1213e783f6cd860ca62cc15cbe))\n- add support for lazy service loading ([4e96d28](https://github.com/nuxt-community/firebase-module/commit/4e96d28a43014c85a01a0c4c953f756bd2ec0812))\n\n### Bug Fixes\n\n- **analytics:** Fixed service naming issue ([addd317](https://github.com/nuxt-community/firebase-module/commit/addd317c7abf4ea9d70bd17943411f11cdaefac4))\n- **auth:** Fixed initialize ([c4b203d](https://github.com/nuxt-community/firebase-module/commit/c4b203d5a6d1aea521e70097a47c1b104b02c044))\n- **auth-credential:** fixed auth-credential import (require) ([faeed48](https://github.com/nuxt-community/firebase-module/commit/faeed4803908d7a262ac73759b1608ad91a6ef95))\n- **auth-serverlogin:** fixed serverLogin issue (ctx.res missing) ([edd1a75](https://github.com/nuxt-community/firebase-module/commit/edd1a755401fcd25886644554325dcaf6778e89d))\n- **fireObj:** fireObj was not injected in non-lazy + non-legacy mode ([dc66991](https://github.com/nuxt-community/firebase-module/commit/dc6699171c1e35552f7a02f093adb4ac329b9f46))\n- **initauth:** async import of initAuth within auth plugin ([36eb8f4](https://github.com/nuxt-community/firebase-module/commit/36eb8f490797f9cc7a03216f18806c1a93cd8700))\n- **initAuth:** Fixed mmissing options in initAuth & small lazy mode fix ([8e54384](https://github.com/nuxt-community/firebase-module/commit/8e54384dd1109439a0c33f358b1c30a009a27002))\n- **legacymodeinfo:** fixed error 'Cannot use 'in' operator to search for 'legacyMode' in undefined ' ([0684e64](https://github.com/nuxt-community/firebase-module/commit/0684e64bb708a2b4fdee23b2c3a6d8f73f117a68))\n- **loggerinfo:** added module name to legyMode info log because it's not clear on multi-line log ([cb85c29](https://github.com/nuxt-community/firebase-module/commit/cb85c291dec1508068b34b5d363bde601cdd1318))\n- **naming:** Improved readability by consistanly naming services constants ([0d62e76](https://github.com/nuxt-community/firebase-module/commit/0d62e7618df69bb63fca01b7f3a3a214ed32d280))\n- **netlify:** updated netlify.toml ([26f5aa9](https://github.com/nuxt-community/firebase-module/commit/26f5aa9aaa0ad1ff4dc6903178547acc1904097c))\n- **packageejson:** missing comma ([a6669fc](https://github.com/nuxt-community/firebase-module/commit/a6669fc872751077b3b089648e76276ac20f1512))\n- **remoteconfig:** fixed 'defaultConfig' being child of 'settings' instead of main obj ([7e1020c](https://github.com/nuxt-community/firebase-module/commit/7e1020c3c024c2b938f8a339a38d700036f46605))\n- **static:** fixed static=true also dynamically importing the modules ([cf61833](https://github.com/nuxt-community/firebase-module/commit/cf61833da715799cf88914d45b8eed62993d6933))\n- **ts:** Added ready() to $fire and added missing 'storage' ([bb78d3a](https://github.com/nuxt-community/firebase-module/commit/bb78d3a6e3348430201a0c8cf5220b981e6603db))\n- **ts:** Fixed $fire.database ([6bd9df9](https://github.com/nuxt-community/firebase-module/commit/6bd9df9560436d3db59afaa8a88391a779024520))\n- make initAuth work again ([db8a467](https://github.com/nuxt-community/firebase-module/commit/db8a467db2e865c4ea0c570cce276bf635400368))\n- review comments ([f5265ae](https://github.com/nuxt-community/firebase-module/commit/f5265aecf210978ce333d6bd7621676a4ad12719))\n- use existing injection name ([a6971ac](https://github.com/nuxt-community/firebase-module/commit/a6971acc0d440b3553975e40a09d819d0d8c1077))\n- use service mapping ([33489a1](https://github.com/nuxt-community/firebase-module/commit/33489a17a1f35d95680f79ac98d31a16c1412df5))\n- use service mapping ([bd16287](https://github.com/nuxt-community/firebase-module/commit/bd1628735f333b448562b9eda5cc5a9d3e9d9e06))\n\n### [6.1.1](https://github.com/nuxt-community/firebase-module/compare/v6.1.0...v6.1.1) (2020-07-25)\n\n### Bug Fixes\n\n- **types:** improve typing of locals ([407eb2c](https://github.com/nuxt-community/firebase-module/commit/407eb2cd492adac282fd869d32eb9a2095e6060d))\n\n## [6.1.0](https://github.com/nuxt-community/firebase-module/compare/v6.0.1...v6.1.0) (2020-06-29)\n\n### Features\n\n- **analytics:** added collectionEnabled option to analytics ([5da8a19](https://github.com/nuxt-community/firebase-module/commit/5da8a19e1b6b70f78c5d9701ecd71d767a4a4627))\n\n### Bug Fixes\n\n- typo in README ([c0158c9](https://github.com/nuxt-community/firebase-module/commit/c0158c90abeeceb2e39aa7c5322a365988de0623))\n\n### [6.0.1](https://github.com/nuxt-community/firebase-module/compare/v6.0.0...v6.0.1) (2020-06-08)\n\n### Bug Fixes\n\n- **bug:** fixed \"Cannot read property 'memoryOnly' of undefined\" bug ([8f69cc3](https://github.com/nuxt-community/firebase-module/commit/8f69cc3681fbb9eab51817bcdcb5d9bc8240178e)), closes [#224](https://github.com/nuxt-community/firebase-module/issues/224)\n\n## [6.0.0](https://github.com/nuxt-community/firebase-module/compare/v5.2.0...v6.0.0) (2020-06-07)\n\n### ⚠ BREAKING CHANGES\n\n- **messaging:** Messaging expects payloads to be delivered according to the new HTTP v1 API.\n\n### Features\n\n- **auth:** add idToken to user's payload ([97d8055](https://github.com/nuxt-community/firebase-module/commit/97d805591cbc3073417f755e0ae9e6c0ed20bed3)), closes [#202](https://github.com/nuxt-community/firebase-module/issues/202)\n- **firestore:** added memoryOnly option to firestore ([efde3fe](https://github.com/nuxt-community/firebase-module/commit/efde3fedb448cc60661a3cf5f67e5d13b195d578)), closes [#135](https://github.com/nuxt-community/firebase-module/issues/135)\n- **messaging:** implement notificationKey setting ([a985f02](https://github.com/nuxt-community/firebase-module/commit/a985f02e5e45b4c5c64bc4597bf9a41650f23bda))\n- **messaging:** migrated to HTTP v1 API for messaging ([9c09a26](https://github.com/nuxt-community/firebase-module/commit/9c09a266472d90e9f9809312006476addddab64e))\n\n### Bug Fixes\n\n- **auth:** add 127.0.0.1 support ([c8b6114](https://github.com/nuxt-community/firebase-module/commit/c8b6114582cc1acc478b886bf5f05c5d05209fed)), closes [#203](https://github.com/nuxt-community/firebase-module/issues/203)\n- **messaging:** only pass notificationKey to messaging sw ([5958b25](https://github.com/nuxt-community/firebase-module/commit/5958b251dcffeb5002408f4e275ad41886224b1c))\n- **types:** specify preliminary types ([d03799c](https://github.com/nuxt-community/firebase-module/commit/d03799c87f23352bf9404a3abbafad98267fc43d))\n\n## [5.2.0](https://github.com/nuxt-community/firebase-module/compare/v5.0.7...v5.2.0) (2020-05-01)\n\n### Features\n\n- **auth:** implement full ssr support ([17c0968](https://github.com/nuxt-community/firebase-module/commit/17c09686deb471da6faddcec16e140ab3013bdbd))\n- **auth:** implement session manager ([5106f44](https://github.com/nuxt-community/firebase-module/commit/5106f448c3b15d14143f7e29f354f0fe47e929c9))\n\n### Bug Fixes\n\n- **helpers:** helper plugins are now exported as CommonJS instaed of ES6 ([806ecce](https://github.com/nuxt-community/firebase-module/commit/806ecce0a3b85478ef71a383e6a64c018c1b76e2))\n- **main:** move messaging support check below import statement ([ca02c10](https://github.com/nuxt-community/firebase-module/commit/ca02c1061840f6bf652fe2ef9c36b7050dcfb0ad))\n- **main:** remove references to removed session manager template ([9bf87a3](https://github.com/nuxt-community/firebase-module/commit/9bf87a32b73d07a9f64c58a1163d78df20e5c548))\n- **manager:** use common js syntax for module imports/exports ([be6ac76](https://github.com/nuxt-community/firebase-module/commit/be6ac76ebd7d235c92b1195226e1000041a9fe19))\n- **module:** remove unnecessary deps and simplify options resolution ([2501896](https://github.com/nuxt-community/firebase-module/commit/25018966f1ce52de8fdaa9685efe511b65ea6968))\n- **ssr:** avoid using session manager for simple user injection ([8f26383](https://github.com/nuxt-community/firebase-module/commit/8f26383577c9fdc8edb1ccf9e6328fc0a4f1ec4c))\n- **ssr:** check for req existence in ssr auth calls ([675aeed](https://github.com/nuxt-community/firebase-module/commit/675aeedecd70b1461d155b07689ca238ba5ed083))\n- **templates:** improve type checks for more stability ([11d1f25](https://github.com/nuxt-community/firebase-module/commit/11d1f25ed3303aef24f0f7b159ec509de402d5ea))\n- **types:** update credential option to allow ServiceAccount object ([427347d](https://github.com/nuxt-community/firebase-module/commit/427347d3a60f6bd07beb4f54ea7ed7b64e58e3cb))\n- syntax on firebase module ([d3da4e9](https://github.com/nuxt-community/firebase-module/commit/d3da4e9506e9abce72ab345d22cbeada01ed91a9))\n\n### [5.0.7](https://github.com/nuxt-community/firebase-module/compare/v5.0.6...v5.0.7) (2020-04-06)\n\n### Bug Fixes\n\n- **ssr-auth:** fixed a regression bug in ssr auth ([01411b3](https://github.com/nuxt-community/firebase-module/commit/01411b3fcfe3300065aaf1fff443eb83928ac755))\n\n### [5.0.6](https://github.com/nuxt-community/firebase-module/compare/v5.0.5...v5.0.6) (2020-03-30)\n\n### Bug Fixes\n\n- **auth:** move ssrAuth plugin to the bottom of the module ([b7d5fe3](https://github.com/nuxt-community/firebase-module/commit/b7d5fe3bff89ff434c957411e7d1da438bd88a74))\n\n### [5.0.5](https://github.com/nuxt-community/firebase-module/compare/v5.0.4...v5.0.5) (2020-03-30)\n\n### [5.0.4](https://github.com/nuxt-community/firebase-module/compare/v5.0.3...v5.0.4) (2020-03-30)\n\n### Bug Fixes\n\n- **auth:** use plugin instead of middleware for ssr authentication ([9171b34](https://github.com/nuxt-community/firebase-module/commit/9171b34c75ba7b048a2270f00d41206f7daf2cb1))\n\n### [5.0.3](https://github.com/nuxt-community/firebase-module/compare/v5.0.2...v5.0.3) (2020-03-18)\n\n### [5.0.2](https://github.com/nuxt-community/firebase-module/compare/v5.0.1...v5.0.2) (2020-03-16)\n\n### [5.0.1](https://github.com/nuxt-community/firebase-module/compare/v5.0.0...v5.0.1) (2020-03-15)\n\n### Bug Fixes\n\n- **module:** fix firebase-auth-sw only loaded when serverLogin === true ([35c434b](https://github.com/nuxt-community/firebase-module/commit/35c434b4a36cf69b72e4ee03828b04eb10217997))\n\n## [5.0.0](https://github.com/nuxt-community/firebase-module/compare/v4.2.2...v5.0.0) (2020-03-15)\n\n### ⚠ BREAKING CHANGES\n\n- **auth:** moved sessionLifetime configuration key\n- **auth:** moved configuration key\n- **auth:** api changes\n- **auth:** success mutation/action properties removed in lieu of sign in/out mutations/actions\n- **auth:** set user object on res.locals.user as stipulated with @lupas\n\n### Features\n\n- **auth:** finialize server auth after tests ([2f829a4](https://github.com/nuxt-community/firebase-module/commit/2f829a4fd25d0999c14c9b5fb7b613f8a96c641a))\n- **auth:** implement ignorePaths config for ssr functionality ([82a6c2d](https://github.com/nuxt-community/firebase-module/commit/82a6c2dcd8ebf895e9f9d8c71f6327642120d680)), closes [#87](https://github.com/nuxt-community/firebase-module/issues/87) [#117](https://github.com/nuxt-community/firebase-module/issues/117)\n- **auth:** implement persistence preset for auth service ([b576f23](https://github.com/nuxt-community/firebase-module/commit/b576f23e3dffccb0874b4a6572e097d80a9d886a)), closes [#122](https://github.com/nuxt-community/firebase-module/issues/122)\n- **auth:** implement server side authentication ([b545b74](https://github.com/nuxt-community/firebase-module/commit/b545b7495dfd4f696fd4972a7919c3a2784bd36c))\n- **auth:** implement server side client sdk sessions ([3e07b01](https://github.com/nuxt-community/firebase-module/commit/3e07b0128410c594b0d3eaab3dddd25fd0cb314e))\n- **auth:** implement sign in/out mutations and actions ([4b4800e](https://github.com/nuxt-community/firebase-module/commit/4b4800e2cc328f62952ebe062c4519b08d97a24b)), closes [#118](https://github.com/nuxt-community/firebase-module/issues/118)\n- **auth:** simplify auth state changed handler ([02b13a2](https://github.com/nuxt-community/firebase-module/commit/02b13a244c2aa44bc23dcebe065cb900984d6c58))\n\n### Bug Fixes\n\n- **auth:** update createServerMiddleware function to be default export ([1d6eb46](https://github.com/nuxt-community/firebase-module/commit/1d6eb464c04d4189fcbdd72cba3dd4be12823d87))\n- **auth:** update import statement to point to correct file ([2e299af](https://github.com/nuxt-community/firebase-module/commit/2e299afa81278dec40919b0b6d8ef215d71e89a4))\n- **auth:** update variable names in render:routeDone ([a93ed39](https://github.com/nuxt-community/firebase-module/commit/a93ed39cc00b67e2b16da17a5a5b66bb0c9403c0))\n- **auth:** use error logger on auth verification failure ([82e1a82](https://github.com/nuxt-community/firebase-module/commit/82e1a82763b8cb63fc32b17c0fb89dae39ab2c02))\n- **types:** augment correct interface in http module ([7704581](https://github.com/nuxt-community/firebase-module/commit/7704581c9286b1f9f2d086c0893b91e6d6c2a925))\n- **types:** update AuthServiceConfig interface ([577c880](https://github.com/nuxt-community/firebase-module/commit/577c880c5c397ae89df8fb7f95c12e9c5d220ab2))\n- **types:** update server response augmentation ([0419d12](https://github.com/nuxt-community/firebase-module/commit/0419d129936689df2773edddfd89538814d0ac1e))\n- **types:** update types to make ssr options optional ([99bfcde](https://github.com/nuxt-community/firebase-module/commit/99bfcdea9b906e0354f93f4e00c6e236be7a2068))\n\n- **auth:** update documentation ([316894b](https://github.com/nuxt-community/firebase-module/commit/316894b47aafcc53e7f1497608db1f3bf935759a))\n\n### [4.2.2](https://github.com/nuxt-community/firebase-module/compare/v4.2.1...v4.2.2) (2020-03-10)\n\n### [4.2.1](https://github.com/nuxt-community/firebase-module/compare/v4.2.0...v4.2.1) (2020-03-10)\n\n## [4.2.0](https://github.com/nuxt-community/firebase-module/compare/v4.1.0...v4.2.0) (2020-03-10)\n\n### Features\n\n- add option to add fireStore.settings() in nuxt.config.js ([21e32c1](https://github.com/nuxt-community/firebase-module/commit/21e32c1d57457370efc0a8e679033335ee656c09))\n\n### Bug Fixes\n\n- updated firebase version for firebase-auth-sw ([2d460a8](https://github.com/nuxt-community/firebase-module/commit/2d460a856fb234a4f9e005c85a7029baadccde01))\n\n## [4.1.0](https://github.com/nuxt-community/firebase-module/compare/v4.0.0...v4.1.0) (2020-02-28)\n\n### Features\n\n- use consola instead of console ([1d209d8](https://github.com/nuxt-community/firebase-module/commit/1d209d8cb62c549f562036bf7e60690e15bcdbf6))\n\n### Bug Fixes\n\n- add types ([cd8ef74](https://github.com/nuxt-community/firebase-module/commit/cd8ef7470ff7c2844f58c540a4d302a76f3c2ad8))\n- added links to license ([d3320e8](https://github.com/nuxt-community/firebase-module/commit/d3320e8ce57fa7bc11e6bfb4a246fc1f59771152))\n- delete broken \"related\" link ([e845d40](https://github.com/nuxt-community/firebase-module/commit/e845d4001114f0d3fa1727dc01d72541cd08eec6))\n- re-added unintentionally removed isEmpty() ([559b510](https://github.com/nuxt-community/firebase-module/commit/559b5101e4927a41fb0c105abdede7a443668eb3))\n"
  },
  {
    "path": "packages/firebase-module/babel.config.js",
    "content": "module.exports = {\n  env: {\n    test: {\n      plugins: ['@babel/plugin-syntax-dynamic-import', 'dynamic-import-node'],\n      presets: [\n        [\n          '@babel/preset-env',\n          {\n            targets: {\n              node: 'current',\n            },\n          },\n        ],\n      ],\n    },\n  },\n}\n"
  },
  {
    "path": "packages/firebase-module/commitlint.config.js",
    "content": "module.exports = {\n  extends: [\n    '@commitlint/config-conventional'\n  ]\n}\n"
  },
  {
    "path": "packages/firebase-module/husky.config.js",
    "content": "module.exports = {\n  hooks: {\n    'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',\n    'pre-commit': 'yarn lint',\n    'pre-push': 'yarn lint'\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/jest.config.js",
    "content": "module.exports = {\n  collectCoverage: true,\n  collectCoverageFrom: [\n    'lib/**/*.js',\n    '!lib/plugins/**/*.js',\n    '!lib/serverMiddleware/*.js',\n    '!lib/sw-templates/*.js',\n  ],\n  moduleFileExtensions: ['ts', 'js', 'json'],\n  testEnvironment: 'node',\n  transform: {\n    '^.+\\\\.js$': 'babel-jest',\n  },\n  transformIgnorePatterns: ['node_modules'],\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/module.js",
    "content": "const { resolve } = require('path')\nconst firebase = require('firebase/compat/app')\nconst logger = require('./utils/logger')\nconst templateUtils = require('./utils/template-utils')\n\nconst r = (...path) => resolve(__dirname, ...path)\n\nmodule.exports = function (moduleOptions) {\n  const defaultOptions = {\n    injectModule: true,\n  }\n\n  const options = Object.assign(\n    defaultOptions,\n    this.options.firebase,\n    moduleOptions\n  )\n  const currentEnv = getCurrentEnv(options)\n\n  validateOptions(options)\n\n  options.config = getFinalUseConfigObject(options.config, currentEnv)\n  validateConfigKeys(options, currentEnv)\n\n  // Assign some defaults\n  options.services.app = Object.assign({ static: false }, options.services.app)\n  for (const service in options.services) {\n    if (options.services[service] === true) {\n      // If a service is enabled always set an object\n      // so we dont have to bother about this in the\n      // service templates\n      options.services[service] = {}\n    }\n  }\n\n  loadMessaging.call(this, options)\n  const loadAuthPlugin = loadAuth.call(this, options)\n\n  const enabledServices = []\n  for (const serviceMapping of Object.values(templateUtils.serviceMappings)) {\n    // Note: app is always set, see defaults above\n    const serviceOptions = options.services[serviceMapping.id]\n    if (!serviceOptions) {\n      continue\n    }\n\n    this.addTemplate({\n      src: r(`plugins/services/${serviceMapping.id}.js`),\n      fileName: `firebase/${serviceMapping.id === 'app' ? '' : 'service.'}${\n        serviceMapping.id\n      }.js`,\n      options: {\n        ...options,\n        ...templateUtils,\n        serviceMapping,\n        serviceOptions,\n      },\n    })\n\n    if (serviceMapping.id !== 'app') {\n      enabledServices.push(serviceMapping)\n    }\n  }\n\n  // Register main firebase-module plugin\n  this.addPlugin({\n    src: r('plugins/main.js'),\n    fileName: 'firebase/index.js',\n    options: {\n      ...options,\n      ...templateUtils,\n      enabledServices,\n    },\n  })\n\n  // add ssrAuth plugin last\n  // so res object is augmented for other plugins of this module\n  loadAuthPlugin()\n\n  // Terminate Database after Nuxt Generate\n  if (options.terminateDatabasesAfterGenerate) {\n    terminateDatabasesInGenerateHooks(this)\n  }\n}\n\n/**\n * Helper function to add service-worker templates\n */\nfunction addServiceWorker(\n  { config, onFirebaseHosting = false },\n  templateFile,\n  templateOptions = {}\n) {\n  // Add Service Worker Template\n  this.addTemplate({\n    src: r(`sw-templates/${templateFile}`),\n    fileName: resolve(\n      this.options.srcDir,\n      this.options.dir.static,\n      templateFile\n    ),\n    options: {\n      firebaseVersion: firebase.SDK_VERSION,\n      config,\n      loadFromFirebaseHosting:\n        process.env.NODE_ENV === 'production' ? onFirebaseHosting : false,\n      ...templateOptions,\n    },\n  })\n}\n\n/**\n * Adds the messaging service worker template if needed\n */\nfunction loadMessaging(options) {\n  const { messaging } = options.services\n  if (!messaging || !messaging.createServiceWorker) {\n    return\n  }\n\n  addServiceWorker.call(this, options, 'firebase-messaging-sw.js', {\n    actions: messaging.actions,\n    inject: messaging.inject,\n  })\n}\n\n/**\n * Handles server side authentication & client side auth initialization\n */\nfunction loadAuth(options) {\n  const { auth } = options.services\n  const noop = (_) => _\n\n  if (!auth) {\n    return noop\n  }\n\n  if (!isEmpty(auth.initialize)) {\n    // Register initAuth plugin\n    if (options.lazy || auth.initialize.subscribeManually) {\n      this.addTemplate({\n        src: r('plugins/services/auth.initialize.js'),\n        fileName: 'firebase/service.auth.initialize.js',\n      })\n    } else {\n      this.addPlugin({\n        src: r('plugins/services/auth.initialize.js'),\n        fileName: 'firebase/service.auth.initialize.js',\n      })\n    }\n  }\n\n  // Early return when ssr auth is not needed\n  if (!auth.ssr) {\n    return noop\n  }\n\n  const ssrConfig = Object.assign({}, auth.ssr)\n  options.sessions = false\n\n  // Resolve credential setting\n  const credential =\n    typeof ssrConfig.credential === 'string'\n      ? this.nuxt.resolver.resolveAlias(ssrConfig.credential)\n      : ssrConfig.credential || false\n\n  // Add Service-Worker\n  addServiceWorker.call(this, options, 'firebase-auth-sw.js', {\n    authOptions: options.services.auth,\n    ignorePaths: [\n      '/__webpack_hmr',\n      '/_loading',\n      this.options.build.publicPath,\n      ...(ssrConfig.ignorePaths || []),\n    ],\n  })\n\n  if (ssrConfig.serverLogin && credential) {\n    options.sessions = Object.assign({}, ssrConfig.serverLogin)\n\n    this.addPlugin({\n      src: r('plugins/services/auth.serverLogin.js'),\n      fileName: 'firebase/service.auth.serverLogin-server.js',\n      mode: 'server',\n      options: {\n        credential,\n        config: options.config,\n      },\n    })\n\n    const sessionLifetime = options.sessions.sessionLifetime || 0\n\n    this.nuxt.hook('render:routeDone', async (_, __, { res }) => {\n      if (!res || !res.locals || !res.locals._session) {\n        return\n      }\n\n      const { _session: session, _manager: manager } = res.locals\n\n      if (manager) {\n        manager.endSession(session.name)\n        return\n      }\n\n      // fallback if session manager was not passed (SHOULD NOT HAPPEN)\n      const elapsed = Date.now() - session.options._created\n      if (elapsed >= sessionLifetime) {\n        try {\n          await session.delete()\n        } catch (error) {\n          logger.error('App deletion failed: ' + error.code)\n        }\n      }\n    })\n  }\n\n  return () => {\n    this.addPlugin({\n      src: r('plugins/services/auth.ssr.js'),\n      fileName: 'firebase/service.auth.ssr-server.js',\n      mode: 'server',\n      options: {\n        credential,\n        config: options.config,\n      },\n    })\n  }\n}\n\n/**\n * Validates the options defined by the user and throws an error is something is\n * missing or wrongly set up.\n * See: https://firebase.nuxtjs.org/guide/options/\n */\nfunction validateOptions(options) {\n  if (isEmpty(options)) {\n    return logger.error(\n      'Options are missing or empty, add at least the Firebase config parameters in your nuxt.config.js file.'\n    )\n  }\n\n  if (isEmpty(options.services)) {\n    return logger.error(\n      `The 'services' option is missing or empty, make sure to define it properly.\n      See: https://firebase.nuxtjs.org/guide/getting-started#configure`\n    )\n  }\n\n  if (isEmpty(options.config)) {\n    return logger.error(\n      'Firebase config not set properly in nuxt.config.js, config object is missing.'\n    )\n  }\n\n  if (options.customEnv && !process.env.FIRE_ENV) {\n    return logger.error(\n      'CustomEnv mode requires process.env.FIRE_ENV variable to be set.'\n    )\n  }\n}\n\n/**\n * Either gets the current environment from the FIRE_ENV env variable\n * or the NODE_ENV variable, depending on setup.\n * See: https://firebase.nuxtjs.org/guide/options/#customenv\n */\nfunction getCurrentEnv(options) {\n  if (options.customEnv) {\n    return process.env.FIRE_ENV\n  }\n  return process.env.NODE_ENV\n}\n\n/**\n * If config is setup within an environment object that is equal to the current environment\n * we set that as the new options.config.\n * Otherwise, we expect the keys to be set directly in options.config already.\n * See: https://firebase.nuxtjs.org/guide/options/#config\n */\nfunction getFinalUseConfigObject(config, currentEnv) {\n  if (config && config[currentEnv]) {\n    return config[currentEnv]\n  }\n  return config\n}\n\n/**\n * Checks the Firebase config for the current environment in the nuxt.config.js file.\n * Breaks if a required key is missing.\n * See: https://firebase.nuxtjs.org/guide/options/#config\n */\nfunction validateConfigKeys(options, currentEnv) {\n  const configKeys = Object.keys(options.config || false)\n\n  const requiredKeys = [\n    'apiKey',\n    'authDomain',\n    // 'databaseURL', // legacy, only available in old projects\n    'projectId',\n    'storageBucket',\n    'messagingSenderId',\n    'appId',\n    // 'measurementId' - not a must without Analytics, we throw a warning below\n  ]\n\n  // If one of the required keys is missing, throw an error:\n  if (requiredKeys.some((k) => !configKeys.includes(k))) {\n    const missingKey =\n      requiredKeys[requiredKeys.findIndex((k) => !configKeys.includes(k))]\n    return logger.error(\n      `Missing or incomplete config for current environment '${currentEnv}': key '${missingKey}' is required!`\n    )\n  }\n\n  // Only if Analytics is enabled and the measurementId key is missing, throw an error.\n  if (options.analytics && !configKeys.includes('measurementId')) {\n    return logger.warn(\n      'Missing measurementId configuration value. Analytics will be non-functional.'\n    )\n  }\n}\n\n/**\n * This makes sure nuxt generate does finish without running into a timeout issue.\n * Might be able to remove this at some point (e.g. with Nuxt 3)\n * See https://github.com/nuxt-community/firebase-module/issues/93\n */\nfunction terminateDatabasesInGenerateHooks(ctx) {\n  ctx.nuxt.hook('generate:before', async (generator) => {\n    const { default: firebase } = await import('firebase/compat/app')\n    await import('firebase/compat/database')\n    await import('firebase/compat/firestore')\n\n    if (!firebase.apps.length) {\n      firebase.initializeApp(generator.options.firebase.config)\n    }\n\n    generator.$fire = firebase.apps[0]\n  })\n  ctx.nuxt.hook('generate:done', async ({ $fire }) => {\n    // Terminate Databases\n    try {\n      await $fire.database().goOffline()\n      console.info('RealTime Database manually terminated.')\n    } catch (e) {}\n    try {\n      await $fire.firestore().terminate()\n      console.info('Firestore manually terminated.')\n    } catch (e) {}\n  })\n}\n\nfunction isEmpty(val) {\n  return val == null || !(Object.keys(val) || val).length\n}\n\nmodule.exports.meta = require('../package.json')\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/README.md",
    "content": "# Plugins\n\nThe files within the \"plugins\" folder will be parsed and copied to the /dist folder of the built project. These are then imported as nuxt-plugins.\n\n[Lodas Template](https://lodash.com/docs/4.17.15#template) is used to parse these plugins.\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/main.js",
    "content": "import createApp from './app.js'\n<%\nconst { enabledServices } = options\nserverServices = enabledServices.filter(service => !service.clientOnly)\nclientServices = enabledServices\n\nfor (const service of enabledServices) { %>\n<%= `import ${service.id}Service from './service.${service.id}.js'`%><%\n} %>\n\nconst appConfig = <%= serialize(options.config) %>\n\nexport default async (ctx, inject) => {\n\n  <%/****************************************\n  **************** LAZY MODE **************\n  ****************************************/%>\n  <% if (options.lazy) { %>\n  let firebase, session\n  let firebaseReady = false\n\n  const fire = {\n    async appReady() {\n      if (!firebaseReady) {\n        ({ firebase, session } = await createApp(appConfig, ctx))\n        firebaseReady = true;\n\n        <% if (options.injectModule) { %>\n        forceInject(ctx, inject, \"fireModule\", firebase)\n        <% } %>\n      }\n      return session\n    },\n    async ready() {\n      await fire.appReady()\n\n      let servicePromises = []\n\n      <% if (serverServices.length) { %>\n      if (process.server) {\n        servicePromises = [\n        <%= serverServices.reduce((acc, service) => `${acc}fire.${service.id}Ready(),\\n        `, '') %>\n        ]\n      }\n      <% } %>\n\n      <% if (clientServices.length) { %>\n      if (process.client) {\n        servicePromises = [\n        <%= clientServices.reduce((acc, service) => `${acc}fire.${service.id}Ready(),\\n        `, '') %>\n        ]\n      }\n      <% } %>\n\n      await Promise.all(servicePromises)\n      return session\n    }\n  }\n\n  if (process.server) {\n  <% for (service of serverServices) { %>\n  <% const serviceName = service.id %>\n  fire.<%= serviceName %> = null\n  fire.<%= serviceName %>Ready = async () => {\n    if (!fire.<%= serviceName %>) {\n      await fire.appReady()\n      fire.<%= serviceName %> = await <%= `${service.id}Service(session, firebase, ctx, inject)` %>\n    }\n\n    return fire.<%= serviceName %>\n  }\n  <% } %>\n  }\n\n  if (process.client) {\n    <% for (service of clientServices) { %>\n    <% const serviceName = service.id %>\n    fire.<%= serviceName %> = null\n    fire.<%= serviceName %>Ready = async () => {\n      if (!fire.<%= serviceName %>) {\n        await fire.appReady()\n        fire.<%= serviceName %> = await <%= `${service.id}Service(session, firebase, ctx, inject)` %>\n      }\n\n      return fire.<%= serviceName %>\n    }\n    <% } %>\n  }\n\n  inject('fire', fire)\n  ctx.$fire = fire\n\n\n  <%/****************************************\n  ************* NON-LAZY MODE *************\n  ****************************************/%>\n  <% } else { %>\n  const { firebase, session } = await createApp(appConfig, ctx)\n\n  let servicePromises = []\n\n  <% if (serverServices.length) { %>\n  if (process.server) {\n    servicePromises = [\n      <%= serverServices.reduce((acc, service) => `${acc}${service.id}Service(session, firebase, ctx, inject),\\n    `, '') %>\n    ]\n  } \n  <% } %>\n\n  <% if (clientServices.length) { %>\n  if (process.client) {\n    servicePromises = [\n      <%= clientServices.reduce((acc, service) => `${acc}${service.id}Service(session, firebase, ctx, inject),\\n      `, '') %>\n    ]\n  }\n  <% } %>\n\n  const [\n    <%= enabledServices.map(service => service.id).join(',\\n    ') %>\n  ] = await Promise.all(servicePromises)\n  \n  const fire = {\n    <%= enabledServices.map(service => `${service.id}: ${service.id}`).join(',\\n    ') %>\n  }\n\n  <% if (options.injectModule) { %>\n    inject('fireModule', firebase)\n    ctx.$fireModule = firebase\n  <% } %>\n\n  inject('fire', fire)\n  ctx.$fire = fire\n  <% } %>\n}\n\n\n<%/*************************************\n************* HELPERS********************\n****************************************/%>\n<%/**\nCustom inject function that is able to overwrite previously injected values,\nwhich original inject doesn't allow to do.\nThis method is copied from https://github.com/nuxt-community/sentry-module/blob/master/lib/plugin.lazy.js#L189\nwhich is adapted from the inject method in nuxt/vue-app/template/index.js\nFixes https://github.com/nuxt-community/firebase-module/issues/366\n**/%>\nfunction forceInject (ctx, inject, key, value) {\n  inject(key, value)\n  const injectKey = '$' + key\n  ctx[injectKey] = value \n  if (typeof window !== \"undefined\" && window.<%= globals.nuxt %>) {\n  // If clause makes sure it's only run when ready() is called in a component, not in a plugin.\n    window.<%= globals.nuxt %>.$options[injectKey] = value\n  }\n}"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/analytics.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session, firebase) {\n  // Can only be initiated on client side\n  if (!process.client) { \n    return\n  }\n\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  // Only initialize it if the Browser supports it\n  const isSupported = await firebase.analytics.isSupported()\n  if (!isSupported) {\n    console.info('[@nuxtjs/firebase]: Firebase Analytics was not initialized because it is not supported on this browser.')\n    return\n  }\n\n  const analyticsService = session.<%= serviceMapping.id %>()\n\n  <% if ('collectionEnabled' in serviceOptions) { %>\n  // In development we want to disable analytics collection\n  analyticsService.setAnalyticsCollectionEnabled(<%= !!serviceOptions.collectionEnabled %>)\n  <% } %>\n\n  return analyticsService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/app.js",
    "content": "<%= options.writeStaticImports(options) %>\n\nexport default async function createApp(config, {res}) {\n  <%= (statement = options.writeImportStatement(options))\n  && `const firebaseModule = ${statement}`\n  %>\n  const firebase = firebaseModule.default\n\n  <% if (typeof options.sessions === 'object') { %>\n  /*************************************************\n  * If Firebase \"Auth SSR serverLogin Option\" is on\n  *************************************************/\n  let session\n  if (process.server && res && res.locals && res.locals.user) {\n    const { default: SessionManager } = await import('@nuxtjs/firebase/lib/utils/auth-ssr/ssr-auth-session-manager.js')\n    const manager = new SessionManager(firebase, {\n      config,\n      sessions: <%= serialize(options.sessions) %>\n    })\n    // Resolve the firebase app corresponding to the server user\n    session = await manager.startSession(res.locals.user.uid)\n    res.locals._session = session\n    res.locals._manager = manager\n  } else {\n    session = firebase.apps.find(a => a.name === '[DEFAULT]') || firebase.initializeApp(config)\n  }\n\n  <% } else { %>\n  /*****************************************************\n  * Without \"Auth SSR serverLogin Option\" -> normal init\n  *****************************************************/\n  if (!firebase.apps.length) {\n    firebase.initializeApp(config)\n  }\n  const session = firebase.apps[0]\n  <% } %>\n\n  return {\n    firebase,\n    session\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/appCheck.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  // Can only be initiated on client side\n  if (!process.client) { \n    return\n  }\n\n  <% if (!serviceOptions.static) { %>    \n    <%= writeImportStatement(options) %>\n  <% } %>\n  \n  <% /* Uses debug config, if debug token option is set. */ %>\n  <% if (serviceOptions.debugToken) { %>\n    self.FIREBASE_APPCHECK_DEBUG_TOKEN = <%= serviceOptions.debugToken %>\n  <% } %>\n  \n  const appCheckService = session.<%= serviceMapping.id %>()\n\n  return appCheckService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/auth.initialize.js",
    "content": "// runs the functions once BEFORE the root Vue.js Application is instantiated.\nexport default ({ $fireAuthStore }) => {\n  // Can only be initiated on client side\n  if (!process.client) {\n    return\n  }\n\n  return $fireAuthStore.subscribe()\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/auth.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement } = options %>\n\n<% const hasOnAuthStateChangedMutation = (serviceOptions.initialize && typeof serviceOptions.initialize.onAuthStateChangedMutation === 'string') %>\n<% const hasOnAuthStateChangedAction = (serviceOptions.initialize && typeof serviceOptions.initialize.onAuthStateChangedAction === 'string') %>\n<% const hasOnAuthStateChanged = (hasOnAuthStateChangedMutation || hasOnAuthStateChangedAction) %>\n<% const onIdTokenChangedMutation = (serviceOptions.initialize && typeof serviceOptions.initialize.onIdTokenChangedMutation === 'string') %>\n<% const onIdTokenChangedAction = (serviceOptions.initialize && typeof serviceOptions.initialize.onIdTokenChangedAction === 'string') %> \n<% const hasIdTokenChanged = (onIdTokenChangedMutation || onIdTokenChangedAction) %>\n\nexport default async function (session, firebase, ctx, inject) {\n  \n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n  const authService = session.<%= serviceMapping.id %>()\n\n  <% /* Uses emulator, if emulatorPort is set. */ %>\n  <% if (['string', 'number'].includes(typeof serviceOptions.emulatorPort)) { %>\n  <% const emulatorHost =\n  typeof serviceOptions.emulatorHost === 'string'\n    ? serviceOptions.emulatorHost\n    : 'http://localhost'\n  %>\n  authService.useEmulator('<%= `${emulatorHost}` %>:<%= `${serviceOptions.emulatorPort}` %>'<% if (serviceOptions.disableEmulatorWarnings) { %><%= `, { disableWarnings: true }` %><% } %>)\n  <% } %>\n\n  <% if (serviceOptions.persistence) { %>\n    if (process.client) {\n    const persistence = firebase.auth.Auth.Persistence.<%=\n      serviceOptions.persistence === 'session'\n        ? 'SESSION'\n        : serviceOptions.persistence === 'none'\n          ? 'NONE'\n          : 'LOCAL'\n    %>\n    try {\n      await authService.setPersistence(persistence)\n    } catch (err) {\n      if (err.code === 'auth/invalid-persistence-type') {\n        console.warn(`[@nuxtjs/firebase]: Invalid persistence type '${persistence}' provided`)\n      } else if (err.code === 'auth/unsupported-persistence-type') {\n        console.warn(`[@nuxtjs/firebase]: Persistence type '${persistence}' is not supported in this environment.`)\n      }\n    }\n  }\n  <% } %>\n\n  <% if (serviceOptions.initialize) { %>\n  // Sets up a listener, mutations and action for every onAuthStateChanged by Firebase.\n  const fireAuthStore = {\n    unsubscribe() {\n      if (this.unsubscribeAuthStateListener) {\n        this.unsubscribeAuthStateListener()\n        delete this.unsubscribeAuthStateListener\n      }\n      if (this.unsubscribeIdTokenListener) {\n        this.unsubscribeIdTokenListener()\n        delete this.unsubscribeIdTokenListener\n      }\n    },\n    subscribe() {\n      const promises = []\n      <% if (hasOnAuthStateChanged && !this.unsubscribeAuthStateListener) { %>\n      promises.push(new Promise(resolve => {\n        this.unsubscribeAuthStateListener = authService.onAuthStateChanged(async authUser => {\n          const claims = authUser ? (await authUser.getIdTokenResult(true)).claims : null\n\n          <% if (hasOnAuthStateChangedMutation) { %>\n          ctx.store.commit(<%= serialize(serviceOptions.initialize.onAuthStateChangedMutation) %>, { authUser, claims })\n          <% } %>\n\n          <% if (hasOnAuthStateChangedAction) { %>\n          await ctx.store.dispatch(<%= serialize(serviceOptions.initialize.onAuthStateChangedAction) %>, { authUser, claims })\n          <% } %>\n\n          resolve()\n        })\n      }))\n      <% } %>\n\n      <% if (hasIdTokenChanged && !this.unsubscribeIdTokenListener) { %>\n      promises.push(new Promise(resolve => {\n        this.unsubscribeIdTokenListener = authService.onIdTokenChanged(async authUser => {\n          const claims = authUser ? (await authUser.getIdTokenResult(true)).claims : null\n\n          <% if (onIdTokenChangedMutation) { %>\n          ctx.store.commit(<%= serialize(serviceOptions.initialize.onIdTokenChangedMutation) %>, { authUser, claims })\n          <% } %>\n\n          <% if (onIdTokenChangedAction) { %>\n          await ctx.store.dispatch(<%= serialize(serviceOptions.initialize.onIdTokenChangedAction) %>, { authUser, claims })\n          <% } %>\n\n          resolve()\n        })\n      }))\n      <% } %>\n      return Promise.all(promises)\n    }\n  }\n  inject('fireAuthStore', fireAuthStore)\n  <% } %>\n\n  return authService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/auth.serverLogin.js",
    "content": "import admin from 'firebase-admin'\n\nconst config = <%= serialize(options.config) %>\n\nif (!admin.apps.length) {\n  const credential = <%=\n    options.credential === true\n      ? 'admin.credential.applicationDefault()'\n      : `admin.credential.cert(require(${serialize(options.credential)}))`\n  %>\n\n  admin.initializeApp({\n    credential,\n    ...config\n  })\n}\n\nexport default async ({ res }) => {\n  if (res && res.locals && res.locals.user && res.locals.user.uid && res.locals._manager) {\n    const uid = res.locals.user.uid\n    const manager = res.locals._manager\n\n    // if the user is already logged in to the session, return early\n    const user = manager.getUser(uid)\n    if (user) return\n\n    try {\n      // Retrieve a custom auth token from the users uid\n      const customToken = await admin.auth().createCustomToken(uid)\n\n      // attempt client sdk sign\n      await manager.login(uid, customToken)\n    } catch (error) {\n      // @TODO: implement appropriate error handling, if at all necessary\n      console.error(error)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/auth.ssr.js",
    "content": "import admin from 'firebase-admin'\n\nconst config = <%= serialize(options.config) %>\n\nconst simulateUserRecord = ({\n  uid,\n  email,\n  email_verified: emailVerified,\n  name: displayName\n}) => ({\n  uid,\n  email,\n  emailVerified,\n  displayName\n})\n\nif (!admin.apps.length) {\n  <% if (options.credential) { %>\n    const credential = <%=\n    options.credential === true\n      ? 'admin.credential.applicationDefault()'\n      : `admin.credential.cert(require(${serialize(options.credential)}))`\n  %>\n  \n  admin.initializeApp({\n    credential,\n    ...config\n  })\n  <% } else { %>\n  admin.initializeApp(config)\n  <% } %>\n}\n\nexport default async ({ req, res }) => {\n  if (!req || !req.headers.authorization) {\n    return\n  }\n\n  // Parse the injected ID token from the request header.\n  const authorizationHeader = req.headers.authorization || ''\n  const components = authorizationHeader.split(' ')\n  const idToken = components.length > 1 ? components[1] : ''\n\n  try {\n    // Try to verify the id token, additionally checking if the token was revoked\n    const decodedToken = await admin.auth().verifyIdToken(idToken)\n\n    if (decodedToken.uid) {\n      const authUser = <%=\n        options.credential\n          ? 'await admin.auth().getUser(decodedToken.uid)'\n          : 'simulateUserRecord(decodedToken)'\n      %>\n\n      res.locals = {\n        ...res.locals,\n        user: {\n          ...authUser,\n\t\t\t\t\tallClaims: decodedToken,\n\t\t\t\t\tidToken,\n        }\n      }\n    }\n  } catch (e) {\n    console.error(e)\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/database.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  const databaseService = session.<%= serviceMapping.id %>()\n\n  <% /* Uses emulator, if emulatorPort is set. */ %>\n  <% if (['string', 'number'].includes(typeof serviceOptions.emulatorPort)) { %>\n  <% const emulatorHost =\n  typeof serviceOptions.emulatorHost === 'string'\n    ? serviceOptions.emulatorHost\n    : 'localhost'\n  %>\n  databaseService.useEmulator('<%= `${emulatorHost}` %>', <%= `${serviceOptions.emulatorPort}` %>)\n  <% } %>\n\n  return databaseService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/firestore.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  const firestoreService = session.<%= serviceMapping.id %>()\n\n  <% if (typeof serviceOptions.settings === 'object') { %>\n    firestoreService.settings(<%= serialize(serviceOptions.settings) %>)\n  <% } %>\n\n  <% /* Uses emulator, if emulatorPort is set. */ %>\n  <% if (['string', 'number'].includes(typeof serviceOptions.emulatorPort)) { %>\n  <% const emulatorHost =\n  typeof serviceOptions.emulatorHost === 'string'\n    ? serviceOptions.emulatorHost\n    : 'localhost'\n  %>\n  // If statement fixes Issue #390, only runs useEmulator when not yet called (relevant on server) \n  if (process.client || firestoreService._delegate._settings.host === 'firestore.googleapis.com') {\n    firestoreService.useEmulator('<%= `${emulatorHost}` %>', <%= `${serviceOptions.emulatorPort}` %>)\n  }\n  <% } %>\n\n  <% if (serviceOptions.enablePersistence) { %>\n  // persistence should only be enabled client side\n  if (process.client) {\n    try {\n      <% const enablePersistence = Object.assign({}, serviceOptions.enablePersistence) %>\n      await firestoreService.enablePersistence(<%= serialize(enablePersistence) %>)\n    } catch (err) {\n      if (err.code == 'failed-precondition') {\n        console.warn('[@nuxtjs/firebase]: Firestore Persistence not enabled. Multiple tabs open, persistence can only be enabled in one tab at a a time.')\n      } else if (err.code == 'unimplemented') {\n        console.info('[@nuxtjs/firebase]: Firestore Persistence not enabled. The current browser does not support all of the features required to enable persistence.')\n      }\n    }\n  }\n  <% } %>\n\n  return firestoreService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/functions.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  <% if (serviceOptions.location) { %>\n  const functionsService = session.<%= serviceMapping.id %>('<%= serviceOptions.location %>')\n  <% } else { %>\n  <% /* If .location is undefined, default will be \"us-central1\" */ %>\n  const functionsService = session.<%= serviceMapping.id %>()\n  <% } %>\n\n  <% /* Uses emulator, if emulatorPort is set. */ %>\n  <% if (['string', 'number'].includes(typeof serviceOptions.emulatorPort)) { %>\n  <% const emulatorHost =\n  typeof serviceOptions.emulatorHost === 'string'\n    ? serviceOptions.emulatorHost\n    : 'http://localhost'\n  %>\n  functionsService.useFunctionsEmulator('<%= `${emulatorHost}` %>:<%= `${serviceOptions.emulatorPort}` %>')\n  <% } %>\n\n  return functionsService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/messaging.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session, firebase) {\n  // Can only be initiated on client side\n  if (!process.client) { \n    return\n  }\n\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  if (firebase.messaging.isSupported()) {\n    const messagingService = session.<%= serviceMapping.id %>()\n\n    <% if (serviceOptions.fcmPublicVapidKey) { %>\n    messagingService.getToken({vapidKey: <%= serialize(serviceOptions.fcmPublicVapidKey) %>})\n    <% } %>\n\n    return messagingService\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/performance.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  // Can only be initiated on client side\n  if (!process.client) { \n    return\n  }\n\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  const performanceService = session.<%= serviceMapping.id %>()\n  return performanceService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/remoteConfig.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  // Can only be initiated on client side\n  if (!process.client) { \n    return\n  }\n\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  const remoteConfigService = session.<%= serviceMapping.id %>()\n\n  <% const settings = Object.assign({}, serviceOptions.settings) %>\n  remoteConfigService.settings = {\n    fetchTimeoutMillis: <%= `${settings.fetchTimeoutMillis || 60000 }` %>,\n    minimumFetchIntervalMillis: <%= `${settings.minimumFetchIntervalMillis || 43200000}` %>\n  }\n\n  <% if (typeof serviceOptions.defaultConfig === 'object') { %>\n    remoteConfigService.defaultConfig = <%= serialize(serviceOptions.defaultConfig) %>\n  <% } %>\n\n  return remoteConfigService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/plugins/services/storage.js",
    "content": "<% const { serviceMapping, serviceOptions, writeImportStatement, writeInjections } = options %>\n\nexport default async function (session) {\n  <% if (!serviceOptions.static) { %>    \n  <%= writeImportStatement(options) %>\n  <% } %>\n\n  const storageService = session.<%= serviceMapping.id %>()\n\n  <% /* Uses emulator, if emulatorPort is set. */ %>\n  <% if (['string', 'number'].includes(typeof serviceOptions.emulatorPort)) { %>\n  <% const emulatorHost =\n  typeof serviceOptions.emulatorHost === 'string'\n    ? serviceOptions.emulatorHost\n    : 'localhost'\n  %>\n  storageService.useEmulator('<%= `${emulatorHost}` %>', <%= `${serviceOptions.emulatorPort}` %>)\n  <% } %>\n\n  return storageService\n}\n"
  },
  {
    "path": "packages/firebase-module/lib/sw-templates/README.md",
    "content": "# SW-Templates\n\nThese *service worker templates* will be parsed by lodash template and then copied in the /static folder of the built project.\n\n[Lodash Template](https://lodash.com/docs/4.17.15#template) is used to parse these plugins.\n\n"
  },
  {
    "path": "packages/firebase-module/lib/sw-templates/firebase-auth-sw.js",
    "content": "const ignorePaths = <%= serialize(options.ignorePaths) %>\n\n<% if (options.loadFromFirebaseHosting) { %>\n// Only works on Firebase hosting!\nimportScripts('/__/firebase/<%= options.firebaseVersion %>/firebase-app-compat.js')\nimportScripts('/__/firebase/<%= options.firebaseVersion %>/firebase-auth-compat.js')\nimportScripts('/__/firebase/init.js')\n<% } else { %>\nimportScripts(\n  'https://www.gstatic.com/firebasejs/<%= options.firebaseVersion %>/firebase-app-compat.js'\n)\nimportScripts(\n  'https://www.gstatic.com/firebasejs/<%= options.firebaseVersion %>/firebase-auth-compat.js'\n)\nfirebase.initializeApp(<%= serialize(options.config) %>)\n<% } %>\n\n// Initialize authService\nconst authService = firebase.auth()\n\n<% /* Uses emulator, if emulatorPort is set. */ %>\n<% const authOptions = options.authOptions %>\n<% if (['string', 'number'].includes(typeof authOptions.emulatorPort)) { %>\n<% const emulatorHost =\ntypeof authOptions.emulatorHost === 'string'\n  ? authOptions.emulatorHost\n  : 'http://localhost'\n%>\nauthService.useEmulator('<%= `${emulatorHost}` %>:<%= `${authOptions.emulatorPort}` %>')\n<% } %>\n\n\n/**\n * Returns a promise that resolves with an ID token if available.\n * @return {!Promise<?string>} The promise that resolves with an ID token if\n *     available. Otherwise, the promise resolves with null.\n */\nconst getIdToken = () => {\n  return new Promise((resolve) => {\n    const unsubscribe = authService.onAuthStateChanged((user) => {\n      unsubscribe()\n      if (user) {\n        // force token refresh as it might be used to sign in server side\n        user.getIdToken(true).then((idToken) => {\n          resolve(idToken)\n        }, () => {\n          resolve(null)\n        })\n      } else {\n        resolve(null)\n      }\n    })\n  })\n}\n\nconst fetchWithAuthorization = async (original, idToken) => {\n  // Clone headers as request headers are immutable.\n  const headers = new Headers()\n  for (let entry of original.headers.entries()) {\n    headers.append(entry[0], entry[1])\n  }\n\n  // Add ID token to header.\n  headers.append('Authorization', 'Bearer ' + idToken)\n\n  // Create authorized request\n  const { url, ...props } = original.clone()\n  const authorized = new Request(url, {\n    ...props,\n    mode: 'same-origin',\n    redirect: 'manual',\n    headers\n  })\n\n  return fetch(authorized)\n}\n\nself.addEventListener('fetch', (event) => {\n  const url = new URL(event.request.url)\n\n  const expectsHTML = event.request.headers.get('accept').includes('text/html')\n\n  const isSameOrigin = self.location.origin === url.origin\n  const isHttps = (self.location.protocol === 'https:' || self.location.hostname === 'localhost' || self.location.hostname === '127.0.0.1')\n\n  const isIgnored = ignorePaths.some(path => {\n    if (typeof path === 'string') {\n      return url.pathname.startsWith(path)\n    }\n\n    return path.test(url.pathname.slice(1))\n  })\n\n  // https://github.com/nuxt-community/firebase-module/issues/465\n  if (!expectsHTML || !isSameOrigin || !isHttps || isIgnored) {\n    <% if (['string', 'number'].includes(typeof authOptions.emulatorPort)) { %>\n    <% const emulatorHost =\n      typeof authOptions.emulatorHost === 'string'\n        ? authOptions.emulatorHost\n        : 'http://localhost'\n      %>\n    if (event.request.url.startsWith('https://www.googleapis.com/identitytoolkit/')) {\n      event.respondWith(\n        fetch({\n          ...event.request,\n          ...{ url: event.request.url.replace(/https:\\/\\//, '<%= `${emulatorHost}` %>:<%= `${authOptions.emulatorPort}` %>/') }\n        })\n      )\n    } else event.respondWith(fetch(event.request))\n    <% } else { %>\n      event.respondWith(fetch(event.request))\n    <% } %>\n    return\n  }\n\n\n  // Fetch the resource after checking for the ID token.\n  // This can also be integrated with existing logic to serve cached files\n  // in offline mode.\n  event.respondWith(\n    getIdToken().then(\n      idToken => idToken\n        // if the token was retrieved we attempt an authorized fetch\n        // if anything goes wrong we fall back to the original request\n        ? fetchWithAuthorization(event.request, idToken).catch(() => fetch(event.request))\n        // otherwise we return a fetch of the original request directly\n        : fetch(event.request)\n    )\n  )\n})\n\n// In service worker script.\nself.addEventListener('activate', event => {\n  event.waitUntil(clients.claim())\n})"
  },
  {
    "path": "packages/firebase-module/lib/sw-templates/firebase-messaging-sw.js",
    "content": "<% if (options.loadFromFirebaseHosting) { %>\n    // Only works on Firebase hosting & not on localhost!\n    importScripts('/__/firebase/<%= options.firebaseVersion %>/firebase-app-compat.js')\n    importScripts('/__/firebase/<%= options.firebaseVersion %>/firebase-messaging-compat.js')\n    importScripts('/__/firebase/init.js')\n    <% } else { %>\n    importScripts(\n      'https://www.gstatic.com/firebasejs/<%= options.firebaseVersion %>/firebase-app-compat.js'\n    )\n    importScripts(\n      'https://www.gstatic.com/firebasejs/<%= options.firebaseVersion %>/firebase-messaging-compat.js'\n    )\n    firebase.initializeApp(<%= serialize(options.config) %>)\n    <% } %>\n    \n    // Retrieve an instance of Firebase Messaging so that it can handle background\n    // messages.\n    const messaging = firebase.messaging()\n    \n    <% if (options.actions) { %>\n    // Setup event listeners for actions provided in the config:\n    self.addEventListener('notificationclick', function(e) {\n    \n      const actions = <%= serialize(options.actions) %>\n      const action = actions.find(x => x.action === e.action)\n      const notification = e.notification\n    \n      if (!action) return\n    \n      if (action.url) {\n        clients.openWindow(action.url)\n        notification.close()\n      }\n    })\n    <% } %>\n    \n    <% if (options.inject) { %>\n    <%= options.inject %>\n    <% } %>"
  },
  {
    "path": "packages/firebase-module/lib/utils/auth-ssr/ssr-auth-session-manager.js",
    "content": "const logger = require('../logger')\n\nconst sessions = {\n  working: false,\n  queue: [],\n  active: [],\n}\n\nconst logins = {\n  working: false,\n  queue: [],\n}\n\nasync function removeSession(session) {\n  logger.info('deleting session: ', session.instance.name)\n\n  const index = sessions.active.findIndex(\n    (s) => s.instance.name !== session.instance.name\n  )\n  sessions.active.splice(index, 1)\n\n  await session.instance.delete()\n}\n\nfunction enqueueSessionOperation(operation) {\n  return new Promise((resolve) => {\n    sessions.queue.push({\n      operation,\n      resolve,\n    })\n\n    dequeueSessionOperation()\n  })\n}\n\nasync function dequeueSessionOperation() {\n  if (sessions.working) {\n    return\n  }\n  sessions.working = true\n\n  const item = sessions.queue.shift()\n\n  if (!item) {\n    sessions.working = false\n\n    return\n  }\n\n  const result = await item.operation()\n  item.resolve(result)\n\n  sessions.working = false\n  dequeueSessionOperation()\n}\n\nclass SessionManager {\n  constructor(firebase, { config, sessions: sessionConfig }) {\n    this.firebase = firebase\n    this.config = config\n    this.lifetime = sessionConfig.sessionLifetime || 0\n    this.loginDelay = sessionConfig.loginDelay || 50\n  }\n\n  getSession(name, touch = true) {\n    const session = sessions.active.find((s) => s.instance.name === name)\n\n    if (session) {\n      if (session.timeout) {\n        logger.debug('session retrieved, aborting removal')\n\n        clearTimeout(session.timeout)\n        session.timeout = null\n      }\n\n      if (touch) session.touched = Date.now()\n    }\n\n    return session\n  }\n\n  getUser(name) {\n    const session = this.getSession(name)\n\n    if (!session) {\n      const error = new Error(`Missing session for user ${name}`)\n      error.code = 'nuxt-firebase/missing-session'\n\n      throw error\n    }\n\n    const auth = session.instance.auth()\n\n    return auth.currentUser\n  }\n\n  startSession(name = '[DEFAULT]') {\n    return enqueueSessionOperation(() => {\n      logger.info('starting session for: ', name)\n\n      const session = this.getSession(name)\n\n      if (session) {\n        if (name === '[DEFAULT]') return session.instance\n\n        session.active++\n        logger.debug('found existing, active sessions: ', session.active)\n\n        return session.instance\n      }\n\n      const instance =\n        this.firebase.apps.find((a) => a.name === name) ??\n        this.firebase.initializeApp(this.config, name)\n\n      sessions.active.push({\n        instance,\n        active: 1,\n        touched: Date.now(),\n      })\n\n      logger.debug('created, active sessions: ', 1)\n\n      return instance\n    })\n  }\n\n  endSession(name = '[DEFAULT]') {\n    return enqueueSessionOperation(() => {\n      logger.info('ending session for: ', name)\n\n      const session = this.getSession(name, false)\n\n      if (!session || name === '[DEFAULT]') return\n\n      session.active--\n      logger.debug('active sessions: ', session.active)\n\n      if (session.active < 1) {\n        const logoutTimer = this.lifetime - (Date.now() - session.touched)\n\n        logger.debug('enqueueing session removal in: ', logoutTimer)\n\n        session.timeout = setTimeout(() => {\n          enqueueSessionOperation(() => removeSession(session))\n        }, logoutTimer)\n      }\n    })\n  }\n\n  login(name, token) {\n    logger.debug('enqueueing login attempt', Date.now())\n\n    const session = this.getSession(name)\n\n    const auth = session.instance.auth()\n\n    return new Promise((resolve, reject) => {\n      logins.queue.push({\n        promise: () => auth.signInWithCustomToken(token),\n        resolve,\n        reject,\n      })\n\n      this.dequeueLoginAttempts()\n    })\n  }\n\n  async dequeueLoginAttempts() {\n    if (logins.working) {\n      return\n    }\n    logins.working = true\n\n    const current = logins.queue.shift()\n\n    if (!current) {\n      logins.working = false\n      return\n    }\n\n    try {\n      logger.debug('attempting login: ' + Date.now())\n\n      const { user } = await current.promise()\n\n      current.resolve(user)\n    } catch (e) {\n      current.reject(e)\n    }\n\n    setTimeout(() => {\n      logins.working = false\n      this.dequeueLoginAttempts()\n    }, this.loginDelay)\n  }\n}\n\nmodule.exports = SessionManager\n"
  },
  {
    "path": "packages/firebase-module/lib/utils/logger.js",
    "content": "const consola = require('consola')\n\nmodule.exports = consola.withScope('nuxt:firebase')\n"
  },
  {
    "path": "packages/firebase-module/lib/utils/template-utils.js",
    "content": "/*\n  id: used in...\n     - module config\n     - names of the services .js files\n     - name of the Firebase object/function, e.g. firebase.remoteConfig\n     - injection names from version 7+ (e.g. $fire.remoteConfig)\n  importName: name of the import, e.g. import 'firebase/remote-config'\n*/\nconst serviceMappings = {\n  app: {\n    id: 'app',\n    importName: 'app',\n    clientOnly: false,\n  },\n  auth: {\n    id: 'auth',\n    importName: 'auth',\n    clientOnly: false,\n  },\n  database: {\n    // = realtime DB\n    id: 'database',\n    importName: 'database',\n    clientOnly: false,\n  },\n  firestore: {\n    id: 'firestore',\n    importName: 'firestore',\n    clientOnly: false,\n  },\n  storage: {\n    id: 'storage',\n    importName: 'storage',\n    clientOnly: false,\n  },\n  functions: {\n    id: 'functions',\n    importName: 'functions',\n    clientOnly: false,\n  },\n  messaging: {\n    id: 'messaging',\n    importName: 'messaging',\n    clientOnly: true,\n  },\n  performance: {\n    id: 'performance',\n    importName: 'performance',\n    clientOnly: true,\n  },\n  analytics: {\n    id: 'analytics',\n    importName: 'analytics',\n    clientOnly: true,\n  },\n  remoteConfig: {\n    id: 'remoteConfig',\n    importName: 'remote-config',\n    clientOnly: true,\n  },\n  appCheck: {\n    id: 'appCheck',\n    importName: 'app-check',\n    clientOnly: true,\n  },\n}\n\nfunction writeStaticImports(options) {\n  return Object.values(serviceMappings)\n    .map((serviceMapping) =>\n      writeImportStatement(options, serviceMapping, true)\n    )\n    .filter(Boolean)\n    .join('\\n')\n}\n\nfunction writeImportStatement(options, serviceMapping, staticOnly = false) {\n  if (!serviceMapping) {\n    serviceMapping = options.serviceMapping\n    // TODO - does this make sense?\n  }\n\n  const serviceOptions = options.services[serviceMapping.id]\n  if (!serviceOptions) {\n    return\n  }\n\n  const useStaticImport = serviceOptions.static\n\n  let pathAppendix = ''\n  if (serviceOptions.memoryOnly) {\n    // Only works with Firestore\n    pathAppendix = '/memory'\n  }\n\n  const servicePath = serviceMapping.importName\n  const importPath = `'firebase/compat/${servicePath}${pathAppendix}'`\n\n  if (staticOnly) {\n    if (!useStaticImport) {\n      return\n    }\n    return `import ${importPath}`\n  }\n\n  const webpackComments = []\n\n  // Add Chunk Name Comment\n  let webpackChunkName = serviceOptions.chunkName\n  if (!webpackChunkName && process.env.NODE_ENV !== 'production') {\n    webpackChunkName = `firebase-${servicePath}`\n  }\n\n  if (webpackChunkName) {\n    webpackComments.push(`webpackChunkName: '${webpackChunkName}'`)\n  }\n\n  // Add Preload Comment\n  if (serviceOptions.preload) {\n    webpackComments.push('webpackPreload: true')\n  }\n\n  // Add strings surrounding the comment\n  let webpackCommentsString = ''\n  if (webpackComments.length) {\n    webpackCommentsString = `/* ${webpackComments.join(', ')} */`\n  }\n\n  return `await import(${webpackCommentsString}${importPath})`\n}\n\nmodule.exports = {\n  serviceMappings,\n  writeStaticImports,\n  writeImportStatement,\n}\n"
  },
  {
    "path": "packages/firebase-module/package.json",
    "content": "{\n  \"name\": \"@nuxtjs/firebase\",\n  \"version\": \"8.2.2\",\n  \"description\": \"Intergrate Firebase into your Nuxt project.\",\n  \"keywords\": [\n    \"firebase\",\n    \"firestore\",\n    \"google\",\n    \"googleauthentication\",\n    \"nuxt\",\n    \"realtimedatabase\"\n  ],\n  \"homepage\": \"https://firebase.nuxtjs.org/\",\n  \"repository\": \"nuxt-community/firebase-module\",\n  \"license\": \"MIT\",\n  \"author\": \"Pascal Luther\",\n  \"files\": [\n    \"lib\",\n    \"types/*.d.ts\"\n  ],\n  \"main\": \"lib/module.js\",\n  \"types\": \"types/index.d.ts\",\n  \"scripts\": {\n    \"lint\": \"eslint --ext .js,.vue lib test\",\n    \"release\": \"standard-version && git push --follow-tags && npm publish\",\n    \"test\": \"npm run lint && jest\",\n    \"commit\": \"npx git-cz\",\n    \"docs\": \"cd docs && npm run dev\"\n  },\n  \"dependencies\": {\n    \"consola\": \"^2.15.3\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.14.5\",\n    \"@babel/plugin-syntax-dynamic-import\": \"^7.8.3\",\n    \"@babel/preset-env\": \"^7.16.8\",\n    \"@commitlint/cli\": \"latest\",\n    \"@commitlint/config-conventional\": \"latest\",\n    \"@nuxt/types\": \"^2.15.6\",\n    \"@nuxtjs/eslint-config\": \"^8.0.0\",\n    \"@nuxtjs/module-test-utils\": \"^1.6.3\",\n    \"babel-eslint\": \"^10.1.0\",\n    \"babel-jest\": \"^28.1.0\",\n    \"babel-plugin-dynamic-import-node\": \"^2.3.3\",\n    \"codecov\": \"latest\",\n    \"core-js\": \"^3.14.0\",\n    \"cz-conventional-changelog\": \"latest\",\n    \"eslint\": \"^8.0.1\",\n    \"firebase\": \"^9.6.2\",\n    \"husky\": \"^7.0.2\",\n    \"jest\": \"^28.1.0\",\n    \"nuxt\": \"^2.15.6\",\n    \"proxy-mock-js\": \"^1.0.3\",\n    \"standard-version\": \"^9.3.0\",\n    \"eslint-config-prettier\": \"^8.3.0\",\n    \"eslint-plugin-prettier\": \"^4.0.0\",\n    \"prettier\": \"^2.8.4\"\n  },\n  \"peerDependencies\": {\n    \"firebase\": \"^9.6.2\",\n    \"nuxt\": \"^2.15.6\"\n  },\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"config\": {\n    \"commitizen\": {\n      \"path\": \"./node_modules/cz-conventional-changelog\"\n    }\n  },\n  \"optionalDependencies\": {\n    \"firebase-admin\": \"^10.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/firebase-module/renovate.json",
    "content": "{\n  \"extends\": [\n    \"@nuxtjs\"\n  ]\n}\n"
  },
  {
    "path": "packages/firebase-module/test/__snapshots__/default.test.js.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`default plugin contents 1`] = `\n\"import createApp from './app.js'\n\nimport authService from './service.auth.js'\nimport databaseService from './service.database.js'\nimport firestoreService from './service.firestore.js'\nimport storageService from './service.storage.js'\nimport functionsService from './service.functions.js'\nimport messagingService from './service.messaging.js'\nimport performanceService from './service.performance.js'\nimport analyticsService from './service.analytics.js'\nimport remoteConfigService from './service.remoteConfig.js'\n\nconst appConfig = {\\\\\"apiKey\\\\\":\\\\\"\\\\\\\\u003CapiKey\\\\\\\\u003E\\\\\",\\\\\"authDomain\\\\\":\\\\\"\\\\\\\\u003CauthDomain\\\\\\\\u003E\\\\\",\\\\\"databaseURL\\\\\":\\\\\"\\\\\\\\u003CdatabaseURL\\\\\\\\u003E\\\\\",\\\\\"projectId\\\\\":\\\\\"\\\\\\\\u003CprojectId\\\\\\\\u003E\\\\\",\\\\\"storageBucket\\\\\":\\\\\"\\\\\\\\u003CstorageBucket\\\\\\\\u003E\\\\\",\\\\\"messagingSenderId\\\\\":\\\\\"\\\\\\\\u003CmessagingSenderId\\\\\\\\u003E\\\\\",\\\\\"appId\\\\\":\\\\\"\\\\\\\\u003CappId\\\\\\\\u003E\\\\\",\\\\\"measurementId\\\\\":\\\\\"\\\\\\\\u003CmeasurementId\\\\\\\\u003E\\\\\"}\n\nexport default async (ctx, inject) => {\n  /****************************************\n  **************** LAZY MODE **************\n  ****************************************/\n\n  const { firebase, session } = await createApp(appConfig, ctx)\n\n  let servicePromises = []\n\n  if (process.server) {\n    servicePromises = [\n      authService(session, firebase, ctx, inject),\n    databaseService(session, firebase, ctx, inject),\n    firestoreService(session, firebase, ctx, inject),\n    storageService(session, firebase, ctx, inject),\n    functionsService(session, firebase, ctx, inject),\n\n    ]\n  }\n\n  if (process.client) {\n    servicePromises = [\n      authService(session, firebase, ctx, inject),\n      databaseService(session, firebase, ctx, inject),\n      firestoreService(session, firebase, ctx, inject),\n      storageService(session, firebase, ctx, inject),\n      functionsService(session, firebase, ctx, inject),\n      messagingService(session, firebase, ctx, inject),\n      performanceService(session, firebase, ctx, inject),\n      analyticsService(session, firebase, ctx, inject),\n      remoteConfigService(session, firebase, ctx, inject),\n\n    ]\n  }\n\n  const [\n    auth,\n    database,\n    firestore,\n    storage,\n    functions,\n    messaging,\n    performance,\n    analytics,\n    remoteConfig\n  ] = await Promise.all(servicePromises)\n\n  const fire = {\n    auth: auth,\n    database: database,\n    firestore: firestore,\n    storage: storage,\n    functions: functions,\n    messaging: messaging,\n    performance: performance,\n    analytics: analytics,\n    remoteConfig: remoteConfig\n  }\n\n  inject('fire', fire)\n  ctx.$fire = fire\n}\n\"\n`;\n"
  },
  {
    "path": "packages/firebase-module/test/__snapshots__/lazy-init-auth.test.js.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`lazy-init-auth init auth plugin exist 1`] = `\n\"// runs the functions once BEFORE the root Vue.js Application is instantiated.\nexport default ({ $fireAuthStore }) => {\n  return $fireAuthStore.subscribe()\n}\n\"\n`;\n"
  },
  {
    "path": "packages/firebase-module/test/__snapshots__/lazy.test.js.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`lazy plugin contents 1`] = `\n\"import createApp from './app.js'\n\nimport authService from './service.auth.js'\nimport databaseService from './service.database.js'\nimport firestoreService from './service.firestore.js'\nimport storageService from './service.storage.js'\nimport functionsService from './service.functions.js'\nimport messagingService from './service.messaging.js'\nimport performanceService from './service.performance.js'\nimport analyticsService from './service.analytics.js'\nimport remoteConfigService from './service.remoteConfig.js'\n\nconst appConfig = {\\\\\"apiKey\\\\\":\\\\\"\\\\\\\\u003CapiKey\\\\\\\\u003E\\\\\",\\\\\"authDomain\\\\\":\\\\\"\\\\\\\\u003CauthDomain\\\\\\\\u003E\\\\\",\\\\\"databaseURL\\\\\":\\\\\"\\\\\\\\u003CdatabaseURL\\\\\\\\u003E\\\\\",\\\\\"projectId\\\\\":\\\\\"\\\\\\\\u003CprojectId\\\\\\\\u003E\\\\\",\\\\\"storageBucket\\\\\":\\\\\"\\\\\\\\u003CstorageBucket\\\\\\\\u003E\\\\\",\\\\\"messagingSenderId\\\\\":\\\\\"\\\\\\\\u003CmessagingSenderId\\\\\\\\u003E\\\\\",\\\\\"appId\\\\\":\\\\\"\\\\\\\\u003CappId\\\\\\\\u003E\\\\\",\\\\\"measurementId\\\\\":\\\\\"\\\\\\\\u003CmeasurementId\\\\\\\\u003E\\\\\"}\n\nexport default async (ctx, inject) => {\n  /****************************************\n  **************** LAZY MODE **************\n  ****************************************/\n\n  let firebase, session\n  let firebaseReady = false\n\n  const fire = {\n    async appReady() {\n      if (!firebaseReady) {\n        ({ firebase, session } = await createApp(appConfig, ctx))\n        firebaseReady = true;\n      }\n      return session\n    },\n    async ready() {\n      await fire.appReady()\n\n      let servicePromises = []\n\n      if (process.server) {\n        servicePromises = [\n        fire.authReady(),\n        fire.databaseReady(),\n        fire.firestoreReady(),\n        fire.storageReady(),\n        fire.functionsReady(),\n\n        ]\n      }\n\n      if (process.client) {\n        servicePromises = [\n        fire.authReady(),\n        fire.databaseReady(),\n        fire.firestoreReady(),\n        fire.storageReady(),\n        fire.functionsReady(),\n        fire.messagingReady(),\n        fire.performanceReady(),\n        fire.analyticsReady(),\n        fire.remoteConfigReady(),\n\n        ]\n      }\n\n      await Promise.all(servicePromises)\n      return session\n    }\n  }\n\n  if (process.server) {\n  fire.auth = null\n  fire.authReady = async () => {\n    if (!fire.auth) {\n      await fire.appReady()\n      fire.auth = await authService(session, firebase, ctx, inject)\n    }\n\n    return fire.auth\n  }\n\n  fire.database = null\n  fire.databaseReady = async () => {\n    if (!fire.database) {\n      await fire.appReady()\n      fire.database = await databaseService(session, firebase, ctx, inject)\n    }\n\n    return fire.database\n  }\n\n  fire.firestore = null\n  fire.firestoreReady = async () => {\n    if (!fire.firestore) {\n      await fire.appReady()\n      fire.firestore = await firestoreService(session, firebase, ctx, inject)\n    }\n\n    return fire.firestore\n  }\n\n  fire.storage = null\n  fire.storageReady = async () => {\n    if (!fire.storage) {\n      await fire.appReady()\n      fire.storage = await storageService(session, firebase, ctx, inject)\n    }\n\n    return fire.storage\n  }\n\n  fire.functions = null\n  fire.functionsReady = async () => {\n    if (!fire.functions) {\n      await fire.appReady()\n      fire.functions = await functionsService(session, firebase, ctx, inject)\n    }\n\n    return fire.functions\n  }\n  }\n\n  if (process.client) {\n    fire.auth = null\n    fire.authReady = async () => {\n      if (!fire.auth) {\n        await fire.appReady()\n        fire.auth = await authService(session, firebase, ctx, inject)\n      }\n\n      return fire.auth\n    }\n\n    fire.database = null\n    fire.databaseReady = async () => {\n      if (!fire.database) {\n        await fire.appReady()\n        fire.database = await databaseService(session, firebase, ctx, inject)\n      }\n\n      return fire.database\n    }\n\n    fire.firestore = null\n    fire.firestoreReady = async () => {\n      if (!fire.firestore) {\n        await fire.appReady()\n        fire.firestore = await firestoreService(session, firebase, ctx, inject)\n      }\n\n      return fire.firestore\n    }\n\n    fire.storage = null\n    fire.storageReady = async () => {\n      if (!fire.storage) {\n        await fire.appReady()\n        fire.storage = await storageService(session, firebase, ctx, inject)\n      }\n\n      return fire.storage\n    }\n\n    fire.functions = null\n    fire.functionsReady = async () => {\n      if (!fire.functions) {\n        await fire.appReady()\n        fire.functions = await functionsService(session, firebase, ctx, inject)\n      }\n\n      return fire.functions\n    }\n\n    fire.messaging = null\n    fire.messagingReady = async () => {\n      if (!fire.messaging) {\n        await fire.appReady()\n        fire.messaging = await messagingService(session, firebase, ctx, inject)\n      }\n\n      return fire.messaging\n    }\n\n    fire.performance = null\n    fire.performanceReady = async () => {\n      if (!fire.performance) {\n        await fire.appReady()\n        fire.performance = await performanceService(session, firebase, ctx, inject)\n      }\n\n      return fire.performance\n    }\n\n    fire.analytics = null\n    fire.analyticsReady = async () => {\n      if (!fire.analytics) {\n        await fire.appReady()\n        fire.analytics = await analyticsService(session, firebase, ctx, inject)\n      }\n\n      return fire.analytics\n    }\n\n    fire.remoteConfig = null\n    fire.remoteConfigReady = async () => {\n      if (!fire.remoteConfig) {\n        await fire.appReady()\n        fire.remoteConfig = await remoteConfigService(session, firebase, ctx, inject)\n      }\n\n      return fire.remoteConfig\n    }\n  }\n\n  inject('fire', fire)\n  ctx.$fire = fire\n\n  /****************************************\n  ************* NON-LAZY MODE *************\n  ****************************************/\n}\n\"\n`;\n"
  },
  {
    "path": "packages/firebase-module/test/__snapshots__/with-module.test.js.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`with-module plugin contents 1`] = `\n\"import createApp from './app.js'\n\nimport authService from './service.auth.js'\nimport databaseService from './service.database.js'\nimport firestoreService from './service.firestore.js'\nimport storageService from './service.storage.js'\nimport functionsService from './service.functions.js'\nimport messagingService from './service.messaging.js'\nimport performanceService from './service.performance.js'\nimport analyticsService from './service.analytics.js'\nimport remoteConfigService from './service.remoteConfig.js'\n\nconst appConfig = {\\\\\"apiKey\\\\\":\\\\\"\\\\\\\\u003CapiKey\\\\\\\\u003E\\\\\",\\\\\"authDomain\\\\\":\\\\\"\\\\\\\\u003CauthDomain\\\\\\\\u003E\\\\\",\\\\\"databaseURL\\\\\":\\\\\"\\\\\\\\u003CdatabaseURL\\\\\\\\u003E\\\\\",\\\\\"projectId\\\\\":\\\\\"\\\\\\\\u003CprojectId\\\\\\\\u003E\\\\\",\\\\\"storageBucket\\\\\":\\\\\"\\\\\\\\u003CstorageBucket\\\\\\\\u003E\\\\\",\\\\\"messagingSenderId\\\\\":\\\\\"\\\\\\\\u003CmessagingSenderId\\\\\\\\u003E\\\\\",\\\\\"appId\\\\\":\\\\\"\\\\\\\\u003CappId\\\\\\\\u003E\\\\\",\\\\\"measurementId\\\\\":\\\\\"\\\\\\\\u003CmeasurementId\\\\\\\\u003E\\\\\"}\n\nexport default async (ctx, inject) => {\n  /****************************************\n  **************** LAZY MODE **************\n  ****************************************/\n\n  const { firebase, session } = await createApp(appConfig, ctx)\n\n  let servicePromises = []\n\n  if (process.server) {\n    servicePromises = [\n      authService(session, firebase, ctx, inject),\n    databaseService(session, firebase, ctx, inject),\n    firestoreService(session, firebase, ctx, inject),\n    storageService(session, firebase, ctx, inject),\n    functionsService(session, firebase, ctx, inject),\n\n    ]\n  }\n\n  if (process.client) {\n    servicePromises = [\n      authService(session, firebase, ctx, inject),\n      databaseService(session, firebase, ctx, inject),\n      firestoreService(session, firebase, ctx, inject),\n      storageService(session, firebase, ctx, inject),\n      functionsService(session, firebase, ctx, inject),\n      messagingService(session, firebase, ctx, inject),\n      performanceService(session, firebase, ctx, inject),\n      analyticsService(session, firebase, ctx, inject),\n      remoteConfigService(session, firebase, ctx, inject),\n\n    ]\n  }\n\n  const [\n    auth,\n    database,\n    firestore,\n    storage,\n    functions,\n    messaging,\n    performance,\n    analytics,\n    remoteConfig\n  ] = await Promise.all(servicePromises)\n\n  const fire = {\n    auth: auth,\n    database: database,\n    firestore: firestore,\n    storage: storage,\n    functions: functions,\n    messaging: messaging,\n    performance: performance,\n    analytics: analytics,\n    remoteConfig: remoteConfig\n  }\n\n    inject('fireModule', firebase)\n    ctx.$fireModule = firebase\n\n  inject('fire', fire)\n  ctx.$fire = fire\n}\n\"\n`;\n"
  },
  {
    "path": "packages/firebase-module/test/default.test.js",
    "content": "const { resolve } = require('path')\nconst fs = require('fs-extra')\nconst { Nuxt, Builder } = require('nuxt')\nconst FirebaseModule = require('..')\n\njest.mock('firebase/compat/app', () => ({\n  apps: [\n    new Proxy(\n      {},\n      {\n        get(target, name) {\n          return jest.fn(() => ({}))\n        },\n      }\n    ),\n  ],\n  messaging: {\n    isSupported: jest.fn(),\n  },\n}))\n\ndescribe('default', () => {\n  let nuxt\n  const buildDir = resolve(__dirname, '.nuxt-default')\n\n  beforeAll(async () => {\n    const config = {\n      rootDir: resolve(__dirname, '..'),\n      buildDir,\n      srcDir: resolve(__dirname, 'fixture'),\n      modules: [\n        [\n          FirebaseModule,\n          {\n            injectModule: false,\n            config: {\n              // REQUIRED: Official config for firebase.initializeApp(config):\n              apiKey: '<apiKey>',\n              authDomain: '<authDomain>',\n              databaseURL: '<databaseURL>',\n              projectId: '<projectId>',\n              storageBucket: '<storageBucket>',\n              messagingSenderId: '<messagingSenderId>',\n              appId: '<appId>',\n              measurementId: '<measurementId>',\n            },\n            services: {\n              analytics: true,\n              auth: true,\n              firestore: true,\n              functions: true,\n              messaging: true,\n              performance: true,\n              database: true,\n              remoteConfig: true,\n              storage: true,\n            },\n          },\n        ],\n      ],\n    }\n    config.dev = false\n\n    nuxt = new Nuxt(config)\n    const BundleBuilder = { build: (_) => _ }\n    const builder = new Builder(nuxt, BundleBuilder)\n    await builder.build()\n  }, 60000)\n\n  afterAll(async () => {\n    await nuxt.close()\n  })\n\n  test('plugin contents', async () => {\n    const content = await fs.readFile(resolve(buildDir, 'firebase/index.js'), {\n      encoding: 'utf8',\n    })\n\n    expect(content).toContain('auth,')\n    expect(content).toContain('messaging,')\n\n    expect(content).not.toContain('Mess')\n\n    expect(content).toMatchSnapshot()\n  })\n\n  test('exec plugin (server)', async () => {\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(1)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeUndefined()\n  })\n\n  test('exec plugin (client)', async () => {\n    process.client = true\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(1)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeUndefined()\n  })\n})\n"
  },
  {
    "path": "packages/firebase-module/test/fixture/nuxt.config.js",
    "content": "import FirebaseModule from '../..'\n\nexport default {\n  rootDir: __dirname,\n  render: {\n    resourceHints: false,\n  },\n  modules: [FirebaseModule],\n  firebase: {\n    lazy: true,\n    injectModule: true,\n    config: {\n      // REQUIRED: Official config for firebase.initializeApp(config):\n      apiKey: '<apiKey>',\n      authDomain: '<authDomain>',\n      databaseURL: 'https://test.firebaseio.com',\n      projectId: '<projectId>',\n      storageBucket: '<storageBucket>',\n      messagingSenderId: '<messagingSenderId>',\n      appId: '<appId>',\n      measurementId: '<measurementId>',\n    },\n    services: {\n      auth: true,\n      database: true,\n      messaging: true,\n      analytics: true,\n      remoteConfig: true,\n    },\n  },\n}\n"
  },
  {
    "path": "packages/firebase-module/test/fixture/pages/index.vue",
    "content": "<template>\n  <h1>Works!</h1>\n</template>\n\n<script>\nexport default {\n  async mounted () {\n    const app = await this.$fire.appReady()\n    console.info('app ready', app) // eslint-disable-line no-console\n  }\n}\n</script>\n"
  },
  {
    "path": "packages/firebase-module/test/lazy-init-auth.test.js",
    "content": "const { resolve } = require('path')\nconst fs = require('fs-extra')\nconst { Nuxt, Builder } = require('nuxt')\nconst FirebaseModule = require('..')\n\njest.mock('firebase/compat/app', () => {\n  const { getProxyMock } = require('proxy-mock-js')\n  const spyFn = (name, fn) => jest.fn(fn)\n  const session = getProxyMock({}, 'firebaseSession', spyFn)\n\n  /* const session = new Proxy({}, {\n    get(target, name) {\n      return jest.fn(() => ({}))\n    }\n  }) */\n\n  return {\n    apps: [session],\n    messaging: {\n      isSupported: jest.fn(),\n    },\n  }\n})\n\ndescribe('lazy-init-auth', () => {\n  let nuxt\n  const buildDir = resolve(__dirname, '.nuxt-lazy-init-auth')\n\n  beforeAll(async () => {\n    const config = {\n      rootDir: resolve(__dirname, '..'),\n      buildDir,\n      srcDir: resolve(__dirname, 'fixture'),\n      modules: [\n        [\n          FirebaseModule,\n          {\n            injectModule: false,\n            lazy: true,\n            config: {\n              // REQUIRED: Official config for firebase.initializeApp(config):\n              apiKey: '<apiKey>',\n              authDomain: '<authDomain>',\n              databaseURL: '<databaseURL>',\n              projectId: '<projectId>',\n              storageBucket: '<storageBucket>',\n              messagingSenderId: '<messagingSenderId>',\n              appId: '<appId>',\n              measurementId: '<measurementId>',\n            },\n            services: {\n              analytics: true,\n              auth: {\n                initialize: {\n                  onAuthStateChangedAction: 'onAuthStateChanged',\n                },\n              },\n              firestore: true,\n              functions: true,\n              messaging: true,\n              performance: true,\n              database: true,\n              remoteConfig: true,\n              storage: true,\n            },\n          },\n        ],\n      ],\n    }\n    config.dev = false\n\n    nuxt = new Nuxt(config)\n    const BundleBuilder = { build: (_) => _ }\n    const builder = new Builder(nuxt, BundleBuilder)\n    await builder.build()\n  }, 60000)\n\n  afterAll(async () => {\n    await nuxt.close()\n  })\n\n  test('init auth plugin exist', async () => {\n    const content = await fs.readFile(\n      resolve(buildDir, 'firebase/service.auth.initialize.js'),\n      { encoding: 'utf8' }\n    )\n    expect(content).toMatchSnapshot()\n  })\n})\n"
  },
  {
    "path": "packages/firebase-module/test/lazy.test.js",
    "content": "const { resolve } = require('path')\nconst fs = require('fs-extra')\nconst { Nuxt, Builder } = require('nuxt')\nconst FirebaseModule = require('..')\n\njest.mock('firebase/compat/app', () => {\n  const { getProxyMock } = require('proxy-mock-js')\n  const spyFn = (name, fn) => jest.fn(fn)\n  const session = getProxyMock({}, 'firebaseSession', spyFn)\n\n  /* const session = new Proxy({}, {\n    get(target, name) {\n      return jest.fn(() => ({}))\n    }\n  }) */\n\n  return {\n    apps: [session],\n    messaging: {\n      isSupported: jest.fn(),\n    },\n  }\n})\n\ndescribe('lazy', () => {\n  let nuxt\n  const buildDir = resolve(__dirname, '.nuxt-lazy')\n\n  beforeAll(async () => {\n    const config = {\n      rootDir: resolve(__dirname, '..'),\n      buildDir,\n      srcDir: resolve(__dirname, 'fixture'),\n      modules: [\n        [\n          FirebaseModule,\n          {\n            injectModule: false,\n            lazy: true,\n            config: {\n              // REQUIRED: Official config for firebase.initializeApp(config):\n              apiKey: '<apiKey>',\n              authDomain: '<authDomain>',\n              databaseURL: '<databaseURL>',\n              projectId: '<projectId>',\n              storageBucket: '<storageBucket>',\n              messagingSenderId: '<messagingSenderId>',\n              appId: '<appId>',\n              measurementId: '<measurementId>',\n            },\n            services: {\n              analytics: true,\n              auth: true,\n              firestore: true,\n              functions: true,\n              messaging: true,\n              performance: true,\n              database: true,\n              remoteConfig: true,\n              storage: true,\n            },\n          },\n        ],\n      ],\n    }\n    config.dev = false\n\n    nuxt = new Nuxt(config)\n    const BundleBuilder = { build: (_) => _ }\n    const builder = new Builder(nuxt, BundleBuilder)\n    await builder.build()\n  }, 60000)\n\n  afterAll(async () => {\n    await nuxt.close()\n  })\n\n  test('plugin contents', async () => {\n    const content = await fs.readFile(resolve(buildDir, 'firebase/index.js'), {\n      encoding: 'utf8',\n    })\n\n    expect(content).toContain('fire.auth = null')\n    expect(content).toContain('fire.messaging = null')\n\n    expect(content).not.toContain('Mess')\n\n    expect(content).toMatchSnapshot()\n  })\n\n  test('exec plugin (server)', async () => {\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(1)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeUndefined()\n\n    expect(ctx.$fire.appReady).toBeDefined()\n\n    // TODO: test the appReady call. Doesnt work atm due to Jest not detecting\n    // a async callback in the session var. Not fully sure whats happening\n    // const app = await ctx.$fire.appReady()\n  })\n\n  test('exec plugin (client)', async () => {\n    process.client = true\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(1)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeUndefined()\n  })\n})\n"
  },
  {
    "path": "packages/firebase-module/test/with-module.test.js",
    "content": "const { resolve } = require('path')\nconst fs = require('fs-extra')\nconst { Nuxt, Builder } = require('nuxt')\nconst FirebaseModule = require('..')\n\njest.mock('firebase/compat/app', () => ({\n  apps: [\n    new Proxy(\n      {},\n      {\n        get(target, name) {\n          return jest.fn(() => ({}))\n        },\n      }\n    ),\n  ],\n  messaging: {\n    isSupported: jest.fn(),\n  },\n}))\n\ndescribe('with-module', () => {\n  let nuxt\n  const buildDir = resolve(__dirname, '.nuxt-with-module')\n\n  beforeAll(async () => {\n    const config = {\n      rootDir: resolve(__dirname, '..'),\n      buildDir,\n      srcDir: resolve(__dirname, 'fixture'),\n      modules: [\n        [\n          FirebaseModule,\n          {\n            injectModule: true,\n            config: {\n              // REQUIRED: Official config for firebase.initializeApp(config):\n              apiKey: '<apiKey>',\n              authDomain: '<authDomain>',\n              databaseURL: '<databaseURL>',\n              projectId: '<projectId>',\n              storageBucket: '<storageBucket>',\n              messagingSenderId: '<messagingSenderId>',\n              appId: '<appId>',\n              measurementId: '<measurementId>',\n            },\n            services: {\n              analytics: true,\n              auth: true,\n              firestore: true,\n              functions: true,\n              messaging: true,\n              performance: true,\n              database: true,\n              remoteConfig: true,\n              storage: true,\n            },\n          },\n        ],\n      ],\n    }\n    config.dev = false\n\n    nuxt = new Nuxt(config)\n    const BundleBuilder = { build: (_) => _ }\n    const builder = new Builder(nuxt, BundleBuilder)\n    await builder.build()\n  }, 60000)\n\n  afterAll(async () => {\n    await nuxt.close()\n  })\n\n  test('plugin contents', async () => {\n    const content = await fs.readFile(resolve(buildDir, 'firebase/index.js'), {\n      encoding: 'utf8',\n    })\n\n    expect(content).toContain('auth,')\n    expect(content).toContain('messaging,')\n    expect(content).toContain('firebase')\n\n    expect(content).not.toContain('Mess')\n\n    expect(content).toMatchSnapshot()\n  })\n\n  test('exec plugin (server)', async () => {\n    process.server = true\n    process.client = false\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(2)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeDefined()\n  })\n\n  test('exec plugin (client)', async () => {\n    process.server = false\n    process.client = true\n    const Plugin = await import(resolve(buildDir, 'firebase/index.js')).then(\n      (m) => m.default || m\n    )\n    const ctx = {}\n    const inject = jest.fn()\n\n    await Plugin(ctx, inject)\n    expect(inject).toHaveBeenCalledTimes(2)\n    expect(ctx.$fire).toBeDefined()\n    expect(ctx.$fireModule).toBeDefined()\n  })\n})\n"
  },
  {
    "path": "packages/firebase-module/types/index.d.ts",
    "content": "import { ServerResponse } from 'http'\nimport { Vue } from 'vue/types/vue'\nimport { NuxtAppOptions, Configuration } from '@nuxt/types'\nimport { NuxtConfiguration } from '@nuxt/vue-app'\nimport { ServiceAccount } from 'firebase-admin'\n\nimport firebase from 'firebase/compat'\nimport { auth } from 'firebase-admin'\n\n/***********************************\n * Module Config\n ************************************/\nexport interface FirebaseConfiguration {\n  apiKey: string\n  authDomain: string\n  databaseURL?: string\n  projectId: string\n  storageBucket: string\n  messagingSenderId: string\n  appId: string\n  measurementId: string\n}\n\ninterface ServiceConfig {\n  static?: boolean\n  preload?: boolean\n  chunkName?: string\n}\n\ninterface messagingAction {\n  action: string\n  url?: string\n}\n\nexport interface AuthServiceConfig extends ServiceConfig {\n  persistence?: firebase.auth.Auth.Persistence\n\n  initialize?: {\n    onAuthStateChangedMutation?: string\n    onAuthStateChangedAction?: string\n    onIdTokenChangedMutation?: string\n    onIdTokenChangedAction?: string\n    subscribeManually?: boolean\n  }\n\n  ssr?:\n    | boolean\n    | {\n        credential: string | ServiceAccount | true\n        serverLogin?:\n          | boolean\n          | {\n              sessionLifetime?: number\n              loginDelay?: number\n            }\n        ignorePaths?: (string | RegExp)[]\n      }\n\n  emulatorPort?: number\n  emulatorHost?: string\n  disableEmulatorWarnings?: boolean\n}\n\nexport interface FirestoreServiceConfig extends ServiceConfig {\n  memoryOnly?: boolean\n  enablePersistence?:\n    | boolean\n    | {\n        synchronizeTabs: boolean\n      }\n  emulatorPort?: number\n  emulatorHost?: string\n  settings?: firebase.firestore.Settings\n}\n\nexport interface FunctionsServiceConfig extends ServiceConfig {\n  location?: string\n  emulatorPort?: number\n  emulatorHost?: string\n}\n\nexport interface StorageServiceConfig extends ServiceConfig {\n  emulatorPort?: number\n  emulatorHost?: string\n}\n\nexport interface DatabaseServiceConfig extends ServiceConfig {\n  emulatorPort?: number\n  emulatorHost?: string\n}\n\nexport interface MessagingServiceConfig extends ServiceConfig {\n  createServiceWorker?:\n    | boolean\n    | {\n        notification: {\n          title: string\n          body: string\n          image: string\n          vibrate: number[]\n          clickPath: string\n        }\n      }\n  actions?: messagingAction[]\n  fcmPublicVapidKey?: string\n  inject?: string\n}\n\nexport interface PerformanceServiceConfig extends ServiceConfig {}\n\nexport interface AppCheckServiceConfig extends ServiceConfig {\n  debugToken?: string | boolean\n}\n\nexport interface AnalyticsServiceConfig extends ServiceConfig {\n  collectionEnabled?: boolean\n}\n\nexport interface RemoteConfigServiceConfig extends ServiceConfig {\n  settings?: {\n    fetchTimeoutMillis?: number\n    minimumFetchIntervalMillis?: number\n  }\n  defaultConfig?: Record<string, string>\n}\n\nexport interface FirebaseModuleConfiguration {\n  injectModule?: boolean\n  lazy?: boolean\n  config:\n    | {\n        [envKey: string]: FirebaseConfiguration\n      }\n    | FirebaseConfiguration\n  services: {\n    auth?: boolean | AuthServiceConfig\n    firestore?: boolean | FirestoreServiceConfig\n    functions?: boolean | FunctionsServiceConfig\n    storage?: boolean | StorageServiceConfig\n    database?: boolean | DatabaseServiceConfig\n    messaging?: boolean | MessagingServiceConfig\n    performance?: boolean | PerformanceServiceConfig\n    appCheck?: boolean | AppCheckServiceConfig\n    analytics?: boolean | AnalyticsServiceConfig\n    remoteConfig?: boolean | RemoteConfigServiceConfig\n  }\n  customEnv?: boolean\n  onFirebaseHosting?: boolean | object\n  terminateDatabasesAfterGenerate?: boolean\n}\n\n/***********************************\n * Injections\n ************************************/\n\ninterface ReadyFunction {\n  (): void\n}\n\ninterface NuxtFireInstance {\n  auth: firebase.auth.Auth\n  authReady: ReadyFunction\n  database: firebase.database.Database\n  databaseReady: ReadyFunction\n  firestore: firebase.firestore.Firestore\n  firestoreReady: ReadyFunction\n  functions: firebase.functions.Functions\n  functionsReady: ReadyFunction\n  storage: firebase.storage.Storage\n  storageReady: ReadyFunction\n  messaging: firebase.messaging.Messaging\n  messagingReady: ReadyFunction\n  performance: firebase.performance.Performance\n  performanceReady: ReadyFunction\n  appCheck: firebase.appCheck.AppCheck\n  appCheckReady: ReadyFunction\n  analytics: firebase.analytics.Analytics\n  analyticsReady: ReadyFunction\n  remoteConfig: firebase.remoteConfig.RemoteConfig\n  remoteConfigReady: ReadyFunction\n}\n\ninterface NuxtFireAuthStore {\n  subscribe: () => Promise<void>\n  unsubscribe: () => void\n}\n\ndeclare module '@nuxt/vue-app' {\n  interface NuxtConfiguration {\n    firebase?: FirebaseModuleConfiguration\n  }\n  interface Context {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n  interface NuxtAppOptions {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n}\n\ndeclare module '@nuxt/types' {\n  interface Context {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n\n  interface NuxtAppOptions {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n\n  interface Configuration {\n    firebase?: FirebaseModuleConfiguration\n  }\n}\n\ndeclare module 'vue/types/vue' {\n  interface Vue {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n}\n\ndeclare module '@nuxt/vue-app' {\n  interface NuxtAppOptions {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n}\n\ndeclare module 'vuex/types/index' {\n  interface Store<S> {\n    $fireModule: typeof firebase\n    $fire: NuxtFireInstance\n    $fireAuthStore: NuxtFireAuthStore\n  }\n}\n\n/***********************************\n * Misc\n ************************************/\n\nexport type FireAuthServerUser = Omit<\n  auth.UserRecord,\n  'disabled' | 'metadata' | 'providerData'\n> &\n  Partial<Pick<auth.UserRecord, 'disabled' | 'metadata' | 'providerData'>> & {\n    allClaims: auth.DecodedIdToken\n    idToken: string\n  }\n\ndeclare module 'http' {\n  interface ServerResponse {\n    locals: Record<'user', FireAuthServerUser> & Record<string, any>\n  }\n}\n"
  }
]