feat: show types of options on hover

This commit is contained in:
Ayo Ayco 2024-08-17 12:31:02 +02:00
parent 426ab0a963
commit 5d29f4d0af
2 changed files with 16 additions and 18 deletions

View file

@ -3,14 +3,13 @@ import node from "@astrojs/node";
import serviceWorker from "./index.js";
export default defineConfig({
// output: "server",
// adapter: node({
// mode: "middleware"
// }),
output: "server",
adapter: node({
mode: "middleware"
}),
site: 'https://ayo.ayco.io',
integrations: [
serviceWorker({
path: "./example_sw.js",
assetCachePrefix: 'cozy-reader',
customRoutes: [
'/threads'

View file

@ -13,21 +13,20 @@ const ASTROSW = 'astro-sw';
/**
* @typedef {import('astro').AstroIntegration} AstroIntegration
* @typedef {import('esbuild').BuildOptions} BuildOptions
* @typedef {{
* path: string,
* assetCachePrefix?: string,
* assetCacheVersionID?: string,
* customRoutes?: Array<string>,
* excludeRoutes?: Array<string,
* logAssets?: true,
* esbuild?: BuildOptions
* }} ServiceWorkerConfig
*/
/**
* Accepts configuration options with service worker path
* and injects needed variables such as `__assets` generated by Astro
* @param {ServiceWorkerConfig} options
* @param {{
* path: string,
* assetCachePrefix?: string,
* assetCacheVersionID?: string,
* customRoutes?: string[],
* excludeRoutes?: string[],
* logAssets?: true,
* esbuild?: BuildOptions
* }} options
* @returns {AstroIntegration}
*/
export default function serviceWorker(options) {
@ -205,11 +204,11 @@ declare const __prefix: string;`
try {
await build({
entryPoints: [tempFile],
bundle: true,
...esbuild,
outfile,
platform: 'browser',
bundle: true,
...esbuild
entryPoints: [tempFile],
})
} catch (err) {
logger.error(err.toString())