main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

4
node_modules/next/dist/trace/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { trace, flushAllTraces, Span, SpanStatus } from './trace';
import { SpanId, setGlobal } from './shared';
export { trace, flushAllTraces, Span, setGlobal, SpanStatus };
export type { SpanId };

38
node_modules/next/dist/trace/index.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
trace: null,
flushAllTraces: null,
Span: null,
setGlobal: null,
SpanStatus: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
trace: function() {
return _trace.trace;
},
flushAllTraces: function() {
return _trace.flushAllTraces;
},
Span: function() {
return _trace.Span;
},
setGlobal: function() {
return _shared.setGlobal;
},
SpanStatus: function() {
return _trace.SpanStatus;
}
});
const _trace = require("./trace");
const _shared = require("./shared");
//# sourceMappingURL=index.js.map

1
node_modules/next/dist/trace/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/trace/index.ts"],"names":["trace","flushAllTraces","Span","setGlobal","SpanStatus"],"mappings":";;;;;;;;;;;;;;;;;;IAGSA,KAAK;eAALA,YAAK;;IAAEC,cAAc;eAAdA,qBAAc;;IAAEC,IAAI;eAAJA,WAAI;;IAAEC,SAAS;eAATA,iBAAS;;IAAEC,UAAU;eAAVA,iBAAU;;;uBAHH;wBACtB"}

13
node_modules/next/dist/trace/report/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { SpanId } from '../shared';
type Reporter = {
flushAll: () => Promise<void> | void;
report: (spanName: string, duration: number, timestamp: number, id: SpanId, parentId?: SpanId, attrs?: Object, startTime?: number) => void;
};
declare class MultiReporter implements Reporter {
private reporters;
constructor(reporters: Reporter[]);
flushAll(): Promise<void>;
report(spanName: string, duration: number, timestamp: number, id: SpanId, parentId?: SpanId, attrs?: Object, startTime?: number): void;
}
export declare const reporter: MultiReporter;
export {};

35
node_modules/next/dist/trace/report/index.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "reporter", {
enumerable: true,
get: function() {
return reporter;
}
});
const _totelemetry = /*#__PURE__*/ _interop_require_default(require("./to-telemetry"));
const _tojson = /*#__PURE__*/ _interop_require_default(require("./to-json"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
class MultiReporter {
constructor(reporters){
this.reporters = [];
this.reporters = reporters;
}
async flushAll() {
await Promise.all(this.reporters.map((reporter)=>reporter.flushAll()));
}
report(spanName, duration, timestamp, id, parentId, attrs, startTime) {
this.reporters.forEach((reporter)=>reporter.report(spanName, duration, timestamp, id, parentId, attrs, startTime));
}
}
const reporter = new MultiReporter([
_tojson.default,
_totelemetry.default
]);
//# sourceMappingURL=index.js.map

1
node_modules/next/dist/trace/report/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/trace/report/index.ts"],"names":["reporter","MultiReporter","constructor","reporters","flushAll","Promise","all","map","report","spanName","duration","timestamp","id","parentId","attrs","startTime","forEach","reportToJson","reportToTelemetry"],"mappings":";;;;+BAoDaA;;;eAAAA;;;oEAnDiB;+DACL;;;;;;AAezB,MAAMC;IAGJC,YAAYC,SAAqB,CAAE;aAF3BA,YAAwB,EAAE;QAGhC,IAAI,CAACA,SAAS,GAAGA;IACnB;IAEA,MAAMC,WAAW;QACf,MAAMC,QAAQC,GAAG,CAAC,IAAI,CAACH,SAAS,CAACI,GAAG,CAAC,CAACP,WAAaA,SAASI,QAAQ;IACtE;IAEAI,OACEC,QAAgB,EAChBC,QAAgB,EAChBC,SAAiB,EACjBC,EAAU,EACVC,QAAiB,EACjBC,KAAc,EACdC,SAAkB,EAClB;QACA,IAAI,CAACZ,SAAS,CAACa,OAAO,CAAC,CAAChB,WACtBA,SAASQ,MAAM,CACbC,UACAC,UACAC,WACAC,IACAC,UACAC,OACAC;IAGN;AACF;AAGO,MAAMf,WAAW,IAAIC,cAAc;IAACgB,eAAY;IAAEC,oBAAiB;CAAC"}

25
node_modules/next/dist/trace/report/to-json.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
declare const localEndpoint: {
serviceName: string;
ipv4: string;
port: number;
};
type Event = {
traceId: string;
parentId?: number;
name: string;
id: number;
timestamp: number;
duration: number;
localEndpoint?: typeof localEndpoint;
tags?: Object;
startTime?: number;
};
export declare function batcher(reportEvents: (evts: Event[]) => Promise<void>): {
flushAll: () => Promise<void>;
report: (event: Event) => void;
};
declare const _default: {
flushAll: () => Promise<void> | undefined;
report: (name: string, duration: number, timestamp: number, id: number, parentId?: number | undefined, attrs?: Object | undefined, startTime?: number | undefined) => void;
};
export default _default;

167
node_modules/next/dist/trace/report/to-json.js generated vendored Normal file
View File

@@ -0,0 +1,167 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
batcher: null,
default: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
batcher: function() {
return batcher;
},
default: function() {
return _default;
}
});
const _crypto = require("crypto");
const _shared = require("../shared");
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _constants = require("../../shared/lib/constants");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const localEndpoint = {
serviceName: "nextjs",
ipv4: "127.0.0.1",
port: 9411
};
function batcher(reportEvents) {
const events = [];
// Promise queue to ensure events are always sent on flushAll
const queue = new Set();
return {
flushAll: async ()=>{
await Promise.all(queue);
if (events.length > 0) {
await reportEvents(events);
events.length = 0;
}
},
report: (event)=>{
events.push(event);
if (events.length > 100) {
const evts = events.slice();
events.length = 0;
const report = reportEvents(evts);
queue.add(report);
report.then(()=>queue.delete(report));
}
}
};
}
let writeStream;
let traceId;
let batch;
const writeStreamOptions = {
flags: "a",
encoding: "utf8"
};
class RotatingWriteStream {
constructor(file, sizeLimit){
this.file = file;
this.size = 0;
this.sizeLimit = sizeLimit;
this.createWriteStream();
}
createWriteStream() {
this.writeStream = _fs.default.createWriteStream(this.file, writeStreamOptions);
}
// Recreate the file
async rotate() {
await this.end();
try {
_fs.default.unlinkSync(this.file);
} catch (err) {
// It's fine if the file does not exist yet
if (err.code !== "ENOENT") {
throw err;
}
}
this.size = 0;
this.createWriteStream();
this.rotatePromise = undefined;
}
async write(data) {
if (this.rotatePromise) await this.rotatePromise;
this.size += data.length;
if (this.size > this.sizeLimit) {
await (this.rotatePromise = this.rotate());
}
if (!this.writeStream.write(data, "utf8")) {
if (this.drainPromise === undefined) {
this.drainPromise = new Promise((resolve, _reject)=>{
this.writeStream.once("drain", ()=>{
this.drainPromise = undefined;
resolve();
});
});
}
await this.drainPromise;
}
}
end() {
return new Promise((resolve)=>{
this.writeStream.end(resolve);
});
}
}
const reportToLocalHost = (name, duration, timestamp, id, parentId, attrs, startTime)=>{
const distDir = _shared.traceGlobals.get("distDir");
const phase = _shared.traceGlobals.get("phase");
if (!distDir || !phase) {
return;
}
if (!traceId) {
traceId = process.env.TRACE_ID || (0, _crypto.randomBytes)(8).toString("hex");
}
if (!batch) {
batch = batcher(async (events)=>{
if (!writeStream) {
await _fs.default.promises.mkdir(distDir, {
recursive: true
});
const file = _path.default.join(distDir, "trace");
writeStream = new RotatingWriteStream(file, // Development is limited to 50MB, production is unlimited
phase === _constants.PHASE_DEVELOPMENT_SERVER ? 52428800 : Infinity);
}
const eventsJson = JSON.stringify(events);
try {
await writeStream.write(eventsJson + "\n");
} catch (err) {
console.log(err);
}
});
}
batch.report({
traceId,
parentId,
name,
id,
timestamp,
duration,
tags: attrs,
startTime
});
};
const _default = {
flushAll: ()=>batch ? batch.flushAll().then(()=>{
const phase = _shared.traceGlobals.get("phase");
// Only end writeStream when manually flushing in production
if (phase !== _constants.PHASE_DEVELOPMENT_SERVER) {
writeStream.end();
}
}) : undefined,
report: reportToLocalHost
};
//# sourceMappingURL=to-json.js.map

1
node_modules/next/dist/trace/report/to-json.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/trace/report/to-json.ts"],"names":["batcher","localEndpoint","serviceName","ipv4","port","reportEvents","events","queue","Set","flushAll","Promise","all","length","report","event","push","evts","slice","add","then","delete","writeStream","traceId","batch","writeStreamOptions","flags","encoding","RotatingWriteStream","constructor","file","sizeLimit","size","createWriteStream","fs","rotate","end","unlinkSync","err","code","rotatePromise","undefined","write","data","drainPromise","resolve","_reject","once","reportToLocalHost","name","duration","timestamp","id","parentId","attrs","startTime","distDir","traceGlobals","get","phase","process","env","TRACE_ID","randomBytes","toString","promises","mkdir","recursive","path","join","PHASE_DEVELOPMENT_SERVER","Infinity","eventsJson","JSON","stringify","console","log","tags"],"mappings":";;;;;;;;;;;;;;;IAyBgBA,OAAO;eAAPA;;IAgJhB,OAYC;eAZD;;;wBAzK4B;wBACC;2DACd;6DACE;2BACwB;;;;;;AAEzC,MAAMC,gBAAgB;IACpBC,aAAa;IACbC,MAAM;IACNC,MAAM;AACR;AAeO,SAASJ,QAAQK,YAA8C;IACpE,MAAMC,SAAkB,EAAE;IAC1B,6DAA6D;IAC7D,MAAMC,QAAQ,IAAIC;IAClB,OAAO;QACLC,UAAU;YACR,MAAMC,QAAQC,GAAG,CAACJ;YAClB,IAAID,OAAOM,MAAM,GAAG,GAAG;gBACrB,MAAMP,aAAaC;gBACnBA,OAAOM,MAAM,GAAG;YAClB;QACF;QACAC,QAAQ,CAACC;YACPR,OAAOS,IAAI,CAACD;YAEZ,IAAIR,OAAOM,MAAM,GAAG,KAAK;gBACvB,MAAMI,OAAOV,OAAOW,KAAK;gBACzBX,OAAOM,MAAM,GAAG;gBAChB,MAAMC,SAASR,aAAaW;gBAC5BT,MAAMW,G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QAAQF,oBAAY,CAACC,GAAG,CAAC;YAC/B,4DAA4D;YAC5D,IAAIC,UAAUW,mCAAwB,EAAE;gBACtChD,YAAYc,GAAG;YACjB;QACF,KACAK;IACN3B,QAAQkC;AACV"}

View File

@@ -0,0 +1,5 @@
declare const _default: {
flushAll: () => void;
report: (spanName: string, duration: number) => void;
};
export default _default;

