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
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,30 @@ jobs:
- run:
name: Install JavaScript dependencies for the JS web extension sample
command: |
npm --prefix ./samples/web-extension/javascript install
npm --prefix ./samples/web-extension/javascript run link:glean
npm --prefix ./samples/browser/webext/javascript install
npm --prefix ./samples/browser/webext/javascript run link:glean
- run:
name: Build the JS web extension sample
command: |
npm --prefix ./samples/web-extension/javascript run build
npm --prefix ./samples/browser/webext/javascript run build
- run:
name: Run JS web extension sample test
command: |
export PATH=.:$PATH && npm --prefix ./samples/web-extension/javascript run test
export PATH=.:$PATH && npm --prefix ./samples/browser/webext/javascript run test
# TS sample related jobs
- run:
name: Install Typescript dependencies for the TS web extension sample
command: |
npm --prefix ./samples/web-extension/typescript install
npm --prefix ./samples/web-extension/typescript run link:glean
npm --prefix ./samples/browser/webext/typescript install
npm --prefix ./samples/browser/webext/typescript run link:glean
- run:
name: Build the TS web extension sample
command: |
npm --prefix ./samples/web-extension/typescript run build
npm --prefix ./samples/browser/webext/typescript run build
- run:
name: Run TS web extension sample test
command: |
export PATH=.:$PATH && npm --prefix ./samples/web-extension/typescript run test
export PATH=.:$PATH && npm --prefix ./samples/browser/webext/typescript run test

node-sample-tests:
docker:
Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ updates:
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/samples/web-extension/typescript"
directory: "/samples/browser/webext/typescript"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/samples/web-extension/javascript"
directory: "/samples/browser/webext/javascript"
schedule:
interval: "daily"
- package-ecosystem: "npm"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

* [#856](https://github.com/mozilla/glean.js/pull/856): Expose the `@mozilla/glean/web` entry point for using Glean.js in websites.

# v0.23.0 (2021-10-12)

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.22.0...v0.23.0)
Expand Down
6 changes: 5 additions & 1 deletion glean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"./plugins/*": "./dist/plugins/*.js",
"./uploader": "./dist/core/upload/uploader.js",
"./node": "./dist/index/node.js",
"./webext": "./dist/index/webext.js"
"./webext": "./dist/index/webext.js",
"./web": "./dist/index/web.js"
},
"typesVersions": {
"*": {
Expand All @@ -21,6 +22,9 @@
"node": [
"./dist/types/index/node.d.ts"
],
"web": [
"./dist/types/index/web.d.ts"
],
"private/ping": [
"./dist/types/core/pings/ping_type.d.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion glean/src/core/upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class PingUploader implements PingsDatabaseObserver {
if (ping.retries >= this.policy.maxRecoverableFailures) {
log(
LOG_TAG,
`Reached maximum recoverable failures for ping "${JSON.stringify(ping.name)}". You are done.`,
`Reached maximum recoverable failures for ping "${ping.identifier}". You are done.`,
LoggingLevel.Info
);
this.rateLimiter.stop();
Expand Down
9 changes: 9 additions & 0 deletions glean/src/index/web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import platform from "../platform/browser/web/index.js";
import base from "./base.js";

export { ErrorType } from "../core/error/error_type.js";
export default base(platform);
2 changes: 1 addition & 1 deletion glean/src/index/webext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import platform from "../platform/webext/index.js";
import platform from "../platform/browser/webext/index.js";
import base from "./base.js";

export { ErrorType } from "../core/error/error_type.js";
Expand Down
19 changes: 19 additions & 0 deletions glean/src/platform/browser/web/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import type Platform from "../../index.js";
import uploader from "../uploader.js";

// We will still use the TestPlatform as a placeholder
// for the other web modules that have not been implemented yet.
// See Bug 1726726 (Storage).
import TestPlatform from "../../test/index.js";

const WebPlaftorm: Platform = {
...TestPlatform,
uploader,
name: "web"
};

export default WebPlaftorm;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Storage from "./storage.js";
import uploader from "./uploader.js";
import uploader from "../uploader.js";
import info from "./platform_info.js";

import type Platform from "../index.js";
import type Platform from "../../index.js";

const WebExtPlatform: Platform = {
Storage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import type PlatformInfo from "../../core/platform_info.js";
import { KnownOperatingSystems } from "../../core/platform_info.js";
import type PlatformInfo from "../../../core/platform_info.js";
import { KnownOperatingSystems } from "../../../core/platform_info.js";

const WebExtPlatformInfo: PlatformInfo = {
async os(): Promise<KnownOperatingSystems> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import log, { LoggingLevel } from "../../core/log.js";
import type { StorageIndex } from "../../core/storage/index.js";
import type Store from "../../core/storage/index.js";
import { updateNestedObject, getValueFromNestedObject, deleteKeyFromNestedObject } from "../../core/storage/utils.js";
import type { JSONArray, JSONObject, JSONPrimitive, JSONValue } from "../../core/utils.js";
import { isJSONValue, isObject } from "../../core/utils.js";
import log, { LoggingLevel } from "../../../core/log.js";
import type { StorageIndex } from "../../../core/storage/index.js";
import type Store from "../../../core/storage/index.js";
import {
updateNestedObject,
getValueFromNestedObject,
deleteKeyFromNestedObject
} from "../../../core/storage/utils.js";
import type { JSONArray, JSONObject, JSONPrimitive, JSONValue } from "../../../core/utils.js";
import { isJSONValue, isObject } from "../../../core/utils.js";

const LOG_TAG = "platform.webext.Storage";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "jsdom-global/register";
import assert from "assert";
import sinon from "sinon";

import BrowserUploader from "../../../../src/platform/webext/uploader";
import BrowserUploader from "../../../../src/platform/browser/uploader";
import type { JSONObject } from "../../../../src/core/utils";
import { UploadResult, UploadResultStatus } from "../../../../src/core/upload/uploader";

Expand Down
2 changes: 1 addition & 1 deletion glean/tests/unit/platform/storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type Store from "../../../src/core/storage";

import TestStore from "../../../src/platform/test/storage";
import QMLStore from "../../../src/platform/qt/storage";
import WebExtStore from "../../../src/platform/webext/storage";
import WebExtStore from "../../../src/platform/browser/webext/storage";
import type { JSONValue } from "../../../src/core/utils";
import { isUndefined } from "../../../src/core/utils";

Expand Down
3 changes: 2 additions & 1 deletion glean/tsconfig/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"../src/core/metrics/types/*.ts",
"../src/plugins/*.ts",
"../src/index/node.ts",
"../src/index/webext.ts"
"../src/index/webext.ts",
"../src/index/web.ts"
],
"compilerOptions": {
"target": "ES2018",
Expand Down
File renamed without changes.
Loading