@elgap/edukaai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +15 -0
- package/.output/public/_nuxt/BHDzAs85.js +1 -0
- package/.output/public/_nuxt/BJzbfdL_.js +1 -0
- package/.output/public/_nuxt/BKGLlKXk.js +6 -0
- package/.output/public/_nuxt/BLuXzJk3.js +1 -0
- package/.output/public/_nuxt/BNOzzLI3.js +1 -0
- package/.output/public/_nuxt/BO5GMwXh.js +1 -0
- package/.output/public/_nuxt/BQRbsFGy.js +1 -0
- package/.output/public/_nuxt/Be4MVdOg.js +1 -0
- package/.output/public/_nuxt/Bu4d3Z1T.js +1 -0
- package/.output/public/_nuxt/BwpBBNv4.js +1 -0
- package/.output/public/_nuxt/C1Og9-6n.js +97 -0
- package/.output/public/_nuxt/C3CjAhtj.js +1 -0
- package/.output/public/_nuxt/C6E3Ty3z.js +1 -0
- package/.output/public/_nuxt/COct4B42.js +1 -0
- package/.output/public/_nuxt/CQ6g2dtj.js +1 -0
- package/.output/public/_nuxt/CURSW5TV.js +246 -0
- package/.output/public/_nuxt/CW57JW4s.js +1 -0
- package/.output/public/_nuxt/Cg2fM61o.js +18 -0
- package/.output/public/_nuxt/CgGOeWta.js +1 -0
- package/.output/public/_nuxt/CoyYbT7u.js +1 -0
- package/.output/public/_nuxt/D11MHbGc.js +133 -0
- package/.output/public/_nuxt/D24dz0S8.js +1 -0
- package/.output/public/_nuxt/D3EFPr8x.js +1 -0
- package/.output/public/_nuxt/Dvt4ZHil.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/ab87ba0e-6d0d-4466-8b12-00d44f8fb9d3.json +1 -0
- package/.output/public/_nuxt/default.C1K1-g4D.css +1 -0
- package/.output/public/_nuxt/entry.CH8k-Mga.css +1 -0
- package/.output/public/_nuxt/error-404.C-Ezrlz-.css +1 -0
- package/.output/public/_nuxt/error-500.DBWf9FGj.css +1 -0
- package/.output/public/_nuxt/first-training.wFDD65zm.css +1 -0
- package/.output/public/_nuxt/import.cUKYdCrq.css +1 -0
- package/.output/public/_nuxt/index.D-2VHyHA.css +1 -0
- package/.output/public/_nuxt/index.D4J_vHmL.css +1 -0
- package/.output/public/_nuxt/mPJeLIz7.js +1 -0
- package/.output/server/chunks/_/error-500.mjs +19 -0
- package/.output/server/chunks/_/error-500.mjs.map +1 -0
- package/.output/server/chunks/build/ExampleCard-styles.BUOJhEg0.mjs +8 -0
- package/.output/server/chunks/build/ExampleCard-styles.BUOJhEg0.mjs.map +1 -0
- package/.output/server/chunks/build/ExampleForm-Bcpl0CfL.mjs +238 -0
- package/.output/server/chunks/build/ExampleForm-Bcpl0CfL.mjs.map +1 -0
- package/.output/server/chunks/build/ImportPreview-styles.CFmMl5Ok.mjs +8 -0
- package/.output/server/chunks/build/ImportPreview-styles.CFmMl5Ok.mjs.map +1 -0
- package/.output/server/chunks/build/_id_-BUSGcL-H.mjs +113 -0
- package/.output/server/chunks/build/_id_-BUSGcL-H.mjs.map +1 -0
- package/.output/server/chunks/build/axolotl-C-EXGgM8.mjs +112 -0
- package/.output/server/chunks/build/axolotl-C-EXGgM8.mjs.map +1 -0
- package/.output/server/chunks/build/best-practices-DsadorHb.mjs +38 -0
- package/.output/server/chunks/build/best-practices-DsadorHb.mjs.map +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +4 -0
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
- package/.output/server/chunks/build/default-DPkqqHOE.mjs +354 -0
- package/.output/server/chunks/build/default-DPkqqHOE.mjs.map +1 -0
- package/.output/server/chunks/build/default-styles.DsqVVS7k.mjs +8 -0
- package/.output/server/chunks/build/default-styles.DsqVVS7k.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-K4UfZNck.mjs +97 -0
- package/.output/server/chunks/build/error-404-K4UfZNck.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.DuDrf-v0.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.DuDrf-v0.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-CA7TEPNg.mjs +79 -0
- package/.output/server/chunks/build/error-500-CA7TEPNg.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.8IYEHzz6.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.8IYEHzz6.mjs.map +1 -0
- package/.output/server/chunks/build/examples-BHK8MDrs.mjs +134 -0
- package/.output/server/chunks/build/examples-BHK8MDrs.mjs.map +1 -0
- package/.output/server/chunks/build/export-BzxFqqfP.mjs +233 -0
- package/.output/server/chunks/build/export-BzxFqqfP.mjs.map +1 -0
- package/.output/server/chunks/build/faq-DKch73dS.mjs +112 -0
- package/.output/server/chunks/build/faq-DKch73dS.mjs.map +1 -0
- package/.output/server/chunks/build/field-guide-qbukT8F0.mjs +38 -0
- package/.output/server/chunks/build/field-guide-qbukT8F0.mjs.map +1 -0
- package/.output/server/chunks/build/first-training-BbEOBcEW.mjs +343 -0
- package/.output/server/chunks/build/first-training-BbEOBcEW.mjs.map +1 -0
- package/.output/server/chunks/build/first-training-styles.BzOa_KRD.mjs +8 -0
- package/.output/server/chunks/build/first-training-styles.BzOa_KRD.mjs.map +1 -0
- package/.output/server/chunks/build/glossary-CxSGCJoH.mjs +397 -0
- package/.output/server/chunks/build/glossary-CxSGCJoH.mjs.map +1 -0
- package/.output/server/chunks/build/huggingface-TSmyUzZU.mjs +128 -0
- package/.output/server/chunks/build/huggingface-TSmyUzZU.mjs.map +1 -0
- package/.output/server/chunks/build/import-C0kYhRv9.mjs +247 -0
- package/.output/server/chunks/build/import-C0kYhRv9.mjs.map +1 -0
- package/.output/server/chunks/build/index-C1ntBEWd.mjs +235 -0
- package/.output/server/chunks/build/index-C1ntBEWd.mjs.map +1 -0
- package/.output/server/chunks/build/index-D3CxihcX.mjs +320 -0
- package/.output/server/chunks/build/index-D3CxihcX.mjs.map +1 -0
- package/.output/server/chunks/build/index-DgKa1cy0.mjs +360 -0
- package/.output/server/chunks/build/index-DgKa1cy0.mjs.map +1 -0
- package/.output/server/chunks/build/index-cG54gaKX.mjs +513 -0
- package/.output/server/chunks/build/index-cG54gaKX.mjs.map +1 -0
- package/.output/server/chunks/build/index-styles.BX2SZiiS.mjs +8 -0
- package/.output/server/chunks/build/index-styles.BX2SZiiS.mjs.map +1 -0
- package/.output/server/chunks/build/llm-training-DIqc0eiM.mjs +91 -0
- package/.output/server/chunks/build/llm-training-DIqc0eiM.mjs.map +1 -0
- package/.output/server/chunks/build/new-b3338aLF.mjs +92 -0
- package/.output/server/chunks/build/new-b3338aLF.mjs.map +1 -0
- package/.output/server/chunks/build/nuxt-link-Ceyd90PQ.mjs +290 -0
- package/.output/server/chunks/build/nuxt-link-Ceyd90PQ.mjs.map +1 -0
- package/.output/server/chunks/build/sample-datasets-CVLWMQUA.mjs +45 -0
- package/.output/server/chunks/build/sample-datasets-CVLWMQUA.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +1979 -0
- package/.output/server/chunks/build/server.mjs.map +1 -0
- package/.output/server/chunks/build/styles.mjs +20 -0
- package/.output/server/chunks/build/styles.mjs.map +1 -0
- package/.output/server/chunks/build/test-router-BYM6Cpst.mjs +105 -0
- package/.output/server/chunks/build/test-router-BYM6Cpst.mjs.map +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +5800 -0
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +481 -0
- package/.output/server/chunks/routes/renderer.mjs.map +1 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/.output/server/index.mjs +12 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/api.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/app.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/component.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/context.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/hooks.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/index.js +22 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/api/util.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/const.js +5 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/env.js +17 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/index.js +45 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/plugin.js +2 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/proxy.js +111 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/lib/cjs/time.js +28 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@6.6.4/package.json +37 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@7.7.9/dist/index.cjs +42 -0
- package/.output/server/node_modules/.nitro/@vue/devtools-api@7.7.9/package.json +32 -0
- package/.output/server/node_modules/.nitro/hookable@5.5.3/dist/index.cjs +299 -0
- package/.output/server/node_modules/.nitro/hookable@5.5.3/package.json +49 -0
- package/.output/server/node_modules/.nitro/hookable@6.0.1/dist/index.mjs +266 -0
- package/.output/server/node_modules/.nitro/hookable@6.0.1/package.json +52 -0
- package/.output/server/node_modules/.nitro/perfect-debounce@1.0.0/dist/index.cjs +59 -0
- package/.output/server/node_modules/.nitro/perfect-debounce@1.0.0/package.json +44 -0
- package/.output/server/node_modules/.nitro/perfect-debounce@2.1.0/dist/index.mjs +89 -0
- package/.output/server/node_modules/.nitro/perfect-debounce@2.1.0/package.json +41 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14582 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/index.js +292 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +702 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/common.js +76 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/format.js +40 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icon.js +52 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icons.js +133 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +20 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +31 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +80 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +102 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +29 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +60 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +50 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +204 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +35 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +134 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +167 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +81 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +78 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +68 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +47 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +105 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +64 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +26 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/name.js +58 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/square.js +34 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +13 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +126 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +21 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +93 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +48 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +24 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +44 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +125 -0
- package/.output/server/node_modules/@iconify/utils/lib/index.js +53 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +63 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/title.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/build.js +115 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/html.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/id.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +69 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +55 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/size.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +8 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/url.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +9 -0
- package/.output/server/node_modules/@iconify/utils/package.json +118 -0
- package/.output/server/node_modules/@iconify/vue/dist/iconify.mjs +1893 -0
- package/.output/server/node_modules/@iconify/vue/package.json +64 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6763 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/devtools-kit/dist/index.cjs +6850 -0
- package/.output/server/node_modules/@vue/devtools-kit/package.json +44 -0
- package/.output/server/node_modules/@vue/devtools-shared/dist/index.cjs +378 -0
- package/.output/server/node_modules/@vue/devtools-shared/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1870 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6810 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1750 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +883 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/birpc/dist/index.cjs +296 -0
- package/.output/server/node_modules/birpc/package.json +57 -0
- package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/.output/server/node_modules/consola/package.json +136 -0
- package/.output/server/node_modules/devalue/index.js +4 -0
- package/.output/server/node_modules/devalue/package.json +37 -0
- package/.output/server/node_modules/devalue/src/base64.js +110 -0
- package/.output/server/node_modules/devalue/src/constants.js +7 -0
- package/.output/server/node_modules/devalue/src/parse.js +246 -0
- package/.output/server/node_modules/devalue/src/stringify.js +350 -0
- package/.output/server/node_modules/devalue/src/uneval.js +490 -0
- package/.output/server/node_modules/devalue/src/utils.js +148 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +120 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/pinia/dist/pinia.prod.cjs +719 -0
- package/.output/server/node_modules/pinia/package.json +94 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/tailwindcss/dist/chunk-X4GG3EDV.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/dist/colors.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/package.json +89 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/.output/server/node_modules/ufo/package.json +48 -0
- package/.output/server/node_modules/unhead/dist/index.mjs +9 -0
- package/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
- package/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +180 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BPM0-cfG.mjs +44 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +269 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +148 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.D_nrZZPH.mjs +182 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.ckV6dpEQ.mjs +166 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.fVVqDC1O.mjs +203 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
- package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
- package/.output/server/node_modules/unhead/package.json +105 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +301 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +55 -0
- package/.output/server/node_modules/vue-router/dist/devtools-EWN81iOl.mjs +1220 -0
- package/.output/server/node_modules/vue-router/dist/vue-router.mjs +1557 -0
- package/.output/server/node_modules/vue-router/package.json +153 -0
- package/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
- package/.output/server/package.json +37 -0
- package/LICENSE +21 -0
- package/README.md +132 -0
- package/bin/cli.js +75 -0
- package/package.json +71 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
//#region src/utils.ts
|
|
2
|
+
function flatHooks(configHooks, hooks = {}, parentName) {
|
|
3
|
+
for (const key in configHooks) {
|
|
4
|
+
const subHook = configHooks[key];
|
|
5
|
+
const name = parentName ? `${parentName}:${key}` : key;
|
|
6
|
+
if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
|
|
7
|
+
else if (typeof subHook === "function") hooks[name] = subHook;
|
|
8
|
+
}
|
|
9
|
+
return hooks;
|
|
10
|
+
}
|
|
11
|
+
function mergeHooks(...hooks) {
|
|
12
|
+
const finalHooks = {};
|
|
13
|
+
for (const hook of hooks) {
|
|
14
|
+
const flatenHook = flatHooks(hook);
|
|
15
|
+
for (const key in flatenHook) if (finalHooks[key]) finalHooks[key].push(flatenHook[key]);
|
|
16
|
+
else finalHooks[key] = [flatenHook[key]];
|
|
17
|
+
}
|
|
18
|
+
for (const key in finalHooks) if (finalHooks[key].length > 1) {
|
|
19
|
+
const array = finalHooks[key];
|
|
20
|
+
finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
|
|
21
|
+
} else finalHooks[key] = finalHooks[key][0];
|
|
22
|
+
return finalHooks;
|
|
23
|
+
}
|
|
24
|
+
function serial(tasks, function_) {
|
|
25
|
+
return tasks.reduce((promise, task) => promise.then(() => function_(task)), Promise.resolve());
|
|
26
|
+
}
|
|
27
|
+
const createTask = /* @__PURE__ */ (() => {
|
|
28
|
+
if (console.createTask) return console.createTask;
|
|
29
|
+
const defaultTask = { run: (fn) => fn() };
|
|
30
|
+
return () => defaultTask;
|
|
31
|
+
})();
|
|
32
|
+
function callHooks(hooks, args, startIndex, task) {
|
|
33
|
+
for (let i = startIndex; i < hooks.length; i += 1) try {
|
|
34
|
+
const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
|
|
35
|
+
if (result instanceof Promise) return result.then(() => callHooks(hooks, args, i + 1, task));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return Promise.reject(error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function serialTaskCaller(hooks, args, name) {
|
|
41
|
+
if (hooks.length > 0) return callHooks(hooks, args, 0, createTask(name));
|
|
42
|
+
}
|
|
43
|
+
function parallelTaskCaller(hooks, args, name) {
|
|
44
|
+
if (hooks.length > 0) {
|
|
45
|
+
const task = createTask(name);
|
|
46
|
+
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** @deprecated */
|
|
50
|
+
function serialCaller(hooks, arguments_) {
|
|
51
|
+
return hooks.reduce((promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])), Promise.resolve());
|
|
52
|
+
}
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
function parallelCaller(hooks, args) {
|
|
55
|
+
return Promise.all(hooks.map((hook) => hook(...args || [])));
|
|
56
|
+
}
|
|
57
|
+
function callEachWith(callbacks, arg0) {
|
|
58
|
+
for (const callback of [...callbacks]) callback(arg0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/hookable.ts
|
|
63
|
+
var Hookable = class {
|
|
64
|
+
_hooks;
|
|
65
|
+
_before;
|
|
66
|
+
_after;
|
|
67
|
+
_deprecatedHooks;
|
|
68
|
+
_deprecatedMessages;
|
|
69
|
+
constructor() {
|
|
70
|
+
this._hooks = {};
|
|
71
|
+
this._before = void 0;
|
|
72
|
+
this._after = void 0;
|
|
73
|
+
this._deprecatedMessages = void 0;
|
|
74
|
+
this._deprecatedHooks = {};
|
|
75
|
+
this.hook = this.hook.bind(this);
|
|
76
|
+
this.callHook = this.callHook.bind(this);
|
|
77
|
+
this.callHookWith = this.callHookWith.bind(this);
|
|
78
|
+
}
|
|
79
|
+
hook(name, function_, options = {}) {
|
|
80
|
+
if (!name || typeof function_ !== "function") return () => {};
|
|
81
|
+
const originalName = name;
|
|
82
|
+
let dep;
|
|
83
|
+
while (this._deprecatedHooks[name]) {
|
|
84
|
+
dep = this._deprecatedHooks[name];
|
|
85
|
+
name = dep.to;
|
|
86
|
+
}
|
|
87
|
+
if (dep && !options.allowDeprecated) {
|
|
88
|
+
let message = dep.message;
|
|
89
|
+
if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
|
90
|
+
if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
|
|
91
|
+
if (!this._deprecatedMessages.has(message)) {
|
|
92
|
+
console.warn(message);
|
|
93
|
+
this._deprecatedMessages.add(message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!function_.name) try {
|
|
97
|
+
Object.defineProperty(function_, "name", {
|
|
98
|
+
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
|
99
|
+
configurable: true
|
|
100
|
+
});
|
|
101
|
+
} catch {}
|
|
102
|
+
this._hooks[name] = this._hooks[name] || [];
|
|
103
|
+
this._hooks[name].push(function_);
|
|
104
|
+
return () => {
|
|
105
|
+
if (function_) {
|
|
106
|
+
this.removeHook(name, function_);
|
|
107
|
+
function_ = void 0;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
hookOnce(name, function_) {
|
|
112
|
+
let _unreg;
|
|
113
|
+
let _function = (...arguments_) => {
|
|
114
|
+
if (typeof _unreg === "function") _unreg();
|
|
115
|
+
_unreg = void 0;
|
|
116
|
+
_function = void 0;
|
|
117
|
+
return function_(...arguments_);
|
|
118
|
+
};
|
|
119
|
+
_unreg = this.hook(name, _function);
|
|
120
|
+
return _unreg;
|
|
121
|
+
}
|
|
122
|
+
removeHook(name, function_) {
|
|
123
|
+
const hooks = this._hooks[name];
|
|
124
|
+
if (hooks) {
|
|
125
|
+
const index = hooks.indexOf(function_);
|
|
126
|
+
if (index !== -1) hooks.splice(index, 1);
|
|
127
|
+
if (hooks.length === 0) this._hooks[name] = void 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
deprecateHook(name, deprecated) {
|
|
131
|
+
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
|
132
|
+
const _hooks = this._hooks[name] || [];
|
|
133
|
+
this._hooks[name] = void 0;
|
|
134
|
+
for (const hook of _hooks) this.hook(name, hook);
|
|
135
|
+
}
|
|
136
|
+
deprecateHooks(deprecatedHooks) {
|
|
137
|
+
for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
|
|
138
|
+
}
|
|
139
|
+
addHooks(configHooks) {
|
|
140
|
+
const hooks = flatHooks(configHooks);
|
|
141
|
+
const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
|
|
142
|
+
return () => {
|
|
143
|
+
for (const unreg of removeFns) unreg();
|
|
144
|
+
removeFns.length = 0;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
removeHooks(configHooks) {
|
|
148
|
+
const hooks = flatHooks(configHooks);
|
|
149
|
+
for (const key in hooks) this.removeHook(key, hooks[key]);
|
|
150
|
+
}
|
|
151
|
+
removeAllHooks() {
|
|
152
|
+
this._hooks = {};
|
|
153
|
+
}
|
|
154
|
+
callHook(name, ...args) {
|
|
155
|
+
return this.callHookWith(serialTaskCaller, name, args);
|
|
156
|
+
}
|
|
157
|
+
callHookParallel(name, ...args) {
|
|
158
|
+
return this.callHookWith(parallelTaskCaller, name, args);
|
|
159
|
+
}
|
|
160
|
+
callHookWith(caller, name, args) {
|
|
161
|
+
const event = this._before || this._after ? {
|
|
162
|
+
name,
|
|
163
|
+
args,
|
|
164
|
+
context: {}
|
|
165
|
+
} : void 0;
|
|
166
|
+
if (this._before) callEachWith(this._before, event);
|
|
167
|
+
const result = caller(this._hooks[name] ? [...this._hooks[name]] : [], args, name);
|
|
168
|
+
if (result instanceof Promise) return result.finally(() => {
|
|
169
|
+
if (this._after && event) callEachWith(this._after, event);
|
|
170
|
+
});
|
|
171
|
+
if (this._after && event) callEachWith(this._after, event);
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
beforeEach(function_) {
|
|
175
|
+
this._before = this._before || [];
|
|
176
|
+
this._before.push(function_);
|
|
177
|
+
return () => {
|
|
178
|
+
if (this._before !== void 0) {
|
|
179
|
+
const index = this._before.indexOf(function_);
|
|
180
|
+
if (index !== -1) this._before.splice(index, 1);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
afterEach(function_) {
|
|
185
|
+
this._after = this._after || [];
|
|
186
|
+
this._after.push(function_);
|
|
187
|
+
return () => {
|
|
188
|
+
if (this._after !== void 0) {
|
|
189
|
+
const index = this._after.indexOf(function_);
|
|
190
|
+
if (index !== -1) this._after.splice(index, 1);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
function createHooks() {
|
|
196
|
+
return new Hookable();
|
|
197
|
+
}
|
|
198
|
+
var HookableCore = class {
|
|
199
|
+
_hooks;
|
|
200
|
+
constructor() {
|
|
201
|
+
this._hooks = {};
|
|
202
|
+
}
|
|
203
|
+
hook(name, fn) {
|
|
204
|
+
if (!name || typeof fn !== "function") return () => {};
|
|
205
|
+
this._hooks[name] = this._hooks[name] || [];
|
|
206
|
+
this._hooks[name].push(fn);
|
|
207
|
+
return () => {
|
|
208
|
+
if (fn) {
|
|
209
|
+
this.removeHook(name, fn);
|
|
210
|
+
fn = void 0;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
removeHook(name, function_) {
|
|
215
|
+
const hooks = this._hooks[name];
|
|
216
|
+
if (hooks) {
|
|
217
|
+
const index = hooks.indexOf(function_);
|
|
218
|
+
if (index !== -1) hooks.splice(index, 1);
|
|
219
|
+
if (hooks.length === 0) this._hooks[name] = void 0;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
callHook(name, ...args) {
|
|
223
|
+
const hooks = this._hooks[name];
|
|
224
|
+
if (!hooks || hooks.length === 0) return;
|
|
225
|
+
return callHooks(hooks, args, 0);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/debugger.ts
|
|
231
|
+
const isBrowser = typeof window !== "undefined";
|
|
232
|
+
/** Start debugging hook names and timing in console */
|
|
233
|
+
function createDebugger(hooks, _options = {}) {
|
|
234
|
+
const options = {
|
|
235
|
+
inspect: isBrowser,
|
|
236
|
+
group: isBrowser,
|
|
237
|
+
filter: () => true,
|
|
238
|
+
..._options
|
|
239
|
+
};
|
|
240
|
+
const _filter = options.filter;
|
|
241
|
+
const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
|
|
242
|
+
const _tag = options.tag ? `[${options.tag}] ` : "";
|
|
243
|
+
const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
|
|
244
|
+
const _idCtr = {};
|
|
245
|
+
const unsubscribeBefore = hooks.beforeEach((event) => {
|
|
246
|
+
if (filter !== void 0 && !filter(event.name)) return;
|
|
247
|
+
_idCtr[event.name] = _idCtr[event.name] || 0;
|
|
248
|
+
event._id = _idCtr[event.name]++;
|
|
249
|
+
console.time(logPrefix(event));
|
|
250
|
+
});
|
|
251
|
+
const unsubscribeAfter = hooks.afterEach((event) => {
|
|
252
|
+
if (filter !== void 0 && !filter(event.name)) return;
|
|
253
|
+
if (options.group) console.groupCollapsed(event.name);
|
|
254
|
+
if (options.inspect) console.timeLog(logPrefix(event), event.args);
|
|
255
|
+
else console.timeEnd(logPrefix(event));
|
|
256
|
+
if (options.group) console.groupEnd();
|
|
257
|
+
_idCtr[event.name]--;
|
|
258
|
+
});
|
|
259
|
+
return { close: () => {
|
|
260
|
+
unsubscribeBefore();
|
|
261
|
+
unsubscribeAfter();
|
|
262
|
+
} };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hookable",
|
|
3
|
+
"version": "6.0.1",
|
|
4
|
+
"description": "Awaitable hook system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hook",
|
|
7
|
+
"hookable",
|
|
8
|
+
"plugin",
|
|
9
|
+
"tapable",
|
|
10
|
+
"tappable"
|
|
11
|
+
],
|
|
12
|
+
"repository": "unjs/hookable",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./dist/index.mjs"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"bench": "node --expose-gc --allow-natives-syntax test/bench.ts",
|
|
26
|
+
"build": "obuild src/index.ts",
|
|
27
|
+
"dev": "vitest",
|
|
28
|
+
"lint": "eslint --cache . && prettier -c src test",
|
|
29
|
+
"lint:fix": "eslint --cache . --fix && prettier -c src test -w",
|
|
30
|
+
"prepublish": "pnpm build",
|
|
31
|
+
"release": "pnpm test && pnpm build && changelogen --release --publish --push",
|
|
32
|
+
"test": "pnpm lint && vitest run --coverage",
|
|
33
|
+
"test:types": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^25.0.3",
|
|
37
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
38
|
+
"changelogen": "^0.6.2",
|
|
39
|
+
"esbuild": "^0.27.2",
|
|
40
|
+
"eslint": "^9.39.2",
|
|
41
|
+
"eslint-config-unjs": "^0.5.0",
|
|
42
|
+
"expect-type": "^1.3.0",
|
|
43
|
+
"hookable-prev": "npm:hookable@^5.5.3",
|
|
44
|
+
"mitata": "^1.0.34",
|
|
45
|
+
"obuild": "^0.4.9",
|
|
46
|
+
"prettier": "^3.7.4",
|
|
47
|
+
"typescript": "^5.9.3",
|
|
48
|
+
"vite": "^7.3.0",
|
|
49
|
+
"vitest": "^4.0.16"
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "pnpm@10.26.0"
|
|
52
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const DEBOUNCE_DEFAULTS = {
|
|
4
|
+
trailing: true
|
|
5
|
+
};
|
|
6
|
+
function debounce(fn, wait = 25, options = {}) {
|
|
7
|
+
options = { ...DEBOUNCE_DEFAULTS, ...options };
|
|
8
|
+
if (!Number.isFinite(wait)) {
|
|
9
|
+
throw new TypeError("Expected `wait` to be a finite number");
|
|
10
|
+
}
|
|
11
|
+
let leadingValue;
|
|
12
|
+
let timeout;
|
|
13
|
+
let resolveList = [];
|
|
14
|
+
let currentPromise;
|
|
15
|
+
let trailingArgs;
|
|
16
|
+
const applyFn = (_this, args) => {
|
|
17
|
+
currentPromise = _applyPromised(fn, _this, args);
|
|
18
|
+
currentPromise.finally(() => {
|
|
19
|
+
currentPromise = null;
|
|
20
|
+
if (options.trailing && trailingArgs && !timeout) {
|
|
21
|
+
const promise = applyFn(_this, trailingArgs);
|
|
22
|
+
trailingArgs = null;
|
|
23
|
+
return promise;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return currentPromise;
|
|
27
|
+
};
|
|
28
|
+
return function(...args) {
|
|
29
|
+
if (currentPromise) {
|
|
30
|
+
if (options.trailing) {
|
|
31
|
+
trailingArgs = args;
|
|
32
|
+
}
|
|
33
|
+
return currentPromise;
|
|
34
|
+
}
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
const shouldCallNow = !timeout && options.leading;
|
|
37
|
+
clearTimeout(timeout);
|
|
38
|
+
timeout = setTimeout(() => {
|
|
39
|
+
timeout = null;
|
|
40
|
+
const promise = options.leading ? leadingValue : applyFn(this, args);
|
|
41
|
+
for (const _resolve of resolveList) {
|
|
42
|
+
_resolve(promise);
|
|
43
|
+
}
|
|
44
|
+
resolveList = [];
|
|
45
|
+
}, wait);
|
|
46
|
+
if (shouldCallNow) {
|
|
47
|
+
leadingValue = applyFn(this, args);
|
|
48
|
+
resolve(leadingValue);
|
|
49
|
+
} else {
|
|
50
|
+
resolveList.push(resolve);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function _applyPromised(fn, _this, args) {
|
|
56
|
+
return await fn.apply(_this, args);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.debounce = debounce;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "perfect-debounce",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"repository": "unjs/perfect-debounce",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.cjs",
|
|
17
|
+
"module": "./dist/index.mjs",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "unbuild",
|
|
24
|
+
"dev": "vitest dev",
|
|
25
|
+
"lint": "eslint --ext .ts,.js,.mjs,.cjs . && prettier --check src test",
|
|
26
|
+
"lint:fix": "eslint --ext .ts,.js,.mjs,.cjs . --fix && prettier -w src test",
|
|
27
|
+
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
|
|
28
|
+
"test": "vitest run --coverage"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^18.16.3",
|
|
32
|
+
"@vitest/coverage-c8": "^0.31.0",
|
|
33
|
+
"changelogen": "^0.5.3",
|
|
34
|
+
"eslint": "^8.39.0",
|
|
35
|
+
"eslint-config-unjs": "^0.1.0",
|
|
36
|
+
"in-range": "^3.0.0",
|
|
37
|
+
"prettier": "^2.8.8",
|
|
38
|
+
"time-span": "^5.1.0",
|
|
39
|
+
"typescript": "^5.0.4",
|
|
40
|
+
"unbuild": "^1.2.1",
|
|
41
|
+
"vitest": "^0.31.0"
|
|
42
|
+
},
|
|
43
|
+
"packageManager": "pnpm@8.4.0"
|
|
44
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const DEBOUNCE_DEFAULTS = { trailing: true };
|
|
3
|
+
/**
|
|
4
|
+
Debounce functions
|
|
5
|
+
@param fn - Promise-returning/async function to debounce.
|
|
6
|
+
@param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
|
|
7
|
+
@returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
|
|
8
|
+
@example
|
|
9
|
+
```
|
|
10
|
+
import { debounce } from 'perfect-debounce';
|
|
11
|
+
const expensiveCall = async input => input;
|
|
12
|
+
const debouncedFn = debounce(expensiveCall, 200);
|
|
13
|
+
for (const number of [1, 2, 3]) {
|
|
14
|
+
console.log(await debouncedFn(number));
|
|
15
|
+
}
|
|
16
|
+
//=> 1
|
|
17
|
+
//=> 2
|
|
18
|
+
//=> 3
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
function debounce(fn, wait = 25, options = {}) {
|
|
22
|
+
options = {
|
|
23
|
+
...DEBOUNCE_DEFAULTS,
|
|
24
|
+
...options
|
|
25
|
+
};
|
|
26
|
+
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
|
|
27
|
+
let leadingValue;
|
|
28
|
+
let timeout;
|
|
29
|
+
let resolveList = [];
|
|
30
|
+
let currentPromise;
|
|
31
|
+
let trailingArgs;
|
|
32
|
+
const applyFn = (_this, args) => {
|
|
33
|
+
currentPromise = _applyPromised(fn, _this, args);
|
|
34
|
+
currentPromise.finally(() => {
|
|
35
|
+
currentPromise = null;
|
|
36
|
+
if (options.trailing && trailingArgs && !timeout) {
|
|
37
|
+
const promise = applyFn(_this, trailingArgs);
|
|
38
|
+
trailingArgs = null;
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return currentPromise;
|
|
43
|
+
};
|
|
44
|
+
const debounced = function(...args) {
|
|
45
|
+
if (options.trailing) trailingArgs = args;
|
|
46
|
+
if (currentPromise) return currentPromise;
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const shouldCallNow = !timeout && options.leading;
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
timeout = setTimeout(() => {
|
|
51
|
+
timeout = null;
|
|
52
|
+
const promise = options.leading ? leadingValue : applyFn(this, args);
|
|
53
|
+
trailingArgs = null;
|
|
54
|
+
for (const _resolve of resolveList) _resolve(promise);
|
|
55
|
+
resolveList = [];
|
|
56
|
+
}, wait);
|
|
57
|
+
if (shouldCallNow) {
|
|
58
|
+
leadingValue = applyFn(this, args);
|
|
59
|
+
resolve(leadingValue);
|
|
60
|
+
} else resolveList.push(resolve);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const _clearTimeout = (timer) => {
|
|
64
|
+
if (timer) {
|
|
65
|
+
clearTimeout(timer);
|
|
66
|
+
timeout = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
debounced.isPending = () => !!timeout;
|
|
70
|
+
debounced.cancel = () => {
|
|
71
|
+
_clearTimeout(timeout);
|
|
72
|
+
resolveList = [];
|
|
73
|
+
trailingArgs = null;
|
|
74
|
+
};
|
|
75
|
+
debounced.flush = () => {
|
|
76
|
+
_clearTimeout(timeout);
|
|
77
|
+
if (!trailingArgs || currentPromise) return;
|
|
78
|
+
const args = trailingArgs;
|
|
79
|
+
trailingArgs = null;
|
|
80
|
+
return applyFn(this, args);
|
|
81
|
+
};
|
|
82
|
+
return debounced;
|
|
83
|
+
}
|
|
84
|
+
async function _applyPromised(fn, _this, args) {
|
|
85
|
+
return await fn.apply(_this, args);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { debounce };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "perfect-debounce",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"repository": "unjs/perfect-debounce",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.mjs",
|
|
13
|
+
"module": "./dist/index.mjs",
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "obuild",
|
|
20
|
+
"dev": "vitest dev",
|
|
21
|
+
"lint": "eslint . && prettier --check src test",
|
|
22
|
+
"lint:fix": "eslint . --fix && prettier -w src test",
|
|
23
|
+
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
|
|
24
|
+
"test": "vitest run --coverage"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^25.0.10",
|
|
28
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
29
|
+
"automd": "^0.4.2",
|
|
30
|
+
"changelogen": "^0.6.2",
|
|
31
|
+
"eslint": "^9.39.2",
|
|
32
|
+
"eslint-config-unjs": "^0.6.2",
|
|
33
|
+
"in-range": "^3.0.0",
|
|
34
|
+
"obuild": "^0.4.18",
|
|
35
|
+
"prettier": "^3.8.1",
|
|
36
|
+
"time-span": "^5.1.0",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vitest": "^4.0.17"
|
|
39
|
+
},
|
|
40
|
+
"packageManager": "pnpm@10.28.1"
|
|
41
|
+
}
|