feat: show types of options on hover
This commit is contained in:
parent
426ab0a963
commit
5d29f4d0af
2 changed files with 16 additions and 18 deletions
|
@ -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'
|
||||
|
|
25
index.js
25
index.js
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue