Skip to content

Commit e13b794

Browse files
authored
Create experiment modularized FM SDK (#3822)
Check in FM modularzied SDK into exp directory
1 parent 404dc91 commit e13b794

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4827
-3
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
},
1212
"typescript.tsdk": "node_modules/typescript/lib",
1313
"files.associations": { "*.json": "jsonc" }
14-
}
14+
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## API Report File for "@firebase/messaging-exp"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { FirebaseApp } from '@firebase/app-types-exp';
8+
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
9+
import { MessagePayload } from '@firebase/messaging-types-exp';
10+
import { NextFn } from '@firebase/util';
11+
import { Observer } from '@firebase/util';
12+
import { Unsubscribe } from '@firebase/util';
13+
14+
// @public
15+
export function deleteToken(messaging: FirebaseMessaging): Promise<boolean>;
16+
17+
// @public
18+
export function getMessaging(app: FirebaseApp): FirebaseMessaging;
19+
20+
// @public
21+
export function getToken(messaging: FirebaseMessaging, options?: {
22+
vapidKey?: string;
23+
swReg?: ServiceWorkerRegistration;
24+
}): Promise<string>;
25+
26+
// @public
27+
export function onMessage(messaging: FirebaseMessaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
28+
29+
30+
// (No @packageDocumentation comment for this package)
31+
32+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
export * from '@firebase/messaging-exp';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "firebase-exp/messaging",
3+
"main": "dist/index.cjs.js",
4+
"browser": "dist/index.esm.js",
5+
"module": "dist/index.esm.js",
6+
"typings": "dist/messaging/index.d.ts"
7+
}

packages-exp/firebase-exp/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"@firebase/functions-exp": "0.0.900",
4444
"@firebase/firestore": "2.1.1",
4545
"@firebase/performance-exp": "0.0.900",
46-
"@firebase/remote-config-exp": "0.0.900"
46+
"@firebase/remote-config-exp": "0.0.900",
47+
"@firebase/messaging-exp": "0.0.900"
48+
4749
},
4850
"devDependencies": {
4951
"rollup": "2.33.2",
@@ -66,6 +68,7 @@
6668
"firestore",
6769
"firestore/lite",
6870
"performance",
69-
"remote-config"
71+
"remote-config",
72+
"messaging"
7073
]
7174
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
module.exports = {
19+
extends: '../../config/.eslintrc.js',
20+
parserOptions: {
21+
project: 'tsconfig.json',
22+
// to make vscode-eslint work with monorepo
23+
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
24+
tsconfigRootDir: __dirname
25+
}
26+
};

packages-exp/messaging-exp/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @firebase/messaging
2+
3+
This is the Firebase Cloud Messaging component of the Firebase JS SDK.
4+
5+
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../config/api-extractor.json",
3+
// Point it to your entry point d.ts file.
4+
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
5+
"dtsRollup": {
6+
"enabled": true
7+
}
8+
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* @license
3+
* Copyright 2017 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const karmaBase = require('../../config/karma.base');
19+
20+
const files = [`src/**/*.test.ts`];
21+
22+
module.exports = function (config) {
23+
const karmaConfig = {
24+
...karmaBase,
25+
files,
26+
frameworks: ['mocha']
27+
};
28+
29+
config.set(karmaConfig);
30+
};
31+
32+
module.exports.files = files;
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "@firebase/messaging-exp",
3+
"private": true,
4+
"version": "0.0.900",
5+
"description": "",
6+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
7+
"main": "dist/index.cjs.js",
8+
"module": "dist/index.esm.js",
9+
"esm2017": "dist/index.esm2017.js",
10+
"sw": "dist/index.sw.esm5.js",
11+
"files": [
12+
"dist"
13+
],
14+
"scripts": {
15+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
16+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
17+
"build": "rollup -c && yarn api-report",
18+
"build:deps": "lerna run --scope @firebase/'{app-exp,messaging-exp}' --include-dependencies build",
19+
"dev": "rollup -c -w",
20+
"test": "run-p test:karma type-check lint ",
21+
"test:integration": "run-p test:karma type-check lint && cd ../../integration/messaging && npm run-script test",
22+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
23+
"test:karma": "karma start --single-run",
24+
"test:debug": "karma start --browsers=Chrome --auto-watch",
25+
"prepare": "yarn build",
26+
"api-report": "api-extractor run --local --verbose",
27+
"type-check": "tsc --noEmit"
28+
},
29+
"license": "Apache-2.0",
30+
"peerDependencies": {
31+
"@firebase/app-exp": "0.x",
32+
"@firebase/app-types-exp": "0.x"
33+
},
34+
"dependencies": {
35+
"@firebase/component": "0.1.21",
36+
"@firebase/installations-exp": "0.x",
37+
"@firebase/messaging-types-exp": "0.0.900",
38+
"@firebase/util": "0.3.2",
39+
"idb": "3.0.2",
40+
"tslib": "^1.11.1"
41+
},
42+
"devDependencies": {
43+
"rollup-plugin-json": "4.0.0",
44+
"rollup-plugin-typescript2": "0.27.0",
45+
"ts-essentials": "7.0.1",
46+
"typescript": "3.8.3"
47+
},
48+
"repository": {
49+
"directory": "packages/messaging",
50+
"type": "git",
51+
"url": "https://github.com/firebase/firebase-js-sdk.git"
52+
},
53+
"bugs": {
54+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
55+
},
56+
"typings": "dist/index.d.ts"
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* @license
3+
* Copyright 2018 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import json from 'rollup-plugin-json';
19+
import pkg from './package.json';
20+
import typescript from 'typescript';
21+
import typescriptPlugin from 'rollup-plugin-typescript2';
22+
23+
const deps = Object.keys(
24+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
25+
);
26+
27+
/**
28+
* ES5 Builds
29+
*/
30+
const es5BuildPlugins = [
31+
typescriptPlugin({
32+
typescript
33+
}),
34+
json()
35+
];
36+
37+
const es5Builds = [
38+
// window builds
39+
{
40+
input: 'src/index.ts',
41+
output: [
42+
{ file: pkg.main, format: 'cjs', sourcemap: true },
43+
{ file: pkg.module, format: 'es', sourcemap: true }
44+
],
45+
plugins: es5BuildPlugins,
46+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
47+
},
48+
49+
// sw builds
50+
{
51+
input: 'src/index.sw.ts',
52+
output: [{ file: pkg.sw, format: 'es', sourcemap: true }],
53+
plugins: es5BuildPlugins,
54+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
55+
}
56+
];
57+
58+
/**
59+
* ES2017 Builds
60+
*/
61+
const es2017BuildPlugins = [
62+
typescriptPlugin({
63+
typescript,
64+
tsconfigOverride: {
65+
compilerOptions: {
66+
target: 'es2017'
67+
}
68+
}
69+
}),
70+
json({ preferConst: true })
71+
];
72+
73+
const es2017Builds = [
74+
{
75+
input: 'src/index.ts',
76+
output: {
77+
file: pkg.esm2017,
78+
format: 'es',
79+
sourcemap: true
80+
},
81+
plugins: es2017BuildPlugins,
82+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
83+
}
84+
];
85+
86+
export default [...es5Builds, ...es2017Builds];

0 commit comments

Comments
 (0)