@datadog/esbuild-plugin 2.3.1-dev-9 → 2.3.1-dev-10
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 +280 -368
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +270 -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,177 @@ 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/")
|
|
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
|
+
for (const depIdentifier of dependencies) {
|
|
11858
|
+
const depDeps = tempDeps.get(depIdentifier) || {
|
|
11859
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11860
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11861
|
+
};
|
|
11862
|
+
depDeps.dependents.add(moduleIdentifier);
|
|
11863
|
+
tempDeps.set(depIdentifier, depDeps);
|
|
11864
|
+
}
|
|
11865
|
+
if (!isModuleSupported(moduleIdentifier)) {
|
|
11866
|
+
continue;
|
|
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
|
+
for (const chunk of chunks) {
|
|
11921
|
+
const files = getChunkFiles(chunk);
|
|
11922
|
+
const chunkModules = chunk.getModules().flatMap((m) => {
|
|
11923
|
+
return "modules" in m && Array.isArray(m.modules) ? m.modules.map((m2) => m2.identifier()) : m.identifier();
|
|
11924
|
+
}).filter(isModuleSupported);
|
|
11925
|
+
for (const file of files) {
|
|
11926
|
+
if (getType(file) === "map") {
|
|
11927
|
+
continue;
|
|
11871
11928
|
}
|
|
11929
|
+
const fileModules = modulesPerFile.get(file) || [];
|
|
11930
|
+
modulesPerFile.set(file, [...fileModules, ...chunkModules]);
|
|
11872
11931
|
}
|
|
11873
11932
|
}
|
|
11874
11933
|
for (const asset of assets) {
|
|
11875
11934
|
const file = {
|
|
11876
|
-
size: asset.
|
|
11935
|
+
size: asset.source.size() || 0,
|
|
11877
11936
|
name: asset.name,
|
|
11878
11937
|
inputs: [],
|
|
11879
11938
|
filepath: getAbsolutePath(context.bundler.outDir, asset.name),
|
|
11880
11939
|
type: getType(asset.name)
|
|
11881
11940
|
};
|
|
11882
|
-
reportOutputsIndexed
|
|
11941
|
+
reportOutputsIndexed.set(file.filepath, file);
|
|
11883
11942
|
outputs.push(file);
|
|
11884
11943
|
if (file.type === "map") {
|
|
11885
11944
|
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
|
-
continue;
|
|
11893
|
-
}
|
|
11894
|
-
sourcemap.inputs.push(outputFound);
|
|
11895
|
-
}
|
|
11896
|
-
const getModulePath = (module) => {
|
|
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)) {
|
|
11938
11945
|
continue;
|
|
11939
11946
|
}
|
|
11940
|
-
const
|
|
11941
|
-
if (
|
|
11947
|
+
const fileModules = modulesPerFile.get(file.filepath);
|
|
11948
|
+
if (!fileModules) {
|
|
11949
|
+
warn(`Could not find modules for ${file.name}`);
|
|
11942
11950
|
continue;
|
|
11943
11951
|
}
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
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) {
|
|
11952
|
+
for (const moduleIdentifier of fileModules) {
|
|
11953
|
+
const inputFound = reportInputsIndexed.get(moduleIdentifier);
|
|
11954
|
+
if (!inputFound) {
|
|
11955
|
+
warn(`Could not find input of ${moduleIdentifier}`);
|
|
11976
11956
|
continue;
|
|
11977
11957
|
}
|
|
11978
|
-
|
|
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}`);
|
|
11985
|
-
continue;
|
|
11986
|
-
}
|
|
11987
|
-
if (!outputFound.inputs.includes(file)) {
|
|
11988
|
-
outputFound.inputs.push(file);
|
|
11989
|
-
}
|
|
11958
|
+
file.inputs.push(inputFound);
|
|
11990
11959
|
}
|
|
11991
|
-
reportInputsIndexed[modulePath] = file;
|
|
11992
|
-
inputs.push(file);
|
|
11993
11960
|
}
|
|
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}`);
|
|
11961
|
+
for (const sourcemap of tempSourcemaps) {
|
|
11962
|
+
const outputFound = reportOutputsIndexed.get(
|
|
11963
|
+
sourcemap.filepath.replace(/\.map$/, "")
|
|
11964
|
+
);
|
|
11965
|
+
if (!outputFound) {
|
|
11966
|
+
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
12005
11967
|
continue;
|
|
12006
11968
|
}
|
|
12007
|
-
|
|
12008
|
-
input.dependents = cleanReport(depsReport.dependents, input.filepath, getInput);
|
|
11969
|
+
sourcemap.inputs.push(outputFound);
|
|
12009
11970
|
}
|
|
12010
|
-
for (const [name,
|
|
11971
|
+
for (const [name, entrypoint] of result.entrypoints) {
|
|
12011
11972
|
const entryOutputs = [];
|
|
12012
11973
|
const entryInputs = [];
|
|
12013
11974
|
let size = 0;
|
|
12014
|
-
const
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
if (typeof asset === "string") {
|
|
12021
|
-
assetPath = getAbsolutePath(context.bundler.outDir, asset);
|
|
12022
|
-
} else if (typeof asset.name === "string") {
|
|
12023
|
-
assetPath = getAbsolutePath(context.bundler.outDir, asset.name);
|
|
12024
|
-
}
|
|
12025
|
-
if (!assetPath || !reportOutputsIndexed[assetPath]) {
|
|
12026
|
-
warn(`Could not find output of ${JSON.stringify(asset)}`);
|
|
11975
|
+
const entryFiles = entrypoint.chunks.flatMap(getChunkFiles);
|
|
11976
|
+
const entryFilename = entrypoint.chunks.filter((c) => c.entryModule).flatMap((c) => Array.from(c.files))[0];
|
|
11977
|
+
for (const file2 of entryFiles) {
|
|
11978
|
+
const outputFound = reportOutputsIndexed.get(file2);
|
|
11979
|
+
if (!file2 || !outputFound) {
|
|
11980
|
+
warn(`Could not find output of ${JSON.stringify(file2)}`);
|
|
12027
11981
|
continue;
|
|
12028
11982
|
}
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
entryInputs.push(...outputFound.inputs);
|
|
12034
|
-
size += outputFound.size;
|
|
12035
|
-
}
|
|
11983
|
+
if (outputFound.type !== "map" && !entryOutputs.includes(outputFound)) {
|
|
11984
|
+
entryOutputs.push(outputFound);
|
|
11985
|
+
entryInputs.push(...outputFound.inputs);
|
|
11986
|
+
size += outputFound.size;
|
|
12036
11987
|
}
|
|
12037
11988
|
}
|
|
12038
|
-
const entryFilename = stats.assetsByChunkName?.[name]?.[0];
|
|
12039
11989
|
const file = {
|
|
12040
11990
|
name,
|
|
12041
11991
|
filepath: entryFilename ? getAbsolutePath(context.bundler.outDir, entryFilename) : "unknown",
|
|
@@ -12046,6 +11996,8 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
12046
11996
|
};
|
|
12047
11997
|
entries.push(file);
|
|
12048
11998
|
}
|
|
11999
|
+
context.build.errors = result.errors.map((err) => err.message);
|
|
12000
|
+
context.build.warnings = [...warnings, ...result.warnings.map((err) => err.message)];
|
|
12049
12001
|
context.build.inputs = inputs;
|
|
12050
12002
|
context.build.outputs = outputs;
|
|
12051
12003
|
context.build.entries = entries;
|
|
@@ -12092,7 +12044,7 @@ const getBundlerReportPlugin = (opts, globalContext) => {
|
|
|
12092
12044
|
globalContext.bundler.outDir = build.initialOptions.outdir;
|
|
12093
12045
|
}
|
|
12094
12046
|
if (build.initialOptions.outfile) {
|
|
12095
|
-
globalContext.bundler.outDir =
|
|
12047
|
+
globalContext.bundler.outDir = path$i.dirname(build.initialOptions.outfile);
|
|
12096
12048
|
}
|
|
12097
12049
|
build.initialOptions.metafile = true;
|
|
12098
12050
|
}
|
|
@@ -13013,7 +12965,7 @@ function requireNode$1 () {
|
|
|
13013
12965
|
hasRequiredNode$1 = 1;
|
|
13014
12966
|
(function (module, exports) {
|
|
13015
12967
|
const tty = require$$0$1;
|
|
13016
|
-
const util = require$$1
|
|
12968
|
+
const util = require$$1;
|
|
13017
12969
|
|
|
13018
12970
|
/**
|
|
13019
12971
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -13926,7 +13878,7 @@ function requireNode () {
|
|
|
13926
13878
|
hasRequiredNode = 1;
|
|
13927
13879
|
(function (module, exports) {
|
|
13928
13880
|
const tty = require$$0$1;
|
|
13929
|
-
const util = require$$1
|
|
13881
|
+
const util = require$$1;
|
|
13930
13882
|
|
|
13931
13883
|
/**
|
|
13932
13884
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -19072,7 +19024,7 @@ const processInjections = async (toInject, log) => {
|
|
|
19072
19024
|
return results.filter(Boolean);
|
|
19073
19025
|
};
|
|
19074
19026
|
|
|
19075
|
-
const getInjectionPlugins = (opts, context, toInject) => {
|
|
19027
|
+
const getInjectionPlugins = (bundler, opts, context, toInject) => {
|
|
19076
19028
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$4);
|
|
19077
19029
|
const contentToInject = [];
|
|
19078
19030
|
const getContentToInject = () => {
|
|
@@ -19094,27 +19046,7 @@ ${after}`;
|
|
|
19094
19046
|
return "";
|
|
19095
19047
|
}
|
|
19096
19048
|
};
|
|
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
|
-
},
|
|
19049
|
+
const plugins = [
|
|
19118
19050
|
// Prepare and fetch the content to inject for all bundlers.
|
|
19119
19051
|
{
|
|
19120
19052
|
name: PREPARATION_PLUGIN_NAME,
|
|
@@ -19123,103 +19055,79 @@ ${after}`;
|
|
|
19123
19055
|
async buildStart() {
|
|
19124
19056
|
const results = await processInjections(toInject, log);
|
|
19125
19057
|
contentToInject.push(...results);
|
|
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
|
+
try {
|
|
19066
|
+
await fs$j.promises.mkdir(path$i.dirname(absolutePathInjectFile), {
|
|
19067
|
+
recursive: true
|
|
19068
|
+
});
|
|
19069
|
+
await fs$j.promises.writeFile(absolutePathInjectFile, getContentToInject());
|
|
19070
|
+
} catch (e) {
|
|
19071
|
+
log(`Could not create the file: ${e.message}`, "error");
|
|
19072
|
+
}
|
|
19073
|
+
},
|
|
19074
|
+
async buildEnd() {
|
|
19075
|
+
if (context.bundler.name !== "esbuild") {
|
|
19076
|
+
return;
|
|
19077
|
+
}
|
|
19078
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19079
|
+
context.bundler.outDir,
|
|
19080
|
+
INJECTED_FILE_PATH
|
|
19081
|
+
);
|
|
19082
|
+
await fs$j.promises.rm(absolutePathInjectFile, {
|
|
19083
|
+
force: true,
|
|
19084
|
+
maxRetries: 3,
|
|
19085
|
+
recursive: true
|
|
19086
|
+
});
|
|
19126
19087
|
}
|
|
19127
19088
|
},
|
|
19128
|
-
// Inject the
|
|
19089
|
+
// Inject the file that will be home of all injected content.
|
|
19129
19090
|
// Each bundler has its own way to inject a file.
|
|
19130
19091
|
{
|
|
19131
19092
|
name: PLUGIN_NAME$4,
|
|
19132
19093
|
esbuild: {
|
|
19133
19094
|
setup(build) {
|
|
19134
19095
|
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
|
-
});
|
|
19096
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19097
|
+
context.bundler.outDir,
|
|
19098
|
+
INJECTED_FILE_PATH
|
|
19099
|
+
);
|
|
19100
|
+
initialOptions.inject = initialOptions.inject || [];
|
|
19101
|
+
initialOptions.inject.push(absolutePathInjectFile);
|
|
19176
19102
|
}
|
|
19177
19103
|
},
|
|
19178
19104
|
webpack: (compiler) => {
|
|
19179
|
-
const
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
}
|
|
19195
|
-
if (typeof originalEntry === "object") {
|
|
19196
|
-
const newEntry = {};
|
|
19197
|
-
if (Object.keys(originalEntry).length === 0) {
|
|
19198
|
-
newEntry[INJECTED_FILE] = // Webpack 4 and 5 have different entry formats.
|
|
19199
|
-
context.bundler.variant === "5" ? { import: [INJECTED_FILE] } : INJECTED_FILE;
|
|
19200
|
-
return newEntry;
|
|
19201
|
-
}
|
|
19202
|
-
for (const entryName in originalEntry) {
|
|
19203
|
-
if (!Object.hasOwn(originalEntry, entryName)) {
|
|
19204
|
-
continue;
|
|
19105
|
+
const BannerPlugin = compiler?.webpack?.BannerPlugin || bundler?.BannerPlugin || bundler?.default?.BannerPlugin;
|
|
19106
|
+
if (!BannerPlugin) {
|
|
19107
|
+
log("Missing BannerPlugin", "error");
|
|
19108
|
+
}
|
|
19109
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
19110
|
+
compiler.options.plugins.push(
|
|
19111
|
+
new BannerPlugin({
|
|
19112
|
+
// Not wrapped in comments.
|
|
19113
|
+
raw: true,
|
|
19114
|
+
// Not sure this is actually working, but it's supposed to only add
|
|
19115
|
+
// the banner to entry modules.
|
|
19116
|
+
entryOnly: true,
|
|
19117
|
+
banner({ chunk }) {
|
|
19118
|
+
if (!chunk?.entryModule) {
|
|
19119
|
+
return "";
|
|
19205
19120
|
}
|
|
19206
|
-
|
|
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
|
-
};
|
|
19121
|
+
return getContentToInject();
|
|
19212
19122
|
}
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
return [INJECTED_FILE, originalEntry];
|
|
19216
|
-
};
|
|
19217
|
-
compiler.options.entry = injectEntry(compiler.options.entry);
|
|
19123
|
+
})
|
|
19124
|
+
);
|
|
19218
19125
|
},
|
|
19219
19126
|
rollup: rollupInjectionPlugin,
|
|
19220
19127
|
vite: rollupInjectionPlugin
|
|
19221
19128
|
}
|
|
19222
19129
|
];
|
|
19130
|
+
return plugins;
|
|
19223
19131
|
};
|
|
19224
19132
|
|
|
19225
19133
|
const getInternalPlugins = (options, meta) => {
|
|
@@ -19233,7 +19141,8 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19233
19141
|
name: meta.framework,
|
|
19234
19142
|
fullName: `${meta.framework}${variant}`,
|
|
19235
19143
|
variant,
|
|
19236
|
-
outDir: cwd
|
|
19144
|
+
outDir: cwd,
|
|
19145
|
+
version: meta.bundler.version || meta.bundler.VERSION
|
|
19237
19146
|
},
|
|
19238
19147
|
build: {
|
|
19239
19148
|
errors: [],
|
|
@@ -19249,7 +19158,7 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19249
19158
|
const bundlerReportPlugin = getBundlerReportPlugin(options, globalContext);
|
|
19250
19159
|
const buildReportPlugin = getBuildReportPlugin(options, globalContext);
|
|
19251
19160
|
const gitPlugin = getGitPlugin(options, globalContext);
|
|
19252
|
-
const injectionPlugins = getInjectionPlugins(options, globalContext, toInject);
|
|
19161
|
+
const injectionPlugins = getInjectionPlugins(meta.bundler, options, globalContext, toInject);
|
|
19253
19162
|
return {
|
|
19254
19163
|
globalContext,
|
|
19255
19164
|
internalPlugins: [bundlerReportPlugin, buildReportPlugin, gitPlugin, ...injectionPlugins]
|
|
@@ -19423,12 +19332,12 @@ if (typeof module !== "undefined") {
|
|
|
19423
19332
|
}
|
|
19424
19333
|
|
|
19425
19334
|
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
19426
|
-
if (
|
|
19335
|
+
if (path$i.extname(sourcemapFilePath) !== ".map") {
|
|
19427
19336
|
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
19428
19337
|
}
|
|
19429
19338
|
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
19430
19339
|
const relativePath = minifiedFilePath.replace(context.bundler.outDir, "");
|
|
19431
|
-
const minifiedUrl = options.minifiedPathPrefix ?
|
|
19340
|
+
const minifiedUrl = options.minifiedPathPrefix ? path$i.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
19432
19341
|
return {
|
|
19433
19342
|
minifiedFilePath,
|
|
19434
19343
|
minifiedUrl,
|
|
@@ -20301,7 +20210,7 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
20301
20210
|
sourcemap.sourcemapFilePath,
|
|
20302
20211
|
(reason) => {
|
|
20303
20212
|
warnings.push(
|
|
20304
|
-
`${
|
|
20213
|
+
`${path$i.basename(sourcemap.sourcemapFilePath)}: "${reason}"`
|
|
20305
20214
|
);
|
|
20306
20215
|
}
|
|
20307
20216
|
),
|
|
@@ -21122,7 +21031,7 @@ var polyfills = polyfills$1;
|
|
|
21122
21031
|
var legacy = legacyStreams;
|
|
21123
21032
|
var clone = clone_1;
|
|
21124
21033
|
|
|
21125
|
-
var util = require$$1
|
|
21034
|
+
var util = require$$1;
|
|
21126
21035
|
|
|
21127
21036
|
/* istanbul ignore next - node 0.x polyfill */
|
|
21128
21037
|
var gracefulQueue;
|
|
@@ -21672,7 +21581,7 @@ function retry () {
|
|
|
21672
21581
|
};
|
|
21673
21582
|
} (fs$i));
|
|
21674
21583
|
|
|
21675
|
-
const path$g =
|
|
21584
|
+
const path$g = path$i;
|
|
21676
21585
|
|
|
21677
21586
|
// get drive on windows
|
|
21678
21587
|
function getRootPath (p) {
|
|
@@ -21697,7 +21606,7 @@ var win32 = {
|
|
|
21697
21606
|
};
|
|
21698
21607
|
|
|
21699
21608
|
const fs$g = gracefulFs;
|
|
21700
|
-
const path$f =
|
|
21609
|
+
const path$f = path$i;
|
|
21701
21610
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
21702
21611
|
|
|
21703
21612
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -21759,7 +21668,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
21759
21668
|
var mkdirs_1$1 = mkdirs$2;
|
|
21760
21669
|
|
|
21761
21670
|
const fs$f = gracefulFs;
|
|
21762
|
-
const path$e =
|
|
21671
|
+
const path$e = path$i;
|
|
21763
21672
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
21764
21673
|
|
|
21765
21674
|
const o777 = parseInt('0777', 8);
|
|
@@ -21827,7 +21736,7 @@ var mkdirs_1 = {
|
|
|
21827
21736
|
|
|
21828
21737
|
const fs$e = gracefulFs;
|
|
21829
21738
|
const os = require$$0;
|
|
21830
|
-
const path$d =
|
|
21739
|
+
const path$d = path$i;
|
|
21831
21740
|
|
|
21832
21741
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
21833
21742
|
function hasMillisResSync () {
|
|
@@ -21916,7 +21825,7 @@ var buffer$1 = function (size) {
|
|
|
21916
21825
|
};
|
|
21917
21826
|
|
|
21918
21827
|
const fs$d = gracefulFs;
|
|
21919
|
-
const path$c =
|
|
21828
|
+
const path$c = path$i;
|
|
21920
21829
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
21921
21830
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
21922
21831
|
|
|
@@ -22124,7 +22033,7 @@ var pathExists_1 = {
|
|
|
22124
22033
|
};
|
|
22125
22034
|
|
|
22126
22035
|
const fs$b = gracefulFs;
|
|
22127
|
-
const path$b =
|
|
22036
|
+
const path$b = path$i;
|
|
22128
22037
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
22129
22038
|
const pathExists$7 = pathExists_1.pathExists;
|
|
22130
22039
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -22374,7 +22283,7 @@ var copy$1 = {
|
|
|
22374
22283
|
};
|
|
22375
22284
|
|
|
22376
22285
|
const fs$a = gracefulFs;
|
|
22377
|
-
const path$a =
|
|
22286
|
+
const path$a = path$i;
|
|
22378
22287
|
const assert = require$$5;
|
|
22379
22288
|
|
|
22380
22289
|
const isWindows = (process.platform === 'win32');
|
|
@@ -22696,7 +22605,7 @@ var remove$3 = {
|
|
|
22696
22605
|
|
|
22697
22606
|
const u$7 = universalify.fromCallback;
|
|
22698
22607
|
const fs$9 = fs$j;
|
|
22699
|
-
const path$9 =
|
|
22608
|
+
const path$9 = path$i;
|
|
22700
22609
|
const mkdir$5 = mkdirs_1;
|
|
22701
22610
|
const remove$2 = remove$3;
|
|
22702
22611
|
|
|
@@ -22742,7 +22651,7 @@ var empty$2 = {
|
|
|
22742
22651
|
};
|
|
22743
22652
|
|
|
22744
22653
|
const u$6 = universalify.fromCallback;
|
|
22745
|
-
const path$8 =
|
|
22654
|
+
const path$8 = path$i;
|
|
22746
22655
|
const fs$8 = gracefulFs;
|
|
22747
22656
|
const mkdir$4 = mkdirs_1;
|
|
22748
22657
|
const pathExists$6 = pathExists_1.pathExists;
|
|
@@ -22790,7 +22699,7 @@ var file$1 = {
|
|
|
22790
22699
|
};
|
|
22791
22700
|
|
|
22792
22701
|
const u$5 = universalify.fromCallback;
|
|
22793
|
-
const path$7 =
|
|
22702
|
+
const path$7 = path$i;
|
|
22794
22703
|
const fs$7 = gracefulFs;
|
|
22795
22704
|
const mkdir$3 = mkdirs_1;
|
|
22796
22705
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -22849,7 +22758,7 @@ var link$1 = {
|
|
|
22849
22758
|
createLinkSync
|
|
22850
22759
|
};
|
|
22851
22760
|
|
|
22852
|
-
const path$6 =
|
|
22761
|
+
const path$6 = path$i;
|
|
22853
22762
|
const fs$6 = gracefulFs;
|
|
22854
22763
|
const pathExists$4 = pathExists_1.pathExists;
|
|
22855
22764
|
|
|
@@ -22978,7 +22887,7 @@ var symlinkType_1 = {
|
|
|
22978
22887
|
};
|
|
22979
22888
|
|
|
22980
22889
|
const u$4 = universalify.fromCallback;
|
|
22981
|
-
const path$5 =
|
|
22890
|
+
const path$5 = path$i;
|
|
22982
22891
|
const fs$4 = gracefulFs;
|
|
22983
22892
|
const _mkdirs = mkdirs_1;
|
|
22984
22893
|
const mkdirs = _mkdirs.mkdirs;
|
|
@@ -23207,7 +23116,7 @@ var jsonfile = {
|
|
|
23207
23116
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
23208
23117
|
};
|
|
23209
23118
|
|
|
23210
|
-
const path$4 =
|
|
23119
|
+
const path$4 = path$i;
|
|
23211
23120
|
const mkdir$2 = mkdirs_1;
|
|
23212
23121
|
const pathExists$2 = pathExists_1.pathExists;
|
|
23213
23122
|
const jsonFile$2 = jsonfile;
|
|
@@ -23234,7 +23143,7 @@ function outputJson (file, data, options, callback) {
|
|
|
23234
23143
|
var outputJson_1 = outputJson;
|
|
23235
23144
|
|
|
23236
23145
|
const fs$3 = gracefulFs;
|
|
23237
|
-
const path$3 =
|
|
23146
|
+
const path$3 = path$i;
|
|
23238
23147
|
const mkdir$1 = mkdirs_1;
|
|
23239
23148
|
const jsonFile$1 = jsonfile;
|
|
23240
23149
|
|
|
@@ -23266,7 +23175,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
23266
23175
|
var json = jsonFile;
|
|
23267
23176
|
|
|
23268
23177
|
const fs$2 = gracefulFs;
|
|
23269
|
-
const path$2 =
|
|
23178
|
+
const path$2 = path$i;
|
|
23270
23179
|
const copySync = copySync$1.copySync;
|
|
23271
23180
|
const removeSync = remove$3.removeSync;
|
|
23272
23181
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -23383,7 +23292,7 @@ var moveSync_1 = {
|
|
|
23383
23292
|
|
|
23384
23293
|
const u$1 = universalify.fromCallback;
|
|
23385
23294
|
const fs$1 = gracefulFs;
|
|
23386
|
-
const path$1 =
|
|
23295
|
+
const path$1 = path$i;
|
|
23387
23296
|
const copy = copy$1.copy;
|
|
23388
23297
|
const remove$1 = remove$3.remove;
|
|
23389
23298
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -23464,7 +23373,7 @@ var move_1 = {
|
|
|
23464
23373
|
|
|
23465
23374
|
const u = universalify.fromCallback;
|
|
23466
23375
|
const fs = gracefulFs;
|
|
23467
|
-
const path =
|
|
23376
|
+
const path = path$i;
|
|
23468
23377
|
const mkdir = mkdirs_1;
|
|
23469
23378
|
const pathExists = pathExists_1.pathExists;
|
|
23470
23379
|
|
|
@@ -23934,7 +23843,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23934
23843
|
} else if (typeof outputOptions === "string") {
|
|
23935
23844
|
destination = outputOptions;
|
|
23936
23845
|
}
|
|
23937
|
-
const outputPath =
|
|
23846
|
+
const outputPath = path$i.resolve(cwd, destination);
|
|
23938
23847
|
try {
|
|
23939
23848
|
const errors = {};
|
|
23940
23849
|
const filesToWrite = {};
|
|
@@ -23953,7 +23862,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23953
23862
|
const proms = Object.keys(filesToWrite).map((file) => {
|
|
23954
23863
|
const start = Date.now();
|
|
23955
23864
|
log(`Start writing ${file}.json.`);
|
|
23956
|
-
return writeFile(
|
|
23865
|
+
return writeFile(path$i.join(outputPath, `${file}.json`), filesToWrite[file].content).then(() => {
|
|
23957
23866
|
log(`Wrote ${file}.json in ${formatDuration(Date.now() - start)}`);
|
|
23958
23867
|
}).catch((e) => {
|
|
23959
23868
|
log(
|
|
@@ -34325,7 +34234,7 @@ virtualStats.VirtualStats = VirtualStats;
|
|
|
34325
34234
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
34326
34235
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34327
34236
|
};
|
|
34328
|
-
const path_1 = __importDefault(
|
|
34237
|
+
const path_1 = __importDefault(path$i);
|
|
34329
34238
|
const virtual_stats_1 = virtualStats;
|
|
34330
34239
|
let inode = 45000000;
|
|
34331
34240
|
const ALL = 'all';
|
|
@@ -34609,7 +34518,7 @@ var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
|
34609
34518
|
|
|
34610
34519
|
// node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
|
|
34611
34520
|
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 = () =>
|
|
34521
|
+
var getDirname = () => path$i.dirname(getFilename());
|
|
34613
34522
|
var __dirname$1 = /* @__PURE__ */ getDirname();
|
|
34614
34523
|
|
|
34615
34524
|
// node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -35361,8 +35270,8 @@ function remapping(input, loader, options) {
|
|
|
35361
35270
|
return new SourceMap(traceMappings(tree), opts);
|
|
35362
35271
|
}
|
|
35363
35272
|
function normalizeAbsolutePath(path6) {
|
|
35364
|
-
if (
|
|
35365
|
-
return
|
|
35273
|
+
if (path$i.isAbsolute(path6))
|
|
35274
|
+
return path$i.normalize(path6);
|
|
35366
35275
|
else
|
|
35367
35276
|
return path6;
|
|
35368
35277
|
}
|
|
@@ -35410,7 +35319,7 @@ var ExtToLoader = {
|
|
|
35410
35319
|
".txt": "text"
|
|
35411
35320
|
};
|
|
35412
35321
|
function guessLoader(code, id) {
|
|
35413
|
-
return ExtToLoader[
|
|
35322
|
+
return ExtToLoader[path$i.extname(id).toLowerCase()] || "js";
|
|
35414
35323
|
}
|
|
35415
35324
|
function unwrapLoader(loader, code, id) {
|
|
35416
35325
|
if (typeof loader === "function")
|
|
@@ -35484,8 +35393,8 @@ function createBuildContext(initialOptions) {
|
|
|
35484
35393
|
emitFile(emittedFile) {
|
|
35485
35394
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
35486
35395
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
35487
|
-
const outPath =
|
|
35488
|
-
const outDir =
|
|
35396
|
+
const outPath = path$i.resolve(initialOptions.outdir, outFileName);
|
|
35397
|
+
const outDir = path$i.dirname(outPath);
|
|
35489
35398
|
if (!fs$j.existsSync(outDir))
|
|
35490
35399
|
fs$j.mkdirSync(outDir, { recursive: true });
|
|
35491
35400
|
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
@@ -35686,7 +35595,7 @@ function buildSetup(meta) {
|
|
|
35686
35595
|
onLoad({ filter: onLoadFilter }, async (args) => {
|
|
35687
35596
|
const id = args.path + args.suffix;
|
|
35688
35597
|
const { errors, warnings, mixedContext } = createPluginContext(context);
|
|
35689
|
-
const resolveDir =
|
|
35598
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35690
35599
|
let code, map;
|
|
35691
35600
|
if (plugin.load && (!plugin.loadInclude || plugin.loadInclude(id))) {
|
|
35692
35601
|
const result = await plugin.load.call(mixedContext, id);
|
|
@@ -35717,7 +35626,7 @@ function buildSetup(meta) {
|
|
|
35717
35626
|
if (plugin.transformInclude && !plugin.transformInclude(id))
|
|
35718
35627
|
return;
|
|
35719
35628
|
const { mixedContext, errors, warnings } = createPluginContext(context);
|
|
35720
|
-
const resolveDir =
|
|
35629
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35721
35630
|
let code = await args.getContents();
|
|
35722
35631
|
let map;
|
|
35723
35632
|
const result = await plugin.transform.call(mixedContext, code, id);
|
|
@@ -35775,7 +35684,7 @@ function createFarmContext(context, currentResolveId) {
|
|
|
35775
35684
|
resolvedPath: outFileName,
|
|
35776
35685
|
name: outFileName,
|
|
35777
35686
|
content: [...buffer$2.Buffer.from(emittedFile.source)],
|
|
35778
|
-
resourceType:
|
|
35687
|
+
resourceType: path$i.extname(outFileName)
|
|
35779
35688
|
});
|
|
35780
35689
|
}
|
|
35781
35690
|
},
|
|
@@ -35809,7 +35718,7 @@ var ExtToLoader2 = {
|
|
|
35809
35718
|
".node": "napi"
|
|
35810
35719
|
};
|
|
35811
35720
|
function guessIdLoader(id) {
|
|
35812
|
-
return ExtToLoader2[
|
|
35721
|
+
return ExtToLoader2[path$i.extname(id).toLowerCase()] || "js";
|
|
35813
35722
|
}
|
|
35814
35723
|
function transformQuery(context) {
|
|
35815
35724
|
const queryParamsObject = {};
|
|
@@ -35899,7 +35808,7 @@ function toFarmPlugin(plugin, options) {
|
|
|
35899
35808
|
farmPlugin.resolve = {
|
|
35900
35809
|
filters: { sources: [".*", ...filters], importers: [".*"] },
|
|
35901
35810
|
async executor(params, context) {
|
|
35902
|
-
const resolvedIdPath =
|
|
35811
|
+
const resolvedIdPath = path$i.resolve(
|
|
35903
35812
|
process.cwd(),
|
|
35904
35813
|
params.importer ?? ""
|
|
35905
35814
|
);
|
|
@@ -36106,11 +36015,11 @@ function createBuildContext2(compilation) {
|
|
|
36106
36015
|
}
|
|
36107
36016
|
|
|
36108
36017
|
// src/rspack/index.ts
|
|
36109
|
-
var TRANSFORM_LOADER =
|
|
36018
|
+
var TRANSFORM_LOADER = path$i.resolve(
|
|
36110
36019
|
__dirname$1,
|
|
36111
36020
|
"rspack/loaders/transform"
|
|
36112
36021
|
);
|
|
36113
|
-
var LOAD_LOADER =
|
|
36022
|
+
var LOAD_LOADER = path$i.resolve(
|
|
36114
36023
|
__dirname$1,
|
|
36115
36024
|
"rspack/loaders/load"
|
|
36116
36025
|
);
|
|
@@ -36118,7 +36027,7 @@ function getRspackPlugin(factory) {
|
|
|
36118
36027
|
return (userOptions) => {
|
|
36119
36028
|
return {
|
|
36120
36029
|
apply(compiler) {
|
|
36121
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36030
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process.cwd(), "_virtual_");
|
|
36122
36031
|
const injected = compiler.$unpluginContext || {};
|
|
36123
36032
|
compiler.$unpluginContext = injected;
|
|
36124
36033
|
const meta = {
|
|
@@ -36228,7 +36137,7 @@ function createBuildContext3(options, compilation) {
|
|
|
36228
36137
|
});
|
|
36229
36138
|
},
|
|
36230
36139
|
addWatchFile(id) {
|
|
36231
|
-
options.addWatchFile(
|
|
36140
|
+
options.addWatchFile(path$i.resolve(process2.cwd(), id));
|
|
36232
36141
|
},
|
|
36233
36142
|
emitFile(emittedFile) {
|
|
36234
36143
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
@@ -36262,11 +36171,11 @@ function normalizeMessage(error) {
|
|
|
36262
36171
|
}
|
|
36263
36172
|
|
|
36264
36173
|
// src/webpack/index.ts
|
|
36265
|
-
var TRANSFORM_LOADER2 =
|
|
36174
|
+
var TRANSFORM_LOADER2 = path$i.resolve(
|
|
36266
36175
|
__dirname$1,
|
|
36267
36176
|
"webpack/loaders/transform"
|
|
36268
36177
|
);
|
|
36269
|
-
var LOAD_LOADER2 =
|
|
36178
|
+
var LOAD_LOADER2 = path$i.resolve(
|
|
36270
36179
|
__dirname$1,
|
|
36271
36180
|
"webpack/loaders/load"
|
|
36272
36181
|
);
|
|
@@ -36274,7 +36183,7 @@ function getWebpackPlugin(factory) {
|
|
|
36274
36183
|
return (userOptions) => {
|
|
36275
36184
|
return {
|
|
36276
36185
|
apply(compiler) {
|
|
36277
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36186
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process2.cwd(), "_virtual_");
|
|
36278
36187
|
const injected = compiler.$unpluginContext || {};
|
|
36279
36188
|
compiler.$unpluginContext = injected;
|
|
36280
36189
|
const meta = {
|
|
@@ -36481,6 +36390,7 @@ const validateOptions = (options = {}) => {
|
|
|
36481
36390
|
};
|
|
36482
36391
|
const HOST_NAME = "datadog-build-plugins";
|
|
36483
36392
|
const buildPluginFactory = ({
|
|
36393
|
+
bundler,
|
|
36484
36394
|
version
|
|
36485
36395
|
}) => {
|
|
36486
36396
|
return createUnplugin((opts, unpluginMetaContext) => {
|
|
@@ -36489,6 +36399,7 @@ const buildPluginFactory = ({
|
|
|
36489
36399
|
unpluginMetaContext.esbuildHostName = HOST_NAME;
|
|
36490
36400
|
}
|
|
36491
36401
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
36402
|
+
bundler,
|
|
36492
36403
|
version,
|
|
36493
36404
|
...unpluginMetaContext
|
|
36494
36405
|
});
|
|
@@ -36511,7 +36422,7 @@ const buildPluginFactory = ({
|
|
|
36511
36422
|
|
|
36512
36423
|
var name = "@datadog/esbuild-plugin";
|
|
36513
36424
|
var packageManager = "yarn@4.0.2";
|
|
36514
|
-
var version$1 = "2.3.1-dev-
|
|
36425
|
+
var version$1 = "2.3.1-dev-10";
|
|
36515
36426
|
var license = "MIT";
|
|
36516
36427
|
var author = "Datadog";
|
|
36517
36428
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -36599,6 +36510,7 @@ var pkg = {
|
|
|
36599
36510
|
};
|
|
36600
36511
|
|
|
36601
36512
|
const datadogEsbuildPlugin = buildPluginFactory({
|
|
36513
|
+
bundler: esbuild,
|
|
36602
36514
|
version: pkg.version
|
|
36603
36515
|
}).esbuild;
|
|
36604
36516
|
const version = pkg.version;
|