code stringlengths 28 313k | docstring stringlengths 25 85.3k | func_name stringlengths 1 74 | language stringclasses 1
value | repo stringlengths 5 60 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
digest(s) {
return import_enc_hex.default.stringify((0, import_sha1.default)(s));
} | Compute the sha1 hash of the script and return its hex representation. | digest | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
constructor(client, opts) {
this.client = client;
this.opts = opts;
this.enableTelemetry = opts?.enableTelemetry ?? true;
if (opts?.readYourWrites === false) {
this.client.readYourWrites = false;
}
this.enableAutoPipelining = opts?.enableAutoPipelining ?? true;
} | Create a new redis client
@example
```typescript
const redis = new Redis({
url: "<UPSTASH_REDIS_REST_URL>",
token: "<UPSTASH_REDIS_REST_TOKEN>",
});
``` | constructor | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
createScript(script) {
return new Script(this, script);
} | Technically this is not private, we can hide it from intellisense by doing this | createScript | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
constructor(configOrRequester) {
if ("request" in configOrRequester) {
super(configOrRequester);
return;
}
if (!configOrRequester.url) {
console.warn(
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
);
} else if (configOrRequester.url.st... | Create a new redis client by providing a custom `Requester` implementation
@example
```ts
import { UpstashRequest, Requester, UpstashResponse, Redis } from "@upstash/redis"
const requester: Requester = {
request: <TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>> => {
// ...
}
}
const re... | constructor | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
static fromEnv(config) {
if (process.env === void 0) {
throw new TypeError(
'[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
);
}
const url = process.env.UPSTASH_R... | Create a new Upstash Redis instance from environment variables.
Use this to automatically load connection secrets from your environment
variables. For instance when using the Vercel integration.
This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
your environment using `process.env`. | fromEnv | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
async *scanIterator(options) {
let cursor = "0";
let keys;
do {
[cursor, keys] = await this.scan(cursor, options);
for (const key of keys) {
yield key;
}
} while (cursor !== "0");
} | Same as `scan` but returns an AsyncIterator to allow iteration via `for await`. | scanIterator | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
async *hscanIterator(key, options) {
let cursor = "0";
let items;
do {
[cursor, items] = await this.hscan(key, cursor, options);
for (const item of items) {
yield item;
}
} while (cursor !== "0");
} | Same as `hscan` but returns an AsyncIterator to allow iteration via `for await`. | hscanIterator | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
async *sscanIterator(key, options) {
let cursor = "0";
let items;
do {
[cursor, items] = await this.sscan(key, cursor, options);
for (const item of items) {
yield item;
}
} while (cursor !== "0");
} | Same as `sscan` but returns an AsyncIterator to allow iteration via `for await`. | sscanIterator | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
async *zscanIterator(key, options) {
let cursor = "0";
let items;
do {
[cursor, items] = await this.zscan(key, cursor, options);
for (const item of items) {
yield item;
}
} while (cursor !== "0");
} | Same as `zscan` but returns an AsyncIterator to allow iteration via `for await`. | zscanIterator | javascript | vercel/next.js | .github/actions/upload-turboyet-data/dist/index.js | https://github.com/vercel/next.js/blob/master/.github/actions/upload-turboyet-data/dist/index.js | MIT |
TinaProvider = ({ children }) => {
return <TinaCMS {...tinaConfig}>{children}</TinaCMS>;
} | @private Do not import this directly, please import the dynamic provider instead | TinaProvider | javascript | vercel/next.js | examples/cms-tina/.tina/components/TinaProvider.js | https://github.com/vercel/next.js/blob/master/examples/cms-tina/.tina/components/TinaProvider.js | MIT |
async function createCouchbaseCluster() {
if (cached.conn) {
return cached.conn;
}
cached.conn = await couchbase.connect(
"couchbase://" +
COUCHBASE_ENDPOINT +
(IS_CLOUD_INSTANCE === "true"
? "?ssl=no_verify&console_log_level=5"
: ""),
{
username: COUCHBASE_USER,
... | Global is used here to maintain a cached connection across hot reloads
in development. This prevents connections growing exponentially
during API Route usage. | createCouchbaseCluster | javascript | vercel/next.js | examples/with-couchbase/util/couchbase.js | https://github.com/vercel/next.js/blob/master/examples/with-couchbase/util/couchbase.js | MIT |
function getKnex() {
if (!cached.instance) cached.instance = knex(config);
return cached.instance;
} | Global is used here to ensure the connection
is cached across hot-reloads in development
see https://github.com/vercel/next.js/discussions/12229#discussioncomment-83372 | getKnex | javascript | vercel/next.js | examples/with-knex/knex/index.js | https://github.com/vercel/next.js/blob/master/examples/with-knex/knex/index.js | MIT |
function MyApp({ Component, pageProps }) {
return (
/* Here we call NextSeo and pass our default configuration to it */
<>
<DefaultSeo {...SEO} />
<Component {...pageProps} />
</>
);
} | Using a custom _app.js with next-seo you can set default SEO
that will apply to every page. Full info on how the default works
can be found here: https://github.com/garmeeh/next-seo#default-seo-configuration | MyApp | javascript | vercel/next.js | examples/with-next-seo/pages/_app.js | https://github.com/vercel/next.js/blob/master/examples/with-next-seo/pages/_app.js | MIT |
async function createUser({ username, password }) {
// Here you should create the user and save the salt and hashed password (some dbs may have
// authentication methods that will do it for you so you don't have to worry about it):
const salt = crypto.randomBytes(16).toString("hex");
const hash = crypto
.pb... | User methods. The example doesn't contain a DB, but for real applications you must use a
db here, such as MongoDB, Fauna, SQL, etc. | createUser | javascript | vercel/next.js | examples/with-passport/lib/user.js | https://github.com/vercel/next.js/blob/master/examples/with-passport/lib/user.js | MIT |
create(context) {
function checkRequireCall(node) {
// Check if this is a require() call
if (
node.type !== 'CallExpression' ||
node.callee.type !== 'Identifier' ||
node.callee.name !== 'require' ||
node.arguments.length !== 1 ||
node.arguments[0].type !== 'Litera... | ESLint rule: typechecked-require
Ensures every require(source) call is cast to typeof import(source)
Source: https://v0.dev/chat/eslint-cast-imports-CDvQ3iWC1Mo | create | javascript | vercel/next.js | packages/eslint-plugin-internal/src/eslint-typechecked-require.js | https://github.com/vercel/next.js/blob/master/packages/eslint-plugin-internal/src/eslint-typechecked-require.js | MIT |
externalHandler = ({ context, request, getResolve }, callback) => {
;(async () => {
if (
request.match(
/next[/\\]dist[/\\]compiled[/\\](babel|webpack|source-map|semver|jest-worker|stacktrace-parser|@ampproject\/toolbox-optimizer)/
)
) {
callback(null, 'commonjs ' + req... | @param {Object} options
@param {boolean} options.dev
@param {boolean} options.turbo
@param {keyof typeof bundleTypes} options.bundleType
@param {boolean} options.experimental
@param {Partial<webpack.Configuration>} options.rest
@returns {webpack.Configuration} | externalHandler | javascript | vercel/next.js | packages/next/next-runtime.webpack-config.js | https://github.com/vercel/next.js/blob/master/packages/next/next-runtime.webpack-config.js | MIT |
async function server(task, opts) {
await task
.source('src/server/**/!(*.test).+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/server')
} | /!(*.test).+(js|ts|tsx|json)')
.swc('server', { dev: opts.dev })
.target('dist/lib')
}
export async function lib_esm(task, opts) {
await task
.source('src/lib/* | server | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function api_esm(task, opts) {
await task
.source('src/api/**/*.+(js|mts|ts|tsx)')
.swc('server', { dev: opts.dev, esm: true })
.target('dist/api')
.target('dist/esm/api')
} | /!(*.test).+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/server')
}
export async function server_esm(task, opts) {
await task
.source('src/server/* | api_esm | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function next_devtools_entrypoint(task, opts) {
await task
.source('src/next-devtools/dev-overlay.shim.ts')
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools')
} | /!(*.test|*.stories).+(js|ts|tsx|woff2)')
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/client')
}
export async function client_esm(task, opts) {
await task
.source('src/client/* | next_devtools_entrypoint | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function next_devtools_shared(task, opts) {
await task
.source(
'src/next-devtools/shared/**/!(*.test|*.stories).+(js|ts|tsx|woff2)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools/shared')
} | /!(*.test|*.stories).+(js|ts|tsx|woff2)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools/server')
}
export async function next_devtools_server_esm(task, opts) {
await task
.source(
'src/next-devtools/server/* | next_devtools_shared | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function next_devtools_userspace(task, opts) {
await task
.source(
'src/next-devtools/userspace/**/!(*.test|*.stories).+(js|ts|tsx|woff2)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools/userspace')
} | /!(*.test|*.stories).+(js|ts|tsx|woff2)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools/shared')
}
export async function next_devtools_shared_esm(task, opts) {
await task
.source(
'src/next-devtools/shared/* | next_devtools_userspace | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function nextbuildstatic(task, opts) {
await task
.source('src/export/**/!(*.test).+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/export')
} | /!(*.test|*.stories).+(js|ts|tsx|woff2)'
)
.swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/next-devtools/userspace')
}
export async function next_devtools_userspace_esm(task, opts) {
await task
.source(
'src/next-devtools/userspace/* | nextbuildstatic | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function pages_app(task, opts) {
await task
.source('src/pages/_app.tsx')
.swc('client', {
dev: opts.dev,
interopClientDefaultExport: true,
})
.target('dist/pages')
} | /!(*.test).+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/export')
}
// export is a reserved keyword for functions
export async function nextbuildstatic_esm(task, opts) {
await task
.source('src/export/* | pages_app | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function diagnostics(task, opts) {
await task
.source('src/diagnostics/**/*.+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/diagnostics')
} | /*.+(js|ts|tsx)')
.swc('server', { dev: opts.dev })
.target('dist/telemetry')
}
export async function trace(task, opts) {
await task
.source('src/trace/* | diagnostics | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function shared_esm(task, opts) {
await task
.source('src/shared/**/*.+(js|ts|tsx)', {
ignore: [
'src/shared/**/{amp,config,constants,dynamic,app-dynamic,head,runtime-config}.+(js|ts|tsx)',
'**/*.test.d.ts',
'**/*.test.+(js|ts|tsx)',
],
})
.swc('client', { dev: op... | /{amp,config,constants,dynamic,app-dynamic,head,runtime-config}.+(js|ts|tsx)',
'* | shared_esm | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function shared_re_exported(task, opts) {
await task
.source(
'src/shared/**/{amp,config,constants,dynamic,app-dynamic,head,runtime-config}.+(js|ts|tsx)',
{
ignore: ['**/*.test.d.ts', '**/*.test.+(js|ts|tsx)'],
}
)
.swc('client', { dev: opts.dev, interopClientDefaultExport:... | /*.+(js|ts|tsx)', {
ignore: [
'src/shared/* | shared_re_exported | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function shared_re_exported_esm(task, opts) {
await task
.source(
'src/shared/**/{amp,config,constants,app-dynamic,dynamic,head}.+(js|ts|tsx)',
{
ignore: ['**/*.test.d.ts', '**/*.test.+(js|ts|tsx)'],
}
)
.swc('client', {
dev: opts.dev,
esm: true,
})
.tar... | /{amp,config,constants,dynamic,app-dynamic,head,runtime-config}.+(js|ts|tsx)',
{
ignore: ['* | shared_re_exported_esm | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function server_wasm(task, opts) {
await task.source('src/server/**/*.+(wasm)').target('dist/server')
} | /{amp,config,constants,app-dynamic,dynamic,head}.+(js|ts|tsx)',
{
ignore: ['* | server_wasm | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
async function experimental_testmode(task, opts) {
await task
.source('src/experimental/testmode/**/!(*.test).+(js|ts|tsx)')
.swc('server', {
dev: opts.dev,
})
.target('dist/experimental/testmode')
} | /*.+(wasm)').target('dist/server')
}
export async function experimental_testing(task, opts) {
await task
.source('src/experimental/testing/* | experimental_testmode | javascript | vercel/next.js | packages/next/taskfile.js | https://github.com/vercel/next.js/blob/master/packages/next/taskfile.js | MIT |
function pluginCreator() {
return {
postcssPlugin: 'postcss-plugin-stub',
prepare() {
return {}
},
}
} | This file creates a stub postcss plugin
It will be pre-compiled into "src/compiled/postcss-plugin-stub-for-cssnano-simple",
which "postcss-svgo" will be aliased to when creating "cssnano-preset-simple" | pluginCreator | javascript | vercel/next.js | packages/next/src/bundles/postcss-plugin-stub/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/bundles/postcss-plugin-stub/index.js | MIT |
get size() {
return this._parsed.size;
} | The amount of cookies received from the client | size | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
delete(names) {
const map = this._parsed;
const result = !Array.isArray(names) ? map.delete(names) : names.map((name) => map.delete(name));
this._headers.set(
"cookie",
Array.from(map).map(([_, value]) => stringifyCookie(value)).join("; ")
);
return result;
} | Delete the cookies matching the passed name or names in the request. | delete | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
clear() {
this.delete(Array.from(this._parsed.keys()));
return this;
} | Delete all the cookies in the cookies in the request. | clear | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
toString() {
return [...this._parsed.values()].map((v) => `${v.name}=${encodeURIComponent(v.value)}`).join("; ");
} | Format the cookies in the request as a string for logging | toString | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
get(...args) {
const key = typeof args[0] === "string" ? args[0] : args[0].name;
return this._parsed.get(key);
} | {@link https://wicg.github.io/cookie-store/#CookieStore-get CookieStore#get} without the Promise. | get | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
getAll(...args) {
var _a;
const all = Array.from(this._parsed.values());
if (!args.length) {
return all;
}
const key = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name;
return all.filter((c) => c.name === key);
} | {@link https://wicg.github.io/cookie-store/#CookieStore-getAll CookieStore#getAll} without the Promise. | getAll | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
set(...args) {
const [name, value, cookie] = args.length === 1 ? [args[0].name, args[0].value, args[0]] : args;
const map = this._parsed;
map.set(name, normalizeCookie({ name, value, ...cookie }));
replace(map, this._headers);
return this;
} | {@link https://wicg.github.io/cookie-store/#CookieStore-set CookieStore#set} without the Promise. | set | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
delete(...args) {
const [name, options] = typeof args[0] === "string" ? [args[0]] : [args[0].name, args[0]];
return this.set({ ...options, name, value: "", expires: /* @__PURE__ */ new Date(0) });
} | {@link https://wicg.github.io/cookie-store/#CookieStore-delete CookieStore#delete} without the Promise. | delete | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/cookies/index.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/cookies/index.js | MIT |
add(key, value) {
const length = key.length;
if (length === 0) {
throw new TypeError("Unreachable");
}
let index = 0;
let node = this;
while (true) {
const code = key.charCodeAt(index);
if (code > 127) {
throw new TypeError("key m... | @param {string} key
@param {any} value | add | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
constructor(maxCachedSessions) {
this._maxCachedSessions = maxCachedSessions;
this._sessionCache = /* @__PURE__ */ new Map();
this._sessionRegistry = new global.FinalizationRegistry((key) => {
if (this._sessionCache.size < this._maxCachedSessions) {
return;
... | Exporting for testing purposes only.
Marking as deprecated to discourage any use outside of testing.
@deprecated | constructor | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
dispatch(opts, handler) {
const headers = buildHeaders(opts.headers);
throwIfProxyAuthIsSent(headers);
if (headers && !("host" in headers) && !("Host" in headers)) {
const { host } = new URL2(opts.origin);
headers.host = host;
}
return this[kAgent].dispatch(
... | @param {import('../types/proxy-agent').ProxyAgent.Options | string | URL} opts
@returns {URL} | dispatch | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
append(name, value, isLowerCase) {
this[kHeadersSortedMap] = null;
const lowercaseName = isLowerCase ? name : name.toLowerCase();
const exists = this[kHeadersMap].get(lowercaseName);
if (exists) {
const delimiter = lowercaseName === "cookie" ? "; " : ", ";
this[kHeade... | @see https://fetch.spec.whatwg.org/#concept-header-list-append
@param {string} name
@param {string} value
@param {boolean} isLowerCase | append | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
readAsArrayBuffer(blob) {
webidl.brandCheck(this, _FileReader);
webidl.argumentLengthCheck(arguments, 1, "FileReader.readAsArrayBuffer");
blob = webidl.converters.Blob(blob, { strict: false });
readOperation(this, blob, "ArrayBuffer");
} | @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
@param {import('buffer').Blob} blob | readAsArrayBuffer | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
get result() {
webidl.brandCheck(this, _FileReader);
return this[kResult];
} | @see https://w3c.github.io/FileAPI/#dom-filereader-result | result | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
constructor(options = {}) {
options.readableObjectMode = true;
super(options);
this.state = options.eventSourceSettings || {};
if (options.push) {
this.push = options.push;
}
} | @param {object} options
@param {eventSourceSettings} options.eventSourceSettings
@param {Function} [options.push] | constructor | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
parseLine(line, event) {
if (line.length === 0) {
return;
}
const colonPosition = line.indexOf(COLON);
if (colonPosition === 0) {
return;
}
let field = "";
let value = "";
if (colonPosition !== -1) {
field = line.subarray(0, c... | @param {Buffer} line
@param {EventStreamEvent} event | parseLine | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
constructor(url, eventSourceInitDict = {}) {
super();
__privateAdd(this, _connect);
/**
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model
* @returns {Promise<void>}
*/
__privateAdd(this, _reconnect);
__privateAdd... | Creates a new EventSource object.
@param {string} url
@param {EventSourceInit} [eventSourceInitDict]
@see https://html.spec.whatwg.org/multipage/server-sent-events.html#the-eventsource-interface | constructor | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
get readyState() {
return __privateGet(this, _readyState);
} | Returns the state of this EventSource object's connection. It can have the
values described below.
@returns {0|1|2}
@readonly | readyState | javascript | vercel/next.js | packages/next/src/compiled/@edge-runtime/primitives/fetch.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/@edge-runtime/primitives/fetch.js | MIT |
function createSafeHandler(cb) {
return input => {
const type = getURLType(input);
const base = buildSafeBase(input);
const url = new URL(input, base);
cb(url);
const result = url.toString();
if (type === "absolute") {
return result;
} else if (type === "scheme-relative") {
... | Make it easy to create small utilities that tweak a URL's path. | createSafeHandler | javascript | vercel/next.js | packages/next/src/compiled/source-map08/source-map.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/source-map08/source-map.js | MIT |
function computeRelativeURL(rootURL, targetURL) {
if (typeof rootURL === "string") rootURL = new URL(rootURL);
if (typeof targetURL === "string") targetURL = new URL(targetURL);
const targetParts = targetURL.pathname.split("/");
const rootParts = rootURL.pathname.split("/");
// If we've got a URL path endin... | Given two URLs that are assumed to be on the same
protocol/host/user/password build a relative URL from the
path, params, and hash values.
@param rootURL The root URL that the target will be relative to.
@param targetURL The target that the relative URL points to.
@return A rootURL-relative, normalized URL value. | computeRelativeURL | javascript | vercel/next.js | packages/next/src/compiled/source-map08/source-map.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/source-map08/source-map.js | MIT |
function join(aRoot, aPath) {
const pathType = getURLType(aPath);
const rootType = getURLType(aRoot);
aRoot = ensureDirectory(aRoot);
if (pathType === "absolute") {
return withBase(aPath, undefined);
}
if (rootType === "absolute") {
return withBase(aPath, aRoot);
}
if (pathType === "scheme-re... | Joins two paths/URLs.
All returned URLs will be normalized.
@param aRoot The root path or URL. Assumed to reference a directory.
@param aPath The path or URL to be joined with the root.
@return A joined and normalized URL value. | join | javascript | vercel/next.js | packages/next/src/compiled/source-map08/source-map.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/source-map08/source-map.js | MIT |
function relative(rootURL, targetURL) {
const result = relativeIfPossible(rootURL, targetURL);
return typeof result === "string" ? result : normalize(targetURL);
} | Make a path relative to a URL or another path. If returning a
relative URL is not possible, the original target will be returned.
All returned URLs will be normalized.
@param aRoot The root path or URL.
@param aPath The path or URL to be made relative to aRoot.
@return A rootURL-relative (if possible), normalized URL ... | relative | javascript | vercel/next.js | packages/next/src/compiled/source-map08/source-map.js | https://github.com/vercel/next.js/blob/master/packages/next/src/compiled/source-map08/source-map.js | MIT |
constructor(options = {}) {
this.options = {
shouldIgnorePath: options.shouldIgnorePath ?? defaultShouldIgnorePath,
isSourceMapAsset: options.isSourceMapAsset ?? defaultIsSourceMapAsset,
}
} | This plugin adds a field to source maps that identifies which sources are
vendored or runtime-injected (aka third-party) sources. These are consumed by
Chrome DevTools to automatically ignore-list sources. | constructor | javascript | vercel/next.js | packages/next/webpack-plugins/devtools-ignore-list-plugin.js | https://github.com/vercel/next.js/blob/master/packages/next/webpack-plugins/devtools-ignore-list-plugin.js | MIT |
function loader(value, bindings, callback) {
const defaults = this.sourceMap ? { SourceMapGenerator } : {}
const options = this.getOptions()
const config = { ...defaults, ...options }
const hash = getOptionsHash(options)
const compiler = this._compiler || marker
let map = cache.get(compiler)
if (!map) {... | A webpack loader for mdx-rs. This is largely based on existing @mdx-js/loader,
replaces internal compilation logic to use mdx-rs instead. | loader | javascript | vercel/next.js | packages/next-mdx/mdx-rs-loader.js | https://github.com/vercel/next.js/blob/master/packages/next-mdx/mdx-rs-loader.js | MIT |
async function getSchedulerVersion(reactVersion) {
const url = `https://registry.npmjs.org/react-dom/${reactVersion}`
const response = await fetch(url, {
headers: {
Accept: 'application/json',
},
})
if (!response.ok) {
throw new Error(
`${url}: ${response.status} ${response.statusText}\n... | Set to `null` to automatically sync the React version of Pages Router with App Router React version.
Set to a specific version to override the Pages Router React version e.g. `^19.0.0`.
"Active" just refers to our current development practice. While we do support
React 18 in pages router, we don't focus our developmen... | getSchedulerVersion | javascript | vercel/next.js | scripts/sync-react.js | https://github.com/vercel/next.js/blob/master/scripts/sync-react.js | MIT |
formatUnion = (values) =>
values.map((value) => `"${value}"`).join('|') | This is an autogenerated file by scripts/update-google-fonts.js | formatUnion | javascript | vercel/next.js | scripts/update-google-fonts.js | https://github.com/vercel/next.js/blob/master/scripts/update-google-fonts.js | MIT |
function exec(title, file, args) {
logCommand(title, `${file} ${args.join(' ')}`)
return execa(file, args, {
stderr: 'inherit',
})
} | @param title {string}
@param file {string}
@param args {readonly string[]}
@returns {execa.ExecaChildProcess} | exec | javascript | vercel/next.js | test/update-bundler-manifest.js | https://github.com/vercel/next.js/blob/master/test/update-bundler-manifest.js | MIT |
function logCommand(title, command) {
let message = `\n${bold().underline(title)}\n`
if (command) {
message += `> ${bold(command)}\n`
}
console.log(message)
} | @param {string} title
@param {string} [command] | logCommand | javascript | vercel/next.js | test/update-bundler-manifest.js | https://github.com/vercel/next.js/blob/master/test/update-bundler-manifest.js | MIT |
function accountForOverhead(megaBytes) {
// We are sending {megaBytes} - 5% to account for encoding overhead
return Math.floor(1024 * 1024 * megaBytes * 0.95)
} | This function accounts for the overhead of encoding the data to be sent
over the network via a multipart request.
@param {number} megaBytes
@returns {number} | accountForOverhead | javascript | vercel/next.js | test/e2e/app-dir/actions/account-for-overhead.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/actions/account-for-overhead.js | MIT |
async function middleware(request) {
if (request.nextUrl.pathname === '/searchparams-normalization-bug') {
const headers = new Headers(request.headers)
headers.set('test', request.nextUrl.searchParams.get('val') || '')
const response = NextResponse.next({
request: {
headers,
},
})
... | @param {import('next/server').NextRequest} request
@returns {Promise<NextResponse | undefined>} | middleware | javascript | vercel/next.js | test/e2e/app-dir/app/middleware.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/app/middleware.js | MIT |
async function middleware(request) {
const headersFromRequest = new Headers(request.headers)
// It should be able to import and use `headers` inside middleware
const headersFromNext = await nextHeaders()
headersFromRequest.set('x-from-middleware', 'hello-from-middleware')
// make sure headers() from `next/he... | @param {import('next/server').NextRequest} request | middleware | javascript | vercel/next.js | test/e2e/app-dir/app-middleware/middleware.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/app-middleware/middleware.js | MIT |
function middleware(request) {
if (
request.nextUrl.pathname ===
'/hooks/use-selected-layout-segment/rewritten-middleware'
) {
return NextResponse.rewrite(
new URL(
'/hooks/use-selected-layout-segment/first/slug3/second/catch/all',
request.url
)
)
}
} | @param {import('next/server').NextRequest} request
@returns {NextResponse | undefined} | middleware | javascript | vercel/next.js | test/e2e/app-dir/hooks/middleware.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/hooks/middleware.js | MIT |
get() {
return {
waitUntil(/** @type {Promise<any>} */ promise) {
cliLog('waitUntil from "@next/request-context" was called')
promise.catch((err) => {
console.error(err)
})
},
}
} | @type {import('next/dist/server/after/builtin-request-context').BuiltinRequestContext} | get | javascript | vercel/next.js | test/e2e/app-dir/next-after-app/utils/provided-request-context.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/next-after-app/utils/provided-request-context.js | MIT |
async get(cacheKey, softTags) {
console.log('ModernCustomCacheHandler::get', cacheKey, softTags)
return defaultCacheHandler.get(cacheKey, softTags)
} | @type {import('next/dist/server/lib/cache-handlers/types').CacheHandlerV2} | get | javascript | vercel/next.js | test/e2e/app-dir/use-cache-custom-handler/handler.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/use-cache-custom-handler/handler.js | MIT |
async get(cacheKey, softTags) {
console.log(
'LegacyCustomCacheHandler::get',
cacheKey,
JSON.stringify(softTags)
)
return defaultCacheHandler.get(cacheKey, softTags)
} | @type {import('next/dist/server/lib/cache-handlers/types').CacheHandler} | get | javascript | vercel/next.js | test/e2e/app-dir/use-cache-custom-handler/legacy-handler.js | https://github.com/vercel/next.js/blob/master/test/e2e/app-dir/use-cache-custom-handler/legacy-handler.js | MIT |
init() {
context.middleware.write(`
import { NextResponse } from 'next/server'
import { hasDynamic } from 'lib'
// populated with tests
export default async function () {
await hasDynamic()
return NextResponse.next()
}
export c... | '
}
`)
await waitFor(500)
})
it('warns in dev for allowed code', async () => {
context.app = await launchApp(context.appDir, context.appPort, appOption)
const res = await fetchViaHTTP(context.appPort, middlewareUrl)
await waitFor(500)
expect(res.status).toBe(200)
... | init | javascript | vercel/next.js | test/integration/edge-runtime-configurable-guards/test/index.test.js | https://github.com/vercel/next.js/blob/master/test/integration/edge-runtime-configurable-guards/test/index.test.js | MIT |
init() {
context.api.write(`
export default async function handler(request) {
if ((() => false)()) {
eval('100')
}
return Response.json({ result: true })
}
export const config = {
runtime: 'edge',
unstable_al... | '
}
`)
context.lib.write(`
export async function hasDynamic() {
eval('100')
}
`)
},
},
{
title: 'Middleware using lib',
url: middlewareUrl,
init() {
context.middleware.write(`
import { NextResponse } from... | init | javascript | vercel/next.js | test/integration/edge-runtime-configurable-guards/test/index.test.js | https://github.com/vercel/next.js/blob/master/test/integration/edge-runtime-configurable-guards/test/index.test.js | MIT |
init() {
context.middleware.write(`
import { NextResponse } from 'next/server'
import { hasUnusedDynamic } from 'lib'
// populated with tests
export default async function () {
await hasUnusedDynamic()
return NextResponse.next()
}
... | '
}
`)
context.lib.write(`
export async function hasDynamic() {
eval('100')
}
`)
},
// TODO: Re-enable when Turbopack applies the middleware dynamic code
// evaluation transforms also to code in node_modules.
skip: Boolean(process... | init | javascript | vercel/next.js | test/integration/edge-runtime-configurable-guards/test/index.test.js | https://github.com/vercel/next.js/blob/master/test/integration/edge-runtime-configurable-guards/test/index.test.js | MIT |
init() {
context.api.write(`
import { hasDynamic } from 'lib'
export default async function handler(request) {
await hasDynamic()
return Response.json({ result: true })
}
export const config = {
runtime: 'edge',
unstable_all... | '
}
`)
context.lib.write(`
export async function hasUnusedDynamic() {
if ((() => false)()) {
eval('100')
}
}
`)
},
},
{
title: 'Middleware using lib',
url: middlewareUrl,
init() {
context.... | init | javascript | vercel/next.js | test/integration/edge-runtime-configurable-guards/test/index.test.js | https://github.com/vercel/next.js/blob/master/test/integration/edge-runtime-configurable-guards/test/index.test.js | MIT |
function getAmpValidatorInstance(
/** @type {string | undefined} */ validatorPath
) {
let promise = instancePromises.get(validatorPath)
if (!promise) {
// NOTE: if `validatorPath` is undefined, `AmpHtmlValidator` will load the code from its default URL
promise = AmpHtmlValidator.getInstance(validatorPath)... | This is a workaround for issues with concurrent `AmpHtmlValidator.getInstance()` calls,
duplicated from 'packages/next/src/export/helpers/get-amp-html-validator.ts'.
see original code for explanation.
@returns {Promise<Validator>} | getAmpValidatorInstance | javascript | vercel/next.js | test/lib/amp-test-utils.js | https://github.com/vercel/next.js/blob/master/test/lib/amp-test-utils.js | MIT |
function getBundledAmpValidatorFilepath() {
return require.resolve(
'next/dist/compiled/amphtml-validator/validator_wasm.js'
)
} | Use the same validator that we use for builds.
This avoids trying to load one from the network, which can cause random test flakiness.
(duplicated from 'packages/next/src/export/helpers/get-amp-html-validator.ts') | getBundledAmpValidatorFilepath | javascript | vercel/next.js | test/lib/amp-test-utils.js | https://github.com/vercel/next.js/blob/master/test/lib/amp-test-utils.js | MIT |
async function createNextInstall({
parentSpan,
dependencies = {},
resolutions = null,
installCommand = null,
packageJson = {},
dirSuffix = '',
keepRepoDir = false,
beforeInstall,
}) {
const tmpDir = await fs.realpath(process.env.NEXT_TEST_DIR || os.tmpdir())
return await parentSpan
.traceChild(... | @param {object} param0
@param {import('@next/telemetry').Span} param0.parentSpan
@param {object} [param0.dependencies]
@param {object | null} [param0.resolutions]
@param { ((ctx: { dependencies: { [key: string]: string } }) => string) | string | null} [param0.installCommand]
@param {object} [param0.packageJson]
@param ... | createNextInstall | javascript | vercel/next.js | test/lib/create-next-install.js | https://github.com/vercel/next.js/blob/master/test/lib/create-next-install.js | MIT |
function Home() {
const helloWorld = useMemo(()=>new HelloWorld(), []);
return /*#__PURE__*/ _jsx("button", {
onClick: ()=>helloWorld.hi(),
children: "Click me"
});
} | Add your relevant code here for the issue to reproduce | Home | javascript | vercel/next.js | turbopack/crates/turbopack-ecmascript/tests/analyzer/graph/issue-75938/input.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-ecmascript/tests/analyzer/graph/issue-75938/input.js | MIT |
set (carrier, key, value) {
carrier.push({
key,
value
});
} | we use this map to propagate attributes from nested spans to the top span | set | javascript | vercel/next.js | turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/input.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/input.js | MIT |
getTracerInstance() {
return trace.getTracer('next.js', '0.0.1');
} | Returns an instance to the trace with configured name.
Since wrap / trace can be defined in any place prior to actual trace subscriber initialization,
This should be lazily evaluated. | getTracerInstance | javascript | vercel/next.js | turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/input.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/input.js | MIT |
function defineProp(obj, name, options) {
if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options);
} | This file contains runtime types and functions that are shared between all
TurboPack ECMAScript runtimes.
It will be prepended to the runtime code of each runtime. | defineProp | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function esm(exports, getters) {
defineProp(exports, '__esModule', {
value: true
});
if (toStringTag) defineProp(exports, toStringTag, {
value: 'Module'
});
for(const key in getters){
const item = getters[key];
if (Array.isArray(item)) {
defineProp(exports... | Adds the getters to the exports object. | esm | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function esmExport(module, exports, getters) {
module.namespaceObject = module.exports;
esm(exports, getters);
} | Makes the module an ESM with exports | esmExport | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function dynamicExport(module, exports, object) {
ensureDynamicExports(module, exports);
if (typeof object === 'object' && object !== null) {
module[REEXPORTED_OBJECTS].push(object);
}
} | Dynamically exports properties from an object | dynamicExport | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function interopEsm(raw, ns, allowExportDefault) {
const getters = Object.create(null);
for(let current = raw; (typeof current === 'object' || typeof current === 'function') && !LEAF_PROTOTYPES.includes(current); current = getProto(current)){
for (const key of Object.getOwnPropertyNames(current)){
... | @param raw
@param ns
@param allowExportDefault
* `false`: will have the raw module as default export
* `true`: will have the default property as default export | interopEsm | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function moduleContext(map) {
function moduleContext(id) {
if (hasOwnProperty.call(map, id)) {
return map[id].module();
}
const e = new Error(`Cannot find module '${id}'`);
e.code = 'MODULE_NOT_FOUND';
throw e;
}
moduleContext.keys = ()=>{
return O... | `require.context` and require/import expression runtime. | moduleContext | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function getChunkPath(chunkData) {
return typeof chunkData === 'string' ? chunkData : chunkData.path;
} | Returns the path of a chunk defined by its data. | getChunkPath | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
relativeURL = function relativeURL(inputUrl) {
const realUrl = new URL(inputUrl, 'x:/');
const values = {};
for(const key in realUrl)values[key] = realUrl[key];
values.href = inputUrl;
values.pathname = inputUrl.replace(/[?#].*/, '');
values.origin = values.protocol = '';
values.toString = v... | A pseudo "fake" URL object to resolve to its relative path.
When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this
runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid
hydration mismatch.
This is base... | relativeURL | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function invariant(never, computeMessage) {
throw new Error(`Invariant: ${computeMessage(never)}`);
} | Utility function to ensure all variants of an enum are handled. | invariant | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function requireStub(_moduleId) {
throw new Error('dynamic usage of require is not supported');
} | A stub function to make `require` available but non-functional in ESM. | requireStub | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function resolveAbsolutePath(modulePath) {
if (modulePath) {
return path.join(ABSOLUTE_ROOT, modulePath);
}
return ABSOLUTE_ROOT;
} | Returns an absolute path to the given module path.
Module path should be relative, either path to a file or a directory.
This fn allows to calculate an absolute path for some global static values, such as
`__dirname` or `import.meta.url` that Turbopack will not embeds in compile time.
See ImportMetaBinding::code_gener... | resolveAbsolutePath | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function stringifySourceInfo(source) {
switch(source.type){
case 0:
return `runtime for chunk ${source.chunkPath}`;
case 1:
return `parent module ${source.parentId}`;
default:
invariant(source, (source)=>`Unknown source type: ${source?.type}`);
}
} | The module was instantiated because a parent module imported it. | stringifySourceInfo | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function createResolvePathFromModule(resolver) {
return function resolvePathFromModule(moduleId) {
const exported = resolver(moduleId);
const exportedPath = exported?.default ?? exported;
if (typeof exportedPath !== 'string') {
return exported;
}
const strippedAss... | Returns an absolute path to the given module's id. | createResolvePathFromModule | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function getOrInstantiateModuleFromParent(id, sourceModule) {
const module1 = moduleCache[id];
if (module1) {
return module1;
}
return instantiateModule(id, {
type: 1,
parentId: sourceModule.id
});
} | Retrieves a module from the cache, or instantiate it if it is not cached. | getOrInstantiateModuleFromParent | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function getOrInstantiateRuntimeModule(moduleId, chunkPath) {
const module1 = moduleCache[moduleId];
if (module1) {
if (module1.error) {
throw module1.error;
}
return module1;
}
return instantiateRuntimeModule(moduleId, chunkPath);
} | Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached. | getOrInstantiateRuntimeModule | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
function isJs(chunkUrlOrPath) {
return regexJsUrl.test(chunkUrlOrPath);
} | Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment. | isJs | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js | MIT |
async function loadChunk(source, chunkData) {
if (typeof chunkData === 'string') {
return loadChunkPath(source, chunkData);
}
const includedList = chunkData.included || [];
const modulesPromises = includedList.map((included)=>{
if (moduleFactories[included]) return true;
return a... | Map from a chunk path to the chunk lists it belongs to. | loadChunk | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function createResolvePathFromModule(resolver) {
return function resolvePathFromModule(moduleId) {
const exported = resolver(moduleId);
return exported?.default ?? exported;
};
} | Returns an absolute url to an asset. | createResolvePathFromModule | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function resolveAbsolutePath(modulePath) {
return `/ROOT/${modulePath ?? ''}`;
} | no-op for browser
@param modulePath | resolveAbsolutePath | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function getWorkerBlobURL(chunks) {
// It is important to reverse the array so when bootstrapping we can infer what chunk is being
// evaluated by poping urls off of this array. See `getPathFromScript`
let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};
self.TURBOPACK_NEXT... | Returns a blob URL for the worker.
@param chunks list of chunks to load | getWorkerBlobURL | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function getFirstModuleChunk(moduleId) {
const moduleChunkPaths = moduleChunksMap.get(moduleId);
if (moduleChunkPaths == null) {
return null;
}
return moduleChunkPaths.values().next().value;
} | Returns the first chunk that included a module.
This is used by the Node.js backend, hence why it's marked as unused in this
file. | getFirstModuleChunk | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function getChunkRelativeUrl(chunkPath) {
return `${CHUNK_BASE_PATH}${chunkPath.split('/').map((p)=>encodeURIComponent(p)).join('/')}${CHUNK_SUFFIX_PATH}`;
} | Returns the URL relative to the origin where a chunk can be fetched from. | getChunkRelativeUrl | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function registerChunk([chunkScript, chunkModules, runtimeParams]) {
const chunkPath = getPathFromScript(chunkScript);
for (const [moduleId, moduleFactory] of Object.entries(chunkModules)){
if (!moduleFactories[moduleId]) {
moduleFactories[moduleId] = moduleFactory;
}
addModu... | Marks a chunk list as a runtime chunk list. There can be more than one
runtime chunk list. For instance, integration tests can have multiple chunk
groups loaded at runtime, each with its own chunk list. | registerChunk | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
function isCss(chunkUrl) {
return regexCssUrl.test(chunkUrl);
} | Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment. | isCss | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
constructor(message, dependencyChain){
super(message);
this.dependencyChain = dependencyChain;
} | This file contains runtime types and functions that are shared between all
Turbopack *development* ECMAScript runtimes.
It will be appended to the runtime code of each runtime right after the
shared runtime utils. | constructor | javascript | vercel/next.js | turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | https://github.com/vercel/next.js/blob/master/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.