@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.js
CHANGED
|
@@ -9,9 +9,9 @@ var promises = require('node:fs/promises');
|
|
|
9
9
|
var node_events = require('node:events');
|
|
10
10
|
var Stream$1 = require('node:stream');
|
|
11
11
|
var node_string_decoder = require('node:string_decoder');
|
|
12
|
-
var
|
|
12
|
+
var path$i = require('path');
|
|
13
13
|
var require$$0$1 = require('tty');
|
|
14
|
-
var require$$1
|
|
14
|
+
var require$$1 = require('util');
|
|
15
15
|
var child_process = require('child_process');
|
|
16
16
|
var url = require('url');
|
|
17
17
|
var promises$1 = require('fs/promises');
|
|
@@ -23,6 +23,7 @@ var require$$5 = require('assert');
|
|
|
23
23
|
var perf_hooks = require('perf_hooks');
|
|
24
24
|
var querystring = require('querystring');
|
|
25
25
|
var process2 = require('process');
|
|
26
|
+
var esbuild = require('esbuild');
|
|
26
27
|
|
|
27
28
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
28
29
|
function _interopNamespaceDefault(e) {
|
|
@@ -2294,8 +2295,8 @@ var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
|
|
|
2294
2295
|
|
|
2295
2296
|
const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
|
|
2296
2297
|
const PLUGIN_NAME$4 = "datadog-injection-plugin";
|
|
2297
|
-
const
|
|
2298
|
-
const
|
|
2298
|
+
const INJECTED_FILE = "__datadog-helper-file";
|
|
2299
|
+
const INJECTED_FILE_PATH = `${INJECTED_FILE}.js`;
|
|
2299
2300
|
const DISTANT_FILE_RX = /^https?:\/\//;
|
|
2300
2301
|
|
|
2301
2302
|
const formatDuration = (duration) => {
|
|
@@ -2306,7 +2307,7 @@ const formatDuration = (duration) => {
|
|
|
2306
2307
|
const minutes = d.getUTCMinutes();
|
|
2307
2308
|
const seconds = d.getUTCSeconds();
|
|
2308
2309
|
const milliseconds = d.getUTCMilliseconds();
|
|
2309
|
-
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds}ms`.trim();
|
|
2310
|
+
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds ? `${milliseconds}ms` : ""}`.trim();
|
|
2310
2311
|
};
|
|
2311
2312
|
const getResolvedPath = (filepath) => {
|
|
2312
2313
|
try {
|
|
@@ -2376,7 +2377,7 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
|
|
|
2376
2377
|
const rightStop = stringLength - leftStop;
|
|
2377
2378
|
return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
|
|
2378
2379
|
};
|
|
2379
|
-
const
|
|
2380
|
+
const isInjectionFile = (filename) => filename.includes(INJECTED_FILE);
|
|
2380
2381
|
|
|
2381
2382
|
var balancedMatch = balanced$1;
|
|
2382
2383
|
function balanced$1(a, b, str) {
|
|
@@ -11332,18 +11333,13 @@ const cleanReport = (report, filepath, filter) => {
|
|
|
11332
11333
|
const cleanedPath = cleanPath(reportFilepath);
|
|
11333
11334
|
if (
|
|
11334
11335
|
// Don't add injections.
|
|
11335
|
-
|
|
11336
|
+
isInjectionFile(reportFilepath) || // Don't add itself into it.
|
|
11336
11337
|
cleanedPath === filepath || // Remove common specific files injected by bundlers.
|
|
11337
11338
|
BUNDLER_SPECIFICS.includes(cleanedPath)
|
|
11338
11339
|
) {
|
|
11339
11340
|
continue;
|
|
11340
11341
|
}
|
|
11341
|
-
|
|
11342
|
-
const filteredValue = filter(cleanedPath);
|
|
11343
|
-
if (filteredValue) {
|
|
11344
|
-
cleanedReport.add(filteredValue);
|
|
11345
|
-
}
|
|
11346
|
-
} else {
|
|
11342
|
+
{
|
|
11347
11343
|
cleanedReport.add(cleanedPath);
|
|
11348
11344
|
}
|
|
11349
11345
|
}
|
|
@@ -11353,16 +11349,16 @@ const cleanPath = (filepath) => {
|
|
|
11353
11349
|
return filepath.split("!").pop().split(QUERY_RX).shift().replace(/^[^\w\s.,!@#$%^&*()=+~`\-/]+/, "");
|
|
11354
11350
|
};
|
|
11355
11351
|
const getAbsolutePath = (cwd, filepath) => {
|
|
11356
|
-
if (
|
|
11352
|
+
if (isInjectionFile(filepath)) {
|
|
11357
11353
|
return INJECTED_FILE;
|
|
11358
11354
|
}
|
|
11359
11355
|
if (filepath.startsWith(cwd)) {
|
|
11360
11356
|
return filepath;
|
|
11361
11357
|
}
|
|
11362
|
-
return
|
|
11358
|
+
return path$i.resolve(cwd, filepath);
|
|
11363
11359
|
};
|
|
11364
11360
|
const cleanName = (context, filepath) => {
|
|
11365
|
-
if (
|
|
11361
|
+
if (isInjectionFile(filepath)) {
|
|
11366
11362
|
return INJECTED_FILE;
|
|
11367
11363
|
}
|
|
11368
11364
|
if (filepath === "unknown") {
|
|
@@ -11436,8 +11432,24 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11436
11432
|
const reportOutputsIndexed = {};
|
|
11437
11433
|
const metaInputsIndexed = reIndexMeta(result.metafile.inputs, cwd);
|
|
11438
11434
|
const metaOutputsIndexed = reIndexMeta(result.metafile.outputs, cwd);
|
|
11435
|
+
const getRealPathFromInjectionProxy = (entryPoint) => {
|
|
11436
|
+
if (!isInjectionFile(entryPoint)) {
|
|
11437
|
+
return entryPoint;
|
|
11438
|
+
}
|
|
11439
|
+
const metaInput = metaInputsIndexed[getAbsolutePath(cwd, entryPoint)];
|
|
11440
|
+
if (!metaInput) {
|
|
11441
|
+
return entryPoint;
|
|
11442
|
+
}
|
|
11443
|
+
const actualImport = metaInput.imports.find(
|
|
11444
|
+
(imp) => !isInjectionFile(imp.path)
|
|
11445
|
+
);
|
|
11446
|
+
if (!actualImport) {
|
|
11447
|
+
return entryPoint;
|
|
11448
|
+
}
|
|
11449
|
+
return actualImport.path;
|
|
11450
|
+
};
|
|
11439
11451
|
for (const [filename, input] of Object.entries(result.metafile.inputs)) {
|
|
11440
|
-
if (
|
|
11452
|
+
if (isInjectionFile(filename)) {
|
|
11441
11453
|
continue;
|
|
11442
11454
|
}
|
|
11443
11455
|
const filepath = getAbsolutePath(cwd, filename);
|
|
@@ -11458,7 +11470,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11458
11470
|
const cleanedName = cleanName(context, fullPath);
|
|
11459
11471
|
const inputFiles = [];
|
|
11460
11472
|
for (const inputName of Object.keys(output.inputs)) {
|
|
11461
|
-
if (
|
|
11473
|
+
if (isInjectionFile(inputName)) {
|
|
11462
11474
|
continue;
|
|
11463
11475
|
}
|
|
11464
11476
|
const inputFound = reportInputsIndexed[getAbsolutePath(cwd, inputName)];
|
|
@@ -11491,7 +11503,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11491
11503
|
if (!output.entryPoint) {
|
|
11492
11504
|
continue;
|
|
11493
11505
|
}
|
|
11494
|
-
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, output.entryPoint)];
|
|
11506
|
+
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, getRealPathFromInjectionProxy(output.entryPoint))];
|
|
11495
11507
|
if (inputFile) {
|
|
11496
11508
|
if (!entryNames.get(inputFile.name)) {
|
|
11497
11509
|
continue;
|
|
@@ -11526,7 +11538,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11526
11538
|
};
|
|
11527
11539
|
const FILE_EXCEPTIONS_RX = /(<runtime>|https:|file:|data:|#)/g;
|
|
11528
11540
|
const isFileSupported = (filePath) => {
|
|
11529
|
-
if (
|
|
11541
|
+
if (isInjectionFile(filePath) || filePath.match(FILE_EXCEPTIONS_RX)) {
|
|
11530
11542
|
return false;
|
|
11531
11543
|
}
|
|
11532
11544
|
return true;
|
|
@@ -11803,239 +11815,183 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11803
11815
|
};
|
|
11804
11816
|
|
|
11805
11817
|
const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
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
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11818
|
+
const inputs = [];
|
|
11819
|
+
const outputs = [];
|
|
11820
|
+
const entries = [];
|
|
11821
|
+
const warnings = [];
|
|
11822
|
+
const reportInputsIndexed = /* @__PURE__ */ new Map();
|
|
11823
|
+
const reportOutputsIndexed = /* @__PURE__ */ new Map();
|
|
11824
|
+
const modulesPerFile = /* @__PURE__ */ new Map();
|
|
11825
|
+
const tempSourcemaps = [];
|
|
11826
|
+
const tempDeps = /* @__PURE__ */ new Map();
|
|
11827
|
+
const isModuleSupported = (moduleIdentifier) => {
|
|
11828
|
+
return (
|
|
11829
|
+
// Ignore unidentified modules and runtimes.
|
|
11830
|
+
!!moduleIdentifier && !moduleIdentifier.startsWith("webpack/runtime") && !moduleIdentifier.includes("/webpack4/buildin/") && !moduleIdentifier.startsWith("multi ")
|
|
11831
|
+
);
|
|
11832
|
+
};
|
|
11833
|
+
const warn = (warning) => {
|
|
11834
|
+
warnings.push(warning);
|
|
11835
|
+
log(warning, "warn");
|
|
11836
|
+
};
|
|
11837
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
11838
|
+
compilation.hooks.finishModules.tap(PLUGIN_NAME, (finishedModules) => {
|
|
11839
|
+
const getModuleFromDep = (dep) => {
|
|
11840
|
+
return compilation.moduleGraph ? compilation.moduleGraph.getModule(dep) : dep.module;
|
|
11841
|
+
};
|
|
11842
|
+
for (const module of finishedModules) {
|
|
11843
|
+
const moduleIdentifier = module.identifier();
|
|
11844
|
+
const dependencies = new Set(
|
|
11845
|
+
[...module.dependencies, ...module.blocks.flatMap((b) => b.dependencies)].filter(
|
|
11846
|
+
(dep) => (
|
|
11847
|
+
// Ignore side effects.
|
|
11848
|
+
dep.type !== "harmony side effect evaluation" && // Ignore those we can't identify.
|
|
11849
|
+
getModuleFromDep(dep)?.identifier() && // Only what we support.
|
|
11850
|
+
isModuleSupported(getModuleFromDep(dep)?.identifier()) && // Don't add itself as a dependency.
|
|
11851
|
+
getModuleFromDep(dep)?.identifier() !== moduleIdentifier
|
|
11852
|
+
)
|
|
11853
|
+
).map((dep) => {
|
|
11854
|
+
return getModuleFromDep(dep)?.identifier();
|
|
11855
|
+
}).filter(Boolean)
|
|
11856
|
+
);
|
|
11857
|
+
if (!isModuleSupported(moduleIdentifier)) {
|
|
11858
|
+
continue;
|
|
11859
|
+
}
|
|
11860
|
+
for (const depIdentifier of dependencies) {
|
|
11861
|
+
const depDeps = tempDeps.get(depIdentifier) || {
|
|
11862
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11863
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11864
|
+
};
|
|
11865
|
+
depDeps.dependents.add(moduleIdentifier);
|
|
11866
|
+
tempDeps.set(depIdentifier, depDeps);
|
|
11867
|
+
}
|
|
11868
|
+
const moduleDeps = tempDeps.get(moduleIdentifier) || {
|
|
11869
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11870
|
+
dependencies: /* @__PURE__ */ new Set()
|
|
11871
|
+
};
|
|
11872
|
+
for (const moduleDep of dependencies) {
|
|
11873
|
+
moduleDeps.dependencies.add(moduleDep);
|
|
11874
|
+
}
|
|
11875
|
+
tempDeps.set(moduleIdentifier, moduleDeps);
|
|
11876
|
+
const file = {
|
|
11877
|
+
size: module.size() || 0,
|
|
11878
|
+
name: cleanName(context, moduleIdentifier),
|
|
11879
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11880
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11881
|
+
filepath: moduleIdentifier,
|
|
11882
|
+
type: getType(moduleIdentifier)
|
|
11883
|
+
};
|
|
11884
|
+
inputs.push(file);
|
|
11885
|
+
reportInputsIndexed.set(moduleIdentifier, file);
|
|
11886
|
+
}
|
|
11887
|
+
for (const input of inputs) {
|
|
11888
|
+
const depsReport = tempDeps.get(input.filepath);
|
|
11889
|
+
if (!depsReport) {
|
|
11890
|
+
warn(`Could not find dependency report for ${input.name}`);
|
|
11891
|
+
continue;
|
|
11892
|
+
}
|
|
11893
|
+
for (const dependency of depsReport.dependencies) {
|
|
11894
|
+
const depInput = reportInputsIndexed.get(dependency);
|
|
11895
|
+
if (!depInput) {
|
|
11896
|
+
warn(`Could not find input of dependency ${dependency}`);
|
|
11897
|
+
continue;
|
|
11862
11898
|
}
|
|
11899
|
+
input.dependencies.add(depInput);
|
|
11863
11900
|
}
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11901
|
+
for (const dependent of depsReport.dependents) {
|
|
11902
|
+
const depInput = reportInputsIndexed.get(dependent);
|
|
11903
|
+
if (!depInput) {
|
|
11904
|
+
warn(`Could not find input of dependent ${dependent}`);
|
|
11905
|
+
continue;
|
|
11906
|
+
}
|
|
11907
|
+
input.dependents.add(depInput);
|
|
11868
11908
|
}
|
|
11869
|
-
|
|
11870
|
-
|
|
11909
|
+
}
|
|
11910
|
+
});
|
|
11911
|
+
});
|
|
11912
|
+
compiler.hooks.afterEmit.tap(PLUGIN_NAME, (result) => {
|
|
11913
|
+
const chunks = result.chunks;
|
|
11914
|
+
const assets = result.getAssets();
|
|
11915
|
+
const getChunkFiles = (chunk) => {
|
|
11916
|
+
return [...chunk.files || [], ...chunk.auxiliaryFiles || []].map(
|
|
11917
|
+
(f) => getAbsolutePath(context.bundler.outDir, f)
|
|
11918
|
+
);
|
|
11919
|
+
};
|
|
11920
|
+
const chunkGraph = result.chunkGraph;
|
|
11921
|
+
for (const chunk of chunks) {
|
|
11922
|
+
const files = getChunkFiles(chunk);
|
|
11923
|
+
const chunkModules = (chunkGraph ? chunkGraph?.getChunkModules(chunk) : chunk.getModules()).flatMap((m) => {
|
|
11924
|
+
return "modules" in m && Array.isArray(m.modules) ? m.modules.map((m2) => m2.identifier()) : m.identifier();
|
|
11925
|
+
}).filter(isModuleSupported);
|
|
11926
|
+
for (const file of files) {
|
|
11927
|
+
if (getType(file) === "map") {
|
|
11928
|
+
continue;
|
|
11871
11929
|
}
|
|
11930
|
+
const fileModules = modulesPerFile.get(file) || [];
|
|
11931
|
+
modulesPerFile.set(file, [...fileModules, ...chunkModules]);
|
|
11872
11932
|
}
|
|
11873
11933
|
}
|
|
11874
11934
|
for (const asset of assets) {
|
|
11875
11935
|
const file = {
|
|
11876
|
-
size: asset.
|
|
11936
|
+
size: asset.source.size() || 0,
|
|
11877
11937
|
name: asset.name,
|
|
11878
11938
|
inputs: [],
|
|
11879
11939
|
filepath: getAbsolutePath(context.bundler.outDir, asset.name),
|
|
11880
11940
|
type: getType(asset.name)
|
|
11881
11941
|
};
|
|
11882
|
-
reportOutputsIndexed
|
|
11942
|
+
reportOutputsIndexed.set(file.filepath, file);
|
|
11883
11943
|
outputs.push(file);
|
|
11884
11944
|
if (file.type === "map") {
|
|
11885
11945
|
tempSourcemaps.push(file);
|
|
11886
|
-
}
|
|
11887
|
-
}
|
|
11888
|
-
for (const sourcemap of tempSourcemaps) {
|
|
11889
|
-
const outputFound = reportOutputsIndexed[sourcemap.filepath.replace(/\.map$/, "")];
|
|
11890
|
-
if (!outputFound) {
|
|
11891
|
-
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
11892
11946
|
continue;
|
|
11893
11947
|
}
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
return module.nameForCondition ? module.nameForCondition : module.name ? getAbsolutePath(context.cwd, module.name) : module.identifier ? module.identifier : "unknown";
|
|
11898
|
-
};
|
|
11899
|
-
const isModuleSupported = (module) => {
|
|
11900
|
-
if (isInjection(getModulePath(module)) || // Do not report runtime modules as they are very specific to webpack.
|
|
11901
|
-
module.moduleType === "runtime" || module.name?.startsWith("(webpack)") || // Also ignore orphan modules
|
|
11902
|
-
module.type === "orphan modules") {
|
|
11903
|
-
return false;
|
|
11904
|
-
}
|
|
11905
|
-
return true;
|
|
11906
|
-
};
|
|
11907
|
-
const getModules = (reason) => {
|
|
11908
|
-
const { moduleIdentifier, moduleId } = reason;
|
|
11909
|
-
if (!moduleIdentifier && !moduleId) {
|
|
11910
|
-
return [];
|
|
11911
|
-
}
|
|
11912
|
-
const modulesFound = [];
|
|
11913
|
-
if (moduleId) {
|
|
11914
|
-
const module = modulePerId.get(moduleId);
|
|
11915
|
-
if (module) {
|
|
11916
|
-
modulesFound.push(module);
|
|
11917
|
-
}
|
|
11918
|
-
const concatModules = concatModulesPerId.get(moduleId);
|
|
11919
|
-
if (concatModules) {
|
|
11920
|
-
modulesFound.push(...concatModules);
|
|
11921
|
-
}
|
|
11922
|
-
}
|
|
11923
|
-
if (moduleIdentifier) {
|
|
11924
|
-
const module = modulePerIdentifier.get(moduleIdentifier);
|
|
11925
|
-
if (module) {
|
|
11926
|
-
modulesFound.push(module);
|
|
11927
|
-
}
|
|
11928
|
-
const concatModules = concatModulesPerIdentifier.get(moduleIdentifier);
|
|
11929
|
-
if (concatModules) {
|
|
11930
|
-
modulesFound.push(...concatModules);
|
|
11931
|
-
}
|
|
11932
|
-
}
|
|
11933
|
-
return Array.from(new Set(modulesFound.map(getModulePath)));
|
|
11934
|
-
};
|
|
11935
|
-
const modulesDone = /* @__PURE__ */ new Set();
|
|
11936
|
-
for (const module of modules) {
|
|
11937
|
-
if (!isModuleSupported(module)) {
|
|
11948
|
+
const fileModules = modulesPerFile.get(file.filepath);
|
|
11949
|
+
if (!fileModules) {
|
|
11950
|
+
warn(`Could not find modules for ${file.name}`);
|
|
11938
11951
|
continue;
|
|
11939
11952
|
}
|
|
11940
|
-
const
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
modulesDone.add(modulePath);
|
|
11945
|
-
if (modulePath === "unknown") {
|
|
11946
|
-
warn(`Unknown module: ${JSON.stringify(module)}`);
|
|
11947
|
-
}
|
|
11948
|
-
if (module.reasons) {
|
|
11949
|
-
const moduleDeps = tempDeps[modulePath] || {
|
|
11950
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11951
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11952
|
-
};
|
|
11953
|
-
const dependents = module.reasons.flatMap(getModules);
|
|
11954
|
-
for (const dependent of dependents) {
|
|
11955
|
-
const reasonDeps = tempDeps[dependent] || {
|
|
11956
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11957
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11958
|
-
};
|
|
11959
|
-
reasonDeps.dependencies.add(modulePath);
|
|
11960
|
-
tempDeps[dependent] = reasonDeps;
|
|
11961
|
-
moduleDeps.dependents.add(dependent);
|
|
11962
|
-
}
|
|
11963
|
-
tempDeps[modulePath] = moduleDeps;
|
|
11964
|
-
}
|
|
11965
|
-
const file = {
|
|
11966
|
-
size: module.size || 0,
|
|
11967
|
-
name: cleanName(context, modulePath),
|
|
11968
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11969
|
-
dependents: /* @__PURE__ */ new Set(),
|
|
11970
|
-
filepath: modulePath,
|
|
11971
|
-
type: getType(modulePath)
|
|
11972
|
-
};
|
|
11973
|
-
for (const chunkId of module.chunks || []) {
|
|
11974
|
-
const chunkFound = chunks.find((chunk) => chunk.id === chunkId);
|
|
11975
|
-
if (!chunkFound) {
|
|
11976
|
-
continue;
|
|
11977
|
-
}
|
|
11978
|
-
const chunkFiles = chunkFound.files || [];
|
|
11979
|
-
if (chunkFound.auxiliaryFiles) {
|
|
11980
|
-
chunkFiles.push(...chunkFound.auxiliaryFiles);
|
|
11981
|
-
}
|
|
11982
|
-
const outputFound = outputs.find((output) => chunkFiles.includes(output.name));
|
|
11983
|
-
if (!outputFound) {
|
|
11984
|
-
warn(`Output not found for ${file.name}`);
|
|
11953
|
+
for (const moduleIdentifier of fileModules) {
|
|
11954
|
+
const inputFound = reportInputsIndexed.get(moduleIdentifier);
|
|
11955
|
+
if (!inputFound) {
|
|
11956
|
+
warn(`Could not find input of ${moduleIdentifier}`);
|
|
11985
11957
|
continue;
|
|
11986
11958
|
}
|
|
11987
|
-
|
|
11988
|
-
outputFound.inputs.push(file);
|
|
11989
|
-
}
|
|
11959
|
+
file.inputs.push(inputFound);
|
|
11990
11960
|
}
|
|
11991
|
-
reportInputsIndexed[modulePath] = file;
|
|
11992
|
-
inputs.push(file);
|
|
11993
11961
|
}
|
|
11994
|
-
const
|
|
11995
|
-
const
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
};
|
|
12001
|
-
for (const input of inputs) {
|
|
12002
|
-
const depsReport = tempDeps[input.filepath];
|
|
12003
|
-
if (!depsReport) {
|
|
12004
|
-
warn(`Could not find dependency report for ${input.name}`);
|
|
11962
|
+
for (const sourcemap of tempSourcemaps) {
|
|
11963
|
+
const outputFound = reportOutputsIndexed.get(
|
|
11964
|
+
sourcemap.filepath.replace(/\.map$/, "")
|
|
11965
|
+
);
|
|
11966
|
+
if (!outputFound) {
|
|
11967
|
+
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
12005
11968
|
continue;
|
|
12006
11969
|
}
|
|
12007
|
-
|
|
12008
|
-
input.dependents = cleanReport(depsReport.dependents, input.filepath, getInput);
|
|
11970
|
+
sourcemap.inputs.push(outputFound);
|
|
12009
11971
|
}
|
|
12010
|
-
for (const [name,
|
|
11972
|
+
for (const [name, entrypoint] of result.entrypoints) {
|
|
12011
11973
|
const entryOutputs = [];
|
|
12012
11974
|
const entryInputs = [];
|
|
12013
11975
|
let size = 0;
|
|
12014
|
-
const
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
if (!assetPath || !reportOutputsIndexed[assetPath]) {
|
|
12026
|
-
warn(`Could not find output of ${JSON.stringify(asset)}`);
|
|
11976
|
+
const entryFiles = entrypoint.chunks.flatMap(getChunkFiles);
|
|
11977
|
+
const entryFilename = entrypoint.chunks.filter(
|
|
11978
|
+
(c) => (
|
|
11979
|
+
// Webpack5 forces you to use the chunkGraph to get the modules.
|
|
11980
|
+
chunkGraph ? chunkGraph.getNumberOfEntryModules(c) > 0 : c.hasEntryModule()
|
|
11981
|
+
)
|
|
11982
|
+
).flatMap((c) => Array.from(c.files))[0];
|
|
11983
|
+
for (const file2 of entryFiles) {
|
|
11984
|
+
const outputFound = reportOutputsIndexed.get(file2);
|
|
11985
|
+
if (!file2 || !outputFound) {
|
|
11986
|
+
warn(`Could not find output of ${JSON.stringify(file2)}`);
|
|
12027
11987
|
continue;
|
|
12028
11988
|
}
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
entryInputs.push(...outputFound.inputs);
|
|
12034
|
-
size += outputFound.size;
|
|
12035
|
-
}
|
|
11989
|
+
if (outputFound.type !== "map" && !entryOutputs.includes(outputFound)) {
|
|
11990
|
+
entryOutputs.push(outputFound);
|
|
11991
|
+
entryInputs.push(...outputFound.inputs);
|
|
11992
|
+
size += outputFound.size;
|
|
12036
11993
|
}
|
|
12037
11994
|
}
|
|
12038
|
-
const entryFilename = stats.assetsByChunkName?.[name]?.[0];
|
|
12039
11995
|
const file = {
|
|
12040
11996
|
name,
|
|
12041
11997
|
filepath: entryFilename ? getAbsolutePath(context.bundler.outDir, entryFilename) : "unknown",
|
|
@@ -12046,6 +12002,8 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
12046
12002
|
};
|
|
12047
12003
|
entries.push(file);
|
|
12048
12004
|
}
|
|
12005
|
+
context.build.errors = result.errors.map((err) => err.message);
|
|
12006
|
+
context.build.warnings = [...warnings, ...result.warnings.map((err) => err.message)];
|
|
12049
12007
|
context.build.inputs = inputs;
|
|
12050
12008
|
context.build.outputs = outputs;
|
|
12051
12009
|
context.build.entries = entries;
|
|
@@ -12092,7 +12050,7 @@ const getBundlerReportPlugin = (opts, globalContext) => {
|
|
|
12092
12050
|
globalContext.bundler.outDir = build.initialOptions.outdir;
|
|
12093
12051
|
}
|
|
12094
12052
|
if (build.initialOptions.outfile) {
|
|
12095
|
-
globalContext.bundler.outDir =
|
|
12053
|
+
globalContext.bundler.outDir = path$i.dirname(build.initialOptions.outfile);
|
|
12096
12054
|
}
|
|
12097
12055
|
build.initialOptions.metafile = true;
|
|
12098
12056
|
}
|
|
@@ -13013,7 +12971,7 @@ function requireNode$1 () {
|
|
|
13013
12971
|
hasRequiredNode$1 = 1;
|
|
13014
12972
|
(function (module, exports) {
|
|
13015
12973
|
const tty = require$$0$1;
|
|
13016
|
-
const util = require$$1
|
|
12974
|
+
const util = require$$1;
|
|
13017
12975
|
|
|
13018
12976
|
/**
|
|
13019
12977
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -13926,7 +13884,7 @@ function requireNode () {
|
|
|
13926
13884
|
hasRequiredNode = 1;
|
|
13927
13885
|
(function (module, exports) {
|
|
13928
13886
|
const tty = require$$0$1;
|
|
13929
|
-
const util = require$$1
|
|
13887
|
+
const util = require$$1;
|
|
13930
13888
|
|
|
13931
13889
|
/**
|
|
13932
13890
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -19072,7 +19030,7 @@ const processInjections = async (toInject, log) => {
|
|
|
19072
19030
|
return results.filter(Boolean);
|
|
19073
19031
|
};
|
|
19074
19032
|
|
|
19075
|
-
const getInjectionPlugins = (opts, context, toInject) => {
|
|
19033
|
+
const getInjectionPlugins = (bundler, opts, context, toInject) => {
|
|
19076
19034
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$4);
|
|
19077
19035
|
const contentToInject = [];
|
|
19078
19036
|
const getContentToInject = () => {
|
|
@@ -19094,27 +19052,7 @@ ${after}`;
|
|
|
19094
19052
|
return "";
|
|
19095
19053
|
}
|
|
19096
19054
|
};
|
|
19097
|
-
|
|
19098
|
-
// Resolve the injected file for all bundlers.
|
|
19099
|
-
{
|
|
19100
|
-
name: RESOLUTION_PLUGIN_NAME,
|
|
19101
|
-
enforce: "pre",
|
|
19102
|
-
async resolveId(id) {
|
|
19103
|
-
if (isInjection(id)) {
|
|
19104
|
-
return { id, moduleSideEffects: true };
|
|
19105
|
-
}
|
|
19106
|
-
},
|
|
19107
|
-
loadInclude(id) {
|
|
19108
|
-
if (isInjection(id)) {
|
|
19109
|
-
return true;
|
|
19110
|
-
}
|
|
19111
|
-
},
|
|
19112
|
-
load(id) {
|
|
19113
|
-
if (isInjection(id)) {
|
|
19114
|
-
return getContentToInject();
|
|
19115
|
-
}
|
|
19116
|
-
}
|
|
19117
|
-
},
|
|
19055
|
+
const plugins = [
|
|
19118
19056
|
// Prepare and fetch the content to inject for all bundlers.
|
|
19119
19057
|
{
|
|
19120
19058
|
name: PREPARATION_PLUGIN_NAME,
|
|
@@ -19123,103 +19061,93 @@ ${after}`;
|
|
|
19123
19061
|
async buildStart() {
|
|
19124
19062
|
const results = await processInjections(toInject, log);
|
|
19125
19063
|
contentToInject.push(...results);
|
|
19064
|
+
if (context.bundler.name !== "esbuild") {
|
|
19065
|
+
return;
|
|
19066
|
+
}
|
|
19067
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19068
|
+
context.bundler.outDir,
|
|
19069
|
+
INJECTED_FILE_PATH
|
|
19070
|
+
);
|
|
19071
|
+
try {
|
|
19072
|
+
await fs$j.promises.mkdir(path$i.dirname(absolutePathInjectFile), {
|
|
19073
|
+
recursive: true
|
|
19074
|
+
});
|
|
19075
|
+
await fs$j.promises.writeFile(absolutePathInjectFile, getContentToInject());
|
|
19076
|
+
} catch (e) {
|
|
19077
|
+
log(`Could not create the file: ${e.message}`, "error");
|
|
19078
|
+
}
|
|
19079
|
+
},
|
|
19080
|
+
async buildEnd() {
|
|
19081
|
+
if (context.bundler.name !== "esbuild") {
|
|
19082
|
+
return;
|
|
19083
|
+
}
|
|
19084
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19085
|
+
context.bundler.outDir,
|
|
19086
|
+
INJECTED_FILE_PATH
|
|
19087
|
+
);
|
|
19088
|
+
await fs$j.promises.rm(absolutePathInjectFile, {
|
|
19089
|
+
force: true,
|
|
19090
|
+
maxRetries: 3,
|
|
19091
|
+
recursive: true
|
|
19092
|
+
});
|
|
19126
19093
|
}
|
|
19127
19094
|
},
|
|
19128
|
-
// Inject the
|
|
19095
|
+
// Inject the file that will be home of all injected content.
|
|
19129
19096
|
// Each bundler has its own way to inject a file.
|
|
19130
19097
|
{
|
|
19131
19098
|
name: PLUGIN_NAME$4,
|
|
19132
19099
|
esbuild: {
|
|
19133
19100
|
setup(build) {
|
|
19134
19101
|
const { initialOptions } = build;
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
}
|
|
19142
|
-
return {
|
|
19143
|
-
pluginName: PLUGIN_NAME$4,
|
|
19144
|
-
path: require$$1.isAbsolute(args.path) ? args.path : require$$1.join(args.resolveDir, args.path),
|
|
19145
|
-
pluginData: {
|
|
19146
|
-
isInjectionResolver: true,
|
|
19147
|
-
originalPath: args.path,
|
|
19148
|
-
originalResolveDir: args.resolveDir
|
|
19149
|
-
},
|
|
19150
|
-
// Adding a suffix prevents esbuild from marking the entrypoint as resolved,
|
|
19151
|
-
// avoiding a dependency loop with the proxy module.
|
|
19152
|
-
// This ensures esbuild continues to traverse the module tree
|
|
19153
|
-
// and re-resolves the entrypoint when imported from the proxy module.
|
|
19154
|
-
suffix: "?datadogInjected=true"
|
|
19155
|
-
};
|
|
19156
|
-
});
|
|
19157
|
-
build.onLoad({ filter: /.*/ }, async (args) => {
|
|
19158
|
-
if (!args.pluginData?.isInjectionResolver) {
|
|
19159
|
-
return null;
|
|
19160
|
-
}
|
|
19161
|
-
const originalPath = args.pluginData.originalPath;
|
|
19162
|
-
const originalResolveDir = args.pluginData.originalResolveDir;
|
|
19163
|
-
const contents = `
|
|
19164
|
-
import ${JSON.stringify(INJECTED_FILE)};
|
|
19165
|
-
import * as OriginalModule from ${JSON.stringify(originalPath)};
|
|
19166
|
-
export default OriginalModule['default'.toString()];
|
|
19167
|
-
export * from ${JSON.stringify(originalPath)};
|
|
19168
|
-
`;
|
|
19169
|
-
return {
|
|
19170
|
-
loader: "js",
|
|
19171
|
-
pluginName: PLUGIN_NAME$4,
|
|
19172
|
-
contents,
|
|
19173
|
-
resolveDir: originalResolveDir
|
|
19174
|
-
};
|
|
19175
|
-
});
|
|
19102
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19103
|
+
context.bundler.outDir,
|
|
19104
|
+
INJECTED_FILE_PATH
|
|
19105
|
+
);
|
|
19106
|
+
initialOptions.inject = initialOptions.inject || [];
|
|
19107
|
+
initialOptions.inject.push(absolutePathInjectFile);
|
|
19176
19108
|
}
|
|
19177
19109
|
},
|
|
19178
19110
|
webpack: (compiler) => {
|
|
19179
|
-
const
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
context.bundler.variant === "5"
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19111
|
+
const BannerPlugin = compiler?.webpack?.BannerPlugin || bundler?.BannerPlugin || bundler?.default?.BannerPlugin;
|
|
19112
|
+
compiler?.webpack?.ChunkGraph || bundler?.ChunkGraph || bundler?.default?.ChunkGraph;
|
|
19113
|
+
if (!BannerPlugin) {
|
|
19114
|
+
log("Missing BannerPlugin", "error");
|
|
19115
|
+
}
|
|
19116
|
+
let chunkGraph;
|
|
19117
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME$4, (compilation) => {
|
|
19118
|
+
compilation.hooks.afterChunks.tap(PLUGIN_NAME$4, () => {
|
|
19119
|
+
chunkGraph = compilation.chunkGraph;
|
|
19120
|
+
});
|
|
19121
|
+
});
|
|
19122
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
19123
|
+
compiler.options.plugins.push(
|
|
19124
|
+
new BannerPlugin({
|
|
19125
|
+
// Not wrapped in comments.
|
|
19126
|
+
raw: true,
|
|
19127
|
+
// Doesn't seem to work, but it's supposed to only add
|
|
19128
|
+
// the banner to entry modules.
|
|
19129
|
+
entryOnly: true,
|
|
19130
|
+
banner(data) {
|
|
19131
|
+
if (context.bundler.variant === "5") {
|
|
19132
|
+
if (!chunkGraph || chunkGraph.getNumberOfEntryModules(data.chunk) === 0) {
|
|
19133
|
+
return "";
|
|
19134
|
+
}
|
|
19135
|
+
return getContentToInject();
|
|
19136
|
+
} else {
|
|
19137
|
+
if (!data.chunk?.hasEntryModule()) {
|
|
19138
|
+
return "";
|
|
19139
|
+
}
|
|
19140
|
+
return getContentToInject();
|
|
19205
19141
|
}
|
|
19206
|
-
const entry = originalEntry[entryName];
|
|
19207
|
-
newEntry[entryName] = // Webpack 4 and 5 have different entry formats.
|
|
19208
|
-
typeof entry === "string" ? [INJECTED_FILE, entry] : {
|
|
19209
|
-
...entry,
|
|
19210
|
-
import: [INJECTED_FILE, ...entry.import]
|
|
19211
|
-
};
|
|
19212
19142
|
}
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
return [INJECTED_FILE, originalEntry];
|
|
19216
|
-
};
|
|
19217
|
-
compiler.options.entry = injectEntry(compiler.options.entry);
|
|
19143
|
+
})
|
|
19144
|
+
);
|
|
19218
19145
|
},
|
|
19219
19146
|
rollup: rollupInjectionPlugin,
|
|
19220
19147
|
vite: rollupInjectionPlugin
|
|
19221
19148
|
}
|
|
19222
19149
|
];
|
|
19150
|
+
return plugins;
|
|
19223
19151
|
};
|
|
19224
19152
|
|
|
19225
19153
|
const getInternalPlugins = (options, meta) => {
|
|
@@ -19233,7 +19161,8 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19233
19161
|
name: meta.framework,
|
|
19234
19162
|
fullName: `${meta.framework}${variant}`,
|
|
19235
19163
|
variant,
|
|
19236
|
-
outDir: cwd
|
|
19164
|
+
outDir: cwd,
|
|
19165
|
+
version: meta.bundler.version || meta.bundler.VERSION
|
|
19237
19166
|
},
|
|
19238
19167
|
build: {
|
|
19239
19168
|
errors: [],
|
|
@@ -19249,7 +19178,7 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19249
19178
|
const bundlerReportPlugin = getBundlerReportPlugin(options, globalContext);
|
|
19250
19179
|
const buildReportPlugin = getBuildReportPlugin(options, globalContext);
|
|
19251
19180
|
const gitPlugin = getGitPlugin(options, globalContext);
|
|
19252
|
-
const injectionPlugins = getInjectionPlugins(options, globalContext, toInject);
|
|
19181
|
+
const injectionPlugins = getInjectionPlugins(meta.bundler, options, globalContext, toInject);
|
|
19253
19182
|
return {
|
|
19254
19183
|
globalContext,
|
|
19255
19184
|
internalPlugins: [bundlerReportPlugin, buildReportPlugin, gitPlugin, ...injectionPlugins]
|
|
@@ -19423,12 +19352,12 @@ if (typeof module !== "undefined") {
|
|
|
19423
19352
|
}
|
|
19424
19353
|
|
|
19425
19354
|
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
19426
|
-
if (
|
|
19355
|
+
if (path$i.extname(sourcemapFilePath) !== ".map") {
|
|
19427
19356
|
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
19428
19357
|
}
|
|
19429
19358
|
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
19430
19359
|
const relativePath = minifiedFilePath.replace(context.bundler.outDir, "");
|
|
19431
|
-
const minifiedUrl = options.minifiedPathPrefix ?
|
|
19360
|
+
const minifiedUrl = options.minifiedPathPrefix ? path$i.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
19432
19361
|
return {
|
|
19433
19362
|
minifiedFilePath,
|
|
19434
19363
|
minifiedUrl,
|
|
@@ -20301,7 +20230,7 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
20301
20230
|
sourcemap.sourcemapFilePath,
|
|
20302
20231
|
(reason) => {
|
|
20303
20232
|
warnings.push(
|
|
20304
|
-
`${
|
|
20233
|
+
`${path$i.basename(sourcemap.sourcemapFilePath)}: "${reason}"`
|
|
20305
20234
|
);
|
|
20306
20235
|
}
|
|
20307
20236
|
),
|
|
@@ -21122,7 +21051,7 @@ var polyfills = polyfills$1;
|
|
|
21122
21051
|
var legacy = legacyStreams;
|
|
21123
21052
|
var clone = clone_1;
|
|
21124
21053
|
|
|
21125
|
-
var util = require$$1
|
|
21054
|
+
var util = require$$1;
|
|
21126
21055
|
|
|
21127
21056
|
/* istanbul ignore next - node 0.x polyfill */
|
|
21128
21057
|
var gracefulQueue;
|
|
@@ -21672,7 +21601,7 @@ function retry () {
|
|
|
21672
21601
|
};
|
|
21673
21602
|
} (fs$i));
|
|
21674
21603
|
|
|
21675
|
-
const path$g =
|
|
21604
|
+
const path$g = path$i;
|
|
21676
21605
|
|
|
21677
21606
|
// get drive on windows
|
|
21678
21607
|
function getRootPath (p) {
|
|
@@ -21697,7 +21626,7 @@ var win32 = {
|
|
|
21697
21626
|
};
|
|
21698
21627
|
|
|
21699
21628
|
const fs$g = gracefulFs;
|
|
21700
|
-
const path$f =
|
|
21629
|
+
const path$f = path$i;
|
|
21701
21630
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
21702
21631
|
|
|
21703
21632
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -21759,7 +21688,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
21759
21688
|
var mkdirs_1$1 = mkdirs$2;
|
|
21760
21689
|
|
|
21761
21690
|
const fs$f = gracefulFs;
|
|
21762
|
-
const path$e =
|
|
21691
|
+
const path$e = path$i;
|
|
21763
21692
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
21764
21693
|
|
|
21765
21694
|
const o777 = parseInt('0777', 8);
|
|
@@ -21827,7 +21756,7 @@ var mkdirs_1 = {
|
|
|
21827
21756
|
|
|
21828
21757
|
const fs$e = gracefulFs;
|
|
21829
21758
|
const os = require$$0;
|
|
21830
|
-
const path$d =
|
|
21759
|
+
const path$d = path$i;
|
|
21831
21760
|
|
|
21832
21761
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
21833
21762
|
function hasMillisResSync () {
|
|
@@ -21916,7 +21845,7 @@ var buffer$1 = function (size) {
|
|
|
21916
21845
|
};
|
|
21917
21846
|
|
|
21918
21847
|
const fs$d = gracefulFs;
|
|
21919
|
-
const path$c =
|
|
21848
|
+
const path$c = path$i;
|
|
21920
21849
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
21921
21850
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
21922
21851
|
|
|
@@ -22124,7 +22053,7 @@ var pathExists_1 = {
|
|
|
22124
22053
|
};
|
|
22125
22054
|
|
|
22126
22055
|
const fs$b = gracefulFs;
|
|
22127
|
-
const path$b =
|
|
22056
|
+
const path$b = path$i;
|
|
22128
22057
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
22129
22058
|
const pathExists$7 = pathExists_1.pathExists;
|
|
22130
22059
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -22374,7 +22303,7 @@ var copy$1 = {
|
|
|
22374
22303
|
};
|
|
22375
22304
|
|
|
22376
22305
|
const fs$a = gracefulFs;
|
|
22377
|
-
const path$a =
|
|
22306
|
+
const path$a = path$i;
|
|
22378
22307
|
const assert = require$$5;
|
|
22379
22308
|
|
|
22380
22309
|
const isWindows = (process.platform === 'win32');
|
|
@@ -22696,7 +22625,7 @@ var remove$3 = {
|
|
|
22696
22625
|
|
|
22697
22626
|
const u$7 = universalify.fromCallback;
|
|
22698
22627
|
const fs$9 = fs$j;
|
|
22699
|
-
const path$9 =
|
|
22628
|
+
const path$9 = path$i;
|
|
22700
22629
|
const mkdir$5 = mkdirs_1;
|
|
22701
22630
|
const remove$2 = remove$3;
|
|
22702
22631
|
|
|
@@ -22742,7 +22671,7 @@ var empty$2 = {
|
|
|
22742
22671
|
};
|
|
22743
22672
|
|
|
22744
22673
|
const u$6 = universalify.fromCallback;
|
|
22745
|
-
const path$8 =
|
|
22674
|
+
const path$8 = path$i;
|
|
22746
22675
|
const fs$8 = gracefulFs;
|
|
22747
22676
|
const mkdir$4 = mkdirs_1;
|
|
22748
22677
|
const pathExists$6 = pathExists_1.pathExists;
|
|
@@ -22790,7 +22719,7 @@ var file$1 = {
|
|
|
22790
22719
|
};
|
|
22791
22720
|
|
|
22792
22721
|
const u$5 = universalify.fromCallback;
|
|
22793
|
-
const path$7 =
|
|
22722
|
+
const path$7 = path$i;
|
|
22794
22723
|
const fs$7 = gracefulFs;
|
|
22795
22724
|
const mkdir$3 = mkdirs_1;
|
|
22796
22725
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -22849,7 +22778,7 @@ var link$1 = {
|
|
|
22849
22778
|
createLinkSync
|
|
22850
22779
|
};
|
|
22851
22780
|
|
|
22852
|
-
const path$6 =
|
|
22781
|
+
const path$6 = path$i;
|
|
22853
22782
|
const fs$6 = gracefulFs;
|
|
22854
22783
|
const pathExists$4 = pathExists_1.pathExists;
|
|
22855
22784
|
|
|
@@ -22978,7 +22907,7 @@ var symlinkType_1 = {
|
|
|
22978
22907
|
};
|
|
22979
22908
|
|
|
22980
22909
|
const u$4 = universalify.fromCallback;
|
|
22981
|
-
const path$5 =
|
|
22910
|
+
const path$5 = path$i;
|
|
22982
22911
|
const fs$4 = gracefulFs;
|
|
22983
22912
|
const _mkdirs = mkdirs_1;
|
|
22984
22913
|
const mkdirs = _mkdirs.mkdirs;
|
|
@@ -23207,7 +23136,7 @@ var jsonfile = {
|
|
|
23207
23136
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
23208
23137
|
};
|
|
23209
23138
|
|
|
23210
|
-
const path$4 =
|
|
23139
|
+
const path$4 = path$i;
|
|
23211
23140
|
const mkdir$2 = mkdirs_1;
|
|
23212
23141
|
const pathExists$2 = pathExists_1.pathExists;
|
|
23213
23142
|
const jsonFile$2 = jsonfile;
|
|
@@ -23234,7 +23163,7 @@ function outputJson (file, data, options, callback) {
|
|
|
23234
23163
|
var outputJson_1 = outputJson;
|
|
23235
23164
|
|
|
23236
23165
|
const fs$3 = gracefulFs;
|
|
23237
|
-
const path$3 =
|
|
23166
|
+
const path$3 = path$i;
|
|
23238
23167
|
const mkdir$1 = mkdirs_1;
|
|
23239
23168
|
const jsonFile$1 = jsonfile;
|
|
23240
23169
|
|
|
@@ -23266,7 +23195,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
23266
23195
|
var json = jsonFile;
|
|
23267
23196
|
|
|
23268
23197
|
const fs$2 = gracefulFs;
|
|
23269
|
-
const path$2 =
|
|
23198
|
+
const path$2 = path$i;
|
|
23270
23199
|
const copySync = copySync$1.copySync;
|
|
23271
23200
|
const removeSync = remove$3.removeSync;
|
|
23272
23201
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -23383,7 +23312,7 @@ var moveSync_1 = {
|
|
|
23383
23312
|
|
|
23384
23313
|
const u$1 = universalify.fromCallback;
|
|
23385
23314
|
const fs$1 = gracefulFs;
|
|
23386
|
-
const path$1 =
|
|
23315
|
+
const path$1 = path$i;
|
|
23387
23316
|
const copy = copy$1.copy;
|
|
23388
23317
|
const remove$1 = remove$3.remove;
|
|
23389
23318
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -23464,7 +23393,7 @@ var move_1 = {
|
|
|
23464
23393
|
|
|
23465
23394
|
const u = universalify.fromCallback;
|
|
23466
23395
|
const fs = gracefulFs;
|
|
23467
|
-
const path =
|
|
23396
|
+
const path = path$i;
|
|
23468
23397
|
const mkdir = mkdirs_1;
|
|
23469
23398
|
const pathExists = pathExists_1.pathExists;
|
|
23470
23399
|
|
|
@@ -23934,7 +23863,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23934
23863
|
} else if (typeof outputOptions === "string") {
|
|
23935
23864
|
destination = outputOptions;
|
|
23936
23865
|
}
|
|
23937
|
-
const outputPath =
|
|
23866
|
+
const outputPath = path$i.resolve(cwd, destination);
|
|
23938
23867
|
try {
|
|
23939
23868
|
const errors = {};
|
|
23940
23869
|
const filesToWrite = {};
|
|
@@ -23953,7 +23882,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23953
23882
|
const proms = Object.keys(filesToWrite).map((file) => {
|
|
23954
23883
|
const start = Date.now();
|
|
23955
23884
|
log(`Start writing ${file}.json.`);
|
|
23956
|
-
return writeFile(
|
|
23885
|
+
return writeFile(path$i.join(outputPath, `${file}.json`), filesToWrite[file].content).then(() => {
|
|
23957
23886
|
log(`Wrote ${file}.json in ${formatDuration(Date.now() - start)}`);
|
|
23958
23887
|
}).catch((e) => {
|
|
23959
23888
|
log(
|
|
@@ -34325,7 +34254,7 @@ virtualStats.VirtualStats = VirtualStats;
|
|
|
34325
34254
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
34326
34255
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34327
34256
|
};
|
|
34328
|
-
const path_1 = __importDefault(
|
|
34257
|
+
const path_1 = __importDefault(path$i);
|
|
34329
34258
|
const virtual_stats_1 = virtualStats;
|
|
34330
34259
|
let inode = 45000000;
|
|
34331
34260
|
const ALL = 'all';
|
|
@@ -34609,7 +34538,7 @@ var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
|
34609
34538
|
|
|
34610
34539
|
// node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
|
|
34611
34540
|
var getFilename = () => url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
34612
|
-
var getDirname = () =>
|
|
34541
|
+
var getDirname = () => path$i.dirname(getFilename());
|
|
34613
34542
|
var __dirname$1 = /* @__PURE__ */ getDirname();
|
|
34614
34543
|
|
|
34615
34544
|
// node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -35361,8 +35290,8 @@ function remapping(input, loader, options) {
|
|
|
35361
35290
|
return new SourceMap(traceMappings(tree), opts);
|
|
35362
35291
|
}
|
|
35363
35292
|
function normalizeAbsolutePath(path6) {
|
|
35364
|
-
if (
|
|
35365
|
-
return
|
|
35293
|
+
if (path$i.isAbsolute(path6))
|
|
35294
|
+
return path$i.normalize(path6);
|
|
35366
35295
|
else
|
|
35367
35296
|
return path6;
|
|
35368
35297
|
}
|
|
@@ -35410,7 +35339,7 @@ var ExtToLoader = {
|
|
|
35410
35339
|
".txt": "text"
|
|
35411
35340
|
};
|
|
35412
35341
|
function guessLoader(code, id) {
|
|
35413
|
-
return ExtToLoader[
|
|
35342
|
+
return ExtToLoader[path$i.extname(id).toLowerCase()] || "js";
|
|
35414
35343
|
}
|
|
35415
35344
|
function unwrapLoader(loader, code, id) {
|
|
35416
35345
|
if (typeof loader === "function")
|
|
@@ -35484,8 +35413,8 @@ function createBuildContext(initialOptions) {
|
|
|
35484
35413
|
emitFile(emittedFile) {
|
|
35485
35414
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
35486
35415
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
35487
|
-
const outPath =
|
|
35488
|
-
const outDir =
|
|
35416
|
+
const outPath = path$i.resolve(initialOptions.outdir, outFileName);
|
|
35417
|
+
const outDir = path$i.dirname(outPath);
|
|
35489
35418
|
if (!fs$j.existsSync(outDir))
|
|
35490
35419
|
fs$j.mkdirSync(outDir, { recursive: true });
|
|
35491
35420
|
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
@@ -35686,7 +35615,7 @@ function buildSetup(meta) {
|
|
|
35686
35615
|
onLoad({ filter: onLoadFilter }, async (args) => {
|
|
35687
35616
|
const id = args.path + args.suffix;
|
|
35688
35617
|
const { errors, warnings, mixedContext } = createPluginContext(context);
|
|
35689
|
-
const resolveDir =
|
|
35618
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35690
35619
|
let code, map;
|
|
35691
35620
|
if (plugin.load && (!plugin.loadInclude || plugin.loadInclude(id))) {
|
|
35692
35621
|
const result = await plugin.load.call(mixedContext, id);
|
|
@@ -35717,7 +35646,7 @@ function buildSetup(meta) {
|
|
|
35717
35646
|
if (plugin.transformInclude && !plugin.transformInclude(id))
|
|
35718
35647
|
return;
|
|
35719
35648
|
const { mixedContext, errors, warnings } = createPluginContext(context);
|
|
35720
|
-
const resolveDir =
|
|
35649
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35721
35650
|
let code = await args.getContents();
|
|
35722
35651
|
let map;
|
|
35723
35652
|
const result = await plugin.transform.call(mixedContext, code, id);
|
|
@@ -35775,7 +35704,7 @@ function createFarmContext(context, currentResolveId) {
|
|
|
35775
35704
|
resolvedPath: outFileName,
|
|
35776
35705
|
name: outFileName,
|
|
35777
35706
|
content: [...buffer$2.Buffer.from(emittedFile.source)],
|
|
35778
|
-
resourceType:
|
|
35707
|
+
resourceType: path$i.extname(outFileName)
|
|
35779
35708
|
});
|
|
35780
35709
|
}
|
|
35781
35710
|
},
|
|
@@ -35809,7 +35738,7 @@ var ExtToLoader2 = {
|
|
|
35809
35738
|
".node": "napi"
|
|
35810
35739
|
};
|
|
35811
35740
|
function guessIdLoader(id) {
|
|
35812
|
-
return ExtToLoader2[
|
|
35741
|
+
return ExtToLoader2[path$i.extname(id).toLowerCase()] || "js";
|
|
35813
35742
|
}
|
|
35814
35743
|
function transformQuery(context) {
|
|
35815
35744
|
const queryParamsObject = {};
|
|
@@ -35899,7 +35828,7 @@ function toFarmPlugin(plugin, options) {
|
|
|
35899
35828
|
farmPlugin.resolve = {
|
|
35900
35829
|
filters: { sources: [".*", ...filters], importers: [".*"] },
|
|
35901
35830
|
async executor(params, context) {
|
|
35902
|
-
const resolvedIdPath =
|
|
35831
|
+
const resolvedIdPath = path$i.resolve(
|
|
35903
35832
|
process.cwd(),
|
|
35904
35833
|
params.importer ?? ""
|
|
35905
35834
|
);
|
|
@@ -36106,11 +36035,11 @@ function createBuildContext2(compilation) {
|
|
|
36106
36035
|
}
|
|
36107
36036
|
|
|
36108
36037
|
// src/rspack/index.ts
|
|
36109
|
-
var TRANSFORM_LOADER =
|
|
36038
|
+
var TRANSFORM_LOADER = path$i.resolve(
|
|
36110
36039
|
__dirname$1,
|
|
36111
36040
|
"rspack/loaders/transform"
|
|
36112
36041
|
);
|
|
36113
|
-
var LOAD_LOADER =
|
|
36042
|
+
var LOAD_LOADER = path$i.resolve(
|
|
36114
36043
|
__dirname$1,
|
|
36115
36044
|
"rspack/loaders/load"
|
|
36116
36045
|
);
|
|
@@ -36118,7 +36047,7 @@ function getRspackPlugin(factory) {
|
|
|
36118
36047
|
return (userOptions) => {
|
|
36119
36048
|
return {
|
|
36120
36049
|
apply(compiler) {
|
|
36121
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36050
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process.cwd(), "_virtual_");
|
|
36122
36051
|
const injected = compiler.$unpluginContext || {};
|
|
36123
36052
|
compiler.$unpluginContext = injected;
|
|
36124
36053
|
const meta = {
|
|
@@ -36228,7 +36157,7 @@ function createBuildContext3(options, compilation) {
|
|
|
36228
36157
|
});
|
|
36229
36158
|
},
|
|
36230
36159
|
addWatchFile(id) {
|
|
36231
|
-
options.addWatchFile(
|
|
36160
|
+
options.addWatchFile(path$i.resolve(process2.cwd(), id));
|
|
36232
36161
|
},
|
|
36233
36162
|
emitFile(emittedFile) {
|
|
36234
36163
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
@@ -36262,11 +36191,11 @@ function normalizeMessage(error) {
|
|
|
36262
36191
|
}
|
|
36263
36192
|
|
|
36264
36193
|
// src/webpack/index.ts
|
|
36265
|
-
var TRANSFORM_LOADER2 =
|
|
36194
|
+
var TRANSFORM_LOADER2 = path$i.resolve(
|
|
36266
36195
|
__dirname$1,
|
|
36267
36196
|
"webpack/loaders/transform"
|
|
36268
36197
|
);
|
|
36269
|
-
var LOAD_LOADER2 =
|
|
36198
|
+
var LOAD_LOADER2 = path$i.resolve(
|
|
36270
36199
|
__dirname$1,
|
|
36271
36200
|
"webpack/loaders/load"
|
|
36272
36201
|
);
|
|
@@ -36274,7 +36203,7 @@ function getWebpackPlugin(factory) {
|
|
|
36274
36203
|
return (userOptions) => {
|
|
36275
36204
|
return {
|
|
36276
36205
|
apply(compiler) {
|
|
36277
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36206
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process2.cwd(), "_virtual_");
|
|
36278
36207
|
const injected = compiler.$unpluginContext || {};
|
|
36279
36208
|
compiler.$unpluginContext = injected;
|
|
36280
36209
|
const meta = {
|
|
@@ -36481,6 +36410,7 @@ const validateOptions = (options = {}) => {
|
|
|
36481
36410
|
};
|
|
36482
36411
|
const HOST_NAME = "datadog-build-plugins";
|
|
36483
36412
|
const buildPluginFactory = ({
|
|
36413
|
+
bundler,
|
|
36484
36414
|
version
|
|
36485
36415
|
}) => {
|
|
36486
36416
|
return createUnplugin((opts, unpluginMetaContext) => {
|
|
@@ -36489,6 +36419,7 @@ const buildPluginFactory = ({
|
|
|
36489
36419
|
unpluginMetaContext.esbuildHostName = HOST_NAME;
|
|
36490
36420
|
}
|
|
36491
36421
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
36422
|
+
bundler,
|
|
36492
36423
|
version,
|
|
36493
36424
|
...unpluginMetaContext
|
|
36494
36425
|
});
|
|
@@ -36511,7 +36442,7 @@ const buildPluginFactory = ({
|
|
|
36511
36442
|
|
|
36512
36443
|
var name = "@datadog/esbuild-plugin";
|
|
36513
36444
|
var packageManager = "yarn@4.0.2";
|
|
36514
|
-
var version$1 = "2.3.1-dev-
|
|
36445
|
+
var version$1 = "2.3.1-dev-12";
|
|
36515
36446
|
var license = "MIT";
|
|
36516
36447
|
var author = "Datadog";
|
|
36517
36448
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -36599,6 +36530,7 @@ var pkg = {
|
|
|
36599
36530
|
};
|
|
36600
36531
|
|
|
36601
36532
|
const datadogEsbuildPlugin = buildPluginFactory({
|
|
36533
|
+
bundler: esbuild,
|
|
36602
36534
|
version: pkg.version
|
|
36603
36535
|
}).esbuild;
|
|
36604
36536
|
const version = pkg.version;
|