renovate-log-parser 0.1.0 → 0.1.2
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/README.md +39 -27
- package/dist/commands/web.d.ts +2 -1
- package/dist/commands/web.js +23 -11
- package/dist/commands/web.js.map +1 -1
- package/dist/server/api.d.ts +16 -0
- package/dist/server/api.js +173 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/http-error.d.ts +18 -0
- package/dist/server/http-error.js +23 -0
- package/dist/server/http-error.js.map +1 -0
- package/dist/server/index.d.ts +34 -0
- package/dist/server/index.js +54 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/log-registry.d.ts +34 -0
- package/dist/server/log-registry.js +157 -0
- package/dist/server/log-registry.js.map +1 -0
- package/dist/server/server-main.d.ts +1 -0
- package/dist/server/server-main.js +31 -0
- package/dist/server/server-main.js.map +1 -0
- package/dist/server/translate-filters.d.ts +58 -0
- package/dist/server/translate-filters.js +119 -0
- package/dist/server/translate-filters.js.map +1 -0
- package/package.json +6 -3
- package/web/.output/public/200.html +1 -0
- package/web/.output/public/404.html +1 -0
- package/web/.output/public/_nuxt/{CGPWRqbc.js → B4JKWaDj.js} +1 -1
- package/web/.output/public/_nuxt/Bs-RnkRE.js +37 -0
- package/web/.output/public/_nuxt/{Sgtec1U0.js → DjtJytwR.js} +1 -1
- package/web/.output/public/_nuxt/{BgApMHS1.js → a71R3CFc.js} +1 -1
- package/web/.output/public/_nuxt/builds/latest.json +1 -1
- package/web/.output/public/_nuxt/builds/meta/bc129b23-5172-4e74-875d-2a24574a5dbe.json +1 -0
- package/web/.output/public/index.html +1 -0
- package/web/.output/nitro.json +0 -15
- package/web/.output/public/_nuxt/BWja8e3M.js +0 -37
- package/web/.output/public/_nuxt/builds/meta/c4723e49-0623-47af-ae79-9ab6428bdcc1.json +0 -1
- package/web/.output/server/chunks/_/error-500.mjs +0 -19
- package/web/.output/server/chunks/_/error-500.mjs.map +0 -1
- package/web/.output/server/chunks/_/icons.mjs +0 -6153
- package/web/.output/server/chunks/_/icons.mjs.map +0 -1
- package/web/.output/server/chunks/_/icons2.mjs +0 -11494
- package/web/.output/server/chunks/_/icons2.mjs.map +0 -1
- package/web/.output/server/chunks/build/_plugin-vue_export-helper-1tPrXgE0.mjs +0 -10
- package/web/.output/server/chunks/build/_plugin-vue_export-helper-1tPrXgE0.mjs.map +0 -1
- package/web/.output/server/chunks/build/client.precomputed.mjs +0 -4
- package/web/.output/server/chunks/build/client.precomputed.mjs.map +0 -1
- package/web/.output/server/chunks/build/error-404-DyaaQUIS.mjs +0 -106
- package/web/.output/server/chunks/build/error-404-DyaaQUIS.mjs.map +0 -1
- package/web/.output/server/chunks/build/error-404-styles.9cNA4arh.mjs +0 -8
- package/web/.output/server/chunks/build/error-404-styles.9cNA4arh.mjs.map +0 -1
- package/web/.output/server/chunks/build/error-500-CVSP-p02.mjs +0 -89
- package/web/.output/server/chunks/build/error-500-CVSP-p02.mjs.map +0 -1
- package/web/.output/server/chunks/build/error-500-styles.BX54ZlkH.mjs +0 -8
- package/web/.output/server/chunks/build/error-500-styles.BX54ZlkH.mjs.map +0 -1
- package/web/.output/server/chunks/build/index-88dXYOxO.mjs +0 -19675
- package/web/.output/server/chunks/build/index-88dXYOxO.mjs.map +0 -1
- package/web/.output/server/chunks/build/index-styles.V2iua2bE.mjs +0 -8
- package/web/.output/server/chunks/build/index-styles.V2iua2bE.mjs.map +0 -1
- package/web/.output/server/chunks/build/server.mjs +0 -7910
- package/web/.output/server/chunks/build/server.mjs.map +0 -1
- package/web/.output/server/chunks/build/styles.mjs +0 -10
- package/web/.output/server/chunks/build/styles.mjs.map +0 -1
- package/web/.output/server/chunks/nitro/nitro.mjs +0 -6944
- package/web/.output/server/chunks/nitro/nitro.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/fields.get.mjs +0 -27
- package/web/.output/server/chunks/routes/api/fields.get.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/findings.get.mjs +0 -30
- package/web/.output/server/chunks/routes/api/findings.get.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/log/contents.post.mjs +0 -29
- package/web/.output/server/chunks/routes/api/log/contents.post.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/log/path.post.mjs +0 -30
- package/web/.output/server/chunks/routes/api/log/path.post.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/repositories.get.mjs +0 -27
- package/web/.output/server/chunks/routes/api/repositories.get.mjs.map +0 -1
- package/web/.output/server/chunks/routes/api/rows.get.mjs +0 -48
- package/web/.output/server/chunks/routes/api/rows.get.mjs.map +0 -1
- package/web/.output/server/chunks/routes/renderer.mjs +0 -451
- package/web/.output/server/chunks/routes/renderer.mjs.map +0 -1
- package/web/.output/server/chunks/virtual/_virtual_spa-template.mjs +0 -4
- package/web/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +0 -1
- package/web/.output/server/index.mjs +0 -16
- package/web/.output/server/index.mjs.map +0 -1
- package/web/.output/server/node_modules/.nitro/hookable@5.5.3/dist/index.mjs +0 -290
- package/web/.output/server/node_modules/.nitro/hookable@5.5.3/package.json +0 -49
- package/web/.output/server/node_modules/.nitro/hookable@6.1.1/dist/index.mjs +0 -257
- package/web/.output/server/node_modules/.nitro/hookable@6.1.1/package.json +0 -53
- package/web/.output/server/node_modules/@babel/parser/lib/index.js +0 -14599
- package/web/.output/server/node_modules/@babel/parser/package.json +0 -50
- package/web/.output/server/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +0 -1038
- package/web/.output/server/node_modules/@floating-ui/core/package.json +0 -63
- package/web/.output/server/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +0 -789
- package/web/.output/server/node_modules/@floating-ui/dom/package.json +0 -72
- package/web/.output/server/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +0 -165
- package/web/.output/server/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +0 -136
- package/web/.output/server/node_modules/@floating-ui/utils/package.json +0 -70
- package/web/.output/server/node_modules/@floating-ui/vue/dist/floating-ui.vue.mjs +0 -190
- package/web/.output/server/node_modules/@floating-ui/vue/package.json +0 -71
- package/web/.output/server/node_modules/@iconify/utils/lib/colors/index.js +0 -295
- package/web/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +0 -701
- package/web/.output/server/node_modules/@iconify/utils/lib/css/common.js +0 -75
- package/web/.output/server/node_modules/@iconify/utils/lib/css/format.js +0 -39
- package/web/.output/server/node_modules/@iconify/utils/lib/css/icon.js +0 -47
- package/web/.output/server/node_modules/@iconify/utils/lib/css/icons.js +0 -128
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +0 -19
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +0 -13
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +0 -17
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +0 -16
- package/web/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +0 -30
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +0 -78
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +0 -100
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +0 -28
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +0 -58
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +0 -48
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +0 -203
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +0 -33
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +0 -132
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +0 -165
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +0 -79
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +0 -92
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +0 -26
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +0 -76
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +0 -66
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +0 -45
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +0 -103
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +0 -36
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +0 -92
- package/web/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +0 -62
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +0 -25
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +0 -16
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/name.js +0 -57
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/square.js +0 -33
- package/web/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +0 -12
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +0 -125
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +0 -19
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +0 -25
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +0 -36
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +0 -91
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +0 -46
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +0 -23
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +0 -42
- package/web/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +0 -123
- package/web/.output/server/node_modules/@iconify/utils/lib/index.js +0 -52
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +0 -30
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +0 -26
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +0 -27
- package/web/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +0 -105
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +0 -26
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +0 -26
- package/web/.output/server/node_modules/@iconify/utils/lib/misc/title.js +0 -9
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/build.js +0 -113
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +0 -31
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +0 -13
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/html.js +0 -9
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/id.js +0 -41
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +0 -22
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +0 -67
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +0 -54
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/size.js +0 -27
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +0 -7
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/url.js +0 -22
- package/web/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +0 -8
- package/web/.output/server/node_modules/@iconify/utils/package.json +0 -119
- package/web/.output/server/node_modules/@iconify/vue/dist/iconify.mjs +0 -1896
- package/web/.output/server/node_modules/@iconify/vue/package.json +0 -62
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -1268
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +0 -34
- package/web/.output/server/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -74
- package/web/.output/server/node_modules/@tanstack/virtual-core/package.json +0 -56
- package/web/.output/server/node_modules/@tanstack/vue-virtual/dist/esm/index.js +0 -66
- package/web/.output/server/node_modules/@tanstack/vue-virtual/package.json +0 -68
- package/web/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6759
- package/web/.output/server/node_modules/@vue/compiler-core/package.json +0 -58
- package/web/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -689
- package/web/.output/server/node_modules/@vue/compiler-dom/package.json +0 -57
- package/web/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1413
- package/web/.output/server/node_modules/@vue/compiler-ssr/package.json +0 -34
- package/web/.output/server/node_modules/@vue/devtools-api/dist/index.js +0 -2
- package/web/.output/server/node_modules/@vue/devtools-api/package.json +0 -34
- package/web/.output/server/node_modules/@vue/devtools-kit/dist/index.js +0 -5670
- package/web/.output/server/node_modules/@vue/devtools-kit/node_modules/hookable/dist/index.mjs +0 -290
- package/web/.output/server/node_modules/@vue/devtools-kit/node_modules/hookable/package.json +0 -49
- package/web/.output/server/node_modules/@vue/devtools-kit/package.json +0 -44
- package/web/.output/server/node_modules/@vue/devtools-shared/dist/index.js +0 -239
- package/web/.output/server/node_modules/@vue/devtools-shared/package.json +0 -33
- package/web/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1899
- package/web/.output/server/node_modules/@vue/reactivity/package.json +0 -55
- package/web/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -6940
- package/web/.output/server/node_modules/@vue/runtime-core/package.json +0 -52
- package/web/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1822
- package/web/.output/server/node_modules/@vue/runtime-dom/package.json +0 -60
- package/web/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -896
- package/web/.output/server/node_modules/@vue/server-renderer/package.json +0 -55
- package/web/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +0 -604
- package/web/.output/server/node_modules/@vue/shared/package.json +0 -47
- package/web/.output/server/node_modules/@vueuse/core/dist/index.js +0 -8464
- package/web/.output/server/node_modules/@vueuse/core/package.json +0 -49
- package/web/.output/server/node_modules/@vueuse/shared/dist/index.js +0 -2013
- package/web/.output/server/node_modules/@vueuse/shared/package.json +0 -42
- package/web/.output/server/node_modules/aria-hidden/dist/es5/index.js +0 -174
- package/web/.output/server/node_modules/aria-hidden/package.json +0 -71
- package/web/.output/server/node_modules/birpc/dist/index.mjs +0 -291
- package/web/.output/server/node_modules/birpc/package.json +0 -57
- package/web/.output/server/node_modules/consola/dist/chunks/prompt.mjs +0 -280
- package/web/.output/server/node_modules/consola/dist/core.mjs +0 -512
- package/web/.output/server/node_modules/consola/dist/index.mjs +0 -651
- package/web/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +0 -72
- package/web/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +0 -288
- package/web/.output/server/node_modules/consola/package.json +0 -136
- package/web/.output/server/node_modules/devalue/index.js +0 -4
- package/web/.output/server/node_modules/devalue/package.json +0 -40
- package/web/.output/server/node_modules/devalue/src/base64.js +0 -60
- package/web/.output/server/node_modules/devalue/src/constants.js +0 -12
- package/web/.output/server/node_modules/devalue/src/parse.js +0 -283
- package/web/.output/server/node_modules/devalue/src/stringify.js +0 -401
- package/web/.output/server/node_modules/devalue/src/uneval.js +0 -552
- package/web/.output/server/node_modules/devalue/src/utils.js +0 -160
- package/web/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +0 -77
- package/web/.output/server/node_modules/entities/dist/commonjs/decode.js +0 -568
- package/web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +0 -7
- package/web/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +0 -7
- package/web/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +0 -21
- package/web/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +0 -31
- package/web/.output/server/node_modules/entities/dist/commonjs/package.json +0 -3
- package/web/.output/server/node_modules/entities/package.json +0 -120
- package/web/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +0 -344
- package/web/.output/server/node_modules/estree-walker/package.json +0 -37
- package/web/.output/server/node_modules/hookable/dist/index.mjs +0 -257
- package/web/.output/server/node_modules/hookable/package.json +0 -53
- package/web/.output/server/node_modules/nostics/dist/index.mjs +0 -179
- package/web/.output/server/node_modules/nostics/package.json +0 -124
- package/web/.output/server/node_modules/perfect-debounce/dist/index.mjs +0 -89
- package/web/.output/server/node_modules/perfect-debounce/package.json +0 -41
- package/web/.output/server/node_modules/rou3/dist/index.mjs +0 -501
- package/web/.output/server/node_modules/rou3/package.json +0 -48
- package/web/.output/server/node_modules/source-map-js/lib/array-set.js +0 -121
- package/web/.output/server/node_modules/source-map-js/lib/base64-vlq.js +0 -140
- package/web/.output/server/node_modules/source-map-js/lib/base64.js +0 -67
- package/web/.output/server/node_modules/source-map-js/lib/binary-search.js +0 -111
- package/web/.output/server/node_modules/source-map-js/lib/mapping-list.js +0 -79
- package/web/.output/server/node_modules/source-map-js/lib/quick-sort.js +0 -132
- package/web/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +0 -1188
- package/web/.output/server/node_modules/source-map-js/lib/source-map-generator.js +0 -444
- package/web/.output/server/node_modules/source-map-js/lib/source-node.js +0 -413
- package/web/.output/server/node_modules/source-map-js/lib/util.js +0 -594
- package/web/.output/server/node_modules/source-map-js/package.json +0 -71
- package/web/.output/server/node_modules/source-map-js/source-map.js +0 -8
- package/web/.output/server/node_modules/srvx/dist/_chunks/_body-limit.mjs +0 -39
- package/web/.output/server/node_modules/srvx/dist/_chunks/_plugins.mjs +0 -56
- package/web/.output/server/node_modules/srvx/dist/_chunks/_trust-proxy.mjs +0 -58
- package/web/.output/server/node_modules/srvx/dist/_chunks/_url.mjs +0 -134
- package/web/.output/server/node_modules/srvx/dist/_chunks/_utils.mjs +0 -15
- package/web/.output/server/node_modules/srvx/dist/_chunks/_utils2.mjs +0 -75
- package/web/.output/server/node_modules/srvx/dist/adapters/node.mjs +0 -976
- package/web/.output/server/node_modules/srvx/package.json +0 -102
- package/web/.output/server/node_modules/tailwind-merge/dist/bundle-mjs.mjs +0 -3365
- package/web/.output/server/node_modules/tailwind-merge/package.json +0 -93
- package/web/.output/server/node_modules/tailwind-variants/dist/chunk-LQJYWU4O.js +0 -112
- package/web/.output/server/node_modules/tailwind-variants/dist/chunk-RZF76H2U.js +0 -269
- package/web/.output/server/node_modules/tailwind-variants/dist/index.js +0 -38
- package/web/.output/server/node_modules/tailwind-variants/package.json +0 -122
- package/web/.output/server/node_modules/tailwindcss/dist/chunk-X4GG3EDV.mjs +0 -1
- package/web/.output/server/node_modules/tailwindcss/dist/colors.mjs +0 -1
- package/web/.output/server/node_modules/tailwindcss/package.json +0 -89
- package/web/.output/server/node_modules/ufo/dist/index.mjs +0 -645
- package/web/.output/server/node_modules/ufo/package.json +0 -48
- package/web/.output/server/node_modules/unhead/dist/index.mjs +0 -9
- package/web/.output/server/node_modules/unhead/dist/parser.mjs +0 -508
- package/web/.output/server/node_modules/unhead/dist/plugins.mjs +0 -101
- package/web/.output/server/node_modules/unhead/dist/scripts.mjs +0 -30
- package/web/.output/server/node_modules/unhead/dist/server.mjs +0 -180
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.B3VbJo7Y.mjs +0 -207
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +0 -43
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +0 -269
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.CaI5ZD4O.mjs +0 -182
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +0 -71
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.D4vSFytZ.mjs +0 -236
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +0 -196
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.Dh1cQCTe.mjs +0 -44
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.TxTMM7cM.mjs +0 -166
- package/web/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +0 -38
- package/web/.output/server/node_modules/unhead/dist/utils.mjs +0 -5
- package/web/.output/server/node_modules/unhead/node_modules/hookable/dist/index.mjs +0 -257
- package/web/.output/server/node_modules/unhead/node_modules/hookable/package.json +0 -53
- package/web/.output/server/node_modules/unhead/package.json +0 -105
- package/web/.output/server/node_modules/vue/dist/vue.cjs.js +0 -80
- package/web/.output/server/node_modules/vue/dist/vue.cjs.prod.js +0 -66
- package/web/.output/server/node_modules/vue/index.js +0 -7
- package/web/.output/server/node_modules/vue/index.mjs +0 -1
- package/web/.output/server/node_modules/vue/package.json +0 -112
- package/web/.output/server/node_modules/vue/server-renderer/index.mjs +0 -1
- package/web/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +0 -249
- package/web/.output/server/node_modules/vue-bundle-renderer/package.json +0 -57
- package/web/.output/server/node_modules/vue-demi/lib/index.mjs +0 -34
- package/web/.output/server/node_modules/vue-demi/package.json +0 -47
- package/web/.output/server/node_modules/vue-router/dist/devtools-Bpr7ZAVB.js +0 -1056
- package/web/.output/server/node_modules/vue-router/dist/useApi-CROJJdhE.js +0 -436
- package/web/.output/server/node_modules/vue-router/dist/vue-router.js +0 -1543
- package/web/.output/server/node_modules/vue-router/package.json +0 -214
- package/web/.output/server/node_modules/vue-router/vue-router.node.mjs +0 -2
- package/web/.output/server/package.json +0 -51
|
@@ -1,976 +0,0 @@
|
|
|
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 };
|