Skip to content

Commit

Permalink
build: upgrade edge-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jul 27, 2022
1 parent d5875c1 commit 6fbffb8
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 176 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -56,7 +56,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.17",
"@edge-runtime/jest-environment": "1.1.0-beta.23",
"@fullhuman/postcss-purgecss": "1.3.0",
"@mdx-js/loader": "0.18.0",
"@next/bundle-analyzer": "workspace:*",
Expand Down
53 changes: 12 additions & 41 deletions packages/next/compiled/@edge-runtime/primitives/cache.js
Expand Up @@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/primitives/cache.js
var cache_exports = {};
__export(cache_exports, {
Cache: () => CacheFromStorage,
Cache: () => Cache,
CacheStorage: () => CacheStorage,
caches: () => caches,
createCaches: () => createCaches
Expand Down Expand Up @@ -130,53 +130,24 @@ function createCaches() {
return { Cache: Cache2, cacheStorage };
}
__name(createCaches, "createCaches");
function CacheStorage() {
if (!(this instanceof CacheStorage))
return new CacheStorage();
throw TypeError("Illegal constructor");
}
__name(CacheStorage, "CacheStorage");
function CacheStorageToString() {
return "function CacheStorage() { [native code] }";
}
__name(CacheStorageToString, "CacheStorageToString");
Object.defineProperty(CacheStorageToString, "name", {
configurable: true,
enumerable: false,
value: "toString() { [native code] }",
writable: true
});
Object.defineProperty(CacheStorage, "toString", {
configurable: true,
enumerable: false,
value: CacheStorageToString,
writable: true
});
function Cache() {
if (!(this instanceof Cache))
return new Cache();
throw TypeError("Illegal constructor");
}
__name(Cache, "Cache");
function CacheToString() {
return "function Cache() { [native code] }";
function CacheStorage() {
if (!(this instanceof CacheStorage))
return new CacheStorage();
throw TypeError("Illegal constructor");
}
__name(CacheToString, "CacheToString");
Object.defineProperty(CacheToString, "name", {
configurable: true,
enumerable: false,
value: "toString() { [native code] }",
writable: true
});
Object.defineProperty(Cache, "toString", {
configurable: true,
enumerable: false,
value: CacheToString,
writable: true
});
var cachesStorage = createCaches();
var CacheFromStorage = cachesStorage.Cache;
var caches = cachesStorage.cacheStorage();
__name(CacheStorage, "CacheStorage");
var caches = (() => {
const { cacheStorage } = createCaches();
const caches2 = cacheStorage();
caches2.open("default");
return caches2;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Cache,
Expand Down
45 changes: 27 additions & 18 deletions packages/next/compiled/@edge-runtime/primitives/console.js
Expand Up @@ -105,6 +105,15 @@ var require_dist = __commonJS({
if (formattedPrimitive !== void 0) {
return formattedPrimitive;
}
const symbols = Object.getOwnPropertySymbols(value);
if (symbols.length > 0) {
symbols.forEach((symbol) => {
const obj = value;
const symbolKey = `[${symbol.toString()}]`;
obj[symbolKey] = obj[symbol];
delete obj[symbol];
});
}
const keys = ctx.showHidden ? Object.getOwnPropertyNames(value) : Object.keys(value);
const visibleKeys = /* @__PURE__ */ new Set();
keys.forEach((key) => visibleKeys.add(key));
Expand All @@ -121,8 +130,10 @@ var require_dist = __commonJS({
return format2(value[ctx.customInspectSymbol]());
}
}
const isValueFunction = kind(value, "function");
const isValueArray = Array.isArray(value);
let base = "";
if (kind(value, "function")) {
if (isValueFunction) {
base = `[Function${value.name ? ": " + value.name : ""}]`;
} else if (isRegExp(value)) {
base = " " + RegExp.prototype.toString.call(value);
Expand All @@ -133,25 +144,25 @@ var require_dist = __commonJS({
} else if (hasCustomSymbol(value, ctx.customInspectSymbol)) {
base = " " + value[ctx.customInspectSymbol]();
}
const braces = Array.isArray(value) ? ["[", "]"] : ["{", "}"];
if (keys.length === 0 && (!Array.isArray(value) || value.length === 0)) {
const braces = isValueArray ? ["[", "]"] : isValueFunction ? ["", ""] : ["{", "}"];
if (keys.length === 0 && (!isValueArray || value.length === 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes && recurseTimes < 0) {
return isRegExp(value) ? RegExp.prototype.toString.call(value) : "[Object]";
}
ctx.seen.push(value);
const output = Array.isArray(value) ? formatArray(ctx, value, recurseTimes, visibleKeys, keys) : keys.map((key) => formatProperty(ctx, value, recurseTimes, visibleKeys, key, false));
let output = isValueArray ? formatArray(ctx, value, recurseTimes, visibleKeys, keys) : keys.map((key) => formatProperty(ctx, value, recurseTimes, visibleKeys, key, false));
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
return reduceToSingleString(output, base, braces, isValueFunction);
}
__name(formatValue, "formatValue");
function inspect(value, opts2) {
opts2 = Object.assign({ seen: [], depth: 2 }, opts2);
return formatValue(opts2, value, opts2.depth);
}
__name(inspect, "inspect");
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, isArray) {
let name;
let str;
const desc = Object.getOwnPropertyDescriptor(value, key) || {
Expand All @@ -169,7 +180,7 @@ var require_dist = __commonJS({
if (ctx.seen.indexOf(desc.value) < 0) {
str = formatValue(ctx, desc.value, recurseTimes === null || recurseTimes === void 0 ? null : recurseTimes - 1);
if (str.indexOf("\n") > -1) {
if (array) {
if (isArray) {
str = str.split("\n").map((line) => ` ${line}`).join("\n").slice(2);
} else {
str = "\n" + str.split("\n").map((line) => ` ${line}`).join("\n");
Expand All @@ -180,17 +191,11 @@ var require_dist = __commonJS({
}
}
if (name === void 0) {
if (array && key.match(/^\d+$/)) {
if (isArray && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify("" + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.slice(1, -1);
} else {
name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
}
}
return `${name}: ${str}`;
return `${key}: ${str}`;
}
__name(formatProperty, "formatProperty");
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
Expand Down Expand Up @@ -252,14 +257,18 @@ var require_dist = __commonJS({
return kind(value, "object") && (Object.prototype.toString.call(value) === "[object Error]" || value instanceof Error);
}
__name(isError, "isError");
function reduceToSingleString(output, base, braces) {
function reduceToSingleString(output, base, braces, isValueFunction) {
const length = output.reduce((prev, cur) => {
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
if (length > 60) {
return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
const prefix2 = isValueFunction ? " {" : "";
const suffix2 = isValueFunction ? "\n}" : " ";
return braces[0] + (base === "" ? "" : base + prefix2 + "\n ") + ` ${output.join(",\n ")}` + suffix2 + braces[1];
}
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
const prefix = isValueFunction ? " { " : " ";
const suffix = isValueFunction ? " } " : " ";
return (braces[0] + base + prefix + output.join(", ") + suffix + braces[1]).trim();
}
__name(reduceToSingleString, "reduceToSingleString");
function safeStringify(object) {
Expand Down
16 changes: 0 additions & 16 deletions packages/next/compiled/@edge-runtime/primitives/crypto.js
Expand Up @@ -9551,22 +9551,6 @@ function SubtleCrypto3() {
throw TypeError("Illegal constructor");
}
__name(SubtleCrypto3, "SubtleCrypto");
function SubtleCryptoToString() {
return "function SubtleCrypto() { [native code] }";
}
__name(SubtleCryptoToString, "SubtleCryptoToString");
Object.defineProperty(SubtleCryptoToString, "name", {
configurable: true,
enumerable: false,
value: "toString() { [native code] }",
writable: true
});
Object.defineProperty(SubtleCrypto3, "toString", {
configurable: true,
enumerable: false,
value: SubtleCryptoToString,
writable: true
});
var crypto2 = new Crypto3();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Expand Down
21 changes: 8 additions & 13 deletions packages/next/compiled/@edge-runtime/primitives/fetch.js
Expand Up @@ -4249,9 +4249,9 @@ var require_pool_base = __commonJS({
}
});

// ../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/request.js
var require_request2 = __commonJS({
"../../node_modules/.pnpm/undici@5.5.1/node_modules/undici/lib/core/request.js"(exports, module2) {
// src/patches/undici-core-request.js
var require_undici_core_request = __commonJS({
"src/patches/undici-core-request.js"(exports, module2) {
"use strict";
init_define_process();
var {
Expand Down Expand Up @@ -4408,7 +4408,10 @@ var require_request2 = __commonJS({
assert(!this.aborted);
assert(!this.completed);
if (channels.headers.hasSubscribers) {
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
channels.headers.publish({
request: this,
response: { statusCode, headers, statusText }
});
}
return this[kHandler].onHeaders(statusCode, headers, resume, statusText);
}
Expand Down Expand Up @@ -4463,14 +4466,6 @@ var require_request2 = __commonJS({
request.contentType = val;
request.headers += `${key}: ${val}\r
`;
} else if (key.length === 17 && key.toLowerCase() === "transfer-encoding") {
throw new InvalidArgumentError2("invalid transfer-encoding header");
} else if (key.length === 10 && key.toLowerCase() === "connection") {
throw new InvalidArgumentError2("invalid connection header");
} else if (key.length === 10 && key.toLowerCase() === "keep-alive") {
throw new InvalidArgumentError2("invalid keep-alive header");
} else if (key.length === 7 && key.toLowerCase() === "upgrade") {
throw new InvalidArgumentError2("invalid upgrade header");
} else if (key.length === 6 && key.toLowerCase() === "expect") {
throw new NotSupportedError("expect header not supported");
} else {
Expand Down Expand Up @@ -5083,7 +5078,7 @@ var require_client = __commonJS({
var assert = require("assert");
var net = require("net");
var util = require_util();
var Request2 = require_request2();
var Request2 = require_undici_core_request();
var DispatcherBase = require_dispatcher_base();
var RedirectHandler = require_redirect();
var {
Expand Down
@@ -1 +1 @@
{"name":"@edge-runtime/primitives","version":"1.1.0-beta.17","main":"./index.js","license":"MPLv2"}
{"name":"@edge-runtime/primitives","version":"1.1.0-beta.23","main":"./index.js","license":"MPLv2"}
6 changes: 3 additions & 3 deletions packages/next/compiled/@edge-runtime/primitives/url.js
Expand Up @@ -3328,10 +3328,10 @@ module.exports = __toCommonJS(url_exports);
init_define_process();
var import_whatwg_url = __toESM(require_whatwg_url());

// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.3/node_modules/urlpattern-polyfill/index.js
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.5/node_modules/urlpattern-polyfill/index.js
init_define_process();

// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.3/node_modules/urlpattern-polyfill/dist/urlpattern.js
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.5/node_modules/urlpattern-polyfill/dist/urlpattern.js
init_define_process();
var regexIdentifierStart = /[$_\p{ID_Start}]/u;
var regexIdentifierPart = /[$_\u200C\u200D\p{ID_Continue}]/u;
Expand Down Expand Up @@ -4573,7 +4573,7 @@ var URLPattern = /* @__PURE__ */ __name(class {
}
}, "URLPattern");

// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.3/node_modules/urlpattern-polyfill/index.js
// ../../node_modules/.pnpm/urlpattern-polyfill@5.0.5/node_modules/urlpattern-polyfill/index.js
if (!globalThis.URLPattern) {
globalThis.URLPattern = URLPattern;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/compiled/edge-runtime/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/next/compiled/webpack/bundle5.js
Expand Up @@ -9372,7 +9372,7 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {

/***/ }),

/***/ 81579:
/***/ 90099:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -100575,7 +100575,7 @@ module.exports.chunkHasJs = chunkHasJs;


const { Parser: AcornParser } = __webpack_require__(31988);
const { importAssertions } = __webpack_require__(81579);
const { importAssertions } = __webpack_require__(90099);
const { SyncBailHook, HookMap } = __webpack_require__(44217);
const vm = __webpack_require__(26144);
const Parser = __webpack_require__(68646);
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Expand Up @@ -117,7 +117,7 @@
"@babel/runtime": "7.15.4",
"@babel/traverse": "7.18.0",
"@babel/types": "7.18.0",
"@edge-runtime/primitives": "1.1.0-beta.17",
"@edge-runtime/primitives": "1.1.0-beta.23",
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.4.4",
"@napi-rs/triples": "1.1.0",
Expand Down Expand Up @@ -194,7 +194,7 @@
"debug": "4.1.1",
"devalue": "2.0.1",
"domain-browser": "4.19.0",
"edge-runtime": "1.1.0-beta.17",
"edge-runtime": "1.1.0-beta.23",
"events": "3.3.0",
"find-cache-dir": "3.3.1",
"find-up": "4.1.0",
Expand Down

0 comments on commit 6fbffb8

Please sign in to comment.