Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.2.0...main)

* [#90](https://github.com/mozilla/glean.js/pull/90): Provide exports for CommonJS and browser environemnts.
* [#90](https://github.com/mozilla/glean.js/pull/90): BUGIFX: Accept lifetimes as strings when instantiating metric types.
* [#90](https://github.com/mozilla/glean.js/pull/90): BUGFIX: Fix type declaration paths.
* [#90](https://github.com/mozilla/glean.js/pull/90): BUGFIX: Make web-ext-types a peer dependency.
* This is quick fix until [Bug 1694701](https://bugzilla.mozilla.org/show_bug.cgi?id=1694701) is fixed.

# v0.2.0 (2021-02-23)

* [#85](https://github.com/mozilla/glean.js/pull/85): Include type declarations in `@mozilla/glean` webext package bundle.
Expand Down
33 changes: 25 additions & 8 deletions glean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for Javascript environments.",
"exports": {
"./package.json": "./package.json",
"./webext": "./dist/webext/index/webext.js",
"./webext/private/metrics/*": "./dist/webext/core/metrics/types/*.js",
"./webext/private/ping": "./dist/webext/core/pings/index.js"
"./webext": {
"browser": "./dist/webext/browser/index/webext.js",
"import": "./dist/webext/esm/index/webext.js",
"require": "./dist/webext/cjs/index/webext.js"
},
"./webext/private/metrics/*": {
"browser": "./dist/webext/browser/core/metrics/types/*.js",
"import": "./dist/webext/esm/core/metrics/types/*.js",
"require": "./dist/webext/cjs/core/metrics/types/*.js"
},
"./webext/private/ping": {
"browser": "./dist/webext/browser/core/pings/index.js",
"import": "./dist/webext/esm/core/pings/index.js",
"require": "./dist/webext/cjs/core/pings/index.js"
}
},
"typesVersions": {
"*": {
"webext/*": [
"./dist/webext/types/*"
]
"webext": [ "./dist/webext/types/index/webext.d.ts" ],
"webext/private/ping": [ "./dist/webext/types/core/pings/index.d.ts" ],
"webext/private/metrics/*": [ "./dist/webext/types/core/metrics/types/*" ]
}
},
"files": [
Expand All @@ -27,9 +39,11 @@
"build:test-webext": "cd tests/platform/utils/webext/sample/ && npm install && npm run build:xpi",
"lint": "eslint . --ext .ts,.js,.json --max-warnings=0",
"fix": "eslint . --ext .ts,.js,.json --fix",
"build:webext:lib": "tsc -p ./tsconfig/webext/index.json",
"build:webext:lib:esm": "tsc -p ./tsconfig/webext/esm.json",
"build:webext:lib:cjs": "tsc -p ./tsconfig/webext/cjs.json",
"build:webext:lib:browser": "tsc -p ./tsconfig/webext/browser.json",
"build:webext:types": "tsc -p ./tsconfig/webext/types.json",
"build:webext": "npm run build:webext:lib && npm run build:webext:types",
"build:webext": "rm -rf dist/webext && npm run build:webext:lib:esm && npm run build:webext:lib:cjs && npm run build:webext:lib:browser && npm run build:webext:types",
"build:qt": "webpack --config webpack.config.qt.js --mode production",
"prepublishOnly": "cp ../README.md ./README.md && npm run build:webext",
"postpublish": "rm ./README.md"
Expand Down Expand Up @@ -77,5 +91,8 @@
},
"dependencies": {
"uuid": "^8.3.2"
},
"peerDependencies": {
"web-ext-types": "^3.2.1"
}
}
4 changes: 2 additions & 2 deletions glean/src/core/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface CommonMetricData {
// List of ping names to include this metric in.
readonly sendInPings: string[],
// The metric's lifetime.
readonly lifetime: Lifetime,
readonly lifetime: Lifetime | string,
// Whether or not the metric is disabled.
//
// Disabled metrics are never recorded.
Expand All @@ -121,7 +121,7 @@ export abstract class MetricType implements CommonMetricData {
this.name = meta.name;
this.category = meta.category;
this.sendInPings = meta.sendInPings;
this.lifetime = meta.lifetime;
this.lifetime = meta.lifetime as Lifetime;
this.disabled = meta.disabled;
}

Expand Down
9 changes: 9 additions & 0 deletions glean/tsconfig/webext/browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../base.json",
"include": ["../../src/index/webext.ts", "../../src/core/metrics/types/*.ts"],
"compilerOptions": {
"target": "ES2018",
"module": "ES6",
"outDir": "../../dist/webext/browser"
}
}
9 changes: 9 additions & 0 deletions glean/tsconfig/webext/cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../base.json",
"include": ["../../src/index/webext.ts", "../../src/core/metrics/types/*.ts"],
"compilerOptions": {
"target": "ES2019",
"module": "CommonJS",
"outDir": "../../dist/webext/cjs"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "../base.json",
"include": ["../../src/index/webext.ts", "../../src/core/metrics/types/*.ts"],
"compilerOptions": {
"outDir": "../../dist/webext"
"target": "ES2019",
"module": "ES2020",
"outDir": "../../dist/webext/esm"
}
}
Loading