36
node_modules/next/dist/trace/report/to-telemetry.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _shared = require("../shared");
const TRACE_EVENT_ACCESSLIST = new Map(Object.entries({
"webpack-invalidated": "WEBPACK_INVALIDATED"
}));
const reportToTelemetry = (spanName, duration)=>{
const eventName = TRACE_EVENT_ACCESSLIST.get(spanName);
if (!eventName) {
return;
}
const telemetry = _shared.traceGlobals.get("telemetry");
if (!telemetry) {
return;
}
telemetry.record({
eventName,
payload: {
durationInMicroseconds: duration
}
});
};
const _default = {
flushAll: ()=>{},
report: reportToTelemetry
};
//# sourceMappingURL=to-telemetry.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/trace/report/to-telemetry.ts"],"names":["TRACE_EVENT_ACCESSLIST","Map","Object","entries","reportToTelemetry","spanName","duration","eventName","get","telemetry","traceGlobals","record","payload","durationInMicroseconds","flushAll","report"],"mappings":";;;;+BA2BA;;;eAAA;;;wBA1B6B;AAE7B,MAAMA,yBAAyB,IAAIC,IACjCC,OAAOC,OAAO,CAAC;IACb,uBAAuB;AACzB;AAGF,MAAMC,oBAAoB,CAACC,UAAkBC;IAC3C,MAAMC,YAAYP,uBAAuBQ,GAAG,CAACH;IAC7C,IAAI,CAACE,WAAW;QACd;IACF;IACA,MAAME,YAAmCC,oBAAY,CAACF,GAAG,CAAC;IAC1D,IAAI,CAACC,WAAW;QACd;IACF;IAEAA,UAAUE,MAAM,CAAC;QACfJ;QACAK,SAAS;YACPC,wBAAwBP;QAC1B;IACF;AACF;MAEA,WAAe;IACbQ,UAAU,KAAO;IACjBC,QAAQX;AACV"}

3
node_modules/next/dist/trace/shared.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export type SpanId = number;
export declare const traceGlobals: Map<any, any>;
export declare const setGlobal: (key: any, val: any) => void;

33
node_modules/next/dist/trace/shared.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
traceGlobals: null,
setGlobal: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
traceGlobals: function() {
return traceGlobals;
},
setGlobal: function() {
return setGlobal;
}
});
let _traceGlobals = global._traceGlobals;
if (!_traceGlobals) {
_traceGlobals = new Map();
}
global._traceGlobals = _traceGlobals;
const traceGlobals = _traceGlobals;
const setGlobal = (key, val)=>{
traceGlobals.set(key, val);
};
//# sourceMappingURL=shared.js.map

1
node_modules/next/dist/trace/shared.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/trace/shared.ts"],"names":["traceGlobals","setGlobal","_traceGlobals","global","Map","key","val","set"],"mappings":";;;;;;;;;;;;;;;IASaA,YAAY;eAAZA;;IACAC,SAAS;eAATA;;;AARb,IAAIC,gBAA+B,AAACC,OAAeD,aAAa;AAEhE,IAAI,CAACA,eAAe;IAClBA,gBAAgB,IAAIE;AACtB;AACED,OAAeD,aAAa,GAAGA;AAE1B,MAAMF,eAA8BE;AACpC,MAAMD,YAAY,CAACI,KAAUC;IAClCN,aAAaO,GAAG,CAACF,KAAKC;AACxB"}

1
node_modules/next/dist/trace/trace-uploader.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

108
node_modules/next/dist/trace/trace-uploader.js generated vendored Normal file
View File

