-
Notifications
You must be signed in to change notification settings - Fork 940
Initial copy of performance and performance-types to packages-exp #3778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5965fbe
Initial copy of performance and performance-types to packages-exp
jposuna 96f58d5
Removing CHANGELOG.md
jposuna d96ad31
Updated the copyright year on all files
jposuna 0585b23
Updating the version to 0.0.800 on both the performance-exp and perfo…
jposuna 2bbb8b9
Removing a file I added by mistake
jposuna 64359fb
Updating the copyright year of a few more files that I missed
jposuna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module.exports = { | ||
extends: '../../config/.eslintrc.js', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
// to make vscode-eslint work with monorepo | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250 | ||
tsconfigRootDir: __dirname | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# @firebase/performance | ||
|
||
## 0.4.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [[`da1c7df79`](https://github.com/firebase/firebase-js-sdk/commit/da1c7df7982b08bbef82fcc8d93255f3e2d23cca), [`fb3b095e4`](https://github.com/firebase/firebase-js-sdk/commit/fb3b095e4b7c8f57fdb3172bc039c84576abf290)]: | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
|
||
## 0.4.0 | ||
|
||
### Minor Changes | ||
|
||
- [`67501b980`](https://github.com/firebase/firebase-js-sdk/commit/67501b9806c7014738080bc0be945b2c0748c17e) [#3424](https://github.com/firebase/firebase-js-sdk/pull/3424) - Issue 2393 - Add environment check to Performance Module | ||
|
||
## 0.3.11 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [[`d4ca3da0`](https://github.com/firebase/firebase-js-sdk/commit/d4ca3da0a59fcea1261ba69d7eb663bba38d3089)]: | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
|
||
## 0.3.10 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]: | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
|
||
## 0.3.9 | ||
|
||
### Patch Changes | ||
|
||
- [`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e) [#3297](https://github.com/firebase/firebase-js-sdk/pull/3297) Thanks [@renovate](https://github.com/apps/renovate)! - Update dependency typescript to v3.9.5 | ||
|
||
- Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e)]: | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
- @firebase/[email protected] | ||
|
||
## 0.3.0 | ||
|
||
- [changed] Updated internal performance event transport mechanism. | ||
|
||
## 0.2.30 | ||
|
||
- [changed] Internal transport protocol update from proto2 to proto3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @firebase/performance | ||
jposuna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This is the Firebase Performance component of the Firebase JS SDK. | ||
|
||
**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.** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* @license | ||
* Copyright 2019 Google LLC | ||
jposuna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import firebase from '@firebase/app'; | ||
import '@firebase/installations'; | ||
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types'; | ||
import { _FirebaseNamespace } from '@firebase/app-types/private'; | ||
import { PerformanceController } from './src/controllers/perf'; | ||
import { setupApi } from './src/services/api_service'; | ||
import { SettingsService } from './src/services/settings_service'; | ||
import { ERROR_FACTORY, ErrorCode } from './src/utils/errors'; | ||
import { FirebasePerformance } from '@firebase/performance-types'; | ||
import { Component, ComponentType } from '@firebase/component'; | ||
import { FirebaseInstallations } from '@firebase/installations-types'; | ||
import { name, version } from './package.json'; | ||
|
||
const DEFAULT_ENTRY_NAME = '[DEFAULT]'; | ||
|
||
export function registerPerformance(instance: FirebaseNamespace): void { | ||
const factoryMethod = ( | ||
app: FirebaseApp, | ||
installations: FirebaseInstallations | ||
): PerformanceController => { | ||
if (app.name !== DEFAULT_ENTRY_NAME) { | ||
throw ERROR_FACTORY.create(ErrorCode.FB_NOT_DEFAULT); | ||
} | ||
if (typeof window === 'undefined') { | ||
throw ERROR_FACTORY.create(ErrorCode.NO_WINDOW); | ||
} | ||
setupApi(window); | ||
SettingsService.getInstance().firebaseAppInstance = app; | ||
SettingsService.getInstance().installationsService = installations; | ||
return new PerformanceController(app); | ||
}; | ||
|
||
// Register performance with firebase-app. | ||
(instance as _FirebaseNamespace).INTERNAL.registerComponent( | ||
new Component( | ||
'performance', | ||
container => { | ||
/* Dependencies */ | ||
// getImmediate for FirebaseApp will always succeed | ||
const app = container.getProvider('app').getImmediate(); | ||
// The following call will always succeed because perf has `import '@firebase/installations'` | ||
const installations = container | ||
.getProvider('installations') | ||
.getImmediate(); | ||
|
||
return factoryMethod(app, installations); | ||
}, | ||
ComponentType.PUBLIC | ||
) | ||
); | ||
|
||
instance.registerVersion(name, version); | ||
} | ||
|
||
registerPerformance(firebase); | ||
|
||
declare module '@firebase/app-types' { | ||
interface FirebaseNamespace { | ||
performance?: { | ||
(app?: FirebaseApp): FirebasePerformance; | ||
}; | ||
} | ||
interface FirebaseApp { | ||
performance?(): FirebasePerformance; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
const karmaBase = require('../../config/karma.base'); | ||
|
||
const files = [`test/**/*`, 'src/**/*.test.ts']; | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
...karmaBase, | ||
// files to load into karma | ||
files, | ||
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] }, | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha'] | ||
}); | ||
}; | ||
|
||
module.exports.files = files; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "@firebase/performance-exp", | ||
"version": "0.4.1", | ||
jposuna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"description": "Firebase performance for web", | ||
"author": "Firebase <[email protected]> (https://firebase.google.com/)", | ||
"main": "dist/index.cjs.js", | ||
"browser": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"files": ["dist"], | ||
"scripts": { | ||
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", | ||
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts'", | ||
"build": "rollup -c", | ||
"build:deps": "lerna run --scope @firebase/performance-exp --include-dependencies build", | ||
"dev": "rollup -c -w", | ||
"test": "run-p lint test:browser", | ||
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", | ||
"test:browser": "karma start --single-run", | ||
"test:debug": "karma start --browsers=Chrome --auto-watch", | ||
"prepare": "yarn build", | ||
"prettier": "prettier --write '{src,test}/**/*.{js,ts}'" | ||
}, | ||
"peerDependencies": { | ||
"@firebase/app": "0.x", | ||
"@firebase/app-types": "0.x" | ||
}, | ||
"dependencies": { | ||
"@firebase/logger": "0.2.6", | ||
"@firebase/installations": "0.4.17", | ||
"@firebase/util": "0.3.2", | ||
"@firebase/performance-types-exp": "0.0.13", | ||
"@firebase/component": "0.1.19", | ||
"tslib": "^1.11.1" | ||
}, | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@firebase/app": "0.6.11", | ||
"rollup": "2.26.7", | ||
"rollup-plugin-json": "4.0.0", | ||
"rollup-plugin-typescript2": "0.27.2", | ||
"typescript": "4.0.2" | ||
}, | ||
"repository": { | ||
"directory": "packages/performance-exp", | ||
"type": "git", | ||
"url": "https://github.com/firebase/firebase-js-sdk.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/firebase/firebase-js-sdk/issues" | ||
}, | ||
"typings": "dist/index.d.ts", | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"reportDir": "./coverage/node" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC | ||
jposuna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import json from 'rollup-plugin-json'; | ||
import typescriptPlugin from 'rollup-plugin-typescript2'; | ||
import typescript from 'typescript'; | ||
import pkg from './package.json'; | ||
|
||
const deps = Object.keys( | ||
Object.assign({}, pkg.peerDependencies, pkg.dependencies) | ||
); | ||
|
||
/** | ||
* ES5 Builds | ||
*/ | ||
const es5BuildPlugins = [typescriptPlugin({ typescript }), json()]; | ||
|
||
const es5Builds = [ | ||
{ | ||
input: 'index.ts', | ||
output: [ | ||
{ file: pkg.main, format: 'cjs', sourcemap: true }, | ||
{ file: pkg.module, format: 'es', sourcemap: true } | ||
], | ||
plugins: es5BuildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
/** | ||
* ES2017 Builds | ||
*/ | ||
|
||
const es2017BuildPlugins = [ | ||
typescriptPlugin({ | ||
typescript, | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
target: 'es2017' | ||
} | ||
} | ||
}), | ||
json({ preferConst: true }) | ||
]; | ||
|
||
const es2017Builds = [ | ||
{ | ||
input: 'index.ts', | ||
output: [{ file: pkg.esm2017, format: 'es', sourcemap: true }], | ||
plugins: es2017BuildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
export default [...es5Builds, ...es2017Builds]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { version } from '../package.json'; | ||
|
||
export const SDK_VERSION = version; | ||
/** The prefix for start User Timing marks used for creating Traces. */ | ||
export const TRACE_START_MARK_PREFIX = 'FB-PERF-TRACE-START'; | ||
/** The prefix for stop User Timing marks used for creating Traces. */ | ||
export const TRACE_STOP_MARK_PREFIX = 'FB-PERF-TRACE-STOP'; | ||
/** The prefix for User Timing measure used for creating Traces. */ | ||
export const TRACE_MEASURE_PREFIX = 'FB-PERF-TRACE-MEASURE'; | ||
/** The prefix for out of the box page load Trace name. */ | ||
export const OOB_TRACE_PAGE_LOAD_PREFIX = '_wt_'; | ||
|
||
export const FIRST_PAINT_COUNTER_NAME = '_fp'; | ||
|
||
export const FIRST_CONTENTFUL_PAINT_COUNTER_NAME = '_fcp'; | ||
|
||
export const FIRST_INPUT_DELAY_COUNTER_NAME = '_fid'; | ||
|
||
export const CONFIG_LOCAL_STORAGE_KEY = '@firebase/performance/config'; | ||
|
||
export const CONFIG_EXPIRY_LOCAL_STORAGE_KEY = | ||
'@firebase/performance/configexpire'; | ||
|
||
export const SERVICE = 'performance'; | ||
export const SERVICE_NAME = 'Performance'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.