code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function exportValue(module, value) {
module.exports = value;
} | Dynamically exports properties from an object | exportValue | 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 exportNamespace(module, namespace) {
module.exports = module.namespaceObject = namespace;
} | Dynamically exports properties from an object | exportNamespace | 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 createGetter(obj, key) {
return ()=>obj[key];
} | Dynamically exports properties from an object | createGetter | 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 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_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 createNS(raw) {
if (typeof raw === 'function') {
return function(...args) {
return raw.apply(this, args);
};
} else {
return Object.create(null);
}
} | @param raw
@param ns
@param allowExportDefault
* `false`: will have the raw module as default export
* `true`: will have the default property as default export | createNS | 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 esmImport(sourceModule, id) {
const module = getOrInstantiateModuleFromParent(id, sourceModule);
if (module.error) throw module.error;
// any ES module has to have `module.namespaceObject` defined.
if (module.namespaceObject) return module.namespaceObject;
// only ESM can be an async module... | @param raw
@param ns
@param allowExportDefault
* `false`: will have the raw module as default export
* `true`: will have the default property as default export | esmImport | 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 commonJsRequire(sourceModule, id) {
const module = getOrInstantiateModuleFromParent(id, sourceModule);
if (module.error) throw module.error;
return module.exports;
} | @param raw
@param ns
@param allowExportDefault
* `false`: will have the raw module as default export
* `true`: will have the default property as default export | commonJsRequire | 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 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_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 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;
} | `require.context` and require/import expression runtime. | moduleContext | 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 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_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 isPromise(maybePromise) {
return maybePromise != null && typeof maybePromise === 'object' && 'then' in maybePromise && typeof maybePromise.then === 'function';
} | Returns the path of a chunk defined by its data. | isPromise | 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 isAsyncModuleExt(obj) {
return turbopackQueues in obj;
} | Returns the path of a chunk defined by its data. | isAsyncModuleExt | 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 createPromise() {
let resolve;
let reject;
const promise = new Promise((res, rej)=>{
reject = rej;
resolve = res;
});
return {
promise,
resolve: resolve,
reject: reject
};
} | Returns the path of a chunk defined by its data. | createPromise | 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 resolveQueue(queue) {
if (queue && queue.status !== 1) {
queue.status = 1;
queue.forEach((fn)=>fn.queueCount--);
queue.forEach((fn)=>fn.queueCount-- ? fn.queueCount++ : fn());
}
} | Returns the path of a chunk defined by its data. | resolveQueue | 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 wrapDeps(deps) {
return deps.map((dep)=>{
if (dep !== null && typeof dep === 'object') {
if (isAsyncModuleExt(dep)) return dep;
if (isPromise(dep)) {
const queue = Object.assign([], {
status: 0
});
const obj... | Returns the path of a chunk defined by its data. | wrapDeps | 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 asyncModule(module, body, hasAwait) {
const queue = hasAwait ? Object.assign([], {
status: -1
}) : undefined;
const depQueues = new Set();
const { resolve, reject, promise: rawPromise } = createPromise();
const promise = Object.assign(rawPromise, {
[turbopackExports]: module... | Returns the path of a chunk defined by its data. | asyncModule | 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 |
get () {
return promise;
} | Returns the path of a chunk defined by its data. | get | 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 |
set (v) {
// Calling `esmExport` leads to this.
if (v !== promise) {
promise[turbopackExports] = v;
}
} | Returns the path of a chunk defined by its data. | set | 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 handleAsyncDependencies(deps) {
const currentDeps = wrapDeps(deps);
const getResult = ()=>currentDeps.map((d)=>{
if (d[turbopackError]) throw d[turbopackError];
return d[turbopackExports];
});
const { promise, resolve } = createPromise();
... | Returns the path of a chunk defined by its data. | handleAsyncDependencies | 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 |
getResult = ()=>currentDeps.map((d)=>{
if (d[turbopackError]) throw d[turbopackError];
return d[turbopackExports];
}) | Returns the path of a chunk defined by its data. | getResult | 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 |
getResult = ()=>currentDeps.map((d)=>{
if (d[turbopackError]) throw d[turbopackError];
return d[turbopackExports];
}) | Returns the path of a chunk defined by its data. | getResult | 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 fnQueue(q) {
if (q !== queue && !depQueues.has(q)) {
depQueues.add(q);
if (q && q.status === 0) {
fn.queueCount++;
q.push(fn);
}
}
} | Returns the path of a chunk defined by its data. | fnQueue | 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 asyncResult(err) {
if (err) {
reject(promise[turbopackError] = err);
} else {
resolve(promise[turbopackExports]);
}
resolveQueue(queue);
} | Returns the path of a chunk defined by its data. | asyncResult | 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 |
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_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 |
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_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 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_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 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_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 |
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 |
async function loadChunkByUrl(source, chunkUrl) {
try {
await BACKEND.loadChunk(chunkUrl, source);
} catch (error) {
let loadReason;
switch(source.type){
case 0:
loadReason = `as a runtime dependency of chunk ${source.chunkPath}`;
break;
... | Map from a chunk path to the chunk lists it belongs to. | loadChunkByUrl | 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 |
async function loadChunkPath(source, chunkPath) {
const url = getChunkRelativeUrl(chunkPath);
return loadChunkByUrl(source, url);
} | Map from a chunk path to the chunk lists it belongs to. | loadChunkPath | 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 getPathFromScript(chunkScript) {
if (typeof chunkScript === 'string') {
return chunkScript;
}
const chunkUrl = typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined' ? TURBOPACK_NEXT_CHUNK_URLS.pop() : chunkScript.getAttribute('src');
const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/,... | Returns the URL relative to the origin where a chunk can be fetched from. | getPathFromScript | 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 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_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 |
getOrInstantiateModuleFromParent = (id, sourceModule)=>{
if (!sourceModule.hot.active) {
console.warn(`Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`);
}
const module = devModuleCache[id];
if (sourceModule.children.indexOf(id) === -1) {
... | 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_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 |
getOrInstantiateModuleFromParent = (id, sourceModule)=>{
if (!sourceModule.hot.active) {
console.warn(`Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`);
}
const module = devModuleCache[id];
if (sourceModule.children.indexOf(id) === -1) {
... | 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_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 instantiateModule(id, source) {
const moduleFactory = moduleFactories[id];
if (typeof moduleFactory !== 'function') {
// This can happen if modules incorrectly handle HMR disposes/updates,
// e.g. when they keep a `setTimeout` around which still executes old code
// and contains... | Retrieves a module from the cache, or instantiate it if it is not cached. | instantiateModule | 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 runModuleExecutionHooks(module, executeModule) {
if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {
const cleanupReactRefreshIntercept = globalThis.$RefreshInterceptModuleExecution$(module.id);
try {
executeModule({
register: globalThis.$Re... | NOTE(alexkirsz) Webpack has a "module execution" interception hook that
Next.js' React Refresh runtime hooks into to add module context to the
refresh registry. | runModuleExecutionHooks | 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 registerExportsAndSetupBoundaryForReactRefresh(module, helpers) {
const currentExports = module.exports;
const prevExports = module.hot.data.prevExports ?? null;
helpers.registerExportsForReactRefresh(currentExports, module.id);
// A module can be accepted automatically based on its exports, e.... | This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | registerExportsAndSetupBoundaryForReactRefresh | 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 formatDependencyChain(dependencyChain) {
return `Dependency chain: ${dependencyChain.join(' -> ')}`;
} | This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | formatDependencyChain | 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 computeOutdatedModules(added, modified) {
const newModuleFactories = new Map();
for (const [moduleId, entry] of added){
if (entry != null) {
newModuleFactories.set(moduleId, _eval(entry));
}
}
const outdatedModules = computedInvalidatedModules(modified.keys());
f... | This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | computeOutdatedModules | 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 computedInvalidatedModules(invalidated) {
const outdatedModules = new Set();
for (const moduleId of invalidated){
const effect = getAffectedModuleEffects(moduleId);
switch(effect.type){
case 'unaccepted':
throw new UpdateApplyError(`cannot apply update: unacc... | This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | computedInvalidatedModules | 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 computeOutdatedSelfAcceptedModules(outdatedModules) {
const outdatedSelfAcceptedModules = [];
for (const moduleId of outdatedModules){
const module = devModuleCache[moduleId];
const hotState = moduleHotState.get(module);
if (module && hotState.selfAccepted && !hotState.selfInval... | This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | computeOutdatedSelfAcceptedModules | 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 updateChunksPhase(chunksAddedModules, chunksDeletedModules) {
for (const [chunkPath, addedModuleIds] of chunksAddedModules){
for (const moduleId of addedModuleIds){
addModuleToChunk(moduleId, chunkPath);
}
}
const disposedModules = new Set();
for (const [chunkPath, a... | Adds, deletes, and moves modules between chunks. This must happen before the
dispose phase as it needs to know which modules were removed from all chunks,
which we can only compute *after* taking care of added and moved modules. | updateChunksPhase | 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 disposePhase(outdatedModules, disposedModules) {
for (const moduleId of outdatedModules){
disposeModule(moduleId, 'replace');
}
for (const moduleId of disposedModules){
disposeModule(moduleId, 'clear');
}
// Removing modules from the module cache is a separate step.
// W... | Adds, deletes, and moves modules between chunks. This must happen before the
dispose phase as it needs to know which modules were removed from all chunks,
which we can only compute *after* taking care of added and moved modules. | disposePhase | 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 disposeModule(moduleId, mode) {
const module = devModuleCache[moduleId];
if (!module) {
return;
}
const hotState = moduleHotState.get(module);
const data = {};
// Run the `hot.dispose` handler, if any, passing in the persistent
// `hot.data` object.
for (const disposeHan... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | disposeModule | 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 applyPhase(outdatedSelfAcceptedModules, newModuleFactories, outdatedModuleParents, reportError) {
// Update module factories.
for (const [moduleId, factory] of newModuleFactories.entries()){
moduleFactories[moduleId] = factory;
}
// TODO(alexkirsz) Run new runtime entries here.
// T... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyPhase | 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 applyUpdate(update) {
switch(update.type){
case 'ChunkListUpdate':
applyChunkListUpdate(update);
break;
default:
invariant(update, (update)=>`Unknown update type: ${update.type}`);
}
} | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyUpdate | 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 applyChunkListUpdate(update) {
if (update.merged != null) {
for (const merged of update.merged){
switch(merged.type){
case 'EcmascriptMergedUpdate':
applyEcmascriptMergedUpdate(merged);
break;
default:
... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyChunkListUpdate | 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 applyEcmascriptMergedUpdate(update) {
const { entries = {}, chunks = {} } = update;
const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(entries, chunks);
const { outdatedModules, newModuleFactories } = computeOutdatedModules(added, modified);
const { disposedModules } ... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyEcmascriptMergedUpdate | 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 applyInvalidatedModules(outdatedModules) {
if (queuedInvalidatedModules.size > 0) {
computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId)=>{
outdatedModules.add(moduleId);
});
queuedInvalidatedModules.clear();
}
return outdatedModules;
} | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyInvalidatedModules | 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 applyInternal(outdatedModules, disposedModules, newModuleFactories) {
outdatedModules = applyInvalidatedModules(outdatedModules);
const outdatedSelfAcceptedModules = computeOutdatedSelfAcceptedModules(outdatedModules);
const { outdatedModuleParents } = disposePhase(outdatedModules, disposedModules)... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | applyInternal | 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 reportError(err) {
if (!error) error = err;
} | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | reportError | 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 computeChangedModules(entries, updates) {
const chunksAdded = new Map();
const chunksDeleted = new Map();
const added = new Map();
const modified = new Map();
const deleted = new Set();
for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates)){
switch(mergedChunkUpda... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | computeChangedModules | 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 getAffectedModuleEffects(moduleId) {
const outdatedModules = new Set();
const queue = [
{
moduleId,
dependencyChain: []
}
];
let nextItem;
while(nextItem = queue.shift()){
const { moduleId, dependencyChain } = nextItem;
if (moduleId !=... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | getAffectedModuleEffects | 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 handleApply(chunkListPath, update) {
switch(update.type){
case 'partial':
{
// This indicates that the update is can be applied to the current state of the application.
applyUpdate(update.instruction);
break;
}
case 're... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | handleApply | 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 createModuleHot(moduleId, hotData) {
const hotState = {
selfAccepted: false,
selfDeclined: false,
selfInvalidated: false,
disposeHandlers: []
};
const hot = {
// TODO(alexkirsz) This is not defined in the HMR API. It was used to
// decide whether to w... | Disposes of an instance of a module.
Returns the persistent hot data that should be kept for the next module
instance.
NOTE: mode = "replace" will not remove modules from the devModuleCache
This must be done in a separate step afterwards.
This is important because all modules need to be disposed to update the
parent/... | createModuleHot | 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 removeModuleFromChunk(moduleId, chunkPath) {
const moduleChunks = moduleChunksMap.get(moduleId);
moduleChunks.delete(chunkPath);
const chunkModules = chunkModulesMap.get(chunkPath);
chunkModules.delete(moduleId);
const noRemainingModules = chunkModules.size === 0;
if (noRemainingModules... | Removes a module from a chunk.
Returns `true` if there are no remaining chunks including this module. | removeModuleFromChunk | 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 disposeChunkList(chunkListPath) {
const chunkPaths = chunkListChunksMap.get(chunkListPath);
if (chunkPaths == null) {
return false;
}
chunkListChunksMap.delete(chunkListPath);
for (const chunkPath of chunkPaths){
const chunkChunkLists = chunkChunkListsMap.get(chunkPath);
... | Disposes of a chunk list and its corresponding exclusive chunks. | disposeChunkList | 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 disposeChunk(chunkPath) {
const chunkUrl = getChunkRelativeUrl(chunkPath);
// This should happen whether the chunk has any modules in it or not.
// For instance, CSS chunks have no modules in them, but they still need to be unloaded.
DEV_BACKEND.unloadChunk?.(chunkUrl);
const chunkModules =... | Disposes of a chunk and its corresponding exclusive modules.
@returns Whether the chunk was disposed of. | disposeChunk | 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 registerChunkList(chunkList) {
const chunkListScript = chunkList.script;
const chunkListPath = getPathFromScript(chunkListScript);
// The "chunk" is also registered to finish the loading in the backend
BACKEND.registerChunk(chunkListPath);
globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([
... | Subscribes to chunk list updates from the update server and applies them. | registerChunkList | 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 augmentContext(context) {
return context;
} | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | augmentContext | 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 fetchWebAssembly(wasmChunkPath) {
return fetch(getChunkRelativeUrl(wasmChunkPath));
} | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | fetchWebAssembly | 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 |
async function loadWebAssembly(_source, wasmChunkPath, _edgeModule, importsObj) {
const req = fetchWebAssembly(wasmChunkPath);
const { instance } = await WebAssembly.instantiateStreaming(req, importsObj);
return instance.exports;
} | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | loadWebAssembly | 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 |
async function loadWebAssemblyModule(_source, wasmChunkPath, _edgeModule) {
const req = fetchWebAssembly(wasmChunkPath);
return await WebAssembly.compileStreaming(req);
} | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | loadWebAssemblyModule | 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 |
async registerChunk (chunkPath, params) {
const chunkUrl = getChunkRelativeUrl(chunkPath);
const resolver = getOrCreateResolver(chunkUrl);
resolver.resolve();
if (params == null) {
return;
}
for (const otherChunkData of params.other... | Maps chunk paths to the corresponding resolver. | 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 |
loadChunk (chunkUrl, source) {
return doLoadChunk(chunkUrl, source);
} | Loads the given chunk, and returns a promise that resolves once the chunk
has been loaded. | 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 getOrCreateResolver(chunkUrl) {
let resolver = chunkResolvers.get(chunkUrl);
if (!resolver) {
let resolve;
let reject;
const promise = new Promise((innerResolve, innerReject)=>{
resolve = innerResolve;
reject = innerReject;
... | Loads the given chunk, and returns a promise that resolves once the chunk
has been loaded. | getOrCreateResolver | 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 doLoadChunk(chunkUrl, source) {
const resolver = getOrCreateResolver(chunkUrl);
if (resolver.loadingStarted) {
return resolver.promise;
}
if (source.type === SourceType.Runtime) {
// We don't need to load chunks references from runtime code, as they're al... | Loads the given chunk, and returns a promise that resolves once the chunk
has been loaded. | doLoadChunk | 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 |
unloadChunk (chunkUrl) {
deleteResolver(chunkUrl);
// TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.
const decodedChunkUrl = decodeURI(chunkUrl);
if (isCss(chunkUrl)) {
const links = document.querySelectorAll(`link[href="${ch... | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | unloadChunk | 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 |
reloadChunk (chunkUrl) {
return new Promise((resolve, reject)=>{
if (!isCss(chunkUrl)) {
reject(new Error('The DOM backend can only reload CSS chunks'));
return;
}
const decodedChunkUrl = decodeURI(chunkUrl);
... | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | reloadChunk | 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 _eval({ code, url, map }) {
code += `\n\n//# sourceURL=${encodeURI(location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX_PATH)}`;
if (map) {
code += `\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(// btoa doesn't handle nonlatin characters, so escape them as \x sequen... | This file contains the runtime code specific to the Turbopack development
ECMAScript DOM runtime.
It will be appended to the base development runtime code. | _eval | 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 |
async function dbConnect() {
if (cached.conn) {
return cached.conn
}
if (!cached.promise) {
const opts = {
bufferCommands: false,
}
cached.promise = mongoose.connect(MONGODB_URI, opts).then((mongoose) => {
return mongoose
})
}
cached.conn = await cached.promise
return cache... | Global is used here to maintain a cached connection across hot reloads
in development. This prevents connections growing exponentially
during API Route usage. | dbConnect | javascript | vercel/next.js | turbopack/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/lib/dbConnect.js | https://github.com/vercel/next.js/blob/master/turbopack/packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose/lib/dbConnect.js | MIT |
function done(err) {
if (!cbCalled) {
cb(err);
cbCalled = true;
}
} | This is the exposed module.
This method facilitates copying a file.
@param {String} fileSrc
@param {String} fileDest
@param {Function} cb
@access public | done | javascript | aws/aws-iot-device-sdk-js | examples/lib/copy-file.js | https://github.com/aws/aws-iot-device-sdk-js/blob/master/examples/lib/copy-file.js | Apache-2.0 |
Unirest = function (method, uri, headers, body, callback) {
var unirest = function (uri, headers, body, callback) {
var $this = {
/**
* Stream Multipart form-data request
*
* @type {Boolean}
*/
_stream: false,
/**
* Container to hold multipart form data for pr... | Initialize our Rest Container
@type {Object} | Unirest | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
unirest = function (uri, headers, body, callback) {
var $this = {
/**
* Stream Multipart form-data request
*
* @type {Boolean}
*/
_stream: false,
/**
* Container to hold multipart form data for processing upon request.
*
* @type {Array}
* @p... | Initialize our Rest Container
@type {Object} | unirest | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleRetriableRequestResponse (result) {
// If retries is not defined or all attempts tried, return true to invoke end's callback.
if ($this.options.retry === undefined || $this.options.retry.attempts === 0) {
return true
}
// If status code is not listed,... | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | handleRetriableRequestResponse | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleRequestResponse (error, response, body) {
var result = {}
var status
var data
var type
// Handle pure error
if (error && !response) {
result.error = error
if (handleRetriableRequestResponse(result) && callback) {
... | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | handleRequestResponse | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function setCookie (cookie) {
var crumbs = Unirest.trim(cookie).split('=')
var key = Unirest.trim(crumbs[0])
var value = Unirest.trim(crumbs.slice(1).join('='))
if (crumbs[0] && crumbs[0] !== '') {
result.cookies[key] = value === '' ? true : value
... | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | setCookie | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleGZIPResponse (response) {
if (/^(deflate|gzip)$/.test(response.headers['content-encoding'])) {
var unzip = zlib.createUnzip()
var stream = new Stream()
var _on = response.on
var decoder
// Keeping node happy
stream.req = r... | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | handleGZIPResponse | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleFormData (form) {
for (var i = 0; i < $this._multipart.length; i++) {
var item = $this._multipart[i]
if (item.attachment && is(item.value).a(String)) {
if (does(item.value).contain('http://') || does(item.value).contain('https://')) {
item.... | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | handleFormData | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function authn(auth) {
if (!auth) return null;
if (typeof auth === 'string') return auth;
if (auth.user && auth.pass) return auth.user + ':' + auth.pass;
return auth;
} | Sends HTTP Request and awaits Response finalization. Request compression and Response decompression occurs here.
Upon HTTP Response post-processing occurs and invokes `callback` with a single argument, the `[Response](#response)` object.
@param {Function} callback
@return {Object} | authn | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleField (name, value, options) {
var serialized
var length
var key
var i
options = options || { attachment: false }
if (is(name).a(Object)) {
for (key in name) {
if (Object.prototype.hasOwnProperty.call(name, key)) {
handleField(key, name[... | Handles Multipart Field Processing
@param {String} name
@param {Mixed} value
@param {Object} options | handleField | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function handleFieldValue (value) {
if (!(value instanceof Buffer || typeof value === 'string')) {
if (is(value).a(Object)) {
if (value instanceof fs.FileReadStream) {
return value
} else {
return Unirest.serializers.json(value)
}
} else {
... | Handles Multipart Value Processing
@param {Mixed} value | handleFieldValue | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function setupOption (name, ref) {
$this[name] = function (arg) {
$this.options[ref || name] = arg
return $this
}
} | Handles Multipart Value Processing
@param {Mixed} value | setupOption | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function setupMethod (method) {
Unirest[method] = Unirest(method)
} | Generate sugar for request library.
This allows us to mock super-agent chaining style while using request library under the hood. | setupMethod | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function is (value) {
return {
a: function (check) {
if (check.prototype) check = check.prototype.constructor.name
var type = Object.prototype.toString.call(value).slice(8, -1).toLowerCase()
return value != null && type === check.toLowerCase()
}
}
} | Simple Utility Methods for checking information about a value.
@param {Mixed} value Could be anything.
@return {Object} | is | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function does (value) {
var arrayIndexOf = (Array.indexOf ? function (arr, obj, from) {
return arr.indexOf(obj, from)
} : function (arr, obj, from) {
var l = arr.length
var i = from ? parseInt((1 * from) + (from < 0 ? l : 0), 10) : 0
i = i < 0 ? 0 : i
for (; i < l; i++) if (i in arr && arr[i] ==... | Simple Utility Methods for checking information about a value.
@param {Mixed} value Could be anything.
@return {Object} | does | javascript | Kong/unirest-nodejs | index.js | https://github.com/Kong/unirest-nodejs/blob/master/index.js | MIT |
function getLogLevel(level, action, payload, type) {
switch (typeof level) {
case 'object':
return typeof level[type] === 'function' ? level[type](...payload) : level[type];
case 'function':
return level(action);
default:
return level;
}
} | Get log level string based on supplied params
@param {string | function | object} level - console[level]
@param {object} action - selected action
@param {array} payload - selected payload
@param {string} type - log entry type
@returns {string} level | getLogLevel | javascript | LogRocket/redux-logger | src/core.js | https://github.com/LogRocket/redux-logger/blob/master/src/core.js | MIT |
function defaultTitleFormatter(options) {
const { timestamp, duration } = options;
return (action, time, took) => {
const parts = ['action'];
parts.push(`%c${String(action.type)}`);
if (timestamp) parts.push(`%c@ ${time}`);
if (duration) parts.push(`%c(in ${took.toFixed(2)} ms)`);
return part... | Get log level string based on supplied params
@param {string | function | object} level - console[level]
@param {object} action - selected action
@param {array} payload - selected payload
@param {string} type - log entry type
@returns {string} level | defaultTitleFormatter | javascript | LogRocket/redux-logger | src/core.js | https://github.com/LogRocket/redux-logger/blob/master/src/core.js | MIT |
function createLogger(options = {}) {
const loggerOptions = Object.assign({}, defaults, options);
const {
logger,
stateTransformer,
errorTransformer,
predicate,
logErrors,
diffPredicate,
} = loggerOptions;
// Return if 'console' object is not defined
if (typeof logger === 'undefined'... | Creates logger with following options
@namespace
@param {object} options - options for logger
@param {string | function | object} options.level - console[level]
@param {boolean} options.duration - print duration of each action?
@param {boolean} options.timestamp - print timestamp with each action?
@param {object} opti... | createLogger | javascript | LogRocket/redux-logger | src/index.js | https://github.com/LogRocket/redux-logger/blob/master/src/index.js | MIT |
defaultLogger = ({ dispatch, getState } = {}) => {
if (typeof dispatch === 'function' || typeof getState === 'function') {
return createLogger()({ dispatch, getState });
}
// eslint-disable-next-line no-console
console.error(`
[redux-logger v3] BREAKING CHANGE
[redux-logger v3] Since 3.0.0 redux-logger expo... | Creates logger with following options
@namespace
@param {object} options - options for logger
@param {string | function | object} options.level - console[level]
@param {boolean} options.duration - print duration of each action?
@param {boolean} options.timestamp - print timestamp with each action?
@param {object} opti... | defaultLogger | javascript | LogRocket/redux-logger | src/index.js | https://github.com/LogRocket/redux-logger/blob/master/src/index.js | MIT |
defaultLogger = ({ dispatch, getState } = {}) => {
if (typeof dispatch === 'function' || typeof getState === 'function') {
return createLogger()({ dispatch, getState });
}
// eslint-disable-next-line no-console
console.error(`
[redux-logger v3] BREAKING CHANGE
[redux-logger v3] Since 3.0.0 redux-logger expo... | Creates logger with following options
@namespace
@param {object} options - options for logger
@param {string | function | object} options.level - console[level]
@param {boolean} options.duration - print duration of each action?
@param {boolean} options.timestamp - print timestamp with each action?
@param {object} opti... | defaultLogger | javascript | LogRocket/redux-logger | src/index.js | https://github.com/LogRocket/redux-logger/blob/master/src/index.js | MIT |
function broadcast(data, channel) {
for (var client of server.clients) {
if (channel ? client.channel === channel : client.channel) {
send(data, client)
}
}
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | broadcast | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.