@@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up"));
const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises"));
const _child_process = /*#__PURE__*/ _interop_require_default(require("child_process"));
const _assert = /*#__PURE__*/ _interop_require_default(require("assert"));
const _nodefetch = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/node-fetch"));
const _os = /*#__PURE__*/ _interop_require_default(require("os"));
const _readline = require("readline");
const _fs = require("fs");
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _storage = require("../telemetry/storage");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
// Predefined set of the event names to be included in the trace.
// If the trace span's name matches to one of the event names in the set,
// it'll up uploaded to the trace server.
const EVENT_FILTER = new Set([
"client-hmr-latency",
"hot-reloader",
"webpack-invalid-client",
"webpack-invalidated-server",
"navigation-to-hydration"
]);
const { NEXT_TRACE_UPLOAD_DEBUG, // An external env to allow to upload full trace without picking up the relavant spans.
// This is mainly for the debugging purpose, to allwo manual audit for full trace for the given build.
// [NOTE] This may fail if build is large and generated trace is excessively large.
NEXT_TRACE_UPLOAD_FULL } = process.env;
const isDebugEnabled = !!NEXT_TRACE_UPLOAD_DEBUG || !!NEXT_TRACE_UPLOAD_FULL;
const shouldUploadFullTrace = !!NEXT_TRACE_UPLOAD_FULL;
const [, , traceUploadUrl, mode, _isTurboSession, projectDir, distDir] = process.argv;
const isTurboSession = _isTurboSession === "true";
(async function upload() {
const nextVersion = JSON.parse(await _promises.default.readFile(_path.default.resolve(__dirname, "../../package.json"), "utf8")).version;
const telemetry = new _storage.Telemetry({
distDir
});
const projectPkgJsonPath = await (0, _findup.default)("package.json");
(0, _assert.default)(projectPkgJsonPath);
const projectPkgJson = JSON.parse(await _promises.default.readFile(projectPkgJsonPath, "utf-8"));
const pkgName = projectPkgJson.name;
const commit = _child_process.default.spawnSync(_os.default.platform() === "win32" ? "git.exe" : "git", [
"rev-parse",
"HEAD"
], {
shell: true
}).stdout.toString().trimEnd();
const readLineInterface = (0, _readline.createInterface)({
input: (0, _fs.createReadStream)(_path.default.join(projectDir, distDir, "trace")),
crlfDelay: Infinity
});
const traces = new Map();
for await (const line of readLineInterface){
const lineEvents = JSON.parse(line);
for (const event of lineEvents){
if (// Always include root spans
event.parentId === undefined || shouldUploadFullTrace || EVENT_FILTER.has(event.name)) {
if (typeof event.tags.trigger === "string" && _path.default.isAbsolute(event.tags.trigger)) {
event.tags.trigger = "[project]/" + _path.default.relative(projectDir, event.tags.trigger).replaceAll(_path.default.sep, "/");
}
let trace = traces.get(event.traceId);
if (trace === undefined) {
trace = [];
traces.set(event.traceId, trace);
}
trace.push(event);
}
}
}
const body = {
metadata: {
anonymousId: telemetry.anonymousId,
arch: _os.default.arch(),
commit,
cpus: _os.default.cpus().length,
isTurboSession,
mode,
nextVersion,
pkgName,
platform: _os.default.platform(),
sessionId: telemetry.sessionId
},
traces: [
...traces.values()
]
};
if (isDebugEnabled) {
console.log("Sending request with body", JSON.stringify(body, null, 2));
}
let res = await (0, _nodefetch.default)(traceUploadUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-trace-transfer-mode": shouldUploadFullTrace ? "full" : "default"
},
body: JSON.stringify(body)
});
if (isDebugEnabled) {
console.log("Received response", res.status, await res.json());
}
})();
//# sourceMappingURL=trace-uploader.js.map

