Skip to content

Commit

Permalink
Update and fix all paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jan 21, 2024
1 parent 6162a6c commit f599f08
Show file tree
Hide file tree
Showing 18 changed files with 1,436 additions and 10,056 deletions.
11,435 changes: 1,400 additions & 10,035 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
"type-fest": "^4.9.0",
"webext-detect-page": "^4.2.1"
},
"@parcel/resolver-default": {
"packageExports": true
},
"devDependencies": {
"@parcel/config-webextension": "^2.6.2",
"@parcel/config-webextension": "^2.11.0",
"@sindresorhus/tsconfig": "^5.0.0",
"@types/chrome": "^0.0.254",
"@types/tape": "^5.6.4",
Expand All @@ -41,7 +44,7 @@
"eslint-config-pixiebrix": "^0.32.0",
"events": "^3.3.0",
"npm-run-all": "^4.1.5",
"parcel": "^2.6.2",
"parcel": "^2.11.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
Expand All @@ -50,13 +53,12 @@
"webext-content-scripts": "^2.6.0",
"webextension-polyfill": "^0.10.0"
},
"alias": {
"./this-stuff-is-just-for-local-parcel-tests": "https://github.com/parcel-bundler/parcel/issues/4936",
"./source/**/*.js": "./source/$1/$2.ts"
},
"targets": {
"main": false,
"default": {
"engines": {
"browsers": "Chrome 110"
},
"source": "source/test/manifest.json",
"sourceMap": {
"inline": true
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable unicorn/no-await-expression-member */
import test from "tape";
import { isBackground } from "webext-detect-page";
import { getThisFrame } from "../../thisTarget.js";
import { getThisFrame } from "webext-messenger/thisTarget.js";
import { expectDuration, trackSettleTime } from "../helpers.js";
import {
backgroundOnly,
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getMethod, getNotifier, backgroundTarget } from "../../index.js";
import { getMethod, getNotifier, backgroundTarget } from "webext-messenger";

// Dog-fooding, needed to run the tests
export const openTab = getMethod("openTab", backgroundTarget);
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/getSelf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta, type Sender } from "../../index.js";
import { type MessengerMeta, type Sender } from "webext-messenger";

export async function getSelf(
this: MessengerMeta
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/getTrace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta, type Sender } from "../../index.js";
import { type MessengerMeta, type Sender } from "webext-messenger";

export async function getTrace(this: MessengerMeta): Promise<Sender[]> {
return this.trace;
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/registration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isBackground } from "webext-detect-page";
import { registerMethods } from "../../index.js";
import { registerMethods } from "webext-messenger";

import { sum } from "./sum.js";
import { throws } from "./throws.js";
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/sumIfMeta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta } from "../../index.js";
import { type MessengerMeta } from "webext-messenger";

export async function sumIfMeta(
this: MessengerMeta,
Expand Down
2 changes: 1 addition & 1 deletion source/test/background/testingApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { executeFunction } from "webext-content-scripts";
import { once } from "../../shared.js";
import { once } from "webext-messenger/shared.js";

export async function ensureScripts(tabId: number): Promise<void> {
await browser.tabs.executeScript(tabId, {
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from "tape";
import { isBackground, isContentScript, isWebPage } from "webext-detect-page";
import { type PageTarget, type Sender, type Target } from "../../index.js";
import { type PageTarget, type Sender, type Target } from "webext-messenger";
import {
errorTabDoesntExist,
errorTargetClosedEarly,
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getNotifier, getMethod } from "../../index.js";
import { getNotifier, getMethod } from "webext-messenger";

export const getPageTitle = getMethod("getPageTitle");
export const getPageTitleNotification = getNotifier("getPageTitle"); // Test-only; Notifications can't be getters
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/getSelf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta, type Sender } from "../../index.js";
import { type MessengerMeta, type Sender } from "webext-messenger";

export async function getSelf(
this: MessengerMeta
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/getTrace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta, type Sender } from "../../index.js";
import { type MessengerMeta, type Sender } from "webext-messenger";

export async function getTrace(this: MessengerMeta): Promise<Sender[]> {
return this.trace;
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/missedRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerMethods } from "../../index.js";
import { registerMethods } from "webext-messenger";

console.log(
"My friend wrote a bunch of browser tests and all I got is this lousy log"
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/registration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isContentScript } from "webext-detect-page";
import { registerMethods } from "../../index.js";
import { registerMethods } from "webext-messenger";

import { getPageTitle } from "./getPageTitle.js";
import { setPageTitle } from "./setPageTitle.js";
Expand Down
2 changes: 1 addition & 1 deletion source/test/contentscript/sumIfMeta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type MessengerMeta } from "../../index.js";
import { type MessengerMeta } from "webext-messenger";

export async function sumIfMeta(
this: MessengerMeta,
Expand Down
8 changes: 8 additions & 0 deletions source/test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "module",
"alias": {
"_info": "`exports` can't be followed or else it will have to depend on the main `build` to run",
"webext-messenger/**/*.js": "../$1/$2.ts",
"webext-messenger": "../"
}
}
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"extends": "@sindresorhus/tsconfig",
"include": ["source/**/*"],
"compilerOptions": {
"baseUrl": ".",
"outDir": "distribution",
"skipLibCheck": false
"skipLibCheck": false,
"paths": {
"webext-messenger/*": ["source/*"],
"webext-messenger": ["source/index.ts"]
}
}
}

0 comments on commit f599f08

Please sign in to comment.