@datadog/esbuild-plugin 2.3.1-dev-8 → 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 +288 -358
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +278 -348
- 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,15 +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 isInternalPlugin = (pluginName, context) => {
|
|
2381
|
-
for (const internalPluginName of context.pluginNames) {
|
|
2382
|
-
if (pluginName.includes(internalPluginName)) {
|
|
2383
|
-
return true;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
return false;
|
|
2387
|
-
};
|
|
2380
|
+
const isInjectionFile = (filename) => filename.includes(INJECTED_FILE);
|
|
2388
2381
|
|
|
2389
2382
|
var balancedMatch = balanced$1;
|
|
2390
2383
|
function balanced$1(a, b, str) {
|
|
@@ -11340,18 +11333,13 @@ const cleanReport = (report, filepath, filter) => {
|
|
|
11340
11333
|
const cleanedPath = cleanPath(reportFilepath);
|
|
11341
11334
|
if (
|
|
11342
11335
|
// Don't add injections.
|
|
11343
|
-
|
|
11336
|
+
isInjectionFile(reportFilepath) || // Don't add itself into it.
|
|
11344
11337
|
cleanedPath === filepath || // Remove common specific files injected by bundlers.
|
|
11345
11338
|
BUNDLER_SPECIFICS.includes(cleanedPath)
|
|
11346
11339
|
) {
|
|
11347
11340
|
continue;
|
|
11348
11341
|
}
|
|
11349
|
-
|
|
11350
|
-
const filteredValue = filter(cleanedPath);
|
|
11351
|
-
if (filteredValue) {
|
|
11352
|
-
cleanedReport.add(filteredValue);
|
|
11353
|
-
}
|
|
11354
|
-
} else {
|
|
11342
|
+
{
|
|
11355
11343
|
cleanedReport.add(cleanedPath);
|
|
11356
11344
|
}
|
|
11357
11345
|
}
|
|
@@ -11361,16 +11349,16 @@ const cleanPath = (filepath) => {
|
|
|
11361
11349
|
return filepath.split("!").pop().split(QUERY_RX).shift().replace(/^[^\w\s.,!@#$%^&*()=+~`\-/]+/, "");
|
|
11362
11350
|
};
|
|
11363
11351
|
const getAbsolutePath = (cwd, filepath) => {
|
|
11364
|
-
if (
|
|
11352
|
+
if (isInjectionFile(filepath)) {
|
|
11365
11353
|
return INJECTED_FILE;
|
|
11366
11354
|
}
|
|
11367
11355
|
if (filepath.startsWith(cwd)) {
|
|
11368
11356
|
return filepath;
|
|
11369
11357
|
}
|
|
11370
|
-
return
|
|
11358
|
+
return path$i.resolve(cwd, filepath);
|
|
11371
11359
|
};
|
|
11372
11360
|
const cleanName = (context, filepath) => {
|
|
11373
|
-
if (
|
|
11361
|
+
if (isInjectionFile(filepath)) {
|
|
11374
11362
|
return INJECTED_FILE;
|
|
11375
11363
|
}
|
|
11376
11364
|
if (filepath === "unknown") {
|
|
@@ -11444,8 +11432,24 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11444
11432
|
const reportOutputsIndexed = {};
|
|
11445
11433
|
const metaInputsIndexed = reIndexMeta(result.metafile.inputs, cwd);
|
|
11446
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
|
+
};
|
|
11447
11451
|
for (const [filename, input] of Object.entries(result.metafile.inputs)) {
|
|
11448
|
-
if (
|
|
11452
|
+
if (isInjectionFile(filename)) {
|
|
11449
11453
|
continue;
|
|
11450
11454
|
}
|
|
11451
11455
|
const filepath = getAbsolutePath(cwd, filename);
|
|
@@ -11466,7 +11470,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11466
11470
|
const cleanedName = cleanName(context, fullPath);
|
|
11467
11471
|
const inputFiles = [];
|
|
11468
11472
|
for (const inputName of Object.keys(output.inputs)) {
|
|
11469
|
-
if (
|
|
11473
|
+
if (isInjectionFile(inputName)) {
|
|
11470
11474
|
continue;
|
|
11471
11475
|
}
|
|
11472
11476
|
const inputFound = reportInputsIndexed[getAbsolutePath(cwd, inputName)];
|
|
@@ -11499,7 +11503,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11499
11503
|
if (!output.entryPoint) {
|
|
11500
11504
|
continue;
|
|
11501
11505
|
}
|
|
11502
|
-
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, output.entryPoint)];
|
|
11506
|
+
const inputFile = reportInputsIndexed[getAbsolutePath(cwd, getRealPathFromInjectionProxy(output.entryPoint))];
|
|
11503
11507
|
if (inputFile) {
|
|
11504
11508
|
if (!entryNames.get(inputFile.name)) {
|
|
11505
11509
|
continue;
|
|
@@ -11534,7 +11538,7 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11534
11538
|
};
|
|
11535
11539
|
const FILE_EXCEPTIONS_RX = /(<runtime>|https:|file:|data:|#)/g;
|
|
11536
11540
|
const isFileSupported = (filePath) => {
|
|
11537
|
-
if (
|
|
11541
|
+
if (isInjectionFile(filePath) || filePath.match(FILE_EXCEPTIONS_RX)) {
|
|
11538
11542
|
return false;
|
|
11539
11543
|
}
|
|
11540
11544
|
return true;
|
|
@@ -11811,239 +11815,177 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11811
11815
|
};
|
|
11812
11816
|
|
|
11813
11817
|
const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
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
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
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;
|
|
11870
11898
|
}
|
|
11899
|
+
input.dependencies.add(depInput);
|
|
11871
11900
|
}
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
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);
|
|
11876
11908
|
}
|
|
11877
|
-
|
|
11878
|
-
|
|
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;
|
|
11879
11928
|
}
|
|
11929
|
+
const fileModules = modulesPerFile.get(file) || [];
|
|
11930
|
+
modulesPerFile.set(file, [...fileModules, ...chunkModules]);
|
|
11880
11931
|
}
|
|
11881
11932
|
}
|
|
11882
11933
|
for (const asset of assets) {
|
|
11883
11934
|
const file = {
|
|
11884
|
-
size: asset.
|
|
11935
|
+
size: asset.source.size() || 0,
|
|
11885
11936
|
name: asset.name,
|
|
11886
11937
|
inputs: [],
|
|
11887
11938
|
filepath: getAbsolutePath(context.bundler.outDir, asset.name),
|
|
11888
11939
|
type: getType(asset.name)
|
|
11889
11940
|
};
|
|
11890
|
-
reportOutputsIndexed
|
|
11941
|
+
reportOutputsIndexed.set(file.filepath, file);
|
|
11891
11942
|
outputs.push(file);
|
|
11892
11943
|
if (file.type === "map") {
|
|
11893
11944
|
tempSourcemaps.push(file);
|
|
11894
|
-
}
|
|
11895
|
-
}
|
|
11896
|
-
for (const sourcemap of tempSourcemaps) {
|
|
11897
|
-
const outputFound = reportOutputsIndexed[sourcemap.filepath.replace(/\.map$/, "")];
|
|
11898
|
-
if (!outputFound) {
|
|
11899
|
-
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
11900
11945
|
continue;
|
|
11901
11946
|
}
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
return module.nameForCondition ? module.nameForCondition : module.name ? getAbsolutePath(context.cwd, module.name) : module.identifier ? module.identifier : "unknown";
|
|
11906
|
-
};
|
|
11907
|
-
const isModuleSupported = (module) => {
|
|
11908
|
-
if (isInjection(getModulePath(module)) || // Do not report runtime modules as they are very specific to webpack.
|
|
11909
|
-
module.moduleType === "runtime" || module.name?.startsWith("(webpack)") || // Also ignore orphan modules
|
|
11910
|
-
module.type === "orphan modules") {
|
|
11911
|
-
return false;
|
|
11912
|
-
}
|
|
11913
|
-
return true;
|
|
11914
|
-
};
|
|
11915
|
-
const getModules = (reason) => {
|
|
11916
|
-
const { moduleIdentifier, moduleId } = reason;
|
|
11917
|
-
if (!moduleIdentifier && !moduleId) {
|
|
11918
|
-
return [];
|
|
11919
|
-
}
|
|
11920
|
-
const modulesFound = [];
|
|
11921
|
-
if (moduleId) {
|
|
11922
|
-
const module = modulePerId.get(moduleId);
|
|
11923
|
-
if (module) {
|
|
11924
|
-
modulesFound.push(module);
|
|
11925
|
-
}
|
|
11926
|
-
const concatModules = concatModulesPerId.get(moduleId);
|
|
11927
|
-
if (concatModules) {
|
|
11928
|
-
modulesFound.push(...concatModules);
|
|
11929
|
-
}
|
|
11930
|
-
}
|
|
11931
|
-
if (moduleIdentifier) {
|
|
11932
|
-
const module = modulePerIdentifier.get(moduleIdentifier);
|
|
11933
|
-
if (module) {
|
|
11934
|
-
modulesFound.push(module);
|
|
11935
|
-
}
|
|
11936
|
-
const concatModules = concatModulesPerIdentifier.get(moduleIdentifier);
|
|
11937
|
-
if (concatModules) {
|
|
11938
|
-
modulesFound.push(...concatModules);
|
|
11939
|
-
}
|
|
11940
|
-
}
|
|
11941
|
-
return Array.from(new Set(modulesFound.map(getModulePath)));
|
|
11942
|
-
};
|
|
11943
|
-
const modulesDone = /* @__PURE__ */ new Set();
|
|
11944
|
-
for (const module of modules) {
|
|
11945
|
-
if (!isModuleSupported(module)) {
|
|
11947
|
+
const fileModules = modulesPerFile.get(file.filepath);
|
|
11948
|
+
if (!fileModules) {
|
|
11949
|
+
warn(`Could not find modules for ${file.name}`);
|
|
11946
11950
|
continue;
|
|
11947
11951
|
}
|
|
11948
|
-
const
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
modulesDone.add(modulePath);
|
|
11953
|
-
if (modulePath === "unknown") {
|
|
11954
|
-
warn(`Unknown module: ${JSON.stringify(module)}`);
|
|
11955
|
-
}
|
|
11956
|
-
if (module.reasons) {
|
|
11957
|
-
const moduleDeps = tempDeps[modulePath] || {
|
|
11958
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11959
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11960
|
-
};
|
|
11961
|
-
const dependents = module.reasons.flatMap(getModules);
|
|
11962
|
-
for (const dependent of dependents) {
|
|
11963
|
-
const reasonDeps = tempDeps[dependent] || {
|
|
11964
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11965
|
-
dependents: /* @__PURE__ */ new Set()
|
|
11966
|
-
};
|
|
11967
|
-
reasonDeps.dependencies.add(modulePath);
|
|
11968
|
-
tempDeps[dependent] = reasonDeps;
|
|
11969
|
-
moduleDeps.dependents.add(dependent);
|
|
11970
|
-
}
|
|
11971
|
-
tempDeps[modulePath] = moduleDeps;
|
|
11972
|
-
}
|
|
11973
|
-
const file = {
|
|
11974
|
-
size: module.size || 0,
|
|
11975
|
-
name: cleanName(context, modulePath),
|
|
11976
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
11977
|
-
dependents: /* @__PURE__ */ new Set(),
|
|
11978
|
-
filepath: modulePath,
|
|
11979
|
-
type: getType(modulePath)
|
|
11980
|
-
};
|
|
11981
|
-
for (const chunkId of module.chunks || []) {
|
|
11982
|
-
const chunkFound = chunks.find((chunk) => chunk.id === chunkId);
|
|
11983
|
-
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}`);
|
|
11984
11956
|
continue;
|
|
11985
11957
|
}
|
|
11986
|
-
|
|
11987
|
-
if (chunkFound.auxiliaryFiles) {
|
|
11988
|
-
chunkFiles.push(...chunkFound.auxiliaryFiles);
|
|
11989
|
-
}
|
|
11990
|
-
const outputFound = outputs.find((output) => chunkFiles.includes(output.name));
|
|
11991
|
-
if (!outputFound) {
|
|
11992
|
-
warn(`Output not found for ${file.name}`);
|
|
11993
|
-
continue;
|
|
11994
|
-
}
|
|
11995
|
-
if (!outputFound.inputs.includes(file)) {
|
|
11996
|
-
outputFound.inputs.push(file);
|
|
11997
|
-
}
|
|
11958
|
+
file.inputs.push(inputFound);
|
|
11998
11959
|
}
|
|
11999
|
-
reportInputsIndexed[modulePath] = file;
|
|
12000
|
-
inputs.push(file);
|
|
12001
11960
|
}
|
|
12002
|
-
const
|
|
12003
|
-
const
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
};
|
|
12009
|
-
for (const input of inputs) {
|
|
12010
|
-
const depsReport = tempDeps[input.filepath];
|
|
12011
|
-
if (!depsReport) {
|
|
12012
|
-
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}`);
|
|
12013
11967
|
continue;
|
|
12014
11968
|
}
|
|
12015
|
-
|
|
12016
|
-
input.dependents = cleanReport(depsReport.dependents, input.filepath, getInput);
|
|
11969
|
+
sourcemap.inputs.push(outputFound);
|
|
12017
11970
|
}
|
|
12018
|
-
for (const [name,
|
|
11971
|
+
for (const [name, entrypoint] of result.entrypoints) {
|
|
12019
11972
|
const entryOutputs = [];
|
|
12020
11973
|
const entryInputs = [];
|
|
12021
11974
|
let size = 0;
|
|
12022
|
-
const
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
if (typeof asset === "string") {
|
|
12029
|
-
assetPath = getAbsolutePath(context.bundler.outDir, asset);
|
|
12030
|
-
} else if (typeof asset.name === "string") {
|
|
12031
|
-
assetPath = getAbsolutePath(context.bundler.outDir, asset.name);
|
|
12032
|
-
}
|
|
12033
|
-
if (!assetPath || !reportOutputsIndexed[assetPath]) {
|
|
12034
|
-
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)}`);
|
|
12035
11981
|
continue;
|
|
12036
11982
|
}
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
entryInputs.push(...outputFound.inputs);
|
|
12042
|
-
size += outputFound.size;
|
|
12043
|
-
}
|
|
11983
|
+
if (outputFound.type !== "map" && !entryOutputs.includes(outputFound)) {
|
|
11984
|
+
entryOutputs.push(outputFound);
|
|
11985
|
+
entryInputs.push(...outputFound.inputs);
|
|
11986
|
+
size += outputFound.size;
|
|
12044
11987
|
}
|
|
12045
11988
|
}
|
|
12046
|
-
const entryFilename = stats.assetsByChunkName?.[name]?.[0];
|
|
12047
11989
|
const file = {
|
|
12048
11990
|
name,
|
|
12049
11991
|
filepath: entryFilename ? getAbsolutePath(context.bundler.outDir, entryFilename) : "unknown",
|
|
@@ -12054,6 +11996,8 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
12054
11996
|
};
|
|
12055
11997
|
entries.push(file);
|
|
12056
11998
|
}
|
|
11999
|
+
context.build.errors = result.errors.map((err) => err.message);
|
|
12000
|
+
context.build.warnings = [...warnings, ...result.warnings.map((err) => err.message)];
|
|
12057
12001
|
context.build.inputs = inputs;
|
|
12058
12002
|
context.build.outputs = outputs;
|
|
12059
12003
|
context.build.entries = entries;
|
|
@@ -12100,7 +12044,7 @@ const getBundlerReportPlugin = (opts, globalContext) => {
|
|
|
12100
12044
|
globalContext.bundler.outDir = build.initialOptions.outdir;
|
|
12101
12045
|
}
|
|
12102
12046
|
if (build.initialOptions.outfile) {
|
|
12103
|
-
globalContext.bundler.outDir =
|
|
12047
|
+
globalContext.bundler.outDir = path$i.dirname(build.initialOptions.outfile);
|
|
12104
12048
|
}
|
|
12105
12049
|
build.initialOptions.metafile = true;
|
|
12106
12050
|
}
|
|
@@ -13021,7 +12965,7 @@ function requireNode$1 () {
|
|
|
13021
12965
|
hasRequiredNode$1 = 1;
|
|
13022
12966
|
(function (module, exports) {
|
|
13023
12967
|
const tty = require$$0$1;
|
|
13024
|
-
const util = require$$1
|
|
12968
|
+
const util = require$$1;
|
|
13025
12969
|
|
|
13026
12970
|
/**
|
|
13027
12971
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -13934,7 +13878,7 @@ function requireNode () {
|
|
|
13934
13878
|
hasRequiredNode = 1;
|
|
13935
13879
|
(function (module, exports) {
|
|
13936
13880
|
const tty = require$$0$1;
|
|
13937
|
-
const util = require$$1
|
|
13881
|
+
const util = require$$1;
|
|
13938
13882
|
|
|
13939
13883
|
/**
|
|
13940
13884
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -19080,21 +19024,19 @@ const processInjections = async (toInject, log) => {
|
|
|
19080
19024
|
return results.filter(Boolean);
|
|
19081
19025
|
};
|
|
19082
19026
|
|
|
19083
|
-
const getInjectionPlugins = (opts, context, toInject) => {
|
|
19027
|
+
const getInjectionPlugins = (bundler, opts, context, toInject) => {
|
|
19084
19028
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$4);
|
|
19085
19029
|
const contentToInject = [];
|
|
19086
19030
|
const getContentToInject = () => {
|
|
19087
|
-
|
|
19088
|
-
// Needs at least one element otherwise ESBuild will throw 'Do not know how to load path'.
|
|
19089
|
-
// Most likely because it tries to generate an empty file.
|
|
19090
|
-
`
|
|
19031
|
+
const before = `
|
|
19091
19032
|
/********************************************/
|
|
19092
|
-
/* BEGIN INJECTION BY DATADOG BUILD PLUGINS
|
|
19093
|
-
|
|
19094
|
-
contentToInject.push(`
|
|
19033
|
+
/* BEGIN INJECTION BY DATADOG BUILD PLUGINS */`;
|
|
19034
|
+
const after = `
|
|
19095
19035
|
/* END INJECTION BY DATADOG BUILD PLUGINS */
|
|
19096
|
-
|
|
19097
|
-
return
|
|
19036
|
+
/********************************************/`;
|
|
19037
|
+
return `${before}
|
|
19038
|
+
${contentToInject.join("\n\n")}
|
|
19039
|
+
${after}`;
|
|
19098
19040
|
};
|
|
19099
19041
|
const rollupInjectionPlugin = {
|
|
19100
19042
|
banner(chunk) {
|
|
@@ -19104,28 +19046,8 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19104
19046
|
return "";
|
|
19105
19047
|
}
|
|
19106
19048
|
};
|
|
19107
|
-
|
|
19108
|
-
//
|
|
19109
|
-
{
|
|
19110
|
-
name: RESOLUTION_PLUGIN_NAME,
|
|
19111
|
-
enforce: "pre",
|
|
19112
|
-
resolveId(id) {
|
|
19113
|
-
if (isInjection(id)) {
|
|
19114
|
-
return { id, moduleSideEffects: true };
|
|
19115
|
-
}
|
|
19116
|
-
},
|
|
19117
|
-
loadInclude(id) {
|
|
19118
|
-
if (isInjection(id)) {
|
|
19119
|
-
return true;
|
|
19120
|
-
}
|
|
19121
|
-
},
|
|
19122
|
-
load(id) {
|
|
19123
|
-
if (isInjection(id)) {
|
|
19124
|
-
return getContentToInject();
|
|
19125
|
-
}
|
|
19126
|
-
}
|
|
19127
|
-
},
|
|
19128
|
-
// Prepare and fetch the content to inject.
|
|
19049
|
+
const plugins = [
|
|
19050
|
+
// Prepare and fetch the content to inject for all bundlers.
|
|
19129
19051
|
{
|
|
19130
19052
|
name: PREPARATION_PLUGIN_NAME,
|
|
19131
19053
|
enforce: "pre",
|
|
@@ -19133,75 +19055,79 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19133
19055
|
async buildStart() {
|
|
19134
19056
|
const results = await processInjections(toInject, log);
|
|
19135
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
|
+
});
|
|
19136
19087
|
}
|
|
19137
19088
|
},
|
|
19138
|
-
// Inject the
|
|
19089
|
+
// Inject the file that will be home of all injected content.
|
|
19090
|
+
// Each bundler has its own way to inject a file.
|
|
19139
19091
|
{
|
|
19140
19092
|
name: PLUGIN_NAME$4,
|
|
19141
19093
|
esbuild: {
|
|
19142
19094
|
setup(build) {
|
|
19143
19095
|
const { initialOptions } = build;
|
|
19144
|
-
const
|
|
19145
|
-
|
|
19096
|
+
const absolutePathInjectFile = path$i.resolve(
|
|
19097
|
+
context.bundler.outDir,
|
|
19098
|
+
INJECTED_FILE_PATH
|
|
19099
|
+
);
|
|
19146
19100
|
initialOptions.inject = initialOptions.inject || [];
|
|
19147
|
-
initialOptions.inject.push(
|
|
19148
|
-
for (const plugin of plugins) {
|
|
19149
|
-
const oldSetup = plugin.setup;
|
|
19150
|
-
if (isInternalPlugin(plugin.name, context)) {
|
|
19151
|
-
continue;
|
|
19152
|
-
}
|
|
19153
|
-
plugin.setup = async (esbuild) => {
|
|
19154
|
-
esbuild.initialOptions.inject = initialInject;
|
|
19155
|
-
await oldSetup(esbuild);
|
|
19156
|
-
};
|
|
19157
|
-
}
|
|
19101
|
+
initialOptions.inject.push(absolutePathInjectFile);
|
|
19158
19102
|
}
|
|
19159
19103
|
},
|
|
19160
19104
|
webpack: (compiler) => {
|
|
19161
|
-
const
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
}
|
|
19177
|
-
if (typeof originalEntry === "object") {
|
|
19178
|
-
const newEntry = {};
|
|
19179
|
-
if (Object.keys(originalEntry).length === 0) {
|
|
19180
|
-
newEntry[INJECTED_FILE] = // Webpack 4 and 5 have different entry formats.
|
|
19181
|
-
context.bundler.variant === "5" ? { import: [INJECTED_FILE] } : INJECTED_FILE;
|
|
19182
|
-
return newEntry;
|
|
19183
|
-
}
|
|
19184
|
-
for (const entryName in originalEntry) {
|
|
19185
|
-
if (!Object.hasOwn(originalEntry, entryName)) {
|
|
19186
|
-
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 "";
|
|
19187
19120
|
}
|
|
19188
|
-
|
|
19189
|
-
newEntry[entryName] = // Webpack 4 and 5 have different entry formats.
|
|
19190
|
-
typeof entry === "string" ? [INJECTED_FILE, entry] : {
|
|
19191
|
-
...entry,
|
|
19192
|
-
import: [INJECTED_FILE, ...entry.import]
|
|
19193
|
-
};
|
|
19121
|
+
return getContentToInject();
|
|
19194
19122
|
}
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
return [INJECTED_FILE, originalEntry];
|
|
19198
|
-
};
|
|
19199
|
-
compiler.options.entry = injectEntry(compiler.options.entry);
|
|
19123
|
+
})
|
|
19124
|
+
);
|
|
19200
19125
|
},
|
|
19201
19126
|
rollup: rollupInjectionPlugin,
|
|
19202
19127
|
vite: rollupInjectionPlugin
|
|
19203
19128
|
}
|
|
19204
19129
|
];
|
|
19130
|
+
return plugins;
|
|
19205
19131
|
};
|
|
19206
19132
|
|
|
19207
19133
|
const getInternalPlugins = (options, meta) => {
|
|
@@ -19215,7 +19141,8 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19215
19141
|
name: meta.framework,
|
|
19216
19142
|
fullName: `${meta.framework}${variant}`,
|
|
19217
19143
|
variant,
|
|
19218
|
-
outDir: cwd
|
|
19144
|
+
outDir: cwd,
|
|
19145
|
+
version: meta.bundler.version || meta.bundler.VERSION
|
|
19219
19146
|
},
|
|
19220
19147
|
build: {
|
|
19221
19148
|
errors: [],
|
|
@@ -19231,7 +19158,7 @@ const getInternalPlugins = (options, meta) => {
|
|
|
19231
19158
|
const bundlerReportPlugin = getBundlerReportPlugin(options, globalContext);
|
|
19232
19159
|
const buildReportPlugin = getBuildReportPlugin(options, globalContext);
|
|
19233
19160
|
const gitPlugin = getGitPlugin(options, globalContext);
|
|
19234
|
-
const injectionPlugins = getInjectionPlugins(options, globalContext, toInject);
|
|
19161
|
+
const injectionPlugins = getInjectionPlugins(meta.bundler, options, globalContext, toInject);
|
|
19235
19162
|
return {
|
|
19236
19163
|
globalContext,
|
|
19237
19164
|
internalPlugins: [bundlerReportPlugin, buildReportPlugin, gitPlugin, ...injectionPlugins]
|
|
@@ -19405,12 +19332,12 @@ if (typeof module !== "undefined") {
|
|
|
19405
19332
|
}
|
|
19406
19333
|
|
|
19407
19334
|
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
19408
|
-
if (
|
|
19335
|
+
if (path$i.extname(sourcemapFilePath) !== ".map") {
|
|
19409
19336
|
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
19410
19337
|
}
|
|
19411
19338
|
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
19412
19339
|
const relativePath = minifiedFilePath.replace(context.bundler.outDir, "");
|
|
19413
|
-
const minifiedUrl = options.minifiedPathPrefix ?
|
|
19340
|
+
const minifiedUrl = options.minifiedPathPrefix ? path$i.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
19414
19341
|
return {
|
|
19415
19342
|
minifiedFilePath,
|
|
19416
19343
|
minifiedUrl,
|
|
@@ -20283,7 +20210,7 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
20283
20210
|
sourcemap.sourcemapFilePath,
|
|
20284
20211
|
(reason) => {
|
|
20285
20212
|
warnings.push(
|
|
20286
|
-
`${
|
|
20213
|
+
`${path$i.basename(sourcemap.sourcemapFilePath)}: "${reason}"`
|
|
20287
20214
|
);
|
|
20288
20215
|
}
|
|
20289
20216
|
),
|
|
@@ -21104,7 +21031,7 @@ var polyfills = polyfills$1;
|
|
|
21104
21031
|
var legacy = legacyStreams;
|
|
21105
21032
|
var clone = clone_1;
|
|
21106
21033
|
|
|
21107
|
-
var util = require$$1
|
|
21034
|
+
var util = require$$1;
|
|
21108
21035
|
|
|
21109
21036
|
/* istanbul ignore next - node 0.x polyfill */
|
|
21110
21037
|
var gracefulQueue;
|
|
@@ -21654,7 +21581,7 @@ function retry () {
|
|
|
21654
21581
|
};
|
|
21655
21582
|
} (fs$i));
|
|
21656
21583
|
|
|
21657
|
-
const path$g =
|
|
21584
|
+
const path$g = path$i;
|
|
21658
21585
|
|
|
21659
21586
|
// get drive on windows
|
|
21660
21587
|
function getRootPath (p) {
|
|
@@ -21679,7 +21606,7 @@ var win32 = {
|
|
|
21679
21606
|
};
|
|
21680
21607
|
|
|
21681
21608
|
const fs$g = gracefulFs;
|
|
21682
|
-
const path$f =
|
|
21609
|
+
const path$f = path$i;
|
|
21683
21610
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
21684
21611
|
|
|
21685
21612
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -21741,7 +21668,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
21741
21668
|
var mkdirs_1$1 = mkdirs$2;
|
|
21742
21669
|
|
|
21743
21670
|
const fs$f = gracefulFs;
|
|
21744
|
-
const path$e =
|
|
21671
|
+
const path$e = path$i;
|
|
21745
21672
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
21746
21673
|
|
|
21747
21674
|
const o777 = parseInt('0777', 8);
|
|
@@ -21809,7 +21736,7 @@ var mkdirs_1 = {
|
|
|
21809
21736
|
|
|
21810
21737
|
const fs$e = gracefulFs;
|
|
21811
21738
|
const os = require$$0;
|
|
21812
|
-
const path$d =
|
|
21739
|
+
const path$d = path$i;
|
|
21813
21740
|
|
|
21814
21741
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
21815
21742
|
function hasMillisResSync () {
|
|
@@ -21898,7 +21825,7 @@ var buffer$1 = function (size) {
|
|
|
21898
21825
|
};
|
|
21899
21826
|
|
|
21900
21827
|
const fs$d = gracefulFs;
|
|
21901
|
-
const path$c =
|
|
21828
|
+
const path$c = path$i;
|
|
21902
21829
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
21903
21830
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
21904
21831
|
|
|
@@ -22106,7 +22033,7 @@ var pathExists_1 = {
|
|
|
22106
22033
|
};
|
|
22107
22034
|
|
|
22108
22035
|
const fs$b = gracefulFs;
|
|
22109
|
-
const path$b =
|
|
22036
|
+
const path$b = path$i;
|
|
22110
22037
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
22111
22038
|
const pathExists$7 = pathExists_1.pathExists;
|
|
22112
22039
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -22356,7 +22283,7 @@ var copy$1 = {
|
|
|
22356
22283
|
};
|
|
22357
22284
|
|
|
22358
22285
|
const fs$a = gracefulFs;
|
|
22359
|
-
const path$a =
|
|
22286
|
+
const path$a = path$i;
|
|
22360
22287
|
const assert = require$$5;
|
|
22361
22288
|
|
|
22362
22289
|
const isWindows = (process.platform === 'win32');
|
|
@@ -22678,7 +22605,7 @@ var remove$3 = {
|
|
|
22678
22605
|
|
|
22679
22606
|
const u$7 = universalify.fromCallback;
|
|
22680
22607
|
const fs$9 = fs$j;
|
|
22681
|
-
const path$9 =
|
|
22608
|
+
const path$9 = path$i;
|
|
22682
22609
|
const mkdir$5 = mkdirs_1;
|
|
22683
22610
|
const remove$2 = remove$3;
|
|
22684
22611
|
|
|
@@ -22724,7 +22651,7 @@ var empty$2 = {
|
|
|
22724
22651
|
};
|
|
22725
22652
|
|
|
22726
22653
|
const u$6 = universalify.fromCallback;
|
|
22727
|
-
const path$8 =
|
|
22654
|
+
const path$8 = path$i;
|
|
22728
22655
|
const fs$8 = gracefulFs;
|
|
22729
22656
|
const mkdir$4 = mkdirs_1;
|
|
22730
22657
|
const pathExists$6 = pathExists_1.pathExists;
|
|
@@ -22772,7 +22699,7 @@ var file$1 = {
|
|
|
22772
22699
|
};
|
|
22773
22700
|
|
|
22774
22701
|
const u$5 = universalify.fromCallback;
|
|
22775
|
-
const path$7 =
|
|
22702
|
+
const path$7 = path$i;
|
|
22776
22703
|
const fs$7 = gracefulFs;
|
|
22777
22704
|
const mkdir$3 = mkdirs_1;
|
|
22778
22705
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -22831,7 +22758,7 @@ var link$1 = {
|
|
|
22831
22758
|
createLinkSync
|
|
22832
22759
|
};
|
|
22833
22760
|
|
|
22834
|
-
const path$6 =
|
|
22761
|
+
const path$6 = path$i;
|
|
22835
22762
|
const fs$6 = gracefulFs;
|
|
22836
22763
|
const pathExists$4 = pathExists_1.pathExists;
|
|
22837
22764
|
|
|
@@ -22960,7 +22887,7 @@ var symlinkType_1 = {
|
|
|
22960
22887
|
};
|
|
22961
22888
|
|
|
22962
22889
|
const u$4 = universalify.fromCallback;
|
|
22963
|
-
const path$5 =
|
|
22890
|
+
const path$5 = path$i;
|
|
22964
22891
|
const fs$4 = gracefulFs;
|
|
22965
22892
|
const _mkdirs = mkdirs_1;
|
|
22966
22893
|
const mkdirs = _mkdirs.mkdirs;
|
|
@@ -23189,7 +23116,7 @@ var jsonfile = {
|
|
|
23189
23116
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
23190
23117
|
};
|
|
23191
23118
|
|
|
23192
|
-
const path$4 =
|
|
23119
|
+
const path$4 = path$i;
|
|
23193
23120
|
const mkdir$2 = mkdirs_1;
|
|
23194
23121
|
const pathExists$2 = pathExists_1.pathExists;
|
|
23195
23122
|
const jsonFile$2 = jsonfile;
|
|
@@ -23216,7 +23143,7 @@ function outputJson (file, data, options, callback) {
|
|
|
23216
23143
|
var outputJson_1 = outputJson;
|
|
23217
23144
|
|
|
23218
23145
|
const fs$3 = gracefulFs;
|
|
23219
|
-
const path$3 =
|
|
23146
|
+
const path$3 = path$i;
|
|
23220
23147
|
const mkdir$1 = mkdirs_1;
|
|
23221
23148
|
const jsonFile$1 = jsonfile;
|
|
23222
23149
|
|
|
@@ -23248,7 +23175,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
23248
23175
|
var json = jsonFile;
|
|
23249
23176
|
|
|
23250
23177
|
const fs$2 = gracefulFs;
|
|
23251
|
-
const path$2 =
|
|
23178
|
+
const path$2 = path$i;
|
|
23252
23179
|
const copySync = copySync$1.copySync;
|
|
23253
23180
|
const removeSync = remove$3.removeSync;
|
|
23254
23181
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -23365,7 +23292,7 @@ var moveSync_1 = {
|
|
|
23365
23292
|
|
|
23366
23293
|
const u$1 = universalify.fromCallback;
|
|
23367
23294
|
const fs$1 = gracefulFs;
|
|
23368
|
-
const path$1 =
|
|
23295
|
+
const path$1 = path$i;
|
|
23369
23296
|
const copy = copy$1.copy;
|
|
23370
23297
|
const remove$1 = remove$3.remove;
|
|
23371
23298
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -23446,7 +23373,7 @@ var move_1 = {
|
|
|
23446
23373
|
|
|
23447
23374
|
const u = universalify.fromCallback;
|
|
23448
23375
|
const fs = gracefulFs;
|
|
23449
|
-
const path =
|
|
23376
|
+
const path = path$i;
|
|
23450
23377
|
const mkdir = mkdirs_1;
|
|
23451
23378
|
const pathExists = pathExists_1.pathExists;
|
|
23452
23379
|
|
|
@@ -23916,7 +23843,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23916
23843
|
} else if (typeof outputOptions === "string") {
|
|
23917
23844
|
destination = outputOptions;
|
|
23918
23845
|
}
|
|
23919
|
-
const outputPath =
|
|
23846
|
+
const outputPath = path$i.resolve(cwd, destination);
|
|
23920
23847
|
try {
|
|
23921
23848
|
const errors = {};
|
|
23922
23849
|
const filesToWrite = {};
|
|
@@ -23935,7 +23862,7 @@ const outputFiles = async (data, outputOptions, log, cwd) => {
|
|
|
23935
23862
|
const proms = Object.keys(filesToWrite).map((file) => {
|
|
23936
23863
|
const start = Date.now();
|
|
23937
23864
|
log(`Start writing ${file}.json.`);
|
|
23938
|
-
return writeFile(
|
|
23865
|
+
return writeFile(path$i.join(outputPath, `${file}.json`), filesToWrite[file].content).then(() => {
|
|
23939
23866
|
log(`Wrote ${file}.json in ${formatDuration(Date.now() - start)}`);
|
|
23940
23867
|
}).catch((e) => {
|
|
23941
23868
|
log(
|
|
@@ -34307,7 +34234,7 @@ virtualStats.VirtualStats = VirtualStats;
|
|
|
34307
34234
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
34308
34235
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34309
34236
|
};
|
|
34310
|
-
const path_1 = __importDefault(
|
|
34237
|
+
const path_1 = __importDefault(path$i);
|
|
34311
34238
|
const virtual_stats_1 = virtualStats;
|
|
34312
34239
|
let inode = 45000000;
|
|
34313
34240
|
const ALL = 'all';
|
|
@@ -34591,7 +34518,7 @@ var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
|
34591
34518
|
|
|
34592
34519
|
// node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
|
|
34593
34520
|
var getFilename = () => url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
34594
|
-
var getDirname = () =>
|
|
34521
|
+
var getDirname = () => path$i.dirname(getFilename());
|
|
34595
34522
|
var __dirname$1 = /* @__PURE__ */ getDirname();
|
|
34596
34523
|
|
|
34597
34524
|
// node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -35343,8 +35270,8 @@ function remapping(input, loader, options) {
|
|
|
35343
35270
|
return new SourceMap(traceMappings(tree), opts);
|
|
35344
35271
|
}
|
|
35345
35272
|
function normalizeAbsolutePath(path6) {
|
|
35346
|
-
if (
|
|
35347
|
-
return
|
|
35273
|
+
if (path$i.isAbsolute(path6))
|
|
35274
|
+
return path$i.normalize(path6);
|
|
35348
35275
|
else
|
|
35349
35276
|
return path6;
|
|
35350
35277
|
}
|
|
@@ -35392,7 +35319,7 @@ var ExtToLoader = {
|
|
|
35392
35319
|
".txt": "text"
|
|
35393
35320
|
};
|
|
35394
35321
|
function guessLoader(code, id) {
|
|
35395
|
-
return ExtToLoader[
|
|
35322
|
+
return ExtToLoader[path$i.extname(id).toLowerCase()] || "js";
|
|
35396
35323
|
}
|
|
35397
35324
|
function unwrapLoader(loader, code, id) {
|
|
35398
35325
|
if (typeof loader === "function")
|
|
@@ -35466,8 +35393,8 @@ function createBuildContext(initialOptions) {
|
|
|
35466
35393
|
emitFile(emittedFile) {
|
|
35467
35394
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
35468
35395
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
35469
|
-
const outPath =
|
|
35470
|
-
const outDir =
|
|
35396
|
+
const outPath = path$i.resolve(initialOptions.outdir, outFileName);
|
|
35397
|
+
const outDir = path$i.dirname(outPath);
|
|
35471
35398
|
if (!fs$j.existsSync(outDir))
|
|
35472
35399
|
fs$j.mkdirSync(outDir, { recursive: true });
|
|
35473
35400
|
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
@@ -35668,7 +35595,7 @@ function buildSetup(meta) {
|
|
|
35668
35595
|
onLoad({ filter: onLoadFilter }, async (args) => {
|
|
35669
35596
|
const id = args.path + args.suffix;
|
|
35670
35597
|
const { errors, warnings, mixedContext } = createPluginContext(context);
|
|
35671
|
-
const resolveDir =
|
|
35598
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35672
35599
|
let code, map;
|
|
35673
35600
|
if (plugin.load && (!plugin.loadInclude || plugin.loadInclude(id))) {
|
|
35674
35601
|
const result = await plugin.load.call(mixedContext, id);
|
|
@@ -35699,7 +35626,7 @@ function buildSetup(meta) {
|
|
|
35699
35626
|
if (plugin.transformInclude && !plugin.transformInclude(id))
|
|
35700
35627
|
return;
|
|
35701
35628
|
const { mixedContext, errors, warnings } = createPluginContext(context);
|
|
35702
|
-
const resolveDir =
|
|
35629
|
+
const resolveDir = path$i.dirname(args.path);
|
|
35703
35630
|
let code = await args.getContents();
|
|
35704
35631
|
let map;
|
|
35705
35632
|
const result = await plugin.transform.call(mixedContext, code, id);
|
|
@@ -35757,7 +35684,7 @@ function createFarmContext(context, currentResolveId) {
|
|
|
35757
35684
|
resolvedPath: outFileName,
|
|
35758
35685
|
name: outFileName,
|
|
35759
35686
|
content: [...buffer$2.Buffer.from(emittedFile.source)],
|
|
35760
|
-
resourceType:
|
|
35687
|
+
resourceType: path$i.extname(outFileName)
|
|
35761
35688
|
});
|
|
35762
35689
|
}
|
|
35763
35690
|
},
|
|
@@ -35791,7 +35718,7 @@ var ExtToLoader2 = {
|
|
|
35791
35718
|
".node": "napi"
|
|
35792
35719
|
};
|
|
35793
35720
|
function guessIdLoader(id) {
|
|
35794
|
-
return ExtToLoader2[
|
|
35721
|
+
return ExtToLoader2[path$i.extname(id).toLowerCase()] || "js";
|
|
35795
35722
|
}
|
|
35796
35723
|
function transformQuery(context) {
|
|
35797
35724
|
const queryParamsObject = {};
|
|
@@ -35881,7 +35808,7 @@ function toFarmPlugin(plugin, options) {
|
|
|
35881
35808
|
farmPlugin.resolve = {
|
|
35882
35809
|
filters: { sources: [".*", ...filters], importers: [".*"] },
|
|
35883
35810
|
async executor(params, context) {
|
|
35884
|
-
const resolvedIdPath =
|
|
35811
|
+
const resolvedIdPath = path$i.resolve(
|
|
35885
35812
|
process.cwd(),
|
|
35886
35813
|
params.importer ?? ""
|
|
35887
35814
|
);
|
|
@@ -36088,11 +36015,11 @@ function createBuildContext2(compilation) {
|
|
|
36088
36015
|
}
|
|
36089
36016
|
|
|
36090
36017
|
// src/rspack/index.ts
|
|
36091
|
-
var TRANSFORM_LOADER =
|
|
36018
|
+
var TRANSFORM_LOADER = path$i.resolve(
|
|
36092
36019
|
__dirname$1,
|
|
36093
36020
|
"rspack/loaders/transform"
|
|
36094
36021
|
);
|
|
36095
|
-
var LOAD_LOADER =
|
|
36022
|
+
var LOAD_LOADER = path$i.resolve(
|
|
36096
36023
|
__dirname$1,
|
|
36097
36024
|
"rspack/loaders/load"
|
|
36098
36025
|
);
|
|
@@ -36100,7 +36027,7 @@ function getRspackPlugin(factory) {
|
|
|
36100
36027
|
return (userOptions) => {
|
|
36101
36028
|
return {
|
|
36102
36029
|
apply(compiler) {
|
|
36103
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36030
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process.cwd(), "_virtual_");
|
|
36104
36031
|
const injected = compiler.$unpluginContext || {};
|
|
36105
36032
|
compiler.$unpluginContext = injected;
|
|
36106
36033
|
const meta = {
|
|
@@ -36210,7 +36137,7 @@ function createBuildContext3(options, compilation) {
|
|
|
36210
36137
|
});
|
|
36211
36138
|
},
|
|
36212
36139
|
addWatchFile(id) {
|
|
36213
|
-
options.addWatchFile(
|
|
36140
|
+
options.addWatchFile(path$i.resolve(process2.cwd(), id));
|
|
36214
36141
|
},
|
|
36215
36142
|
emitFile(emittedFile) {
|
|
36216
36143
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
@@ -36244,11 +36171,11 @@ function normalizeMessage(error) {
|
|
|
36244
36171
|
}
|
|
36245
36172
|
|
|
36246
36173
|
// src/webpack/index.ts
|
|
36247
|
-
var TRANSFORM_LOADER2 =
|
|
36174
|
+
var TRANSFORM_LOADER2 = path$i.resolve(
|
|
36248
36175
|
__dirname$1,
|
|
36249
36176
|
"webpack/loaders/transform"
|
|
36250
36177
|
);
|
|
36251
|
-
var LOAD_LOADER2 =
|
|
36178
|
+
var LOAD_LOADER2 = path$i.resolve(
|
|
36252
36179
|
__dirname$1,
|
|
36253
36180
|
"webpack/loaders/load"
|
|
36254
36181
|
);
|
|
@@ -36256,7 +36183,7 @@ function getWebpackPlugin(factory) {
|
|
|
36256
36183
|
return (userOptions) => {
|
|
36257
36184
|
return {
|
|
36258
36185
|
apply(compiler) {
|
|
36259
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
36186
|
+
const VIRTUAL_MODULE_PREFIX = path$i.resolve(compiler.options.context ?? process2.cwd(), "_virtual_");
|
|
36260
36187
|
const injected = compiler.$unpluginContext || {};
|
|
36261
36188
|
compiler.$unpluginContext = injected;
|
|
36262
36189
|
const meta = {
|
|
@@ -36463,6 +36390,7 @@ const validateOptions = (options = {}) => {
|
|
|
36463
36390
|
};
|
|
36464
36391
|
const HOST_NAME = "datadog-build-plugins";
|
|
36465
36392
|
const buildPluginFactory = ({
|
|
36393
|
+
bundler,
|
|
36466
36394
|
version
|
|
36467
36395
|
}) => {
|
|
36468
36396
|
return createUnplugin((opts, unpluginMetaContext) => {
|
|
@@ -36471,6 +36399,7 @@ const buildPluginFactory = ({
|
|
|
36471
36399
|
unpluginMetaContext.esbuildHostName = HOST_NAME;
|
|
36472
36400
|
}
|
|
36473
36401
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
36402
|
+
bundler,
|
|
36474
36403
|
version,
|
|
36475
36404
|
...unpluginMetaContext
|
|
36476
36405
|
});
|
|
@@ -36493,7 +36422,7 @@ const buildPluginFactory = ({
|
|
|
36493
36422
|
|
|
36494
36423
|
var name = "@datadog/esbuild-plugin";
|
|
36495
36424
|
var packageManager = "yarn@4.0.2";
|
|
36496
|
-
var version$1 = "2.3.1-dev-
|
|
36425
|
+
var version$1 = "2.3.1-dev-10";
|
|
36497
36426
|
var license = "MIT";
|
|
36498
36427
|
var author = "Datadog";
|
|
36499
36428
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -36581,6 +36510,7 @@ var pkg = {
|
|
|
36581
36510
|
};
|
|
36582
36511
|
|
|
36583
36512
|
const datadogEsbuildPlugin = buildPluginFactory({
|
|
36513
|
+
bundler: esbuild,
|
|
36584
36514
|
version: pkg.version
|
|
36585
36515
|
}).esbuild;
|
|
36586
36516
|
const version = pkg.version;
|