feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell
- Introduced blog routing using Next.js App Router - Implemented dynamic [slug] pages for blog posts - Added MDX-based content loading via lib/posts - Integrated shared TopBar layout with navigation - Established clear content, lib and component separation
This commit is contained in:
21
apps/public-web/node_modules/next/dist/server/after/after-context.d.ts
generated
vendored
Normal file
21
apps/public-web/node_modules/next/dist/server/after/after-context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { RequestLifecycleOpts } from '../base-server';
|
||||
import type { AfterTask } from './after';
|
||||
export type AfterContextOpts = {
|
||||
waitUntil: RequestLifecycleOpts['waitUntil'] | undefined;
|
||||
onClose: RequestLifecycleOpts['onClose'];
|
||||
onTaskError: RequestLifecycleOpts['onAfterTaskError'] | undefined;
|
||||
};
|
||||
export declare class AfterContext {
|
||||
private waitUntil;
|
||||
private onClose;
|
||||
private onTaskError;
|
||||
private runCallbacksOnClosePromise;
|
||||
private callbackQueue;
|
||||
private workUnitStores;
|
||||
constructor({ waitUntil, onClose, onTaskError }: AfterContextOpts);
|
||||
after(task: AfterTask): void;
|
||||
private addCallback;
|
||||
private runCallbacksOnClose;
|
||||
private runCallbacks;
|
||||
private reportTaskError;
|
||||
}
|
||||
140
apps/public-web/node_modules/next/dist/server/after/after-context.js
generated
vendored
Normal file
140
apps/public-web/node_modules/next/dist/server/after/after-context.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AfterContext", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return AfterContext;
|
||||
}
|
||||
});
|
||||
const _pqueue = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/p-queue"));
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _isthenable = require("../../shared/lib/is-thenable");
|
||||
const _workasyncstorageexternal = require("../app-render/work-async-storage.external");
|
||||
const _revalidationutils = require("../revalidation-utils");
|
||||
const _asynclocalstorage = require("../app-render/async-local-storage");
|
||||
const _workunitasyncstorageexternal = require("../app-render/work-unit-async-storage.external");
|
||||
const _aftertaskasyncstorageexternal = require("../app-render/after-task-async-storage.external");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
class AfterContext {
|
||||
constructor({ waitUntil, onClose, onTaskError }){
|
||||
this.workUnitStores = new Set();
|
||||
this.waitUntil = waitUntil;
|
||||
this.onClose = onClose;
|
||||
this.onTaskError = onTaskError;
|
||||
this.callbackQueue = new _pqueue.default();
|
||||
this.callbackQueue.pause();
|
||||
}
|
||||
after(task) {
|
||||
if ((0, _isthenable.isThenable)(task)) {
|
||||
if (!this.waitUntil) {
|
||||
errorWaitUntilNotAvailable();
|
||||
}
|
||||
this.waitUntil(task.catch((error)=>this.reportTaskError('promise', error)));
|
||||
} else if (typeof task === 'function') {
|
||||
// TODO(after): implement tracing
|
||||
this.addCallback(task);
|
||||
} else {
|
||||
throw Object.defineProperty(new Error('`after()`: Argument must be a promise or a function'), "__NEXT_ERROR_CODE", {
|
||||
value: "E50",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
addCallback(callback) {
|
||||
// if something is wrong, throw synchronously, bubbling up to the `after` callsite.
|
||||
if (!this.waitUntil) {
|
||||
errorWaitUntilNotAvailable();
|
||||
}
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
this.workUnitStores.add(workUnitStore);
|
||||
}
|
||||
const afterTaskStore = _aftertaskasyncstorageexternal.afterTaskAsyncStorage.getStore();
|
||||
// This is used for checking if request APIs can be called inside `after`.
|
||||
// Note that we need to check the phase in which the *topmost* `after` was called (which should be "action"),
|
||||
// not the current phase (which might be "after" if we're in a nested after).
|
||||
// Otherwise, we might allow `after(() => headers())`, but not `after(() => after(() => headers()))`.
|
||||
const rootTaskSpawnPhase = afterTaskStore ? afterTaskStore.rootTaskSpawnPhase // nested after
|
||||
: workUnitStore == null ? void 0 : workUnitStore.phase // topmost after
|
||||
;
|
||||
// this should only happen once.
|
||||
if (!this.runCallbacksOnClosePromise) {
|
||||
this.runCallbacksOnClosePromise = this.runCallbacksOnClose();
|
||||
this.waitUntil(this.runCallbacksOnClosePromise);
|
||||
}
|
||||
// Bind the callback to the current execution context (i.e. preserve all currently available ALS-es).
|
||||
// We do this because we want all of these to be equivalent in every regard except timing:
|
||||
// after(() => x())
|
||||
// after(x())
|
||||
// await x()
|
||||
const wrappedCallback = (0, _asynclocalstorage.bindSnapshot)(// WARNING: Don't make this a named function. It must be anonymous.
|
||||
// See: https://github.com/facebook/react/pull/34911
|
||||
async ()=>{
|
||||
try {
|
||||
await _aftertaskasyncstorageexternal.afterTaskAsyncStorage.run({
|
||||
rootTaskSpawnPhase
|
||||
}, ()=>callback());
|
||||
} catch (error) {
|
||||
this.reportTaskError('function', error);
|
||||
}
|
||||
});
|
||||
this.callbackQueue.add(wrappedCallback);
|
||||
}
|
||||
async runCallbacksOnClose() {
|
||||
await new Promise((resolve)=>this.onClose(resolve));
|
||||
return this.runCallbacks();
|
||||
}
|
||||
async runCallbacks() {
|
||||
if (this.callbackQueue.size === 0) return;
|
||||
for (const workUnitStore of this.workUnitStores){
|
||||
workUnitStore.phase = 'after';
|
||||
}
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if (!workStore) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Missing workStore in AfterContext.runCallbacks'), "__NEXT_ERROR_CODE", {
|
||||
value: "E547",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return (0, _revalidationutils.withExecuteRevalidates)(workStore, ()=>{
|
||||
this.callbackQueue.start();
|
||||
return this.callbackQueue.onIdle();
|
||||
});
|
||||
}
|
||||
reportTaskError(taskKind, error) {
|
||||
// TODO(after): this is fine for now, but will need better intergration with our error reporting.
|
||||
// TODO(after): should we log this if we have a onTaskError callback?
|
||||
console.error(taskKind === 'promise' ? `A promise passed to \`after()\` rejected:` : `An error occurred in a function passed to \`after()\`:`, error);
|
||||
if (this.onTaskError) {
|
||||
// this is very defensive, but we really don't want anything to blow up in an error handler
|
||||
try {
|
||||
this.onTaskError == null ? void 0 : this.onTaskError.call(this, error);
|
||||
} catch (handlerError) {
|
||||
console.error(Object.defineProperty(new _invarianterror.InvariantError('`onTaskError` threw while handling an error thrown from an `after` task', {
|
||||
cause: handlerError
|
||||
}), "__NEXT_ERROR_CODE", {
|
||||
value: "E569",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function errorWaitUntilNotAvailable() {
|
||||
throw Object.defineProperty(new Error('`after()` will not work correctly, because `waitUntil` is not available in the current environment.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E91",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=after-context.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/after-context.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/after-context.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
apps/public-web/node_modules/next/dist/server/after/after.d.ts
generated
vendored
Normal file
6
apps/public-web/node_modules/next/dist/server/after/after.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export type AfterTask<T = unknown> = Promise<T> | AfterCallback<T>;
|
||||
export type AfterCallback<T = unknown> = () => T | Promise<T>;
|
||||
/**
|
||||
* This function allows you to schedule callbacks to be executed after the current request finishes.
|
||||
*/
|
||||
export declare function after<T>(task: AfterTask<T>): void;
|
||||
26
apps/public-web/node_modules/next/dist/server/after/after.js
generated
vendored
Normal file
26
apps/public-web/node_modules/next/dist/server/after/after.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "after", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return after;
|
||||
}
|
||||
});
|
||||
const _workasyncstorageexternal = require("../app-render/work-async-storage.external");
|
||||
function after(task) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if (!workStore) {
|
||||
// TODO(after): the linked docs page talks about *dynamic* APIs, which after soon won't be anymore
|
||||
throw Object.defineProperty(new Error('`after` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context'), "__NEXT_ERROR_CODE", {
|
||||
value: "E468",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const { afterContext } = workStore;
|
||||
return afterContext.after(task);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=after.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/after.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/after.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/after/after.ts"],"sourcesContent":["import { workAsyncStorage } from '../app-render/work-async-storage.external'\n\nexport type AfterTask<T = unknown> = Promise<T> | AfterCallback<T>\nexport type AfterCallback<T = unknown> = () => T | Promise<T>\n\n/**\n * This function allows you to schedule callbacks to be executed after the current request finishes.\n */\nexport function after<T>(task: AfterTask<T>): void {\n const workStore = workAsyncStorage.getStore()\n\n if (!workStore) {\n // TODO(after): the linked docs page talks about *dynamic* APIs, which after soon won't be anymore\n throw new Error(\n '`after` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context'\n )\n }\n\n const { afterContext } = workStore\n return afterContext.after(task)\n}\n"],"names":["after","task","workStore","workAsyncStorage","getStore","Error","afterContext"],"mappings":";;;;+BAQgBA;;;eAAAA;;;0CARiB;AAQ1B,SAASA,MAASC,IAAkB;IACzC,MAAMC,YAAYC,0CAAgB,CAACC,QAAQ;IAE3C,IAAI,CAACF,WAAW;QACd,kGAAkG;QAClG,MAAM,qBAEL,CAFK,IAAIG,MACR,2HADI,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;IAEA,MAAM,EAAEC,YAAY,EAAE,GAAGJ;IACzB,OAAOI,aAAaN,KAAK,CAACC;AAC5B","ignoreList":[0]}
|
||||
29
apps/public-web/node_modules/next/dist/server/after/awaiter.d.ts
generated
vendored
Normal file
29
apps/public-web/node_modules/next/dist/server/after/awaiter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Provides a `waitUntil` implementation which gathers promises to be awaited later (via {@link AwaiterMulti.awaiting}).
|
||||
* Unlike a simple `Promise.all`, {@link AwaiterMulti} works recursively --
|
||||
* if a promise passed to {@link AwaiterMulti.waitUntil} calls `waitUntil` again,
|
||||
* that second promise will also be awaited.
|
||||
*/
|
||||
export declare class AwaiterMulti {
|
||||
private promises;
|
||||
private onError;
|
||||
constructor({ onError }?: {
|
||||
onError?: (error: unknown) => void;
|
||||
});
|
||||
waitUntil: (promise: Promise<unknown>) => void;
|
||||
awaiting(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Like {@link AwaiterMulti}, but can only be awaited once.
|
||||
* If {@link AwaiterOnce.waitUntil} is called after that, it will throw.
|
||||
*/
|
||||
export declare class AwaiterOnce {
|
||||
private awaiter;
|
||||
private done;
|
||||
private pending;
|
||||
constructor(options?: {
|
||||
onError?: (error: unknown) => void;
|
||||
});
|
||||
waitUntil: (promise: Promise<unknown>) => void;
|
||||
awaiting(): Promise<void>;
|
||||
}
|
||||
74
apps/public-web/node_modules/next/dist/server/after/awaiter.js
generated
vendored
Normal file
74
apps/public-web/node_modules/next/dist/server/after/awaiter.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
AwaiterMulti: null,
|
||||
AwaiterOnce: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
AwaiterMulti: function() {
|
||||
return AwaiterMulti;
|
||||
},
|
||||
AwaiterOnce: function() {
|
||||
return AwaiterOnce;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
class AwaiterMulti {
|
||||
constructor({ onError } = {}){
|
||||
this.promises = new Set();
|
||||
this.waitUntil = (promise)=>{
|
||||
// if a promise settles before we await it, we should drop it --
|
||||
// storing them indefinitely could result in a memory leak.
|
||||
const cleanup = ()=>{
|
||||
this.promises.delete(promise);
|
||||
};
|
||||
promise.then(cleanup, (err)=>{
|
||||
cleanup();
|
||||
this.onError(err);
|
||||
});
|
||||
this.promises.add(promise);
|
||||
};
|
||||
this.onError = onError ?? console.error;
|
||||
}
|
||||
async awaiting() {
|
||||
while(this.promises.size > 0){
|
||||
const promises = Array.from(this.promises);
|
||||
this.promises.clear();
|
||||
await Promise.allSettled(promises);
|
||||
}
|
||||
}
|
||||
}
|
||||
class AwaiterOnce {
|
||||
constructor(options = {}){
|
||||
this.done = false;
|
||||
this.waitUntil = (promise)=>{
|
||||
if (this.done) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Cannot call waitUntil() on an AwaiterOnce that was already awaited'), "__NEXT_ERROR_CODE", {
|
||||
value: "E563",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return this.awaiter.waitUntil(promise);
|
||||
};
|
||||
this.awaiter = new AwaiterMulti(options);
|
||||
}
|
||||
async awaiting() {
|
||||
if (!this.pending) {
|
||||
this.pending = this.awaiter.awaiting().finally(()=>{
|
||||
this.done = true;
|
||||
});
|
||||
}
|
||||
return this.pending;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=awaiter.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/awaiter.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/awaiter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/after/awaiter.ts"],"sourcesContent":["import { InvariantError } from '../../shared/lib/invariant-error'\n\n/**\n * Provides a `waitUntil` implementation which gathers promises to be awaited later (via {@link AwaiterMulti.awaiting}).\n * Unlike a simple `Promise.all`, {@link AwaiterMulti} works recursively --\n * if a promise passed to {@link AwaiterMulti.waitUntil} calls `waitUntil` again,\n * that second promise will also be awaited.\n */\nexport class AwaiterMulti {\n private promises: Set<Promise<unknown>> = new Set()\n private onError: (error: unknown) => void\n\n constructor({ onError }: { onError?: (error: unknown) => void } = {}) {\n this.onError = onError ?? console.error\n }\n\n public waitUntil = (promise: Promise<unknown>): void => {\n // if a promise settles before we await it, we should drop it --\n // storing them indefinitely could result in a memory leak.\n const cleanup = () => {\n this.promises.delete(promise)\n }\n\n promise.then(cleanup, (err) => {\n cleanup()\n this.onError(err)\n })\n\n this.promises.add(promise)\n }\n\n public async awaiting(): Promise<void> {\n while (this.promises.size > 0) {\n const promises = Array.from(this.promises)\n this.promises.clear()\n await Promise.allSettled(promises)\n }\n }\n}\n\n/**\n * Like {@link AwaiterMulti}, but can only be awaited once.\n * If {@link AwaiterOnce.waitUntil} is called after that, it will throw.\n */\nexport class AwaiterOnce {\n private awaiter: AwaiterMulti\n private done: boolean = false\n private pending: Promise<void> | undefined\n\n constructor(options: { onError?: (error: unknown) => void } = {}) {\n this.awaiter = new AwaiterMulti(options)\n }\n\n public waitUntil = (promise: Promise<unknown>): void => {\n if (this.done) {\n throw new InvariantError(\n 'Cannot call waitUntil() on an AwaiterOnce that was already awaited'\n )\n }\n return this.awaiter.waitUntil(promise)\n }\n\n public async awaiting(): Promise<void> {\n if (!this.pending) {\n this.pending = this.awaiter.awaiting().finally(() => {\n this.done = true\n })\n }\n return this.pending\n }\n}\n"],"names":["AwaiterMulti","AwaiterOnce","constructor","onError","promises","Set","waitUntil","promise","cleanup","delete","then","err","add","console","error","awaiting","size","Array","from","clear","Promise","allSettled","options","done","InvariantError","awaiter","pending","finally"],"mappings":";;;;;;;;;;;;;;;IAQaA,YAAY;eAAZA;;IAoCAC,WAAW;eAAXA;;;gCA5CkB;AAQxB,MAAMD;IAIXE,YAAY,EAAEC,OAAO,EAA0C,GAAG,CAAC,CAAC,CAAE;aAH9DC,WAAkC,IAAIC;aAOvCC,YAAY,CAACC;YAClB,gEAAgE;YAChE,2DAA2D;YAC3D,MAAMC,UAAU;gBACd,IAAI,CAACJ,QAAQ,CAACK,MAAM,CAACF;YACvB;YAEAA,QAAQG,IAAI,CAACF,SAAS,CAACG;gBACrBH;gBACA,IAAI,CAACL,OAAO,CAACQ;YACf;YAEA,IAAI,CAACP,QAAQ,CAACQ,GAAG,CAACL;QACpB;QAhBE,IAAI,CAACJ,OAAO,GAAGA,WAAWU,QAAQC,KAAK;IACzC;IAiBA,MAAaC,WAA0B;QACrC,MAAO,IAAI,CAACX,QAAQ,CAACY,IAAI,GAAG,EAAG;YAC7B,MAAMZ,WAAWa,MAAMC,IAAI,CAAC,IAAI,CAACd,QAAQ;YACzC,IAAI,CAACA,QAAQ,CAACe,KAAK;YACnB,MAAMC,QAAQC,UAAU,CAACjB;QAC3B;IACF;AACF;AAMO,MAAMH;IAKXC,YAAYoB,UAAkD,CAAC,CAAC,CAAE;aAH1DC,OAAgB;aAOjBjB,YAAY,CAACC;YAClB,IAAI,IAAI,CAACgB,IAAI,EAAE;gBACb,MAAM,qBAEL,CAFK,IAAIC,8BAAc,CACtB,uEADI,qBAAA;2BAAA;gCAAA;kCAAA;gBAEN;YACF;YACA,OAAO,IAAI,CAACC,OAAO,CAACnB,SAAS,CAACC;QAChC;QAVE,IAAI,CAACkB,OAAO,GAAG,IAAIzB,aAAasB;IAClC;IAWA,MAAaP,WAA0B;QACrC,IAAI,CAAC,IAAI,CAACW,OAAO,EAAE;YACjB,IAAI,CAACA,OAAO,GAAG,IAAI,CAACD,OAAO,CAACV,QAAQ,GAAGY,OAAO,CAAC;gBAC7C,IAAI,CAACJ,IAAI,GAAG;YACd;QACF;QACA,OAAO,IAAI,CAACG,OAAO;IACrB;AACF","ignoreList":[0]}
|
||||
17
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.d.ts
generated
vendored
Normal file
17
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export declare function getBuiltinRequestContext(): BuiltinRequestContextValue | undefined;
|
||||
/** A request context provided by the platform. */
|
||||
export type BuiltinRequestContext = {
|
||||
get(): BuiltinRequestContextValue | undefined;
|
||||
};
|
||||
export type RunnableBuiltinRequestContext = BuiltinRequestContext & {
|
||||
run<T>(value: BuiltinRequestContextValue, callback: () => T): T;
|
||||
};
|
||||
export type BuiltinRequestContextValue = {
|
||||
waitUntil?: WaitUntil;
|
||||
};
|
||||
export type WaitUntil = (promise: Promise<any>) => void;
|
||||
/** "@next/request-context" has a different signature from AsyncLocalStorage,
|
||||
* matching [AsyncContext.Variable](https://github.com/tc39/proposal-async-context).
|
||||
* We don't need a full AsyncContext adapter here, just having `.get()` is enough
|
||||
*/
|
||||
export declare function createLocalRequestContext(): RunnableBuiltinRequestContext;
|
||||
38
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.js
generated
vendored
Normal file
38
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createLocalRequestContext: null,
|
||||
getBuiltinRequestContext: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createLocalRequestContext: function() {
|
||||
return createLocalRequestContext;
|
||||
},
|
||||
getBuiltinRequestContext: function() {
|
||||
return getBuiltinRequestContext;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("../app-render/async-local-storage");
|
||||
function getBuiltinRequestContext() {
|
||||
const _globalThis = globalThis;
|
||||
const ctx = _globalThis[NEXT_REQUEST_CONTEXT_SYMBOL];
|
||||
return ctx == null ? void 0 : ctx.get();
|
||||
}
|
||||
const NEXT_REQUEST_CONTEXT_SYMBOL = Symbol.for('@next/request-context');
|
||||
function createLocalRequestContext() {
|
||||
const storage = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
return {
|
||||
get: ()=>storage.getStore(),
|
||||
run: (value, callback)=>storage.run(value, callback)
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=builtin-request-context.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/builtin-request-context.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/after/builtin-request-context.ts"],"sourcesContent":["import { createAsyncLocalStorage } from '../app-render/async-local-storage'\n\nexport function getBuiltinRequestContext():\n | BuiltinRequestContextValue\n | undefined {\n const _globalThis = globalThis as GlobalThisWithRequestContext\n const ctx = _globalThis[NEXT_REQUEST_CONTEXT_SYMBOL]\n return ctx?.get()\n}\n\nconst NEXT_REQUEST_CONTEXT_SYMBOL = Symbol.for('@next/request-context')\n\ntype GlobalThisWithRequestContext = typeof globalThis & {\n [NEXT_REQUEST_CONTEXT_SYMBOL]?: BuiltinRequestContext\n}\n\n/** A request context provided by the platform. */\nexport type BuiltinRequestContext = {\n get(): BuiltinRequestContextValue | undefined\n}\n\nexport type RunnableBuiltinRequestContext = BuiltinRequestContext & {\n run<T>(value: BuiltinRequestContextValue, callback: () => T): T\n}\n\nexport type BuiltinRequestContextValue = {\n waitUntil?: WaitUntil\n}\nexport type WaitUntil = (promise: Promise<any>) => void\n\n/** \"@next/request-context\" has a different signature from AsyncLocalStorage,\n * matching [AsyncContext.Variable](https://github.com/tc39/proposal-async-context).\n * We don't need a full AsyncContext adapter here, just having `.get()` is enough\n */\nexport function createLocalRequestContext(): RunnableBuiltinRequestContext {\n const storage = createAsyncLocalStorage<BuiltinRequestContextValue>()\n return {\n get: () => storage.getStore(),\n run: (value, callback) => storage.run(value, callback),\n }\n}\n"],"names":["createLocalRequestContext","getBuiltinRequestContext","_globalThis","globalThis","ctx","NEXT_REQUEST_CONTEXT_SYMBOL","get","Symbol","for","storage","createAsyncLocalStorage","getStore","run","value","callback"],"mappings":";;;;;;;;;;;;;;;IAkCgBA,yBAAyB;eAAzBA;;IAhCAC,wBAAwB;eAAxBA;;;mCAFwB;AAEjC,SAASA;IAGd,MAAMC,cAAcC;IACpB,MAAMC,MAAMF,WAAW,CAACG,4BAA4B;IACpD,OAAOD,uBAAAA,IAAKE,GAAG;AACjB;AAEA,MAAMD,8BAA8BE,OAAOC,GAAG,CAAC;AAwBxC,SAASR;IACd,MAAMS,UAAUC,IAAAA,0CAAuB;IACvC,OAAO;QACLJ,KAAK,IAAMG,QAAQE,QAAQ;QAC3BC,KAAK,CAACC,OAAOC,WAAaL,QAAQG,GAAG,CAACC,OAAOC;IAC/C;AACF","ignoreList":[0]}
|
||||
1
apps/public-web/node_modules/next/dist/server/after/index.d.ts
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './after';
|
||||
21
apps/public-web/node_modules/next/dist/server/after/index.js
generated
vendored
Normal file
21
apps/public-web/node_modules/next/dist/server/after/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && __export(require("./after"));
|
||||
_export_star(require("./after"), exports);
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/index.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/after/index.ts"],"sourcesContent":["export * from './after'\n"],"names":[],"mappings":";;;;;qBAAc","ignoreList":[0]}
|
||||
14
apps/public-web/node_modules/next/dist/server/after/run-with-after.d.ts
generated
vendored
Normal file
14
apps/public-web/node_modules/next/dist/server/after/run-with-after.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { AfterContextOpts } from './after-context';
|
||||
type Ctx = {
|
||||
waitUntil: NonNullable<AfterContextOpts['waitUntil']>;
|
||||
onClose: NonNullable<AfterContextOpts['onClose']>;
|
||||
onTaskError: NonNullable<AfterContextOpts['onTaskError']>;
|
||||
};
|
||||
export declare class AfterRunner {
|
||||
private awaiter;
|
||||
private closeController;
|
||||
private finishedWithoutErrors;
|
||||
readonly context: Ctx;
|
||||
executeAfter(): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
35
apps/public-web/node_modules/next/dist/server/after/run-with-after.js
generated
vendored
Normal file
35
apps/public-web/node_modules/next/dist/server/after/run-with-after.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AfterRunner", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return AfterRunner;
|
||||
}
|
||||
});
|
||||
const _detachedpromise = require("../../lib/detached-promise");
|
||||
const _webonclose = require("../web/web-on-close");
|
||||
const _awaiter = require("./awaiter");
|
||||
class AfterRunner {
|
||||
async executeAfter() {
|
||||
this.closeController.dispatchClose();
|
||||
await this.awaiter.awaiting();
|
||||
// if we got an error while running the callbacks,
|
||||
// thenthis is a noop, because the promise is already rejected
|
||||
this.finishedWithoutErrors.resolve();
|
||||
return this.finishedWithoutErrors.promise;
|
||||
}
|
||||
constructor(){
|
||||
this.awaiter = new _awaiter.AwaiterOnce();
|
||||
this.closeController = new _webonclose.CloseController();
|
||||
this.finishedWithoutErrors = new _detachedpromise.DetachedPromise();
|
||||
this.context = {
|
||||
waitUntil: this.awaiter.waitUntil.bind(this.awaiter),
|
||||
onClose: this.closeController.onClose.bind(this.closeController),
|
||||
onTaskError: (error)=>this.finishedWithoutErrors.reject(error)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=run-with-after.js.map
|
||||
1
apps/public-web/node_modules/next/dist/server/after/run-with-after.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/server/after/run-with-after.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/after/run-with-after.ts"],"sourcesContent":["import { DetachedPromise } from '../../lib/detached-promise'\nimport { CloseController } from '../web/web-on-close'\nimport type { AfterContextOpts } from './after-context'\nimport { AwaiterOnce } from './awaiter'\n\ntype Ctx = {\n waitUntil: NonNullable<AfterContextOpts['waitUntil']>\n onClose: NonNullable<AfterContextOpts['onClose']>\n onTaskError: NonNullable<AfterContextOpts['onTaskError']>\n}\n\nexport class AfterRunner {\n private awaiter = new AwaiterOnce()\n private closeController = new CloseController()\n private finishedWithoutErrors = new DetachedPromise<void>()\n\n readonly context: Ctx = {\n waitUntil: this.awaiter.waitUntil.bind(this.awaiter),\n onClose: this.closeController.onClose.bind(this.closeController),\n onTaskError: (error) => this.finishedWithoutErrors.reject(error),\n }\n\n public async executeAfter() {\n this.closeController.dispatchClose()\n await this.awaiter.awaiting()\n\n // if we got an error while running the callbacks,\n // thenthis is a noop, because the promise is already rejected\n this.finishedWithoutErrors.resolve()\n\n return this.finishedWithoutErrors.promise\n }\n}\n"],"names":["AfterRunner","executeAfter","closeController","dispatchClose","awaiter","awaiting","finishedWithoutErrors","resolve","promise","AwaiterOnce","CloseController","DetachedPromise","context","waitUntil","bind","onClose","onTaskError","error","reject"],"mappings":";;;;+BAWaA;;;eAAAA;;;iCAXmB;4BACA;yBAEJ;AAQrB,MAAMA;IAWX,MAAaC,eAAe;QAC1B,IAAI,CAACC,eAAe,CAACC,aAAa;QAClC,MAAM,IAAI,CAACC,OAAO,CAACC,QAAQ;QAE3B,kDAAkD;QAClD,8DAA8D;QAC9D,IAAI,CAACC,qBAAqB,CAACC,OAAO;QAElC,OAAO,IAAI,CAACD,qBAAqB,CAACE,OAAO;IAC3C;;aAnBQJ,UAAU,IAAIK,oBAAW;aACzBP,kBAAkB,IAAIQ,2BAAe;aACrCJ,wBAAwB,IAAIK,gCAAe;aAE1CC,UAAe;YACtBC,WAAW,IAAI,CAACT,OAAO,CAACS,SAAS,CAACC,IAAI,CAAC,IAAI,CAACV,OAAO;YACnDW,SAAS,IAAI,CAACb,eAAe,CAACa,OAAO,CAACD,IAAI,CAAC,IAAI,CAACZ,eAAe;YAC/Dc,aAAa,CAACC,QAAU,IAAI,CAACX,qBAAqB,CAACY,MAAM,CAACD;QAC5D;;AAYF","ignoreList":[0]}
|
||||
Reference in New Issue
Block a user