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";
|
import serviceWorker from "./index.js";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
// output: "server",
|
output: "server",
|
||||||
// adapter: node({
|
adapter: node({
|
||||||
// mode: "middleware"
|
mode: "middleware"
|
||||||
// }),
|
}),
|
||||||
site: 'https://ayo.ayco.io',
|
site: 'https://ayo.ayco.io',
|
||||||
integrations: [
|
integrations: [
|
||||||
serviceWorker({
|
serviceWorker({
|
||||||
path: "./example_sw.js",
|
|
||||||
assetCachePrefix: 'cozy-reader',
|
assetCachePrefix: 'cozy-reader',
|
||||||
customRoutes: [
|
customRoutes: [
|
||||||
'/threads'
|
'/threads'
|
||||||
|
|
25
index.js
25
index.js
|
@ -13,21 +13,20 @@ const ASTROSW = 'astro-sw';
|
||||||
/**
|
/**
|
||||||
* @typedef {import('astro').AstroIntegration} AstroIntegration
|
* @typedef {import('astro').AstroIntegration} AstroIntegration
|
||||||
* @typedef {import('esbuild').BuildOptions} BuildOptions
|
* @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
|
* Accepts configuration options with service worker path
|
||||||
* and injects needed variables such as `__assets` generated by Astro
|
* 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}
|
* @returns {AstroIntegration}
|
||||||
*/
|
*/
|
||||||
export default function serviceWorker(options) {
|
export default function serviceWorker(options) {
|
||||||
|
@ -205,11 +204,11 @@ declare const __prefix: string;`
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await build({
|
await build({
|
||||||
entryPoints: [tempFile],
|
bundle: true,
|
||||||
|
...esbuild,
|
||||||
outfile,
|
outfile,
|
||||||
platform: 'browser',
|
platform: 'browser',
|
||||||
bundle: true,
|
entryPoints: [tempFile],
|
||||||
...esbuild
|
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err.toString())
|
logger.error(err.toString())
|
||||||
|
|
Loading…
Reference in a new issue