refactor: js -> ts

This commit is contained in:
Ayo Ayco 2025-04-07 20:51:55 +01:00
parent 6d2a090387
commit e5f644e241
9 changed files with 502 additions and 59 deletions

View file

@ -2,7 +2,7 @@
import { defineConfig } from 'astro/config'
import node from '@astrojs/node'
import serviceWorker from '@ayco/astro-sw'
import serviceWorker from '../package/src/astro-sw'
export default defineConfig({
output: 'static',

View file

@ -26,6 +26,8 @@
"husky": "^9.1.7",
"prettier": "^3.5.3",
"prettier-plugin-astro": "^0.14.1",
"tsup": "^8.4.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.29.0",
"vitest": "^3.1.1"
}

View file

@ -8,12 +8,11 @@
"url": "https://git.sr.ht/~ayoayco/astro-sw"
},
"exports": {
".": "./astro-sw.js",
"./globals": "./globals.js"
".": "./dist/astro-sw.js",
"./globals": "./dist/globals.js"
},
"files": [
"astro-sw.js",
"globals.js"
"dist"
],
"main": "./astro-sw.js",
"type": "module",
@ -21,6 +20,7 @@
"node": ">=18.0.0"
},
"scripts": {
"build": "tsup src/** --format esm --dts --clean",
"test": "vitest run",
"version:patch": "npm version patch",
"version:minor": "npm version minor",
@ -37,5 +37,8 @@
},
"peerDependencies": {
"astro": "^5.6"
},
"devDependencies": {
"@types/node": "^22.14.0"
}
}

View file

@ -7,6 +7,8 @@ import { readFile, writeFile, readdir, unlink } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { resolve, dirname, join } from 'node:path'
import { build } from 'esbuild'
import type { Config } from './types'
import type { AstroIntegration } from 'astro'
const ASTROSW = '@ayco/astro-sw'
/**
@ -17,35 +19,11 @@ const ASTROSW = '@ayco/astro-sw'
/**
* Accepts configuration options with service worker path
* and injects needed variables such as `__assets` generated by Astro
* @param {{
* path: string,
* assetCachePrefix?: string,
* assetCacheVersionID?: string,
* customRoutes?: string[],
* excludeRoutes?: string[],
* logAssets?: true,
* esbuild?: BuildOptions,
* registrationHooks?: {
* installing?: () => void,
* waiting?: () => void,
* active?: () => void,
* error?: (error) => void,
* unsupported?: () => void,
* afterRegistration?: () => void,
* }
* experimental?: {
* strategy?: {
* fetchFn: () => void,
* installFn: () => void,
* activateFn: () => void,
* waitFn: () => void,
* }
* }
* }} options
* @param {} options
* @returns {AstroIntegration}
*/
export default function serviceWorker(options) {
let {
export default function serviceWorker(options: Config): AstroIntegration {
const {
assetCachePrefix = ASTROSW,
assetCacheVersionID = '0',
path: serviceWorkerPath = undefined,
@ -68,7 +46,7 @@ export default function serviceWorker(options) {
/**
* @type {Array<string>}
*/
let manifestAssets = []
let manifestAssets: string[] = []
const registrationScript = `const registerSW = async () => {
if ("serviceWorker" in navigator) {
@ -114,7 +92,7 @@ export default function serviceWorker(options) {
}
},
'astro:config:done': async ({ injectTypes }) => {
let injectedTypes = `
const injectedTypes = `
declare const __assets: string[];
declare const __version: string;
declare const __prefix: string;`
@ -196,9 +174,10 @@ declare const __prefix: string;`
try {
logger.info(`Using service worker in path: ${swPath}`)
// @ts-expect-error undefined error is caught via try-catch
originalScript = await readFile(swPath)
} catch (err) {
logger.error(err)
} catch (err: unknown) {
logger.error(JSON.stringify(err))
if (!swPath) {
logger.error(`
@ -224,7 +203,7 @@ declare const __prefix: string;`
{ flag: 'w+' }
)
} catch (err) {
logger.error(err.toString())
logger.error(JSON.stringify(err))
}
try {
@ -236,14 +215,14 @@ declare const __prefix: string;`
entryPoints: [tempFile],
})
} catch (err) {
logger.error(err.toString())
logger.error(JSON.stringify(err))
}
// remove temp file
try {
await unlink(tempFile)
} catch (err) {
logger.error(err.toString())
logger.error(JSON.stringify(err))
}
},
},

