file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
crates/swc_ecma_transforms_base/tests/resolver/module/001/input.js
JavaScript
import { foo as foo } from "src";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/module/001/output.js
JavaScript
import { foo__0 as foo__2 } from "src";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/named-export/input.js
JavaScript
export { a as b } from "foo"; export { b as c } from "far";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/named-export/output.js
JavaScript
export { a__0 as b__0 } from "foo"; export { b__0 as c__0 } from "far";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/arrow_expr/var/scope/input.js
JavaScript
var Test = (() => { var Test = (() => { var Test = 2; return Test; })(); return Test; })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/arrow_expr/var/scope/output.js
JavaScript
var Test__2 = (()=>{ var Test__3 = (()=>{ var Test__4 = 2; return Test__4; })(); return Test__3; })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/fn_expr/var/scope/fn/input.js
JavaScript
var Test = (function () { var Test = (function () { function Test() {} return Test; })(); return Test; })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/fn_expr/var/scope/fn/output.js
JavaScript
var Test__2 = function() { var Test__3 = function() { function Test__4() {} return Test__4; }(); return Test__3; }();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/fn_expr/var/scope/input.js
JavaScript
var Test = (function () { var Test = (function () { var Test = 2; return Test; })(); return Test; })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/nested/fn_expr/var/scope/output.js
JavaScript
var Test__2 = function() { var Test__3 = function() { var Test__4 = 2; return Test__4; }(); return Test__3; }();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/next-66237/input.js
JavaScript
"use strict"; (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[854], { /***/ 3712: /***/ (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ $Q: function () { return /* binding */ C; }, /* harmony export */ Ev: function () { return /* binding */ B; }, /* harmony export */ e_: function () { return /* binding */ I; }, /* harmony export */ jU: function () { return /* binding */ e; } /* harmony export */ }); /* unused harmony exports ACTION_ELEMENTS, SbbScrollHandler, breakpoints, findInput, findReferencedElement, hostContext, isAndroid, isBlink, isBreakpoint, isChromium, isEdge, isFirefox, isIOS, isNextjs, isSafari, isTrident, isWebkit, pageScrollDisabled */ let a; try { a = typeof Intl < "u" && Intl.v8BreakIterator; } catch (e) { a = !1; } const e = () => typeof document == "object" && !!document, l = () => e() && /(edge)/i.test(navigator.userAgent), c = () => e() && /(msie|trident)/i.test(navigator.userAgent), y = () => e() && !!(window.chrome || a) && typeof CSS < "u" && !l() && !c(), g = () => e() && /AppleWebKit/i.test(navigator.userAgent) && !y() && !l() && !c(), w = () => e() && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window), v = () => e() && /(firefox|minefield)/i.test(navigator.userAgent), A = () => e() && /android/i.test(navigator.userAgent) && !c(), E = () => e() && /safari/i.test(navigator.userAgent) && g(), p = () => !!globalThis.next, S = () => { var t, n; return (n = (t = navigator.userAgentData) == null ? void 0 : t.brands) == null ? void 0 : n.some((o) => o.brand == "Chromium"); } }), }]);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/next-66237/output.js
JavaScript
"use strict"; (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([ [ 854 ], { 3712: function(__unused_webpack___webpack_module____3, __webpack_exports____3, __webpack_require____3) { __webpack_require____3.d(__webpack_exports____3, { $Q: function() { return C; }, Ev: function() { return B; }, e_: function() { return I; }, jU: function() { return e__3; } }); let a__3; try { a__3 = typeof Intl < "u" && Intl.v8BreakIterator; } catch (e__9) { a__3 = !1; } const e__3 = ()=>typeof document == "object" && !!document, l__3 = ()=>e__3() && /(edge)/i.test(navigator.userAgent), c__3 = ()=>e__3() && /(msie|trident)/i.test(navigator.userAgent), y__3 = ()=>e__3() && !!(window.chrome || a__3) && typeof CSS < "u" && !l__3() && !c__3(), g__3 = ()=>e__3() && /AppleWebKit/i.test(navigator.userAgent) && !y__3() && !l__3() && !c__3(), w__3 = ()=>e__3() && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window), v__3 = ()=>e__3() && /(firefox|minefield)/i.test(navigator.userAgent), A__3 = ()=>e__3() && /android/i.test(navigator.userAgent) && !c__3(), E__3 = ()=>e__3() && /safari/i.test(navigator.userAgent) && g__3(), p__3 = ()=>!!globalThis.next, S__3 = ()=>{ var t__10, n__10; return (n__10 = (t__10 = navigator.userAgentData) == null ? void 0 : t__10.brands) == null ? void 0 : n__10.some((o__11)=>o__11.brand == "Chromium"); }; } } ]);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/next/react-fast-refresh/1/input.js
JavaScript
import dynamic from "next/dynamic"; export const Comp = dynamic(() => import("../Content"), { ssr: false });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/next/react-fast-refresh/1/output.js
JavaScript
import dynamic__2 from "next/dynamic"; export const Comp__2 = dynamic__2(()=>import("../Content"), { ssr: false });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pass/assignment/input.js
JavaScript
let a = 1; a = 2; expect(a).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pass/assignment/output.js
JavaScript
let a__2 = 1; a__2 = 2; expect(a__2).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pass/call/input.js
JavaScript
let a = 1; function b() { return a + 1; } expect(b()).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pass/call/output.js
JavaScript
let a__2 = 1; function b__2() { return a__2 + 1; } expect(b__2()).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pr_1171/1/input.js
JavaScript
function isAbsolute() {} function parse(path) { const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; if (isAbsolute) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pr_1171/1/output.js
JavaScript
function isAbsolute__2() {} function parse__2(path__4) { const isAbsolute__4 = path__4.charCodeAt(0) === CHAR_FORWARD_SLASH; if (isAbsolute__4) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pr_1171/2/input.js
JavaScript
function parse(path) { const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; if (isAbsolute) { } } function isAbsolute() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/pr_1171/2/output.js
JavaScript
function parse__2(path__3) { const isAbsolute__3 = path__3.charCodeAt(0) === CHAR_FORWARD_SLASH; if (isAbsolute__3) {} } function isAbsolute__2() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression/001/input.js
JavaScript
var sym = Symbol(); class Foo { [sym]() { return 1; } } class Bar extends Foo { [sym]() { return super[sym]() + 2; } } var i = new Bar(); expect(i[sym]()).toBe(3);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression/001/output.js
JavaScript
var sym__2 = Symbol(); class Foo__2 { [sym__2]() { return 1; } } class Bar__2 extends Foo__2 { [sym__2]() { return super[sym__2]() + 2; } } var i__2 = new Bar__2(); expect(i__2[sym__2]()).toBe(3);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression/002/input.js
JavaScript
var sym = Symbol(); var Foo = (function () { function Foo() { _classCallCheck(this, Foo); } _createClass(Foo, [ { key: sym, value: function () { return 1; }, }, ]); return Foo; })(); var Bar = (function (_Foo) { _inherits(Bar, _Foo); function Bar() { _classCallCheck(this, Bar); return _possibleConstructorReturn( this, _getPrototypeOf(Bar).apply(this, arguments) ); } _createClass(Bar, [ { key: sym, value: function () { return _get(_getPrototypeOf(Bar.prototype), sym, this)() + 2; }, }, ]); return Bar; })(Foo); var i = new Bar(); expect(i[sym]()).toBe(3);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression/002/output.js
JavaScript
var sym__2 = Symbol(); var Foo__2 = function() { function Foo__3() { _classCallCheck(this, Foo__3); } _createClass(Foo__3, [ { key: sym__2, value: function() { return 1; } } ]); return Foo__3; }(); var Bar__2 = function(_Foo__6) { _inherits(Bar__6, _Foo__6); function Bar__6() { _classCallCheck(this, Bar__6); return _possibleConstructorReturn(this, _getPrototypeOf(Bar__6).apply(this, arguments)); } _createClass(Bar__6, [ { key: sym__2, value: function() { return _get(_getPrototypeOf(Bar__6.prototype), sym__2, this)() + 2; } } ]); return Bar__6; }(Foo__2); var i__2 = new Bar__2(); expect(i__2[sym__2]()).toBe(3);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression_of_454/input.js
JavaScript
function broken(x) { var Foo = (function (_Bar) { _inherits(Foo, _Bar); function Foo() { _classCallCheck(this, Foo); return _possibleConstructorReturn( this, _getPrototypeOf(Foo).apply(this, arguments) ); } return Foo; })(Bar); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/regression_of_454/output.js
JavaScript
function broken__2(x__3) { var Foo__3 = function(_Bar__4) { _inherits(Foo__4, _Bar__4); function Foo__4() { _classCallCheck(this, Foo__4); return _possibleConstructorReturn(this, _getPrototypeOf(Foo__4).apply(this, arguments)); } return Foo__4; }(Bar); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/same-level/input.js
JavaScript
var a = "foo"; var a = "bar";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/same-level/output.js
JavaScript
var a__2 = "foo"; var a__2 = "bar";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/shorthand/input.js
JavaScript
let a = "foo"; function foo() { let a = "bar"; use({ a }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/shorthand/output.js
JavaScript
let a__2 = "foo"; function foo__2() { let a__3 = "bar"; use({ a__3 }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/ts/es5/for/of/27/input.js
JavaScript
for (var { x: a = 0, y: b = 1 } of [2, 3]) { a; b; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/ts/es5/for/of/27/output.js
JavaScript
for (var { x: a__2 = 0, y: b__2 = 1 } of [ 2, 3 ]){ a__2; b__2; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/1/input.js
JavaScript
foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/1/output.js
JavaScript
foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/2/input.js
JavaScript
foo(); var foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/2/output.js
JavaScript
foo__2(); var foo__2;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/3/input.js
JavaScript
foo(); function foo() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/unresolved-mark/3/output.js
JavaScript
foo__2(); function foo__2() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/update/input.js
JavaScript
let a = 1; a++; expect(a).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/update/output.js
JavaScript
let a__2 = 1; a__2++; expect(a__2).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/1/input.js
JavaScript
import { Writable } from "stream"; import * as ReactDOMServer from "react-dom/server"; import { StyleRegistry, createStyleRegistry } from "styled-jsx"; import { warn } from "../build/output/log"; import { GSP_NO_RETURNED_VALUE, GSSP_COMPONENT_MEMBER_ERROR, GSSP_NO_RETURNED_VALUE, STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR, SERVER_PROPS_GET_INIT_PROPS_CONFLICT, SERVER_PROPS_SSG_CONFLICT, SSG_GET_INITIAL_PROPS_CONFLICT, UNSTABLE_REVALIDATE_RENAME_ERROR, } from "../lib/constants"; import { isSerializableProps } from "../lib/is-serializable-props"; import { isInAmpMode } from "../shared/lib/amp"; import { AmpStateContext } from "../shared/lib/amp-context"; import { BODY_RENDER_TARGET, SERVER_PROPS_ID, STATIC_PROPS_ID, STATIC_STATUS_PAGES, } from "../shared/lib/constants"; import { defaultHead } from "../shared/lib/head"; import { HeadManagerContext } from "../shared/lib/head-manager-context"; import Loadable from "../shared/lib/loadable"; import { LoadableContext } from "../shared/lib/loadable-context"; import postProcess from "../shared/lib/post-process"; import { RouterContext } from "../shared/lib/router-context"; import { isDynamicRoute } from "../shared/lib/router/utils/is-dynamic"; import { HtmlContext, getDisplayName, isResSent, loadGetInitialProps, } from "../shared/lib/utils"; import { tryGetPreviewData } from "./api-utils"; import { denormalizePagePath } from "./denormalize-page-path"; import { getFontDefinitionFromManifest } from "./font-utils"; import { normalizePagePath } from "./normalize-page-path"; import optimizeAmp from "./optimize-amp"; import { allowedStatusCodes, getRedirectStatus, } from "../lib/load-custom-routes"; import RenderResult from "./render-result"; import isError from "../lib/is-error"; function noRouter() { const message = 'No router instance found. you should only use "next/router" inside the client side of your app. https://nextjs.org/docs/messages/no-router-instance'; throw new Error(message); } class ServerRouter { constructor( pathname, query, as, { isFallback }, isReady, basePath, locale, locales, defaultLocale, domainLocales, isPreview, isLocaleDomain ) { this.route = pathname.replace(/\/$/, "") || "/"; this.pathname = pathname; this.query = query; this.asPath = as; this.isFallback = isFallback; this.basePath = basePath; this.locale = locale; this.locales = locales; this.defaultLocale = defaultLocale; this.isReady = isReady; this.domainLocales = domainLocales; this.isPreview = !!isPreview; this.isLocaleDomain = !!isLocaleDomain; } push() { noRouter(); } replace() { noRouter(); } reload() { noRouter(); } back() { noRouter(); } prefetch() { noRouter(); } beforePopState() { noRouter(); } } function enhanceComponents(options, App, Component) { if (typeof options === "function") { return { App, Component: options(Component), }; } return { App: options.enhanceApp ? options.enhanceApp(App) : App, Component: options.enhanceComponent ? options.enhanceComponent(Component) : Component, }; } const invalidKeysMsg = (methodName, invalidKeys) => { return ( `Additional keys were returned from \`${methodName}\`. Properties intended for your component must be nested under the \`props\` key, e.g.:` + `\n\n\treturn { props: { title: 'My Title', content: '...' } }` + `\n\nKeys that need to be moved: ${invalidKeys.join(", ")}.` + `\nRead more: https://nextjs.org/docs/messages/invalid-getstaticprops-value` ); }; function checkRedirectValues(redirect, req, method) { const { destination, permanent, statusCode, basePath } = redirect; let errors = []; const hasStatusCode = typeof statusCode !== "undefined"; const hasPermanent = typeof permanent !== "undefined"; if (hasPermanent && hasStatusCode) { errors.push( `\`permanent\` and \`statusCode\` can not both be provided` ); } else if (hasPermanent && typeof permanent !== "boolean") { errors.push(`\`permanent\` must be \`true\` or \`false\``); } else if (hasStatusCode && !allowedStatusCodes.has(statusCode)) { errors.push( `\`statusCode\` must undefined or one of ${[ ...allowedStatusCodes, ].join(", ")}` ); } const destinationType = typeof destination; if (destinationType !== "string") { errors.push( `\`destination\` should be string but received ${destinationType}` ); } const basePathType = typeof basePath; if (basePathType !== "undefined" && basePathType !== "boolean") { errors.push( `\`basePath\` should be undefined or a false, received ${basePathType}` ); } if (errors.length > 0) { throw new Error( `Invalid redirect object returned from ${method} for ${req.url}\n` + errors.join(" and ") + "\n" + `See more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp` ); } } export async function renderToHTML(req, res, pathname, query, renderOpts) { renderOpts.devOnlyCacheBusterQueryString = renderOpts.dev ? renderOpts.devOnlyCacheBusterQueryString || `?ts=${Date.now()}` : ""; query = Object.assign({}, query); const { err, dev = false, ampPath = "", App, Document, pageConfig = {}, Component, buildManifest, fontManifest, reactLoadableManifest, ErrorDebug, getStaticProps, getStaticPaths, getServerSideProps, isDataReq, params, previewProps, basePath, devOnlyCacheBusterQueryString, supportsDynamicHTML, concurrentFeatures, } = renderOpts; const getFontDefinition = (url) => { if (fontManifest) { return getFontDefinitionFromManifest(url, fontManifest); } return ""; }; const callMiddleware = async (method, args, props = false) => { let results = props ? {} : []; if (Document[`${method}Middleware`]) { let middlewareFunc = await Document[`${method}Middleware`]; middlewareFunc = middlewareFunc.default || middlewareFunc; const curResults = await middlewareFunc(...args); if (props) { for (const result of curResults) { results = { ...results, ...result, }; } } else { results = curResults; } } return results; }; const headTags = (...args) => callMiddleware("headTags", args); const isFallback = !!query.__nextFallback; delete query.__nextFallback; delete query.__nextLocale; delete query.__nextDefaultLocale; const isSSG = !!getStaticProps; const isBuildTimeSSG = isSSG && renderOpts.nextExport; const defaultAppGetInitialProps = App.getInitialProps === App.origGetInitialProps; const hasPageGetInitialProps = !!Component.getInitialProps; const pageIsDynamic = isDynamicRoute(pathname); const isAutoExport = !hasPageGetInitialProps && defaultAppGetInitialProps && !isSSG && !getServerSideProps; for (const methodName of [ "getStaticProps", "getServerSideProps", "getStaticPaths", ]) { if (Component[methodName]) { throw new Error( `page ${pathname} ${methodName} ${GSSP_COMPONENT_MEMBER_ERROR}` ); } } if (hasPageGetInitialProps && isSSG) { throw new Error(SSG_GET_INITIAL_PROPS_CONFLICT + ` ${pathname}`); } if (hasPageGetInitialProps && getServerSideProps) { throw new Error(SERVER_PROPS_GET_INIT_PROPS_CONFLICT + ` ${pathname}`); } if (getServerSideProps && isSSG) { throw new Error(SERVER_PROPS_SSG_CONFLICT + ` ${pathname}`); } if (getStaticPaths && !pageIsDynamic) { throw new Error( `getStaticPaths is only allowed for dynamic SSG pages and was found on '${pathname}'.` + `\nRead more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage` ); } if (!!getStaticPaths && !isSSG) { throw new Error( `getStaticPaths was added without a getStaticProps in ${pathname}. Without getStaticProps, getStaticPaths does nothing` ); } if (isSSG && pageIsDynamic && !getStaticPaths) { throw new Error( `getStaticPaths is required for dynamic SSG pages and is missing for '${pathname}'.` + `\nRead more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value` ); } let asPath = renderOpts.resolvedAsPath || req.url; if (dev) { const { isValidElementType } = require("react-is"); if (!isValidElementType(Component)) { throw new Error( `The default export is not a React Component in page: "${pathname}"` ); } if (!isValidElementType(App)) { throw new Error( `The default export is not a React Component in page: "/_app"` ); } if (!isValidElementType(Document)) { throw new Error( `The default export is not a React Component in page: "/_document"` ); } if (isAutoExport || isFallback) { query = { ...(query.amp ? { amp: query.amp, } : {}), }; asPath = `${pathname}${ req.url.endsWith("/") && pathname !== "/" && !pageIsDynamic ? "/" : "" }`; req.url = pathname; } if ( pathname === "/404" && (hasPageGetInitialProps || getServerSideProps) ) { throw new Error( `\`pages/404\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}` ); } if ( STATIC_STATUS_PAGES.includes(pathname) && (hasPageGetInitialProps || getServerSideProps) ) { throw new Error( `\`pages${pathname}\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}` ); } } await Loadable.preloadAll(); let isPreview; let previewData; if ((isSSG || getServerSideProps) && !isFallback) { previewData = tryGetPreviewData(req, res, previewProps); isPreview = previewData !== false; } const routerIsReady = !!( getServerSideProps || hasPageGetInitialProps || (!defaultAppGetInitialProps && !isSSG) ); const router = new ServerRouter( pathname, query, asPath, { isFallback: isFallback, }, routerIsReady, basePath, renderOpts.locale, renderOpts.locales, renderOpts.defaultLocale, renderOpts.domainLocales, isPreview, req.__nextIsLocaleDomain ); const jsxStyleRegistry = createStyleRegistry(); const ctx = { err, req: isAutoExport ? undefined : req, res: isAutoExport ? undefined : res, pathname, query, asPath, locale: renderOpts.locale, locales: renderOpts.locales, defaultLocale: renderOpts.defaultLocale, AppTree: (props) => { return ( <AppContainer> <App {...props} Component={Component} router={router} /> </AppContainer> ); }, defaultGetInitialProps: async (docCtx) => { const enhanceApp = (AppComp) => { return (props) => <AppComp {...props} />; }; const { html, head } = await docCtx.renderPage({ enhanceApp, }); const styles = jsxStyleRegistry.styles(); return { html, head, styles, }; }, }; let props; const ampState = { ampFirst: pageConfig.amp === true, hasQuery: Boolean(query.amp), hybrid: pageConfig.amp === "hybrid", }; const inAmpMode = isInAmpMode(ampState); const reactLoadableModules = []; let head = defaultHead(inAmpMode); let scriptLoader = {}; const nextExport = !isSSG && (renderOpts.nextExport || (dev && (isAutoExport || isFallback))); const AppContainer = ({ children }) => ( <RouterContext.Provider value={router}> <AmpStateContext.Provider value={ampState}> <HeadManagerContext.Provider value={{ updateHead: (state) => { head = state; }, updateScripts: (scripts) => { scriptLoader = scripts; }, scripts: {}, mountedInstances: new Set(), }} > <LoadableContext.Provider value={(moduleName) => reactLoadableModules.push(moduleName) } > <StyleRegistry registry={jsxStyleRegistry}> {children} </StyleRegistry> </LoadableContext.Provider> </HeadManagerContext.Provider> </AmpStateContext.Provider> </RouterContext.Provider> ); props = await loadGetInitialProps(App, { AppTree: ctx.AppTree, Component, router, ctx, }); if ((isSSG || getServerSideProps) && isPreview) { props.__N_PREVIEW = true; } if (isSSG) { props[STATIC_PROPS_ID] = true; } if (isSSG && !isFallback) { let data; try { data = await getStaticProps({ ...(pageIsDynamic ? { params: query, } : undefined), ...(isPreview ? { preview: true, previewData: previewData, } : undefined), locales: renderOpts.locales, locale: renderOpts.locale, defaultLocale: renderOpts.defaultLocale, }); } catch (staticPropsError) { if (staticPropsError && staticPropsError.code === "ENOENT") { delete staticPropsError.code; } throw staticPropsError; } if (data == null) { throw new Error(GSP_NO_RETURNED_VALUE); } const invalidKeys = Object.keys(data).filter( (key) => key !== "revalidate" && key !== "props" && key !== "redirect" && key !== "notFound" ); if (invalidKeys.includes("unstable_revalidate")) { throw new Error(UNSTABLE_REVALIDATE_RENAME_ERROR); } if (invalidKeys.length) { throw new Error(invalidKeysMsg("getStaticProps", invalidKeys)); } if (process.env.NODE_ENV !== "production") { if ( typeof data.notFound !== "undefined" && typeof data.redirect !== "undefined" ) { throw new Error( `\`redirect\` and \`notFound\` can not both be returned from ${ isSSG ? "getStaticProps" : "getServerSideProps" } at the same time. Page: ${pathname}\nSee more info here: https://nextjs.org/docs/messages/gssp-mixed-not-found-redirect` ); } } if ("notFound" in data && data.notFound) { if (pathname === "/404") { throw new Error( `The /404 page can not return notFound in "getStaticProps", please remove it to continue!` ); } renderOpts.isNotFound = true; } if ( "redirect" in data && data.redirect && typeof data.redirect === "object" ) { checkRedirectValues(data.redirect, req, "getStaticProps"); if (isBuildTimeSSG) { throw new Error( `\`redirect\` can not be returned from getStaticProps during prerendering (${req.url})\n` + `See more info here: https://nextjs.org/docs/messages/gsp-redirect-during-prerender` ); } data.props = { __N_REDIRECT: data.redirect.destination, __N_REDIRECT_STATUS: getRedirectStatus(data.redirect), }; if (typeof data.redirect.basePath !== "undefined") { data.props.__N_REDIRECT_BASE_PATH = data.redirect.basePath; } renderOpts.isRedirect = true; } if ( (dev || isBuildTimeSSG) && !renderOpts.isNotFound && !isSerializableProps(pathname, "getStaticProps", data.props) ) { throw new Error( "invariant: getStaticProps did not return valid props. Please report this." ); } if ("revalidate" in data) { if (typeof data.revalidate === "number") { if (!Number.isInteger(data.revalidate)) { throw new Error( `A page's revalidate option must be seconds expressed as a natural number for ${req.url}. Mixed numbers, such as '${data.revalidate}', cannot be used.` + `\nTry changing the value to '${Math.ceil( data.revalidate )}' or using \`Math.ceil()\` if you're computing the value.` ); } else if (data.revalidate <= 0) { throw new Error( `A page's revalidate option can not be less than or equal to zero for ${req.url}. A revalidate option of zero means to revalidate after _every_ request, and implies stale data cannot be tolerated.` + `\n\nTo never revalidate, you can set revalidate to \`false\` (only ran once at build-time).` + `\nTo revalidate as soon as possible, you can set the value to \`1\`.` ); } else if (data.revalidate > 31536000) { console.warn( `Warning: A page's revalidate option was set to more than a year for ${req.url}. This may have been done in error.` + `\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \`revalidate\` to \`false\`!` ); } } else if (data.revalidate === true) { data.revalidate = 1; } else if ( data.revalidate === false || typeof data.revalidate === "undefined" ) { data.revalidate = false; } else { throw new Error( `A page's revalidate option must be seconds expressed as a natural number. Mixed numbers and strings cannot be used. Received '${JSON.stringify( data.revalidate )}' for ${req.url}` ); } } else { data.revalidate = false; } props.pageProps = Object.assign( {}, props.pageProps, "props" in data ? data.props : undefined ); renderOpts.revalidate = "revalidate" in data ? data.revalidate : undefined; renderOpts.pageData = props; if (renderOpts.isNotFound) { return null; } } if (getServerSideProps) { props[SERVER_PROPS_ID] = true; } if (getServerSideProps && !isFallback) { let data; let canAccessRes = true; let resOrProxy = res; if (process.env.NODE_ENV !== "production") { resOrProxy = new Proxy(res, { get: function (obj, prop, receiver) { if (!canAccessRes) { throw new Error( `You should not access 'res' after getServerSideProps resolves.` + `\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res` ); } return Reflect.get(obj, prop, receiver); }, }); } try { data = await getServerSideProps({ req: req, res: resOrProxy, query, resolvedUrl: renderOpts.resolvedUrl, ...(pageIsDynamic ? { params: params, } : undefined), ...(previewData !== false ? { preview: true, previewData: previewData, } : undefined), locales: renderOpts.locales, locale: renderOpts.locale, defaultLocale: renderOpts.defaultLocale, }); canAccessRes = false; } catch (serverSidePropsError) { if ( isError(serverSidePropsError) && serverSidePropsError.code === "ENOENT" ) { delete serverSidePropsError.code; } throw serverSidePropsError; } if (data == null) { throw new Error(GSSP_NO_RETURNED_VALUE); } const invalidKeys = Object.keys(data).filter( (key) => key !== "props" && key !== "redirect" && key !== "notFound" ); if (data.unstable_notFound) { throw new Error( `unstable_notFound has been renamed to notFound, please update the field to continue. Page: ${pathname}` ); } if (data.unstable_redirect) { throw new Error( `unstable_redirect has been renamed to redirect, please update the field to continue. Page: ${pathname}` ); } if (invalidKeys.length) { throw new Error(invalidKeysMsg("getServerSideProps", invalidKeys)); } if ("notFound" in data && data.notFound) { if (pathname === "/404") { throw new Error( `The /404 page can not return notFound in "getStaticProps", please remove it to continue!` ); } renderOpts.isNotFound = true; return null; } if ("redirect" in data && typeof data.redirect === "object") { checkRedirectValues(data.redirect, req, "getServerSideProps"); data.props = { __N_REDIRECT: data.redirect.destination, __N_REDIRECT_STATUS: getRedirectStatus(data.redirect), }; if (typeof data.redirect.basePath !== "undefined") { data.props.__N_REDIRECT_BASE_PATH = data.redirect.basePath; } renderOpts.isRedirect = true; } if (data.props instanceof Promise) { data.props = await data.props; } if ( (dev || isBuildTimeSSG) && !isSerializableProps(pathname, "getServerSideProps", data.props) ) { throw new Error( "invariant: getServerSideProps did not return valid props. Please report this." ); } props.pageProps = Object.assign({}, props.pageProps, data.props); renderOpts.pageData = props; } if ( !isSSG && !getServerSideProps && process.env.NODE_ENV !== "production" && Object.keys(props?.pageProps || {}).includes("url") ) { console.warn( `The prop \`url\` is a reserved prop in Next.js for legacy reasons and will be overridden on page ${pathname}\n` + `See more info here: https://nextjs.org/docs/messages/reserved-page-prop` ); } if ((isDataReq && !isSSG) || renderOpts.isRedirect) { return RenderResult.fromStatic(JSON.stringify(props)); } if (isFallback) { props.pageProps = {}; } if (isResSent(res) && !isSSG) return null; let filteredBuildManifest = buildManifest; if (isAutoExport && pageIsDynamic) { const page = denormalizePagePath(normalizePagePath(pathname)); if (page in filteredBuildManifest.pages) { filteredBuildManifest = { ...filteredBuildManifest, pages: { ...filteredBuildManifest.pages, [page]: [ ...filteredBuildManifest.pages[page], ...filteredBuildManifest.lowPriorityFiles.filter((f) => f.includes("_buildManifest") ), ], }, lowPriorityFiles: filteredBuildManifest.lowPriorityFiles.filter( (f) => !f.includes("_buildManifest") ), }; } } const generateStaticHTML = supportsDynamicHTML !== true; const renderDocument = async () => { if (Document.getInitialProps) { const renderPage = (options = {}) => { if (ctx.err && ErrorDebug) { const html = ReactDOMServer.renderToString( <ErrorDebug error={ctx.err} /> ); return { html, head, }; } if (dev && (props.router || props.Component)) { throw new Error( `'router' and 'Component' can not be returned in getInitialProps from _app.js https://nextjs.org/docs/messages/cant-override-next-props` ); } const { App: EnhancedApp, Component: EnhancedComponent } = enhanceComponents(options, App, Component); const html = ReactDOMServer.renderToString( <AppContainer> <EnhancedApp Component={EnhancedComponent} router={router} {...props} /> </AppContainer> ); return { html, head, }; }; const documentCtx = { ...ctx, renderPage, }; const docProps = await loadGetInitialProps(Document, documentCtx); if (isResSent(res) && !isSSG) return null; if (!docProps || typeof docProps.html !== "string") { const message = `"${getDisplayName( Document )}.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string`; throw new Error(message); } return { bodyResult: piperFromArray([docProps.html]), documentElement: (htmlProps) => ( <Document {...htmlProps} {...docProps} /> ), head: docProps.head, headTags: await headTags(documentCtx), styles: docProps.styles, }; } else { const content = ctx.err && ErrorDebug ? ( <ErrorDebug error={ctx.err} /> ) : ( <AppContainer> <App {...props} Component={Component} router={router} /> </AppContainer> ); const bodyResult = concurrentFeatures ? await renderToStream(content, generateStaticHTML) : piperFromArray([ReactDOMServer.renderToString(content)]); return { bodyResult, documentElement: () => Document(), head, headTags: [], styles: jsxStyleRegistry.styles(), }; } }; const documentResult = await renderDocument(); if (!documentResult) { return null; } const dynamicImportsIds = new Set(); const dynamicImports = new Set(); for (const mod of reactLoadableModules) { const manifestItem = reactLoadableManifest[mod]; if (manifestItem) { dynamicImportsIds.add(manifestItem.id); manifestItem.files.forEach((item) => { dynamicImports.add(item); }); } } const hybridAmp = ampState.hybrid; const docComponentsRendered = {}; const { assetPrefix, buildId, customServer, defaultLocale, disableOptimizedLoading, domainLocales, locale, locales, runtimeConfig, } = renderOpts; const htmlProps = { __NEXT_DATA__: { props, page: pathname, query, buildId, assetPrefix: assetPrefix === "" ? undefined : assetPrefix, runtimeConfig, nextExport: nextExport === true ? true : undefined, autoExport: isAutoExport === true ? true : undefined, isFallback, dynamicIds: dynamicImportsIds.size === 0 ? undefined : Array.from(dynamicImportsIds), err: renderOpts.err ? serializeError(dev, renderOpts.err) : undefined, gsp: !!getStaticProps ? true : undefined, gssp: !!getServerSideProps ? true : undefined, customServer, gip: hasPageGetInitialProps ? true : undefined, appGip: !defaultAppGetInitialProps ? true : undefined, locale, locales, defaultLocale, domainLocales, isPreview: isPreview === true ? true : undefined, }, buildManifest: filteredBuildManifest, docComponentsRendered, dangerousAsPath: router.asPath, canonicalBase: !renderOpts.ampPath && req.__nextStrippedLocale ? `${renderOpts.canonicalBase || ""}/${renderOpts.locale}` : renderOpts.canonicalBase, ampPath, inAmpMode, isDevelopment: !!dev, hybridAmp, dynamicImports: Array.from(dynamicImports), assetPrefix, unstable_runtimeJS: process.env.NODE_ENV === "production" ? pageConfig.unstable_runtimeJS : undefined, unstable_JsPreload: pageConfig.unstable_JsPreload, devOnlyCacheBusterQueryString, scriptLoader, locale, disableOptimizedLoading, head: documentResult.head, headTags: documentResult.headTags, styles: documentResult.styles, useMaybeDeferContent, }; const documentHTML = ReactDOMServer.renderToStaticMarkup( <AmpStateContext.Provider value={ampState}> <HtmlContext.Provider value={htmlProps}> {documentResult.documentElement(htmlProps)} </HtmlContext.Provider> </AmpStateContext.Provider> ); if (process.env.NODE_ENV !== "production") { const nonRenderedComponents = []; const expectedDocComponents = ["Main", "Head", "NextScript", "Html"]; for (const comp of expectedDocComponents) { if (!docComponentsRendered[comp]) { nonRenderedComponents.push(comp); } } const plural = nonRenderedComponents.length !== 1 ? "s" : ""; if (nonRenderedComponents.length) { const missingComponentList = nonRenderedComponents .map((e) => `<${e} />`) .join(", "); warn( `Your custom Document (pages/_document) did not render all the required subcomponent${plural}.\n` + `Missing component${plural}: ${missingComponentList}\n` + "Read how to fix here: https://nextjs.org/docs/messages/missing-document-component" ); } } const renderTargetIdx = documentHTML.indexOf(BODY_RENDER_TARGET); const prefix = []; prefix.push("<!DOCTYPE html>"); prefix.push(documentHTML.substring(0, renderTargetIdx)); if (inAmpMode) { prefix.push("<!-- __NEXT_DATA__ -->"); } let pipers = [ piperFromArray(prefix), documentResult.bodyResult, piperFromArray([ documentHTML.substring(renderTargetIdx + BODY_RENDER_TARGET.length), ]), ]; const postProcessors = ( generateStaticHTML ? [ inAmpMode ? async (html) => { html = await optimizeAmp( html, renderOpts.ampOptimizerConfig ); if ( !renderOpts.ampSkipValidation && renderOpts.ampValidator ) { await renderOpts.ampValidator(html, pathname); } return html; } : null, process.env.__NEXT_OPTIMIZE_FONTS || process.env.__NEXT_OPTIMIZE_IMAGES ? async (html) => { return await postProcess( html, { getFontDefinition, }, { optimizeFonts: renderOpts.optimizeFonts, optimizeImages: renderOpts.optimizeImages, } ); } : null, renderOpts.optimizeCss ? async (html) => { const Critters = require("critters"); const cssOptimizer = new Critters({ ssrMode: true, reduceInlineStyles: false, path: renderOpts.distDir, publicPath: `${renderOpts.assetPrefix}/_next/`, preload: "media", fonts: false, ...renderOpts.optimizeCss, }); return await cssOptimizer.process(html); } : null, inAmpMode || hybridAmp ? async (html) => { return html.replace(/&amp;amp=1/g, "&amp=1"); } : null, ] : [] ).filter(Boolean); if (generateStaticHTML || postProcessors.length > 0) { let html = await piperToString(chainPipers(pipers)); for (const postProcessor of postProcessors) { if (postProcessor) { html = await postProcessor(html); } } return new RenderResult(html); } return new RenderResult(chainPipers(pipers)); } function errorToJSON(err) { const { name, message, stack } = err; return { name, message, stack, }; } function serializeError(dev, err) { if (dev) { return errorToJSON(err); } return { name: "Internal Server Error.", message: "500 - Internal Server Error.", statusCode: 500, }; } function renderToStream(element, generateStaticHTML) { return new Promise((resolve, reject) => { let underlyingStream = null; const stream = new Writable({ highWaterMark: 0, write(chunk, encoding, callback) { if (!underlyingStream) { throw new Error( "invariant: write called without an underlying stream. This is a bug in Next.js" ); } if (!underlyingStream.writable.write(chunk, encoding)) { underlyingStream.queuedCallbacks.push(() => callback()); } else { callback(); } }, }); stream.once("finish", () => { if (!underlyingStream) { throw new Error( "invariant: finish called without an underlying stream. This is a bug in Next.js" ); } underlyingStream.resolve(); }); stream.once("error", (err) => { if (!underlyingStream) { throw new Error( "invariant: error called without an underlying stream. This is a bug in Next.js" ); } underlyingStream.resolve(err); }); Object.defineProperty(stream, "flush", { value: () => { if (!underlyingStream) { throw new Error( "invariant: flush called without an underlying stream. This is a bug in Next.js" ); } if (typeof underlyingStream.writable.flush === "function") { underlyingStream.writable.flush(); } }, enumerable: true, }); let resolved = false; const doResolve = () => { if (!resolved) { resolved = true; resolve((res, next) => { const drainHandler = () => { const prevCallbacks = underlyingStream.queuedCallbacks; underlyingStream.queuedCallbacks = []; prevCallbacks.forEach((callback) => callback()); }; res.on("drain", drainHandler); underlyingStream = { resolve: (err) => { underlyingStream = null; res.removeListener("drain", drainHandler); next(err); }, writable: res, queuedCallbacks: [], }; startWriting(); }); } }; const { abort, startWriting } = ReactDOMServer.pipeToNodeWritable( element, stream, { onError(error) { if (!resolved) { resolved = true; reject(error); } abort(); }, onCompleteShell() { if (!generateStaticHTML) { doResolve(); } }, onCompleteAll() { doResolve(); }, } ); }); } function chainPipers(pipers) { return pipers.reduceRight( (lhs, rhs) => (res, next) => { rhs(res, (err) => (err ? next(err) : lhs(res, next))); }, (res, next) => { res.end(); next(); } ); } function piperFromArray(chunks) { return (res, next) => { if (typeof res.cork === "function") { res.cork(); } chunks.forEach((chunk) => res.write(chunk)); if (typeof res.uncork === "function") { res.uncork(); } next(); }; } function piperToString(input) { return new Promise((resolve, reject) => { const bufferedChunks = []; const stream = new Writable({ writev(chunks, callback) { chunks.forEach((chunk) => bufferedChunks.push(chunk.chunk)); callback(); }, }); input(stream, (err) => { if (err) { reject(err); } else { resolve(Buffer.concat(bufferedChunks).toString()); } }); }); } export function useMaybeDeferContent(_name, contentFn) { return [false, contentFn()]; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/1/output.js
JavaScript
import { Writable__2 } from "stream"; import * as ReactDOMServer__2 from "react-dom/server"; import { StyleRegistry__2, createStyleRegistry__2 } from "styled-jsx"; import { warn__2 } from "../build/output/log"; import { GSP_NO_RETURNED_VALUE__2, GSSP_COMPONENT_MEMBER_ERROR__2, GSSP_NO_RETURNED_VALUE__2, STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR__2, SERVER_PROPS_GET_INIT_PROPS_CONFLICT__2, SERVER_PROPS_SSG_CONFLICT__2, SSG_GET_INITIAL_PROPS_CONFLICT__2, UNSTABLE_REVALIDATE_RENAME_ERROR__2 } from "../lib/constants"; import { isSerializableProps__2 } from "../lib/is-serializable-props"; import { isInAmpMode__2 } from "../shared/lib/amp"; import { AmpStateContext__2 } from "../shared/lib/amp-context"; import { BODY_RENDER_TARGET__2, SERVER_PROPS_ID__2, STATIC_PROPS_ID__2, STATIC_STATUS_PAGES__2 } from "../shared/lib/constants"; import { defaultHead__2 } from "../shared/lib/head"; import { HeadManagerContext__2 } from "../shared/lib/head-manager-context"; import Loadable__2 from "../shared/lib/loadable"; import { LoadableContext__2 } from "../shared/lib/loadable-context"; import postProcess__2 from "../shared/lib/post-process"; import { RouterContext__2 } from "../shared/lib/router-context"; import { isDynamicRoute__2 } from "../shared/lib/router/utils/is-dynamic"; import { HtmlContext__2, getDisplayName__2, isResSent__2, loadGetInitialProps__2 } from "../shared/lib/utils"; import { tryGetPreviewData__2 } from "./api-utils"; import { denormalizePagePath__2 } from "./denormalize-page-path"; import { getFontDefinitionFromManifest__2 } from "./font-utils"; import { normalizePagePath__2 } from "./normalize-page-path"; import optimizeAmp__2 from "./optimize-amp"; import { allowedStatusCodes__2, getRedirectStatus__2 } from "../lib/load-custom-routes"; import RenderResult__2 from "./render-result"; import isError__2 from "../lib/is-error"; function noRouter__2() { const message__3 = 'No router instance found. you should only use "next/router" inside the client side of your app. https://nextjs.org/docs/messages/no-router-instance'; throw new Error(message__3); } class ServerRouter__2 { constructor(pathname__4, query__4, as__4, { isFallback__4 }, isReady__4, basePath__4, locale__4, locales__4, defaultLocale__4, domainLocales__4, isPreview__4, isLocaleDomain__4){ this.route = pathname__4.replace(/\/$/, "") || "/"; this.pathname = pathname__4; this.query = query__4; this.asPath = as__4; this.isFallback = isFallback__4; this.basePath = basePath__4; this.locale = locale__4; this.locales = locales__4; this.defaultLocale = defaultLocale__4; this.isReady = isReady__4; this.domainLocales = domainLocales__4; this.isPreview = !!isPreview__4; this.isLocaleDomain = !!isLocaleDomain__4; } push() { noRouter__2(); } replace() { noRouter__2(); } reload() { noRouter__2(); } back() { noRouter__2(); } prefetch() { noRouter__2(); } beforePopState() { noRouter__2(); } } function enhanceComponents__2(options__11, App__11, Component__11) { if (typeof options__11 === "function") { return { App__11, Component: options__11(Component__11) }; } return { App: options__11.enhanceApp ? options__11.enhanceApp(App__11) : App__11, Component: options__11.enhanceComponent ? options__11.enhanceComponent(Component__11) : Component__11 }; } const invalidKeysMsg__2 = (methodName__13, invalidKeys__13)=>{ return `Additional keys were returned from \`${methodName__13}\`. Properties intended for your component must be nested under the \`props\` key, e.g.:` + `\n\n\treturn { props: { title: 'My Title', content: '...' } }` + `\n\nKeys that need to be moved: ${invalidKeys__13.join(", ")}.` + `\nRead more: https://nextjs.org/docs/messages/invalid-getstaticprops-value`; }; function checkRedirectValues__2(redirect__14, req__14, method__14) { const { destination__14, permanent__14, statusCode__14, basePath__14 } = redirect__14; let errors__14 = []; const hasStatusCode__14 = typeof statusCode__14 !== "undefined"; const hasPermanent__14 = typeof permanent__14 !== "undefined"; if (hasPermanent__14 && hasStatusCode__14) { errors__14.push(`\`permanent\` and \`statusCode\` can not both be provided`); } else if (hasPermanent__14 && typeof permanent__14 !== "boolean") { errors__14.push(`\`permanent\` must be \`true\` or \`false\``); } else if (hasStatusCode__14 && !allowedStatusCodes__2.has(statusCode__14)) { errors__14.push(`\`statusCode\` must undefined or one of ${[ ...allowedStatusCodes__2 ].join(", ")}`); } const destinationType__14 = typeof destination__14; if (destinationType__14 !== "string") { errors__14.push(`\`destination\` should be string but received ${destinationType__14}`); } const basePathType__14 = typeof basePath__14; if (basePathType__14 !== "undefined" && basePathType__14 !== "boolean") { errors__14.push(`\`basePath\` should be undefined or a false, received ${basePathType__14}`); } if (errors__14.length > 0) { throw new Error(`Invalid redirect object returned from ${method__14} for ${req__14.url}\n` + errors__14.join(" and ") + "\n" + `See more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp`); } } export async function renderToHTML__2(req__21, res__21, pathname__21, query__21, renderOpts__21) { renderOpts__21.devOnlyCacheBusterQueryString = renderOpts__21.dev ? renderOpts__21.devOnlyCacheBusterQueryString || `?ts=${Date.now()}` : ""; query__21 = Object.assign({}, query__21); const { err__21, dev__21 = false, ampPath__21 = "", App__21, Document__21, pageConfig__21 = {}, Component__21, buildManifest__21, fontManifest__21, reactLoadableManifest__21, ErrorDebug__21, getStaticProps__21, getStaticPaths__21, getServerSideProps__21, isDataReq__21, params__21, previewProps__21, basePath__21, devOnlyCacheBusterQueryString__21, supportsDynamicHTML__21, concurrentFeatures__21 } = renderOpts__21; const getFontDefinition__21 = (url__22)=>{ if (fontManifest__21) { return getFontDefinitionFromManifest__2(url__22, fontManifest__21); } return ""; }; const callMiddleware__21 = async (method__24, args__24, props__24 = false)=>{ let results__24 = props__24 ? {} : []; if (Document__21[`${method__24}Middleware`]) { let middlewareFunc__25 = await Document__21[`${method__24}Middleware`]; middlewareFunc__25 = middlewareFunc__25.default || middlewareFunc__25; const curResults__25 = await middlewareFunc__25(...args__24); if (props__24) { for (const result__27 of curResults__25){ results__24 = { ...results__24, ...result__27 }; } } else { results__24 = curResults__25; } } return results__24; }; const headTags__21 = (...args__30)=>callMiddleware__21("headTags", args__30); const isFallback__21 = !!query__21.__nextFallback; delete query__21.__nextFallback; delete query__21.__nextLocale; delete query__21.__nextDefaultLocale; const isSSG__21 = !!getStaticProps__21; const isBuildTimeSSG__21 = isSSG__21 && renderOpts__21.nextExport; const defaultAppGetInitialProps__21 = App__21.getInitialProps === App__21.origGetInitialProps; const hasPageGetInitialProps__21 = !!Component__21.getInitialProps; const pageIsDynamic__21 = isDynamicRoute__2(pathname__21); const isAutoExport__21 = !hasPageGetInitialProps__21 && defaultAppGetInitialProps__21 && !isSSG__21 && !getServerSideProps__21; for (const methodName__31 of [ "getStaticProps", "getServerSideProps", "getStaticPaths" ]){ if (Component__21[methodName__31]) { throw new Error(`page ${pathname__21} ${methodName__31} ${GSSP_COMPONENT_MEMBER_ERROR__2}`); } } if (hasPageGetInitialProps__21 && isSSG__21) { throw new Error(SSG_GET_INITIAL_PROPS_CONFLICT__2 + ` ${pathname__21}`); } if (hasPageGetInitialProps__21 && getServerSideProps__21) { throw new Error(SERVER_PROPS_GET_INIT_PROPS_CONFLICT__2 + ` ${pathname__21}`); } if (getServerSideProps__21 && isSSG__21) { throw new Error(SERVER_PROPS_SSG_CONFLICT__2 + ` ${pathname__21}`); } if (getStaticPaths__21 && !pageIsDynamic__21) { throw new Error(`getStaticPaths is only allowed for dynamic SSG pages and was found on '${pathname__21}'.` + `\nRead more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`); } if (!!getStaticPaths__21 && !isSSG__21) { throw new Error(`getStaticPaths was added without a getStaticProps in ${pathname__21}. Without getStaticProps, getStaticPaths does nothing`); } if (isSSG__21 && pageIsDynamic__21 && !getStaticPaths__21) { throw new Error(`getStaticPaths is required for dynamic SSG pages and is missing for '${pathname__21}'.` + `\nRead more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`); } let asPath__21 = renderOpts__21.resolvedAsPath || req__21.url; if (dev__21) { const { isValidElementType__40 } = require("react-is"); if (!isValidElementType__40(Component__21)) { throw new Error(`The default export is not a React Component in page: "${pathname__21}"`); } if (!isValidElementType__40(App__21)) { throw new Error(`The default export is not a React Component in page: "/_app"`); } if (!isValidElementType__40(Document__21)) { throw new Error(`The default export is not a React Component in page: "/_document"`); } if (isAutoExport__21 || isFallback__21) { query__21 = { ...query__21.amp ? { amp: query__21.amp } : {} }; asPath__21 = `${pathname__21}${req__21.url.endsWith("/") && pathname__21 !== "/" && !pageIsDynamic__21 ? "/" : ""}`; req__21.url = pathname__21; } if (pathname__21 === "/404" && (hasPageGetInitialProps__21 || getServerSideProps__21)) { throw new Error(`\`pages/404\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR__2}`); } if (STATIC_STATUS_PAGES__2.includes(pathname__21) && (hasPageGetInitialProps__21 || getServerSideProps__21)) { throw new Error(`\`pages${pathname__21}\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR__2}`); } } await Loadable__2.preloadAll(); let isPreview__21; let previewData__21; if ((isSSG__21 || getServerSideProps__21) && !isFallback__21) { previewData__21 = tryGetPreviewData__2(req__21, res__21, previewProps__21); isPreview__21 = previewData__21 !== false; } const routerIsReady__21 = !!(getServerSideProps__21 || hasPageGetInitialProps__21 || !defaultAppGetInitialProps__21 && !isSSG__21); const router__21 = new ServerRouter__2(pathname__21, query__21, asPath__21, { isFallback: isFallback__21 }, routerIsReady__21, basePath__21, renderOpts__21.locale, renderOpts__21.locales, renderOpts__21.defaultLocale, renderOpts__21.domainLocales, isPreview__21, req__21.__nextIsLocaleDomain); const jsxStyleRegistry__21 = createStyleRegistry__2(); const ctx__21 = { err__21, req: isAutoExport__21 ? undefined : req__21, res: isAutoExport__21 ? undefined : res__21, pathname__21, query__21, asPath__21, locale: renderOpts__21.locale, locales: renderOpts__21.locales, defaultLocale: renderOpts__21.defaultLocale, AppTree: (props__48)=>{ return <AppContainer__21> <App__21 {...props__48} Component={Component__21} router={router__21}/> </AppContainer__21>; }, defaultGetInitialProps: async (docCtx__49)=>{ const enhanceApp__49 = (AppComp__50)=>{ return (props__51)=><AppComp__50 {...props__51}/>; }; const { html__49, head__49 } = await docCtx__49.renderPage({ enhanceApp__49 }); const styles__49 = jsxStyleRegistry__21.styles(); return { html__49, head__49, styles__49 }; } }; let props__21; const ampState__21 = { ampFirst: pageConfig__21.amp === true, hasQuery: Boolean(query__21.amp), hybrid: pageConfig__21.amp === "hybrid" }; const inAmpMode__21 = isInAmpMode__2(ampState__21); const reactLoadableModules__21 = []; let head__21 = defaultHead__2(inAmpMode__21); let scriptLoader__21 = {}; const nextExport__21 = !isSSG__21 && (renderOpts__21.nextExport || dev__21 && (isAutoExport__21 || isFallback__21)); const AppContainer__21 = ({ children__52 })=><RouterContext__2.Provider value={router__21}> <AmpStateContext__2.Provider value={ampState__21}> <HeadManagerContext__2.Provider value={{ updateHead: (state__53)=>{ head__21 = state__53; }, updateScripts: (scripts__54)=>{ scriptLoader__21 = scripts__54; }, scripts: {}, mountedInstances: new Set() }}> <LoadableContext__2.Provider value={(moduleName__55)=>reactLoadableModules__21.push(moduleName__55)}> <StyleRegistry__2 registry={jsxStyleRegistry__21}> {children__52} </StyleRegistry__2> </LoadableContext__2.Provider> </HeadManagerContext__2.Provider> </AmpStateContext__2.Provider> </RouterContext__2.Provider>; props__21 = await loadGetInitialProps__2(App__21, { AppTree: ctx__21.AppTree, Component__21, router__21, ctx__21 }); if ((isSSG__21 || getServerSideProps__21) && isPreview__21) { props__21.__N_PREVIEW = true; } if (isSSG__21) { props__21[STATIC_PROPS_ID__2] = true; } if (isSSG__21 && !isFallback__21) { let data__58; try { data__58 = await getStaticProps__21({ ...pageIsDynamic__21 ? { params: query__21 } : undefined, ...isPreview__21 ? { preview: true, previewData: previewData__21 } : undefined, locales: renderOpts__21.locales, locale: renderOpts__21.locale, defaultLocale: renderOpts__21.defaultLocale }); } catch (staticPropsError__60) { if (staticPropsError__60 && staticPropsError__60.code === "ENOENT") { delete staticPropsError__60.code; } throw staticPropsError__60; } if (data__58 == null) { throw new Error(GSP_NO_RETURNED_VALUE__2); } const invalidKeys__58 = Object.keys(data__58).filter((key__63)=>key__63 !== "revalidate" && key__63 !== "props" && key__63 !== "redirect" && key__63 !== "notFound"); if (invalidKeys__58.includes("unstable_revalidate")) { throw new Error(UNSTABLE_REVALIDATE_RENAME_ERROR__2); } if (invalidKeys__58.length) { throw new Error(invalidKeysMsg__2("getStaticProps", invalidKeys__58)); } if (process.env.NODE_ENV !== "production") { if (typeof data__58.notFound !== "undefined" && typeof data__58.redirect !== "undefined") { throw new Error(`\`redirect\` and \`notFound\` can not both be returned from ${isSSG__21 ? "getStaticProps" : "getServerSideProps"} at the same time. Page: ${pathname__21}\nSee more info here: https://nextjs.org/docs/messages/gssp-mixed-not-found-redirect`); } } if ("notFound" in data__58 && data__58.notFound) { if (pathname__21 === "/404") { throw new Error(`The /404 page can not return notFound in "getStaticProps", please remove it to continue!`); } renderOpts__21.isNotFound = true; } if ("redirect" in data__58 && data__58.redirect && typeof data__58.redirect === "object") { checkRedirectValues__2(data__58.redirect, req__21, "getStaticProps"); if (isBuildTimeSSG__21) { throw new Error(`\`redirect\` can not be returned from getStaticProps during prerendering (${req__21.url})\n` + `See more info here: https://nextjs.org/docs/messages/gsp-redirect-during-prerender`); } data__58.props = { __N_REDIRECT: data__58.redirect.destination, __N_REDIRECT_STATUS: getRedirectStatus__2(data__58.redirect) }; if (typeof data__58.redirect.basePath !== "undefined") { data__58.props.__N_REDIRECT_BASE_PATH = data__58.redirect.basePath; } renderOpts__21.isRedirect = true; } if ((dev__21 || isBuildTimeSSG__21) && !renderOpts__21.isNotFound && !isSerializableProps__2(pathname__21, "getStaticProps", data__58.props)) { throw new Error("invariant: getStaticProps did not return valid props. Please report this."); } if ("revalidate" in data__58) { if (typeof data__58.revalidate === "number") { if (!Number.isInteger(data__58.revalidate)) { throw new Error(`A page's revalidate option must be seconds expressed as a natural number for ${req__21.url}. Mixed numbers, such as '${data__58.revalidate}', cannot be used.` + `\nTry changing the value to '${Math.ceil(data__58.revalidate)}' or using \`Math.ceil()\` if you're computing the value.`); } else if (data__58.revalidate <= 0) { throw new Error(`A page's revalidate option can not be less than or equal to zero for ${req__21.url}. A revalidate option of zero means to revalidate after _every_ request, and implies stale data cannot be tolerated.` + `\n\nTo never revalidate, you can set revalidate to \`false\` (only ran once at build-time).` + `\nTo revalidate as soon as possible, you can set the value to \`1\`.`); } else if (data__58.revalidate > 31536000) { console.warn(`Warning: A page's revalidate option was set to more than a year for ${req__21.url}. This may have been done in error.` + `\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \`revalidate\` to \`false\`!`); } } else if (data__58.revalidate === true) { data__58.revalidate = 1; } else if (data__58.revalidate === false || typeof data__58.revalidate === "undefined") { data__58.revalidate = false; } else { throw new Error(`A page's revalidate option must be seconds expressed as a natural number. Mixed numbers and strings cannot be used. Received '${JSON.stringify(data__58.revalidate)}' for ${req__21.url}`); } } else { data__58.revalidate = false; } props__21.pageProps = Object.assign({}, props__21.pageProps, "props" in data__58 ? data__58.props : undefined); renderOpts__21.revalidate = "revalidate" in data__58 ? data__58.revalidate : undefined; renderOpts__21.pageData = props__21; if (renderOpts__21.isNotFound) { return null; } } if (getServerSideProps__21) { props__21[SERVER_PROPS_ID__2] = true; } if (getServerSideProps__21 && !isFallback__21) { let data__85; let canAccessRes__85 = true; let resOrProxy__85 = res__21; if (process.env.NODE_ENV !== "production") { resOrProxy__85 = new Proxy(res__21, { get: function(obj__87, prop__87, receiver__87) { if (!canAccessRes__85) { throw new Error(`You should not access 'res' after getServerSideProps resolves.` + `\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res`); } return Reflect.get(obj__87, prop__87, receiver__87); } }); } try { data__85 = await getServerSideProps__21({ req: req__21, res: resOrProxy__85, query__21, resolvedUrl: renderOpts__21.resolvedUrl, ...pageIsDynamic__21 ? { params: params__21 } : undefined, ...previewData__21 !== false ? { preview: true, previewData: previewData__21 } : undefined, locales: renderOpts__21.locales, locale: renderOpts__21.locale, defaultLocale: renderOpts__21.defaultLocale }); canAccessRes__85 = false; } catch (serverSidePropsError__90) { if (isError__2(serverSidePropsError__90) && serverSidePropsError__90.code === "ENOENT") { delete serverSidePropsError__90.code; } throw serverSidePropsError__90; } if (data__85 == null) { throw new Error(GSSP_NO_RETURNED_VALUE__2); } const invalidKeys__85 = Object.keys(data__85).filter((key__93)=>key__93 !== "props" && key__93 !== "redirect" && key__93 !== "notFound"); if (data__85.unstable_notFound) { throw new Error(`unstable_notFound has been renamed to notFound, please update the field to continue. Page: ${pathname__21}`); } if (data__85.unstable_redirect) { throw new Error(`unstable_redirect has been renamed to redirect, please update the field to continue. Page: ${pathname__21}`); } if (invalidKeys__85.length) { throw new Error(invalidKeysMsg__2("getServerSideProps", invalidKeys__85)); } if ("notFound" in data__85 && data__85.notFound) { if (pathname__21 === "/404") { throw new Error(`The /404 page can not return notFound in "getStaticProps", please remove it to continue!`); } renderOpts__21.isNotFound = true; return null; } if ("redirect" in data__85 && typeof data__85.redirect === "object") { checkRedirectValues__2(data__85.redirect, req__21, "getServerSideProps"); data__85.props = { __N_REDIRECT: data__85.redirect.destination, __N_REDIRECT_STATUS: getRedirectStatus__2(data__85.redirect) }; if (typeof data__85.redirect.basePath !== "undefined") { data__85.props.__N_REDIRECT_BASE_PATH = data__85.redirect.basePath; } renderOpts__21.isRedirect = true; } if (data__85.props instanceof Promise) { data__85.props = await data__85.props; } if ((dev__21 || isBuildTimeSSG__21) && !isSerializableProps__2(pathname__21, "getServerSideProps", data__85.props)) { throw new Error("invariant: getServerSideProps did not return valid props. Please report this."); } props__21.pageProps = Object.assign({}, props__21.pageProps, data__85.props); renderOpts__21.pageData = props__21; } if (!isSSG__21 && !getServerSideProps__21 && process.env.NODE_ENV !== "production" && Object.keys(props__21?.pageProps || {}).includes("url")) { console.warn(`The prop \`url\` is a reserved prop in Next.js for legacy reasons and will be overridden on page ${pathname__21}\n` + `See more info here: https://nextjs.org/docs/messages/reserved-page-prop`); } if (isDataReq__21 && !isSSG__21 || renderOpts__21.isRedirect) { return RenderResult__2.fromStatic(JSON.stringify(props__21)); } if (isFallback__21) { props__21.pageProps = {}; } if (isResSent__2(res__21) && !isSSG__21) return null; let filteredBuildManifest__21 = buildManifest__21; if (isAutoExport__21 && pageIsDynamic__21) { const page__106 = denormalizePagePath__2(normalizePagePath__2(pathname__21)); if (page__106 in filteredBuildManifest__21.pages) { filteredBuildManifest__21 = { ...filteredBuildManifest__21, pages: { ...filteredBuildManifest__21.pages, [page__106]: [ ...filteredBuildManifest__21.pages[page__106], ...filteredBuildManifest__21.lowPriorityFiles.filter((f__108)=>f__108.includes("_buildManifest")) ] }, lowPriorityFiles: filteredBuildManifest__21.lowPriorityFiles.filter((f__109)=>!f__109.includes("_buildManifest")) }; } } const generateStaticHTML__21 = supportsDynamicHTML__21 !== true; const renderDocument__21 = async ()=>{ if (Document__21.getInitialProps) { const renderPage__111 = (options__112 = {})=>{ if (ctx__21.err && ErrorDebug__21) { const html__113 = ReactDOMServer__2.renderToString(<ErrorDebug__21 error={ctx__21.err}/>); return { html__113, head__21 }; } if (dev__21 && (props__21.router || props__21.Component)) { throw new Error(`'router' and 'Component' can not be returned in getInitialProps from _app.js https://nextjs.org/docs/messages/cant-override-next-props`); } const { App: EnhancedApp__112, Component: EnhancedComponent__112 } = enhanceComponents__2(options__112, App__21, Component__21); const html__112 = ReactDOMServer__2.renderToString(<AppContainer__21> <EnhancedApp__112 Component={EnhancedComponent__112} router={router__21} {...props__21}/> </AppContainer__21>); return { html__112, head__21 }; }; const documentCtx__111 = { ...ctx__21, renderPage__111 }; const docProps__111 = await loadGetInitialProps__2(Document__21, documentCtx__111); if (isResSent__2(res__21) && !isSSG__21) return null; if (!docProps__111 || typeof docProps__111.html !== "string") { const message__115 = `"${getDisplayName__2(Document__21)}.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string`; throw new Error(message__115); } return { bodyResult: piperFromArray__2([ docProps__111.html ]), documentElement: (htmlProps__116)=><Document__21 {...htmlProps__116} {...docProps__111}/>, head: docProps__111.head, headTags: await headTags__21(documentCtx__111), styles: docProps__111.styles }; } else { const content__117 = ctx__21.err && ErrorDebug__21 ? <ErrorDebug__21 error={ctx__21.err}/> : <AppContainer__21> <App__21 {...props__21} Component={Component__21} router={router__21}/> </AppContainer__21>; const bodyResult__117 = concurrentFeatures__21 ? await renderToStream__2(content__117, generateStaticHTML__21) : piperFromArray__2([ ReactDOMServer__2.renderToString(content__117) ]); return { bodyResult__117, documentElement: ()=>Document__21(), head__21, headTags: [], styles: jsxStyleRegistry__21.styles() }; } }; const documentResult__21 = await renderDocument__21(); if (!documentResult__21) { return null; } const dynamicImportsIds__21 = new Set(); const dynamicImports__21 = new Set(); for (const mod__119 of reactLoadableModules__21){ const manifestItem__120 = reactLoadableManifest__21[mod__119]; if (manifestItem__120) { dynamicImportsIds__21.add(manifestItem__120.id); manifestItem__120.files.forEach((item__122)=>{ dynamicImports__21.add(item__122); }); } } const hybridAmp__21 = ampState__21.hybrid; const docComponentsRendered__21 = {}; const { assetPrefix__21, buildId__21, customServer__21, defaultLocale__21, disableOptimizedLoading__21, domainLocales__21, locale__21, locales__21, runtimeConfig__21 } = renderOpts__21; const htmlProps__21 = { __NEXT_DATA__: { props__21, page: pathname__21, query__21, buildId__21, assetPrefix: assetPrefix__21 === "" ? undefined : assetPrefix__21, runtimeConfig__21, nextExport: nextExport__21 === true ? true : undefined, autoExport: isAutoExport__21 === true ? true : undefined, isFallback__21, dynamicIds: dynamicImportsIds__21.size === 0 ? undefined : Array.from(dynamicImportsIds__21), err: renderOpts__21.err ? serializeError__2(dev__21, renderOpts__21.err) : undefined, gsp: !!getStaticProps__21 ? true : undefined, gssp: !!getServerSideProps__21 ? true : undefined, customServer__21, gip: hasPageGetInitialProps__21 ? true : undefined, appGip: !defaultAppGetInitialProps__21 ? true : undefined, locale__21, locales__21, defaultLocale__21, domainLocales__21, isPreview: isPreview__21 === true ? true : undefined }, buildManifest: filteredBuildManifest__21, docComponentsRendered__21, dangerousAsPath: router__21.asPath, canonicalBase: !renderOpts__21.ampPath && req__21.__nextStrippedLocale ? `${renderOpts__21.canonicalBase || ""}/${renderOpts__21.locale}` : renderOpts__21.canonicalBase, ampPath__21, inAmpMode__21, isDevelopment: !!dev__21, hybridAmp__21, dynamicImports: Array.from(dynamicImports__21), assetPrefix__21, unstable_runtimeJS: process.env.NODE_ENV === "production" ? pageConfig__21.unstable_runtimeJS : undefined, unstable_JsPreload: pageConfig__21.unstable_JsPreload, devOnlyCacheBusterQueryString__21, scriptLoader__21, locale__21, disableOptimizedLoading__21, head: documentResult__21.head, headTags: documentResult__21.headTags, styles: documentResult__21.styles, useMaybeDeferContent__2 }; const documentHTML__21 = ReactDOMServer__2.renderToStaticMarkup(<AmpStateContext__2.Provider value={ampState__21}> <HtmlContext__2.Provider value={htmlProps__21}> {documentResult__21.documentElement(htmlProps__21)} </HtmlContext__2.Provider> </AmpStateContext__2.Provider>); if (process.env.NODE_ENV !== "production") { const nonRenderedComponents__123 = []; const expectedDocComponents__123 = [ "Main", "Head", "NextScript", "Html" ]; for (const comp__124 of expectedDocComponents__123){ if (!docComponentsRendered__21[comp__124]) { nonRenderedComponents__123.push(comp__124); } } const plural__123 = nonRenderedComponents__123.length !== 1 ? "s" : ""; if (nonRenderedComponents__123.length) { const missingComponentList__127 = nonRenderedComponents__123.map((e__128)=>`<${e__128} />`).join(", "); warn__2(`Your custom Document (pages/_document) did not render all the required subcomponent${plural__123}.\n` + `Missing component${plural__123}: ${missingComponentList__127}\n` + "Read how to fix here: https://nextjs.org/docs/messages/missing-document-component"); } } const renderTargetIdx__21 = documentHTML__21.indexOf(BODY_RENDER_TARGET__2); const prefix__21 = []; prefix__21.push("<!DOCTYPE html>"); prefix__21.push(documentHTML__21.substring(0, renderTargetIdx__21)); if (inAmpMode__21) { prefix__21.push("<!-- __NEXT_DATA__ -->"); } let pipers__21 = [ piperFromArray__2(prefix__21), documentResult__21.bodyResult, piperFromArray__2([ documentHTML__21.substring(renderTargetIdx__21 + BODY_RENDER_TARGET__2.length) ]) ]; const postProcessors__21 = (generateStaticHTML__21 ? [ inAmpMode__21 ? async (html__130)=>{ html__130 = await optimizeAmp__2(html__130, renderOpts__21.ampOptimizerConfig); if (!renderOpts__21.ampSkipValidation && renderOpts__21.ampValidator) { await renderOpts__21.ampValidator(html__130, pathname__21); } return html__130; } : null, process.env.__NEXT_OPTIMIZE_FONTS || process.env.__NEXT_OPTIMIZE_IMAGES ? async (html__132)=>{ return await postProcess__2(html__132, { getFontDefinition__21 }, { optimizeFonts: renderOpts__21.optimizeFonts, optimizeImages: renderOpts__21.optimizeImages }); } : null, renderOpts__21.optimizeCss ? async (html__133)=>{ const Critters__133 = require("critters"); const cssOptimizer__133 = new Critters__133({ ssrMode: true, reduceInlineStyles: false, path: renderOpts__21.distDir, publicPath: `${renderOpts__21.assetPrefix}/_next/`, preload: "media", fonts: false, ...renderOpts__21.optimizeCss }); return await cssOptimizer__133.process(html__133); } : null, inAmpMode__21 || hybridAmp__21 ? async (html__134)=>{ return html__134.replace(/&amp;amp=1/g, "&amp=1"); } : null ] : []).filter(Boolean); if (generateStaticHTML__21 || postProcessors__21.length > 0) { let html__135 = await piperToString__2(chainPipers__2(pipers__21)); for (const postProcessor__136 of postProcessors__21){ if (postProcessor__136) { html__135 = await postProcessor__136(html__135); } } return new RenderResult__2(html__135); } return new RenderResult__2(chainPipers__2(pipers__21)); } function errorToJSON__2(err__139) { const { name__139, message__139, stack__139 } = err__139; return { name__139, message__139, stack__139 }; } function serializeError__2(dev__140, err__140) { if (dev__140) { return errorToJSON__2(err__140); } return { name: "Internal Server Error.", message: "500 - Internal Server Error.", statusCode: 500 }; } function renderToStream__2(element__142, generateStaticHTML__142) { return new Promise((resolve__143, reject__143)=>{ let underlyingStream__143 = null; const stream__143 = new Writable__2({ highWaterMark: 0, write (chunk__144, encoding__144, callback__144) { if (!underlyingStream__143) { throw new Error("invariant: write called without an underlying stream. This is a bug in Next.js"); } if (!underlyingStream__143.writable.write(chunk__144, encoding__144)) { underlyingStream__143.queuedCallbacks.push(()=>callback__144()); } else { callback__144(); } } }); stream__143.once("finish", ()=>{ if (!underlyingStream__143) { throw new Error("invariant: finish called without an underlying stream. This is a bug in Next.js"); } underlyingStream__143.resolve(); }); stream__143.once("error", (err__150)=>{ if (!underlyingStream__143) { throw new Error("invariant: error called without an underlying stream. This is a bug in Next.js"); } underlyingStream__143.resolve(err__150); }); Object.defineProperty(stream__143, "flush", { value: ()=>{ if (!underlyingStream__143) { throw new Error("invariant: flush called without an underlying stream. This is a bug in Next.js"); } if (typeof underlyingStream__143.writable.flush === "function") { underlyingStream__143.writable.flush(); } }, enumerable: true }); let resolved__143 = false; const doResolve__143 = ()=>{ if (!resolved__143) { resolved__143 = true; resolve__143((res__157, next__157)=>{ const drainHandler__157 = ()=>{ const prevCallbacks__158 = underlyingStream__143.queuedCallbacks; underlyingStream__143.queuedCallbacks = []; prevCallbacks__158.forEach((callback__159)=>callback__159()); }; res__157.on("drain", drainHandler__157); underlyingStream__143 = { resolve: (err__160)=>{ underlyingStream__143 = null; res__157.removeListener("drain", drainHandler__157); next__157(err__160); }, writable: res__157, queuedCallbacks: [] }; startWriting__143(); }); } }; const { abort__143, startWriting__143 } = ReactDOMServer__2.pipeToNodeWritable(element__142, stream__143, { onError (error__161) { if (!resolved__143) { resolved__143 = true; reject__143(error__161); } abort__143(); }, onCompleteShell () { if (!generateStaticHTML__142) { doResolve__143(); } }, onCompleteAll () { doResolve__143(); } }); }); } function chainPipers__2(pipers__166) { return pipers__166.reduceRight((lhs__167, rhs__167)=>(res__168, next__168)=>{ rhs__167(res__168, (err__169)=>err__169 ? next__168(err__169) : lhs__167(res__168, next__168)); }, (res__170, next__170)=>{ res__170.end(); next__170(); }); } function piperFromArray__2(chunks__171) { return (res__172, next__172)=>{ if (typeof res__172.cork === "function") { res__172.cork(); } chunks__171.forEach((chunk__174)=>res__172.write(chunk__174)); if (typeof res__172.uncork === "function") { res__172.uncork(); } next__172(); }; } function piperToString__2(input__176) { return new Promise((resolve__177, reject__177)=>{ const bufferedChunks__177 = []; const stream__177 = new Writable__2({ writev (chunks__178, callback__178) { chunks__178.forEach((chunk__179)=>bufferedChunks__177.push(chunk__179.chunk)); callback__178(); } }); input__176(stream__177, (err__180)=>{ if (err__180) { reject__177(err__180); } else { resolve__177(Buffer.concat(bufferedChunks__177).toString()); } }); }); } export function useMaybeDeferContent__2(_name__183, contentFn__183) { return [ false, contentFn__183() ]; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/2/input.js
JavaScript
function renderToStream(element, generateStaticHTML) { return new Promise((resolve, reject) => { let underlyingStream = null; const stream = new Writable({ highWaterMark: 0, write(chunk, encoding, callback) { if (!underlyingStream) { throw new Error( "invariant: write called without an underlying stream. This is a bug in Next.js" ); } if (!underlyingStream.writable.write(chunk, encoding)) { underlyingStream.queuedCallbacks.push(() => callback()); } else { callback(); } }, }); stream.once("finish", () => { if (!underlyingStream) { throw new Error( "invariant: finish called without an underlying stream. This is a bug in Next.js" ); } underlyingStream.resolve(); }); stream.once("error", (err) => { if (!underlyingStream) { throw new Error( "invariant: error called without an underlying stream. This is a bug in Next.js" ); } underlyingStream.resolve(err); }); Object.defineProperty(stream, "flush", { value: () => { if (!underlyingStream) { throw new Error( "invariant: flush called without an underlying stream. This is a bug in Next.js" ); } if (typeof underlyingStream.writable.flush === "function") { underlyingStream.writable.flush(); } }, enumerable: true, }); let resolved = false; const doResolve = () => { if (!resolved) { resolved = true; resolve((res, next) => { const drainHandler = () => { const prevCallbacks = underlyingStream.queuedCallbacks; underlyingStream.queuedCallbacks = []; prevCallbacks.forEach((callback) => callback()); }; res.on("drain", drainHandler); underlyingStream = { resolve: (err) => { underlyingStream = null; res.removeListener("drain", drainHandler); next(err); }, writable: res, queuedCallbacks: [], }; startWriting(); }); } }; const { abort, startWriting } = ReactDOMServer.pipeToNodeWritable( element, stream, { onError(error) { if (!resolved) { resolved = true; reject(error); } abort(); }, onCompleteShell() { if (!generateStaticHTML) { doResolve(); } }, onCompleteAll() { doResolve(); }, } ); }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/2/output.js
JavaScript
function renderToStream__2(element__3, generateStaticHTML__3) { return new Promise((resolve__4, reject__4)=>{ let underlyingStream__4 = null; const stream__4 = new Writable({ highWaterMark: 0, write (chunk__5, encoding__5, callback__5) { if (!underlyingStream__4) { throw new Error("invariant: write called without an underlying stream. This is a bug in Next.js"); } if (!underlyingStream__4.writable.write(chunk__5, encoding__5)) { underlyingStream__4.queuedCallbacks.push(()=>callback__5()); } else { callback__5(); } } }); stream__4.once("finish", ()=>{ if (!underlyingStream__4) { throw new Error("invariant: finish called without an underlying stream. This is a bug in Next.js"); } underlyingStream__4.resolve(); }); stream__4.once("error", (err__11)=>{ if (!underlyingStream__4) { throw new Error("invariant: error called without an underlying stream. This is a bug in Next.js"); } underlyingStream__4.resolve(err__11); }); Object.defineProperty(stream__4, "flush", { value: ()=>{ if (!underlyingStream__4) { throw new Error("invariant: flush called without an underlying stream. This is a bug in Next.js"); } if (typeof underlyingStream__4.writable.flush === "function") { underlyingStream__4.writable.flush(); } }, enumerable: true }); let resolved__4 = false; const doResolve__4 = ()=>{ if (!resolved__4) { resolved__4 = true; resolve__4((res__18, next__18)=>{ const drainHandler__18 = ()=>{ const prevCallbacks__19 = underlyingStream__4.queuedCallbacks; underlyingStream__4.queuedCallbacks = []; prevCallbacks__19.forEach((callback__20)=>callback__20()); }; res__18.on("drain", drainHandler__18); underlyingStream__4 = { resolve: (err__21)=>{ underlyingStream__4 = null; res__18.removeListener("drain", drainHandler__18); next__18(err__21); }, writable: res__18, queuedCallbacks: [] }; startWriting__4(); }); } }; const { abort__4, startWriting__4 } = ReactDOMServer.pipeToNodeWritable(element__3, stream__4, { onError (error__22) { if (!resolved__4) { resolved__4 = true; reject__4(error__22); } abort__4(); }, onCompleteShell () { if (!generateStaticHTML__3) { doResolve__4(); } }, onCompleteAll () { doResolve__4(); } }); }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/3/input.js
JavaScript
function top() { let resolved = false; const doResolve = () => { let aaa = 3; if (!resolved) { resolved = true; let bbb = 4; resolve((res, next) => { const drainHandler = () => { const prevCallbacks = underlyingStream.queuedCallbacks; underlyingStream.queuedCallbacks = []; prevCallbacks.forEach((callback) => callback()); }; res.on("drain", drainHandler); underlyingStream = { resolve: (err) => { underlyingStream = null; res.removeListener("drain", drainHandler); next(err); }, writable: res, queuedCallbacks: [], }; startWriting(); }); } }; const { abort, startWriting } = ReactDOMServer.pipeToNodeWritable( element, stream, { onError(error) { if (!resolved) { resolved = true; reject(error); } abort(); }, onCompleteShell() { if (!generateStaticHTML) { doResolve(); } }, onCompleteAll() { doResolve(); }, } ); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/resolver/vercel/next/server/render/3/output.js
JavaScript
function top__2() { let resolved__3 = false; const doResolve__3 = ()=>{ let aaa__4 = 3; if (!resolved__3) { resolved__3 = true; let bbb__5 = 4; resolve((res__6, next__6)=>{ const drainHandler__6 = ()=>{ const prevCallbacks__7 = underlyingStream.queuedCallbacks; underlyingStream.queuedCallbacks = []; prevCallbacks__7.forEach((callback__8)=>callback__8()); }; res__6.on("drain", drainHandler__6); underlyingStream = { resolve: (err__9)=>{ underlyingStream = null; res__6.removeListener("drain", drainHandler__6); next__6(err__9); }, writable: res__6, queuedCallbacks: [] }; startWriting__3(); }); } }; const { abort__3, startWriting__3 } = ReactDOMServer.pipeToNodeWritable(element, stream, { onError (error__10) { if (!resolved__3) { resolved__3 = true; reject(error__10); } abort__3(); }, onCompleteShell () { if (!generateStaticHTML) { doResolve__3(); } }, onCompleteAll () { doResolve__3(); } }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/1/input.ts
TypeScript
interface MyType { other: number; } export default MyType;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/1/output.ts
TypeScript
interface MyType__2 { other__0: number; } export default MyType__2;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/2/input.ts
TypeScript
interface Foo { (a: string): void; b: string; } interface Foo { (a: number): number; c: boolean; d: { x: number; y: number }; } export = Foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/2/output.ts
TypeScript
interface Foo__2 { (a: string) : void; b__0: string; } interface Foo__2 { (a: number) : number; c__0: boolean; d__0: { x__0: number; y__0: number; }; } export = Foo__2
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/constructor/input.ts
TypeScript
class G<T> {} class Foo { constructor() { class Foo {} new G<Foo>(); } } new G<Foo>();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/constructor/output.ts
TypeScript
class G__2<T__3> { } class Foo__2 { constructor(){ class Foo__4 { } new G__2<Foo__4>(); } } new G__2<Foo__2>();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/getter/input.ts
TypeScript
class G<T> {} class Foo { get foo() { class Foo {} new G<Foo>(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/getter/output.ts
TypeScript
class G__2<T__3> { } class Foo__2 { get foo() { class Foo__4 { } new G__2<Foo__4>(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/super/input.ts
TypeScript
class A extends B { constructor() { super(); const sym = ""; console.log(super.sym + super[sym]); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/class/super/output.ts
TypeScript
class A__2 extends B { constructor(){ super(); const sym__3 = ""; console.log(super.sym + super[sym__3]); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/declare/input.ts
TypeScript
declare const MY_MAGIC_VARIABLE: string; declare function myFunction(): string; declare enum MyEnum { Value = "value", } declare class MyClass { prop: string; } declare namespace MyNamespace { var value: string; } export default function Page() { return `Server value: ${true ? MY_MAGIC_VARIABLE : "not set" + myFunction() + MyEnum.Value + new MyClass().prop + MyNamespace.value}` }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/declare/output.ts
TypeScript
declare const MY_MAGIC_VARIABLE__2: string; declare function myFunction__2(): string; declare enum MyEnum__2 { Value__0 = "value" } declare class MyClass__2 { prop: string; } declare namespace MyNamespace__2 { var value__4: string; } export default function Page__2() { return `Server value: ${true ? MY_MAGIC_VARIABLE__2 : "not set" + myFunction__2() + MyEnum__2.Value + new MyClass__2().prop + MyNamespace__2.value}`; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/9650/1/input.ts
TypeScript
export class X { constructor() {} bad(target: number) { const d = 1; const min = 0; const max = 100; console.log( "x", `duration ${d} not in range - ${min} ≥ ${d} && ${max} ≥ ${d}` ); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/9650/1/output.ts
TypeScript
export class X__2 { constructor(){} bad(target__4: number) { const d__4 = 1; const min__4 = 0; const max__4 = 100; console.log("x", `duration ${d__4} not in range - ${min__4} ≥ ${d__4} && ${max__4} ≥ ${d__4}`); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/463/1/input.ts
TypeScript
(() => { function foo() { return new Bar(); } class Bar {} })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/463/1/output.ts
TypeScript
(()=>{ function foo__3() { return new Bar__3(); } class Bar__3 { } })();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/463/2/input.ts
TypeScript
function wrapper() { function foo() { return new Bar(); } class Bar {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/463/2/output.ts
TypeScript
function wrapper__2() { function foo__3() { return new Bar__3(); } class Bar__3 { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/486/input.ts
TypeScript
function foo() { target++; { var target = 0; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/486/output.ts
TypeScript
function foo__2() { target__3++; { var target__3 = 0; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/612/1/input.ts
TypeScript
class T { #foo(x) {} #bar(x) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/612/1/output.ts
TypeScript
class T__2 { #foo(x__3) {} #bar(x__4) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/612/2/input.ts
TypeScript
class T { #foo(x) { use(x); } #bar(x) { use(x); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/612/2/output.ts
TypeScript
class T__2 { #foo(x__3) { use(x__3); } #bar(x__4) { use(x__4); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/705/input.ts
TypeScript
import type { Foo } from "./foo.ts"; function _bar(...Foo: Foo) { console.log(Foo); } function _bar2(Foo: Foo, other = Foo) { Foo; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/deno/lint/705/output.ts
TypeScript
import type { Foo__2 } from "./foo.ts"; function _bar__2(...Foo__3: Foo__2) { console.log(Foo__3); } function _bar2__2(Foo__4: Foo__2, other__4 = Foo__4) { Foo__4; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/enum/1/input.ts
TypeScript
enum Foo { hello = 42, } enum Foo2 { hello = "42", } console.log(Foo.hello, Foo2.hello); console.log(Hello.en, Hello["ja-JP"], Hello[`ko-KR`], Hello["zh-CN"]); const enum Hello { en = "hello", "ja-JP" = "こんにちは", "ko-KR" = "안녕하세요", "zh-CN" = `你好`, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/enum/1/output.ts
TypeScript
enum Foo__2 { hello__0 = 42 } enum Foo2__2 { hello__0 = "42" } console.log(Foo__2.hello, Foo2__2.hello); console.log(Hello__2.en, Hello__2["ja-JP"], Hello__2[`ko-KR`], Hello__2["zh-CN"]); const enum Hello__2 { en__0 = "hello", "ja-JP" = "こんにちは", "ko-KR" = "안녕하세요", "zh-CN" = `你好` }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/1/input.ts
TypeScript
function wrapper(a) { var a; { let a; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/1/output.ts
TypeScript
function wrapper__2(a__3) { var a__3; { let a__4; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/2/input.ts
TypeScript
function wrapper(a) { { let a; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/2/output.ts
TypeScript
function wrapper__2(a__3) { { let a__4; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/3/input.ts
TypeScript
function wrapper(a) { { var a; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/3/output.ts
TypeScript
function wrapper__2(a__3) { { var a__3; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/4/input.ts
TypeScript
function wrapper(a) { let a; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/function_scope/4/output.ts
TypeScript
function wrapper__2(a__3) { let a__3; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/generated_contextual_typing_01/input.ts
TypeScript
class Base { private p; } var x338 = (n: { (): Base[] }) => n; x338(function named() { return [d1, d2]; });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/generated_contextual_typing_01/output.ts
TypeScript
class Base__2 { private p; } var x338__2 = (n__3: { () : Base__2[]; })=>n__3; x338__2(function named__4() { return [ d1, d2 ]; });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/internalModules/codeGeneration/importStatements/input.ts
TypeScript
module A { export class Point { constructor(public x: number, public y: number) {} } export var Origin = new Point(0, 0); } // no code gen expected module B { import a = A; //Error generates 'var <Alias> = <EntityName>;' } // no code gen expected module C { import a = A; //Error generates 'var <Alias> = <EntityName>;' var m: typeof a; var p: a.Point; var p = { x: 0, y: 0 }; } // code gen expected module D { import a = A; var p = new a.Point(1, 1); } module E { import a = A; export function xDist(x: a.Point) { return a.Origin.x - x.x; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/internalModules/codeGeneration/importStatements/output.ts
TypeScript
namespace A__2 { export class Point__3 { constructor(public x__4: number, public y__4: number){} } export var Origin__3 = new Point__3(0, 0); } namespace B__2 { import a__5 = A__2; } namespace C__2 { import a__6 = A__2; var m__6: typeof a__6; var p__6: a__6.Point; var p__6 = { x: 0, y: 0 }; } namespace D__2 { import a__7 = A__2; var p__7 = new a__7.Point(1, 1); } namespace E__2 { import a__8 = A__2; export function xDist__8(x__9: a__8.Point) { return a__8.Origin.x - x__9.x; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-5622/1/input.ts
TypeScript
var x = 1 function foo(x, y = function () { x = 2 }) { var x = 3 y() expect(x).toBe(3); } foo() expect(x).toBe(1);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-5622/1/output.ts
TypeScript
var x__2 = 1; function foo__2(x__3, y__3 = function() { x__3 = 2; }) { var x__3 = 3; y__3(); expect(x__3).toBe(3); } foo__2(); expect(x__2).toBe(1);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-5622/2/input.ts
TypeScript
function left(a, b = a, c = b) { a; b; } function right(a = b, b = a) { a; b; } function right2(a = b, b = c, c = a) { a; b; c; } function inside(a = b) { var b; } function outside() { var b; function inside(a = b) { // Still an error because b is declared inside the function var b; } } function defaultArgFunction(a = function () { return b; }, b = 1) { } function defaultArgArrow(a = () => () => b, b = 3) { } class C { constructor(a = b, b = 1) { } method(a = b, b = 1) { } } // Function expressions var x = (a = b, b = c, c = d) => { var d; }; // Should not produce errors - can reference later parameters if they occur within a function expression initializer. function f(a, b = function () { return c; }, c = b()) { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-5622/2/output.ts
TypeScript
function left__2(a__3, b__3 = a__3, c__3 = b__3) { a__3; b__3; } function right__2(a__4 = b__4, b__4 = a__4) { a__4; b__4; } function right2__2(a__5 = b__5, b__5 = c__5, c__5 = a__5) { a__5; b__5; c__5; } function inside__2(a__6 = b) { var b__6; } function outside__2() { var b__7; function inside__7(a__8 = b__7) { var b__8; } } function defaultArgFunction__2(a__9 = function() { return b__9; }, b__9 = 1) {} function defaultArgArrow__2(a__11 = ()=>()=>b__11, b__11 = 3) {} class C__2 { constructor(a__12 = b__12, b__12 = 1){} method(a__13 = b__13, b__13 = 1) {} } var x__2 = (a__14 = b__14, b__14 = c__14, c__14 = d)=>{ var d__14; }; function f__2(a__15, b__15 = function() { return c__15; }, c__15 = b__15()) {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-7967/1/input.ts
TypeScript
{ interface Foo { } } { interface Foo { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-7967/1/output.ts
TypeScript
{ interface Foo__3 { } }{ interface Foo__4 { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-7967/2/input.ts
TypeScript
{ using foo = null } { using foo = null }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-7967/2/output.ts
TypeScript
{ using foo__3 = null; }{ using foo__4 = null; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-9685/1/input.tsx
TypeScript (TSX)
export namespace form { export const input = null; export const test = <input />; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issue-9685/1/output.tsx
TypeScript (TSX)
export namespace form__2 { export const input__3 = null; export const test__3 = <input/>; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issues/1517/1/input.ts
TypeScript
interface X { get foo(): string; set foo(v: string | number); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/tests/ts-resolver/issues/1517/1/output.ts
TypeScript
interface X__2 { get foo__0(): string; set foo__0(v: string | number); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University