1
node_modules/next/dist/trace/trace-uploader.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/trace/trace-uploader.ts"],"names":["EVENT_FILTER","Set","NEXT_TRACE_UPLOAD_DEBUG","NEXT_TRACE_UPLOAD_FULL","process","env","isDebugEnabled","shouldUploadFullTrace","traceUploadUrl","mode","_isTurboSession","projectDir","distDir","argv","isTurboSession","upload","nextVersion","JSON","parse","fsPromise","readFile","path","resolve","__dirname","version","telemetry","Telemetry","projectPkgJsonPath","findUp","assert","projectPkgJson","pkgName","name","commit","child_process","spawnSync","os","platform","shell","stdout","toString","trimEnd","readLineInterface","createInterface","input","createReadStream","join","crlfDelay","Infinity","traces","Map","line","lineEvents","event","parentId","undefined","has","tags","trigger","isAbsolute","relative","replaceAll","sep","trace","get","traceId","set","push","body","metadata","anonymousId","arch","cpus","length","sessionId","values","console","log","stringify","res","fetch","method","headers","status","json"],"mappings":";;;;+DAAmB;iEACG;sEACI;+DACP;kEAED;2DACH;0BACiB;oBACC;6DAChB;yBACS;;;;;;AAE1B,iEAAiE;AACjE,yEAAyE;AACzE,yCAAyC;AACzC,MAAMA,eAAe,IAAIC,IAAI;IAC3B;IACA;IACA;IACA;IACA;CACD;AAED,MAAM,EACJC,uBAAuB,EACvB,uFAAuF;AACvF,sGAAsG;AACtG,mFAAmF;AACnFC,sBAAsB,EACvB,GAAGC,QAAQC,GAAG;AAEf,MAAMC,iBAAiB,CAAC,CAACJ,2BAA2B,CAAC,CAACC;AACtD,MAAMI,wBAAwB,CAAC,CAACJ;AAEhC,MAAM,KAAKK,gBAAgBC,MAAMC,iBAAiBC,YAAYC,QAAQ,GACpER,QAAQS,IAAI;AACd,MAAMC,iBAAiBJ,oBAAoB;AA+BzC,CAAA,eAAeK;IACf,MAAMC,cAAcC,KAAKC,KAAK,CAC5B,MAAMC,iBAAS,CAACC,QAAQ,CACtBC,aAAI,CAACC,OAAO,CAACC,WAAW,uBACxB,SAEFC,OAAO;IAET,MAAMC,YAAY,IAAIC,kBAAS,CAAC;QAAEd;IAAQ;IAE1C,MAAMe,qBAAqB,MAAMC,IAAAA,eAAM,EAAC;IACxCC,IAAAA,eAAM,EAACF;IAEP,MAAMG,iBAAiBb,KAAKC,KAAK,CAC/B,MAAMC,iBAAS,CAACC,QAAQ,CAACO,oBAAoB;IAE/C,MAAMI,UAAUD,eAAeE,IAAI;IAEnC,MAAMC,SAASC,sBAAa,CACzBC,SAAS,CACRC,WAAE,CAACC,QAAQ,OAAO,UAAU,YAAY,OACxC;QAAC;QAAa;KAAO,EACrB;QAAEC,OAAO;IAAK,GAEfC,MAAM,CAACC,QAAQ,GACfC,OAAO;IAEV,MAAMC,oBAAoBC,IAAAA,y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IAEA,IAAIW,MAAM,MAAMC,IAAAA,kBAAK,EAACxE,gBAAgB;QACpCyE,QAAQ;QACRC,SAAS;YACP,gBAAgB;YAChB,yBAAyB3E,wBAAwB,SAAS;QAC5D;QACA6D,MAAMnD,KAAK6D,SAAS,CAACV;IACvB;IAEA,IAAI9D,gBAAgB;QAClBsE,QAAQC,GAAG,CAAC,qBAAqBE,IAAII,MAAM,EAAE,MAAMJ,IAAIK,IAAI;IAC7D;AACF,CAAA"}

33
node_modules/next/dist/trace/trace.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { SpanId } from './shared';
export declare enum SpanStatus {
Started = 0,
Stopped = 1
}
export declare class Span {
name: string;
id: SpanId;
parentId?: SpanId;
duration: number | null;
attrs: {
[key: string]: any;
};
status: SpanStatus;
now: number;
_start: bigint;
constructor({ name, parentId, attrs, startTime, }: {
name: string;
parentId?: SpanId;
startTime?: bigint;
attrs?: Object;
});
stop(stopTime?: bigint): void;
traceChild(name: string, attrs?: Object): Span;
manualTraceChild(name: string, startTime: bigint, stopTime: bigint, attrs?: Object): void;
setAttribute(key: string, value: any): void;
traceFn<T>(fn: (span: Span) => T): T;
traceAsyncFn<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
}
export declare const trace: (name: string, parentId?: SpanId, attrs?: {
[key: string]: string;
} | undefined) => Span;
export declare const flushAllTraces: () => Promise<void>;