27
package/src/types.ts Normal file
View file

@ -0,0 +1,27 @@
import type { BuildOptions } from 'esbuild'
export type Config = {
path: string
assetCachePrefix?: string
assetCacheVersionID?: string
customRoutes?: string[]
excludeRoutes?: string[]
logAssets?: true
esbuild?: BuildOptions
registrationHooks?: {
installing?: () => void
waiting?: () => void
active?: () => void
error?: (error: Error) => void
unsupported?: () => void
afterRegistration?: () => void
}
experimental?: {
strategy?: {
fetchFn: () => void
installFn: () => void
activateFn: () => void
waitFn: () => void
}
}
}

View file

@ -10,7 +10,7 @@ importers:
devDependencies:
'@ayco/astro-sw':
specifier: workspace:*
version: link:packages/astro-sw
version: link:package
'@eslint/js':
specifier: ^9.24.0
version: 9.24.0
@ -35,21 +35,27 @@ importers:
prettier-plugin-astro:
specifier: ^0.14.1
version: 0.14.1
tsup:
specifier: ^8.4.0
version: 8.4.0(postcss@8.5.3)(typescript@5.8.3)
typescript:
specifier: ^5.8.3
version: 5.8.3
typescript-eslint:
specifier: ^8.29.0
version: 8.29.0(eslint@9.24.0)(typescript@5.8.3)
vitest:
specifier: ^3.1.1
version: 3.1.1(@types/debug@4.1.12)
version: 3.1.1(@types/debug@4.1.12)(@types/node@22.14.0)
demo:
devDependencies:
'@astrojs/node':
specifier: ^9.1.3
version: 9.1.3(astro@5.6.1(rollup@4.39.0)(typescript@5.8.3))
version: 9.1.3(astro@5.6.1(@types/node@22.14.0)(rollup@4.39.0)(typescript@5.8.3))
'@ayco/astro-sw':
specifier: workspace:*
version: link:../packages/astro-sw
version: link:../package
'@fastify/middie':
specifier: ^9.0.3
version: 9.0.3
@ -58,7 +64,7 @@ importers:
version: 8.1.1
astro:
specifier: ^5.6.1
version: 5.6.1(rollup@4.39.0)(typescript@5.8.3)
version: 5.6.1(@types/node@22.14.0)(rollup@4.39.0)(typescript@5.8.3)
astro-eslint-parser:
specifier: ^1.2.2
version: 1.2.2
@ -66,15 +72,18 @@ importers:
specifier: ^5.2.2
version: 5.2.2
packages/astro-sw:
package:
dependencies:
astro:
specifier: ^5.6
version: 5.6.1(rollup@4.39.0)(typescript@5.8.3)
esbuild:
specifier: ^0.25.2
version: 0.25.2
devDependencies:
astro:
specifier: ^5.6.1
version: 5.6.1(rollup@4.39.0)(typescript@5.8.3)
'@types/node':
specifier: ^22.14.0
version: 22.14.0
packages:
@ -471,9 +480,24 @@ packages:
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
'@jridgewell/gen-mapping@0.3.8':
resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
engines: {node: '>=6.0.0'}
'@jridgewell/resolve-uri@3.1.2':
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
engines: {node: '>=6.0.0'}
'@jridgewell/set-array@1.2.1':
resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==}
engines: {node: '>=6.0.0'}
'@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
'@jridgewell/trace-mapping@0.3.25':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
'@lukeed/ms@2.0.2':
resolution: {integrity: sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==}
engines: {node: '>=8'}
@ -493,6 +517,10 @@ packages:
'@oslojs/encoding@1.1.0':
resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==}
'@pkgjs/parseargs@0.11.0':
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
'@pkgr/core@0.1.2':
resolution: {integrity: sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@ -648,6 +676,9 @@ packages:
'@types/nlcst@2.0.3':
resolution: {integrity: sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==}
'@types/node@22.14.0':
resolution: {integrity: sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==}
'@types/unist@3.0.3':
resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
@ -776,6 +807,9 @@ packages:
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
engines: {node: '>=12'}
any-promise@1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
anymatch@3.1.3:
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'}
@ -878,6 +912,12 @@ packages:
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
engines: {node: '>=8'}
bundle-require@5.1.0:
resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
peerDependencies:
esbuild: '>=0.18'
cac@6.7.14:
resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}
engines: {node: '>=8'}
@ -963,12 +1003,20 @@ packages:
comma-separated-tokens@2.0.3:
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
commander@4.1.1:
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
engines: {node: '>= 6'}
common-ancestor-path@1.0.1:
resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==}
concat-map@0.0.1:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
consola@3.4.2:
resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}
engines: {node: ^14.18.0 || >=16.10.0}
content-disposition@0.5.4:
resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==}
engines: {node: '>= 0.6'}
@ -1361,6 +1409,10 @@ packages:
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
engines: {node: '>=10.13.0'}
glob@10.4.5:
resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
hasBin: true
glob@11.0.1:
resolution: {integrity: sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==}
engines: {node: 20 || >=22}
@ -1619,10 +1671,17 @@ packages:
isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
jackspeak@3.4.3:
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
jackspeak@4.1.0:
resolution: {integrity: sha512-9DDdhb5j6cpeitCbvLO7n7J4IxnbM6hoF6O1g4HQ5TfhvvKN8ywDM7668ZhMHRqVmxqhps/F6syWK2KcPxYlkw==}
engines: {node: 20 || >=22}
joycon@3.1.1:
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
engines: {node: '>=10'}
js-yaml@4.1.0:
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
hasBin: true
@ -1671,6 +1730,17 @@ packages:
light-my-request@6.6.0:
resolution: {integrity: sha512-CHYbu8RtboSIoVsHZ6Ye4cj4Aw/yg2oAFimlF7mNvfDV192LR7nDiKtSIfCuLT7KokPSTn/9kfVLm5OGN0A28A==}
lilconfig@3.1.3:
resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==}
engines: {node: '>=14'}
lines-and-columns@1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
load-tsconfig@0.2.5:
resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
locate-path@6.0.0:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
@ -1678,6 +1748,9 @@ packages:
lodash.merge@4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
lodash.sortby@4.7.0:
resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
longest-streak@3.1.0:
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
@ -1870,6 +1943,9 @@ packages:
ms@2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
mz@2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
nanoid@3.3.11:
resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -1895,6 +1971,10 @@ packages:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
object-inspect@1.13.4:
resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
engines: {node: '>= 0.4'}
@ -1984,6 +2064,10 @@ packages:
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
engines: {node: '>=8'}
path-scurry@1.11.1:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'}
path-scurry@2.0.0:
resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==}
engines: {node: 20 || >=22}
@ -2020,10 +2104,32 @@ packages:
resolution: {integrity: sha512-i85pKRCt4qMjZ1+L7sy2Ag4t1atFcdbEt76+7iRJn1g2BvsnRMGu9p8pivl9fs63M2kF/A0OacFZhTub+m/qMg==}
hasBin: true
pirates@4.0.7:
resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==}
engines: {node: '>= 6'}
possible-typed-array-names@1.1.0:
resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
engines: {node: '>= 0.4'}
postcss-load-config@6.0.1:
resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==}
engines: {node: '>= 18'}
peerDependencies:
jiti: '>=1.21.0'
postcss: '>=8.0.9'
tsx: ^4.8.1
yaml: ^2.4.2
peerDependenciesMeta:
jiti:
optional: true
postcss:
optional: true
tsx:
optional: true
yaml:
optional: true
postcss-selector-parser@7.1.0:
resolution: {integrity: sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==}
engines: {node: '>=4'}
@ -2140,6 +2246,10 @@ packages:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'}
resolve-from@5.0.0:
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
engines: {node: '>=8'}
ret@0.5.0:
resolution: {integrity: sha512-I1XxrZSQ+oErkRR4jYbAyEEu2I0avBvvMM5JN+6EBprOGRCs63ENqZ3vjavq8fBw2+62G5LF5XelKwuJpcvcxw==}
engines: {node: '>=10'}
@ -2287,6 +2397,10 @@ packages:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
source-map@0.8.0-beta.0:
resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
engines: {node: '>= 8'}
space-separated-tokens@2.0.2:
resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
@ -2347,6 +2461,11 @@ packages:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'}
sucrase@3.35.0:
resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==}
engines: {node: '>=16 || 14 >=14.17'}
hasBin: true
suf-log@2.5.3:
resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==}
@ -2358,6 +2477,13 @@ packages:
resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
engines: {node: ^14.18.0 || >=16.0.0}
thenify-all@1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
thenify@3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
thread-stream@3.1.0:
resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==}
@ -2395,6 +2521,13 @@ packages:
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
engines: {node: '>=0.6'}
tr46@1.0.1:
resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==}
tree-kill@1.2.2:
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
hasBin: true
trim-lines@3.0.1:
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@ -2407,6 +2540,9 @@ packages:
peerDependencies:
typescript: '>=4.8.4'
ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
tsconfck@3.1.5:
resolution: {integrity: sha512-CLDfGgUp7XPswWnezWwsCRxNmgQjhYq3VXHM0/XIRxhVrKw0M1if9agzryh1QS3nxjCROvV+xWxoJO1YctzzWg==}
engines: {node: ^18 || >=20}
@ -2420,6 +2556,25 @@ packages:
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
tsup@8.4.0:
resolution: {integrity: sha512-b+eZbPCjz10fRryaAA7C8xlIHnf8VnsaRqydheLIqwG/Mcpfk8Z5zp3HayX7GaTygkigHl5cBUs+IhcySiIexQ==}
engines: {node: '>=18'}
hasBin: true
peerDependencies:
'@microsoft/api-extractor': ^7.36.0
'@swc/core': ^1
postcss: ^8.4.12
typescript: '>=4.5.0'
peerDependenciesMeta:
'@microsoft/api-extractor':
optional: true
'@swc/core':
optional: true
postcss:
optional: true
typescript:
optional: true
type-check@0.4.0:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@ -2469,6 +2624,9 @@ packages:
uncrypto@0.1.3:
resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==}
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
@ -2657,6 +2815,12 @@ packages:
web-namespaces@2.0.1:
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
webidl-conversions@4.0.2:
resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
whatwg-url@7.1.0:
resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==}
which-boxed-primitive@1.1.1:
resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==}
engines: {node: '>= 0.4'}
@ -2779,10 +2943,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@astrojs/node@9.1.3(astro@5.6.1(rollup@4.39.0)(typescript@5.8.3))':
'@astrojs/node@9.1.3(astro@5.6.1(@types/node@22.14.0)(rollup@4.39.0)(typescript@5.8.3))':
dependencies:
'@astrojs/internal-helpers': 0.6.1
astro: 5.6.1(rollup@4.39.0)(typescript@5.8.3)
astro: 5.6.1(@types/node@22.14.0)(rollup@4.39.0)(typescript@5.8.3)
send: 1.2.0
server-destroy: 1.0.1
transitivePeerDependencies:
@ -3091,8 +3255,23 @@ snapshots:
wrap-ansi: 8.1.0
wrap-ansi-cjs: wrap-ansi@7.0.0
'@jridgewell/gen-mapping@0.3.8':
dependencies:
'@jridgewell/set-array': 1.2.1
'@jridgewell/sourcemap-codec': 1.5.0
'@jridgewell/trace-mapping': 0.3.25
'@jridgewell/resolve-uri@3.1.2': {}
'@jridgewell/set-array@1.2.1': {}
'@jridgewell/sourcemap-codec@1.5.0': {}
'@jridgewell/trace-mapping@0.3.25':
dependencies:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@lukeed/ms@2.0.2': {}
'@nodelib/fs.scandir@2.1.5':
@ -3109,6 +3288,9 @@ snapshots:
'@oslojs/encoding@1.1.0': {}
'@pkgjs/parseargs@0.11.0':
optional: true
'@pkgr/core@0.1.2': {}
'@rollup/pluginutils@5.1.4(rollup@4.39.0)':
@ -3234,6 +3416,10 @@ snapshots:
dependencies:
'@types/unist': 3.0.3
'@types/node@22.14.0':
dependencies:
undici-types: 6.21.0
'@types/unist@3.0.3': {}
'@typescript-eslint/eslint-plugin@8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.24.0)(typescript@5.8.3))(eslint@9.24.0)(typescript@5.8.3)':
@ -3322,13 +3508,13 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
'@vitest/mocker@3.1.1(vite@6.2.5)':
'@vitest/mocker@3.1.1(vite@6.2.5(@types/node@22.14.0))':
dependencies:
'@vitest/spy': 3.1.1
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
vite: 6.2.5
vite: 6.2.5(@types/node@22.14.0)
'@vitest/pretty-format@3.1.1':
dependencies:
@ -3395,6 +3581,8 @@ snapshots:
ansi-styles@6.2.1: {}
any-promise@1.3.0: {}
anymatch@3.1.3:
dependencies:
normalize-path: 3.0.0
@ -3465,6 +3653,101 @@ snapshots:
transitivePeerDependencies:
- supports-color
astro@5.6.1(@types/node@22.14.0)(rollup@4.39.0)(typescript@5.8.3):
dependencies:
'@astrojs/compiler': 2.11.0
'@astrojs/internal-helpers': 0.6.1
'@astrojs/markdown-remark': 6.3.1
'@astrojs/telemetry': 3.2.0
'@oslojs/encoding': 1.1.0
'@rollup/pluginutils': 5.1.4(rollup@4.39.0)
acorn: 8.14.1
aria-query: 5.3.2
axobject-query: 4.1.0
boxen: 8.0.1
ci-info: 4.2.0
clsx: 2.1.1
common-ancestor-path: 1.0.1
cookie: 1.0.2
cssesc: 3.0.0
debug: 4.4.0
deterministic-object-hash: 2.0.2
devalue: 5.1.1
diff: 5.2.0
dlv: 1.1.3
dset: 3.1.4
es-module-lexer: 1.6.0
esbuild: 0.25.2
estree-walker: 3.0.3
flattie: 1.1.1
github-slugger: 2.0.0
html-escaper: 3.0.3
http-cache-semantics: 4.1.1
js-yaml: 4.1.0
kleur: 4.1.5
magic-string: 0.30.17
magicast: 0.3.5
mrmime: 2.0.1
neotraverse: 0.6.18
p-limit: 6.2.0
p-queue: 8.1.0
package-manager-detector: 1.1.0
picomatch: 4.0.2
prompts: 2.4.2
rehype: 13.0.2
semver: 7.7.1
shiki: 3.2.1
tinyexec: 0.3.2
tinyglobby: 0.2.12
tsconfck: 3.1.5(typescript@5.8.3)
ultrahtml: 1.6.0
unist-util-visit: 5.0.0
unstorage: 1.15.0
vfile: 6.0.3
vite: 6.2.5(@types/node@22.14.0)
vitefu: 1.0.6(vite@6.2.5(@types/node@22.14.0))
xxhash-wasm: 1.1.0
yargs-parser: 21.1.1
yocto-spinner: 0.2.1
zod: 3.24.2
zod-to-json-schema: 3.24.5(zod@3.24.2)
zod-to-ts: 1.2.0(typescript@5.8.3)(zod@3.24.2)
optionalDependencies:
sharp: 0.33.5
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
- '@azure/data-tables'
- '@azure/identity'
- '@azure/keyvault-secrets'
- '@azure/storage-blob'
- '@capacitor/preferences'
- '@deno/kv'
- '@netlify/blobs'
- '@planetscale/database'
- '@types/node'
- '@upstash/redis'
- '@vercel/blob'
- '@vercel/kv'
- aws4fetch
- db0
- idb-keyval
- ioredis
- jiti
- less
- lightningcss
- rollup
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
- tsx
- typescript
- uploadthing
- yaml
astro@5.6.1(rollup@4.39.0)(typescript@5.8.3):
dependencies:
'@astrojs/compiler': 2.11.0
@ -3612,6 +3895,11 @@ snapshots:
dependencies:
fill-range: 7.1.1
bundle-require@5.1.0(esbuild@0.25.2):
dependencies:
esbuild: 0.25.2
load-tsconfig: 0.2.5
cac@6.7.14: {}
call-bind-apply-helpers@1.0.2:
@ -3690,10 +3978,14 @@ snapshots:
comma-separated-tokens@2.0.3: {}
commander@4.1.1: {}
common-ancestor-path@1.0.1: {}
concat-map@0.0.1: {}
consola@3.4.2: {}
content-disposition@0.5.4:
dependencies:
safe-buffer: 5.2.1
@ -4195,6 +4487,15 @@ snapshots:
dependencies:
is-glob: 4.0.3
glob@10.4.5:
dependencies:
foreground-child: 3.3.1
jackspeak: 3.4.3
minimatch: 9.0.5
minipass: 7.1.2
package-json-from-dist: 1.0.1
path-scurry: 1.11.1
glob@11.0.1:
dependencies:
foreground-child: 3.3.1
@ -4501,10 +4802,18 @@ snapshots:
isexe@2.0.0: {}
jackspeak@3.4.3:
dependencies:
'@isaacs/cliui': 8.0.2
optionalDependencies:
'@pkgjs/parseargs': 0.11.0
jackspeak@4.1.0:
dependencies:
'@isaacs/cliui': 8.0.2
joycon@3.1.1: {}
js-yaml@4.1.0:
dependencies:
argparse: 2.0.1
@ -4553,12 +4862,20 @@ snapshots:
process-warning: 4.0.1
set-cookie-parser: 2.7.1
lilconfig@3.1.3: {}
lines-and-columns@1.2.4: {}
load-tsconfig@0.2.5: {}
locate-path@6.0.0:
dependencies:
p-locate: 5.0.0
lodash.merge@4.6.2: {}
lodash.sortby@4.7.0: {}
longest-streak@3.1.0: {}
loupe@3.1.3: {}
@ -4925,6 +5242,12 @@ snapshots:
ms@2.1.3: {}
mz@2.7.0:
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
nanoid@3.3.11: {}
natural-compare@1.4.0: {}
@ -4941,6 +5264,8 @@ snapshots:
normalize-path@3.0.0: {}
object-assign@4.1.1: {}
object-inspect@1.13.4: {}
object-keys@1.1.1: {}
@ -5048,6 +5373,11 @@ snapshots:
path-key@3.1.1: {}
path-scurry@1.11.1:
dependencies:
lru-cache: 10.4.3
minipass: 7.1.2
path-scurry@2.0.0:
dependencies:
lru-cache: 11.1.0
@ -5085,8 +5415,16 @@ snapshots:
sonic-boom: 4.2.0
thread-stream: 3.1.0
pirates@4.0.7: {}
possible-typed-array-names@1.1.0: {}
postcss-load-config@6.0.1(postcss@8.5.3):
dependencies:
lilconfig: 3.1.3
optionalDependencies:
postcss: 8.5.3
postcss-selector-parser@7.1.0:
dependencies:
cssesc: 3.0.0
@ -5235,6 +5573,8 @@ snapshots:
resolve-from@4.0.0: {}
resolve-from@5.0.0: {}
ret@0.5.0: {}
retext-latin@4.0.0:
@ -5468,6 +5808,10 @@ snapshots:
source-map-js@1.2.1: {}
source-map@0.8.0-beta.0:
dependencies:
whatwg-url: 7.1.0
space-separated-tokens@2.0.2: {}
split2@4.2.0: {}
@ -5540,6 +5884,16 @@ snapshots:
strip-json-comments@3.1.1: {}
sucrase@3.35.0:
dependencies:
'@jridgewell/gen-mapping': 0.3.8
commander: 4.1.1
glob: 10.4.5
lines-and-columns: 1.2.4
mz: 2.7.0
pirates: 4.0.7
ts-interface-checker: 0.1.13
suf-log@2.5.3:
dependencies:
s.color: 0.0.15
@ -5553,6 +5907,14 @@ snapshots:
'@pkgr/core': 0.1.2
tslib: 2.8.1
thenify-all@1.6.0:
dependencies:
thenify: 3.3.1
thenify@3.3.1:
dependencies:
any-promise: 1.3.0
thread-stream@3.1.0:
dependencies:
real-require: 0.2.0
@ -5580,6 +5942,12 @@ snapshots:
toidentifier@1.0.1: {}
tr46@1.0.1:
dependencies:
punycode: 2.3.1
tree-kill@1.2.2: {}
trim-lines@3.0.1: {}
trough@2.2.0: {}
@ -5588,12 +5956,41 @@ snapshots:
dependencies:
typescript: 5.8.3
ts-interface-checker@0.1.13: {}
tsconfck@3.1.5(typescript@5.8.3):
optionalDependencies:
typescript: 5.8.3
tslib@2.8.1: {}
tsup@8.4.0(postcss@8.5.3)(typescript@5.8.3):
dependencies:
bundle-require: 5.1.0(esbuild@0.25.2)
cac: 6.7.14
chokidar: 4.0.3
consola: 3.4.2
debug: 4.4.0
esbuild: 0.25.2
joycon: 3.1.1
picocolors: 1.1.1
postcss-load-config: 6.0.1(postcss@8.5.3)
resolve-from: 5.0.0
rollup: 4.39.0
source-map: 0.8.0-beta.0
sucrase: 3.35.0
tinyexec: 0.3.2
tinyglobby: 0.2.12
tree-kill: 1.2.2
optionalDependencies:
postcss: 8.5.3
typescript: 5.8.3
transitivePeerDependencies:
- jiti
- supports-color
- tsx
- yaml
type-check@0.4.0:
dependencies:
prelude-ls: 1.2.1
@ -5658,6 +6055,8 @@ snapshots:
uncrypto@0.1.3: {}
undici-types@6.21.0: {}
unified@11.0.5:
dependencies:
'@types/unist': 3.0.3
@ -5742,13 +6141,13 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.2
vite-node@3.1.1:
vite-node@3.1.1(@types/node@22.14.0):
dependencies:
cac: 6.7.14
debug: 4.4.0
es-module-lexer: 1.6.0
pathe: 2.0.3
vite: 6.2.5
vite: 6.2.5(@types/node@22.14.0)
transitivePeerDependencies:
- '@types/node'
- jiti
@ -5771,14 +6170,27 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
vite@6.2.5(@types/node@22.14.0):
dependencies:
esbuild: 0.25.2
postcss: 8.5.3
rollup: 4.39.0
optionalDependencies:
'@types/node': 22.14.0
fsevents: 2.3.3
vitefu@1.0.6(vite@6.2.5(@types/node@22.14.0)):
optionalDependencies:
vite: 6.2.5(@types/node@22.14.0)
vitefu@1.0.6(vite@6.2.5):
optionalDependencies:
vite: 6.2.5
vitest@3.1.1(@types/debug@4.1.12):
vitest@3.1.1(@types/debug@4.1.12)(@types/node@22.14.0):
dependencies:
'@vitest/expect': 3.1.1
'@vitest/mocker': 3.1.1(vite@6.2.5)
'@vitest/mocker': 3.1.1(vite@6.2.5(@types/node@22.14.0))
'@vitest/pretty-format': 3.1.1
'@vitest/runner': 3.1.1
'@vitest/snapshot': 3.1.1
@ -5794,11 +6206,12 @@ snapshots:
tinyexec: 0.3.2
tinypool: 1.0.2
tinyrainbow: 2.0.0
vite: 6.2.5
vite-node: 3.1.1
vite: 6.2.5(@types/node@22.14.0)
vite-node: 3.1.1(@types/node@22.14.0)
why-is-node-running: 2.3.0
optionalDependencies:
'@types/debug': 4.1.12
'@types/node': 22.14.0
transitivePeerDependencies:
- jiti
- less
@ -5815,6 +6228,14 @@ snapshots:
web-namespaces@2.0.1: {}
webidl-conversions@4.0.2: {}
whatwg-url@7.1.0:
dependencies:
lodash.sortby: 4.7.0
tr46: 1.0.1
webidl-conversions: 4.0.2
which-boxed-primitive@1.1.1:
dependencies:
is-bigint: 1.1.0

View file

@ -1,3 +1,3 @@
packages:
- "packages/**"
- "package"
- "demo"

11
tsconfig.json Normal file
View file

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"module": "ESNext" /* Specify what module code is generated. */,
"moduleResolution": "bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
"strict": true /* Enable all strict type-checking options. */
},
"exclude": ["./dist/**/*"]
}