Initial commit
This commit is contained in:
31
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.d.ts
generated
vendored
Normal file
31
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { IncomingHttpHeaders } from 'node:http';
|
||||
import type { NextConfig } from '../../../server/config-shared';
|
||||
import { NextResponse } from '../../../server/web/exports';
|
||||
/**
|
||||
* Tests the logic of `headers`, `redirects`, and `rewrites` in `next.config.js`.
|
||||
* Given the provided next config, this function will return a `NextResponse`
|
||||
* with the result of running the request through the custom routes.
|
||||
*
|
||||
* @example Test whether a given URL results in a redirect.
|
||||
* ```
|
||||
* import { unstable_getResponseFromNextConfig, getRedirectUrl } from 'next/server/testing'
|
||||
* const response = await unstable_getResponseFromNextConfig({
|
||||
* url: 'https://nextjs.org/test',
|
||||
* nextConfig: {
|
||||
* async redirects() {
|
||||
* return [
|
||||
* { source: '/test', destination: '/test2', permanent: false },
|
||||
* ]
|
||||
* },
|
||||
* }
|
||||
* });
|
||||
* expect(response.status).toEqual(307);
|
||||
* expect(getRedirectUrl(response)).toEqual('https://nextjs.org/test2');
|
||||
* ```
|
||||
*/
|
||||
export declare function unstable_getResponseFromNextConfig({ url, nextConfig, headers, cookies, }: {
|
||||
url: string;
|
||||
nextConfig: NextConfig;
|
||||
headers?: IncomingHttpHeaders;
|
||||
cookies?: Record<string, string>;
|
||||
}): Promise<NextResponse>;
|
||||
118
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.js
generated
vendored
Normal file
118
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_getResponseFromNextConfig", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return unstable_getResponseFromNextConfig;
|
||||
}
|
||||
});
|
||||
const _nodeurl = require("node:url");
|
||||
const _pathtoregexp = require("next/dist/compiled/path-to-regexp");
|
||||
const _preparedestination = require("../../../shared/lib/router/utils/prepare-destination");
|
||||
const _buildcustomroute = require("../../../lib/build-custom-route");
|
||||
const _loadcustomroutes = /*#__PURE__*/ _interop_require_default(require("../../../lib/load-custom-routes"));
|
||||
const _exports = require("../../../server/web/exports");
|
||||
const _redirectstatus = require("../../../lib/redirect-status");
|
||||
const _utils = require("./utils");
|
||||
const _parsedurlquerytoparams = require("../../../server/route-modules/app-route/helpers/parsed-url-query-to-params");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Tries to match the current request against the provided route. If there is
|
||||
* a match, it returns the params extracted from the path. If not, it returns
|
||||
* undefined.
|
||||
*/ function matchRoute(route, request, parsedUrl) {
|
||||
const pathname = parsedUrl.pathname;
|
||||
if (!pathname) {
|
||||
return;
|
||||
}
|
||||
const regexMatches = pathname == null ? void 0 : pathname.match(route.regex);
|
||||
if (regexMatches) {
|
||||
const pathMatch = (0, _pathtoregexp.match)(route.source)(pathname);
|
||||
if (!pathMatch) {
|
||||
throw Object.defineProperty(new Error('Unexpected error: extracting params from path failed but the regular expression matched'), "__NEXT_ERROR_CODE", {
|
||||
value: "E289",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (route.has || route.missing) {
|
||||
if (!(0, _preparedestination.matchHas)(request, parsedUrl.query, route.has, route.missing)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return pathMatch.params;
|
||||
}
|
||||
}
|
||||
async function unstable_getResponseFromNextConfig({ url, nextConfig, headers = {}, cookies = {} }) {
|
||||
const parsedUrl = (0, _nodeurl.parse)(url, true);
|
||||
const request = (0, _utils.constructRequest)({
|
||||
url,
|
||||
headers,
|
||||
cookies
|
||||
});
|
||||
const routes = await (0, _loadcustomroutes.default)(nextConfig);
|
||||
const headerRoutes = routes.headers.map((route)=>(0, _buildcustomroute.buildCustomRoute)('header', route));
|
||||
const redirectRoutes = routes.redirects.map((route)=>(0, _buildcustomroute.buildCustomRoute)('redirect', route, [
|
||||
'/_next/'
|
||||
]));
|
||||
const rewriteRoutes = [
|
||||
...routes.rewrites.beforeFiles,
|
||||
...routes.rewrites.afterFiles,
|
||||
...routes.rewrites.fallback
|
||||
].map((route)=>(0, _buildcustomroute.buildCustomRoute)('rewrite', route));
|
||||
const respHeaders = {};
|
||||
for (const route of headerRoutes){
|
||||
const matched = matchRoute(route, request, parsedUrl);
|
||||
if (matched) {
|
||||
for (const header of route.headers){
|
||||
respHeaders[header.key] = header.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
function matchRouteAndGetDestination(route) {
|
||||
const params = matchRoute(route, request, parsedUrl);
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
const { newUrl, parsedDestination } = (0, _preparedestination.prepareDestination)({
|
||||
appendParamsToQuery: false,
|
||||
destination: route.destination,
|
||||
params,
|
||||
query: parsedUrl.query
|
||||
});
|
||||
const searchParams = new URLSearchParams((0, _parsedurlquerytoparams.parsedUrlQueryToParams)(parsedDestination.query));
|
||||
return new URL(searchParams.size > 0 ? `${newUrl}?${searchParams.toString()}` : newUrl, parsedDestination.hostname ? `${parsedDestination.protocol}//${parsedDestination.hostname}` : parsedUrl.host ? `${parsedUrl.protocol}//${parsedUrl.host}` : 'https://example.com');
|
||||
}
|
||||
for (const route of redirectRoutes){
|
||||
const redirectUrl = matchRouteAndGetDestination(route);
|
||||
if (!redirectUrl) {
|
||||
continue;
|
||||
}
|
||||
const statusCode = (0, _redirectstatus.getRedirectStatus)(route);
|
||||
return _exports.NextResponse.redirect(redirectUrl, {
|
||||
status: statusCode,
|
||||
headers: respHeaders
|
||||
});
|
||||
}
|
||||
for (const route of rewriteRoutes){
|
||||
const rewriteUrl = matchRouteAndGetDestination(route);
|
||||
if (!rewriteUrl) {
|
||||
continue;
|
||||
}
|
||||
return _exports.NextResponse.rewrite(rewriteUrl, {
|
||||
headers: respHeaders
|
||||
});
|
||||
}
|
||||
return new _exports.NextResponse('', {
|
||||
status: 200,
|
||||
headers: respHeaders
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=config-testing-utils.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/config-testing-utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.d.ts
generated
vendored
Normal file
3
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './config-testing-utils';
|
||||
export * from './middleware-testing-utils';
|
||||
export { getRedirectUrl, getRewrittenUrl, isRewrite } from './utils';
|
||||
45
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.js
generated
vendored
Normal file
45
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getRedirectUrl: null,
|
||||
getRewrittenUrl: null,
|
||||
isRewrite: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getRedirectUrl: function() {
|
||||
return _utils.getRedirectUrl;
|
||||
},
|
||||
getRewrittenUrl: function() {
|
||||
return _utils.getRewrittenUrl;
|
||||
},
|
||||
isRewrite: function() {
|
||||
return _utils.isRewrite;
|
||||
}
|
||||
});
|
||||
0 && __export(require("./config-testing-utils")) && __export(require("./middleware-testing-utils"));
|
||||
_export_star(require("./config-testing-utils"), exports);
|
||||
_export_star(require("./middleware-testing-utils"), exports);
|
||||
const _utils = require("./utils");
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testing/server/index.ts"],"sourcesContent":["export * from './config-testing-utils'\nexport * from './middleware-testing-utils'\nexport { getRedirectUrl, getRewrittenUrl, isRewrite } from './utils'\n"],"names":["getRedirectUrl","getRewrittenUrl","isRewrite"],"mappings":";;;;;;;;;;;;;;;;IAESA,cAAc;eAAdA,qBAAc;;IAAEC,eAAe;eAAfA,sBAAe;;IAAEC,SAAS;eAATA,gBAAS;;;;qBAFrC;qBACA;uBAC6C"}
|
||||
19
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.d.ts
generated
vendored
Normal file
19
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
import type { NextConfig } from '../../../server/config-shared';
|
||||
import type { MiddlewareConfigMatcherInput } from '../../../build/segment-config/middleware/middleware-config';
|
||||
export interface MiddlewareSourceConfig {
|
||||
matcher?: MiddlewareConfigMatcherInput;
|
||||
}
|
||||
/**
|
||||
* Checks whether the middleware config will match the provide URL and request
|
||||
* information such as headers and cookies. This function is useful for
|
||||
* unit tests to assert that middleware is matching (and therefore executing)
|
||||
* only when it should be.
|
||||
*/
|
||||
export declare function unstable_doesMiddlewareMatch({ config, url, headers, cookies, nextConfig, }: {
|
||||
config: MiddlewareSourceConfig;
|
||||
url: string;
|
||||
headers?: IncomingHttpHeaders;
|
||||
cookies?: Record<string, string>;
|
||||
nextConfig?: NextConfig;
|
||||
}): boolean;
|
||||
30
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js
generated
vendored
Normal file
30
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_doesMiddlewareMatch", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return unstable_doesMiddlewareMatch;
|
||||
}
|
||||
});
|
||||
const _getpagestaticinfo = require("../../../build/analysis/get-page-static-info");
|
||||
const _middlewareroutematcher = require("../../../shared/lib/router/utils/middleware-route-matcher");
|
||||
const _url = require("../../../lib/url");
|
||||
const _utils = require("./utils");
|
||||
function unstable_doesMiddlewareMatch({ config, url, headers, cookies, nextConfig }) {
|
||||
if (!config.matcher) {
|
||||
return true;
|
||||
}
|
||||
const matchers = (0, _getpagestaticinfo.getMiddlewareMatchers)(config.matcher, nextConfig ?? {});
|
||||
const routeMatchFn = (0, _middlewareroutematcher.getMiddlewareRouteMatcher)(matchers);
|
||||
const { pathname, searchParams = new URLSearchParams() } = (0, _url.parseUrl)(url) || {};
|
||||
const request = (0, _utils.constructRequest)({
|
||||
url,
|
||||
headers,
|
||||
cookies
|
||||
});
|
||||
return routeMatchFn(pathname, request, Object.fromEntries(searchParams));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=middleware-testing-utils.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testing/server/middleware-testing-utils.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'http'\nimport { getMiddlewareMatchers } from '../../../build/analysis/get-page-static-info'\nimport { getMiddlewareRouteMatcher } from '../../../shared/lib/router/utils/middleware-route-matcher'\nimport type { NextConfig } from '../../../server/config-shared'\nimport { parseUrl } from '../../../lib/url'\nimport { constructRequest } from './utils'\nimport type { MiddlewareConfigMatcherInput } from '../../../build/segment-config/middleware/middleware-config'\n\nexport interface MiddlewareSourceConfig {\n matcher?: MiddlewareConfigMatcherInput\n}\n\n/**\n * Checks whether the middleware config will match the provide URL and request\n * information such as headers and cookies. This function is useful for\n * unit tests to assert that middleware is matching (and therefore executing)\n * only when it should be.\n */\nexport function unstable_doesMiddlewareMatch({\n config,\n url,\n headers,\n cookies,\n nextConfig,\n}: {\n config: MiddlewareSourceConfig\n url: string\n headers?: IncomingHttpHeaders\n cookies?: Record<string, string>\n nextConfig?: NextConfig\n}): boolean {\n if (!config.matcher) {\n return true\n }\n const matchers = getMiddlewareMatchers(config.matcher, nextConfig ?? {})\n const routeMatchFn = getMiddlewareRouteMatcher(matchers)\n const { pathname, searchParams = new URLSearchParams() } = parseUrl(url) || {}\n const request = constructRequest({ url, headers, cookies })\n return routeMatchFn(pathname, request, Object.fromEntries(searchParams))\n}\n"],"names":["unstable_doesMiddlewareMatch","config","url","headers","cookies","nextConfig","matcher","matchers","getMiddlewareMatchers","routeMatchFn","getMiddlewareRouteMatcher","pathname","searchParams","URLSearchParams","parseUrl","request","constructRequest","Object","fromEntries"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;mCAjBsB;wCACI;qBAEjB;uBACQ;AAa1B,SAASA,6BAA6B,EAC3CC,MAAM,EACNC,GAAG,EACHC,OAAO,EACPC,OAAO,EACPC,UAAU,EAOX;IACC,IAAI,CAACJ,OAAOK,OAAO,EAAE;QACnB,OAAO;IACT;IACA,MAAMC,WAAWC,IAAAA,wCAAqB,EAACP,OAAOK,OAAO,EAAED,cAAc,CAAC;IACtE,MAAMI,eAAeC,IAAAA,iDAAyB,EAACH;IAC/C,MAAM,EAAEI,QAAQ,EAAEC,eAAe,IAAIC,iBAAiB,EAAE,GAAGC,IAAAA,aAAQ,EAACZ,QAAQ,CAAC;IAC7E,MAAMa,UAAUC,IAAAA,uBAAgB,EAAC;QAAEd;QAAKC;QAASC;IAAQ;IACzD,OAAOK,aAAaE,UAAUI,SAASE,OAAOC,WAAW,CAACN;AAC5D"}
|
||||
23
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.d.ts
generated
vendored
Normal file
23
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
import type { BaseNextRequest } from '../../../server/base-http';
|
||||
import type { NextResponse } from '../../../server/web/exports';
|
||||
export declare function constructRequest({ url, headers, cookies, }: {
|
||||
url: string;
|
||||
headers?: IncomingHttpHeaders;
|
||||
cookies?: Record<string, string>;
|
||||
}): BaseNextRequest;
|
||||
/**
|
||||
* Returns the URL of the redirect if the response is a redirect response or
|
||||
* returns null if the response is not.
|
||||
*/
|
||||
export declare function getRedirectUrl(response: NextResponse): string | null;
|
||||
/**
|
||||
* Checks whether the provided response is a rewrite response to a different
|
||||
* URL.
|
||||
*/
|
||||
export declare function isRewrite(response: NextResponse): boolean;
|
||||
/**
|
||||
* Returns the URL of the response rewrite if the response is a rewrite, or
|
||||
* returns null if the response is not.
|
||||
*/
|
||||
export declare function getRewrittenUrl(response: NextResponse): string | null;
|
||||
64
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.js
generated
vendored
Normal file
64
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
constructRequest: null,
|
||||
getRedirectUrl: null,
|
||||
getRewrittenUrl: null,
|
||||
isRewrite: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
constructRequest: function() {
|
||||
return constructRequest;
|
||||
},
|
||||
getRedirectUrl: function() {
|
||||
return getRedirectUrl;
|
||||
},
|
||||
getRewrittenUrl: function() {
|
||||
return getRewrittenUrl;
|
||||
},
|
||||
isRewrite: function() {
|
||||
return isRewrite;
|
||||
}
|
||||
});
|
||||
const _mockrequest = require("../../../server/lib/mock-request");
|
||||
const _node = require("../../../server/base-http/node");
|
||||
const _url = require("../../../lib/url");
|
||||
function constructRequest({ url, headers = {}, cookies = {} }) {
|
||||
if (!headers) {
|
||||
headers = {};
|
||||
}
|
||||
if (!headers.host) {
|
||||
var _parseUrl;
|
||||
headers.host = (_parseUrl = (0, _url.parseUrl)(url)) == null ? void 0 : _parseUrl.host;
|
||||
}
|
||||
if (cookies) {
|
||||
headers = {
|
||||
...headers,
|
||||
cookie: Object.entries(cookies).map(([name, value])=>`${name}=${value}`).join(';')
|
||||
};
|
||||
}
|
||||
return new _node.NodeNextRequest(new _mockrequest.MockedRequest({
|
||||
url,
|
||||
headers,
|
||||
method: 'GET'
|
||||
}));
|
||||
}
|
||||
function getRedirectUrl(response) {
|
||||
return response.headers.get('location');
|
||||
}
|
||||
function isRewrite(response) {
|
||||
return Boolean(getRewrittenUrl(response));
|
||||
}
|
||||
function getRewrittenUrl(response) {
|
||||
return response.headers.get('x-middleware-rewrite');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testing/server/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testing/server/utils.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'http'\nimport { MockedRequest } from '../../../server/lib/mock-request'\nimport { NodeNextRequest } from '../../../server/base-http/node'\nimport type { BaseNextRequest } from '../../../server/base-http'\nimport type { NextResponse } from '../../../server/web/exports'\nimport { parseUrl } from '../../../lib/url'\n\nexport function constructRequest({\n url,\n headers = {},\n cookies = {},\n}: {\n url: string\n headers?: IncomingHttpHeaders\n cookies?: Record<string, string>\n}): BaseNextRequest {\n if (!headers) {\n headers = {}\n }\n if (!headers.host) {\n headers.host = parseUrl(url)?.host\n }\n if (cookies) {\n headers = {\n ...headers,\n cookie: Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join(';'),\n }\n }\n return new NodeNextRequest(new MockedRequest({ url, headers, method: 'GET' }))\n}\n\n/**\n * Returns the URL of the redirect if the response is a redirect response or\n * returns null if the response is not.\n */\nexport function getRedirectUrl(response: NextResponse): string | null {\n return response.headers.get('location')\n}\n\n/**\n * Checks whether the provided response is a rewrite response to a different\n * URL.\n */\nexport function isRewrite(response: NextResponse): boolean {\n return Boolean(getRewrittenUrl(response))\n}\n\n/**\n * Returns the URL of the response rewrite if the response is a rewrite, or\n * returns null if the response is not.\n */\nexport function getRewrittenUrl(response: NextResponse): string | null {\n return response.headers.get('x-middleware-rewrite')\n}\n"],"names":["constructRequest","getRedirectUrl","getRewrittenUrl","isRewrite","url","headers","cookies","host","parseUrl","cookie","Object","entries","map","name","value","join","NodeNextRequest","MockedRequest","method","response","get","Boolean"],"mappings":";;;;;;;;;;;;;;;;;IAOgBA,gBAAgB;eAAhBA;;IA8BAC,cAAc;eAAdA;;IAgBAC,eAAe;eAAfA;;IARAC,SAAS;eAATA;;;6BA5Cc;sBACE;qBAGP;AAElB,SAASH,iBAAiB,EAC/BI,GAAG,EACHC,UAAU,CAAC,CAAC,EACZC,UAAU,CAAC,CAAC,EAKb;IACC,IAAI,CAACD,SAAS;QACZA,UAAU,CAAC;IACb;IACA,IAAI,CAACA,QAAQE,IAAI,EAAE;YACFC;QAAfH,QAAQE,IAAI,IAAGC,YAAAA,IAAAA,aAAQ,EAACJ,yBAATI,UAAeD,IAAI;IACpC;IACA,IAAID,SAAS;QACXD,UAAU;YACR,GAAGA,OAAO;YACVI,QAAQC,OAAOC,OAAO,CAACL,SACpBM,GAAG,CAAC,CAAC,CAACC,MAAMC,MAAM,GAAK,GAAGD,KAAK,CAAC,EAAEC,OAAO,EACzCC,IAAI,CAAC;QACV;IACF;IACA,OAAO,IAAIC,qBAAe,CAAC,IAAIC,0BAAa,CAAC;QAAEb;QAAKC;QAASa,QAAQ;IAAM;AAC7E;AAMO,SAASjB,eAAekB,QAAsB;IACnD,OAAOA,SAASd,OAAO,CAACe,GAAG,CAAC;AAC9B;AAMO,SAASjB,UAAUgB,QAAsB;IAC9C,OAAOE,QAAQnB,gBAAgBiB;AACjC;AAMO,SAASjB,gBAAgBiB,QAAsB;IACpD,OAAOA,SAASd,OAAO,CAACe,GAAG,CAAC;AAC9B"}
|
||||
11
frontend/webapp/node_modules/next/dist/experimental/testmode/context.d.ts
generated
vendored
Normal file
11
frontend/webapp/node_modules/next/dist/experimental/testmode/context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface TestReqInfo {
|
||||
url: string;
|
||||
proxyPort: number;
|
||||
testData: string;
|
||||
}
|
||||
export interface TestRequestReader<R> {
|
||||
url(req: R): string;
|
||||
header(req: R, name: string): string | null;
|
||||
}
|
||||
export declare function withRequest<R, T>(req: R, reader: TestRequestReader<R>, fn: () => T): T;
|
||||
export declare function getTestReqInfo<R>(req?: R, reader?: TestRequestReader<R>): TestReqInfo | undefined;
|
||||
57
frontend/webapp/node_modules/next/dist/experimental/testmode/context.js
generated
vendored
Normal file
57
frontend/webapp/node_modules/next/dist/experimental/testmode/context.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getTestReqInfo: null,
|
||||
withRequest: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getTestReqInfo: function() {
|
||||
return getTestReqInfo;
|
||||
},
|
||||
withRequest: function() {
|
||||
return withRequest;
|
||||
}
|
||||
});
|
||||
const _nodeasync_hooks = require("node:async_hooks");
|
||||
const testStorage = new _nodeasync_hooks.AsyncLocalStorage();
|
||||
function extractTestInfoFromRequest(req, reader) {
|
||||
const proxyPortHeader = reader.header(req, 'next-test-proxy-port');
|
||||
if (!proxyPortHeader) {
|
||||
return undefined;
|
||||
}
|
||||
const url = reader.url(req);
|
||||
const proxyPort = Number(proxyPortHeader);
|
||||
const testData = reader.header(req, 'next-test-data') || '';
|
||||
return {
|
||||
url,
|
||||
proxyPort,
|
||||
testData
|
||||
};
|
||||
}
|
||||
function withRequest(req, reader, fn) {
|
||||
const testReqInfo = extractTestInfoFromRequest(req, reader);
|
||||
if (!testReqInfo) {
|
||||
return fn();
|
||||
}
|
||||
return testStorage.run(testReqInfo, fn);
|
||||
}
|
||||
function getTestReqInfo(req, reader) {
|
||||
const testReqInfo = testStorage.getStore();
|
||||
if (testReqInfo) {
|
||||
return testReqInfo;
|
||||
}
|
||||
if (req && reader) {
|
||||
return extractTestInfoFromRequest(req, reader);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=context.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/context.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/context.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/experimental/testmode/context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\n\nexport interface TestReqInfo {\n url: string\n proxyPort: number\n testData: string\n}\n\nexport interface TestRequestReader<R> {\n url(req: R): string\n header(req: R, name: string): string | null\n}\n\nconst testStorage = new AsyncLocalStorage<TestReqInfo>()\n\nfunction extractTestInfoFromRequest<R>(\n req: R,\n reader: TestRequestReader<R>\n): TestReqInfo | undefined {\n const proxyPortHeader = reader.header(req, 'next-test-proxy-port')\n if (!proxyPortHeader) {\n return undefined\n }\n const url = reader.url(req)\n const proxyPort = Number(proxyPortHeader)\n const testData = reader.header(req, 'next-test-data') || ''\n return { url, proxyPort, testData }\n}\n\nexport function withRequest<R, T>(\n req: R,\n reader: TestRequestReader<R>,\n fn: () => T\n): T {\n const testReqInfo = extractTestInfoFromRequest(req, reader)\n if (!testReqInfo) {\n return fn()\n }\n return testStorage.run(testReqInfo, fn)\n}\n\nexport function getTestReqInfo<R>(\n req?: R,\n reader?: TestRequestReader<R>\n): TestReqInfo | undefined {\n const testReqInfo = testStorage.getStore()\n if (testReqInfo) {\n return testReqInfo\n }\n if (req && reader) {\n return extractTestInfoFromRequest(req, reader)\n }\n return undefined\n}\n"],"names":["getTestReqInfo","withRequest","testStorage","AsyncLocalStorage","extractTestInfoFromRequest","req","reader","proxyPortHeader","header","undefined","url","proxyPort","Number","testData","fn","testReqInfo","run","getStore"],"mappings":";;;;;;;;;;;;;;;IAyCgBA,cAAc;eAAdA;;IAZAC,WAAW;eAAXA;;;iCA7BkB;AAalC,MAAMC,cAAc,IAAIC,kCAAiB;AAEzC,SAASC,2BACPC,GAAM,EACNC,MAA4B;IAE5B,MAAMC,kBAAkBD,OAAOE,MAAM,CAACH,KAAK;IAC3C,IAAI,CAACE,iBAAiB;QACpB,OAAOE;IACT;IACA,MAAMC,MAAMJ,OAAOI,GAAG,CAACL;IACvB,MAAMM,YAAYC,OAAOL;IACzB,MAAMM,WAAWP,OAAOE,MAAM,CAACH,KAAK,qBAAqB;IACzD,OAAO;QAAEK;QAAKC;QAAWE;IAAS;AACpC;AAEO,SAASZ,YACdI,GAAM,EACNC,MAA4B,EAC5BQ,EAAW;IAEX,MAAMC,cAAcX,2BAA2BC,KAAKC;IACpD,IAAI,CAACS,aAAa;QAChB,OAAOD;IACT;IACA,OAAOZ,YAAYc,GAAG,CAACD,aAAaD;AACtC;AAEO,SAASd,eACdK,GAAO,EACPC,MAA6B;IAE7B,MAAMS,cAAcb,YAAYe,QAAQ;IACxC,IAAIF,aAAa;QACf,OAAOA;IACT;IACA,IAAIV,OAAOC,QAAQ;QACjB,OAAOF,2BAA2BC,KAAKC;IACzC;IACA,OAAOG;AACT"}
|
||||
6
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.d.ts
generated
vendored
Normal file
6
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { type TestRequestReader } from './context';
|
||||
type Fetch = typeof fetch;
|
||||
export declare const reader: TestRequestReader<Request>;
|
||||
export declare function handleFetch(originalFetch: Fetch, request: Request): Promise<Response>;
|
||||
export declare function interceptFetch(originalFetch: Fetch): () => void;
|
||||
export {};
|
||||
141
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.js
generated
vendored
Normal file
141
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
handleFetch: null,
|
||||
interceptFetch: null,
|
||||
reader: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
handleFetch: function() {
|
||||
return handleFetch;
|
||||
},
|
||||
interceptFetch: function() {
|
||||
return interceptFetch;
|
||||
},
|
||||
reader: function() {
|
||||
return reader;
|
||||
}
|
||||
});
|
||||
const _context = require("./context");
|
||||
const reader = {
|
||||
url (req) {
|
||||
return req.url;
|
||||
},
|
||||
header (req, name) {
|
||||
return req.headers.get(name);
|
||||
}
|
||||
};
|
||||
function getTestStack() {
|
||||
let stack = (new Error().stack ?? '').split('\n');
|
||||
// Skip the first line and find first non-empty line.
|
||||
for(let i = 1; i < stack.length; i++){
|
||||
if (stack[i].length > 0) {
|
||||
stack = stack.slice(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Filter out franmework lines.
|
||||
stack = stack.filter((f)=>!f.includes('/next/dist/'));
|
||||
// At most 5 lines.
|
||||
stack = stack.slice(0, 5);
|
||||
// Cleanup some internal info and trim.
|
||||
stack = stack.map((s)=>s.replace('webpack-internal:///(rsc)/', '').trim());
|
||||
return stack.join(' ');
|
||||
}
|
||||
async function buildProxyRequest(testData, request) {
|
||||
const { url, method, headers, body, cache, credentials, integrity, mode, redirect, referrer, referrerPolicy } = request;
|
||||
return {
|
||||
testData,
|
||||
api: 'fetch',
|
||||
request: {
|
||||
url,
|
||||
method,
|
||||
headers: [
|
||||
...Array.from(headers),
|
||||
[
|
||||
'next-test-stack',
|
||||
getTestStack()
|
||||
]
|
||||
],
|
||||
body: body ? Buffer.from(await request.arrayBuffer()).toString('base64') : null,
|
||||
cache,
|
||||
credentials,
|
||||
integrity,
|
||||
mode,
|
||||
redirect,
|
||||
referrer,
|
||||
referrerPolicy
|
||||
}
|
||||
};
|
||||
}
|
||||
function buildResponse(proxyResponse) {
|
||||
const { status, headers, body } = proxyResponse.response;
|
||||
return new Response(body ? Buffer.from(body, 'base64') : null, {
|
||||
status,
|
||||
headers: new Headers(headers)
|
||||
});
|
||||
}
|
||||
async function handleFetch(originalFetch, request) {
|
||||
const testInfo = (0, _context.getTestReqInfo)(request, reader);
|
||||
if (!testInfo) {
|
||||
// Passthrough non-test requests.
|
||||
return originalFetch(request);
|
||||
}
|
||||
const { testData, proxyPort } = testInfo;
|
||||
const proxyRequest = await buildProxyRequest(testData, request);
|
||||
const resp = await originalFetch(`http://localhost:${proxyPort}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(proxyRequest),
|
||||
next: {
|
||||
// @ts-ignore
|
||||
internal: true
|
||||
}
|
||||
});
|
||||
if (!resp.ok) {
|
||||
throw Object.defineProperty(new Error(`Proxy request failed: ${resp.status}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E146",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const proxyResponse = await resp.json();
|
||||
const { api } = proxyResponse;
|
||||
switch(api){
|
||||
case 'continue':
|
||||
return originalFetch(request);
|
||||
case 'abort':
|
||||
case 'unhandled':
|
||||
throw Object.defineProperty(new Error(`Proxy request aborted [${request.method} ${request.url}]`), "__NEXT_ERROR_CODE", {
|
||||
value: "E145",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return buildResponse(proxyResponse);
|
||||
}
|
||||
function interceptFetch(originalFetch) {
|
||||
global.fetch = function testFetch(input, init) {
|
||||
var _init_next;
|
||||
// Passthrough internal requests.
|
||||
// @ts-ignore
|
||||
if (init == null ? void 0 : (_init_next = init.next) == null ? void 0 : _init_next.internal) {
|
||||
return originalFetch(input, init);
|
||||
}
|
||||
return handleFetch(originalFetch, new Request(input, init));
|
||||
};
|
||||
return ()=>{
|
||||
global.fetch = originalFetch;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/fetch.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.d.ts
generated
vendored
Normal file
3
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
type Fetch = typeof fetch;
|
||||
export declare function interceptHttpGet(originalFetch: Fetch): () => void;
|
||||
export {};
|
||||
26
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.js
generated
vendored
Normal file
26
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "interceptHttpGet", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return interceptHttpGet;
|
||||
}
|
||||
});
|
||||
const _ClientRequest = require("next/dist/compiled/@mswjs/interceptors/ClientRequest");
|
||||
const _fetch = require("./fetch");
|
||||
function interceptHttpGet(originalFetch) {
|
||||
const clientRequestInterceptor = new _ClientRequest.ClientRequestInterceptor();
|
||||
clientRequestInterceptor.on('request', async ({ request })=>{
|
||||
const response = await (0, _fetch.handleFetch)(originalFetch, request);
|
||||
request.respondWith(response);
|
||||
});
|
||||
clientRequestInterceptor.apply();
|
||||
// Cleanup.
|
||||
return ()=>{
|
||||
clientRequestInterceptor.dispose();
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=httpget.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/httpget.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/experimental/testmode/httpget.ts"],"sourcesContent":["import { ClientRequestInterceptor } from 'next/dist/compiled/@mswjs/interceptors/ClientRequest'\nimport { handleFetch } from './fetch'\n\ntype Fetch = typeof fetch\n\nexport function interceptHttpGet(originalFetch: Fetch): () => void {\n const clientRequestInterceptor = new ClientRequestInterceptor()\n clientRequestInterceptor.on('request', async ({ request }) => {\n const response = await handleFetch(originalFetch, request)\n request.respondWith(response)\n })\n clientRequestInterceptor.apply()\n\n // Cleanup.\n return () => {\n clientRequestInterceptor.dispose()\n }\n}\n"],"names":["interceptHttpGet","originalFetch","clientRequestInterceptor","ClientRequestInterceptor","on","request","response","handleFetch","respondWith","apply","dispose"],"mappings":";;;;+BAKgBA;;;eAAAA;;;+BALyB;uBACb;AAIrB,SAASA,iBAAiBC,aAAoB;IACnD,MAAMC,2BAA2B,IAAIC,uCAAwB;IAC7DD,yBAAyBE,EAAE,CAAC,WAAW,OAAO,EAAEC,OAAO,EAAE;QACvD,MAAMC,WAAW,MAAMC,IAAAA,kBAAW,EAACN,eAAeI;QAClDA,QAAQG,WAAW,CAACF;IACtB;IACAJ,yBAAyBO,KAAK;IAE9B,WAAW;IACX,OAAO;QACLP,yBAAyBQ,OAAO;IAClC;AACF"}
|
||||
10
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.d.ts
generated
vendored
Normal file
10
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { type PlaywrightTestConfig } from '@playwright/test';
|
||||
import type { NextOptionsConfig } from './next-options';
|
||||
/**
|
||||
* This is the default configuration generated by Playwright as of v1.43.0 with some modifications.
|
||||
*
|
||||
* - the `testMatch` property is configured to match all `*.spec.js` or `*.spec.ts` files within the `app` and `pages` directories
|
||||
* - the `use` property is configured with a baseURL matching the expected dev server endpoint (http://127.0.0.1:3000)
|
||||
* - the `webserver` property is configured to run `next dev`.
|
||||
*/
|
||||
export declare const defaultPlaywrightConfig: PlaywrightTestConfig<NextOptionsConfig>;
|
||||
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.js
generated
vendored
Normal file
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "defaultPlaywrightConfig", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return defaultPlaywrightConfig;
|
||||
}
|
||||
});
|
||||
const _test = require("@playwright/test");
|
||||
const defaultPlaywrightConfig = {
|
||||
testMatch: '{app,pages}/**/*.spec.{t,j}s',
|
||||
fullyParallel: true,
|
||||
forbidOnly: process.env.CI === 'true',
|
||||
retries: process.env.CI === 'true' ? 2 : 0,
|
||||
reporter: [
|
||||
[
|
||||
'list'
|
||||
],
|
||||
[
|
||||
'html',
|
||||
{
|
||||
open: 'never'
|
||||
}
|
||||
]
|
||||
],
|
||||
use: {
|
||||
baseURL: 'http://127.0.0.1:3000',
|
||||
trace: 'on-first-retry'
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
..._test.devices['Desktop Chrome']
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
..._test.devices['Desktop Firefox']
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
..._test.devices['Desktop Safari']
|
||||
}
|
||||
}
|
||||
],
|
||||
webServer: {
|
||||
command: process.env.CI === 'true' ? 'next start' : 'next dev',
|
||||
url: 'http://127.0.0.1:3000',
|
||||
reuseExistingServer: process.env.CI !== 'true'
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=default-config.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/default-config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/default-config.ts"],"sourcesContent":["import { devices, type PlaywrightTestConfig } from '@playwright/test'\nimport type { NextOptionsConfig } from './next-options'\n\n/**\n * This is the default configuration generated by Playwright as of v1.43.0 with some modifications.\n *\n * - the `testMatch` property is configured to match all `*.spec.js` or `*.spec.ts` files within the `app` and `pages` directories\n * - the `use` property is configured with a baseURL matching the expected dev server endpoint (http://127.0.0.1:3000)\n * - the `webserver` property is configured to run `next dev`.\n */\nexport const defaultPlaywrightConfig: PlaywrightTestConfig<NextOptionsConfig> =\n {\n testMatch: '{app,pages}/**/*.spec.{t,j}s',\n fullyParallel: true,\n forbidOnly: process.env.CI === 'true',\n retries: process.env.CI === 'true' ? 2 : 0,\n reporter: [['list'], ['html', { open: 'never' }]],\n use: {\n baseURL: 'http://127.0.0.1:3000',\n trace: 'on-first-retry',\n },\n projects: [\n {\n name: 'chromium',\n use: { ...devices['Desktop Chrome'] },\n },\n\n {\n name: 'firefox',\n use: { ...devices['Desktop Firefox'] },\n },\n\n {\n name: 'webkit',\n use: { ...devices['Desktop Safari'] },\n },\n ],\n webServer: {\n command: process.env.CI === 'true' ? 'next start' : 'next dev',\n url: 'http://127.0.0.1:3000',\n reuseExistingServer: process.env.CI !== 'true',\n },\n }\n"],"names":["defaultPlaywrightConfig","testMatch","fullyParallel","forbidOnly","process","env","CI","retries","reporter","open","use","baseURL","trace","projects","name","devices","webServer","command","url","reuseExistingServer"],"mappings":";;;;+BAUaA;;;eAAAA;;;sBAVsC;AAU5C,MAAMA,0BACX;IACEC,WAAW;IACXC,eAAe;IACfC,YAAYC,QAAQC,GAAG,CAACC,EAAE,KAAK;IAC/BC,SAASH,QAAQC,GAAG,CAACC,EAAE,KAAK,SAAS,IAAI;IACzCE,UAAU;QAAC;YAAC;SAAO;QAAE;YAAC;YAAQ;gBAAEC,MAAM;YAAQ;SAAE;KAAC;IACjDC,KAAK;QACHC,SAAS;QACTC,OAAO;IACT;IACAC,UAAU;QACR;YACEC,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,iBAAiB;YAAC;QACtC;QAEA;YACED,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,kBAAkB;YAAC;QACvC;QAEA;YACED,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,iBAAiB;YAAC;QACtC;KACD;IACDC,WAAW;QACTC,SAASb,QAAQC,GAAG,CAACC,EAAE,KAAK,SAAS,eAAe;QACpDY,KAAK;QACLC,qBAAqBf,QAAQC,GAAG,CAACC,EAAE,KAAK;IAC1C;AACF"}
|
||||
17
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.d.ts
generated
vendored
Normal file
17
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as base from '@playwright/test';
|
||||
import type { NextFixture } from './next-fixture';
|
||||
import type { NextOptions, NextOptionsConfig } from './next-options';
|
||||
import type { NextWorkerFixture } from './next-worker-fixture';
|
||||
import { defaultPlaywrightConfig } from './default-config';
|
||||
export { defaultPlaywrightConfig };
|
||||
export * from '@playwright/test';
|
||||
export declare function defineConfig<T extends NextOptionsConfig, W>(config: base.PlaywrightTestConfig<T, W>): base.PlaywrightTestConfig<T, W>;
|
||||
export type { NextFixture, NextOptions };
|
||||
export type { FetchHandlerResult } from '../proxy';
|
||||
export declare const test: base.TestType<base.PlaywrightTestArgs & base.PlaywrightTestOptions & {
|
||||
next: NextFixture;
|
||||
nextOptions: NextOptions;
|
||||
}, base.PlaywrightWorkerArgs & base.PlaywrightWorkerOptions & {
|
||||
_nextWorker: NextWorkerFixture;
|
||||
}>;
|
||||
export default test;
|
||||
130
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.js
generated
vendored
Normal file
130
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
defaultPlaywrightConfig: null,
|
||||
defineConfig: null,
|
||||
test: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return _default;
|
||||
},
|
||||
defaultPlaywrightConfig: function() {
|
||||
return _defaultconfig.defaultPlaywrightConfig;
|
||||
},
|
||||
defineConfig: function() {
|
||||
return defineConfig;
|
||||
},
|
||||
test: function() {
|
||||
return test;
|
||||
}
|
||||
});
|
||||
0 && __export(require("@playwright/test"));
|
||||
const _test = /*#__PURE__*/ _interop_require_wildcard(_export_star(require("@playwright/test"), exports));
|
||||
const _nextworkerfixture = require("./next-worker-fixture");
|
||||
const _nextfixture = require("./next-fixture");
|
||||
const _defaultconfig = require("./default-config");
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function defineConfig(config) {
|
||||
if (config.webServer !== undefined) {
|
||||
// Playwright doesn't merge the `webServer` field as we'd expect, so remove our default if the user specifies one.
|
||||
const { webServer, ...partialDefaultPlaywrightConfig } = _defaultconfig.defaultPlaywrightConfig;
|
||||
return _test.defineConfig(partialDefaultPlaywrightConfig, config);
|
||||
} else {
|
||||
return _test.defineConfig(_defaultconfig.defaultPlaywrightConfig, config);
|
||||
}
|
||||
}
|
||||
const test = _test.test.extend({
|
||||
nextOptions: [
|
||||
{
|
||||
fetchLoopback: false
|
||||
},
|
||||
{
|
||||
option: true
|
||||
}
|
||||
],
|
||||
_nextWorker: [
|
||||
// eslint-disable-next-line no-empty-pattern
|
||||
async ({}, use)=>{
|
||||
await (0, _nextworkerfixture.applyNextWorkerFixture)(use);
|
||||
},
|
||||
{
|
||||
scope: 'worker',
|
||||
auto: true
|
||||
}
|
||||
],
|
||||
next: async ({ nextOptions, _nextWorker, page }, use, testInfo)=>{
|
||||
await (0, _nextfixture.applyNextFixture)(use, {
|
||||
testInfo,
|
||||
nextWorker: _nextWorker,
|
||||
page,
|
||||
nextOptions
|
||||
});
|
||||
}
|
||||
});
|
||||
const _default = test;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/index.ts"],"sourcesContent":["// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as base from '@playwright/test'\nimport type { NextFixture } from './next-fixture'\nimport type { NextOptions, NextOptionsConfig } from './next-options'\nimport type { NextWorkerFixture } from './next-worker-fixture'\nimport { applyNextWorkerFixture } from './next-worker-fixture'\nimport { applyNextFixture } from './next-fixture'\nimport { defaultPlaywrightConfig } from './default-config'\n\nexport { defaultPlaywrightConfig }\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nexport * from '@playwright/test'\n\n// Export this second so it overrides the one from `@playwright/test`\nexport function defineConfig<T extends NextOptionsConfig, W>(\n config: base.PlaywrightTestConfig<T, W>\n): base.PlaywrightTestConfig<T, W>\nexport function defineConfig<T extends NextOptionsConfig = NextOptionsConfig>(\n config: base.PlaywrightTestConfig<T>\n): base.PlaywrightTestConfig<T> {\n if (config.webServer !== undefined) {\n // Playwright doesn't merge the `webServer` field as we'd expect, so remove our default if the user specifies one.\n const { webServer, ...partialDefaultPlaywrightConfig } =\n defaultPlaywrightConfig as base.PlaywrightTestConfig<T>\n return base.defineConfig<T>(partialDefaultPlaywrightConfig, config)\n } else {\n return base.defineConfig<T>(\n defaultPlaywrightConfig as base.PlaywrightTestConfig<T>,\n config\n )\n }\n}\n\nexport type { NextFixture, NextOptions }\nexport type { FetchHandlerResult } from '../proxy'\n\nexport const test = base.test.extend<\n { next: NextFixture; nextOptions: NextOptions },\n { _nextWorker: NextWorkerFixture }\n>({\n nextOptions: [{ fetchLoopback: false }, { option: true }],\n\n _nextWorker: [\n // eslint-disable-next-line no-empty-pattern\n async ({}, use) => {\n await applyNextWorkerFixture(use)\n },\n { scope: 'worker', auto: true },\n ],\n\n next: async ({ nextOptions, _nextWorker, page }, use, testInfo) => {\n await applyNextFixture(use, {\n testInfo,\n nextWorker: _nextWorker,\n page,\n nextOptions,\n })\n },\n})\n\nexport default test\n"],"names":["defaultPlaywrightConfig","defineConfig","test","config","webServer","undefined","partialDefaultPlaywrightConfig","base","extend","nextOptions","fetchLoopback","option","_nextWorker","use","applyNextWorkerFixture","scope","auto","next","page","testInfo","applyNextFixture","nextWorker"],"mappings":"AAAA,6DAA6D;;;;;;;;;;;;;;;;;;IA6D7D,OAAmB;eAAnB;;IApDSA,uBAAuB;eAAvBA,sCAAuB;;IAShBC,YAAY;eAAZA;;IAmBHC,IAAI;eAAJA;;;;2EApCS;mCAIiB;6BACN;+BACO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWjC,SAASD,aACdE,MAAoC;IAEpC,IAAIA,OAAOC,SAAS,KAAKC,WAAW;QAClC,kHAAkH;QAClH,MAAM,EAAED,SAAS,EAAE,GAAGE,gCAAgC,GACpDN,sCAAuB;QACzB,OAAOO,MAAKN,YAAY,CAAIK,gCAAgCH;IAC9D,OAAO;QACL,OAAOI,MAAKN,YAAY,CACtBD,sCAAuB,EACvBG;IAEJ;AACF;AAKO,MAAMD,OAAOK,MAAKL,IAAI,CAACM,MAAM,CAGlC;IACAC,aAAa;QAAC;YAAEC,eAAe;QAAM;QAAG;YAAEC,QAAQ;QAAK;KAAE;IAEzDC,aAAa;QACX,4CAA4C;QAC5C,OAAO,EAAE,EAAEC;YACT,MAAMC,IAAAA,yCAAsB,EAACD;QAC/B;QACA;YAAEE,OAAO;YAAUC,MAAM;QAAK;KAC/B;IAEDC,MAAM,OAAO,EAAER,WAAW,EAAEG,WAAW,EAAEM,IAAI,EAAE,EAAEL,KAAKM;QACpD,MAAMC,IAAAA,6BAAgB,EAACP,KAAK;YAC1BM;YACAE,YAAYT;YACZM;YACAT;QACF;IACF;AACF;MAEA,WAAeP"}
|
||||
20
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.d.ts
generated
vendored
Normal file
20
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { defineConfig } from './index';
|
||||
import type { NextFixture } from './next-fixture';
|
||||
import { type RequestHandler } from 'msw';
|
||||
export * from 'msw';
|
||||
export * from '@playwright/test';
|
||||
export type { NextFixture };
|
||||
export { defineConfig };
|
||||
export interface MswFixture {
|
||||
use: (...handlers: RequestHandler[]) => void;
|
||||
}
|
||||
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
||||
next: NextFixture;
|
||||
nextOptions: import("./next-options").NextOptions;
|
||||
} & {
|
||||
msw: MswFixture;
|
||||
mswHandlers: RequestHandler[];
|
||||
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
|
||||
_nextWorker: import("./next-worker-fixture").NextWorkerFixture;
|
||||
}>;
|
||||
export default test;
|
||||
100
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.js
generated
vendored
Normal file
100
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
defineConfig: null,
|
||||
test: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return _default;
|
||||
},
|
||||
defineConfig: function() {
|
||||
return _index.defineConfig;
|
||||
},
|
||||
test: function() {
|
||||
return test;
|
||||
}
|
||||
});
|
||||
0 && __export(require("msw")) && __export(require("@playwright/test"));
|
||||
const _index = require("./index");
|
||||
const _msw = _export_star(require("msw"), exports);
|
||||
const _stricteventemitter = require("strict-event-emitter");
|
||||
_export_star(require("@playwright/test"), exports);
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
const test = _index.test.extend({
|
||||
mswHandlers: [
|
||||
[],
|
||||
{
|
||||
option: true
|
||||
}
|
||||
],
|
||||
msw: [
|
||||
async ({ next, mswHandlers }, use)=>{
|
||||
const handlers = [
|
||||
...mswHandlers
|
||||
];
|
||||
const emitter = new _stricteventemitter.Emitter();
|
||||
next.onFetch(async (request)=>{
|
||||
const requestId = Math.random().toString(16).slice(2);
|
||||
let isUnhandled = false;
|
||||
let isPassthrough = false;
|
||||
let mockedResponse;
|
||||
await (0, _msw.handleRequest)(request.clone(), requestId, handlers.slice(0), {
|
||||
onUnhandledRequest: ()=>{
|
||||
isUnhandled = true;
|
||||
}
|
||||
}, emitter, {
|
||||
onPassthroughResponse: ()=>{
|
||||
isPassthrough = true;
|
||||
},
|
||||
onMockedResponse: (r)=>{
|
||||
mockedResponse = r;
|
||||
}
|
||||
});
|
||||
if (isUnhandled) {
|
||||
return undefined;
|
||||
}
|
||||
if (isPassthrough) {
|
||||
return 'continue';
|
||||
}
|
||||
if (mockedResponse) {
|
||||
return mockedResponse;
|
||||
}
|
||||
return 'abort';
|
||||
});
|
||||
await use({
|
||||
use: (...newHandlers)=>{
|
||||
handlers.unshift(...newHandlers);
|
||||
}
|
||||
});
|
||||
handlers.length = 0;
|
||||
},
|
||||
{
|
||||
auto: true
|
||||
}
|
||||
]
|
||||
});
|
||||
const _default = test;
|
||||
|
||||
//# sourceMappingURL=msw.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/msw.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/msw.ts"],"sourcesContent":["import { test as base, defineConfig } from './index'\nimport type { NextFixture } from './next-fixture'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { type RequestHandler, handleRequest } from 'msw'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { Emitter } from 'strict-event-emitter'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nexport * from 'msw'\n// eslint-disable-next-line import/no-extraneous-dependencies\nexport * from '@playwright/test'\nexport type { NextFixture }\nexport { defineConfig }\n\nexport interface MswFixture {\n use: (...handlers: RequestHandler[]) => void\n}\n\nexport const test = base.extend<{\n msw: MswFixture\n mswHandlers: RequestHandler[]\n}>({\n mswHandlers: [[], { option: true }],\n\n msw: [\n async ({ next, mswHandlers }, use) => {\n const handlers: RequestHandler[] = [...mswHandlers]\n const emitter = new Emitter()\n\n next.onFetch(async (request) => {\n const requestId = Math.random().toString(16).slice(2)\n let isUnhandled = false\n let isPassthrough = false\n let mockedResponse\n await handleRequest(\n request.clone(),\n requestId,\n handlers.slice(0),\n {\n onUnhandledRequest: () => {\n isUnhandled = true\n },\n },\n emitter as any,\n {\n onPassthroughResponse: () => {\n isPassthrough = true\n },\n onMockedResponse: (r) => {\n mockedResponse = r\n },\n }\n )\n\n if (isUnhandled) {\n return undefined\n }\n if (isPassthrough) {\n return 'continue'\n }\n\n if (mockedResponse) {\n return mockedResponse\n }\n\n return 'abort'\n })\n\n await use({\n use: (...newHandlers) => {\n handlers.unshift(...newHandlers)\n },\n })\n\n handlers.length = 0\n },\n { auto: true },\n ],\n})\n\nexport default test\n"],"names":["defineConfig","test","base","extend","mswHandlers","option","msw","next","use","handlers","emitter","Emitter","onFetch","request","requestId","Math","random","toString","slice","isUnhandled","isPassthrough","mockedResponse","handleRequest","clone","onUnhandledRequest","onPassthroughResponse","onMockedResponse","r","undefined","newHandlers","unshift","length","auto"],"mappings":";;;;;;;;;;;;;;;;IAgFA,OAAmB;eAAnB;;IApESA,YAAY;eAAZA,mBAAY;;IAMRC,IAAI;eAAJA;;;;uBAlB8B;kCAGQ;oCAE3B;qBAKV;;;;;;;;;;;;;;AAQP,MAAMA,OAAOC,WAAI,CAACC,MAAM,CAG5B;IACDC,aAAa;QAAC,EAAE;QAAE;YAAEC,QAAQ;QAAK;KAAE;IAEnCC,KAAK;QACH,OAAO,EAAEC,IAAI,EAAEH,WAAW,EAAE,EAAEI;YAC5B,MAAMC,WAA6B;mBAAIL;aAAY;YACnD,MAAMM,UAAU,IAAIC,2BAAO;YAE3BJ,KAAKK,OAAO,CAAC,OAAOC;gBAClB,MAAMC,YAAYC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;gBACnD,IAAIC,cAAc;gBAClB,IAAIC,gBAAgB;gBACpB,IAAIC;gBACJ,MAAMC,IAAAA,kBAAa,EACjBT,QAAQU,KAAK,IACbT,WACAL,SAASS,KAAK,CAAC,IACf;oBACEM,oBAAoB;wBAClBL,cAAc;oBAChB;gBACF,GACAT,SACA;oBACEe,uBAAuB;wBACrBL,gBAAgB;oBAClB;oBACAM,kBAAkB,CAACC;wBACjBN,iBAAiBM;oBACnB;gBACF;gBAGF,IAAIR,aAAa;oBACf,OAAOS;gBACT;gBACA,IAAIR,eAAe;oBACjB,OAAO;gBACT;gBAEA,IAAIC,gBAAgB;oBAClB,OAAOA;gBACT;gBAEA,OAAO;YACT;YAEA,MAAMb,IAAI;gBACRA,KAAK,CAAC,GAAGqB;oBACPpB,SAASqB,OAAO,IAAID;gBACtB;YACF;YAEApB,SAASsB,MAAM,GAAG;QACpB;QACA;YAAEC,MAAM;QAAK;KACd;AACH;MAEA,WAAe/B"}
|
||||
12
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts
generated
vendored
Normal file
12
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Page, TestInfo } from '@playwright/test';
|
||||
import type { NextWorkerFixture, FetchHandler } from './next-worker-fixture';
|
||||
import type { NextOptions } from './next-options';
|
||||
export interface NextFixture {
|
||||
onFetch: (handler: FetchHandler) => void;
|
||||
}
|
||||
export declare function applyNextFixture(use: (fixture: NextFixture) => Promise<void>, { testInfo, nextOptions, nextWorker, page, }: {
|
||||
testInfo: TestInfo;
|
||||
nextOptions: NextOptions;
|
||||
nextWorker: NextWorkerFixture;
|
||||
page: Page;
|
||||
}): Promise<void>;
|
||||
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js
generated
vendored
Normal file
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "applyNextFixture", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return applyNextFixture;
|
||||
}
|
||||
});
|
||||
const _pageroute = require("./page-route");
|
||||
const _report = require("./report");
|
||||
class NextFixtureImpl {
|
||||
constructor(testInfo, options, worker, page){
|
||||
this.testInfo = testInfo;
|
||||
this.options = options;
|
||||
this.worker = worker;
|
||||
this.page = page;
|
||||
this.fetchHandlers = [];
|
||||
this.testId = testInfo.testId;
|
||||
worker.onFetch(this.testId, this.handleFetch.bind(this));
|
||||
}
|
||||
async setup() {
|
||||
const testHeaders = {
|
||||
'Next-Test-Proxy-Port': String(this.worker.proxyPort),
|
||||
'Next-Test-Data': this.testId
|
||||
};
|
||||
await this.page.context().route('**', (route)=>(0, _pageroute.handleRoute)(route, this.page, testHeaders, this.handleFetch.bind(this)));
|
||||
}
|
||||
teardown() {
|
||||
this.worker.cleanupTest(this.testId);
|
||||
}
|
||||
onFetch(handler) {
|
||||
this.fetchHandlers.push(handler);
|
||||
}
|
||||
async handleFetch(request) {
|
||||
return (0, _report.reportFetch)(this.testInfo, request, async (req)=>{
|
||||
for (const handler of this.fetchHandlers.slice().reverse()){
|
||||
const result = await handler(req.clone());
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (this.options.fetchLoopback) {
|
||||
return fetch(req.clone());
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
async function applyNextFixture(use, { testInfo, nextOptions, nextWorker, page }) {
|
||||
const fixture = new NextFixtureImpl(testInfo, nextOptions, nextWorker, page);
|
||||
await fixture.setup();
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()
|
||||
await use(fixture);
|
||||
fixture.teardown();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-fixture.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-fixture.ts"],"sourcesContent":["import type { Page, TestInfo } from '@playwright/test'\nimport type { NextWorkerFixture, FetchHandler } from './next-worker-fixture'\nimport type { NextOptions } from './next-options'\nimport type { FetchHandlerResult } from '../proxy'\nimport { handleRoute } from './page-route'\nimport { reportFetch } from './report'\n\nexport interface NextFixture {\n onFetch: (handler: FetchHandler) => void\n}\n\nclass NextFixtureImpl implements NextFixture {\n public readonly testId: string\n private fetchHandlers: FetchHandler[] = []\n\n constructor(\n private testInfo: TestInfo,\n private options: NextOptions,\n private worker: NextWorkerFixture,\n private page: Page\n ) {\n this.testId = testInfo.testId\n worker.onFetch(this.testId, this.handleFetch.bind(this))\n }\n\n async setup(): Promise<void> {\n const testHeaders = {\n 'Next-Test-Proxy-Port': String(this.worker.proxyPort),\n 'Next-Test-Data': this.testId,\n }\n\n await this.page\n .context()\n .route('**', (route) =>\n handleRoute(route, this.page, testHeaders, this.handleFetch.bind(this))\n )\n }\n\n teardown(): void {\n this.worker.cleanupTest(this.testId)\n }\n\n onFetch(handler: FetchHandler): void {\n this.fetchHandlers.push(handler)\n }\n\n private async handleFetch(request: Request): Promise<FetchHandlerResult> {\n return reportFetch(this.testInfo, request, async (req) => {\n for (const handler of this.fetchHandlers.slice().reverse()) {\n const result = await handler(req.clone())\n if (result) {\n return result\n }\n }\n if (this.options.fetchLoopback) {\n return fetch(req.clone())\n }\n return undefined\n })\n }\n}\n\nexport async function applyNextFixture(\n use: (fixture: NextFixture) => Promise<void>,\n {\n testInfo,\n nextOptions,\n nextWorker,\n page,\n }: {\n testInfo: TestInfo\n nextOptions: NextOptions\n nextWorker: NextWorkerFixture\n page: Page\n }\n): Promise<void> {\n const fixture = new NextFixtureImpl(testInfo, nextOptions, nextWorker, page)\n\n await fixture.setup()\n // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()\n await use(fixture)\n\n fixture.teardown()\n}\n"],"names":["applyNextFixture","NextFixtureImpl","constructor","testInfo","options","worker","page","fetchHandlers","testId","onFetch","handleFetch","bind","setup","testHeaders","String","proxyPort","context","route","handleRoute","teardown","cleanupTest","handler","push","request","reportFetch","req","slice","reverse","result","clone","fetchLoopback","fetch","undefined","use","nextOptions","nextWorker","fixture"],"mappings":";;;;+BA8DsBA;;;eAAAA;;;2BA1DM;wBACA;AAM5B,MAAMC;IAIJC,YACE,AAAQC,QAAkB,EAC1B,AAAQC,OAAoB,EAC5B,AAAQC,MAAyB,EACjC,AAAQC,IAAU,CAClB;aAJQH,WAAAA;aACAC,UAAAA;aACAC,SAAAA;aACAC,OAAAA;aANFC,gBAAgC,EAAE;QAQxC,IAAI,CAACC,MAAM,GAAGL,SAASK,MAAM;QAC7BH,OAAOI,OAAO,CAAC,IAAI,CAACD,MAAM,EAAE,IAAI,CAACE,WAAW,CAACC,IAAI,CAAC,IAAI;IACxD;IAEA,MAAMC,QAAuB;QAC3B,MAAMC,cAAc;YAClB,wBAAwBC,OAAO,IAAI,CAACT,MAAM,CAACU,SAAS;YACpD,kBAAkB,IAAI,CAACP,MAAM;QAC/B;QAEA,MAAM,IAAI,CAACF,IAAI,CACZU,OAAO,GACPC,KAAK,CAAC,MAAM,CAACA,QACZC,IAAAA,sBAAW,EAACD,OAAO,IAAI,CAACX,IAAI,EAAEO,aAAa,IAAI,CAACH,WAAW,CAACC,IAAI,CAAC,IAAI;IAE3E;IAEAQ,WAAiB;QACf,IAAI,CAACd,MAAM,CAACe,WAAW,CAAC,IAAI,CAACZ,MAAM;IACrC;IAEAC,QAAQY,OAAqB,EAAQ;QACnC,IAAI,CAACd,aAAa,CAACe,IAAI,CAACD;IAC1B;IAEA,MAAcX,YAAYa,OAAgB,EAA+B;QACvE,OAAOC,IAAAA,mBAAW,EAAC,IAAI,CAACrB,QAAQ,EAAEoB,SAAS,OAAOE;YAChD,KAAK,MAAMJ,WAAW,IAAI,CAACd,aAAa,CAACmB,KAAK,GAAGC,OAAO,GAAI;gBAC1D,MAAMC,SAAS,MAAMP,QAAQI,IAAII,KAAK;gBACtC,IAAID,QAAQ;oBACV,OAAOA;gBACT;YACF;YACA,IAAI,IAAI,CAACxB,OAAO,CAAC0B,aAAa,EAAE;gBAC9B,OAAOC,MAAMN,IAAII,KAAK;YACxB;YACA,OAAOG;QACT;IACF;AACF;AAEO,eAAehC,iBACpBiC,GAA4C,EAC5C,EACE9B,QAAQ,EACR+B,WAAW,EACXC,UAAU,EACV7B,IAAI,EAML;IAED,MAAM8B,UAAU,IAAInC,gBAAgBE,UAAU+B,aAAaC,YAAY7B;IAEvE,MAAM8B,QAAQxB,KAAK;IACnB,yEAAyE;IACzE,MAAMqB,IAAIG;IAEVA,QAAQjB,QAAQ;AAClB"}
|
||||
6
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts
generated
vendored
Normal file
6
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface NextOptions {
|
||||
fetchLoopback?: boolean;
|
||||
}
|
||||
export interface NextOptionsConfig {
|
||||
nextOptions?: NextOptions;
|
||||
}
|
||||
6
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.js
generated
vendored
Normal file
6
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=next-options.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":""}
|
||||
8
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts
generated
vendored
Normal file
8
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { FetchHandlerResult } from '../proxy';
|
||||
export type FetchHandler = (request: Request) => FetchHandlerResult | Promise<FetchHandlerResult>;
|
||||
export interface NextWorkerFixture {
|
||||
proxyPort: number;
|
||||
onFetch: (testId: string, handler: FetchHandler) => void;
|
||||
cleanupTest: (testId: string) => void;
|
||||
}
|
||||
export declare function applyNextWorkerFixture(use: (fixture: NextWorkerFixture) => Promise<void>): Promise<void>;
|
||||
50
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js
generated
vendored
Normal file
50
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "applyNextWorkerFixture", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return applyNextWorkerFixture;
|
||||
}
|
||||
});
|
||||
const _proxy = require("../proxy");
|
||||
class NextWorkerFixtureImpl {
|
||||
async setup() {
|
||||
const server = await (0, _proxy.createProxyServer)({
|
||||
onFetch: this.handleProxyFetch.bind(this)
|
||||
});
|
||||
this.proxyPort = server.port;
|
||||
this.proxyServer = server;
|
||||
}
|
||||
teardown() {
|
||||
if (this.proxyServer) {
|
||||
this.proxyServer.close();
|
||||
this.proxyServer = null;
|
||||
}
|
||||
}
|
||||
cleanupTest(testId) {
|
||||
this.proxyFetchMap.delete(testId);
|
||||
}
|
||||
onFetch(testId, handler) {
|
||||
this.proxyFetchMap.set(testId, handler);
|
||||
}
|
||||
async handleProxyFetch(testId, request) {
|
||||
const handler = this.proxyFetchMap.get(testId);
|
||||
return handler == null ? void 0 : handler(request);
|
||||
}
|
||||
constructor(){
|
||||
this.proxyPort = 0;
|
||||
this.proxyServer = null;
|
||||
this.proxyFetchMap = new Map();
|
||||
}
|
||||
}
|
||||
async function applyNextWorkerFixture(use) {
|
||||
const fixture = new NextWorkerFixtureImpl();
|
||||
await fixture.setup();
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()
|
||||
await use(fixture);
|
||||
fixture.teardown();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-worker-fixture.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-worker-fixture.ts"],"sourcesContent":["import type { FetchHandlerResult, ProxyServer } from '../proxy'\nimport { createProxyServer } from '../proxy'\n\nexport type FetchHandler = (\n request: Request\n) => FetchHandlerResult | Promise<FetchHandlerResult>\n\nexport interface NextWorkerFixture {\n proxyPort: number\n onFetch: (testId: string, handler: FetchHandler) => void\n cleanupTest: (testId: string) => void\n}\n\nclass NextWorkerFixtureImpl implements NextWorkerFixture {\n public proxyPort: number = 0\n private proxyServer: ProxyServer | null = null\n private proxyFetchMap = new Map<string, FetchHandler>()\n\n async setup(): Promise<void> {\n const server = await createProxyServer({\n onFetch: this.handleProxyFetch.bind(this),\n })\n\n this.proxyPort = server.port\n this.proxyServer = server\n }\n\n teardown(): void {\n if (this.proxyServer) {\n this.proxyServer.close()\n this.proxyServer = null\n }\n }\n\n cleanupTest(testId: string): void {\n this.proxyFetchMap.delete(testId)\n }\n\n onFetch(testId: string, handler: FetchHandler): void {\n this.proxyFetchMap.set(testId, handler)\n }\n\n private async handleProxyFetch(\n testId: string,\n request: Request\n ): Promise<FetchHandlerResult> {\n const handler = this.proxyFetchMap.get(testId)\n return handler?.(request)\n }\n}\n\nexport async function applyNextWorkerFixture(\n use: (fixture: NextWorkerFixture) => Promise<void>\n): Promise<void> {\n const fixture = new NextWorkerFixtureImpl()\n await fixture.setup()\n // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()\n await use(fixture)\n fixture.teardown()\n}\n"],"names":["applyNextWorkerFixture","NextWorkerFixtureImpl","setup","server","createProxyServer","onFetch","handleProxyFetch","bind","proxyPort","port","proxyServer","teardown","close","cleanupTest","testId","proxyFetchMap","delete","handler","set","request","get","Map","use","fixture"],"mappings":";;;;+BAmDsBA;;;eAAAA;;;uBAlDY;AAYlC,MAAMC;IAKJ,MAAMC,QAAuB;QAC3B,MAAMC,SAAS,MAAMC,IAAAA,wBAAiB,EAAC;YACrCC,SAAS,IAAI,CAACC,gBAAgB,CAACC,IAAI,CAAC,IAAI;QAC1C;QAEA,IAAI,CAACC,SAAS,GAAGL,OAAOM,IAAI;QAC5B,IAAI,CAACC,WAAW,GAAGP;IACrB;IAEAQ,WAAiB;QACf,IAAI,IAAI,CAACD,WAAW,EAAE;YACpB,IAAI,CAACA,WAAW,CAACE,KAAK;YACtB,IAAI,CAACF,WAAW,GAAG;QACrB;IACF;IAEAG,YAAYC,MAAc,EAAQ;QAChC,IAAI,CAACC,aAAa,CAACC,MAAM,CAACF;IAC5B;IAEAT,QAAQS,MAAc,EAAEG,OAAqB,EAAQ;QACnD,IAAI,CAACF,aAAa,CAACG,GAAG,CAACJ,QAAQG;IACjC;IAEA,MAAcX,iBACZQ,MAAc,EACdK,OAAgB,EACa;QAC7B,MAAMF,UAAU,IAAI,CAACF,aAAa,CAACK,GAAG,CAACN;QACvC,OAAOG,2BAAAA,QAAUE;IACnB;;aAlCOX,YAAoB;aACnBE,cAAkC;aAClCK,gBAAgB,IAAIM;;AAiC9B;AAEO,eAAerB,uBACpBsB,GAAkD;IAElD,MAAMC,UAAU,IAAItB;IACpB,MAAMsB,QAAQrB,KAAK;IACnB,yEAAyE;IACzE,MAAMoB,IAAIC;IACVA,QAAQZ,QAAQ;AAClB"}
|
||||
3
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts
generated
vendored
Normal file
3
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Page, Route } from '@playwright/test';
|
||||
import type { FetchHandler } from './next-worker-fixture';
|
||||
export declare function handleRoute(route: Route, page: Page, testHeaders: Record<string, string>, fetchHandler: FetchHandler | null): Promise<void>;
|
||||
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.js
generated
vendored
Normal file
59
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "handleRoute", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return handleRoute;
|
||||
}
|
||||
});
|
||||
function continueRoute(route, request, testHeaders) {
|
||||
return route.continue({
|
||||
headers: {
|
||||
...request.headers(),
|
||||
...testHeaders
|
||||
}
|
||||
});
|
||||
}
|
||||
async function handleRoute(route, page, testHeaders, fetchHandler) {
|
||||
const request = route.request();
|
||||
// Continue the navigation and non-fetch requests.
|
||||
if (request.isNavigationRequest() || request.resourceType() !== 'fetch') {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
// Continue the local requests. The followup requests will be intercepted
|
||||
// on the server.
|
||||
const pageOrigin = new URL(page.url()).origin;
|
||||
const requestOrigin = new URL(request.url()).origin;
|
||||
if (pageOrigin === requestOrigin) {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
if (!fetchHandler) {
|
||||
return route.abort();
|
||||
}
|
||||
const postData = request.postDataBuffer();
|
||||
const fetchRequest = new Request(request.url(), {
|
||||
method: request.method(),
|
||||
headers: Object.fromEntries(Object.entries(request.headers()).filter(([name])=>!name.toLowerCase().startsWith('next-test-'))),
|
||||
body: postData ?? null
|
||||
});
|
||||
const proxyResponse = await fetchHandler(fetchRequest);
|
||||
if (!proxyResponse) {
|
||||
return route.abort();
|
||||
}
|
||||
if (proxyResponse === 'abort') {
|
||||
return route.abort();
|
||||
}
|
||||
if (proxyResponse === 'continue') {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
const { status, headers, body } = proxyResponse;
|
||||
return route.fulfill({
|
||||
status,
|
||||
headers: Object.fromEntries(headers),
|
||||
body: body ? Buffer.from(await proxyResponse.arrayBuffer()) : undefined
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=page-route.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/page-route.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/page-route.ts"],"sourcesContent":["import type {\n Page,\n Route,\n Request as PlaywrightRequest,\n} from '@playwright/test'\nimport type { FetchHandler } from './next-worker-fixture'\n\nfunction continueRoute(\n route: Route,\n request: PlaywrightRequest,\n testHeaders: Record<string, string>\n): Promise<void> {\n return route.continue({\n headers: {\n ...request.headers(),\n ...testHeaders,\n },\n })\n}\n\nexport async function handleRoute(\n route: Route,\n page: Page,\n testHeaders: Record<string, string>,\n fetchHandler: FetchHandler | null\n) {\n const request = route.request()\n\n // Continue the navigation and non-fetch requests.\n if (request.isNavigationRequest() || request.resourceType() !== 'fetch') {\n return continueRoute(route, request, testHeaders)\n }\n\n // Continue the local requests. The followup requests will be intercepted\n // on the server.\n const pageOrigin = new URL(page.url()).origin\n const requestOrigin = new URL(request.url()).origin\n if (pageOrigin === requestOrigin) {\n return continueRoute(route, request, testHeaders)\n }\n\n if (!fetchHandler) {\n return route.abort()\n }\n\n const postData = request.postDataBuffer()\n const fetchRequest = new Request(request.url(), {\n method: request.method(),\n headers: Object.fromEntries(\n Object.entries(request.headers()).filter(\n ([name]) => !name.toLowerCase().startsWith('next-test-')\n )\n ),\n body: postData ?? null,\n })\n\n const proxyResponse = await fetchHandler(fetchRequest)\n if (!proxyResponse) {\n return route.abort()\n }\n if (proxyResponse === 'abort') {\n return route.abort()\n }\n if (proxyResponse === 'continue') {\n return continueRoute(route, request, testHeaders)\n }\n const { status, headers, body } = proxyResponse\n return route.fulfill({\n status,\n headers: Object.fromEntries(headers),\n body: body ? Buffer.from(await proxyResponse.arrayBuffer()) : undefined,\n })\n}\n"],"names":["handleRoute","continueRoute","route","request","testHeaders","continue","headers","page","fetchHandler","isNavigationRequest","resourceType","pageOrigin","URL","url","origin","requestOrigin","abort","postData","postDataBuffer","fetchRequest","Request","method","Object","fromEntries","entries","filter","name","toLowerCase","startsWith","body","proxyResponse","status","fulfill","Buffer","from","arrayBuffer","undefined"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;AAbtB,SAASC,cACPC,KAAY,EACZC,OAA0B,EAC1BC,WAAmC;IAEnC,OAAOF,MAAMG,QAAQ,CAAC;QACpBC,SAAS;YACP,GAAGH,QAAQG,OAAO,EAAE;YACpB,GAAGF,WAAW;QAChB;IACF;AACF;AAEO,eAAeJ,YACpBE,KAAY,EACZK,IAAU,EACVH,WAAmC,EACnCI,YAAiC;IAEjC,MAAML,UAAUD,MAAMC,OAAO;IAE7B,kDAAkD;IAClD,IAAIA,QAAQM,mBAAmB,MAAMN,QAAQO,YAAY,OAAO,SAAS;QACvE,OAAOT,cAAcC,OAAOC,SAASC;IACvC;IAEA,yEAAyE;IACzE,iBAAiB;IACjB,MAAMO,aAAa,IAAIC,IAAIL,KAAKM,GAAG,IAAIC,MAAM;IAC7C,MAAMC,gBAAgB,IAAIH,IAAIT,QAAQU,GAAG,IAAIC,MAAM;IACnD,IAAIH,eAAeI,eAAe;QAChC,OAAOd,cAAcC,OAAOC,SAASC;IACvC;IAEA,IAAI,CAACI,cAAc;QACjB,OAAON,MAAMc,KAAK;IACpB;IAEA,MAAMC,WAAWd,QAAQe,cAAc;IACvC,MAAMC,eAAe,IAAIC,QAAQjB,QAAQU,GAAG,IAAI;QAC9CQ,QAAQlB,QAAQkB,MAAM;QACtBf,SAASgB,OAAOC,WAAW,CACzBD,OAAOE,OAAO,CAACrB,QAAQG,OAAO,IAAImB,MAAM,CACtC,CAAC,CAACC,KAAK,GAAK,CAACA,KAAKC,WAAW,GAAGC,UAAU,CAAC;QAG/CC,MAAMZ,YAAY;IACpB;IAEA,MAAMa,gBAAgB,MAAMtB,aAAaW;IACzC,IAAI,CAACW,eAAe;QAClB,OAAO5B,MAAMc,KAAK;IACpB;IACA,IAAIc,kBAAkB,SAAS;QAC7B,OAAO5B,MAAMc,KAAK;IACpB;IACA,IAAIc,kBAAkB,YAAY;QAChC,OAAO7B,cAAcC,OAAOC,SAASC;IACvC;IACA,MAAM,EAAE2B,MAAM,EAAEzB,OAAO,EAAEuB,IAAI,EAAE,GAAGC;IAClC,OAAO5B,MAAM8B,OAAO,CAAC;QACnBD;QACAzB,SAASgB,OAAOC,WAAW,CAACjB;QAC5BuB,MAAMA,OAAOI,OAAOC,IAAI,CAAC,MAAMJ,cAAcK,WAAW,MAAMC;IAChE;AACF"}
|
||||
3
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.d.ts
generated
vendored
Normal file
3
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { TestInfo } from '@playwright/test';
|
||||
import type { FetchHandler } from './next-worker-fixture';
|
||||
export declare function reportFetch(testInfo: TestInfo, req: Request, handler: FetchHandler): Promise<Awaited<ReturnType<FetchHandler>>>;
|
||||
127
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.js
generated
vendored
Normal file
127
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "reportFetch", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return reportFetch;
|
||||
}
|
||||
});
|
||||
const _step = require("./step");
|
||||
async function parseBody(r) {
|
||||
const contentType = r.headers.get('content-type');
|
||||
let error;
|
||||
let text;
|
||||
let json;
|
||||
let formData;
|
||||
let buffer;
|
||||
if (contentType == null ? void 0 : contentType.includes('text')) {
|
||||
try {
|
||||
text = await r.text();
|
||||
} catch (e) {
|
||||
error = 'failed to parse text';
|
||||
}
|
||||
} else if (contentType == null ? void 0 : contentType.includes('json')) {
|
||||
try {
|
||||
json = await r.json();
|
||||
} catch (e) {
|
||||
error = 'failed to parse json';
|
||||
}
|
||||
} else if (contentType == null ? void 0 : contentType.includes('form-data')) {
|
||||
try {
|
||||
formData = await r.formData();
|
||||
} catch (e) {
|
||||
error = 'failed to parse formData';
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
buffer = await r.arrayBuffer();
|
||||
} catch (e) {
|
||||
error = 'failed to parse arrayBuffer';
|
||||
}
|
||||
}
|
||||
return {
|
||||
...error ? {
|
||||
error
|
||||
} : null,
|
||||
...text ? {
|
||||
text
|
||||
} : null,
|
||||
...json ? {
|
||||
json: JSON.stringify(json)
|
||||
} : null,
|
||||
...formData ? {
|
||||
formData: JSON.stringify(Array.from(formData))
|
||||
} : null,
|
||||
...buffer && buffer.byteLength > 0 ? {
|
||||
buffer: `base64;${Buffer.from(buffer).toString('base64')}`
|
||||
} : null
|
||||
};
|
||||
}
|
||||
function parseHeaders(headers) {
|
||||
return Object.fromEntries(Array.from(headers).sort(([key1], [key2])=>key1.localeCompare(key2)).map(([key, value])=>{
|
||||
return [
|
||||
`header.${key}`,
|
||||
value
|
||||
];
|
||||
}));
|
||||
}
|
||||
async function reportFetch(testInfo, req, handler) {
|
||||
return (0, _step.step)(testInfo, {
|
||||
title: `next.onFetch: ${req.method} ${req.url}`,
|
||||
category: 'next.onFetch',
|
||||
apiName: 'next.onFetch',
|
||||
params: {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
...await parseBody(req.clone()),
|
||||
...parseHeaders(req.headers)
|
||||
}
|
||||
}, async (complete)=>{
|
||||
const res = await handler(req);
|
||||
if (res === undefined || res == null) {
|
||||
complete({
|
||||
error: {
|
||||
message: 'unhandled'
|
||||
}
|
||||
});
|
||||
} else if (typeof res === 'string' && res !== 'continue') {
|
||||
complete({
|
||||
error: {
|
||||
message: res
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let body;
|
||||
if (typeof res === 'string') {
|
||||
body = {
|
||||
response: res
|
||||
};
|
||||
} else {
|
||||
const { status, statusText } = res;
|
||||
body = {
|
||||
status,
|
||||
...statusText ? {
|
||||
statusText
|
||||
} : null,
|
||||
...await parseBody(res.clone()),
|
||||
...parseHeaders(res.headers)
|
||||
};
|
||||
}
|
||||
await (0, _step.step)(testInfo, {
|
||||
title: `next.onFetch.fulfilled: ${req.method} ${req.url}`,
|
||||
category: 'next.onFetch',
|
||||
apiName: 'next.onFetch.fulfilled',
|
||||
params: {
|
||||
...body,
|
||||
'request.url': req.url,
|
||||
'request.method': req.method
|
||||
}
|
||||
}, async ()=>undefined).catch(()=>undefined);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=report.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/report.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.d.ts
generated
vendored
Normal file
12
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { TestInfo } from '@playwright/test';
|
||||
export interface StepProps {
|
||||
category: string;
|
||||
title: string;
|
||||
apiName?: string;
|
||||
params?: Record<string, string | number | boolean | null | undefined>;
|
||||
}
|
||||
type Complete = (result: {
|
||||
error?: any;
|
||||
}) => void;
|
||||
export declare function step<T>(testInfo: TestInfo, props: StepProps, handler: (complete: Complete) => Promise<Awaited<T>>): Promise<Awaited<T>>;
|
||||
export {};
|
||||
39
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.js
generated
vendored
Normal file
39
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "step", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return step;
|
||||
}
|
||||
});
|
||||
const _test = require("@playwright/test");
|
||||
function isWithRunAsStep(testInfo) {
|
||||
return '_runAsStep' in testInfo;
|
||||
}
|
||||
async function step(testInfo, props, handler) {
|
||||
if (isWithRunAsStep(testInfo)) {
|
||||
return testInfo._runAsStep(props, ({ complete })=>handler(complete));
|
||||
}
|
||||
// Fallback to the `test.step()`.
|
||||
let result;
|
||||
let reportedError;
|
||||
try {
|
||||
await _test.test.step(props.title, async ()=>{
|
||||
result = await handler(({ error })=>{
|
||||
reportedError = error;
|
||||
if (reportedError) {
|
||||
throw reportedError;
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
if (error !== reportedError) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=step.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/playwright/step.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/step.ts"],"sourcesContent":["import type { TestInfo } from '@playwright/test'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { test } from '@playwright/test'\n\nexport interface StepProps {\n category: string\n title: string\n apiName?: string\n params?: Record<string, string | number | boolean | null | undefined>\n}\n\n// Access the internal Playwright API until it's exposed publicly.\n// See https://github.com/microsoft/playwright/issues/27059.\ninterface TestInfoWithRunAsStep extends TestInfo {\n _runAsStep: <T>(\n stepInfo: StepProps,\n handler: (result: { complete: Complete }) => Promise<T>\n ) => Promise<T>\n}\n\ntype Complete = (result: { error?: any }) => void\n\nfunction isWithRunAsStep(\n testInfo: TestInfo\n): testInfo is TestInfoWithRunAsStep {\n return '_runAsStep' in testInfo\n}\n\nexport async function step<T>(\n testInfo: TestInfo,\n props: StepProps,\n handler: (complete: Complete) => Promise<Awaited<T>>\n): Promise<Awaited<T>> {\n if (isWithRunAsStep(testInfo)) {\n return testInfo._runAsStep(props, ({ complete }) => handler(complete))\n }\n\n // Fallback to the `test.step()`.\n let result: Awaited<T>\n let reportedError: any\n try {\n await test.step(props.title, async () => {\n result = await handler(({ error }) => {\n reportedError = error\n if (reportedError) {\n throw reportedError\n }\n })\n })\n } catch (error) {\n if (error !== reportedError) {\n throw error\n }\n }\n return result!\n}\n"],"names":["step","isWithRunAsStep","testInfo","props","handler","_runAsStep","complete","result","reportedError","test","title","error"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;sBA1BD;AAoBrB,SAASC,gBACPC,QAAkB;IAElB,OAAO,gBAAgBA;AACzB;AAEO,eAAeF,KACpBE,QAAkB,EAClBC,KAAgB,EAChBC,OAAoD;IAEpD,IAAIH,gBAAgBC,WAAW;QAC7B,OAAOA,SAASG,UAAU,CAACF,OAAO,CAAC,EAAEG,QAAQ,EAAE,GAAKF,QAAQE;IAC9D;IAEA,iCAAiC;IACjC,IAAIC;IACJ,IAAIC;IACJ,IAAI;QACF,MAAMC,UAAI,CAACT,IAAI,CAACG,MAAMO,KAAK,EAAE;YAC3BH,SAAS,MAAMH,QAAQ,CAAC,EAAEO,KAAK,EAAE;gBAC/BH,gBAAgBG;gBAChB,IAAIH,eAAe;oBACjB,MAAMA;gBACR;YACF;QACF;IACF,EAAE,OAAOG,OAAO;QACd,IAAIA,UAAUH,eAAe;YAC3B,MAAMG;QACR;IACF;IACA,OAAOJ;AACT"}
|
||||
4
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.d.ts
generated
vendored
Normal file
4
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { ProxyFetchRequest, ProxyResponse } from './types';
|
||||
export type FetchHandlerResult = Response | 'abort' | 'continue' | null | undefined;
|
||||
export type FetchHandler = (testData: string, request: Request) => FetchHandlerResult | Promise<FetchHandlerResult>;
|
||||
export declare function handleFetch(req: ProxyFetchRequest, onFetch: FetchHandler): Promise<ProxyResponse>;
|
||||
48
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js
generated
vendored
Normal file
48
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "handleFetch", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return handleFetch;
|
||||
}
|
||||
});
|
||||
const _types = require("./types");
|
||||
function buildRequest(req) {
|
||||
const { request: proxyRequest } = req;
|
||||
const { url, headers, body, ...options } = proxyRequest;
|
||||
return new Request(url, {
|
||||
...options,
|
||||
headers: new Headers(headers),
|
||||
body: body ? Buffer.from(body, 'base64') : null
|
||||
});
|
||||
}
|
||||
async function buildResponse(response) {
|
||||
if (!response) {
|
||||
return _types.UNHANDLED;
|
||||
}
|
||||
if (response === 'abort') {
|
||||
return _types.ABORT;
|
||||
}
|
||||
if (response === 'continue') {
|
||||
return _types.CONTINUE;
|
||||
}
|
||||
const { status, headers, body } = response;
|
||||
return {
|
||||
api: 'fetch',
|
||||
response: {
|
||||
status,
|
||||
headers: Array.from(headers),
|
||||
body: body ? Buffer.from(await response.arrayBuffer()).toString('base64') : null
|
||||
}
|
||||
};
|
||||
}
|
||||
async function handleFetch(req, onFetch) {
|
||||
const { testData } = req;
|
||||
const request = buildRequest(req);
|
||||
const response = await onFetch(testData, request);
|
||||
return buildResponse(response);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch-api.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/proxy/fetch-api.ts"],"sourcesContent":["import type { ProxyFetchRequest, ProxyResponse } from './types'\nimport { ABORT, CONTINUE, UNHANDLED } from './types'\n\nexport type FetchHandlerResult =\n | Response\n | 'abort'\n | 'continue'\n | null\n | undefined\n\nexport type FetchHandler = (\n testData: string,\n request: Request\n) => FetchHandlerResult | Promise<FetchHandlerResult>\n\nfunction buildRequest(req: ProxyFetchRequest): Request {\n const { request: proxyRequest } = req\n const { url, headers, body, ...options } = proxyRequest\n return new Request(url, {\n ...options,\n headers: new Headers(headers),\n body: body ? Buffer.from(body, 'base64') : null,\n })\n}\n\nasync function buildResponse(\n response: FetchHandlerResult\n): Promise<ProxyResponse> {\n if (!response) {\n return UNHANDLED\n }\n if (response === 'abort') {\n return ABORT\n }\n if (response === 'continue') {\n return CONTINUE\n }\n\n const { status, headers, body } = response\n return {\n api: 'fetch',\n response: {\n status,\n headers: Array.from(headers),\n body: body\n ? Buffer.from(await response.arrayBuffer()).toString('base64')\n : null,\n },\n }\n}\n\nexport async function handleFetch(\n req: ProxyFetchRequest,\n onFetch: FetchHandler\n): Promise<ProxyResponse> {\n const { testData } = req\n const request = buildRequest(req)\n const response = await onFetch(testData, request)\n return buildResponse(response)\n}\n"],"names":["handleFetch","buildRequest","req","request","proxyRequest","url","headers","body","options","Request","Headers","Buffer","from","buildResponse","response","UNHANDLED","ABORT","CONTINUE","status","api","Array","arrayBuffer","toString","onFetch","testData"],"mappings":";;;;+BAmDsBA;;;eAAAA;;;uBAlDqB;AAc3C,SAASC,aAAaC,GAAsB;IAC1C,MAAM,EAAEC,SAASC,YAAY,EAAE,GAAGF;IAClC,MAAM,EAAEG,GAAG,EAAEC,OAAO,EAAEC,IAAI,EAAE,GAAGC,SAAS,GAAGJ;IAC3C,OAAO,IAAIK,QAAQJ,KAAK;QACtB,GAAGG,OAAO;QACVF,SAAS,IAAII,QAAQJ;QACrBC,MAAMA,OAAOI,OAAOC,IAAI,CAACL,MAAM,YAAY;IAC7C;AACF;AAEA,eAAeM,cACbC,QAA4B;IAE5B,IAAI,CAACA,UAAU;QACb,OAAOC,gBAAS;IAClB;IACA,IAAID,aAAa,SAAS;QACxB,OAAOE,YAAK;IACd;IACA,IAAIF,aAAa,YAAY;QAC3B,OAAOG,eAAQ;IACjB;IAEA,MAAM,EAAEC,MAAM,EAAEZ,OAAO,EAAEC,IAAI,EAAE,GAAGO;IAClC,OAAO;QACLK,KAAK;QACLL,UAAU;YACRI;YACAZ,SAASc,MAAMR,IAAI,CAACN;YACpBC,MAAMA,OACFI,OAAOC,IAAI,CAAC,MAAME,SAASO,WAAW,IAAIC,QAAQ,CAAC,YACnD;QACN;IACF;AACF;AAEO,eAAetB,YACpBE,GAAsB,EACtBqB,OAAqB;IAErB,MAAM,EAAEC,QAAQ,EAAE,GAAGtB;IACrB,MAAMC,UAAUF,aAAaC;IAC7B,MAAMY,WAAW,MAAMS,QAAQC,UAAUrB;IACzC,OAAOU,cAAcC;AACvB"}
|
||||
3
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.d.ts
generated
vendored
Normal file
3
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { createProxyServer } from './server';
|
||||
export type { FetchHandler, FetchHandlerResult } from './fetch-api';
|
||||
export type * from './types';
|
||||
13
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.js
generated
vendored
Normal file
13
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createProxyServer", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _server.createProxyServer;
|
||||
}
|
||||
});
|
||||
const _server = require("./server");
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/proxy/index.ts"],"sourcesContent":["export { createProxyServer } from './server'\nexport type { FetchHandler, FetchHandlerResult } from './fetch-api'\nexport type * from './types'\n"],"names":["createProxyServer"],"mappings":";;;;+BAASA;;;eAAAA,yBAAiB;;;wBAAQ"}
|
||||
5
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.d.ts
generated
vendored
Normal file
5
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ProxyServer } from './types';
|
||||
import type { FetchHandler } from './fetch-api';
|
||||
export declare function createProxyServer({ onFetch, }: {
|
||||
onFetch?: FetchHandler;
|
||||
}): Promise<ProxyServer>;
|
||||
89
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.js
generated
vendored
Normal file
89
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createProxyServer", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createProxyServer;
|
||||
}
|
||||
});
|
||||
const _http = /*#__PURE__*/ _interop_require_default(require("http"));
|
||||
const _types = require("./types");
|
||||
const _fetchapi = require("./fetch-api");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function readBody(req) {
|
||||
const acc = [];
|
||||
for await (const chunk of req){
|
||||
acc.push(chunk);
|
||||
}
|
||||
return Buffer.concat(acc);
|
||||
}
|
||||
async function createProxyServer({ onFetch }) {
|
||||
const server = _http.default.createServer(async (req, res)=>{
|
||||
if (req.url !== '/') {
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
let json;
|
||||
try {
|
||||
json = JSON.parse((await readBody(req)).toString('utf-8'));
|
||||
} catch (e) {
|
||||
res.writeHead(400);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
const { api } = json;
|
||||
let response;
|
||||
switch(api){
|
||||
case 'fetch':
|
||||
if (onFetch) {
|
||||
response = await (0, _fetchapi.handleFetch)(json, onFetch);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!response) {
|
||||
response = _types.UNHANDLED;
|
||||
}
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
res.write(JSON.stringify(response));
|
||||
res.end();
|
||||
});
|
||||
await new Promise((resolve)=>{
|
||||
server.listen(0, '::', ()=>{
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
const address = server.address();
|
||||
if (!address || typeof address !== 'object') {
|
||||
server.close();
|
||||
throw Object.defineProperty(new Error('Failed to create a proxy server'), "__NEXT_ERROR_CODE", {
|
||||
value: "E107",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const port = address.port;
|
||||
const fetchWith = (input, init, testData)=>{
|
||||
const request = new Request(input, init);
|
||||
request.headers.set('Next-Test-Proxy-Port', String(port));
|
||||
request.headers.set('Next-Test-Data', testData ?? '');
|
||||
return fetch(request);
|
||||
};
|
||||
return {
|
||||
port,
|
||||
close: ()=>server.close(),
|
||||
fetchWith
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/server.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/proxy/server.ts"],"sourcesContent":["import http from 'http'\nimport type { IncomingMessage } from 'http'\nimport type { ProxyRequest, ProxyResponse, ProxyServer } from './types'\nimport { UNHANDLED } from './types'\nimport type { FetchHandler } from './fetch-api'\nimport { handleFetch } from './fetch-api'\n\nasync function readBody(req: IncomingMessage): Promise<Buffer> {\n const acc: Buffer[] = []\n\n for await (const chunk of req) {\n acc.push(chunk)\n }\n\n return Buffer.concat(acc)\n}\n\nexport async function createProxyServer({\n onFetch,\n}: {\n onFetch?: FetchHandler\n}): Promise<ProxyServer> {\n const server = http.createServer(async (req, res) => {\n if (req.url !== '/') {\n res.writeHead(404)\n res.end()\n return\n }\n\n let json: ProxyRequest | undefined\n try {\n json = JSON.parse((await readBody(req)).toString('utf-8')) as ProxyRequest\n } catch (e) {\n res.writeHead(400)\n res.end()\n return\n }\n\n const { api } = json\n\n let response: ProxyResponse | undefined\n switch (api) {\n case 'fetch':\n if (onFetch) {\n response = await handleFetch(json, onFetch)\n }\n break\n default:\n break\n }\n if (!response) {\n response = UNHANDLED\n }\n\n res.writeHead(200, { 'Content-Type': 'application/json' })\n res.write(JSON.stringify(response))\n res.end()\n })\n\n await new Promise((resolve) => {\n server.listen(0, '::', () => {\n resolve(undefined)\n })\n })\n\n const address = server.address()\n if (!address || typeof address !== 'object') {\n server.close()\n throw new Error('Failed to create a proxy server')\n }\n const port = address.port\n\n const fetchWith: ProxyServer['fetchWith'] = (input, init, testData) => {\n const request = new Request(input, init)\n request.headers.set('Next-Test-Proxy-Port', String(port))\n request.headers.set('Next-Test-Data', testData ?? '')\n return fetch(request)\n }\n\n return { port, close: () => server.close(), fetchWith }\n}\n"],"names":["createProxyServer","readBody","req","acc","chunk","push","Buffer","concat","onFetch","server","http","createServer","res","url","writeHead","end","json","JSON","parse","toString","e","api","response","handleFetch","UNHANDLED","write","stringify","Promise","resolve","listen","undefined","address","close","Error","port","fetchWith","input","init","testData","request","Request","headers","set","String","fetch"],"mappings":";;;;+BAiBsBA;;;eAAAA;;;6DAjBL;uBAGS;0BAEE;;;;;;AAE5B,eAAeC,SAASC,GAAoB;IAC1C,MAAMC,MAAgB,EAAE;IAExB,WAAW,MAAMC,SAASF,IAAK;QAC7BC,IAAIE,IAAI,CAACD;IACX;IAEA,OAAOE,OAAOC,MAAM,CAACJ;AACvB;AAEO,eAAeH,kBAAkB,EACtCQ,OAAO,EAGR;IACC,MAAMC,SAASC,aAAI,CAACC,YAAY,CAAC,OAAOT,KAAKU;QAC3C,IAAIV,IAAIW,GAAG,KAAK,KAAK;YACnBD,IAAIE,SAAS,CAAC;YACdF,IAAIG,GAAG;YACP;QACF;QAEA,IAAIC;QACJ,IAAI;YACFA,OAAOC,KAAKC,KAAK,CAAC,AAAC,CAAA,MAAMjB,SAASC,IAAG,EAAGiB,QAAQ,CAAC;QACnD,EAAE,OAAOC,GAAG;YACVR,IAAIE,SAAS,CAAC;YACdF,IAAIG,GAAG;YACP;QACF;QAEA,MAAM,EAAEM,GAAG,EAAE,GAAGL;QAEhB,IAAIM;QACJ,OAAQD;YACN,KAAK;gBACH,IAAIb,SAAS;oBACXc,WAAW,MAAMC,IAAAA,qBAAW,EAACP,MAAMR;gBACrC;gBACA;YACF;gBACE;QACJ;QACA,IAAI,CAACc,UAAU;YACbA,WAAWE,gBAAS;QACtB;QAEAZ,IAAIE,SAAS,CAAC,KAAK;YAAE,gBAAgB;QAAmB;QACxDF,IAAIa,KAAK,CAACR,KAAKS,SAAS,CAACJ;QACzBV,IAAIG,GAAG;IACT;IAEA,MAAM,IAAIY,QAAQ,CAACC;QACjBnB,OAAOoB,MAAM,CAAC,GAAG,MAAM;YACrBD,QAAQE;QACV;IACF;IAEA,MAAMC,UAAUtB,OAAOsB,OAAO;IAC9B,IAAI,CAACA,WAAW,OAAOA,YAAY,UAAU;QAC3CtB,OAAOuB,KAAK;QACZ,MAAM,qBAA4C,CAA5C,IAAIC,MAAM,oCAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAA2C;IACnD;IACA,MAAMC,OAAOH,QAAQG,IAAI;IAEzB,MAAMC,YAAsC,CAACC,OAAOC,MAAMC;QACxD,MAAMC,UAAU,IAAIC,QAAQJ,OAAOC;QACnCE,QAAQE,OAAO,CAACC,GAAG,CAAC,wBAAwBC,OAAOT;QACnDK,QAAQE,OAAO,CAACC,GAAG,CAAC,kBAAkBJ,YAAY;QAClD,OAAOM,MAAML;IACf;IAEA,OAAO;QAAEL;QAAMF,OAAO,IAAMvB,OAAOuB,KAAK;QAAIG;IAAU;AACxD"}
|
||||
43
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.d.ts
generated
vendored
Normal file
43
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
export interface ProxyServer {
|
||||
readonly port: number;
|
||||
fetchWith(input: string | URL, init?: RequestInit, testData?: string): Promise<Response>;
|
||||
close(): void;
|
||||
}
|
||||
interface ProxyRequestBase {
|
||||
testData: string;
|
||||
api: string;
|
||||
}
|
||||
interface ProxyResponseBase {
|
||||
api: string;
|
||||
}
|
||||
export interface ProxyUnhandledResponse extends ProxyResponseBase {
|
||||
api: 'unhandled';
|
||||
}
|
||||
export interface ProxyAbortResponse extends ProxyResponseBase {
|
||||
api: 'abort';
|
||||
}
|
||||
export interface ProxyContinueResponse extends ProxyResponseBase {
|
||||
api: 'continue';
|
||||
}
|
||||
export interface ProxyFetchRequest extends ProxyRequestBase {
|
||||
api: 'fetch';
|
||||
request: {
|
||||
url: string;
|
||||
headers: Array<[string, string]>;
|
||||
body: string | null;
|
||||
} & Omit<RequestInit, 'headers' | 'body'>;
|
||||
}
|
||||
export interface ProxyFetchResponse extends ProxyResponseBase {
|
||||
api: 'fetch';
|
||||
response: {
|
||||
status: number;
|
||||
headers: Array<[string, string]>;
|
||||
body: string | null;
|
||||
};
|
||||
}
|
||||
export type ProxyRequest = ProxyFetchRequest;
|
||||
export type ProxyResponse = ProxyUnhandledResponse | ProxyAbortResponse | ProxyContinueResponse | ProxyFetchResponse;
|
||||
export declare const ABORT: ProxyResponse;
|
||||
export declare const CONTINUE: ProxyResponse;
|
||||
export declare const UNHANDLED: ProxyResponse;
|
||||
export {};
|
||||
37
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.js
generated
vendored
Normal file
37
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ABORT: null,
|
||||
CONTINUE: null,
|
||||
UNHANDLED: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ABORT: function() {
|
||||
return ABORT;
|
||||
},
|
||||
CONTINUE: function() {
|
||||
return CONTINUE;
|
||||
},
|
||||
UNHANDLED: function() {
|
||||
return UNHANDLED;
|
||||
}
|
||||
});
|
||||
const ABORT = {
|
||||
api: 'abort'
|
||||
};
|
||||
const CONTINUE = {
|
||||
api: 'continue'
|
||||
};
|
||||
const UNHANDLED = {
|
||||
api: 'unhandled'
|
||||
};
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/proxy/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/proxy/types.ts"],"sourcesContent":["export interface ProxyServer {\n readonly port: number\n fetchWith(\n input: string | URL,\n init?: RequestInit,\n testData?: string\n ): Promise<Response>\n close(): void\n}\n\ninterface ProxyRequestBase {\n testData: string\n api: string\n}\n\ninterface ProxyResponseBase {\n api: string\n}\n\nexport interface ProxyUnhandledResponse extends ProxyResponseBase {\n api: 'unhandled'\n}\n\nexport interface ProxyAbortResponse extends ProxyResponseBase {\n api: 'abort'\n}\n\nexport interface ProxyContinueResponse extends ProxyResponseBase {\n api: 'continue'\n}\n\nexport interface ProxyFetchRequest extends ProxyRequestBase {\n api: 'fetch'\n request: {\n url: string\n headers: Array<[string, string]>\n body: string | null\n } & Omit<RequestInit, 'headers' | 'body'>\n}\n\nexport interface ProxyFetchResponse extends ProxyResponseBase {\n api: 'fetch'\n response: {\n status: number\n headers: Array<[string, string]>\n body: string | null\n }\n}\n\nexport type ProxyRequest = ProxyFetchRequest\n\nexport type ProxyResponse =\n | ProxyUnhandledResponse\n | ProxyAbortResponse\n | ProxyContinueResponse\n | ProxyFetchResponse\n\nexport const ABORT: ProxyResponse = { api: 'abort' }\nexport const CONTINUE: ProxyResponse = { api: 'continue' }\nexport const UNHANDLED: ProxyResponse = { api: 'unhandled' }\n"],"names":["ABORT","CONTINUE","UNHANDLED","api"],"mappings":";;;;;;;;;;;;;;;;IAyDaA,KAAK;eAALA;;IACAC,QAAQ;eAARA;;IACAC,SAAS;eAATA;;;AAFN,MAAMF,QAAuB;IAAEG,KAAK;AAAQ;AAC5C,MAAMF,WAA0B;IAAEE,KAAK;AAAW;AAClD,MAAMD,YAA2B;IAAEC,KAAK;AAAY"}
|
||||
2
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.d.ts
generated
vendored
Normal file
2
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function interceptTestApis(): () => void;
|
||||
export declare function wrapRequestHandler<T>(handler: (req: Request, fn: () => T) => T): (req: Request, fn: () => T) => T;
|
||||
32
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.js
generated
vendored
Normal file
32
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
interceptTestApis: null,
|
||||
wrapRequestHandler: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
interceptTestApis: function() {
|
||||
return interceptTestApis;
|
||||
},
|
||||
wrapRequestHandler: function() {
|
||||
return wrapRequestHandler;
|
||||
}
|
||||
});
|
||||
const _context = require("./context");
|
||||
const _fetch = require("./fetch");
|
||||
function interceptTestApis() {
|
||||
return (0, _fetch.interceptFetch)(global.fetch);
|
||||
}
|
||||
function wrapRequestHandler(handler) {
|
||||
return (req, fn)=>(0, _context.withRequest)(req, _fetch.reader, ()=>handler(req, fn));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server-edge.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/server-edge.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/experimental/testmode/server-edge.ts"],"sourcesContent":["import { withRequest as withRequestContext } from './context'\nimport { interceptFetch, reader } from './fetch'\n\nexport function interceptTestApis(): () => void {\n return interceptFetch(global.fetch)\n}\n\nexport function wrapRequestHandler<T>(\n handler: (req: Request, fn: () => T) => T\n): (req: Request, fn: () => T) => T {\n return (req, fn) => withRequestContext(req, reader, () => handler(req, fn))\n}\n"],"names":["interceptTestApis","wrapRequestHandler","interceptFetch","global","fetch","handler","req","fn","withRequestContext","reader"],"mappings":";;;;;;;;;;;;;;;IAGgBA,iBAAiB;eAAjBA;;IAIAC,kBAAkB;eAAlBA;;;yBAPkC;uBACX;AAEhC,SAASD;IACd,OAAOE,IAAAA,qBAAc,EAACC,OAAOC,KAAK;AACpC;AAEO,SAASH,mBACdI,OAAyC;IAEzC,OAAO,CAACC,KAAKC,KAAOC,IAAAA,oBAAkB,EAACF,KAAKG,aAAM,EAAE,IAAMJ,QAAQC,KAAKC;AACzE"}
|
||||
5
frontend/webapp/node_modules/next/dist/experimental/testmode/server.d.ts
generated
vendored
Normal file
5
frontend/webapp/node_modules/next/dist/experimental/testmode/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { WorkerRequestHandler } from '../../server/lib/types';
|
||||
import type { NodeRequestHandler } from '../../server/next-server';
|
||||
export declare function interceptTestApis(): () => void;
|
||||
export declare function wrapRequestHandlerWorker(handler: WorkerRequestHandler): WorkerRequestHandler;
|
||||
export declare function wrapRequestHandlerNode(handler: NodeRequestHandler): NodeRequestHandler;
|
||||
62
frontend/webapp/node_modules/next/dist/experimental/testmode/server.js
generated
vendored
Normal file
62
frontend/webapp/node_modules/next/dist/experimental/testmode/server.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
interceptTestApis: null,
|
||||
wrapRequestHandlerNode: null,
|
||||
wrapRequestHandlerWorker: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
interceptTestApis: function() {
|
||||
return interceptTestApis;
|
||||
},
|
||||
wrapRequestHandlerNode: function() {
|
||||
return wrapRequestHandlerNode;
|
||||
},
|
||||
wrapRequestHandlerWorker: function() {
|
||||
return wrapRequestHandlerWorker;
|
||||
}
|
||||
});
|
||||
const _context = require("./context");
|
||||
const _fetch = require("./fetch");
|
||||
const _httpget = require("./httpget");
|
||||
const reader = {
|
||||
url (req) {
|
||||
return req.url ?? '';
|
||||
},
|
||||
header (req, name) {
|
||||
const h = req.headers[name];
|
||||
if (h === undefined || h === null) {
|
||||
return null;
|
||||
}
|
||||
if (typeof h === 'string') {
|
||||
return h;
|
||||
}
|
||||
return h[0] ?? null;
|
||||
}
|
||||
};
|
||||
function interceptTestApis() {
|
||||
const originalFetch = global.fetch;
|
||||
const restoreFetch = (0, _fetch.interceptFetch)(originalFetch);
|
||||
const restoreHttpGet = (0, _httpget.interceptHttpGet)(originalFetch);
|
||||
// Cleanup.
|
||||
return ()=>{
|
||||
restoreFetch();
|
||||
restoreHttpGet();
|
||||
};
|
||||
}
|
||||
function wrapRequestHandlerWorker(handler) {
|
||||
return (req, res)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res));
|
||||
}
|
||||
function wrapRequestHandlerNode(handler) {
|
||||
return (req, res, parsedUrl)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res, parsedUrl));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/experimental/testmode/server.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/experimental/testmode/server.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/experimental/testmode/server.ts"],"sourcesContent":["import type { WorkerRequestHandler } from '../../server/lib/types'\nimport type { NodeRequestHandler } from '../../server/next-server'\nimport { withRequest, type TestRequestReader } from './context'\nimport { interceptFetch } from './fetch'\nimport { interceptHttpGet } from './httpget'\nimport type { IncomingMessage } from 'http'\n\nconst reader: TestRequestReader<IncomingMessage> = {\n url(req) {\n return req.url ?? ''\n },\n header(req, name) {\n const h = req.headers[name]\n if (h === undefined || h === null) {\n return null\n }\n if (typeof h === 'string') {\n return h\n }\n return h[0] ?? null\n },\n}\n\nexport function interceptTestApis(): () => void {\n const originalFetch = global.fetch\n const restoreFetch = interceptFetch(originalFetch)\n const restoreHttpGet = interceptHttpGet(originalFetch)\n\n // Cleanup.\n return () => {\n restoreFetch()\n restoreHttpGet()\n }\n}\n\nexport function wrapRequestHandlerWorker(\n handler: WorkerRequestHandler\n): WorkerRequestHandler {\n return (req, res) => withRequest(req, reader, () => handler(req, res))\n}\n\nexport function wrapRequestHandlerNode(\n handler: NodeRequestHandler\n): NodeRequestHandler {\n return (req, res, parsedUrl) =>\n withRequest(req, reader, () => handler(req, res, parsedUrl))\n}\n"],"names":["interceptTestApis","wrapRequestHandlerNode","wrapRequestHandlerWorker","reader","url","req","header","name","h","headers","undefined","originalFetch","global","fetch","restoreFetch","interceptFetch","restoreHttpGet","interceptHttpGet","handler","res","withRequest","parsedUrl"],"mappings":";;;;;;;;;;;;;;;;IAuBgBA,iBAAiB;eAAjBA;;IAkBAC,sBAAsB;eAAtBA;;IANAC,wBAAwB;eAAxBA;;;yBAjCoC;uBACrB;yBACE;AAGjC,MAAMC,SAA6C;IACjDC,KAAIC,GAAG;QACL,OAAOA,IAAID,GAAG,IAAI;IACpB;IACAE,QAAOD,GAAG,EAAEE,IAAI;QACd,MAAMC,IAAIH,IAAII,OAAO,CAACF,KAAK;QAC3B,IAAIC,MAAME,aAAaF,MAAM,MAAM;YACjC,OAAO;QACT;QACA,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOA;QACT;QACA,OAAOA,CAAC,CAAC,EAAE,IAAI;IACjB;AACF;AAEO,SAASR;IACd,MAAMW,gBAAgBC,OAAOC,KAAK;IAClC,MAAMC,eAAeC,IAAAA,qBAAc,EAACJ;IACpC,MAAMK,iBAAiBC,IAAAA,yBAAgB,EAACN;IAExC,WAAW;IACX,OAAO;QACLG;QACAE;IACF;AACF;AAEO,SAASd,yBACdgB,OAA6B;IAE7B,OAAO,CAACb,KAAKc,MAAQC,IAAAA,oBAAW,EAACf,KAAKF,QAAQ,IAAMe,QAAQb,KAAKc;AACnE;AAEO,SAASlB,uBACdiB,OAA2B;IAE3B,OAAO,CAACb,KAAKc,KAAKE,YAChBD,IAAAA,oBAAW,EAACf,KAAKF,QAAQ,IAAMe,QAAQb,KAAKc,KAAKE;AACrD"}
|
||||
Reference in New Issue
Block a user