Initial boiler plate project
This commit is contained in:
3
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { AppRouteHandlerFn, AppRouteHandlers } from '../module';
|
||||
import { type HTTP_METHOD } from '../../../../web/http';
|
||||
export declare function autoImplementMethods(handlers: AppRouteHandlers): Record<HTTP_METHOD, AppRouteHandlerFn>;
|
||||
77
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.js
generated
vendored
Normal file
77
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "autoImplementMethods", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return autoImplementMethods;
|
||||
}
|
||||
});
|
||||
const _http = require("../../../../web/http");
|
||||
const _responsehandlers = require("../../helpers/response-handlers");
|
||||
const AUTOMATIC_ROUTE_METHODS = [
|
||||
"HEAD",
|
||||
"OPTIONS"
|
||||
];
|
||||
function autoImplementMethods(handlers) {
|
||||
// Loop through all the HTTP methods to create the initial methods object.
|
||||
// Each of the methods will be set to the the 405 response handler.
|
||||
const methods = _http.HTTP_METHODS.reduce((acc, method)=>({
|
||||
...acc,
|
||||
// If the userland module implements the method, then use it. Otherwise,
|
||||
// use the 405 response handler.
|
||||
[method]: handlers[method] ?? _responsehandlers.handleMethodNotAllowedResponse
|
||||
}), {});
|
||||
// Get all the methods that could be automatically implemented that were not
|
||||
// implemented by the userland module.
|
||||
const implemented = new Set(_http.HTTP_METHODS.filter((method)=>handlers[method]));
|
||||
const missing = AUTOMATIC_ROUTE_METHODS.filter((method)=>!implemented.has(method));
|
||||
// Loop over the missing methods to automatically implement them if we can.
|
||||
for (const method of missing){
|
||||
// If the userland module doesn't implement the HEAD method, then
|
||||
// we'll automatically implement it by calling the GET method (if it
|
||||
// exists).
|
||||
if (method === "HEAD") {
|
||||
if (handlers.GET) {
|
||||
// Implement the HEAD method by calling the GET method.
|
||||
methods.HEAD = handlers.GET;
|
||||
// Mark it as implemented.
|
||||
implemented.add("HEAD");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// If OPTIONS is not provided then implement it.
|
||||
if (method === "OPTIONS") {
|
||||
// TODO: check if HEAD is implemented, if so, use it to add more headers
|
||||
// Get all the methods that were implemented by the userland module.
|
||||
const allow = [
|
||||
"OPTIONS",
|
||||
...implemented
|
||||
];
|
||||
// If the list of methods doesn't include HEAD, but it includes GET, then
|
||||
// add HEAD as it's automatically implemented.
|
||||
if (!implemented.has("HEAD") && implemented.has("GET")) {
|
||||
allow.push("HEAD");
|
||||
}
|
||||
// Sort and join the list with commas to create the `Allow` header. See:
|
||||
// https://httpwg.org/specs/rfc9110.html#field.allow
|
||||
const headers = {
|
||||
Allow: allow.sort().join(", ")
|
||||
};
|
||||
// Implement the OPTIONS method by returning a 204 response with the
|
||||
// `Allow` header.
|
||||
methods.OPTIONS = ()=>new Response(null, {
|
||||
status: 204,
|
||||
headers
|
||||
});
|
||||
// Mark this method as implemented.
|
||||
implemented.add("OPTIONS");
|
||||
continue;
|
||||
}
|
||||
throw new Error(`Invariant: should handle all automatic implementable methods, got method: ${method}`);
|
||||
}
|
||||
return methods;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=auto-implement-methods.js.map
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/auto-implement-methods.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/auto-implement-methods.ts"],"names":["autoImplementMethods","AUTOMATIC_ROUTE_METHODS","handlers","methods","HTTP_METHODS","reduce","acc","method","handleMethodNotAllowedResponse","implemented","Set","filter","missing","has","GET","HEAD","add","allow","push","headers","Allow","sort","join","OPTIONS","Response","status","Error"],"mappings":";;;;+BAOgBA;;;eAAAA;;;sBAL+B;kCACA;AAE/C,MAAMC,0BAA0B;IAAC;IAAQ;CAAU;AAE5C,SAASD,qBACdE,QAA0B;IAE1B,0EAA0E;IAC1E,mEAAmE;IACnE,MAAMC,UAAkDC,kBAAY,CAACC,MAAM,CACzE,CAACC,KAAKC,SAAY,CAAA;YAChB,GAAGD,GAAG;YACN,wEAAwE;YACxE,gCAAgC;YAChC,CAACC,OAAO,EAAEL,QAAQ,CAACK,OAAO,IAAIC,gDAA8B;QAC9D,CAAA,GACA,CAAC;IAGH,4EAA4E;IAC5E,sCAAsC;IACtC,MAAMC,cAAc,IAAIC,IAAIN,kBAAY,CAACO,MAAM,CAAC,CAACJ,SAAWL,QAAQ,CAACK,OAAO;IAC5E,MAAMK,UAAUX,wBAAwBU,MAAM,CAC5C,CAACJ,SAAW,CAACE,YAAYI,GAAG,CAACN;IAG/B,2EAA2E;IAC3E,KAAK,MAAMA,UAAUK,QAAS;QAC5B,iEAAiE;QACjE,oEAAoE;QACpE,WAAW;QACX,IAAIL,WAAW,QAAQ;YACrB,IAAIL,SAASY,GAAG,EAAE;gBAChB,uDAAuD;gBACvDX,QAAQY,IAAI,GAAGb,SAASY,GAAG;gBAE3B,0BAA0B;gBAC1BL,YAAYO,GAAG,CAAC;YAClB;YACA;QACF;QAEA,gDAAgD;QAChD,IAAIT,WAAW,WAAW;YACxB,wEAAwE;YAExE,oEAAoE;YACpE,MAAMU,QAAuB;gBAAC;mBAAcR;aAAY;YAExD,yEAAyE;YACzE,8CAA8C;YAC9C,IAAI,CAACA,YAAYI,GAAG,CAAC,WAAWJ,YAAYI,GAAG,CAAC,QAAQ;gBACtDI,MAAMC,IAAI,CAAC;YACb;YAEA,wEAAwE;YACxE,oDAAoD;YACpD,MAAMC,UAAU;gBAAEC,OAAOH,MAAMI,IAAI,GAAGC,IAAI,CAAC;YAAM;YAEjD,oEAAoE;YACpE,kBAAkB;YAClBnB,QAAQoB,OAAO,GAAG,IAAM,IAAIC,SAAS,MAAM;oBAAEC,QAAQ;oBAAKN;gBAAQ;YAElE,mCAAmC;YACnCV,YAAYO,GAAG,CAAC;YAEhB;QACF;QAEA,MAAM,IAAIU,MACR,CAAC,0EAA0E,EAAEnB,OAAO,CAAC;IAEzF;IAEA,OAAOJ;AACT"}
|
||||
7
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.d.ts
generated
vendored
Normal file
7
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Cleans a URL by stripping the protocol, host, and search params.
|
||||
*
|
||||
* @param urlString the url to clean
|
||||
* @returns the cleaned url
|
||||
*/
|
||||
export declare function cleanURL(url: string | URL): URL;
|
||||
24
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.js
generated
vendored
Normal file
24
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Cleans a URL by stripping the protocol, host, and search params.
|
||||
*
|
||||
* @param urlString the url to clean
|
||||
* @returns the cleaned url
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "cleanURL", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return cleanURL;
|
||||
}
|
||||
});
|
||||
function cleanURL(url) {
|
||||
const u = new URL(url);
|
||||
u.host = "localhost:3000";
|
||||
u.search = "";
|
||||
u.protocol = "http";
|
||||
return u;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=clean-url.js.map
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/clean-url.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/clean-url.ts"],"names":["cleanURL","url","u","URL","host","search","protocol"],"mappings":"AAAA;;;;;CAKC;;;;+BAEeA;;;eAAAA;;;AAAT,SAASA,SAASC,GAAiB;IACxC,MAAMC,IAAI,IAAIC,IAAIF;IAClBC,EAAEE,IAAI,GAAG;IACTF,EAAEG,MAAM,GAAG;IACXH,EAAEI,QAAQ,GAAG;IACb,OAAOJ;AACT"}
|
||||
7
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.d.ts
generated
vendored
Normal file
7
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Get pathname from absolute path.
|
||||
*
|
||||
* @param absolutePath the absolute path
|
||||
* @returns the pathname
|
||||
*/
|
||||
export declare function getPathnameFromAbsolutePath(absolutePath: string): string;
|
||||
29
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.js
generated
vendored
Normal file
29
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Get pathname from absolute path.
|
||||
*
|
||||
* @param absolutePath the absolute path
|
||||
* @returns the pathname
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getPathnameFromAbsolutePath", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getPathnameFromAbsolutePath;
|
||||
}
|
||||
});
|
||||
function getPathnameFromAbsolutePath(absolutePath) {
|
||||
// Remove prefix including app dir
|
||||
let appDir = "/app/";
|
||||
if (!absolutePath.includes(appDir)) {
|
||||
appDir = "\\app\\";
|
||||
}
|
||||
const [, ...parts] = absolutePath.split(appDir);
|
||||
const relativePath = appDir[0] + parts.join(appDir);
|
||||
// remove extension
|
||||
const pathname = relativePath.split(".").slice(0, -1).join(".");
|
||||
return pathname;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-pathname-from-absolute-path.js.map
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/get-pathname-from-absolute-path.ts"],"names":["getPathnameFromAbsolutePath","absolutePath","appDir","includes","parts","split","relativePath","join","pathname","slice"],"mappings":"AAAA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,4BAA4BC,YAAoB;IAC9D,kCAAkC;IAClC,IAAIC,SAAS;IACb,IAAI,CAACD,aAAaE,QAAQ,CAACD,SAAS;QAClCA,SAAS;IACX;IACA,MAAM,GAAG,GAAGE,MAAM,GAAGH,aAAaI,KAAK,CAACH;IACxC,MAAMI,eAAeJ,MAAM,CAAC,EAAE,GAAGE,MAAMG,IAAI,CAACL;IAE5C,mBAAmB;IACnB,MAAMM,WAAWF,aAAaD,KAAK,CAAC,KAAKI,KAAK,CAAC,GAAG,CAAC,GAAGF,IAAI,CAAC;IAC3D,OAAOC;AACT"}
|
||||
9
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.d.ts
generated
vendored
Normal file
9
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
/**
|
||||
* Converts the query into params.
|
||||
*
|
||||
* @param query the query to convert to params
|
||||
* @returns the params
|
||||
*/
|
||||
export declare function parsedUrlQueryToParams(query: ParsedUrlQuery): Record<string, string | string[]>;
|
||||
20
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.js
generated
vendored
Normal file
20
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parsedUrlQueryToParams", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return parsedUrlQueryToParams;
|
||||
}
|
||||
});
|
||||
function parsedUrlQueryToParams(query) {
|
||||
const params = {};
|
||||
for (const [key, value] of Object.entries(query)){
|
||||
if (typeof value === "undefined") continue;
|
||||
params[key] = value;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parsed-url-query-to-params.js.map
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/parsed-url-query-to-params.ts"],"names":["parsedUrlQueryToParams","query","params","key","value","Object","entries"],"mappings":";;;;+BAQgBA;;;eAAAA;;;AAAT,SAASA,uBACdC,KAAqB;IAErB,MAAMC,SAA4C,CAAC;IAEnD,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,OAAQ;QAChD,IAAI,OAAOG,UAAU,aAAa;QAClCF,MAAM,CAACC,IAAI,GAAGC;IAChB;IAEA,OAAOF;AACT"}
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function resolveHandlerError(err: any): Response | false;
|
||||
32
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.js
generated
vendored
Normal file
32
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "resolveHandlerError", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return resolveHandlerError;
|
||||
}
|
||||
});
|
||||
const _notfound = require("../../../../../client/components/not-found");
|
||||
const _redirect = require("../../../../../client/components/redirect");
|
||||
const _responsehandlers = require("../../helpers/response-handlers");
|
||||
function resolveHandlerError(err) {
|
||||
if ((0, _redirect.isRedirectError)(err)) {
|
||||
const redirect = (0, _redirect.getURLFromRedirectError)(err);
|
||||
if (!redirect) {
|
||||
throw new Error("Invariant: Unexpected redirect url format");
|
||||
}
|
||||
const status = (0, _redirect.getRedirectStatusCodeFromError)(err);
|
||||
// This is a redirect error! Send the redirect response.
|
||||
return (0, _responsehandlers.handleRedirectResponse)(redirect, err.mutableCookies, status);
|
||||
}
|
||||
if ((0, _notfound.isNotFoundError)(err)) {
|
||||
// This is a not found error! Send the not found response.
|
||||
return (0, _responsehandlers.handleNotFoundResponse)();
|
||||
}
|
||||
// Return false to indicate that this is not a handled error.
|
||||
return false;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolve-handler-error.js.map
|
||||
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/future/route-modules/app-route/helpers/resolve-handler-error.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/server/future/route-modules/app-route/helpers/resolve-handler-error.ts"],"names":["resolveHandlerError","err","isRedirectError","redirect","getURLFromRedirectError","Error","status","getRedirectStatusCodeFromError","handleRedirectResponse","mutableCookies","isNotFoundError","handleNotFoundResponse"],"mappings":";;;;+BAWgBA;;;eAAAA;;;0BAXgB;0BAKzB;kCAIA;AAEA,SAASA,oBAAoBC,GAAQ;IAC1C,IAAIC,IAAAA,yBAAe,EAACD,MAAM;QACxB,MAAME,WAAWC,IAAAA,iCAAuB,EAACH;QACzC,IAAI,CAACE,UAAU;YACb,MAAM,IAAIE,MAAM;QAClB;QAEA,MAAMC,SAASC,IAAAA,wCAA8B,EAACN;QAE9C,wDAAwD;QACxD,OAAOO,IAAAA,wCAAsB,EAACL,UAAUF,IAAIQ,cAAc,EAAEH;IAC9D;IAEA,IAAII,IAAAA,yBAAe,EAACT,MAAM;QACxB,0DAA0D;QAC1D,OAAOU,IAAAA,wCAAsB;IAC/B;IAEA,6DAA6D;IAC7D,OAAO;AACT"}
|
||||
Reference in New Issue
Block a user