Skip to content

Commit d638a42

Browse files
Fis compat (#4215)
* fis-compat implementation * add installations-compat to changeset ignore list * merge congif.ts into index.ts * Update packages-exp/installations-compat/src/index.ts Co-authored-by: Feiyang <[email protected]> * add app-compat back in NameServiceMapping Co-authored-by: Feiyang <[email protected]>
1 parent ba59a0f commit d638a42

13 files changed

+582
-1
lines changed

.changeset/config.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3-
"changelog": ["../repo-scripts/changelog-generator", { "repo": "firebase/firebase-js-sdk"}],
3+
"changelog": [
4+
"../repo-scripts/changelog-generator",
5+
{ "repo": "firebase/firebase-js-sdk" }
6+
],
47
"commit": false,
58
"linked": [],
69
"access": "public",
@@ -20,6 +23,7 @@
2023
"@firebase/functions-types-exp",
2124
"@firebase/installations-exp",
2225
"@firebase/installations-types-exp",
26+
"@firebase/installations-compat",
2327
"@firebase/messaging-exp",
2428
"@firebase/messaging-types-exp",
2529
"@firebase/performance-exp",
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+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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 to load into karma
26+
files,
27+
// frameworks to use
28+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
29+
frameworks: ['mocha']
30+
};
31+
32+
config.set(karmaConfig);
33+
};
34+
35+
module.exports.files = files;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@firebase/installations-compat",
3+
"version": "0.0.900",
4+
"private": true,
5+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6+
"main": "dist/index.cjs.js",
7+
"module": "dist/index.esm.js",
8+
"browser": "dist/index.esm.js",
9+
"esm2017": "dist/index.esm2017.js",
10+
"typings": "dist/installations-compat.d.ts",
11+
"license": "Apache-2.0",
12+
"files": ["dist"],
13+
"scripts": {
14+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
15+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
16+
"build": "rollup -c",
17+
"build:deps": "lerna run --scope @firebase/installations-compat --include-dependencies build",
18+
"build:release": "rollup -c rollup.config.release.js",
19+
"dev": "rollup -c -w",
20+
"test": "yarn type-check && yarn test:karma && yarn lint",
21+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
22+
"test:karma": "karma start --single-run",
23+
"test:debug": "karma start --browsers=Chrome --auto-watch",
24+
"type-check": "tsc -p . --noEmit",
25+
"serve": "yarn serve:build && yarn serve:host",
26+
"serve:build": "rollup -c test-app/rollup.config.js",
27+
"serve:host": "http-server -c-1 test-app",
28+
"prepare": "yarn build:release",
29+
"api-report": "api-extractor run --local --verbose",
30+
"predoc": "node ../../scripts/exp/remove-exp.js temp",
31+
"doc": "api-documenter markdown --input temp --output docs",
32+
"build:doc": "yarn build && yarn doc"
33+
},
34+
"repository": {
35+
"directory": "packages-exp/installations-compat",
36+
"type": "git",
37+
"url": "https://github.com/firebase/firebase-js-sdk.git"
38+
},
39+
"bugs": {
40+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
41+
},
42+
"devDependencies": {
43+
"@firebase/app-compat": "0.0.900",
44+
"rollup": "2.33.2",
45+
"@rollup/plugin-commonjs": "15.1.0",
46+
"@rollup/plugin-json": "4.1.0",
47+
"@rollup/plugin-node-resolve": "9.0.0",
48+
"rollup-plugin-typescript2": "0.29.0",
49+
"rollup-plugin-uglify": "6.0.4",
50+
"typescript": "4.0.5"
51+
},
52+
"peerDependencies": {
53+
"@firebase/app-compat": "0.x"
54+
},
55+
"dependencies": {
56+
"@firebase/installations-exp": "0.0.900",
57+
"@firebase/installations-types-exp": "0.0.900",
58+
"@firebase/util": "0.3.4",
59+
"@firebase/component": "0.1.21",
60+
"idb": "3.0.2",
61+
"tslib": "^1.11.1"
62+
}
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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 typescriptPlugin from 'rollup-plugin-typescript2';
20+
import typescript from 'typescript';
21+
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';
22+
23+
/**
24+
* ES5 Builds
25+
*/
26+
const es5BuildPlugins = [typescriptPlugin({ typescript }), json()];
27+
28+
const es5Builds = es5BuildsNoPlugin.map(build => ({
29+
...build,
30+
plugins: es5BuildPlugins
31+
}));
32+
33+
/**
34+
* ES2017 Builds
35+
*/
36+
const es2017BuildPlugins = [
37+
typescriptPlugin({
38+
typescript,
39+
tsconfigOverride: {
40+
compilerOptions: {
41+
target: 'es2017'
42+
}
43+
}
44+
}),
45+
json({ preferConst: true })
46+
];
47+
48+
const es2017Builds = es2017BuildsNoPlugin.map(build => ({
49+
...build,
50+
plugins: es2017BuildPlugins
51+
}));
52+
53+
export default [...es5Builds, ...es2017Builds];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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 typescriptPlugin from 'rollup-plugin-typescript2';
20+
import typescript from 'typescript';
21+
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
22+
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';
23+
24+
/**
25+
* ES5 Builds
26+
*/
27+
const es5BuildPlugins = [
28+
typescriptPlugin({
29+
typescript,
30+
clean: true,
31+
abortOnError: false,
32+
transformers: [importPathTransformer]
33+
}),
34+
json()
35+
];
36+
37+
const es5Builds = es5BuildsNoPlugin.map(build => ({
38+
...build,
39+
plugins: es5BuildPlugins,
40+
treeshake: {
41+
moduleSideEffects: false
42+
}
43+
}));
44+
45+
/**
46+
* ES2017 Builds
47+
*/
48+
const es2017BuildPlugins = [
49+
typescriptPlugin({
50+
typescript,
51+
tsconfigOverride: {
52+
compilerOptions: {
53+
target: 'es2017'
54+
}
55+
},
56+
abortOnError: false,
57+
clean: true,
58+
transformers: [importPathTransformer]
59+
}),
60+
json({ preferConst: true })
61+
];
62+
63+
const es2017Builds = es2017BuildsNoPlugin.map(build => ({
64+
...build,
65+
plugins: es2017BuildPlugins,
66+
treeshake: {
67+
moduleSideEffects: false
68+
}
69+
}));
70+
71+
export default [...es5Builds, ...es2017Builds];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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+
import pkg from './package.json';
18+
19+
const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies });
20+
21+
/**
22+
* ES5 Builds
23+
*/
24+
export const es5BuildsNoPlugin = [
25+
{
26+
input: 'src/index.ts',
27+
output: [
28+
{ file: pkg.main, format: 'cjs', sourcemap: true },
29+
{ file: pkg.module, format: 'es', sourcemap: true }
30+
],
31+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
32+
}
33+
];
34+
35+
/**
36+
* ES2017 Builds
37+
*/
38+
export const es2017BuildsNoPlugin = [
39+
{
40+
input: 'src/index.ts',
41+
output: {
42+
file: pkg.esm2017,
43+
format: 'es',
44+
sourcemap: true
45+
},
46+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
47+
}
48+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
import { firebase } from '@firebase/app-compat';
19+
import { name, version } from '../package.json';
20+
import { _FirebaseNamespace } from '@firebase/app-types/private';
21+
import { Component, ComponentType } from '@firebase/component';
22+
import { FirebaseInstallations as FirebaseInstallationsCompat } from '@firebase/installations-types';
23+
import { FirebaseApp } from '@firebase/app-types';
24+
import { InstallationsCompat } from './installationsCompat';
25+
26+
declare module '@firebase/component' {
27+
interface NameServiceMapping {
28+
'app-compat': FirebaseApp;
29+
'installations-compat': FirebaseInstallationsCompat;
30+
}
31+
}
32+
33+
function registerInstallations(instance: _FirebaseNamespace): void {
34+
instance.INTERNAL.registerComponent(
35+
new Component(
36+
'installations-compat',
37+
container => {
38+
const app = container.getProvider('app-compat').getImmediate()!;
39+
const installations = container
40+
.getProvider('installations-exp')
41+
.getImmediate()!;
42+
return new InstallationsCompat(app, installations);
43+
},
44+
ComponentType.PUBLIC
45+
)
46+
);
47+
48+
instance.registerVersion(name, version);
49+
}
50+
51+
registerInstallations(firebase as _FirebaseNamespace);

0 commit comments

Comments
 (0)