File tree Expand file tree Collapse file tree 6 files changed +105
-4
lines changed Expand file tree Collapse file tree 6 files changed +105
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { defineBuildConfig } from 'unbuild'
2
2
3
3
export default defineBuildConfig ( {
4
+ entries : [
5
+ {
6
+ input : './src/index' ,
7
+ name : 'index' ,
8
+ } ,
9
+ {
10
+ input : './src/server/index' ,
11
+ name : 'server/index' ,
12
+ } ,
13
+ ] ,
4
14
declaration : true ,
5
15
externals : [
6
16
'firebase' ,
17
+ 'firebase/auth' ,
18
+ 'firebase/app-check' ,
7
19
'firebase/firestore' ,
8
20
'firebase/database' ,
21
+ 'firebase/storage' ,
9
22
'@firebase/firestore-types' ,
10
23
'@firebase/database-types' ,
24
+ 'firebase-admin' ,
11
25
] ,
26
+
27
+ rollup : {
28
+ emitCJS : true ,
29
+ } ,
30
+
31
+ // hooks: {
32
+ // 'rollup:options': (ctx, options) => {
33
+ // if (!Array.isArray(options.output)) {
34
+ // options.output = options.output ? [options.output] : []
35
+ // }
36
+ // options.output.push({
37
+ // dir: ctx.options.outDir,
38
+ // format: 'cjs',
39
+ // entryFileNames: '[name].cjs',
40
+ // exports: 'auto',
41
+ // externalLiveBindings: false,
42
+ // freeze: false,
43
+ // })
44
+ // },
45
+ // },
12
46
} )
Original file line number Diff line number Diff line change 10
10
"." : {
11
11
"import" : " ./dist/index.mjs" ,
12
12
"require" : " ./dist/index.cjs"
13
+ },
14
+ "./server" : {
15
+ "import" : " ./dist/server/index.mjs" ,
16
+ "require" : " ./dist/server/index.cjs"
13
17
}
14
18
},
15
19
"main" : " ./dist/index.cjs" ,
76
80
"enquirer" : " ^2.3.6" ,
77
81
"execa" : " ^6.1.0" ,
78
82
"firebase" : " ^9.14.0" ,
83
+ "firebase-admin" : " ^11.3.0" ,
79
84
"focus-visible" : " ^5.2.0" ,
80
85
"happy-dom" : " ^7.7.0" ,
81
86
"lint-staged" : " ^13.0.4" ,
Original file line number Diff line number Diff line change 43
43
"@nuxtjs/eslint-config-typescript" : " ^12.0.0" ,
44
44
"eslint" : " ^8.28.0" ,
45
45
"firebase" : " ^9.14.0" ,
46
+ "firebase-admin" : " ^11.3.0" ,
46
47
"nuxt" : " ^3.0.0" ,
47
48
"vuefire" : " workspace:*"
48
49
}
Original file line number Diff line number Diff line change
1
+ import type { app } from 'firebase-admin'
2
+ import { CustomProvider , initializeAppCheck } from 'firebase/app-check'
3
+
4
+ /**
5
+ * Adds AppCheck using the Firebase Admin SDK. This is necessary on the Server if you have configured AppCheck on the
6
+ * client.
7
+ *
8
+ * @param adminApp - firebase-admin app
9
+ * @param appId - appId option passed to firebase/app initializeApp()
10
+ * @param param2 options
11
+ */
12
+ export function VueFireAppCheckServer (
13
+ adminApp : app . App ,
14
+ appId : string ,
15
+ {
16
+ // default to 1 week
17
+ ttlMillis = 604_800_000 ,
18
+ } : {
19
+ ttlMillis ?: number
20
+ } = { }
21
+ ) {
22
+ initializeAppCheck ( undefined , {
23
+ provider : new CustomProvider ( {
24
+ getToken : ( ) =>
25
+ adminApp
26
+ . appCheck ( )
27
+ . createToken ( appId , { ttlMillis } )
28
+ . then ( ( { token, ttlMillis : expireTimeMillis } ) => ( {
29
+ token,
30
+ expireTimeMillis,
31
+ } ) ) ,
32
+ } ) ,
33
+ isTokenAutoRefreshEnabled : false ,
34
+ } )
35
+ }
Original file line number Diff line number Diff line change
1
+ export { VueFireAppCheckServer } from './app-check'
You can’t perform that action at this time.
0 commit comments