@datadog/esbuild-plugin 2.3.1-dev-9 → 2.3.1-dev-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.js +300 -368
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +290 -358
- package/dist/src/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/src/index.mjs
CHANGED
|
@@ -7,9 +7,9 @@ import { lstat, readdir as readdir$1, readlink, realpath } from 'node:fs/promise
|
|
|
7
7
|
import { EventEmitter as EventEmitter$1 } from 'node:events';
|
|
8
8
|
import Stream$1 from 'node:stream';
|
|
9
9
|
import { StringDecoder } from 'node:string_decoder';
|
|
10
|
-
import
|
|
10
|
+
import path$i, { resolve as resolve$1, extname, isAbsolute, normalize as normalize$1 } from 'path';
|
|
11
11
|
import require$$0$1 from 'tty';
|
|
12
|
-
import require$$1
|
|
12
|
+
import require$$1 from 'util';
|
|
13
13
|
import { spawn } from 'child_process';
|
|
14
14
|
import { URL as URL$1, fileURLToPath as fileURLToPath$1 } from 'url';
|
|
15
15
|
import { readFile as readFile$1 } from 'fs/promises';
|
|
@@ -21,6 +21,7 @@ import require$$5 from 'assert';
|
|
|
21
21
|
import { performance as performance$1 } from 'perf_hooks';
|
|
22
22
|
import * as querystring from 'querystring';
|
|
23
23
|
import process2 from 'process';
|
|
24
|
+
import esbuild from 'esbuild';
|
|
24
25
|
|
|
25
26
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
26
27
|
|
|
@@ -2271,8 +2272,8 @@ var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
|
|
|
2271
2272
|
|
|
2272
2273
|
const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
|
|
2273
2274
|
const PLUGIN_NAME$4 = "datadog-injection-plugin";
|
|
2274
|
-
const
|
|
2275
|
-
const
|
|
2275
|
+
const INJECTED_FILE = "__datadog-helper-file";
|
|
2276
|
+
const INJECTED_FILE_PATH = `${INJECTED_FILE}.js`;
|
|
2276
2277
|
const DISTANT_FILE_RX = /^https?:\/\//;
|
|
2277
2278
|
|
|
2278
2279
|
const formatDuration = (duration) => {
|
|
@@ -2283,7 +2284,7 @@ const formatDuration = (duration) => {
|
|
|
2283
2284
|
const minutes = d.getUTCMinutes();
|
|
2284
2285
|
const seconds = d.getUTCSeconds();
|
|
2285
2286
|
const milliseconds = d.getUTCMilliseconds();
|
|
2286
|
-
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds}ms`.trim();
|
|
2287
|
+
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds ? `${milliseconds}ms` : ""}`.trim();
|
|
2287
2288
|
};
|
|
2288
2289
|
const getResolvedPath = (filepath) => {
|
|
2289
2290
|
try {
|
|
@@ -2353,7 +2354,7 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
|
|
|
2353
2354
|
const rightStop = stringLength - leftStop;
|
|
2354
2355
|
return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
|
|
2355
2356
|
};
|
|
2356
|
-
const
|
|
2357
|
+
const isInjectionFile = (filename) => filename.includes(INJECTED_FILE);
|
|
2357
2358
|
|
|
2358
2359
|
var balancedMatch = balanced$1;
|
|
2359
2360
|
function balanced$1(a, b, str) {
|
|
@@ -11309,18 +11310,13 @@ const cleanReport = (report, filepath, filter) => {
|
|
|
11309
11310
|
const cleanedPath = cleanPath(reportFilepath);
|
|
11310
11311
|
if (
|
|
11311
11312
|
// Don't add injections.
|
|
11312
|
-
|
|
11313
|
+
isInjectionFile(reportFilepath) || // Don't add itself into it.
|
|
11313
11314
|
cleanedPath === filepath || // Remove common specific files injected by bundlers.
|
|
11314
11315
|
BUNDLER_SPECIFICS.includes(cleanedPath)
|
|
11315
11316
|
) {
|
|
11316
11317
|
continue;
|
|
11317
11318
|
}
|
|
11318
|
-
|
|
11319
|
-
const filteredValue = filter(cleanedPath);
|
|
11320
|
-
if (filteredValue) {
|
|
11321
|
-
cleanedReport.add(filteredValue);
|
|
11322
|
-
}
|
|
11323
|
-
} else {
|
|
11319
|
+
{
|
|
11324
11320
|
cleanedReport.add(cleanedPath);
|
|
11325
11321
|
}
|
|
11326
11322
|
}
|
|
@@ -11330,16 +11326,16 @@ const cleanPath = (filepath) => {
|
|
|
11330
11326
|
return filepath.split("!").pop().split(QUERY_RX).shift().replace(/^[^\w\s.,!@#$%^&*()=+~`\-/]+/, "");
|
|
11331
11327
|
};
|
|
11332
11328
|
const getAbsolutePath = (cwd, filepath) => {
|
|
11333
|
-
if (
|
|
11329
|
+
if (isInjectionFile(filepath)) {
|
|
11334
11330
|
return INJECTED_FILE;
|
|
11335
11331
|
}
|
|
11336
11332
|
if (filepath.startsWith(cwd)) {
|
|
11337
11333
|
return filepath;
|
|
11338
11334
|
}
|
|
11339
|
-
return
|
|
11335
|
+
return path$i.resolve(cwd, filepath);
|
|
11340
11336
|
};
|
|
11341
11337
|
const cleanName = (context, filepath) => {
|
|
11342
|
-
if (
|
|
11338
|
+
if (isInjectionFile(filepath)) {
|
|
11343
11339
|
return INJECTED_FILE;
|
|
11344
11340
|
}
|
|
11345
11341
|
if (filepath === "unknown") {
|
|
@@ -11413,8 +11409,24 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11413
11409
|
const reportOutputsIndexed = {};
|
|
11414
11410
|
const metaInputsIndexed = reIndexMeta(result.metafile.inputs, cwd);
|
|
11415
11411
|
const metaOutputsIndexed = reIndexMeta(result.metafile.outputs, cwd);
|
|
11412
|
+
const getRealPathFromInjectionProxy = (entryPoint) => {
|
|
11413
|
+
if (!isInjectionFile(entryPoint)) {
|
|
11414
|
+
return entryPoint;
|
|
11415
|
+
}
|
|
11416
|
+
const metaInput = metaInputsIndexed[getAbsolutePath(cwd, entryPoint)];
|
|
11417
|
+
if (!metaInput) {
|
|
11418
|
+
return entryPoint;
|
|
11419
|
+
}
|
|
11420
|
+
const actualImport = metaInput.imports.find(
|
|
11421
|
+
(imp) => !isInjectionFile(imp.path)
|
|
11422
|
+
);
|
|
11423
|
+
if (!actualImport) {
|
|
11424
|
+
return entryPoint;
|
|
11425
|
+
}
|
|
11426
|
+
return actualImport.path;
|
|
11427
|
+
};
|
|
11416
11428
|
for (const [filename, input] of Object.entries(result.metafile.inputs)) {
|
|
11417
|
-
if (
|
|
11429
|
+
if (isInjectionFile(filename)) {
|
|
11418
11430
|
continue;
|
|
11419
11431
|
}
|
|
11420
11432
|
const filepath = getAbsolutePath(cwd, filename);
|
|
@@ -11435,7 +11447,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11435
11447
|
const cleanedName = cleanName(context, fullPath);
|
|
11436
11448
|
const inputFiles = [];
|
|
11437
11449
|
for (const inputName of Object.keys(output.inputs)) {
|
|
11438
|
-
if (
|
|
11450
|
+
if (isInjectionFile(inputName)) {
|
|
11439
11451
|
continue;
|
|
11440
11452
|
}
|
|
11441
11453
|
const inputFound = reportInputsIndexed[getAbsolutePath(cwd, inputName)];
|
|
@@ -11468,7 +11480,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11468
11480
|
if (!output.entryPoint) {
|
|
11469
11481
|
continue;
|
|
11470
11482
|
}
|
|
11471
|
-
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, output.entryPoint)];
|
|
11483
|
+
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, getRealPathFromInjectionProxy(output.entryPoint))];
|
|
11472
11484
|
if (inputFile) {
|
|
11473
11485
|
if (!entryNames.get(inputFile.name)) {
|
|
11474
11486
|
continue;
|
|
@@ -11503,7 +11515,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11503
11515
|
};
|
|
11504
11516
|
const FILE_EXCEPTIONS_RX = /(<runtime>|https:|file:|data:|#)/g;
|
|
11505
11517
|
const isFileSupported = (filePath) => {
|
|
11506
|
-
if (
|
|
11518
|
+
if (isInjectionFile(filePath) || filePath.match(FILE_EXCEPTIONS_RX)) {
|
|
11507
11519
|
return false;
|
|
11508
11520
|
}
|
|
11509
11521
|
return true;
|
|
@@ -11780,239 +11792,183 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11780
11792
|
};
|
|
11781
11793
|
|
|
11782
11794
|
const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11795
|
+
const inputs = [];
|
|
11796
|
+
const outputs = [];
|
|
11797
|
+
const entries = [];
|
|
11798
|
+
const warnings = [];
|
|
11799
|
+
const reportInputsIndexed = /* @__PURE__ */ new Map();
|
|
11800
|
+
const reportOutputsIndexed = /* @__PURE__ */ new Map();
|
|
11801
|
+
const modulesPerFile = /* @__PURE__ */ new Map();
|
|
11802
|
+
const tempSourcemaps = [];
|
|
11803
|
+
const tempDeps = /* @__PURE__ */ new Map();
|
|
11804
|
+
const isModuleSupported = (moduleIdentifier) => {
|
|
11805
|
+
return (
|
|
11806
|
+
// Ignore unidentified modules and runtimes.
|
|
11807
|
+
!!moduleIdentifier && !moduleIdentifier.startsWith("webpack/runtime") && !moduleIdentifier.includes("/webpack4/buildin/") && !moduleIdentifier.startsWith("multi ")
|
|
11808
|
+
);
|
|
11809
|
+
};
|
|
11810
|
+
const warn = (warning) => {
|
|
11811
|
+
warnings.push(warning);
|
|
11812
|
+
log(warning, "warn");
|
|
11813
|
+
};
|
|
11814
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
11815
|
+
compilation.hooks.finishModules.tap(PLUGIN_NAME, (finishedModules) => {
|
|
11816
|
+
const getModuleFromDep = (dep) => {
|
|
11817
|
+
return compilation.moduleGraph ? compilation.moduleGraph.getModule(dep) : dep.module;
|
|
11818
|
+
};
|
|
11819
|
+
for (const module of finishedModules) {
|
|
11820
|
+
const moduleIdentifier = module.identifier();
|
|
11821
|
+
const dependencies = new Set(
|
|
11822
|
+
[...module.dependencies, ...module.blocks.flatMap((b) => b.dependencies)].filter(
|
|
11823
|
+
(dep) => (
|
|
11824
|
+
// Ignore side effects.
|
|
11825
|
+
dep.type !== "harmony side effect evaluation" && // Ignore those we can't identify.
|
|
11826
|
+
getModuleFromDep(dep)?.identifier() && // Only what we support.
|
|
11827
|
+
isModuleSupported(getModuleFromDep(dep)?.identifier()) && // Don't add itself as a dependency.
|
|
11828
|
+
getModuleFromDep(dep)?.identifier() !== moduleIdentifier
|
|
11829
|
+
)
|
|
11830
|
+
).map((dep) => {
|
|
11831
|
+
return getModuleFromDep(dep)?.identifier();
|
|
11832
|
+
}).filter(Boolean)
|
|
11833
|
+
);
|
|
11834
|
+
if (!isModuleSupported(moduleIdentifier)) {
|
|
11835
|
+
continue;
|
|
11836
|
+
}
|
|
11837
|
+
for (const depIdentifier of dependencies) {
|
|
11838
|
+
const depDeps = tempDeps.get(depIdentifier) || {
|
|
11839
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11840
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11841
|
+
};
|
|
11842
|
+
depDeps.dependents.add(moduleIdentifier);
|
|
11843
|
+
tempDeps.set(depIdentifier, depDeps);
|
|
11844
|
+
}
|
|
11845
|
+
const moduleDeps = tempDeps.get(moduleIdentifier) || {
|
|
11846
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11847
|
+
dependencies: /* @__PURE__ */ new Set()
|
|
11848
|
+
};
|
|
11849
|
+
for (const moduleDep of dependencies) {
|
|
11850
|
+
moduleDeps.dependencies.add(moduleDep);
|
|
11851
|
+
}
|
|
11852
|
+
tempDeps.set(moduleIdentifier, moduleDeps);
|
|
11853
|
+
const file = {
|
|
11854
|
+
size: module.size() || 0,
|
|
11855
|
+
name: cleanName(context, moduleIdentifier),
|
|
11856
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11857
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11858
|
+
filepath: moduleIdentifier,
|
|
11859
|
+
type: getType(moduleIdentifier)
|
|
11860
|
+
};
|
|
11861
|
+
inputs.push(file);
|
|
11862
|
+
reportInputsIndexed.set(moduleIdentifier, file);
|
|
11863
|
+
}
|
|
11864
|
+
for (const input of inputs) {
|
|
11865
|
+
const depsReport = tempDeps.get(input.filepath);
|
|
11866
|
+
if (!depsReport) {
|
|
11867
|
+
warn(`Could not find dependency report for ${input.name}`);
|
|
11868
|
+
continue;
|
|
11869
|
+
}
|
|
11870
|
+
for (const dependency of depsReport.dependencies) {
|
|
11871
|
+
const depInput = reportInputsIndexed.get(dependency);
|
|
11872
|
+
if (!depInput) {
|
|
11873
|
+
warn(`Could not find input of dependency ${dependency}`);
|
|
11874
|
+
continue;
|
|
11839
11875
|
}
|
|
11876
|
+
input.dependencies.add(depInput);
|
|
11840
11877
|
}
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11878
|
+
for (const dependent of depsReport.dependents) {
|
|
11879
|
+
const depInput = reportInputsIndexed.get(dependent);
|
|
11880
|
+
if (!depInput) {
|
|
11881
|
+
warn(`Could not find input of dependent ${dependent}`);
|
|
11882
|
+
continue;
|
|
11883
|
+
}
|
|
11884
|
+
input.dependents.add(depInput);
|
|
11845
11885
|
}
|
|
11846
|
-
|
|
11847
|
-
|
|
11886
|
+
}
|
|
11887
|
+
});
|
|
11888
|
+
});
|
|
11889
|
+
compiler.hooks.afterEmit.tap(PLUGIN_NAME, (result) => {
|
|
11890
|
+
const chunks = result.chunks;
|
|
11891
|
+
const assets = result.getAssets();
|
|
11892
|
+
const getChunkFiles = (chunk) => {
|
|
11893
|
+
return [...chunk.files || [], ...chunk.auxiliaryFiles || []].map(
|
|
11894
|
+
(f) => getAbsolutePath(context.bundler.outDir, f)
|
|
11895
|
+
);
|
|
11896
|
+
};
|
|
11897
|
+
const chunkGraph = result.chunkGraph;
|
|
11898
|
+
for (const chunk of chunks) {
|
|
11899
|
+
const files = getChunkFiles(chunk);
|
|
11900
|
+
const chunkModules = (chunkGraph ? chunkGraph?.getChunkModules(chunk) : chunk.getModules()).flatMap((m) => {
|
|
11901
|
+
return "modules" in m && Array.isArray(m.modules) ? m.modules.map((m2) => m2.identifier()) : m.identifier();
|
|
11902
|
+
}).filter(isModuleSupported);
|
|
11903
|
+
for (const file of files) {
|
|
11904
|
+
if (getType(file) === "map") {
|
|
11905
|
+
continue;
|
|
11848
11906
|
}
|
|
11907
|
+
const fileModules = modulesPerFile.get(file) || [];
|
|
11908
|
+
modulesPerFile.set(file, [...fileModules, ...chunkModules]);
|
|
11849
11909
|
}
|
|
11850
11910
|
}
|
|
11851
11911
|
for (const asset of assets) {
|
|
11852
11912
|
const file = {
|
|
11853
|
-
size: asset.
|
|
11913
|
+
size: asset.source.size() || 0,
|
|
11854
11914
|
name: asset.name,
|
|
11855
11915
|
inputs: [],
|
|
11856
11916
|
filepath: getAbsolutePath(context.bundler.outDir, asset.name),
|
|
11857
11917
|
type: getType(asset.name)
|
|
11858
11918
|
};
|
|
11859
|
-
reportOutputsIndexed
|
|
11919
|
+
reportOutputsIndexed.set(file.filepath, file);
|
|
11860
11920
|
outputs.push(file);
|
|
11861
11921
|
if (file.type === "map") {
|
|
11862
11922
|
tempSourcemaps.push(file);
|
|
11863
|
-
}
|
|
11864
|
-
}
|
|
11865
|
-
for (const sourcemap of tempSourcemaps) {
|
|
11866
|
-
const outputFound = reportOutputsIndexed[sourcemap.filepath.replace(/\.map$/, "")];
|
|
11867
|
-
if (!outputFound) {
|
|
11868
|
-
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
11869
11923
|
continue;
|
|
11870
11924
|
}
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
return module.nameForCondition ? module.nameForCondition : module.name ? getAbsolutePath(context.cwd, module.name) : module.identifier ? module.identifier : "unknown";
|
|
11875
|
-
};
|
|
11876
|
-
const isModuleSupported = (module) => {
|
|
11877
|
-
if (isInjection(getModulePath(module)) || // Do not report runtime modules as they are very specific to webpack.
|
|
11878
|
-
module.moduleType === "runtime" || module.name?.startsWith("(webpack)") || // Also ignore orphan modules
|
|
11879
|
-
module.type === "orphan modules") {
|
|
11880
|
-
return false;
|
|
11881
|
-
}
|
|
11882
|
-
return true;
|
|
11883
|
-
};
|
|
11884
|
-
const getModules = (reason) => {
|
|
11885
|
-
const { moduleIdentifier, moduleId } = reason;
|
|
11886
|
-
if (!moduleIdentifier && !moduleId) {
|
|
11887
|
-
return [];
|
|
11888
|
-
}
|
|
11889
|
-
const modulesFound = [];
|
|
11890
|
-
if (moduleId) {
|
|
11891
|
-
const module = modulePerId.get(moduleId);
|
|
11892
|
-
if (module) {
|
|
11893
|
-
modulesFound.push(module);
|
|
11894
|
-
}
|
|
11895
|
-
const concatModules = concatModulesPerId.get(moduleId);
|
|
11896
|
-
if (concatModules) {
|
|
11897
|
-
modulesFound.push(...concatModules);
|
|
11898
|
-
}
|
|
11899
|
-
}
|
|
11900
|
-
if (moduleIdentifier) {
|
|
11901
|
-
const module = modulePerIdentifier.get(moduleIdentifier);
|
|
11902
|
-
if (module) {
|
|
11903
|
-
modulesFound.push(module);
|
|
11904
|
-
}
|
|
11905
|
-
const concatModules = concatModulesPerIdentifier.get(moduleIdentifier);
|
|
11906
|
-
if (concatModules) {
|
|
11907
|
-
modulesFound.push(...concatModules);
|
|
11908
|
-
}
|
|
11909
|
-
}
|
|
11910
|
-
return Array.from(new Set(modulesFound.map(getModulePath)));
|
|
11911
|
-
};
|
|
11912
|
-
const modulesDone = /* @__PURE__ */ new Set();
|
|
11913
|
-
for (const module of modules) {
|
|
11914
|
-
if (!isModuleSupported(module)) {
|
|
11925
|
+
const fileModules = modulesPerFile.get(file.filepath);
|
|
11926
|
+
if (!fileModules) {
|
|
11927
|
+
warn(`Could not find modules for ${file.name}`);
|
|
11915
11928
|
continue;
|
|
11916
11929
|
}
|
|
11917
|
-
const
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
modulesDone.add(modulePath);
|
|
11922
|
-
if (modulePath === "unknown") {
|
|
11923
|
-
warn(`Unknown module: ${JSON.stringify(module)}`);
|
|
11924
|
-
}
|
|
11925
|
-
if (module.reasons) {
|
|
11926
|
-
const moduleDeps = tempDeps[modulePath] || {
|
|
11927
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11928
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11929
|
-
};
|
|
11930
|
-
const dependents = module.reasons.flatMap(getModules);
|
|
11931
|
-
for (const dependent of dependents) {
|
|
11932
|
-
const reasonDeps = tempDeps[dependent] || {
|
|
11933
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11934
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11935
|
-
};
|
|
11936
|
-
reasonDeps.dependencies.add(modulePath);
|
|
11937
|
-
tempDeps[dependent] = reasonDeps;
|
|
11938
|
-
moduleDeps.dependents.add(dependent);
|
|
11939
|
-
}
|
|
11940
|
-
tempDeps[modulePath] = moduleDeps;
|
|
11941
|
-
}
|
|
11942
|
-
const file = {
|
|
11943
|
-
size: module.size || 0,
|
|
11944
|
-
name: cleanName(context, modulePath),
|
|
11945
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11946
|
-
dependents: /* @__PURE__ */ new Set(),
|
|
11947
|
-
filepath: modulePath,
|
|
11948
|
-
type: getType(modulePath)
|
|
11949
|
-
};
|
|
11950
|
-
for (const chunkId of module.chunks || []) {
|
|
11951
|
-
const chunkFound = chunks.find((chunk) => chunk.id === chunkId);
|
|
11952
|
-
if (!chunkFound) {
|
|
11953
|
-
continue;
|
|
11954
|
-
}
|
|
11955
|
-
const chunkFiles = chunkFound.files || [];
|
|
11956
|
-
if (chunkFound.auxiliaryFiles) {
|
|
11957
|
-
chunkFiles.push(...chunkFound.auxiliaryFiles);
|
|
11958
|
-
}
|
|
11959
|
-
const outputFound = outputs.find((output) => chunkFiles.includes(output.name));
|
|
11960
|
-
if (!outputFound) {
|
|
11961
|
-
warn(`Output not found for ${file.name}`);
|
|
11930
|
+
for (const moduleIdentifier of fileModules) {
|
|
11931
|
+
const inputFound = reportInputsIndexed.get(moduleIdentifier);
|
|
11932
|
+
if (!inputFound) {
|
|
11933
|
+
warn(`Could not find input of ${moduleIdentifier}`);
|
|
11962
11934
|
continue;
|
|
11963
11935
|
}
|
|
11964
|
-
|
|
11965
|
-
outputFound.inputs.push(file);
|
|
11966
|
-
}
|
|
11936
|
+
file.inputs.push(inputFound);
|
|
11967
11937
|
}
|
|
11968
|
-
reportInputsIndexed[modulePath] = file;
|
|
11969
|
-
inputs.push(file);
|
|
11970
11938
|
}
|
|
11971
|
-
const
|
|
11972
|
-
const
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
};
|
|
11978
|
-
for (const input of inputs) {
|
|
11979
|
-
const depsReport = tempDeps[input.filepath];
|
|
11980
|
-
if (!depsReport) {
|
|
11981
|
-
warn(`Could not find dependency report for ${input.name}`);
|
|
11939
|
+
for (const sourcemap of tempSourcemaps) {
|
|
11940
|
+
const outputFound = reportOutputsIndexed.get(
|
|
11941
|
+
sourcemap.filepath.replace(/\.map$/, "")
|
|
11942
|
+
);
|
|
11943
|
+
if (!outputFound) {
|
|
11944
|
+
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
11982
11945
|
continue;
|
|
11983
11946
|
}
|
|
11984
|
-
|
|
11985
|
-
input.dependents = cleanReport(depsReport.dependents, input.filepath, getInput);
|
|
11947
|
+
sourcemap.inputs.push(outputFound);
|
|
11986
11948
|
}
|
|
11987
|
-
for (const [name,
|
|
11949
|
+
for (const [name, entrypoint] of result.entrypoints) {
|
|
11988
11950
|
const entryOutputs = [];
|
|
11989
11951
|
const entryInputs = [];
|
|
11990
11952
|
let size = 0;
|
|
11991
|
-
const
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
if (!assetPath || !reportOutputsIndexed[assetPath]) {
|
|
12003
|
-
warn(`Could not find output of ${JSON.stringify(asset)}`);
|
|
11953
|
+
const entryFiles = entrypoint.chunks.flatMap(getChunkFiles);
|
|
11954
|
+
const entryFilename = entrypoint.chunks.filter(
|
|
11955
|
+
(c) => (
|
|
11956
|
+
// Webpack5 forces you to use the chunkGraph to get the modules.
|
|
11957
|
+
chunkGraph ? chunkGraph.getNumberOfEntryModules(c) > 0 : c.hasEntryModule()
|
|
11958
|
+
)
|
|
11959
|
+
).flatMap((c) => Array.from(c.files))[0];
|
|
11960
|
+
for (const file2 of entryFiles) {
|
|
11961
|
+
const outputFound = reportOutputsIndexed.get(file2);
|
|
11962
|
+
if (!file2 || !outputFound) {
|
|
11963
|
+
warn(`Could not find output of ${JSON.stringify(file2)}`);
|
|
12004
11964
|
continue;
|
|
12005
11965
|
}
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
entryInputs.push(...outputFound.inputs);
|
|
12011
|
-
size += outputFound.size;
|
|
12012
|
-
}
|
|
11966
|
+
if (outputFound.type !== "map" && !entryOutputs.includes(outputFound)) {
|
|
11967
|
+
entryOutputs.push(outputFound);
|
|
11968
|
+
entryInputs.push(...outputFound.inputs);
|
|
11969
|
+
size += outputFound.size;
|
|
12013
11970
|
}
|
|
12014
11971
|
}
|
|
12015
|
-
const entryFilename = stats.assetsByChunkName?.[name]?.[0];
|
|
12016
11972
|
const file = {
|
|
12017
11973
|
name,
|
|
12018
11974
|
filepath: entryFilename ? getAbsolutePath(context.bundler.outDir, entryFilename) : "unknown",
|
|
@@ -12023,6 +11979,8 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
12023
11979
|
};
|
|
12024
11980
|
entries.push(file);
|
|
12025
11981
|
}
|
|
11982
|
+
context.build.errors = result.errors.map((err) => err.message);
|
|
11983
|
+
context.build.warnings = [...warnings, ...result.warnings.map((err) => err.message)];
|
|
12026
11984
|
context.build.inputs = inputs;
|
|
12027
11985
|
context.build.outputs = outputs;
|
|
12028
11986
|
context.build.entries = entries;
|
|
@@ -12069,7 +12027,7 @@ const getBundlerReportPlugin = (opts, globalContext) => {
|
|
|
12069
12027
|
globalContext.bundler.outDir = build.initialOptions.outdir;
|
|
12070
12028
|
}
|
|
12071
12029
|
if (build.initialOptions.outfile) {
|
|
12072
|
-
globalContext.bundler.outDir =
|
|
12030
|
+
globalContext.bundler.outDir = path$i.dirname(build.initialOptions.outfile);
|
|
12073
12031
|
}
|
|
12074
12032
|
build.initialOptions.metafile = true;
|
|
12075
12033
|
}
|
|
@@ -12990,7 +12948,7 @@ function requireNode$1 () {
|
|
|
12990
12948
|
hasRequiredNode$1 = 1;
|
|
12991
12949
|
(function (module, exports) {
|
|
12992
12950
|
const tty = require$$0$1;
|
|
12993
|
-
const util = require$$1
|
|
12951
|
+
const util = require$$1;
|
|
12994
12952
|
|
|
12995
12953
|
/**
|
|
12996
12954
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -13903,7 +13861,7 @@ function requireNode () {
|
|
|
13903
13861
|
hasRequiredNode = 1;
|
|
13904
13862
|
(function (module, exports) {
|
|
13905
13863
|
const tty = require$$0$1;
|
|
13906
|
-
const util = require$$1
|
|
13864
|
+
const util = require$$1;
|
|
13907
13865
|
|
|
13908
13866
|
/**
|
|
13909
13867
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -19049,7 +19007,7 @@ const processInjections = async (toInject, log) => {
|
|
|
19049
19007
|
return results.filter(Boolean);
|
|
19050
19008
|
};
|
|
19051
19009
|
|
|
19052
|
-
const getInjectionPlugins = (opts, context, toInject) => {
|
|
19010
|
+
const getInjectionPlugins = (bundler, opts, context, toInject) => {
|
|
19053
19011
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$4);
|
|
19054
19012
|
const contentToInject = [];
|
|
19055
19013
|
const getContentToInject = () => {
|
|
@@ -19071,27 +19029,7 @@ ${after}`;
|
|
|
19071
19029
|
return "";
|
|
19072
19030
|
}
|
|
19073
19031
|
};
|
|
19074
|
-
|
|
19075
|
-
// Resolve the injected file for all bundlers.
|
|
19076
|
-
{
|
|
19077
|
-
name: RESOLUTION_PLUGIN_NAME,
|
|
19078
|
-
enforce: "pre",
|
|
19079
|
-
async resolveId(id) {
|
|
19080
|
-
if (isInjection(id)) {
|
|
19081
|
-
return { id, moduleSideEffects: true };
|
|
19082
|
-
}
|
|
19083
|
-
},
|
|
19084
|
-
loadInclude(id) {
|
|
19085
|
-
if (isInjection(id)) {
|
|
19086
|
-
return true;
|
|
19087
|
-
}
|
|
19088
|
-
},
|
|
19089
|
-
load(id) {
|
|
19090
|
-
if (isInjection(id)) {
|
|
19091
|
-
return getContentToInject();
|
|
19092
|
-
}
|
|
19093
|
-
}
|
|
19094
|
-
},
|
|
19032
|
+
const plugins = [
|
|
19095
19033
|
// Prepare and fetch the content to inject for all bundlers.
|
|
19096
19034
|
{
|
|
19097
19035
|
name: PREPARATION_PLUGIN_NAME,
|
|
@@ -19100,103 +19038,93 @@ ${after}`;
|
|
|
19100
19038
|
async buildStart() {
|
|
19101
19039
|
const results = await processInjections(toInject, log);
|
|
19102
19040
|
contentToInject.push(...results);
|
|
19041
|
+
if (context.bundler.name !== "esbuild") {
|
|
19042
|
+
return;
|
|
19043
|
+
}
|
|
19044
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19045
|
+
context.bundler.outDir,
|
|
19046
|
+
INJECTED_FILE_PATH
|
|
19047
|
+
);
|
|
19048
|
+
try {
|
|
19049
|
+
await fs$j.promises.mkdir(path$i.dirname(absolutePathInjectFile), {
|
|
19050
|
+
recursive: true
|
|
19051
|
+
});
|
|
19052
|
+
await fs$j.promises.writeFile(absolutePathInjectFile, getContentToInject());
|
|
19053
|
+
} catch (e) {
|
|
19054
|
+
log(`Could not create the file: ${e.message}`, "error");
|
|
19055
|
+
}
|
|
19056
|
+
},
|
|
19057
|
+
async buildEnd() {
|
|
19058
|
+
if (context.bundler.name !== "esbuild") {
|
|
19059
|
+
return;
|
|
19060
|
+
}
|
|
19061
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19062
|
+
context.bundler.outDir,
|
|
19063
|
+
INJECTED_FILE_PATH
|
|
19064
|
+
);
|
|
19065
|
+
await fs$j.promises.rm(absolutePathInjectFile, {
|
|
19066
|
+
force: true,
|
|
19067
|
+
maxRetries: 3,
|
|
19068
|
+
recursive: true
|
|
19069
|
+
});
|
|
19103
19070
|
}
|
|
19104
19071
|
},
|
|
19105
|
-
// Inject the
|
|
19072
|
+
// Inject the file that will be home of all injected content.
|
|
19106
19073
|
// Each bundler has its own way to inject a file.
|
|
19107
19074
|
{
|
|
19108
19075
|
name: PLUGIN_NAME$4,
|
|
19109
19076
|
esbuild: {
|
|
19110
19077
|
setup(build) {
|
|
19111
19078
|
const { initialOptions } = build;
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
}
|
|
19119
|
-
return {
|
|
19120
|
-
pluginName: PLUGIN_NAME$4,
|
|
19121
|
-
path: require$$1.isAbsolute(args.path) ? args.path : require$$1.join(args.resolveDir, args.path),
|
|
19122
|
-
pluginData: {
|
|
19123
|
-
isInjectionResolver: true,
|
|
19124
|
-
originalPath: args.path,
|
|
19125
|
-
originalResolveDir: args.resolveDir
|
|
19126
|
-
},
|
|
19127
|
-
// Adding a suffix prevents esbuild from marking the entrypoint as resolved,
|
|
19128
|
-
// avoiding a dependency loop with the proxy module.
|
|
19129
|
-
// This ensures esbuild continues to traverse the module tree
|
|
19130
|
-
// and re-resolves the entrypoint when imported from the proxy module.
|
|
19131
|
-
suffix: "?datadogInjected=true"
|
|
19132
|
-
};
|
|
19133
|
-
});
|
|
19134
|
-
build.onLoad({ filter: /.*/ }, async (args) => {
|
|
19135
|
-
if (!args.pluginData?.isInjectionResolver) {
|
|
19136
|
-
return null;
|
|
19137
|
-
}
|
|
19138
|
-
const originalPath = args.pluginData.originalPath;
|
|
19139
|
-
const originalResolveDir = args.pluginData.originalResolveDir;
|
|
19140
|
-
const contents = `
|
|
19141
|
-
import ${JSON.stringify(INJECTED_FILE)};
|
|
19142
|
-
import * as OriginalModule from ${JSON.stringify(originalPath)};
|
|
19143
|
-
export default OriginalModule['default'.toString()];
|
|
19144
|
-
export * from ${JSON.stringify(originalPath)};
|
|
19145
|
-
`;
|
|
19146
|
-
return {
|
|
19147
|
-
loader: "js",
|
|
19148
|
-
pluginName: PLUGIN_NAME$4,
|
|
19149
|
-
contents,
|
|
19150
|
-
resolveDir: originalResolveDir
|
|
19151
|
-
};
|
|
19152
|
-
});
|
|
19079
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19080
|
+
context.bundler.outDir,
|
|
19081
|
+
INJECTED_FILE_PATH
|
|
19082
|
+
);
|
|
19083
|
+
initialOptions.inject = initialOptions.inject || [];
|
|
19084
|
+
initialOptions.inject.push(absolutePathInjectFile);
|
|
19153
19085
|
}
|
|
19154
19086
|
},
|
|
19155
19087
|
webpack: (compiler) => {
|
|
19156
|
-
const
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
context.bundler.variant === "5"
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19088
|
+
const BannerPlugin = compiler?.webpack?.BannerPlugin || bundler?.BannerPlugin || bundler?.default?.BannerPlugin;
|
|
19089
|
+
compiler?.webpack?.ChunkGraph || bundler?.ChunkGraph || bundler?.default?.ChunkGraph;
|
|
19090
|
+
if (!BannerPlugin) {
|
|
19091
|
+
log("Missing BannerPlugin", "error");
|
|
19092
|
+
}
|
|
19093
|
+
let chunkGraph;
|
|
19094
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME$4, (compilation) => {
|
|
19095
|
+
compilation.hooks.afterChunks.tap(PLUGIN_NAME$4, () => {
|
|
19096
|
+
chunkGraph = compilation.chunkGraph;
|
|
19097
|
+
});
|
|
19098
|
+
});
|
|
19099
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
19100
|
+
compiler.options.plugins.push(
|
|
19101
|
+
new BannerPlugin({
|
|
19102
|
+
// Not wrapped in comments.
|
|
19103
|
+
raw: true,
|
|
19104
|
+
// Doesn't seem to work, but it's supposed to only add
|
|
19105
|
+
// the banner to entry modules.
|
|
19106
|
+
entryOnly: true,
|
|
19107
|
+
banner(data) {
|
|
19108
|
+
if (context.bundler.variant === "5") {
|
|
19109
|
+
if (!chunkGraph || chunkGraph.getNumberOfEntryModules(data.chunk) === 0) {
|
|
19110
|
+
return "";
|
|
19111
|
+
}
|
|
19112
|
+
return getContentToInject();
|
|
19113
|
+
} else {
|
|
19114
|
+
if (!data.chunk?.hasEntryModule()) {
|
|
19115
|
+
return "";
|
|
19116
|
+
}
|
|
19117
|
+
return getContentToInject();
|
|
19182
19118
|
}
|
|
19183
|
-
const entry = originalEntry[entryName];
|
|
19184
|
-
newEntry[entryName] = // Webpack 4 and 5 have different entry formats.
|
|
19185
|
-
typeof entry === "string" ? [INJECTED_FILE, entry] : {
|
|
19186
|
-
...entry,
|
|
19187
|
-
import: [INJECTED_FILE, ...entry.import]
|
|
19188
|
-
};
|
|
19189
19119
|
}
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
return [INJECTED_FILE, originalEntry];
|
|
19193
|
-
};
|
|
19194
|
-
compiler.options.entry = injectEntry(compiler.options.entry);
|
|
19120
|
+
})
|
|
19121
|
+
);
|
|
19195
19122
|
},
|
|
19196
19123
|
rollup: rollupInjectionPlugin,
|
|
19197
19124
|
vite: rollupInjectionPlugin
|
|
19198
19125
|
}
|
|
19199
19126
|
];
|
|
19127
|
+
return plugins;
|
|
19200
19128
|
};
|
|
19201
19129
|
|
|
19202
19130
|
const getInternalPlugins = (options, meta) => {
|
|
@@ -19210,7 +19138,8 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19210
19138
|
name: meta.framework,
|
|
19211
19139
|
fullName: `${meta.framework}${variant}`,
|
|
19212
19140
|
variant,
|
|
19213
|
-
outDir: cwd
|
|
19141
|
+
outDir: cwd,
|
|
19142
|
+
version: meta.bundler.version || meta.bundler.VERSION
|
|
19214
19143
|
},
|
|
19215
19144
|
build: {
|
|
19216
19145
|
errors: [],
|
|
@@ -19226,7 +19155,7 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19226
19155
|
const bundlerReportPlugin = getBundlerReportPlugin(options, globalContext);
|
|
19227
19156
|
const buildReportPlugin = getBuildReportPlugin(options, globalContext);
|
|
19228
19157
|
const gitPlugin = getGitPlugin(options, globalContext);
|
|
19229
|
-
const injectionPlugins = getInjectionPlugins(options, globalContext, toInject);
|
|
19158
|
+
const injectionPlugins = getInjectionPlugins(meta.bundler, options, globalContext, toInject);
|
|
19230
19159
|
return {
|
|
19231
19160
|
globalContext,
|
|
19232
19161
|
internalPlugins: [bundlerReportPlugin, buildReportPlugin, gitPlugin, ...injectionPlugins]
|
|
@@ -19400,12 +19329,12 @@ if (typeof module !== "undefined") {
|
|
|
19400
19329
|
}
|
|
19401
19330
|
|
|
19402
19331
|
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
19403
|
-
if (
|
|
19332
|
+
if (path$i.extname(sourcemapFilePath) !== ".map") {
|
|
19404
19333
|
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
19405
19334
|
}
|
|
19406
19335
|
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
19407
19336
|
const relativePath = minifiedFilePath.replace(context.bundler.outDir, "");
|
|
19408
|
-
const minifiedUrl = options.minifiedPathPrefix ?
|
|
19337
|
+
const minifiedUrl = options.minifiedPathPrefix ? path$i.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
19409
19338
|
return {
|
|
19410
19339
|
minifiedFilePath,
|
|
19411
19340
|
minifiedUrl,
|
|
@@ -20278,7 +20207,7 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
20278
20207
|
sourcemap.sourcemapFilePath,
|
|
20279
20208
|
(reason) => {
|
|
20280
20209
|
warnings.push(
|
|
20281
|
-
`${
|
|
20210
|
+
`${path$i.basename(sourcemap.sourcemapFilePath)}: "${reason}"`
|
|
20282
20211
|
);
|
|
20283
20212
|
}
|
|
20284
20213
|
),
|
|
@@ -21099,7 +21028,7 @@ var polyfills = polyfills$1;
|
|
|
21099
21028
|
var legacy = legacyStreams;
|
|
21100
21029
|
var clone = clone_1;
|
|
21101
21030
|
|
|
21102
|
-
var util = require$$1
|
|
21031
|
+
var util = require$$1;
|
|
21103
21032
|
|
|
21104
21033
|
/* istanbul ignore next - node 0.x polyfill */
|
|
21105
21034
|
var gracefulQueue;
|
|
@@ -21649,7 +21578,7 @@ function retry () {
|
|
|
21649
21578
|
};
|
|
21650
21579
|
} (fs$i));
|
|
21651
21580
|
|
|
21652
|
-
const path$g =
|
|
21581
|
+
const path$g = path$i;
|
|
21653
21582
|
|
|
21654
21583
|
// get drive on windows
|
|
21655
21584
|
function getRootPath (p) {
|
|
@@ -21674,7 +21603,7 @@ var win32 = {
|
|
|
21674
21603
|
};
|
|
21675
21604
|
|
|
21676
21605
|
const fs$g = gracefulFs;
|
|
21677
|
-
const path$f =
|
|
21606
|
+
const path$f = path$i;
|
|
21678
21607
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
21679
21608
|
|
|
21680
21609
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -21736,7 +21665,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
21736
21665
|
var mkdirs_1$1 = mkdirs$2;
|
|
21737
21666
|
|
|
21738
21667
|
const fs$f = gracefulFs;
|
|
21739
|
-
const path$e =
|
|
21668
|
+
const path$e = path$i;
|
|
21740
21669
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
21741
21670
|
|
|
21742
21671
|
const o777 = parseInt('0777', 8);
|
|
@@ -21804,7 +21733,7 @@ var mkdirs_1 = {
|
|
|
21804
21733
|
|
|
21805
21734
|
const fs$e = gracefulFs;
|
|
21806
21735
|
const os = require$$0;
|
|
21807
|
-
const path$d =
|
|
21736
|
+
const path$d = path$i;
|
|
21808
21737
|
|
|
21809
21738
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
21810
21739
|
function hasMillisResSync () {
|
|
@@ -21893,7 +21822,7 @@ var buffer$1 = function (size) {
|
|
|
21893
21822
|
};
|
|
21894
21823
|
|
|
21895
21824
|
const fs$d = gracefulFs;
|
|
21896
|
-
const path$c =
|
|
21825
|
+
const path$c = path$i;
|
|
21897
21826
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
21898
21827
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
21899
21828
|
|
|
@@ -22101,7 +22030,7 @@ var pathExists_1 = {
|
|
|
22101
22030
|
};
|
|
22102
22031
|
|
|
22103
22032
|
const fs$b = gracefulFs;
|
|
22104
|
-
const path$b =
|
|
22033
|
+
const path$b = path$i;
|
|
22105
22034
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
22106
22035
|
const pathExists$7 = pathExists_1.pathExists;
|
|
22107
22036
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -22351,7 +22280,7 @@ var copy$1 = {
|
|
|
22351
22280
|
};
|
|
22352
22281
|
|
|
22353
22282
|
const fs$a = gracefulFs;
|
|
22354
|
-
const path$a =
|
|
22283
|
+
const path$a = path$i;
|
|
22355
22284
|
const assert = require$$5;
|
|
22356
22285
|
|
|
22357
22286
|
const isWindows = (process.platform === 'win32');
|
|
@@ -22673,7 +22602,7 @@ var remove$3 = {
|
|
|
22673
22602
|
|
|
22674
22603
|
const u$7 = universalify.fromCallback;
|
|
22675
22604
|
const fs$9 = fs$j;
|
|
22676
|
-
const path$9 =
|
|
22605
|
+
const path$9 = path$i;
|
|
22677
22606
|
const mkdir$5 = mkdirs_1;
|
|
22678
22607
|
const remove$2 = remove$3;
|
|
22679
22608
|
|
|
@@ -22719,7 +22648,7 @@ var empty$2 = {
|
|
|
22719
22648
|
};
|
|
22720
22649
|
|
|
22721
22650
|
const u$6 = universalify.fromCallback;
|
|
22722
|
-
const path$8 =
|
|
22651
|
+
const path$8 = path$i;
|
|
22723
22652
|
const fs$8 = gracefulFs;
|
|
22724
22653
|
const mkdir$4 = mkdirs_1;
|
|
22725
22654
|
const pathExists$6 = pathExists_1.pathExists;
|
|
@@ -22767,7 +22696,7 @@ var file$1 = {
|
|
|
22767
22696
|
};
|
|
22768
22697
|
|
|
22769
22698
|
const u$5 = universalify.fromCallback;
|
|
22770
|
-
const path$7 =
|
|
22699
|
+
const path$7 = path$i;
|
|
22771
22700
|
const fs$7 = gracefulFs;
|
|
22772
22701
|
const mkdir$3 = mkdirs_1;
|
|
22773
22702
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -22826,7 +22755,7 @@ var link$1 = {
|
|
|
22826
22755
|
createLinkSync
|
|
22827
22756
|
};
|
|
22828
22757
|
|
|
22829
|
-
const path$6 =
|
|
22758
|
+
const path$6 = path$i;
|
|
22830
22759
|
const fs$6 = gracefulFs;
|
|
22831
22760
|
const pathExists$4 = pathExists_1.pathExists;
|
|
22832
22761
|
|
|
@@ -22955,7 +22884,7 @@ var symlinkType_1 = {
|
|
|
22955
22884
|
};
|
|
22956
22885
|
|
|
22957
22886
|
const u$4 = universalify.fromCallback;
|
|
22958
|
-
const path$5 =
|
|
22887
|
+
const path$5 = path$i;
|
|
22959
22888
|
const fs$4 = gracefulFs;
|
|
22960
22889
|
const _mkdirs = mkdirs_1;
|
|
22961
22890
|
const mkdirs = _mkdirs.mkdirs;
|
|
@@ -23184,7 +23113,7 @@ var jsonfile = {
|
|
|
23184
23113
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
23185
23114
|
};
|
|
23186
23115
|
|
|
23187
|
-
const path$4 =
|
|
23116
|
+
const path$4 = path$i;
|
|
23188
23117
|
const mkdir$2 = mkdirs_1;
|
|
23189
23118
|
const pathExists$2 = pathExists_1.pathExists;
|
|
23190
23119
|
const jsonFile$2 = jsonfile;
|
|
@@ -23211,7 +23140,7 @@ function outputJson (file, data, options, callback) {
|
|
|
23211
23140
|
var outputJson_1 = outputJson;
|
|
23212
23141
|
|
|
23213
23142
|
const fs$3 = gracefulFs;
|
|
23214
|
-
const path$3 =
|
|
23143
|
+
const path$3 = path$i;
|
|
23215
23144
|
const mkdir$1 = mkdirs_1;
|
|
23216
23145
|
const jsonFile$1 = jsonfile;
|
|
23217
23146
|
|
|
@@ -23243,7 +23172,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
23243
23172
|
var json = jsonFile;
|
|
23244
23173
|
|
|
23245
23174
|
const fs$2 = gracefulFs;
|
|
23246
|
-
const path$2 =
|
|
23175
|
+
const path$2 = path$i;
|
|
23247
23176
|
const copySync = copySync$1.copySync;
|
|
23248
23177
|
const removeSync = remove$3.removeSync;
|
|
23249
23178
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -23360,7 +23289,7 @@ var moveSync_1 = {
|
|
|
23360
23289
|
|
|
23361
23290
|
const u$1 = universalify.fromCallback;
|
|
23362
23291
|
const fs$1 = gracefulFs;
|
|
23363
|
-
const path$1 =
|
|
23292
|
+
const path$1 = path$i;
|
|
23364
23293
|
const copy = copy$1.copy;
|
|
23365
23294
|
const remove$1 = remove$3.remove;
|
|
23366
23295
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -23441,7 +23370,7 @@ var move_1 = {
|
|
|
23441
23370
|
|
|
23442
23371
|
const u = universalify.fromCallback;
|
|
23443
23372
|
const fs = gracefulFs;
|
|
23444
|
-
const path =
|
|
23373
|
+
const path = path$i;
|
|
23445
23374
|
const mkdir = mkdirs_1;
|
|
23446
23375
|
const pathExists = pathExists_1.pathExists;
|
|
23447
23376
|
|
|
@@ -23911,7 +23840,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23911
23840
|
} else if (typeof outputOptions === "string") {
|
|
23912
23841
|
destination = outputOptions;
|
|
23913
23842
|
}
|
|
23914
|
-
const outputPath =
|
|
23843
|
+
const outputPath = path$i.resolve(cwd, destination);
|
|
23915
23844
|
try {
|
|
23916
23845
|
const errors = {};
|
|
23917
23846
|
const filesToWrite = {};
|
|
@@ -23930,7 +23859,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23930
23859
|
const proms = Object.keys(filesToWrite).map((file) => {
|
|
23931
23860
|
const start = Date.now();
|
|
23932
23861
|
log(`Start writing ${file}.json.`);
|
|
23933
|
-
return writeFile(
|
|
23862
|
+
return writeFile(path$i.join(outputPath, `${file}.json`), filesToWrite[file].content).then(() => {
|
|
23934
23863
|
log(`Wrote ${file}.json in ${formatDuration(Date.now() - start)}`);
|
|
23935
23864
|
}).catch((e) => {
|
|
23936
23865
|
log(
|
|
@@ -34302,7 +34231,7 @@ virtualStats.VirtualStats = VirtualStats;
|
|
|
34302
34231
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
34303
34232
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34304
34233
|
};
|
|
34305
|
-
const path_1 = __importDefault(
|
|
34234
|
+
const path_1 = __importDefault(path$i);
|
|
34306
34235
|
const virtual_stats_1 = virtualStats;
|
|
34307
34236
|
let inode = 45000000;
|
|
34308
34237
|
const ALL = 'all';
|
|
@@ -34586,7 +34515,7 @@ var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
|
34586
34515
|
|
|
34587
34516
|
// node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
|
|
34588
34517
|
var getFilename = () => fileURLToPath$1(import.meta.url);
|
|
34589
|
-
var getDirname = () =>
|
|
34518
|
+
var getDirname = () => path$i.dirname(getFilename());
|
|
34590
34519
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
34591
34520
|
|
|
34592
34521
|
// node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -35387,7 +35316,7 @@ var ExtToLoader = {
|
|
|
35387
35316
|
".txt": "text"
|
|
35388
35317
|
};
|
|
35389
35318
|
function guessLoader(code, id) {
|
|
35390
|
-
return ExtToLoader[
|
|
35319
|
+
return ExtToLoader[path$i.extname(id).toLowerCase()] || "js";
|
|
35391
35320
|
}
|
|
35392
35321
|
function unwrapLoader(loader, code, id) {
|
|
35393
35322
|
if (typeof loader === "function")
|
|
@@ -35461,8 +35390,8 @@ function createBuildContext(initialOptions) {
|
|
|
35461
35390
|
emitFile(emittedFile) {
|
|
35462
35391
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
35463
35392
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
35464
|
-
const outPath =
|
|
35465
|
-
const outDir =
|
|
35393
|
+
const outPath = path$i.resolve(initialOptions.outdir, outFileName);
|
|
35394
|
+
const outDir = path$i.dirname(outPath);
|
|
35466
35395
|
if (!fs$j.existsSync(outDir))
|
|
35467
35396
|
fs$j.mkdirSync(outDir, { recursive: true });
|
|
35468
35397
|
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
@@ -35663,7 +35592,7 @@ function buildSetup(meta) {
|
|
|
35663
35592
|
onLoad({ filter: onLoadFilter }, async (args) => {
|
|
35664
35593
|
const id = args.path + args.suffix;
|
|
35665
35594
|
const { errors, warnings, mixedContext } = createPluginContext(context);
|
|
35666
|
-
const resolveDir =
|
|
35595
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35667
35596
|
let code, map;
|
|
35668
35597
|
if (plugin.load && (!plugin.loadInclude || plugin.loadInclude(id))) {
|
|
35669
35598
|
const result = await plugin.load.call(mixedContext, id);
|
|
@@ -35694,7 +35623,7 @@ function buildSetup(meta) {
|
|
|
35694
35623
|
if (plugin.transformInclude && !plugin.transformInclude(id))
|
|
35695
35624
|
return;
|
|
35696
35625
|
const { mixedContext, errors, warnings } = createPluginContext(context);
|
|
35697
|
-
const resolveDir =
|
|
35626
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35698
35627
|
let code = await args.getContents();
|
|
35699
35628
|
let map;
|
|
35700
35629
|
const result = await plugin.transform.call(mixedContext, code, id);
|
|
@@ -35786,7 +35715,7 @@ var ExtToLoader2 = {
|
|
|
35786
35715
|
".node": "napi"
|
|
35787
35716
|
};
|
|
35788
35717
|
function guessIdLoader(id) {
|
|
35789
|
-
return ExtToLoader2[
|
|
35718
|
+
return ExtToLoader2[path$i.extname(id).toLowerCase()] || "js";
|
|
35790
35719
|
}
|
|
35791
35720
|
function transformQuery(context) {
|
|
35792
35721
|
const queryParamsObject = {};
|
|
@@ -35876,7 +35805,7 @@ function toFarmPlugin(plugin, options) {
|
|
|
35876
35805
|
farmPlugin.resolve = {
|
|
35877
35806
|
filters: { sources: [".*", ...filters], importers: [".*"] },
|
|
35878
35807
|
async executor(params, context) {
|
|
35879
|
-
const resolvedIdPath =
|
|
35808
|
+
const resolvedIdPath = path$i.resolve(
|
|
35880
35809
|
process.cwd(),
|
|
35881
35810
|
params.importer ?? ""
|
|
35882
35811
|
);
|
|
@@ -36458,6 +36387,7 @@ const validateOptions = (options = {}) => {
|
|
|
36458
36387
|
};
|
|
36459
36388
|
const HOST_NAME = "datadog-build-plugins";
|
|
36460
36389
|
const buildPluginFactory = ({
|
|
36390
|
+
bundler,
|
|
36461
36391
|
version
|
|
36462
36392
|
}) => {
|
|
36463
36393
|
return createUnplugin((opts, unpluginMetaContext) => {
|
|
@@ -36466,6 +36396,7 @@ const buildPluginFactory = ({
|
|
|
36466
36396
|
unpluginMetaContext.esbuildHostName = HOST_NAME;
|
|
36467
36397
|
}
|
|
36468
36398
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
36399
|
+
bundler,
|
|
36469
36400
|
version,
|
|
36470
36401
|
...unpluginMetaContext
|
|
36471
36402
|
});
|
|
@@ -36488,7 +36419,7 @@ const buildPluginFactory = ({
|
|
|
36488
36419
|
|
|
36489
36420
|
var name = "@datadog/esbuild-plugin";
|
|
36490
36421
|
var packageManager = "yarn@4.0.2";
|
|
36491
|
-
var version$1 = "2.3.1-dev-
|
|
36422
|
+
var version$1 = "2.3.1-dev-12";
|
|
36492
36423
|
var license = "MIT";
|
|
36493
36424
|
var author = "Datadog";
|
|
36494
36425
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -36576,6 +36507,7 @@ var pkg = {
|
|
|
36576
36507
|
};
|
|
36577
36508
|
|
|
36578
36509
|
const datadogEsbuildPlugin = buildPluginFactory({
|
|
36510
|
+
bundler: esbuild,
|
|
36579
36511
|
version: pkg.version
|
|
36580
36512
|
}).esbuild;
|
|
36581
36513
|
const version = pkg.version;
|