Compare commits

..

4 Commits

Author SHA1 Message Date
Bauke 5dfdd73cf5
Update public directory paths for Vite. 2023-03-26 14:33:17 +02:00
Bauke 75eddf0e17
Fix linting issues. 2023-03-26 14:33:08 +02:00
Bauke 2e1c7edfa1
Change package to ES module. 2023-03-26 14:32:57 +02:00
Bauke 6383e77609
Update dependencies. 2023-03-26 14:32:16 +02:00
8 changed files with 1749 additions and 2209 deletions

View File

@ -1,5 +1,6 @@
{ {
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"start": "vite build -m development --watch", "start": "vite build -m development --watch",
"start:chromium": "VITE_BROWSER=chromium pnpm start", "start:chromium": "VITE_BROWSER=chromium pnpm start",
@ -15,36 +16,36 @@
"@holllo/preact-components": "^0.2.3", "@holllo/preact-components": "^0.2.3",
"htm": "^3.1.1", "htm": "^3.1.1",
"modern-normalize": "^1.1.0", "modern-normalize": "^1.1.0",
"preact": "^10.11.0", "preact": "^10.13.1",
"webextension-polyfill": "^0.10.0" "webextension-polyfill": "^0.10.0"
}, },
"devDependencies": { "devDependencies": {
"@preact/preset-vite": "^2.4.0", "@preact/preset-vite": "^2.5.0",
"@types/babel__core": "^7.1.19", "@types/babel__core": "^7.20.0",
"@types/webextension-polyfill": "^0.9.1", "@types/webextension-polyfill": "^0.10.0",
"ava": "^4.3.3", "ava": "^5.2.0",
"c8": "^7.12.0", "c8": "^7.13.0",
"postcss": "^8.4.16", "postcss": "^8.4.21",
"sass": "^1.55.0", "sass": "^1.60.0",
"stylelint": "^14.12.1", "stylelint": "^15.3.0",
"stylelint-config-standard-scss": "^5.0.0", "stylelint-config-standard-scss": "^7.0.1",
"trash-cli": "^5.0.0", "trash-cli": "^5.0.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.8.3", "typescript": "^5.0.2",
"vite": "^3.1.3", "vite": "^4.2.1",
"vite-plugin-web-extension": "^1.4.4", "vite-plugin-web-extension": "^3.0.2",
"web-ext": "^7.2.0", "web-ext": "^7.6.0",
"xo": "^0.52.3" "xo": "^0.53.1"
}, },
"ava": { "ava": {
"extensions": [ "extensions": {
"ts" "ts": "module"
], },
"files": [ "files": [
"tests/**/*.test.ts" "tests/**/*.test.ts"
], ],
"require": [ "nodeArguments": [
"ts-node/register" "--loader=ts-node/esm"
], ],
"snapshotDir": "tests/snapshots" "snapshotDir": "tests/snapshots"
}, },
@ -65,7 +66,6 @@
"files": "tests/**/*.test.ts", "files": "tests/**/*.test.ts",
"rules": { "rules": {
"@typescript-eslint/triple-slash-reference": "off", "@typescript-eslint/triple-slash-reference": "off",
"import/extensions": "off",
"no-await-in-loop": "off" "no-await-in-loop": "off"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -71,18 +71,23 @@ export async function contextClicked(
let url: string | undefined; let url: string | undefined;
switch (id) { switch (id) {
case 'queue-add-new-link': case 'queue-add-new-link': {
text = info.linkText; text = info.linkText;
url = info.linkUrl; url = info.linkUrl;
break; break;
case 'queue-add-new-link-tab': }
case 'queue-add-new-link-tab': {
text = tab?.title; text = tab?.title;
url = info.pageUrl; url = info.pageUrl;
break; break;
default: }
default: {
console.warn(`Encountered unknown context menu ID: ${id}`); console.warn(`Encountered unknown context menu ID: ${id}`);
return; return;
} }
}
if (url === undefined) { if (url === undefined) {
console.warn('Cannot add a new item without a URL.'); console.warn('Cannot add a new item without a URL.');

View File

@ -15,7 +15,7 @@ export default function createManifest(
}; };
const icons = { const icons = {
128: 'assets/queue.png', 128: 'queue.png',
}; };
manifest.icons = icons; manifest.icons = icons;

View File

@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Queue</title> <title>Queue</title>
<link rel="shortcut icon" href="/assets/queue.png" type="image/png"> <link rel="shortcut icon" href="/queue.png" type="image/png">
<link rel="stylesheet" href="./index.scss"> <link rel="stylesheet" href="./index.scss">
</head> </head>

View File

@ -6,7 +6,7 @@ import {
dataMigrations, dataMigrations,
deserializeQueue, deserializeQueue,
serializeQueue, serializeQueue,
} from '../source/settings/migrations'; } from '../source/settings/migrations.js';
const queueItemSample: Queue.Item = { const queueItemSample: Queue.Item = {
added: new Date('2022-03-02T16:00:00Z'), added: new Date('2022-03-02T16:00:00Z'),

View File

@ -8,6 +8,7 @@
"moduleResolution": "Node", "moduleResolution": "Node",
"noEmit": true, "noEmit": true,
"outDir": "build", "outDir": "build",
"skipLibCheck": true,
"strict": true, "strict": true,
"target": "ESNext" "target": "ESNext"
}, },
@ -15,10 +16,5 @@
"source/**/*.ts", "source/**/*.ts",
"tests/**/*.ts", "tests/**/*.ts",
"vite.config.ts" "vite.config.ts"
], ]
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
} }

View File

@ -46,11 +46,11 @@ export default defineConfig({
// See vite-plugin-web-extension for documentation. // See vite-plugin-web-extension for documentation.
// https://github.com/aklinker1/vite-plugin-web-extension // https://github.com/aklinker1/vite-plugin-web-extension
webExtension({ webExtension({
assets: 'assets',
browser: targetBrowser, browser: targetBrowser,
manifest: () => createManifest(targetBrowser), manifest: () => createManifest(targetBrowser),
webExtConfig, webExtConfig,
}), }),
], ],
publicDir: 'source/assets',
root: sourceDir, root: sourceDir,
}); });