Unverified Commit 374ab4bf authored by Meno Abels's avatar Meno Abels Committed by GitHub

Update edge runtime to 1.1.0-beta.37 (#41211)

update of the edge-runtime to 1.1.0-beta.37.
Co-authored-by: 's avatarKiko Beats <2096101+Kikobeats@users.noreply.github.com>
parent 1418e4db
......@@ -57,7 +57,7 @@
"@babel/plugin-proposal-object-rest-spread": "7.14.7",
"@babel/preset-flow": "7.14.5",
"@babel/preset-react": "7.14.5",
"@edge-runtime/jest-environment": "1.1.0-beta.33",
"@edge-runtime/jest-environment": "1.1.0-beta.34",
"@fullhuman/postcss-purgecss": "1.3.0",
"@mdx-js/loader": "0.18.0",
"@next/bundle-analyzer": "workspace:*",
......
......@@ -105,9 +105,7 @@ function createCaches() {
});
} catch (error) {
if (error.message === "disturbed") {
throw new TypeError(
"Failed to execute 'put' on 'Cache': Response body is already used"
);
throw new TypeError("The body has already been consumed.");
}
throw error;
}
......
{"name":"@edge-runtime/primitives","version":"1.1.0-beta.34","main":"./index.js","license":"MPLv2"}
{"name":"@edge-runtime/primitives","version":"1.1.0-beta.36","main":"./index.js","license":"MPLv2"}
......@@ -3372,10 +3372,10 @@ module.exports = __toCommonJS(url_exports);
init_define_process();
var import_whatwg_url = __toESM(require_whatwg_url());
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.9/node_modules/urlpattern-polyfill/index.js
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/index.js
init_define_process();
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.9/node_modules/urlpattern-polyfill/dist/urlpattern.js
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/dist/urlpattern.js
init_define_process();
var regexIdentifierStart = /[$_\p{ID_Start}]/u;
var regexIdentifierPart = /[$_\u200C\u200D\p{ID_Continue}]/u;
......@@ -3608,7 +3608,7 @@ function escapeString(str) {
}
__name(escapeString, "escapeString");
function flags(options) {
return options && options.sensitive ? "u" : "ui";
return options && options.ignoreCase ? "ui" : "u";
}
__name(flags, "flags");
function regexpToRegexp(path, keys) {
......@@ -4402,30 +4402,37 @@ function tokensToPattern(tokens, options) {
}
__name(tokensToPattern, "tokensToPattern");
var URLPattern = /* @__PURE__ */ __name(class {
constructor(init = {}, baseURL) {
constructor(init = {}, baseURLOrOptions, options) {
this.regexp = {};
this.keys = {};
this.component_pattern = {};
try {
let baseURL = void 0;
if (typeof baseURLOrOptions === "string") {
baseURL = baseURLOrOptions;
} else {
options = baseURLOrOptions;
}
if (typeof init === "string") {
const parser = new Parser(init);
parser.parse();
init = parser.result;
if (baseURL) {
if (typeof baseURL === "string") {
init.baseURL = baseURL;
} else {
throw new TypeError(`'baseURL' parameter is not of type 'string'.`);
}
} else if (typeof init.protocol !== "string") {
if (baseURL === void 0 && typeof init.protocol !== "string") {
throw new TypeError(`A base URL must be provided for a relative constructor string.`);
}
} else if (baseURL) {
throw new TypeError(`parameter 1 is not of type 'string'.`);
init.baseURL = baseURL;
} else {
if (!init || typeof init !== "object") {
throw new TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);
}
if (baseURL) {
throw new TypeError(`parameter 1 is not of type 'string'.`);
}
}
if (!init || typeof init !== "object") {
throw new TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);
if (typeof options === "undefined") {
options = { ignoreCase: false };
}
const ignoreCaseOptions = { ignoreCase: options.ignoreCase === true };
const defaults = {
pathname: DEFAULT_PATTERN,
protocol: DEFAULT_PATTERN,
......@@ -4444,56 +4451,56 @@ var URLPattern = /* @__PURE__ */ __name(class {
for (component of COMPONENTS) {
if (!(component in this.pattern))
continue;
const options = {};
const options2 = {};
const pattern = this.pattern[component];
this.keys[component] = [];
switch (component) {
case "protocol":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = protocolEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = protocolEncodeCallback;
break;
case "username":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = usernameEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = usernameEncodeCallback;
break;
case "password":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = passwordEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = passwordEncodeCallback;
break;
case "hostname":
Object.assign(options, HOSTNAME_OPTIONS);
Object.assign(options2, HOSTNAME_OPTIONS);
if (treatAsIPv6Hostname(pattern)) {
options.encodePart = ipv6HostnameEncodeCallback;
options2.encodePart = ipv6HostnameEncodeCallback;
} else {
options.encodePart = hostnameEncodeCallback;
options2.encodePart = hostnameEncodeCallback;
}
break;
case "port":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = portEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS);
options2.encodePart = portEncodeCallback;
break;
case "pathname":
if (isSpecialScheme(this.regexp.protocol)) {
Object.assign(options, PATHNAME_OPTIONS);
options.encodePart = standardURLPathnameEncodeCallback;
Object.assign(options2, PATHNAME_OPTIONS, ignoreCaseOptions);
options2.encodePart = standardURLPathnameEncodeCallback;
} else {
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = pathURLPathnameEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = pathURLPathnameEncodeCallback;
}
break;
case "search":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = searchEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = searchEncodeCallback;
break;
case "hash":
Object.assign(options, DEFAULT_OPTIONS);
options.encodePart = hashEncodeCallback;
Object.assign(options2, DEFAULT_OPTIONS, ignoreCaseOptions);
options2.encodePart = hashEncodeCallback;
break;
}
try {
const tokens = parse(pattern, options);
this.regexp[component] = tokensToRegexp(tokens, this.keys[component], options);
this.component_pattern[component] = tokensToPattern(tokens, options);
const tokens = parse(pattern, options2);
this.regexp[component] = tokensToRegexp(tokens, this.keys[component], options2);
this.component_pattern[component] = tokensToPattern(tokens, options2);
} catch {
throw new TypeError(`invalid ${component} pattern '${this.pattern[component]}'.`);
}
......@@ -4529,7 +4536,7 @@ var URLPattern = /* @__PURE__ */ __name(class {
return false;
}
let component;
for (component in this.pattern) {
for (component of COMPONENTS) {
if (!this.regexp[component].exec(values[component])) {
return false;
}
......@@ -4569,7 +4576,7 @@ var URLPattern = /* @__PURE__ */ __name(class {
result.inputs = [input];
}
let component;
for (component in this.pattern) {
for (component of COMPONENTS) {
let match = this.regexp[component].exec(values[component]);
if (!match) {
return null;
......@@ -4614,7 +4621,7 @@ var URLPattern = /* @__PURE__ */ __name(class {
}
}, "URLPattern");
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.9/node_modules/urlpattern-polyfill/index.js
// ../../node_modules/.pnpm/urlpattern-polyfill@6.0.1/node_modules/urlpattern-polyfill/index.js
if (!globalThis.URLPattern) {
globalThis.URLPattern = URLPattern;
}
......
......@@ -116,7 +116,7 @@
"@babel/runtime": "7.15.4",
"@babel/traverse": "7.18.0",
"@babel/types": "7.18.0",
"@edge-runtime/primitives": "1.1.0-beta.34",
"@edge-runtime/primitives": "1.1.0-beta.36",
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.7.0",
"@napi-rs/triples": "1.1.0",
......@@ -194,7 +194,7 @@
"debug": "4.1.1",
"devalue": "2.0.1",
"domain-browser": "4.19.0",
"edge-runtime": "1.1.0-beta.34",
"edge-runtime": "1.1.0-beta.37",
"events": "3.3.0",
"find-cache-dir": "3.3.1",
"find-up": "4.1.0",
......
......@@ -127,6 +127,15 @@ function getDecorateUnhandledError(runtime: EdgeRuntime) {
}
}
function getDecorateUnhandledRejection(runtime: EdgeRuntime) {
const EdgeRuntimeError = runtime.evaluate(`Error`)
return (rejected: { reason: typeof EdgeRuntimeError }) => {
if (rejected.reason instanceof EdgeRuntimeError) {
decorateServerError(rejected.reason, COMPILER_NAMES.edgeServer)
}
}
}
/**
* Create a module cache specific for the provided parameters. It includes
* a runtime context, require cache and paths cache.
......@@ -282,8 +291,12 @@ Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`),
})
const decorateUnhandledError = getDecorateUnhandledError(runtime)
runtime.context.addEventListener('unhandledrejection', decorateUnhandledError)
runtime.context.addEventListener('error', decorateUnhandledError)
const decorateUnhandledRejection = getDecorateUnhandledRejection(runtime)
runtime.context.addEventListener(
'unhandledrejection',
decorateUnhandledRejection
)
return {
runtime,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment