renovate-log-parser 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/LICENSE +21 -0
- package/README.md +402 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +30 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/analyze.d.ts +24 -0
- package/dist/commands/analyze.js +114 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/detect-errors.d.ts +17 -0
- package/dist/commands/detect-errors.js +119 -0
- package/dist/commands/detect-errors.js.map +1 -0
- package/dist/commands/install-analyze-skill.d.ts +27 -0
- package/dist/commands/install-analyze-skill.js +181 -0
- package/dist/commands/install-analyze-skill.js.map +1 -0
- package/dist/commands/web.d.ts +12 -0
- package/dist/commands/web.js +103 -0
- package/dist/commands/web.js.map +1 -0
- package/dist/core/analyzer.d.ts +89 -0
- package/dist/core/analyzer.js +179 -0
- package/dist/core/analyzer.js.map +1 -0
- package/dist/core/error-detector.d.ts +56 -0
- package/dist/core/error-detector.js +236 -0
- package/dist/core/error-detector.js.map +1 -0
- package/dist/core/filters.d.ts +136 -0
- package/dist/core/filters.js +95 -0
- package/dist/core/filters.js.map +1 -0
- package/dist/core/ignore-file.d.ts +52 -0
- package/dist/core/ignore-file.js +104 -0
- package/dist/core/ignore-file.js.map +1 -0
- package/dist/core/levels.d.ts +33 -0
- package/dist/core/levels.js +35 -0
- package/dist/core/levels.js.map +1 -0
- package/dist/core/parser.d.ts +57 -0
- package/dist/core/parser.js +201 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/query-builder.d.ts +47 -0
- package/dist/core/query-builder.js +155 -0
- package/dist/core/query-builder.js.map +1 -0
- package/dist/core/skill-template.d.ts +34 -0
- package/dist/core/skill-template.js +259 -0
- package/dist/core/skill-template.js.map +1 -0
- package/package.json +68 -0
- package/web/.output/nitro.json +15 -0
- package/web/.output/public/_fonts/57NSSoFy1VLVs2gqly8Ls9awBnZMFyXGrefpmqvdqmc-zJfbBtpgM4cDmcXBsqZNW79_kFnlpPd62b48glgdydA.woff2 +0 -0
- package/web/.output/public/_fonts/8VR2wSMN-3U4NbWAVYXlkRV6hA0jFBXP-0RtL3X7fko-x2gYI4qfmkRdxyQQUPaBZdZdgl1TeVrquF_TxHeM4lM.woff2 +0 -0
- package/web/.output/public/_fonts/GsKUclqeNLJ96g5AU593ug6yanivOiwjW_7zESNPChw-jHA4tBeM1bjF7LATGUpfBuSTyomIFrWBTzjF7txVYfg.woff2 +0 -0
- package/web/.output/public/_fonts/Ld1FnTo3yTIwDyGfTQ5-Fws9AWsCbKfMvgxduXr7JcY-W25bL8NF1fjpLRSOgJb7RoZPHqGQNwMTM7S9tHVoxx8.woff2 +0 -0
- package/web/.output/public/_fonts/NdzqRASp2bovDUhQT1IRE_EMqKJ2KYQdTCfFcBvL8yw-KhwZiS86o3fErOe5GGMExHUemmI_dBfaEFxjISZrBd0.woff2 +0 -0
- package/web/.output/public/_fonts/iTkrULNFJJkTvihIg1Vqi5IODRH_9btXCioVF5l98I8-AndUyau2HR2felA_ra8V2mutQgschhasE5FD1dXGJX8.woff2 +0 -0
- package/web/.output/public/_nuxt/BWja8e3M.js +37 -0
- package/web/.output/public/_nuxt/BgApMHS1.js +1 -0
- package/web/.output/public/_nuxt/CGPWRqbc.js +1 -0
- package/web/.output/public/_nuxt/DlAUqK2U.js +1 -0
- package/web/.output/public/_nuxt/Sgtec1U0.js +1 -0
- package/web/.output/public/_nuxt/builds/latest.json +1 -0
- package/web/.output/public/_nuxt/builds/meta/c4723e49-0623-47af-ae79-9ab6428bdcc1.json +1 -0
- package/web/.output/public/_nuxt/entry.9mB-pyEY.css +1 -0
- package/web/.output/public/_nuxt/error-404.B_PvSG-P.css +1 -0
- package/web/.output/public/_nuxt/error-500.CghkKCEr.css +1 -0
- package/web/.output/public/_nuxt/index.BlvAG7F6.css +1 -0
- package/web/.output/public/favicon.ico +0 -0
- package/web/.output/server/chunks/_/error-500.mjs +19 -0
- package/web/.output/server/chunks/_/error-500.mjs.map +1 -0
- package/web/.output/server/chunks/_/icons.mjs +6153 -0
- package/web/.output/server/chunks/_/icons.mjs.map +1 -0
- package/web/.output/server/chunks/_/icons2.mjs +11494 -0
- package/web/.output/server/chunks/_/icons2.mjs.map +1 -0
- package/web/.output/server/chunks/build/_plugin-vue_export-helper-1tPrXgE0.mjs +10 -0
- package/web/.output/server/chunks/build/_plugin-vue_export-helper-1tPrXgE0.mjs.map +1 -0
- package/web/.output/server/chunks/build/client.precomputed.mjs +4 -0
- package/web/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
- package/web/.output/server/chunks/build/error-404-DyaaQUIS.mjs +106 -0
- package/web/.output/server/chunks/build/error-404-DyaaQUIS.mjs.map +1 -0
- package/web/.output/server/chunks/build/error-404-styles.9cNA4arh.mjs +8 -0
- package/web/.output/server/chunks/build/error-404-styles.9cNA4arh.mjs.map +1 -0
- package/web/.output/server/chunks/build/error-500-CVSP-p02.mjs +89 -0
- package/web/.output/server/chunks/build/error-500-CVSP-p02.mjs.map +1 -0
- package/web/.output/server/chunks/build/error-500-styles.BX54ZlkH.mjs +8 -0
- package/web/.output/server/chunks/build/error-500-styles.BX54ZlkH.mjs.map +1 -0
- package/web/.output/server/chunks/build/index-88dXYOxO.mjs +19675 -0
- package/web/.output/server/chunks/build/index-88dXYOxO.mjs.map +1 -0
- package/web/.output/server/chunks/build/index-styles.V2iua2bE.mjs +8 -0
- package/web/.output/server/chunks/build/index-styles.V2iua2bE.mjs.map +1 -0
- package/web/.output/server/chunks/build/server.mjs +7910 -0
- package/web/.output/server/chunks/build/server.mjs.map +1 -0
- package/web/.output/server/chunks/build/styles.mjs +10 -0
- package/web/.output/server/chunks/build/styles.mjs.map +1 -0
- package/web/.output/server/chunks/nitro/nitro.mjs +6944 -0
- package/web/.output/server/chunks/nitro/nitro.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/fields.get.mjs +27 -0
- package/web/.output/server/chunks/routes/api/fields.get.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/findings.get.mjs +30 -0
- package/web/.output/server/chunks/routes/api/findings.get.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/log/contents.post.mjs +29 -0
- package/web/.output/server/chunks/routes/api/log/contents.post.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/log/path.post.mjs +30 -0
- package/web/.output/server/chunks/routes/api/log/path.post.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/repositories.get.mjs +27 -0
- package/web/.output/server/chunks/routes/api/repositories.get.mjs.map +1 -0
- package/web/.output/server/chunks/routes/api/rows.get.mjs +48 -0
- package/web/.output/server/chunks/routes/api/rows.get.mjs.map +1 -0
- package/web/.output/server/chunks/routes/renderer.mjs +451 -0
- package/web/.output/server/chunks/routes/renderer.mjs.map +1 -0
- package/web/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/web/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/web/.output/server/index.mjs +16 -0
- package/web/.output/server/index.mjs.map +1 -0
- package/web/.output/server/node_modules/.nitro/hookable@5.5.3/dist/index.mjs +290 -0
- package/web/.output/server/node_modules/.nitro/hookable@5.5.3/package.json +49 -0
- package/web/.output/server/node_modules/.nitro/hookable@6.1.1/dist/index.mjs +257 -0
- package/web/.output/server/node_modules/.nitro/hookable@6.1.1/package.json +53 -0
- package/web/.output/server/node_modules/@babel/parser/lib/index.js +14599 -0
- package/web/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/web/.output/server/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1038 -0
- package/web/.output/server/node_modules/@floating-ui/core/package.json +63 -0
- package/web/.output/server/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +789 -0
- package/web/.output/server/node_modules/@floating-ui/dom/package.json +72 -0
- package/web/.output/server/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
- package/web/.output/server/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
- package/web/.output/server/node_modules/@floating-ui/utils/package.json +70 -0
- package/web/.output/server/node_modules/@floating-ui/vue/dist/floating-ui.vue.mjs +190 -0
- package/web/.output/server/node_modules/@floating-ui/vue/package.json +71 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/colors/index.js +295 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +701 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/css/common.js +75 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/css/format.js +39 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/css/icon.js +47 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/css/icons.js +128 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +19 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +13 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +17 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +16 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +30 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +78 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +100 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +28 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +58 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +48 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +203 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +33 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +132 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +165 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +79 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +92 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +26 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +76 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +66 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +45 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +103 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +36 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +92 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +62 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +25 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +16 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/name.js +57 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/square.js +33 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +12 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +125 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +19 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +25 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +36 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +91 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +46 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +23 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +42 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +123 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/index.js +52 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +30 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +26 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +27 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +105 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +26 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +26 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/title.js +9 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/build.js +113 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +31 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +13 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/html.js +9 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/id.js +41 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +22 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +67 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +54 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/size.js +27 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +7 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/url.js +22 -0
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +8 -0
- package/web/.output/server/node_modules/@iconify/utils/package.json +119 -0
- package/web/.output/server/node_modules/@iconify/vue/dist/iconify.mjs +1896 -0
- package/web/.output/server/node_modules/@iconify/vue/package.json +62 -0
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/index.js +1268 -0
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +34 -0
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/utils.js +74 -0
- package/web/.output/server/node_modules/@tanstack/virtual-core/package.json +56 -0
- package/web/.output/server/node_modules/@tanstack/vue-virtual/dist/esm/index.js +66 -0
- package/web/.output/server/node_modules/@tanstack/vue-virtual/package.json +68 -0
- package/web/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6759 -0
- package/web/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/web/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
- package/web/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/web/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
- package/web/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/web/.output/server/node_modules/@vue/devtools-api/dist/index.js +2 -0
- package/web/.output/server/node_modules/@vue/devtools-api/package.json +34 -0
- package/web/.output/server/node_modules/@vue/devtools-kit/dist/index.js +5670 -0
- package/web/.output/server/node_modules/@vue/devtools-kit/node_modules/hookable/dist/index.mjs +290 -0
- package/web/.output/server/node_modules/@vue/devtools-kit/node_modules/hookable/package.json +49 -0
- package/web/.output/server/node_modules/@vue/devtools-kit/package.json +44 -0
- package/web/.output/server/node_modules/@vue/devtools-shared/dist/index.js +239 -0
- package/web/.output/server/node_modules/@vue/devtools-shared/package.json +33 -0
- package/web/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1899 -0
- package/web/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/web/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6940 -0
- package/web/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/web/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1822 -0
- package/web/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/web/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +896 -0
- package/web/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/web/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
- package/web/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/web/.output/server/node_modules/@vueuse/core/dist/index.js +8464 -0
- package/web/.output/server/node_modules/@vueuse/core/package.json +49 -0
- package/web/.output/server/node_modules/@vueuse/shared/dist/index.js +2013 -0
- package/web/.output/server/node_modules/@vueuse/shared/package.json +42 -0
- package/web/.output/server/node_modules/aria-hidden/dist/es5/index.js +174 -0
- package/web/.output/server/node_modules/aria-hidden/package.json +71 -0
- package/web/.output/server/node_modules/birpc/dist/index.mjs +291 -0
- package/web/.output/server/node_modules/birpc/package.json +57 -0
- package/web/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/web/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/web/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/web/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/web/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/web/.output/server/node_modules/consola/package.json +136 -0
- package/web/.output/server/node_modules/devalue/index.js +4 -0
- package/web/.output/server/node_modules/devalue/package.json +40 -0
- package/web/.output/server/node_modules/devalue/src/base64.js +60 -0
- package/web/.output/server/node_modules/devalue/src/constants.js +12 -0
- package/web/.output/server/node_modules/devalue/src/parse.js +283 -0
- package/web/.output/server/node_modules/devalue/src/stringify.js +401 -0
- package/web/.output/server/node_modules/devalue/src/uneval.js +552 -0
- package/web/.output/server/node_modules/devalue/src/utils.js +160 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/web/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/web/.output/server/node_modules/entities/package.json +120 -0
- package/web/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/web/.output/server/node_modules/estree-walker/package.json +37 -0
- package/web/.output/server/node_modules/hookable/dist/index.mjs +257 -0
- package/web/.output/server/node_modules/hookable/package.json +53 -0
- package/web/.output/server/node_modules/nostics/dist/index.mjs +179 -0
- package/web/.output/server/node_modules/nostics/package.json +124 -0
- package/web/.output/server/node_modules/perfect-debounce/dist/index.mjs +89 -0
- package/web/.output/server/node_modules/perfect-debounce/package.json +41 -0
- package/web/.output/server/node_modules/rou3/dist/index.mjs +501 -0
- package/web/.output/server/node_modules/rou3/package.json +48 -0
- package/web/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/web/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/web/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/web/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/web/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/web/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/web/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/web/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/web/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/web/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/web/.output/server/node_modules/source-map-js/package.json +71 -0
- package/web/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_body-limit.mjs +39 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_plugins.mjs +56 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_trust-proxy.mjs +58 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_url.mjs +134 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_utils.mjs +15 -0
- package/web/.output/server/node_modules/srvx/dist/_chunks/_utils2.mjs +75 -0
- package/web/.output/server/node_modules/srvx/dist/adapters/node.mjs +976 -0
- package/web/.output/server/node_modules/srvx/package.json +102 -0
- package/web/.output/server/node_modules/tailwind-merge/dist/bundle-mjs.mjs +3365 -0
- package/web/.output/server/node_modules/tailwind-merge/package.json +93 -0
- package/web/.output/server/node_modules/tailwind-variants/dist/chunk-LQJYWU4O.js +112 -0
- package/web/.output/server/node_modules/tailwind-variants/dist/chunk-RZF76H2U.js +269 -0
- package/web/.output/server/node_modules/tailwind-variants/dist/index.js +38 -0
- package/web/.output/server/node_modules/tailwind-variants/package.json +122 -0
- package/web/.output/server/node_modules/tailwindcss/dist/chunk-X4GG3EDV.mjs +1 -0
- package/web/.output/server/node_modules/tailwindcss/dist/colors.mjs +1 -0
- package/web/.output/server/node_modules/tailwindcss/package.json +89 -0
- package/web/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/web/.output/server/node_modules/ufo/package.json +48 -0
- package/web/.output/server/node_modules/unhead/dist/index.mjs +9 -0
- package/web/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/web/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
- package/web/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
- package/web/.output/server/node_modules/unhead/dist/server.mjs +180 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.B3VbJo7Y.mjs +207 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +269 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.CaI5ZD4O.mjs +182 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +236 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.Dh1cQCTe.mjs +44 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.TxTMM7cM.mjs +166 -0
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
- package/web/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
- package/web/.output/server/node_modules/unhead/node_modules/hookable/dist/index.mjs +257 -0
- package/web/.output/server/node_modules/unhead/node_modules/hookable/package.json +53 -0
- package/web/.output/server/node_modules/unhead/package.json +105 -0
- package/web/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/web/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/web/.output/server/node_modules/vue/index.js +7 -0
- package/web/.output/server/node_modules/vue/index.mjs +1 -0
- package/web/.output/server/node_modules/vue/package.json +112 -0
- package/web/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/web/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +249 -0
- package/web/.output/server/node_modules/vue-bundle-renderer/package.json +57 -0
- package/web/.output/server/node_modules/vue-demi/lib/index.mjs +34 -0
- package/web/.output/server/node_modules/vue-demi/package.json +47 -0
- package/web/.output/server/node_modules/vue-router/dist/devtools-Bpr7ZAVB.js +1056 -0
- package/web/.output/server/node_modules/vue-router/dist/useApi-CROJJdhE.js +436 -0
- package/web/.output/server/node_modules/vue-router/dist/vue-router.js +1543 -0
- package/web/.output/server/node_modules/vue-router/package.json +214 -0
- package/web/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
- package/web/.output/server/package.json +51 -0
|
@@ -0,0 +1,976 @@
|
|
|
1
|
+
import { FastURL, lazyInherit } from "../_chunks/_url.mjs";
|
|
2
|
+
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils2.mjs";
|
|
3
|
+
import { errorPlugin, gracefulShutdownPlugin, wrapFetch } from "../_chunks/_plugins.mjs";
|
|
4
|
+
import { HOST_RE, firstForwardedValue, isTrustedProxy } from "../_chunks/_trust-proxy.mjs";
|
|
5
|
+
import { createBodyTooLargeError, limitBodyStream } from "../_chunks/_body-limit.mjs";
|
|
6
|
+
import nodeHTTP, { IncomingMessage, ServerResponse } from "node:http";
|
|
7
|
+
import { Duplex, PassThrough, Readable, addAbortSignal } from "node:stream";
|
|
8
|
+
import { pipeline } from "node:stream/promises";
|
|
9
|
+
import nodeHTTPS from "node:https";
|
|
10
|
+
import nodeHTTP2 from "node:http2";
|
|
11
|
+
function sendNodeResponse(nodeRes, webRes) {
|
|
12
|
+
try {
|
|
13
|
+
return _sendNodeResponse(nodeRes, webRes, false) || Promise.resolve();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return Promise.reject(error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function sendNodeResponseDetached(nodeRes, webRes) {
|
|
19
|
+
try {
|
|
20
|
+
return _sendNodeResponse(nodeRes, webRes, true);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
handleSendError(nodeRes, error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function handleSendError(nodeRes, _error) {
|
|
26
|
+
if (nodeRes.headersSent) nodeRes.destroy();
|
|
27
|
+
else {
|
|
28
|
+
nodeRes.statusCode = 500;
|
|
29
|
+
nodeRes.end();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function _sendNodeResponse(nodeRes, webRes, detached) {
|
|
33
|
+
if (!webRes) {
|
|
34
|
+
nodeRes.statusCode = 500;
|
|
35
|
+
return endNodeResponse(nodeRes, detached);
|
|
36
|
+
}
|
|
37
|
+
if (webRes._toNodeResponse) {
|
|
38
|
+
const res = webRes._toNodeResponse();
|
|
39
|
+
if (res.body) {
|
|
40
|
+
if (res.body instanceof ReadableStream) {
|
|
41
|
+
writeHead(nodeRes, res.status, res.statusText, res.headers);
|
|
42
|
+
return streamBody(res.body, nodeRes);
|
|
43
|
+
} else if (typeof res.body?.pipe === "function") return pipeBody(res.body, nodeRes, res.status, res.statusText, res.headers);
|
|
44
|
+
writeHead(nodeRes, res.status, res.statusText, res.headers);
|
|
45
|
+
nodeRes.write(res.body);
|
|
46
|
+
} else writeHead(nodeRes, res.status, res.statusText, res.headers);
|
|
47
|
+
return endNodeResponse(nodeRes, detached);
|
|
48
|
+
}
|
|
49
|
+
const rawHeaders = [];
|
|
50
|
+
for (const [key, value] of webRes.headers) rawHeaders.push(key, value);
|
|
51
|
+
writeHead(nodeRes, webRes.status, webRes.statusText, rawHeaders);
|
|
52
|
+
return webRes.body ? streamBody(webRes.body, nodeRes) : endNodeResponse(nodeRes, detached);
|
|
53
|
+
}
|
|
54
|
+
function writeHead(nodeRes, status, statusText, rawHeaders) {
|
|
55
|
+
if (!nodeRes.headersSent) if (nodeRes.req?.httpVersion === "2.0") nodeRes.writeHead(status, rawHeaders);
|
|
56
|
+
else nodeRes.writeHead(status, statusText, rawHeaders);
|
|
57
|
+
}
|
|
58
|
+
function endNodeResponse(nodeRes, detached) {
|
|
59
|
+
if (detached) {
|
|
60
|
+
nodeRes.end();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
return new Promise((resolve) => nodeRes.end(resolve));
|
|
64
|
+
}
|
|
65
|
+
function pipeBody(stream, nodeRes, status, statusText, headers) {
|
|
66
|
+
if (nodeRes.destroyed) {
|
|
67
|
+
stream.destroy?.();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (typeof stream.on !== "function" || typeof stream.destroy !== "function") {
|
|
71
|
+
writeHead(nodeRes, status, statusText, headers);
|
|
72
|
+
stream.pipe(nodeRes);
|
|
73
|
+
return new Promise((resolve) => nodeRes.on("close", resolve));
|
|
74
|
+
}
|
|
75
|
+
if (stream.destroyed) {
|
|
76
|
+
writeHead(nodeRes, 500, "Internal Server Error", []);
|
|
77
|
+
return endNodeResponse(nodeRes);
|
|
78
|
+
}
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
function onEarlyError() {
|
|
81
|
+
stream.off("readable", onReadable);
|
|
82
|
+
stream.destroy();
|
|
83
|
+
writeHead(nodeRes, 500, "Internal Server Error", []);
|
|
84
|
+
endNodeResponse(nodeRes).then(resolve);
|
|
85
|
+
}
|
|
86
|
+
function onReadable() {
|
|
87
|
+
stream.off("error", onEarlyError);
|
|
88
|
+
if (nodeRes.destroyed) {
|
|
89
|
+
stream.destroy();
|
|
90
|
+
return resolve();
|
|
91
|
+
}
|
|
92
|
+
writeHead(nodeRes, status, statusText, headers);
|
|
93
|
+
pipeline(stream, nodeRes).catch(() => {}).then(() => resolve());
|
|
94
|
+
}
|
|
95
|
+
stream.once("error", onEarlyError);
|
|
96
|
+
stream.once("readable", onReadable);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function streamBody(stream, nodeRes) {
|
|
100
|
+
if (nodeRes.destroyed) {
|
|
101
|
+
stream.cancel();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const reader = stream.getReader();
|
|
105
|
+
function streamCancel(error) {
|
|
106
|
+
reader.cancel(error).catch(() => {});
|
|
107
|
+
if (error) nodeRes.destroy(error);
|
|
108
|
+
}
|
|
109
|
+
function streamHandle({ done, value }) {
|
|
110
|
+
try {
|
|
111
|
+
if (done) nodeRes.end();
|
|
112
|
+
else if (nodeRes.write(value)) reader.read().then(streamHandle, streamCancel);
|
|
113
|
+
else nodeRes.once("drain", () => reader.read().then(streamHandle, streamCancel));
|
|
114
|
+
} catch (error) {
|
|
115
|
+
streamCancel(error instanceof Error ? error : void 0);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
nodeRes.on("close", streamCancel);
|
|
119
|
+
nodeRes.on("error", streamCancel);
|
|
120
|
+
reader.read().then(streamHandle, streamCancel);
|
|
121
|
+
return reader.closed.catch(streamCancel).finally(() => {
|
|
122
|
+
nodeRes.off("close", streamCancel);
|
|
123
|
+
nodeRes.off("error", streamCancel);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
var NodeRequestURL = class extends FastURL {
|
|
127
|
+
constructor({ req, trusted = false }) {
|
|
128
|
+
const path = req.url || "/";
|
|
129
|
+
const forwardedHost = trusted ? firstForwardedValue(req.headers["x-forwarded-host"]) : void 0;
|
|
130
|
+
let host = (forwardedHost && HOST_RE.test(forwardedHost) ? forwardedHost : void 0) || req.headers.host || req.headers[":authority"];
|
|
131
|
+
if (host && !HOST_RE.test(host)) host = "_invalid_";
|
|
132
|
+
else if (!host) if (req.socket) host = `${req.socket.localFamily === "IPv6" ? "[" + req.socket.localAddress + "]" : req.socket.localAddress}:${req.socket?.localPort || "80"}`;
|
|
133
|
+
else host = "localhost";
|
|
134
|
+
const forwardedProto = trusted ? firstForwardedValue(req.headers["x-forwarded-proto"]) : void 0;
|
|
135
|
+
const protocol = req.socket?.encrypted || forwardedProto === "https" || trusted && req.headers[":scheme"] === "https" ? "https:" : "http:";
|
|
136
|
+
if (path[0] === "/") {
|
|
137
|
+
const qIndex = path.indexOf("?");
|
|
138
|
+
super({
|
|
139
|
+
protocol,
|
|
140
|
+
host,
|
|
141
|
+
pathname: qIndex === -1 ? path : path.slice(0, qIndex) || "/",
|
|
142
|
+
search: qIndex === -1 ? "" : path.slice(qIndex) || ""
|
|
143
|
+
});
|
|
144
|
+
} else if (path === "*") super({
|
|
145
|
+
protocol,
|
|
146
|
+
host,
|
|
147
|
+
pathname: "/*",
|
|
148
|
+
search: ""
|
|
149
|
+
});
|
|
150
|
+
else super(path);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const _nonJoinedHeaders = /* @__PURE__ */ new Set([
|
|
154
|
+
"age",
|
|
155
|
+
"authorization",
|
|
156
|
+
"content-length",
|
|
157
|
+
"content-type",
|
|
158
|
+
"etag",
|
|
159
|
+
"expires",
|
|
160
|
+
"from",
|
|
161
|
+
"host",
|
|
162
|
+
"if-modified-since",
|
|
163
|
+
"if-unmodified-since",
|
|
164
|
+
"last-modified",
|
|
165
|
+
"location",
|
|
166
|
+
"max-forwards",
|
|
167
|
+
"proxy-authorization",
|
|
168
|
+
"referer",
|
|
169
|
+
"retry-after",
|
|
170
|
+
"server",
|
|
171
|
+
"user-agent"
|
|
172
|
+
]);
|
|
173
|
+
const _validHeaderNameRE = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
|
|
174
|
+
function _isRepeated(rawHeaders, lowerName) {
|
|
175
|
+
let seen = false;
|
|
176
|
+
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
177
|
+
const key = rawHeaders[i];
|
|
178
|
+
if (key.length === lowerName.length && key.toLowerCase() === lowerName) {
|
|
179
|
+
if (seen) return true;
|
|
180
|
+
seen = true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
const NodeRequestHeaders = /* @__PURE__ */ (() => {
|
|
186
|
+
const NativeHeaders = globalThis.Headers;
|
|
187
|
+
class Headers {
|
|
188
|
+
#req;
|
|
189
|
+
#headers;
|
|
190
|
+
constructor(req) {
|
|
191
|
+
this.#req = req;
|
|
192
|
+
}
|
|
193
|
+
static [Symbol.hasInstance](val) {
|
|
194
|
+
return val instanceof NativeHeaders;
|
|
195
|
+
}
|
|
196
|
+
get _headers() {
|
|
197
|
+
if (!this.#headers) {
|
|
198
|
+
const headers = new NativeHeaders();
|
|
199
|
+
const rawHeaders = this.#req.rawHeaders;
|
|
200
|
+
const len = rawHeaders.length;
|
|
201
|
+
for (let i = 0; i < len; i += 2) {
|
|
202
|
+
const key = rawHeaders[i];
|
|
203
|
+
if (key.charCodeAt(0) === 58) continue;
|
|
204
|
+
const value = rawHeaders[i + 1];
|
|
205
|
+
headers.append(key, value);
|
|
206
|
+
}
|
|
207
|
+
this.#headers = headers;
|
|
208
|
+
}
|
|
209
|
+
return this.#headers;
|
|
210
|
+
}
|
|
211
|
+
get(name) {
|
|
212
|
+
if (this.#headers) return this.#headers.get(name);
|
|
213
|
+
const lower = name.toLowerCase();
|
|
214
|
+
if (lower.charCodeAt(0) === 58) return this._headers.get(name);
|
|
215
|
+
const value = this.#req.headers[lower];
|
|
216
|
+
if (typeof value === "string") return _nonJoinedHeaders.has(lower) && _isRepeated(this.#req.rawHeaders, lower) ? this._headers.get(name) : value;
|
|
217
|
+
if (Array.isArray(value)) return value.join(", ");
|
|
218
|
+
return lower !== "__proto__" && _validHeaderNameRE.test(name) ? null : this._headers.get(name);
|
|
219
|
+
}
|
|
220
|
+
has(name) {
|
|
221
|
+
if (this.#headers) return this.#headers.has(name);
|
|
222
|
+
const lower = name.toLowerCase();
|
|
223
|
+
if (lower.charCodeAt(0) === 58) return this._headers.has(name);
|
|
224
|
+
if (Object.hasOwn(this.#req.headers, lower)) return true;
|
|
225
|
+
return lower !== "__proto__" && _validHeaderNameRE.test(name) ? false : this._headers.has(name);
|
|
226
|
+
}
|
|
227
|
+
getSetCookie() {
|
|
228
|
+
if (this.#headers) return this.#headers.getSetCookie();
|
|
229
|
+
const value = this.#req.headers["set-cookie"];
|
|
230
|
+
return Array.isArray(value) ? value.slice() : value ? [value] : [];
|
|
231
|
+
}
|
|
232
|
+
entries() {
|
|
233
|
+
return this._headers.entries();
|
|
234
|
+
}
|
|
235
|
+
[Symbol.iterator]() {
|
|
236
|
+
return this.entries();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
lazyInherit(Headers.prototype, NativeHeaders.prototype, "_headers");
|
|
240
|
+
Object.setPrototypeOf(Headers, NativeHeaders);
|
|
241
|
+
Object.setPrototypeOf(Headers.prototype, NativeHeaders.prototype);
|
|
242
|
+
return Headers;
|
|
243
|
+
})();
|
|
244
|
+
const kNativeRequest = /* @__PURE__ */ Symbol.for("srvx.nativeRequest");
|
|
245
|
+
const NodeRequest = /* @__PURE__ */ (() => {
|
|
246
|
+
const NativeRequest = getNativeRequest();
|
|
247
|
+
class Request {
|
|
248
|
+
runtime;
|
|
249
|
+
waitUntil;
|
|
250
|
+
#req;
|
|
251
|
+
#url;
|
|
252
|
+
#bodyStream;
|
|
253
|
+
#request;
|
|
254
|
+
#headers;
|
|
255
|
+
#abortController;
|
|
256
|
+
#maxRequestBodySize;
|
|
257
|
+
#trustProxy;
|
|
258
|
+
#ip;
|
|
259
|
+
#ipResolved = false;
|
|
260
|
+
#remoteAddress;
|
|
261
|
+
#trusted;
|
|
262
|
+
constructor(ctx) {
|
|
263
|
+
this.#req = ctx.req;
|
|
264
|
+
this.#maxRequestBodySize = ctx.maxRequestBodySize;
|
|
265
|
+
this.#trustProxy = ctx.trustProxy;
|
|
266
|
+
this.runtime = {
|
|
267
|
+
name: "node",
|
|
268
|
+
node: ctx
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
static [Symbol.hasInstance](val) {
|
|
272
|
+
return val instanceof NativeRequest;
|
|
273
|
+
}
|
|
274
|
+
#resolveTrusted() {
|
|
275
|
+
if (this.#trusted === void 0) {
|
|
276
|
+
this.#remoteAddress = this.#req.socket?.remoteAddress;
|
|
277
|
+
this.#trusted = isTrustedProxy(this.#trustProxy, this.#remoteAddress);
|
|
278
|
+
}
|
|
279
|
+
return this.#trusted;
|
|
280
|
+
}
|
|
281
|
+
get ip() {
|
|
282
|
+
if (this.#ipResolved) return this.#ip;
|
|
283
|
+
this.#ipResolved = true;
|
|
284
|
+
if (this.#resolveTrusted()) {
|
|
285
|
+
const forwarded = firstForwardedValue(this.#req.headers["x-forwarded-for"]);
|
|
286
|
+
if (forwarded) return this.#ip = forwarded;
|
|
287
|
+
}
|
|
288
|
+
return this.#ip = this.#remoteAddress;
|
|
289
|
+
}
|
|
290
|
+
get method() {
|
|
291
|
+
if (this.#request) return this.#request.method;
|
|
292
|
+
return this.#req.method || "GET";
|
|
293
|
+
}
|
|
294
|
+
get _url() {
|
|
295
|
+
return this.#url ||= new NodeRequestURL({
|
|
296
|
+
req: this.#req,
|
|
297
|
+
trusted: this.#resolveTrusted()
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
set _url(url) {
|
|
301
|
+
this.#url = url;
|
|
302
|
+
}
|
|
303
|
+
get url() {
|
|
304
|
+
if (this.#request) return this.#request.url;
|
|
305
|
+
return this._url.href;
|
|
306
|
+
}
|
|
307
|
+
get headers() {
|
|
308
|
+
if (this.#request) return this.#request.headers;
|
|
309
|
+
return this.#headers ||= new NodeRequestHeaders(this.#req);
|
|
310
|
+
}
|
|
311
|
+
get _abortController() {
|
|
312
|
+
if (!this.#abortController) {
|
|
313
|
+
this.#abortController = new AbortController();
|
|
314
|
+
const { req, res } = this.runtime.node;
|
|
315
|
+
const abortController = this.#abortController;
|
|
316
|
+
const abort = (err) => abortController.abort?.(err);
|
|
317
|
+
if (res) res.once("close", () => {
|
|
318
|
+
const reqError = req.errored;
|
|
319
|
+
if (reqError) abort(reqError);
|
|
320
|
+
else if (!res.writableEnded) abort();
|
|
321
|
+
});
|
|
322
|
+
else req.once("close", () => {
|
|
323
|
+
if (!req.complete) abort();
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
return this.#abortController;
|
|
327
|
+
}
|
|
328
|
+
get signal() {
|
|
329
|
+
return this.#request ? this.#request.signal : this._abortController.signal;
|
|
330
|
+
}
|
|
331
|
+
get body() {
|
|
332
|
+
if (this.#request) return this.#request.body;
|
|
333
|
+
if (this.#bodyStream === void 0) {
|
|
334
|
+
const method = this.method;
|
|
335
|
+
let stream = !(method === "GET" || method === "HEAD") ? Readable.toWeb(this.#req) : null;
|
|
336
|
+
if (stream && this.#maxRequestBodySize !== void 0) stream = limitBodyStream(stream, this.#maxRequestBodySize);
|
|
337
|
+
this.#bodyStream = stream;
|
|
338
|
+
}
|
|
339
|
+
return this.#bodyStream;
|
|
340
|
+
}
|
|
341
|
+
#readBuffered() {
|
|
342
|
+
return readBody(this.#req, this.#maxRequestBodySize);
|
|
343
|
+
}
|
|
344
|
+
text() {
|
|
345
|
+
if (this.#request) return this.#request.text();
|
|
346
|
+
if (this.#bodyStream !== void 0) return this.#bodyStream ? new Response(this.#bodyStream).text() : Promise.resolve("");
|
|
347
|
+
return this.#readBuffered().then((buf) => buf.toString());
|
|
348
|
+
}
|
|
349
|
+
json() {
|
|
350
|
+
if (this.#request) return this.#request.json();
|
|
351
|
+
if (this.#bodyStream !== void 0) return this.text().then((text) => JSON.parse(text));
|
|
352
|
+
return this.#readBuffered().then((buf) => JSON.parse(buf.toString()));
|
|
353
|
+
}
|
|
354
|
+
get _request() {
|
|
355
|
+
if (!this.#request) {
|
|
356
|
+
const body = this.body;
|
|
357
|
+
this.#request = new NativeRequest(this.url, {
|
|
358
|
+
method: this.method,
|
|
359
|
+
headers: this.headers,
|
|
360
|
+
signal: this._abortController.signal,
|
|
361
|
+
body,
|
|
362
|
+
duplex: body ? "half" : void 0
|
|
363
|
+
});
|
|
364
|
+
this.#headers = void 0;
|
|
365
|
+
this.#bodyStream = void 0;
|
|
366
|
+
}
|
|
367
|
+
return this.#request;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
lazyInherit(Request.prototype, NativeRequest.prototype, "_request");
|
|
371
|
+
Object.setPrototypeOf(Request.prototype, NativeRequest.prototype);
|
|
372
|
+
return Request;
|
|
373
|
+
})();
|
|
374
|
+
function patchGlobalRequest() {
|
|
375
|
+
const NativeRequest = getNativeRequest();
|
|
376
|
+
const PatchedRequest = class Request extends NativeRequest {
|
|
377
|
+
static _srvx = true;
|
|
378
|
+
static [Symbol.hasInstance](instance) {
|
|
379
|
+
if (this === PatchedRequest) return instance instanceof NativeRequest;
|
|
380
|
+
else return Object.prototype.isPrototypeOf.call(this.prototype, instance);
|
|
381
|
+
}
|
|
382
|
+
constructor(input, options) {
|
|
383
|
+
if (typeof input === "object" && "_request" in input) input = input._request;
|
|
384
|
+
super(input, options);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
if (!globalThis.Request._srvx) globalThis.Request = PatchedRequest;
|
|
388
|
+
return PatchedRequest;
|
|
389
|
+
}
|
|
390
|
+
function readBody(req, maxRequestBodySize) {
|
|
391
|
+
if ("rawBody" in req && Buffer.isBuffer(req.rawBody)) {
|
|
392
|
+
if (maxRequestBodySize !== void 0 && req.rawBody.length > maxRequestBodySize) return Promise.reject(createBodyTooLargeError(maxRequestBodySize));
|
|
393
|
+
return Promise.resolve(req.rawBody);
|
|
394
|
+
}
|
|
395
|
+
return new Promise((resolve, reject) => {
|
|
396
|
+
const chunks = [];
|
|
397
|
+
let size = 0;
|
|
398
|
+
const cleanup = () => {
|
|
399
|
+
req.off("data", onData);
|
|
400
|
+
req.off("end", onEnd);
|
|
401
|
+
req.off("error", onError);
|
|
402
|
+
};
|
|
403
|
+
const onData = (chunk) => {
|
|
404
|
+
if (maxRequestBodySize !== void 0) {
|
|
405
|
+
size += chunk.length;
|
|
406
|
+
if (size > maxRequestBodySize) {
|
|
407
|
+
cleanup();
|
|
408
|
+
req.pause?.();
|
|
409
|
+
reject(createBodyTooLargeError(maxRequestBodySize));
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
chunks.push(chunk);
|
|
414
|
+
};
|
|
415
|
+
const onError = (err) => {
|
|
416
|
+
cleanup();
|
|
417
|
+
reject(err);
|
|
418
|
+
};
|
|
419
|
+
const onEnd = () => {
|
|
420
|
+
cleanup();
|
|
421
|
+
resolve(chunks.length === 1 ? chunks[0] : Buffer.concat(chunks));
|
|
422
|
+
};
|
|
423
|
+
req.on("data", onData).once("end", onEnd).once("error", onError);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function getNativeRequest() {
|
|
427
|
+
let R = globalThis[kNativeRequest] || globalThis.Request;
|
|
428
|
+
while (R?._srvx) R = Object.getPrototypeOf(R);
|
|
429
|
+
return globalThis[kNativeRequest] ??= R;
|
|
430
|
+
}
|
|
431
|
+
const NodeResponse = /* @__PURE__ */ (() => {
|
|
432
|
+
const NativeResponse = globalThis.Response;
|
|
433
|
+
const STATUS_CODES = globalThis.process?.getBuiltinModule?.("node:http")?.STATUS_CODES || {};
|
|
434
|
+
class NodeResponse {
|
|
435
|
+
#body;
|
|
436
|
+
#init;
|
|
437
|
+
#headers;
|
|
438
|
+
#response;
|
|
439
|
+
constructor(body, init) {
|
|
440
|
+
this.#body = body;
|
|
441
|
+
this.#init = init;
|
|
442
|
+
}
|
|
443
|
+
static [Symbol.hasInstance](val) {
|
|
444
|
+
return val instanceof NativeResponse;
|
|
445
|
+
}
|
|
446
|
+
get status() {
|
|
447
|
+
return this.#response?.status || this.#init?.status || 200;
|
|
448
|
+
}
|
|
449
|
+
get statusText() {
|
|
450
|
+
return this.#response?.statusText || this.#init?.statusText || STATUS_CODES[this.status] || "";
|
|
451
|
+
}
|
|
452
|
+
get headers() {
|
|
453
|
+
if (this.#response) return this.#response.headers;
|
|
454
|
+
if (this.#headers) return this.#headers;
|
|
455
|
+
const initHeaders = this.#init?.headers;
|
|
456
|
+
return this.#headers = initHeaders instanceof Headers ? initHeaders : new Headers(initHeaders);
|
|
457
|
+
}
|
|
458
|
+
get ok() {
|
|
459
|
+
if (this.#response) return this.#response.ok;
|
|
460
|
+
const status = this.status;
|
|
461
|
+
return status >= 200 && status < 300;
|
|
462
|
+
}
|
|
463
|
+
get _response() {
|
|
464
|
+
if (this.#response) return this.#response;
|
|
465
|
+
let body = this.#body;
|
|
466
|
+
if (body && typeof body.pipe === "function" && !(body instanceof Readable)) {
|
|
467
|
+
const stream = new PassThrough();
|
|
468
|
+
body.pipe(stream);
|
|
469
|
+
const abort = body.abort;
|
|
470
|
+
if (abort) stream.once("close", () => abort());
|
|
471
|
+
body = stream;
|
|
472
|
+
}
|
|
473
|
+
this.#response = new NativeResponse(body, this.#headers ? {
|
|
474
|
+
...this.#init,
|
|
475
|
+
headers: this.#headers
|
|
476
|
+
} : this.#init);
|
|
477
|
+
this.#init = void 0;
|
|
478
|
+
this.#headers = void 0;
|
|
479
|
+
this.#body = void 0;
|
|
480
|
+
return this.#response;
|
|
481
|
+
}
|
|
482
|
+
_toNodeResponse() {
|
|
483
|
+
const status = this.status;
|
|
484
|
+
const statusText = this.statusText;
|
|
485
|
+
let body;
|
|
486
|
+
let contentType;
|
|
487
|
+
let contentLength;
|
|
488
|
+
if (this.#response) body = this.#response.body;
|
|
489
|
+
else if (this.#body) if (this.#body instanceof ReadableStream) body = this.#body;
|
|
490
|
+
else if (typeof this.#body === "string") {
|
|
491
|
+
body = this.#body;
|
|
492
|
+
contentType = "text/plain; charset=UTF-8";
|
|
493
|
+
contentLength = Buffer.byteLength(this.#body);
|
|
494
|
+
} else if (this.#body instanceof ArrayBuffer) {
|
|
495
|
+
body = Buffer.from(this.#body);
|
|
496
|
+
contentLength = this.#body.byteLength;
|
|
497
|
+
} else if (this.#body instanceof Uint8Array) {
|
|
498
|
+
body = this.#body;
|
|
499
|
+
contentLength = this.#body.byteLength;
|
|
500
|
+
} else if (this.#body instanceof DataView) {
|
|
501
|
+
body = Buffer.from(this.#body.buffer);
|
|
502
|
+
contentLength = this.#body.byteLength;
|
|
503
|
+
} else if (this.#body instanceof Blob) {
|
|
504
|
+
body = this.#body.stream();
|
|
505
|
+
contentType = this.#body.type;
|
|
506
|
+
contentLength = this.#body.size;
|
|
507
|
+
} else if (typeof this.#body.pipe === "function") body = this.#body;
|
|
508
|
+
else body = this._response.body;
|
|
509
|
+
const headers = [];
|
|
510
|
+
const initHeaders = this.#init?.headers;
|
|
511
|
+
const headerEntries = this.#response?.headers || this.#headers || (initHeaders ? Array.isArray(initHeaders) ? initHeaders : initHeaders?.entries ? initHeaders.entries() : Object.entries(initHeaders) : void 0);
|
|
512
|
+
let hasContentTypeHeader;
|
|
513
|
+
let hasContentLength;
|
|
514
|
+
if (headerEntries) for (const [key, value] of headerEntries) {
|
|
515
|
+
const lowerKey = typeof key === "string" ? key.toLowerCase() : String(key);
|
|
516
|
+
if (Array.isArray(value)) for (const v of value) headers.push(lowerKey, v);
|
|
517
|
+
else headers.push(lowerKey, value);
|
|
518
|
+
if (lowerKey === "content-type") hasContentTypeHeader = true;
|
|
519
|
+
else if (lowerKey === "content-length") hasContentLength = true;
|
|
520
|
+
}
|
|
521
|
+
if (contentType && !hasContentTypeHeader) headers.push("content-type", contentType);
|
|
522
|
+
if (contentLength && !hasContentLength) headers.push("content-length", String(contentLength));
|
|
523
|
+
this.#init = void 0;
|
|
524
|
+
this.#headers = void 0;
|
|
525
|
+
this.#response = void 0;
|
|
526
|
+
this.#body = void 0;
|
|
527
|
+
return {
|
|
528
|
+
status,
|
|
529
|
+
statusText,
|
|
530
|
+
headers,
|
|
531
|
+
body
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
lazyInherit(NodeResponse.prototype, NativeResponse.prototype, "_response");
|
|
536
|
+
Object.setPrototypeOf(NodeResponse, NativeResponse);
|
|
537
|
+
Object.setPrototypeOf(NodeResponse.prototype, NativeResponse.prototype);
|
|
538
|
+
return NodeResponse;
|
|
539
|
+
})();
|
|
540
|
+
function prematureCloseError() {
|
|
541
|
+
return Object.assign(/* @__PURE__ */ new Error("Connection closed before response was finished"), { code: "ERR_STREAM_PREMATURE_CLOSE" });
|
|
542
|
+
}
|
|
543
|
+
var WebRequestSocket = class extends Duplex {
|
|
544
|
+
_httpMessage;
|
|
545
|
+
autoSelectFamilyAttemptedAddresses = [];
|
|
546
|
+
bufferSize = 0;
|
|
547
|
+
bytesRead = 0;
|
|
548
|
+
bytesWritten = 0;
|
|
549
|
+
connecting = false;
|
|
550
|
+
pending = false;
|
|
551
|
+
readyState = "open";
|
|
552
|
+
remoteAddress = "";
|
|
553
|
+
remoteFamily = "";
|
|
554
|
+
remotePort = 0;
|
|
555
|
+
#request;
|
|
556
|
+
#timeoutTimer;
|
|
557
|
+
#reqReader;
|
|
558
|
+
#headersWritten;
|
|
559
|
+
#_writeBody;
|
|
560
|
+
#resBodyController;
|
|
561
|
+
#resBodyClosed;
|
|
562
|
+
_webResBody;
|
|
563
|
+
#tos = 0;
|
|
564
|
+
constructor(request) {
|
|
565
|
+
super({ allowHalfOpen: true });
|
|
566
|
+
this.#request = request;
|
|
567
|
+
this._webResBody = new ReadableStream({ start: (controller) => {
|
|
568
|
+
this.#resBodyController = controller;
|
|
569
|
+
this.#_writeBody = controller.enqueue.bind(controller);
|
|
570
|
+
this.once("finish", () => {
|
|
571
|
+
this.readyState = "closed";
|
|
572
|
+
this.#resBodyClosed = true;
|
|
573
|
+
controller.close();
|
|
574
|
+
});
|
|
575
|
+
} });
|
|
576
|
+
addAbortSignal(request.signal, this);
|
|
577
|
+
}
|
|
578
|
+
setTimeout(ms, cb) {
|
|
579
|
+
if (typeof ms !== "number" || !Number.isFinite(ms) || ms < 0) return this;
|
|
580
|
+
if (cb) this.on("timeout", cb);
|
|
581
|
+
if (this.#timeoutTimer) clearTimeout(this.#timeoutTimer);
|
|
582
|
+
if (ms > 0) this.#timeoutTimer = setTimeout(() => this.emit("timeout"), ms);
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
setNoDelay() {
|
|
586
|
+
return this;
|
|
587
|
+
}
|
|
588
|
+
setKeepAlive() {
|
|
589
|
+
return this;
|
|
590
|
+
}
|
|
591
|
+
ref() {
|
|
592
|
+
return this;
|
|
593
|
+
}
|
|
594
|
+
unref() {
|
|
595
|
+
return this;
|
|
596
|
+
}
|
|
597
|
+
destroySoon() {
|
|
598
|
+
this.destroy();
|
|
599
|
+
}
|
|
600
|
+
connect() {
|
|
601
|
+
return this;
|
|
602
|
+
}
|
|
603
|
+
resetAndDestroy() {
|
|
604
|
+
this.destroy();
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
address() {
|
|
608
|
+
return {
|
|
609
|
+
address: "",
|
|
610
|
+
family: "",
|
|
611
|
+
port: 0
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
bodyReader() {
|
|
615
|
+
try {
|
|
616
|
+
return this.#request.body?.getReader();
|
|
617
|
+
} catch (error) {
|
|
618
|
+
this.emit("error", error);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
getTypeOfService() {
|
|
622
|
+
return this.#tos;
|
|
623
|
+
}
|
|
624
|
+
setTypeOfService(tos) {
|
|
625
|
+
this.#tos = tos;
|
|
626
|
+
return this;
|
|
627
|
+
}
|
|
628
|
+
_read(_size) {
|
|
629
|
+
const reader = this.#reqReader ??= this.bodyReader();
|
|
630
|
+
if (!reader) {
|
|
631
|
+
this.push(null);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
reader.read().then((res) => this._onRead(res)).catch((error) => {
|
|
635
|
+
this.emit("error", error);
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
_onRead(res) {
|
|
639
|
+
if (res.done) {
|
|
640
|
+
this.push(null);
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (res.value) {
|
|
644
|
+
this.bytesRead += res.value.byteLength;
|
|
645
|
+
this.push(res.value);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
_write(chunk, encoding, callback) {
|
|
649
|
+
if (this.#headersWritten) this.#_writeBody(typeof chunk === "string" ? Buffer.from(chunk, encoding) : chunk);
|
|
650
|
+
else if (chunk?.length > 0) {
|
|
651
|
+
this.#headersWritten = true;
|
|
652
|
+
const headerEnd = chunk.lastIndexOf("\r\n\r\n");
|
|
653
|
+
if (headerEnd === -1) throw new Error("Invalid HTTP headers chunk!");
|
|
654
|
+
if (headerEnd < chunk.length - 4) {
|
|
655
|
+
this._write(chunk.slice(headerEnd + 4), encoding, () => {
|
|
656
|
+
callback(null);
|
|
657
|
+
});
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
callback(null);
|
|
662
|
+
}
|
|
663
|
+
_final(callback) {
|
|
664
|
+
callback(null);
|
|
665
|
+
}
|
|
666
|
+
_destroy(err, cb) {
|
|
667
|
+
if (this.#timeoutTimer) clearTimeout(this.#timeoutTimer);
|
|
668
|
+
if (this.#reqReader) this.#reqReader.cancel().catch((error) => {
|
|
669
|
+
console.error(error);
|
|
670
|
+
});
|
|
671
|
+
if (!this.#resBodyClosed) {
|
|
672
|
+
this.#resBodyClosed = true;
|
|
673
|
+
try {
|
|
674
|
+
this.#resBodyController?.error(err ?? prematureCloseError());
|
|
675
|
+
} catch {}
|
|
676
|
+
}
|
|
677
|
+
this.readyState = "closed";
|
|
678
|
+
cb(err ?? void 0);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
var WebIncomingMessage = class extends IncomingMessage {
|
|
682
|
+
constructor(req, socket) {
|
|
683
|
+
super(socket);
|
|
684
|
+
this.method = req.method;
|
|
685
|
+
const url = req._url ??= new FastURL(req.url);
|
|
686
|
+
this.url = url.pathname + url.search;
|
|
687
|
+
for (const [key, value] of req.headers.entries()) this.headers[key.toLowerCase()] = value;
|
|
688
|
+
if (req.method !== "GET" && req.method !== "HEAD" && !this.headers["content-length"] && !this.headers["transfer-encoding"]) this.headers["transfer-encoding"] = "chunked";
|
|
689
|
+
const onData = (chunk) => {
|
|
690
|
+
this.push(chunk);
|
|
691
|
+
};
|
|
692
|
+
socket.on("data", onData);
|
|
693
|
+
socket.once("end", () => {
|
|
694
|
+
this.emit("end");
|
|
695
|
+
this.off("data", onData);
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
function callNodeHandler(handler, req) {
|
|
700
|
+
const isMiddleware = handler.length > 2;
|
|
701
|
+
const nodeCtx = req.runtime?.node;
|
|
702
|
+
if (!nodeCtx || !nodeCtx.req || !nodeCtx.res) throw new Error("Node.js runtime context is not available.");
|
|
703
|
+
const { req: nodeReq, res: nodeRes } = nodeCtx;
|
|
704
|
+
let _headers;
|
|
705
|
+
const webRes = new NodeResponse(void 0, {
|
|
706
|
+
get status() {
|
|
707
|
+
return nodeRes.statusCode;
|
|
708
|
+
},
|
|
709
|
+
get statusText() {
|
|
710
|
+
return nodeRes.statusMessage;
|
|
711
|
+
},
|
|
712
|
+
get headers() {
|
|
713
|
+
if (!_headers) {
|
|
714
|
+
const headerEntries = [];
|
|
715
|
+
const rawHeaders = nodeRes.getHeaders();
|
|
716
|
+
for (const [name, value] of Object.entries(rawHeaders)) if (Array.isArray(value)) for (const v of value) headerEntries.push([name, v]);
|
|
717
|
+
else if (value) headerEntries.push([name, String(value)]);
|
|
718
|
+
_headers = new Headers(headerEntries);
|
|
719
|
+
}
|
|
720
|
+
return _headers;
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
return new Promise((resolve, reject) => {
|
|
724
|
+
nodeRes.once("close", () => resolve(webRes));
|
|
725
|
+
nodeRes.once("finish", () => resolve(webRes));
|
|
726
|
+
nodeRes.once("error", (error) => reject(error));
|
|
727
|
+
let streamPromise;
|
|
728
|
+
nodeRes.once("pipe", (stream) => {
|
|
729
|
+
streamPromise = new Promise((resolve) => {
|
|
730
|
+
stream.once("end", () => resolve(webRes));
|
|
731
|
+
stream.once("error", (error) => reject(error));
|
|
732
|
+
});
|
|
733
|
+
});
|
|
734
|
+
try {
|
|
735
|
+
if (isMiddleware) Promise.resolve(handler(nodeReq, nodeRes, (error) => error ? reject(error) : streamPromise || resolve(webRes))).catch((error) => reject(error));
|
|
736
|
+
else Promise.resolve(handler(nodeReq, nodeRes)).then(() => streamPromise || webRes);
|
|
737
|
+
} catch (error) {
|
|
738
|
+
reject(error);
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
let needDrainSymbol;
|
|
743
|
+
function getNeedDrainSymbol(res) {
|
|
744
|
+
if (needDrainSymbol === void 0) needDrainSymbol = Object.getOwnPropertySymbols(res).find((s) => s.description === "kNeedDrain") ?? null;
|
|
745
|
+
return needDrainSymbol;
|
|
746
|
+
}
|
|
747
|
+
var WebServerResponse = class extends ServerResponse {
|
|
748
|
+
#socket;
|
|
749
|
+
#socketError;
|
|
750
|
+
constructor(req, socket) {
|
|
751
|
+
super(req);
|
|
752
|
+
this.assignSocket(socket);
|
|
753
|
+
this.once("finish", () => {
|
|
754
|
+
socket.end();
|
|
755
|
+
});
|
|
756
|
+
this.#socket = socket;
|
|
757
|
+
socket.once("error", (err) => {
|
|
758
|
+
this.#socketError ??= err;
|
|
759
|
+
});
|
|
760
|
+
socket.on("drain", () => {
|
|
761
|
+
const kNeedDrain = getNeedDrainSymbol(this);
|
|
762
|
+
if (kNeedDrain && !this[kNeedDrain]) return;
|
|
763
|
+
if (this.destroyed || this.writableFinished) return;
|
|
764
|
+
if (kNeedDrain) this[kNeedDrain] = false;
|
|
765
|
+
this.emit("drain");
|
|
766
|
+
});
|
|
767
|
+
this.waitToFinish = this.waitToFinish.bind(this);
|
|
768
|
+
this.toWebResponse = this.toWebResponse.bind(this);
|
|
769
|
+
}
|
|
770
|
+
waitToFinish() {
|
|
771
|
+
if (this.writableFinished) return Promise.resolve();
|
|
772
|
+
if (this.#socketError || this.#socket.destroyed) return Promise.reject(this.#socketError ?? prematureCloseError());
|
|
773
|
+
if (this.writableEnded) return Promise.resolve();
|
|
774
|
+
return new Promise((resolve, reject) => {
|
|
775
|
+
const socket = this.#socket;
|
|
776
|
+
const settle = (err) => {
|
|
777
|
+
this.removeListener("finish", onFinish);
|
|
778
|
+
this.removeListener("error", onError);
|
|
779
|
+
socket.removeListener("error", onError);
|
|
780
|
+
socket.removeListener("close", onClose);
|
|
781
|
+
if (err) reject(err);
|
|
782
|
+
else resolve();
|
|
783
|
+
};
|
|
784
|
+
const onFinish = () => settle();
|
|
785
|
+
const onError = (err) => settle(err);
|
|
786
|
+
const onClose = () => {
|
|
787
|
+
if (!this.writableFinished) settle(this.#socketError ?? prematureCloseError());
|
|
788
|
+
};
|
|
789
|
+
this.on("finish", onFinish);
|
|
790
|
+
this.on("error", onError);
|
|
791
|
+
socket.on("error", onError);
|
|
792
|
+
socket.on("close", onClose);
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
async toWebResponse() {
|
|
796
|
+
await this.waitToFinish();
|
|
797
|
+
const headers = [];
|
|
798
|
+
const httpHeader = this._header?.split("\r\n");
|
|
799
|
+
for (let i = 1; httpHeader && i < httpHeader.length; i++) {
|
|
800
|
+
const sepIndex = httpHeader[i].indexOf(": ");
|
|
801
|
+
if (sepIndex === -1) continue;
|
|
802
|
+
const key = httpHeader[i].slice(0, Math.max(0, sepIndex));
|
|
803
|
+
const value = httpHeader[i].slice(Math.max(0, sepIndex + 2));
|
|
804
|
+
if (!key) continue;
|
|
805
|
+
headers.push([key, value]);
|
|
806
|
+
}
|
|
807
|
+
return new Response(this.#socket._webResBody, {
|
|
808
|
+
status: this.statusCode,
|
|
809
|
+
statusText: this.statusMessage,
|
|
810
|
+
headers
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
async function fetchNodeHandler(handler, req) {
|
|
815
|
+
const nodeRuntime = req.runtime?.node;
|
|
816
|
+
if (nodeRuntime && nodeRuntime.req && nodeRuntime.res) return await callNodeHandler(handler, req);
|
|
817
|
+
const socket = new WebRequestSocket(req);
|
|
818
|
+
const nodeReq = new WebIncomingMessage(req, socket);
|
|
819
|
+
const nodeRes = new WebServerResponse(nodeReq, socket);
|
|
820
|
+
try {
|
|
821
|
+
await handler(nodeReq, nodeRes);
|
|
822
|
+
return await nodeRes.toWebResponse();
|
|
823
|
+
} catch (error) {
|
|
824
|
+
if (!(req.signal?.aborted || error?.name === "AbortError" || error?.code === "ERR_STREAM_PREMATURE_CLOSE")) console.error(error, { cause: {
|
|
825
|
+
req,
|
|
826
|
+
handler
|
|
827
|
+
} });
|
|
828
|
+
return new Response(null, {
|
|
829
|
+
status: 500,
|
|
830
|
+
statusText: "Internal Server Error"
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
function toNodeHandler(handler, options) {
|
|
835
|
+
if (handler.__nodeHandler) return handler.__nodeHandler;
|
|
836
|
+
function convertedNodeHandler(nodeReq, nodeRes) {
|
|
837
|
+
const res = handler(new NodeRequest({
|
|
838
|
+
req: nodeReq,
|
|
839
|
+
res: nodeRes,
|
|
840
|
+
maxRequestBodySize: options?.maxRequestBodySize,
|
|
841
|
+
trustProxy: options?.trustProxy
|
|
842
|
+
}));
|
|
843
|
+
return res instanceof Promise ? res.then((resolvedRes) => sendNodeResponse(nodeRes, resolvedRes)) : sendNodeResponse(nodeRes, res);
|
|
844
|
+
}
|
|
845
|
+
convertedNodeHandler.__fetchHandler = handler;
|
|
846
|
+
assignFnName(convertedNodeHandler, handler, " (converted to Node handler)");
|
|
847
|
+
return convertedNodeHandler;
|
|
848
|
+
}
|
|
849
|
+
function toFetchHandler(handler) {
|
|
850
|
+
if (handler.__fetchHandler) return handler.__fetchHandler;
|
|
851
|
+
function convertedNodeHandler(req) {
|
|
852
|
+
return fetchNodeHandler(handler, req);
|
|
853
|
+
}
|
|
854
|
+
convertedNodeHandler.__nodeHandler = handler;
|
|
855
|
+
assignFnName(convertedNodeHandler, handler, " (converted to Web handler)");
|
|
856
|
+
return convertedNodeHandler;
|
|
857
|
+
}
|
|
858
|
+
function assignFnName(target, source, suffix) {
|
|
859
|
+
if (source.name) try {
|
|
860
|
+
Object.defineProperty(target, "name", { value: `${source.name}${suffix}` });
|
|
861
|
+
} catch {}
|
|
862
|
+
}
|
|
863
|
+
function serve(options) {
|
|
864
|
+
return new NodeServer(options);
|
|
865
|
+
}
|
|
866
|
+
var NodeServer = class {
|
|
867
|
+
runtime = "node";
|
|
868
|
+
options;
|
|
869
|
+
node;
|
|
870
|
+
serveOptions;
|
|
871
|
+
fetch;
|
|
872
|
+
waitUntil;
|
|
873
|
+
#isSecure;
|
|
874
|
+
#listeningPromise;
|
|
875
|
+
#listenError;
|
|
876
|
+
#wait;
|
|
877
|
+
constructor(options) {
|
|
878
|
+
this.options = {
|
|
879
|
+
...options,
|
|
880
|
+
middleware: [...options.middleware || []]
|
|
881
|
+
};
|
|
882
|
+
for (const plugin of options.plugins || []) plugin(this);
|
|
883
|
+
errorPlugin(this);
|
|
884
|
+
const fetchHandler = this.fetch = wrapFetch(this);
|
|
885
|
+
const handler = (nodeReq, nodeRes) => {
|
|
886
|
+
const reqUrl = nodeReq.url;
|
|
887
|
+
if (reqUrl && reqUrl[0] !== "/" && reqUrl !== "*" && !URL.canParse(reqUrl)) {
|
|
888
|
+
nodeRes.statusCode = 400;
|
|
889
|
+
nodeRes.end();
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
const request = new NodeRequest({
|
|
893
|
+
req: nodeReq,
|
|
894
|
+
res: nodeRes,
|
|
895
|
+
maxRequestBodySize: this.options.maxRequestBodySize,
|
|
896
|
+
trustProxy: this.options.trustProxy
|
|
897
|
+
});
|
|
898
|
+
request.waitUntil = this.#wait?.waitUntil;
|
|
899
|
+
const res = fetchHandler(request);
|
|
900
|
+
return res instanceof Promise ? res.then((resolvedRes) => sendNodeResponseDetached(nodeRes, resolvedRes)) : sendNodeResponseDetached(nodeRes, res);
|
|
901
|
+
};
|
|
902
|
+
this.node = {
|
|
903
|
+
handler,
|
|
904
|
+
server: void 0
|
|
905
|
+
};
|
|
906
|
+
const loader = globalThis.__srvxLoader__;
|
|
907
|
+
if (loader) {
|
|
908
|
+
loader({ server: this });
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
gracefulShutdownPlugin(this);
|
|
912
|
+
this.#wait = createWaitUntil();
|
|
913
|
+
this.waitUntil = this.#wait.waitUntil;
|
|
914
|
+
const tls = resolveTLSOptions(this.options);
|
|
915
|
+
const { port, hostname: host } = resolvePortAndHost(this.options);
|
|
916
|
+
this.serveOptions = {
|
|
917
|
+
port,
|
|
918
|
+
host,
|
|
919
|
+
exclusive: !this.options.reusePort,
|
|
920
|
+
...tls,
|
|
921
|
+
...this.options.node
|
|
922
|
+
};
|
|
923
|
+
let server;
|
|
924
|
+
this.#isSecure = !!this.serveOptions.cert && this.options.protocol !== "http";
|
|
925
|
+
if (this.options.node?.http2 ?? this.#isSecure) if (this.#isSecure) server = nodeHTTP2.createSecureServer({
|
|
926
|
+
allowHTTP1: true,
|
|
927
|
+
...this.serveOptions
|
|
928
|
+
}, handler);
|
|
929
|
+
else throw new Error("node.http2 option requires tls certificate!");
|
|
930
|
+
else if (this.#isSecure) server = nodeHTTPS.createServer(this.serveOptions, handler);
|
|
931
|
+
else server = nodeHTTP.createServer(this.serveOptions, handler);
|
|
932
|
+
this.node.server = server;
|
|
933
|
+
if (!options.manual) this.serve().catch(() => {});
|
|
934
|
+
}
|
|
935
|
+
serve() {
|
|
936
|
+
if (this.#listeningPromise) return this.#listeningPromise.then(() => this);
|
|
937
|
+
const server = this.node?.server;
|
|
938
|
+
if (!server) return Promise.reject(/* @__PURE__ */ new Error("Server not initialized"));
|
|
939
|
+
this.#listenError = void 0;
|
|
940
|
+
this.#listeningPromise = new Promise((resolve, reject) => {
|
|
941
|
+
const onError = (error) => {
|
|
942
|
+
server.off("listening", onListening);
|
|
943
|
+
this.#listenError = error;
|
|
944
|
+
this.#listeningPromise = void 0;
|
|
945
|
+
reject(error);
|
|
946
|
+
};
|
|
947
|
+
const onListening = () => {
|
|
948
|
+
server.off("error", onError);
|
|
949
|
+
printListening(this.options, this.url);
|
|
950
|
+
resolve();
|
|
951
|
+
};
|
|
952
|
+
server.once("error", onError);
|
|
953
|
+
server.once("listening", onListening);
|
|
954
|
+
server.listen(this.serveOptions);
|
|
955
|
+
});
|
|
956
|
+
return this.#listeningPromise.then(() => this);
|
|
957
|
+
}
|
|
958
|
+
get url() {
|
|
959
|
+
const addr = this.node?.server?.address();
|
|
960
|
+
if (!addr) return;
|
|
961
|
+
return typeof addr === "string" ? addr : fmtURL(addr.address, addr.port, this.#isSecure);
|
|
962
|
+
}
|
|
963
|
+
ready() {
|
|
964
|
+
if (this.#listenError) return Promise.reject(this.#listenError);
|
|
965
|
+
return Promise.resolve(this.#listeningPromise).then(() => this);
|
|
966
|
+
}
|
|
967
|
+
async close(closeAll) {
|
|
968
|
+
await Promise.all([this.#wait?.wait(), new Promise((resolve, reject) => {
|
|
969
|
+
const server = this.node?.server;
|
|
970
|
+
if (server && closeAll && "closeAllConnections" in server) server.closeAllConnections();
|
|
971
|
+
if (!server || !server.listening) return resolve();
|
|
972
|
+
server.close((error) => error ? reject(error) : resolve());
|
|
973
|
+
})]);
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
export { NodeResponse as FastResponse, FastURL, NodeRequest, NodeResponse, fetchNodeHandler, patchGlobalRequest, sendNodeResponse, serve, toFetchHandler, toNodeHandler };
|