120
node_modules/next/dist/trace/trace.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
SpanStatus: null,
Span: null,
trace: null,
flushAllTraces: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SpanStatus: function() {
return SpanStatus;
},
Span: function() {
return Span;
},
trace: function() {
return trace;
},
flushAllTraces: function() {
return flushAllTraces;
}
});
const _report = require("./report");
const NUM_OF_MICROSEC_IN_NANOSEC = BigInt("1000");
let count = 0;
const getId = ()=>{
count++;
return count;
};
var SpanStatus;
(function(SpanStatus) {
SpanStatus[SpanStatus["Started"] = 0] = "Started";
SpanStatus[SpanStatus["Stopped"] = 1] = "Stopped";
})(SpanStatus || (SpanStatus = {}));
class Span {
constructor({ name, parentId, attrs, startTime }){
this.name = name;
this.parentId = parentId;
this.duration = null;
this.attrs = attrs ? {
...attrs
} : {};
this.status = 0;
this.id = getId();
this._start = startTime || process.hrtime.bigint();
// hrtime cannot be used to reconstruct tracing span's actual start time
// since it does not have relation to clock time:
// `These times are relative to an arbitrary time in the past, and not related to the time of day and therefore not subject to clock drift`
// https://nodejs.org/api/process.html#processhrtimetime
// Capturing current datetime as additional metadata for external reconstruction.
this.now = Date.now();
}
// Durations are reported as microseconds. This gives 1000x the precision
// of something like Date.now(), which reports in milliseconds.
// Additionally, ~285 years can be safely represented as microseconds as
// a float64 in both JSON and JavaScript.
stop(stopTime) {
const end = stopTime || process.hrtime.bigint();
const duration = (end - this._start) / NUM_OF_MICROSEC_IN_NANOSEC;
this.status = 1;
if (duration > Number.MAX_SAFE_INTEGER) {
throw new Error(`Duration is too long to express as float64: ${duration}`);
}
const timestamp = this._start / NUM_OF_MICROSEC_IN_NANOSEC;
_report.reporter.report(this.name, Number(duration), Number(timestamp), this.id, this.parentId, this.attrs, this.now);
}
traceChild(name, attrs) {
return new Span({
name,
parentId: this.id,
attrs
});
}
manualTraceChild(name, // Start time in nanoseconds since epoch.
startTime, // Stop time in nanoseconds since epoch.
stopTime, attrs) {
const span = new Span({
name,
parentId: this.id,
attrs,
startTime
});
span.stop(stopTime);
}
setAttribute(key, value) {
this.attrs[key] = String(value);
}
traceFn(fn) {
try {
return fn(this);
} finally{
this.stop();
}
}
async traceAsyncFn(fn) {
try {
return await fn(this);
} finally{
this.stop();
}
}
}
const trace = (name, parentId, attrs)=>{
return new Span({
name,
parentId,
attrs
});
};
const flushAllTraces = ()=>_report.reporter.flushAll();
//# sourceMappingURL=trace.js.map

