@vercel/node 1.12.2-canary.3 → 1.12.2-canary.7
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/dist/babel.d.ts +4 -0
- package/dist/dev-server.d.ts +5 -0
- package/dist/example-import.d.ts +1 -0
- package/dist/helpers.d.ts +10 -0
- package/dist/helpers.js +89 -88
- package/dist/index.d.ts +11 -33
- package/dist/index.js +43021 -5493
- package/dist/launcher.js +12 -8
- package/dist/source-map-support.js +49 -47
- package/dist/types.d.ts +33 -0
- package/dist/typescript.d.ts +34 -0
- package/package.json +4 -4
package/dist/babel.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
export declare function rawBody(readable: Readable): Promise<Buffer>;
|
|
5
|
+
export declare function onDevRequest(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { VercelRequest, VercelResponse } from './types';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
import type { Bridge } from '@vercel/node-bridge/bridge';
|
|
5
|
+
export declare class ApiError extends Error {
|
|
6
|
+
readonly statusCode: number;
|
|
7
|
+
constructor(statusCode: number, message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare function sendError(res: VercelResponse, statusCode: number, message: string): void;
|
|
10
|
+
export declare function createServerWithHelpers(handler: (req: VercelRequest, res: VercelResponse) => void | Promise<void>, bridge: Bridge): Server;
|
package/dist/helpers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
module.exports =
|
|
1
2
|
/******/ (() => { // webpackBootstrap
|
|
2
3
|
/******/ "use strict";
|
|
3
4
|
/******/ var __webpack_modules__ = ({
|
|
@@ -437,7 +438,7 @@ function tryDecode(str, decode) {
|
|
|
437
438
|
/***/ }),
|
|
438
439
|
|
|
439
440
|
/***/ 474:
|
|
440
|
-
/***/ ((module, __unused_webpack_exports,
|
|
441
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
441
442
|
|
|
442
443
|
/*!
|
|
443
444
|
* etag
|
|
@@ -459,8 +460,8 @@ module.exports = etag
|
|
|
459
460
|
* @private
|
|
460
461
|
*/
|
|
461
462
|
|
|
462
|
-
var crypto =
|
|
463
|
-
var Stats =
|
|
463
|
+
var crypto = __webpack_require__(417)
|
|
464
|
+
var Stats = __webpack_require__(747).Stats
|
|
464
465
|
|
|
465
466
|
/**
|
|
466
467
|
* Module variables.
|
|
@@ -574,94 +575,20 @@ function stattag (stat) {
|
|
|
574
575
|
|
|
575
576
|
/***/ }),
|
|
576
577
|
|
|
577
|
-
/***/
|
|
578
|
-
/***/ ((
|
|
579
|
-
|
|
580
|
-
module.exports = require("crypto");
|
|
581
|
-
|
|
582
|
-
/***/ }),
|
|
583
|
-
|
|
584
|
-
/***/ 747:
|
|
585
|
-
/***/ ((module) => {
|
|
586
|
-
|
|
587
|
-
module.exports = require("fs");
|
|
588
|
-
|
|
589
|
-
/***/ }),
|
|
590
|
-
|
|
591
|
-
/***/ 605:
|
|
592
|
-
/***/ ((module) => {
|
|
593
|
-
|
|
594
|
-
module.exports = require("http");
|
|
595
|
-
|
|
596
|
-
/***/ }),
|
|
578
|
+
/***/ 508:
|
|
579
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
597
580
|
|
|
598
|
-
/***/ 191:
|
|
599
|
-
/***/ ((module) => {
|
|
600
|
-
|
|
601
|
-
module.exports = require("querystring");
|
|
602
|
-
|
|
603
|
-
/***/ }),
|
|
604
|
-
|
|
605
|
-
/***/ 835:
|
|
606
|
-
/***/ ((module) => {
|
|
607
|
-
|
|
608
|
-
module.exports = require("url");
|
|
609
|
-
|
|
610
|
-
/***/ })
|
|
611
|
-
|
|
612
|
-
/******/ });
|
|
613
|
-
/************************************************************************/
|
|
614
|
-
/******/ // The module cache
|
|
615
|
-
/******/ var __webpack_module_cache__ = {};
|
|
616
|
-
/******/
|
|
617
|
-
/******/ // The require function
|
|
618
|
-
/******/ function __nccwpck_require__(moduleId) {
|
|
619
|
-
/******/ // Check if module is in cache
|
|
620
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
621
|
-
/******/ if (cachedModule !== undefined) {
|
|
622
|
-
/******/ return cachedModule.exports;
|
|
623
|
-
/******/ }
|
|
624
|
-
/******/ // Create a new module (and put it into the cache)
|
|
625
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
626
|
-
/******/ // no module.id needed
|
|
627
|
-
/******/ // no module.loaded needed
|
|
628
|
-
/******/ exports: {}
|
|
629
|
-
/******/ };
|
|
630
|
-
/******/
|
|
631
|
-
/******/ // Execute the module function
|
|
632
|
-
/******/ var threw = true;
|
|
633
|
-
/******/ try {
|
|
634
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
635
|
-
/******/ threw = false;
|
|
636
|
-
/******/ } finally {
|
|
637
|
-
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
638
|
-
/******/ }
|
|
639
|
-
/******/
|
|
640
|
-
/******/ // Return the exports of the module
|
|
641
|
-
/******/ return module.exports;
|
|
642
|
-
/******/ }
|
|
643
|
-
/******/
|
|
644
|
-
/************************************************************************/
|
|
645
|
-
/******/ /* webpack/runtime/compat */
|
|
646
|
-
/******/
|
|
647
|
-
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
648
|
-
/******/
|
|
649
|
-
/************************************************************************/
|
|
650
|
-
var __webpack_exports__ = {};
|
|
651
|
-
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
652
|
-
(() => {
|
|
653
|
-
var exports = __webpack_exports__;
|
|
654
581
|
|
|
655
582
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
656
583
|
exports.createServerWithHelpers = exports.sendError = exports.ApiError = void 0;
|
|
657
|
-
const http_1 =
|
|
584
|
+
const http_1 = __webpack_require__(605);
|
|
658
585
|
function getBodyParser(req, body) {
|
|
659
586
|
return function parseBody() {
|
|
660
587
|
if (!req.headers['content-type']) {
|
|
661
588
|
return undefined;
|
|
662
589
|
}
|
|
663
590
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
664
|
-
const { parse: parseContentType } =
|
|
591
|
+
const { parse: parseContentType } = __webpack_require__(534);
|
|
665
592
|
const { type } = parseContentType(req.headers['content-type']);
|
|
666
593
|
if (type === 'application/json') {
|
|
667
594
|
try {
|
|
@@ -677,7 +604,7 @@ function getBodyParser(req, body) {
|
|
|
677
604
|
}
|
|
678
605
|
if (type === 'application/x-www-form-urlencoded') {
|
|
679
606
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
680
|
-
const { parse: parseQS } =
|
|
607
|
+
const { parse: parseQS } = __webpack_require__(191);
|
|
681
608
|
// note: querystring.parse does not produce an iterable object
|
|
682
609
|
// https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options
|
|
683
610
|
return parseQS(body.toString());
|
|
@@ -691,7 +618,7 @@ function getBodyParser(req, body) {
|
|
|
691
618
|
function getQueryParser({ url = '/' }) {
|
|
692
619
|
return function parseQuery() {
|
|
693
620
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
694
|
-
const { parse: parseURL } =
|
|
621
|
+
const { parse: parseURL } = __webpack_require__(835);
|
|
695
622
|
return parseURL(url, true).query;
|
|
696
623
|
};
|
|
697
624
|
}
|
|
@@ -702,7 +629,7 @@ function getCookieParser(req) {
|
|
|
702
629
|
return {};
|
|
703
630
|
}
|
|
704
631
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
705
|
-
const { parse } =
|
|
632
|
+
const { parse } = __webpack_require__(891);
|
|
706
633
|
return parse(Array.isArray(header) ? header.join(';') : header);
|
|
707
634
|
};
|
|
708
635
|
}
|
|
@@ -723,7 +650,7 @@ function redirect(res, statusOrUrl, url) {
|
|
|
723
650
|
}
|
|
724
651
|
function setCharset(type, charset) {
|
|
725
652
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
726
|
-
const { parse, format } =
|
|
653
|
+
const { parse, format } = __webpack_require__(534);
|
|
727
654
|
const parsed = parse(type);
|
|
728
655
|
parsed.parameters.charset = charset;
|
|
729
656
|
return format(parsed);
|
|
@@ -731,7 +658,7 @@ function setCharset(type, charset) {
|
|
|
731
658
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
732
659
|
function createETag(body, encoding) {
|
|
733
660
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
734
|
-
const etag =
|
|
661
|
+
const etag = __webpack_require__(474);
|
|
735
662
|
const buf = !Buffer.isBuffer(body) ? Buffer.from(body, encoding) : body;
|
|
736
663
|
return etag(buf, { weak: true });
|
|
737
664
|
}
|
|
@@ -898,8 +825,82 @@ function createServerWithHelpers(handler, bridge) {
|
|
|
898
825
|
}
|
|
899
826
|
exports.createServerWithHelpers = createServerWithHelpers;
|
|
900
827
|
|
|
901
|
-
})();
|
|
902
828
|
|
|
903
|
-
|
|
829
|
+
/***/ }),
|
|
830
|
+
|
|
831
|
+
/***/ 417:
|
|
832
|
+
/***/ ((module) => {
|
|
833
|
+
|
|
834
|
+
module.exports = require("crypto");
|
|
835
|
+
|
|
836
|
+
/***/ }),
|
|
837
|
+
|
|
838
|
+
/***/ 747:
|
|
839
|
+
/***/ ((module) => {
|
|
840
|
+
|
|
841
|
+
module.exports = require("fs");
|
|
842
|
+
|
|
843
|
+
/***/ }),
|
|
844
|
+
|
|
845
|
+
/***/ 605:
|
|
846
|
+
/***/ ((module) => {
|
|
847
|
+
|
|
848
|
+
module.exports = require("http");
|
|
849
|
+
|
|
850
|
+
/***/ }),
|
|
851
|
+
|
|
852
|
+
/***/ 191:
|
|
853
|
+
/***/ ((module) => {
|
|
854
|
+
|
|
855
|
+
module.exports = require("querystring");
|
|
856
|
+
|
|
857
|
+
/***/ }),
|
|
858
|
+
|
|
859
|
+
/***/ 835:
|
|
860
|
+
/***/ ((module) => {
|
|
861
|
+
|
|
862
|
+
module.exports = require("url");
|
|
863
|
+
|
|
864
|
+
/***/ })
|
|
865
|
+
|
|
866
|
+
/******/ });
|
|
867
|
+
/************************************************************************/
|
|
868
|
+
/******/ // The module cache
|
|
869
|
+
/******/ var __webpack_module_cache__ = {};
|
|
870
|
+
/******/
|
|
871
|
+
/******/ // The require function
|
|
872
|
+
/******/ function __webpack_require__(moduleId) {
|
|
873
|
+
/******/ // Check if module is in cache
|
|
874
|
+
/******/ if(__webpack_module_cache__[moduleId]) {
|
|
875
|
+
/******/ return __webpack_module_cache__[moduleId].exports;
|
|
876
|
+
/******/ }
|
|
877
|
+
/******/ // Create a new module (and put it into the cache)
|
|
878
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
879
|
+
/******/ // no module.id needed
|
|
880
|
+
/******/ // no module.loaded needed
|
|
881
|
+
/******/ exports: {}
|
|
882
|
+
/******/ };
|
|
883
|
+
/******/
|
|
884
|
+
/******/ // Execute the module function
|
|
885
|
+
/******/ var threw = true;
|
|
886
|
+
/******/ try {
|
|
887
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
888
|
+
/******/ threw = false;
|
|
889
|
+
/******/ } finally {
|
|
890
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
891
|
+
/******/ }
|
|
892
|
+
/******/
|
|
893
|
+
/******/ // Return the exports of the module
|
|
894
|
+
/******/ return module.exports;
|
|
895
|
+
/******/ }
|
|
896
|
+
/******/
|
|
897
|
+
/************************************************************************/
|
|
898
|
+
/******/ /* webpack/runtime/compat */
|
|
899
|
+
/******/
|
|
900
|
+
/******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
|
|
901
|
+
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
|
902
|
+
/******/ // startup
|
|
903
|
+
/******/ // Load entry module and return exports
|
|
904
|
+
/******/ return __webpack_require__(508);
|
|
904
905
|
/******/ })()
|
|
905
906
|
;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
cookies: VercelRequestCookies;
|
|
13
|
-
body: VercelRequestBody;
|
|
14
|
-
};
|
|
15
|
-
export declare type VercelResponse = ServerResponse & {
|
|
16
|
-
send: (body: any) => VercelResponse;
|
|
17
|
-
json: (jsonBody: any) => VercelResponse;
|
|
18
|
-
status: (statusCode: number) => VercelResponse;
|
|
19
|
-
redirect: (statusOrUrl: string | number, url?: string) => VercelResponse;
|
|
20
|
-
};
|
|
21
|
-
export declare type VercelApiHandler = (req: VercelRequest, res: VercelResponse) => void;
|
|
22
|
-
/** @deprecated Use VercelRequestCookies instead. */
|
|
23
|
-
export declare type NowRequestCookies = VercelRequestCookies;
|
|
24
|
-
/** @deprecated Use VercelRequestQuery instead. */
|
|
25
|
-
export declare type NowRequestQuery = VercelRequestQuery;
|
|
26
|
-
/** @deprecated Use VercelRequestBody instead. */
|
|
27
|
-
export declare type NowRequestBody = any;
|
|
28
|
-
/** @deprecated Use VercelRequest instead. */
|
|
29
|
-
export declare type NowRequest = VercelRequest;
|
|
30
|
-
/** @deprecated Use VercelResponse instead. */
|
|
31
|
-
export declare type NowResponse = VercelResponse;
|
|
32
|
-
/** @deprecated Use VercelApiHandler instead. */
|
|
33
|
-
export declare type NowApiHandler = VercelApiHandler;
|
|
1
|
+
import { Files, PrepareCacheOptions, BuildOptions, StartDevServerOptions, StartDevServerResult, shouldServe } from '@vercel/build-utils';
|
|
2
|
+
export { shouldServe };
|
|
3
|
+
export { NowRequest, NowResponse, VercelRequest, VercelResponse, } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare const version = 3;
|
|
6
|
+
export declare function build({ files, entrypoint, workPath, repoRootPath, config, meta, }: BuildOptions): Promise<{
|
|
7
|
+
output: import("@vercel/build-utils").Lambda;
|
|
8
|
+
watch: string[];
|
|
9
|
+
}>;
|
|
10
|
+
export declare function prepareCache({ workPath, }: PrepareCacheOptions): Promise<Files>;
|
|
11
|
+
export declare function startDevServer(opts: StartDevServerOptions): Promise<StartDevServerResult>;
|