Skip to content

Commit cffa42a

Browse files
authored
Merge bcfccba into 5d4d182
2 parents 5d4d182 + bcfccba commit cffa42a

36 files changed

+1937
-4
lines changed

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@firebase/functions-exp",
1919
"@firebase/functions-types-exp",
2020
"firebase-exp",
21+
"@firebase/app-compat",
2122
"@firebase/changelog-generator",
2223
"firebase-size-analysis"
2324
],

common/api-review/app-exp.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export function _clearComponents(): void;
2929
// @internal
3030
export const _components: Map<string, Component<any>>;
3131

32+
// @internal
33+
export const _DEFAULT_ENTRY_NAME = "[DEFAULT]";
34+
3235
// @public
3336
export function deleteApp(app: FirebaseApp): Promise<void>;
3437

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"scripts": {
2424
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
2525
"build": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --scope rxfire --ignore @firebase/app-exp build",
26-
"build:exp": "lerna run --scope @firebase/*-exp --scope firebase-exp build",
26+
"build:exp": "lerna run --scope @firebase/*-exp --scope @firebase/*-compat --scope firebase-exp build",
2727
"build:release": "lerna run --scope @firebase/app-exp build:deps && lerna run --scope @firebase/* --scope firebase --scope rxfire --ignore @firebase/*-exp prepare",
28-
"build:exp:release": "yarn --cwd packages/app build:deps && lerna run --scope @firebase/*-exp --scope firebase-exp prepare && yarn --cwd packages-exp/app-exp typings:public",
28+
"build:exp:release": "yarn --cwd packages/app build:deps && lerna run --scope @firebase/*-exp --scope @firebase/*-compat --scope firebase-exp prepare && yarn --cwd packages-exp/app-exp typings:public",
2929
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
3030
"stage:packages": "./scripts/prepublish.sh",
3131
"repl": "node tools/repl.js",

packages-exp/app-compat/.eslintrc.js

Lines changed: 26 additions & 0 deletions
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/app-compat/.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Directories not needed by end users
2+
/src
3+
test
4+
5+
# Files not needed by end users
6+
gulpfile.js
7+
index.ts
8+
karma.conf.js
9+
tsconfig.json

packages-exp/app-compat/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @firebase/app-compat
2+
3+
This is the compat package that recreates the v7 APIs.
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.**

packages-exp/app-compat/karma.conf.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 karma = require('karma');
19+
const path = require('path');
20+
const karmaBase = require('../../config/karma.base');
21+
22+
const files = ['test/**/*', 'src/**/*.test.ts'];
23+
24+
module.exports = function (config) {
25+
const karmaConfig = Object.assign({}, karmaBase, {
26+
// files to load into karma
27+
files: files,
28+
// frameworks to use
29+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
30+
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
31+
frameworks: ['mocha']
32+
});
33+
34+
config.set(karmaConfig);
35+
};
36+
37+
module.exports.files = files;

packages-exp/app-compat/package.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "@firebase/app-compat",
3+
"version": "0.0.800",
4+
"description": "The primary entrypoint to the Firebase JS SDK",
5+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6+
"private": true,
7+
"main": "dist/index.cjs.js",
8+
"browser": "dist/index.esm5.js",
9+
"module": "dist/index.esm5.js",
10+
"esm2017": "dist/index.esm2017.js",
11+
"lite": "dist/index.lite.js",
12+
"lite-esm2017": "dist/index.lite.esm2017.js",
13+
"files": [
14+
"dist"
15+
],
16+
"scripts": {
17+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
18+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
19+
"build": "rollup -c",
20+
"build:deps": "lerna run --scope @firebase/app-compat --include-dependencies build",
21+
"dev": "rollup -c -w",
22+
"test": "yarn type-check && run-p lint test:browser test:node",
23+
"type-check": "tsc -p . --noEmit",
24+
"test:browser": "karma start --single-run",
25+
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
26+
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* src/**/*.test.ts --config ../../config/mocharc.node.js",
27+
"prepare": "yarn build"
28+
},
29+
"license": "Apache-2.0",
30+
"dependencies": {
31+
"@firebase/app-exp": "0.0.800",
32+
"@firebase/util": "0.3.0",
33+
"@firebase/logger": "0.2.6",
34+
"@firebase/component": "0.1.17",
35+
"tslib": "^1.11.1",
36+
"dom-storage": "2.1.0",
37+
"xmlhttprequest": "1.8.0"
38+
},
39+
"devDependencies": {
40+
"rollup": "2.23.0",
41+
"rollup-plugin-json": "4.0.0",
42+
"rollup-plugin-replace": "2.2.0",
43+
"rollup-plugin-typescript2": "0.27.1",
44+
"typescript": "3.9.7"
45+
},
46+
"repository": {
47+
"directory": "packages-exp/app-compat",
48+
"type": "git",
49+
"url": "https://github.com/firebase/firebase-js-sdk.git"
50+
},
51+
"bugs": {
52+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
53+
},
54+
"typings": "dist/src/index.d.ts",
55+
"nyc": {
56+
"extension": [
57+
".ts"
58+
],
59+
"reportDir": "./coverage/node"
60+
}
61+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 typescriptPlugin from 'rollup-plugin-typescript2';
19+
import json from 'rollup-plugin-json';
20+
import typescript from 'typescript';
21+
import pkg from './package.json';
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+
{
39+
input: 'src/index.ts',
40+
output: [
41+
{ file: pkg.main, format: 'cjs', sourcemap: true },
42+
{ file: pkg.module, format: 'es', sourcemap: true }
43+
],
44+
plugins: es5BuildPlugins,
45+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
46+
},
47+
{
48+
input: 'src/index.lite.ts',
49+
output: {
50+
file: pkg.lite,
51+
format: 'es',
52+
sourcemap: true
53+
},
54+
plugins: es5BuildPlugins,
55+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
56+
}
57+
];
58+
59+
/**
60+
* ES2017 Builds
61+
*/
62+
const es2017BuildPlugins = [
63+
typescriptPlugin({
64+
typescript,
65+
tsconfigOverride: {
66+
compilerOptions: {
67+
target: 'es2017'
68+
}
69+
}
70+
}),
71+
json({
72+
preferConst: true
73+
})
74+
];
75+
76+
const es2017Builds = [
77+
/**
78+
* Browser Builds
79+
*/
80+
{
81+
input: 'src/index.ts',
82+
output: {
83+
file: pkg.esm2017,
84+
format: 'es',
85+
sourcemap: true
86+
},
87+
plugins: es2017BuildPlugins,
88+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
89+
},
90+
{
91+
input: 'src/index.lite.ts',
92+
output: {
93+
file: pkg['lite-esm2017'],
94+
format: 'es',
95+
sourcemap: true
96+
},
97+
plugins: es2017BuildPlugins,
98+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
99+
}
100+
];
101+
102+
export default [...es5Builds, ...es2017Builds];

packages-exp/app-compat/src/errors.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 { ErrorFactory, ErrorMap } from '@firebase/util';
19+
20+
export const enum AppError {
21+
NO_APP = 'no-app',
22+
INVALID_APP_ARGUMENT = 'invalid-app-argument'
23+
}
24+
25+
const ERRORS: ErrorMap<AppError> = {
26+
[AppError.NO_APP]:
27+
"No Firebase App '{$appName}' has been created - " +
28+
'call Firebase App.initializeApp()',
29+
[AppError.INVALID_APP_ARGUMENT]:
30+
'firebase.{$appName}() takes either no argument or a ' +
31+
'Firebase App instance.'
32+
};
33+
34+
type ErrorParams = { [key in AppError]: { appName: string } };
35+
36+
export const ERROR_FACTORY = new ErrorFactory<AppError, ErrorParams>(
37+
'app-compat',
38+
'Firebase',
39+
ERRORS
40+
);

0 commit comments

Comments
 (0)