1
node_modules/next/dist/trace/trace.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/trace/trace.ts"],"names":["Span","trace","flushAllTraces","NUM_OF_MICROSEC_IN_NANOSEC","BigInt","count","getId","SpanStatus","Started","Stopped","constructor","name","parentId","attrs","startTime","duration","status","id","_start","process","hrtime","bigint","now","Date","stop","stopTime","end","Number","MAX_SAFE_INTEGER","Error","timestamp","reporter","report","traceChild","manualTraceChild","span","setAttribute","key","value","String","traceFn","fn","traceAsyncFn","flushAll"],"mappings":";;;;;;;;;;;;;;;;;;;;IAiBaA,IAAI;eAAJA;;IAmGAC,KAAK;eAALA;;IAQAC,cAAc;eAAdA;;;wBA3HY;AAEzB,MAAMC,6BAA6BC,OAAO;AAC1C,IAAIC,QAAQ;AACZ,MAAMC,QAAQ;IACZD;IACA,OAAOA;AACT;IAIO;UAAKE,UAAU;IAAVA,WAAAA,WACVC,aAAAA,KAAAA;IADUD,WAAAA,WAEVE,aAAAA,KAAAA;GAFUF,eAAAA;AAKL,MAAMP;IAaXU,YAAY,EACVC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,SAAS,EAMV,CAAE;QACD,IAAI,CAACH,IAAI,GAAGA;QACZ,IAAI,CAACC,QAAQ,GAAGA;QAChB,IAAI,CAACG,QAAQ,GAAG;QAChB,IAAI,CAACF,KAAK,GAAGA,QAAQ;YAAE,GAAGA,KAAK;QAAC,IAAI,CAAC;QACrC,IAAI,CAACG,MAAM,GAhCbR;QAiCE,IAAI,CAACS,EAAE,GAAGX;QACV,IAAI,CAACY,MAAM,GAAGJ,aAAaK,QAAQC,MAAM,CAACC,MAAM;QAChD,wEAAwE;QACxE,iDAAiD;QACjD,2IAA2I;QAC3I,wDAAwD;QACxD,iFAAiF;QACjF,IAAI,CAACC,GAAG,GAAGC,KAAKD,GAAG;IACrB;IAEA,yEAAyE;IACzE,+DAA+D;IAC/D,wEAAwE;IACxE,yCAAyC;IACzCE,KAAKC,QAAiB,EAAE;QACtB,MAAMC,MAAcD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W;QAAMC;QAAUC;IAAM;AAC1C;AAEO,MAAMX,iBAAiB,IAAM6B,gBAAQ,CAACY,QAAQ"}

7
node_modules/next/dist/trace/upload-trace.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export default function uploadTrace({ traceUploadUrl, mode, isTurboSession, projectDir, distDir, }: {
traceUploadUrl: string;
mode: 'dev';
isTurboSession: boolean;
projectDir: string;
distDir: string;
}): void;

36
node_modules/next/dist/trace/upload-trace.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return uploadTrace;
}
});
function uploadTrace({ traceUploadUrl, mode, isTurboSession, projectDir, distDir }) {
const { NEXT_TRACE_UPLOAD_DEBUG } = process.env;
// Note: cross-spawn is not used here as it causes
// a new command window to appear when we don't want it to
const child_process = require("child_process");
// we use spawnSync when debugging to ensure logs are piped
// correctly to stdout/stderr
const spawn = NEXT_TRACE_UPLOAD_DEBUG ? child_process.spawnSync : child_process.spawn;
spawn(process.execPath, [
require.resolve("./trace-uploader"),
traceUploadUrl,
mode,
String(isTurboSession),
projectDir,
distDir
], {
detached: !NEXT_TRACE_UPLOAD_DEBUG,
windowsHide: true,
shell: false,
...NEXT_TRACE_UPLOAD_DEBUG ? {
stdio: "inherit"
} : {}
});
}
//# sourceMappingURL=upload-trace.js.map

1
node_modules/next/dist/trace/upload-trace.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/trace/upload-trace.ts"],"names":["uploadTrace","traceUploadUrl","mode","isTurboSession","projectDir","distDir","NEXT_TRACE_UPLOAD_DEBUG","process","env","child_process","require","spawn","spawnSync","execPath","resolve","String","detached","windowsHide","shell","stdio"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA,YAAY,EAClCC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,UAAU,EACVC,OAAO,EAOR;IACC,MAAM,EAAEC,uBAAuB,EAAE,GAAGC,QAAQC,GAAG;IAE/C,kDAAkD;IAClD,0DAA0D;IAC1D,MAAMC,gBACJC,QAAQ;IAEV,2DAA2D;IAC3D,6BAA6B;IAC7B,MAAMC,QAAQL,0BACVG,cAAcG,SAAS,GACvBH,cAAcE,KAAK;IAEvBA,MACEJ,QAAQM,QAAQ,EAChB;QACEH,QAAQI,OAAO,CAAC;QAChBb;QACAC;QACAa,OAAOZ;QACPC;QACAC;KACD,EACD;QACEW,UAAU,CAACV;QACXW,aAAa;QACbC,OAAO;QACP,GAAIZ,0BACA;YACEa,OAAO;QACT,IACA,CAAC,CAAC;IACR;AAEJ"}