@datadog/esbuild-plugin 2.3.0-dev → 2.3.0
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 +62 -2
- package/dist/src/index.js +389 -189
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +389 -189
- package/dist/src/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/src/index.js
CHANGED
|
@@ -10846,7 +10846,7 @@ const glob = Object.assign(glob_, {
|
|
|
10846
10846
|
glob.glob = glob;
|
|
10847
10847
|
|
|
10848
10848
|
const EXTENSION_RX = /\.(?!.*(?:\.|\/|\\))(\w{1,})/g;
|
|
10849
|
-
const QUERY_RX = /(
|
|
10849
|
+
const QUERY_RX = /(\?|%3F|\|)+/gi;
|
|
10850
10850
|
const getExtension = (filepath) => {
|
|
10851
10851
|
EXTENSION_RX.lastIndex = 0;
|
|
10852
10852
|
return EXTENSION_RX.exec(filepath)?.[1];
|
|
@@ -10860,14 +10860,83 @@ const getType = (name) => {
|
|
|
10860
10860
|
}
|
|
10861
10861
|
return getExtension(cleanPath(name)) || "unknown";
|
|
10862
10862
|
};
|
|
10863
|
+
const serializeBuildReport = (report) => {
|
|
10864
|
+
const jsonReport = {
|
|
10865
|
+
errors: report.errors,
|
|
10866
|
+
warnings: report.warnings,
|
|
10867
|
+
start: report.start,
|
|
10868
|
+
end: report.end,
|
|
10869
|
+
duration: report.duration,
|
|
10870
|
+
writeDuration: report.writeDuration,
|
|
10871
|
+
entries: [],
|
|
10872
|
+
inputs: [],
|
|
10873
|
+
outputs: []
|
|
10874
|
+
};
|
|
10875
|
+
for (const entry of report.entries || []) {
|
|
10876
|
+
const newEntry = { ...entry, inputs: [], outputs: [] };
|
|
10877
|
+
if (entry.inputs) {
|
|
10878
|
+
newEntry.inputs = entry.inputs.map((file) => file.filepath);
|
|
10879
|
+
}
|
|
10880
|
+
if (entry.outputs) {
|
|
10881
|
+
newEntry.outputs = entry.outputs.map((file) => file.filepath);
|
|
10882
|
+
}
|
|
10883
|
+
jsonReport.entries.push(newEntry);
|
|
10884
|
+
}
|
|
10885
|
+
for (const input of report.inputs || []) {
|
|
10886
|
+
const newInput = { ...input, dependencies: [], dependents: [] };
|
|
10887
|
+
if (input.dependencies) {
|
|
10888
|
+
for (const dependency of input.dependencies) {
|
|
10889
|
+
newInput.dependencies.push(dependency.filepath);
|
|
10890
|
+
}
|
|
10891
|
+
}
|
|
10892
|
+
if (input.dependents) {
|
|
10893
|
+
for (const dependent of input.dependents) {
|
|
10894
|
+
newInput.dependents.push(dependent.filepath);
|
|
10895
|
+
}
|
|
10896
|
+
}
|
|
10897
|
+
jsonReport.inputs.push(newInput);
|
|
10898
|
+
}
|
|
10899
|
+
for (const output of report.outputs || []) {
|
|
10900
|
+
const newOutput = { ...output, inputs: [] };
|
|
10901
|
+
if (output.inputs) {
|
|
10902
|
+
newOutput.inputs = output.inputs.map((file) => file.filepath);
|
|
10903
|
+
}
|
|
10904
|
+
jsonReport.outputs.push(newOutput);
|
|
10905
|
+
}
|
|
10906
|
+
return jsonReport;
|
|
10907
|
+
};
|
|
10863
10908
|
const BUNDLER_SPECIFICS = ["unknown", "commonjsHelpers.js", "vite/preload-helper.js"];
|
|
10864
|
-
const cleanReport = (report, filepath) => {
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10909
|
+
const cleanReport = (report, filepath, filter) => {
|
|
10910
|
+
const cleanedReport = /* @__PURE__ */ new Set();
|
|
10911
|
+
for (const reportFilepath of report) {
|
|
10912
|
+
const cleanedPath = cleanPath(reportFilepath);
|
|
10913
|
+
if (
|
|
10914
|
+
// Don't add itself into it.
|
|
10915
|
+
cleanedPath === filepath || // Remove common specific files injected by bundlers.
|
|
10916
|
+
BUNDLER_SPECIFICS.includes(cleanedPath)
|
|
10917
|
+
) {
|
|
10918
|
+
continue;
|
|
10919
|
+
}
|
|
10920
|
+
if (filter) {
|
|
10921
|
+
const filteredValue = filter(cleanedPath);
|
|
10922
|
+
if (filteredValue) {
|
|
10923
|
+
cleanedReport.add(filteredValue);
|
|
10924
|
+
}
|
|
10925
|
+
} else {
|
|
10926
|
+
cleanedReport.add(cleanedPath);
|
|
10927
|
+
}
|
|
10928
|
+
}
|
|
10929
|
+
return cleanedReport;
|
|
10868
10930
|
};
|
|
10869
10931
|
const cleanPath = (filepath) => {
|
|
10870
|
-
return filepath.split(QUERY_RX).shift().replace(/^[^\w\s.,!@#$%^&*()=+~`\-/]+/, "");
|
|
10932
|
+
return filepath.split("!").pop().split(QUERY_RX).shift().replace(/^[^\w\s.,!@#$%^&*()=+~`\-/]+/, "");
|
|
10933
|
+
};
|
|
10934
|
+
const getResolvedPath = (filepath) => {
|
|
10935
|
+
try {
|
|
10936
|
+
return require.resolve(filepath);
|
|
10937
|
+
} catch (e) {
|
|
10938
|
+
return filepath;
|
|
10939
|
+
}
|
|
10871
10940
|
};
|
|
10872
10941
|
const cleanName = (context, filepath) => {
|
|
10873
10942
|
if (filepath === "unknown") {
|
|
@@ -10876,12 +10945,7 @@ const cleanName = (context, filepath) => {
|
|
|
10876
10945
|
if (filepath.includes("webpack/runtime")) {
|
|
10877
10946
|
return filepath.replace("webpack/runtime/", "").replace(/ +/g, "-");
|
|
10878
10947
|
}
|
|
10879
|
-
|
|
10880
|
-
try {
|
|
10881
|
-
resolvedPath = require.resolve(filepath);
|
|
10882
|
-
} catch (e) {
|
|
10883
|
-
}
|
|
10884
|
-
return resolvedPath.replace(context.bundler.outDir, "").replace(context.cwd, "").split("node_modules").pop().split("?").shift().replace(/^\/+/, "");
|
|
10948
|
+
return filepath.split("!").pop().replace(context.bundler.outDir, "").replace(context.cwd, "").split("node_modules").pop().split(QUERY_RX).shift().replace(/^\/+/, "");
|
|
10885
10949
|
};
|
|
10886
10950
|
|
|
10887
10951
|
const reIndexMeta = (obj, cwd) => Object.fromEntries(
|
|
@@ -10904,7 +10968,7 @@ const getEntryNames = (entrypoints, context) => {
|
|
|
10904
10968
|
const fullPath = entry && typeof entry === "object" ? entry.in : entry;
|
|
10905
10969
|
const allFiles = getAllEntryFiles(fullPath, context.cwd);
|
|
10906
10970
|
for (const file of allFiles) {
|
|
10907
|
-
const cleanedName = cleanName(context, file);
|
|
10971
|
+
const cleanedName = cleanName(context, getResolvedPath(file));
|
|
10908
10972
|
entryNames.set(cleanedName, cleanedName);
|
|
10909
10973
|
}
|
|
10910
10974
|
}
|
|
@@ -10913,7 +10977,7 @@ const getEntryNames = (entrypoints, context) => {
|
|
|
10913
10977
|
for (const [entryName, entryPath] of entryList) {
|
|
10914
10978
|
const allFiles = getAllEntryFiles(entryPath, context.cwd);
|
|
10915
10979
|
for (const file of allFiles) {
|
|
10916
|
-
const cleanedName = cleanName(context, file);
|
|
10980
|
+
const cleanedName = cleanName(context, getResolvedPath(file));
|
|
10917
10981
|
entryNames.set(cleanedName, entryName);
|
|
10918
10982
|
}
|
|
10919
10983
|
}
|
|
@@ -10951,8 +11015,8 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
10951
11015
|
const file = {
|
|
10952
11016
|
name: cleanName(context, filename),
|
|
10953
11017
|
filepath,
|
|
10954
|
-
dependents:
|
|
10955
|
-
dependencies:
|
|
11018
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11019
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
10956
11020
|
size: input.bytes,
|
|
10957
11021
|
type: getType(filename)
|
|
10958
11022
|
};
|
|
@@ -11027,7 +11091,17 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11027
11091
|
meta: metaOutputsIndexed
|
|
11028
11092
|
}
|
|
11029
11093
|
};
|
|
11094
|
+
const FILE_EXCEPTIONS_RX = /(<runtime>|https:|file:|data:|#)/g;
|
|
11095
|
+
const isFileSupported = (filePath) => {
|
|
11096
|
+
if (filePath.match(FILE_EXCEPTIONS_RX)) {
|
|
11097
|
+
return false;
|
|
11098
|
+
}
|
|
11099
|
+
return true;
|
|
11100
|
+
};
|
|
11030
11101
|
const getAllImports = (filePath, ref, allImports = {}) => {
|
|
11102
|
+
if (!isFileSupported(filePath)) {
|
|
11103
|
+
return allImports;
|
|
11104
|
+
}
|
|
11031
11105
|
const file = ref.report[filePath];
|
|
11032
11106
|
if (!file) {
|
|
11033
11107
|
warn(`Could not find report's ${filePath}`);
|
|
@@ -11079,14 +11153,17 @@ const getEsbuildPlugin$2 = (context, log) => {
|
|
|
11079
11153
|
continue;
|
|
11080
11154
|
}
|
|
11081
11155
|
for (const dependency of metaFile.imports) {
|
|
11156
|
+
if (!isFileSupported(dependency.path)) {
|
|
11157
|
+
continue;
|
|
11158
|
+
}
|
|
11082
11159
|
const dependencyPath = path$i.join(cwd, dependency.path);
|
|
11083
11160
|
const dependencyFile = references.inputs.report[dependencyPath];
|
|
11084
11161
|
if (!dependencyFile) {
|
|
11085
11162
|
warn(`Could not find input file of ${dependency.path}`);
|
|
11086
11163
|
continue;
|
|
11087
11164
|
}
|
|
11088
|
-
input.dependencies.
|
|
11089
|
-
dependencyFile.dependents.
|
|
11165
|
+
input.dependencies.add(dependencyFile);
|
|
11166
|
+
dependencyFile.dependents.add(input);
|
|
11090
11167
|
}
|
|
11091
11168
|
}
|
|
11092
11169
|
context.build.outputs = outputs;
|
|
@@ -11113,19 +11190,23 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11113
11190
|
moduleParsed(info) {
|
|
11114
11191
|
const cleanId = cleanPath(info.id);
|
|
11115
11192
|
const report = importsReport[cleanId] || {
|
|
11116
|
-
dependencies:
|
|
11117
|
-
dependents:
|
|
11193
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11194
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11118
11195
|
};
|
|
11119
11196
|
const newDependencies = cleanReport(
|
|
11120
|
-
[...info.dynamicallyImportedIds, ...info.importedIds],
|
|
11197
|
+
/* @__PURE__ */ new Set([...info.dynamicallyImportedIds, ...info.importedIds]),
|
|
11121
11198
|
cleanId
|
|
11122
|
-
)
|
|
11199
|
+
);
|
|
11123
11200
|
const newDependents = cleanReport(
|
|
11124
|
-
[...info.dynamicImporters, ...info.importers],
|
|
11201
|
+
/* @__PURE__ */ new Set([...info.dynamicImporters, ...info.importers]),
|
|
11125
11202
|
cleanId
|
|
11126
|
-
)
|
|
11127
|
-
|
|
11128
|
-
|
|
11203
|
+
);
|
|
11204
|
+
for (const dependent of newDependents) {
|
|
11205
|
+
report.dependents.add(dependent);
|
|
11206
|
+
}
|
|
11207
|
+
for (const dependency of newDependencies) {
|
|
11208
|
+
report.dependencies.add(dependency);
|
|
11209
|
+
}
|
|
11129
11210
|
importsReport[cleanId] = report;
|
|
11130
11211
|
},
|
|
11131
11212
|
writeBundle(options, bundle) {
|
|
@@ -11144,22 +11225,28 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11144
11225
|
for (const dependency of dependencies) {
|
|
11145
11226
|
const cleanedDependency = cleanPath(dependency);
|
|
11146
11227
|
if (!importsReport[cleanedDependency]) {
|
|
11147
|
-
importsReport[cleanedDependency] = {
|
|
11228
|
+
importsReport[cleanedDependency] = {
|
|
11229
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11230
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11231
|
+
};
|
|
11148
11232
|
}
|
|
11149
|
-
if (importsReport[cleanedDependency].dependents.
|
|
11233
|
+
if (importsReport[cleanedDependency].dependents.has(filepath)) {
|
|
11150
11234
|
continue;
|
|
11151
11235
|
}
|
|
11152
|
-
importsReport[cleanedDependency].dependents.
|
|
11236
|
+
importsReport[cleanedDependency].dependents.add(filepath);
|
|
11153
11237
|
}
|
|
11154
11238
|
for (const dependent of dependents) {
|
|
11155
11239
|
const cleanedDependent = cleanPath(dependent);
|
|
11156
11240
|
if (!importsReport[cleanedDependent]) {
|
|
11157
|
-
importsReport[cleanedDependent] = {
|
|
11241
|
+
importsReport[cleanedDependent] = {
|
|
11242
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11243
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11244
|
+
};
|
|
11158
11245
|
}
|
|
11159
|
-
if (importsReport[cleanedDependent].dependencies.
|
|
11246
|
+
if (importsReport[cleanedDependent].dependencies.has(filepath)) {
|
|
11160
11247
|
continue;
|
|
11161
11248
|
}
|
|
11162
|
-
importsReport[cleanedDependent].dependencies.
|
|
11249
|
+
importsReport[cleanedDependent].dependencies.add(filepath);
|
|
11163
11250
|
}
|
|
11164
11251
|
}
|
|
11165
11252
|
for (const [filename, asset] of Object.entries(bundle)) {
|
|
@@ -11182,8 +11269,8 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11182
11269
|
}
|
|
11183
11270
|
const moduleFile = {
|
|
11184
11271
|
name: cleanName(context, modulepath),
|
|
11185
|
-
dependencies:
|
|
11186
|
-
dependents:
|
|
11272
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11273
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11187
11274
|
filepath: modulepath,
|
|
11188
11275
|
// Since we store as input, we use the originalLength.
|
|
11189
11276
|
size: module.originalLength,
|
|
@@ -11214,7 +11301,7 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11214
11301
|
);
|
|
11215
11302
|
continue;
|
|
11216
11303
|
}
|
|
11217
|
-
input.dependencies.
|
|
11304
|
+
input.dependencies.add(foundInput);
|
|
11218
11305
|
}
|
|
11219
11306
|
for (const dependent of importReport.dependents) {
|
|
11220
11307
|
const foundInput = reportInputsIndexed[dependent];
|
|
@@ -11224,7 +11311,7 @@ const getRollupPlugin$1 = (context, log) => {
|
|
|
11224
11311
|
);
|
|
11225
11312
|
continue;
|
|
11226
11313
|
}
|
|
11227
|
-
input.dependents.
|
|
11314
|
+
input.dependents.add(foundInput);
|
|
11228
11315
|
}
|
|
11229
11316
|
}
|
|
11230
11317
|
if (tempSourcemaps.length) {
|
|
@@ -11302,34 +11389,58 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11302
11389
|
chunkGroupChildren: true,
|
|
11303
11390
|
chunkGroups: true,
|
|
11304
11391
|
chunkModules: true,
|
|
11392
|
+
chunkRelations: true,
|
|
11305
11393
|
entrypoints: true,
|
|
11306
11394
|
errors: true,
|
|
11307
11395
|
ids: true,
|
|
11308
11396
|
modules: true,
|
|
11397
|
+
nestedModules: true,
|
|
11309
11398
|
reasons: true,
|
|
11310
11399
|
relatedAssets: true,
|
|
11311
|
-
runtime: true,
|
|
11312
|
-
runtimeModules: true,
|
|
11313
11400
|
warnings: true
|
|
11314
11401
|
});
|
|
11315
11402
|
const chunks = stats.chunks || [];
|
|
11316
|
-
const assets =
|
|
11317
|
-
const modules =
|
|
11403
|
+
const assets = compilation.getAssets();
|
|
11404
|
+
const modules = [];
|
|
11318
11405
|
const entrypoints = stats.entrypoints || [];
|
|
11319
11406
|
const tempSourcemaps = [];
|
|
11320
11407
|
const tempDeps = {};
|
|
11321
11408
|
const reportInputsIndexed = {};
|
|
11322
11409
|
const reportOutputsIndexed = {};
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11410
|
+
const modulePerId = /* @__PURE__ */ new Map();
|
|
11411
|
+
const modulePerIdentifier = /* @__PURE__ */ new Map();
|
|
11412
|
+
const concatModulesPerId = /* @__PURE__ */ new Map();
|
|
11413
|
+
const concatModulesPerIdentifier = /* @__PURE__ */ new Map();
|
|
11414
|
+
for (const module of stats.modules || []) {
|
|
11415
|
+
if (module.modules) {
|
|
11416
|
+
if (module.id) {
|
|
11417
|
+
concatModulesPerId.set(module.id, module.modules);
|
|
11418
|
+
}
|
|
11419
|
+
if (module.identifier) {
|
|
11420
|
+
concatModulesPerIdentifier.set(module.identifier, module.modules);
|
|
11421
|
+
}
|
|
11422
|
+
for (const subModule of module.modules) {
|
|
11423
|
+
modules.push(subModule);
|
|
11424
|
+
if (subModule.id) {
|
|
11425
|
+
modulePerId.set(subModule.id, subModule);
|
|
11426
|
+
}
|
|
11427
|
+
if (subModule.identifier) {
|
|
11428
|
+
modulePerIdentifier.set(subModule.identifier, subModule);
|
|
11429
|
+
}
|
|
11430
|
+
}
|
|
11431
|
+
} else {
|
|
11432
|
+
modules.push(module);
|
|
11433
|
+
if (module.id) {
|
|
11434
|
+
modulePerId.set(module.id, module);
|
|
11435
|
+
}
|
|
11436
|
+
if (module.identifier) {
|
|
11437
|
+
modulePerIdentifier.set(module.identifier, module);
|
|
11327
11438
|
}
|
|
11328
11439
|
}
|
|
11329
11440
|
}
|
|
11330
11441
|
for (const asset of assets) {
|
|
11331
11442
|
const file = {
|
|
11332
|
-
size: asset.size,
|
|
11443
|
+
size: asset.info.size || 0,
|
|
11333
11444
|
name: asset.name,
|
|
11334
11445
|
inputs: [],
|
|
11335
11446
|
filepath: path$i.join(context.bundler.outDir, asset.name),
|
|
@@ -11344,38 +11455,77 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11344
11455
|
for (const sourcemap of tempSourcemaps) {
|
|
11345
11456
|
const outputFound = reportOutputsIndexed[sourcemap.filepath.replace(/\.map$/, "")];
|
|
11346
11457
|
if (!outputFound) {
|
|
11347
|
-
warn(`Output not found for ${sourcemap.name}`);
|
|
11458
|
+
warn(`Output not found for sourcemap ${sourcemap.name}`);
|
|
11348
11459
|
continue;
|
|
11349
11460
|
}
|
|
11350
11461
|
sourcemap.inputs.push(outputFound);
|
|
11351
11462
|
}
|
|
11463
|
+
const getModulePath = (module) => {
|
|
11464
|
+
return module.nameForCondition ? module.nameForCondition : module.name ? path$i.join(context.cwd, module.name) : module.identifier ? module.identifier : "unknown";
|
|
11465
|
+
};
|
|
11466
|
+
const getModules = (reason) => {
|
|
11467
|
+
const { moduleIdentifier, moduleId } = reason;
|
|
11468
|
+
if (!moduleIdentifier && !moduleId) {
|
|
11469
|
+
return [];
|
|
11470
|
+
}
|
|
11471
|
+
const modulesFound = [];
|
|
11472
|
+
if (moduleId) {
|
|
11473
|
+
const module = modulePerId.get(moduleId);
|
|
11474
|
+
if (module) {
|
|
11475
|
+
modulesFound.push(module);
|
|
11476
|
+
}
|
|
11477
|
+
const concatModules = concatModulesPerId.get(moduleId);
|
|
11478
|
+
if (concatModules) {
|
|
11479
|
+
modulesFound.push(...concatModules);
|
|
11480
|
+
}
|
|
11481
|
+
}
|
|
11482
|
+
if (moduleIdentifier) {
|
|
11483
|
+
const module = modulePerIdentifier.get(moduleIdentifier);
|
|
11484
|
+
if (module) {
|
|
11485
|
+
modulesFound.push(module);
|
|
11486
|
+
}
|
|
11487
|
+
const concatModules = concatModulesPerIdentifier.get(moduleIdentifier);
|
|
11488
|
+
if (concatModules) {
|
|
11489
|
+
modulesFound.push(...concatModules);
|
|
11490
|
+
}
|
|
11491
|
+
}
|
|
11492
|
+
return Array.from(new Set(modulesFound.map(getModulePath)));
|
|
11493
|
+
};
|
|
11494
|
+
const modulesDone = /* @__PURE__ */ new Set();
|
|
11352
11495
|
for (const module of modules) {
|
|
11353
|
-
if (module.moduleType === "runtime" || module.name?.startsWith("(webpack)")) {
|
|
11496
|
+
if (module.moduleType === "runtime" || module.name?.startsWith("(webpack)") || module.type === "orphan modules") {
|
|
11497
|
+
continue;
|
|
11498
|
+
}
|
|
11499
|
+
const modulePath = getModulePath(module);
|
|
11500
|
+
if (modulesDone.has(modulePath)) {
|
|
11354
11501
|
continue;
|
|
11355
11502
|
}
|
|
11356
|
-
|
|
11503
|
+
modulesDone.add(modulePath);
|
|
11357
11504
|
if (modulePath === "unknown") {
|
|
11358
11505
|
warn(`Unknown module: ${JSON.stringify(module)}`);
|
|
11359
11506
|
}
|
|
11360
11507
|
if (module.reasons) {
|
|
11361
|
-
const moduleDeps = tempDeps[modulePath] || {
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
for (const
|
|
11367
|
-
const reasonDeps = tempDeps[
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11508
|
+
const moduleDeps = tempDeps[modulePath] || {
|
|
11509
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11510
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11511
|
+
};
|
|
11512
|
+
const dependents = module.reasons.flatMap(getModules);
|
|
11513
|
+
for (const dependent of dependents) {
|
|
11514
|
+
const reasonDeps = tempDeps[dependent] || {
|
|
11515
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11516
|
+
dependents: /* @__PURE__ */ new Set()
|
|
11517
|
+
};
|
|
11518
|
+
reasonDeps.dependencies.add(modulePath);
|
|
11519
|
+
tempDeps[dependent] = reasonDeps;
|
|
11520
|
+
moduleDeps.dependents.add(dependent);
|
|
11521
|
+
}
|
|
11372
11522
|
tempDeps[modulePath] = moduleDeps;
|
|
11373
11523
|
}
|
|
11374
11524
|
const file = {
|
|
11375
11525
|
size: module.size || 0,
|
|
11376
11526
|
name: cleanName(context, modulePath),
|
|
11377
|
-
dependencies:
|
|
11378
|
-
dependents:
|
|
11527
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
11528
|
+
dependents: /* @__PURE__ */ new Set(),
|
|
11379
11529
|
filepath: modulePath,
|
|
11380
11530
|
type: getType(modulePath)
|
|
11381
11531
|
};
|
|
@@ -11393,7 +11543,9 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11393
11543
|
warn(`Output not found for ${file.name}`);
|
|
11394
11544
|
continue;
|
|
11395
11545
|
}
|
|
11396
|
-
outputFound.inputs.
|
|
11546
|
+
if (!outputFound.inputs.includes(file)) {
|
|
11547
|
+
outputFound.inputs.push(file);
|
|
11548
|
+
}
|
|
11397
11549
|
}
|
|
11398
11550
|
reportInputsIndexed[modulePath] = file;
|
|
11399
11551
|
inputs.push(file);
|
|
@@ -11411,10 +11563,8 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11411
11563
|
warn(`Could not find dependency report for ${input.name}`);
|
|
11412
11564
|
continue;
|
|
11413
11565
|
}
|
|
11414
|
-
input.dependencies = cleanReport(depsReport.dependencies, input.filepath)
|
|
11415
|
-
|
|
11416
|
-
);
|
|
11417
|
-
input.dependents = cleanReport(depsReport.dependents, input.filepath).map(getInput);
|
|
11566
|
+
input.dependencies = cleanReport(depsReport.dependencies, input.filepath, getInput);
|
|
11567
|
+
input.dependents = cleanReport(depsReport.dependents, input.filepath, getInput);
|
|
11418
11568
|
}
|
|
11419
11569
|
for (const [name, entry] of Object.entries(entrypoints)) {
|
|
11420
11570
|
const entryOutputs = [];
|
|
@@ -11437,21 +11587,21 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11437
11587
|
}
|
|
11438
11588
|
const outputFound = reportOutputsIndexed[assetPath];
|
|
11439
11589
|
if (outputFound) {
|
|
11440
|
-
if (outputFound.type !== "map") {
|
|
11590
|
+
if (outputFound.type !== "map" && !entryOutputs.includes(outputFound)) {
|
|
11441
11591
|
entryOutputs.push(outputFound);
|
|
11442
11592
|
entryInputs.push(...outputFound.inputs);
|
|
11443
11593
|
size += outputFound.size;
|
|
11444
11594
|
}
|
|
11445
11595
|
}
|
|
11446
11596
|
}
|
|
11447
|
-
const
|
|
11597
|
+
const entryFilename = stats.assetsByChunkName?.[name]?.[0];
|
|
11448
11598
|
const file = {
|
|
11449
11599
|
name,
|
|
11450
|
-
filepath:
|
|
11600
|
+
filepath: entryFilename ? path$i.join(context.bundler.outDir, entryFilename) : "unknown",
|
|
11451
11601
|
size,
|
|
11452
|
-
inputs: entryInputs,
|
|
11602
|
+
inputs: Array.from(new Set(entryInputs)),
|
|
11453
11603
|
outputs: entryOutputs,
|
|
11454
|
-
type:
|
|
11604
|
+
type: entryFilename ? getType(entryFilename) : "unknown"
|
|
11455
11605
|
};
|
|
11456
11606
|
entries.push(file);
|
|
11457
11607
|
}
|
|
@@ -11461,7 +11611,7 @@ const getWebpackPlugin$2 = (context, PLUGIN_NAME, log) => (compiler) => {
|
|
|
11461
11611
|
});
|
|
11462
11612
|
};
|
|
11463
11613
|
|
|
11464
|
-
const PLUGIN_NAME$3 = "build-report";
|
|
11614
|
+
const PLUGIN_NAME$3 = "datadog-build-report-plugin";
|
|
11465
11615
|
const getBuildReportPlugin = (opts, context) => {
|
|
11466
11616
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$3);
|
|
11467
11617
|
return {
|
|
@@ -18366,7 +18516,7 @@ const getRepositoryData = async (git, repositoryURL) => {
|
|
|
18366
18516
|
|
|
18367
18517
|
const getGitPlugin = (options, context) => {
|
|
18368
18518
|
return {
|
|
18369
|
-
name: "git-plugin",
|
|
18519
|
+
name: "datadog-git-plugin",
|
|
18370
18520
|
enforce: "pre",
|
|
18371
18521
|
async buildStart() {
|
|
18372
18522
|
const shouldGetGitInfo = options.rum?.sourcemaps && options.disableGit !== true;
|
|
@@ -18379,7 +18529,7 @@ const getGitPlugin = (options, context) => {
|
|
|
18379
18529
|
};
|
|
18380
18530
|
};
|
|
18381
18531
|
|
|
18382
|
-
const PLUGIN_NAME$2 = "context-plugin";
|
|
18532
|
+
const PLUGIN_NAME$2 = "datadog-context-plugin";
|
|
18383
18533
|
const rollupPlugin = (context) => ({
|
|
18384
18534
|
options(options) {
|
|
18385
18535
|
context.bundler.rawConfig = options;
|
|
@@ -18399,9 +18549,6 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
18399
18549
|
const variant = meta.framework === "webpack" ? meta.webpack.compiler["webpack"] ? "5" : "4" : "";
|
|
18400
18550
|
const globalContext = {
|
|
18401
18551
|
auth: opts.auth,
|
|
18402
|
-
start: Date.now(),
|
|
18403
|
-
cwd,
|
|
18404
|
-
version: meta.version,
|
|
18405
18552
|
bundler: {
|
|
18406
18553
|
name: meta.framework,
|
|
18407
18554
|
fullName: `${meta.framework}${variant}`,
|
|
@@ -18411,7 +18558,10 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
18411
18558
|
build: {
|
|
18412
18559
|
errors: [],
|
|
18413
18560
|
warnings: []
|
|
18414
|
-
}
|
|
18561
|
+
},
|
|
18562
|
+
cwd,
|
|
18563
|
+
start: Date.now(),
|
|
18564
|
+
version: meta.version
|
|
18415
18565
|
};
|
|
18416
18566
|
const globalContextPlugin = {
|
|
18417
18567
|
name: PLUGIN_NAME$2,
|
|
@@ -23322,31 +23472,6 @@ const getLoaders = (loaders) => {
|
|
|
23322
23472
|
return metrics;
|
|
23323
23473
|
};
|
|
23324
23474
|
|
|
23325
|
-
const getModuleEntryTags = (file, entries) => {
|
|
23326
|
-
const entryNames = entries.filter((entry) => {
|
|
23327
|
-
const foundModules = entry.inputs.filter((input) => {
|
|
23328
|
-
return input.name === file.name;
|
|
23329
|
-
});
|
|
23330
|
-
return foundModules.length;
|
|
23331
|
-
}).map((entry) => entry.name);
|
|
23332
|
-
return Array.from(new Set(entryNames)).map((entryName) => `entryName:${entryName}`);
|
|
23333
|
-
};
|
|
23334
|
-
const getAssetEntryTags = (file, entries) => {
|
|
23335
|
-
const cleanAssetName = file.name.replace(/\.map$/, "");
|
|
23336
|
-
const entryNames = entries.filter((entry) => {
|
|
23337
|
-
const foundModules = entry.outputs.filter((output) => {
|
|
23338
|
-
return output.name === cleanAssetName;
|
|
23339
|
-
});
|
|
23340
|
-
return foundModules.length;
|
|
23341
|
-
}).map((entry) => entry.name);
|
|
23342
|
-
return Array.from(new Set(entryNames)).map((entryName) => `entryName:${entryName}`);
|
|
23343
|
-
};
|
|
23344
|
-
const getModuleAssetTags = (file, outputs) => {
|
|
23345
|
-
const assetNames = outputs.filter((output) => {
|
|
23346
|
-
return output.inputs.find((input) => input.filepath === file.filepath);
|
|
23347
|
-
}).map((output) => output.name);
|
|
23348
|
-
return Array.from(new Set(assetNames)).map((assetName) => `assetName:${assetName}`);
|
|
23349
|
-
};
|
|
23350
23475
|
const getUniversalMetrics = (globalContext) => {
|
|
23351
23476
|
const metrics = [];
|
|
23352
23477
|
const inputs = globalContext.build.inputs || [];
|
|
@@ -23355,6 +23480,32 @@ const getUniversalMetrics = (globalContext) => {
|
|
|
23355
23480
|
const nbWarnings = globalContext.build.warnings.length;
|
|
23356
23481
|
const nbErrors = globalContext.build.errors.length;
|
|
23357
23482
|
const duration = globalContext.build.duration;
|
|
23483
|
+
const entriesPerInput = /* @__PURE__ */ new Map();
|
|
23484
|
+
const assetsPerInput = /* @__PURE__ */ new Map();
|
|
23485
|
+
const entriesPerAsset = /* @__PURE__ */ new Map();
|
|
23486
|
+
for (const entry of entries) {
|
|
23487
|
+
for (const input of entry.inputs) {
|
|
23488
|
+
if (!entriesPerInput.has(input.filepath)) {
|
|
23489
|
+
entriesPerInput.set(input.filepath, []);
|
|
23490
|
+
}
|
|
23491
|
+
entriesPerInput.get(input.filepath).push(entry.name);
|
|
23492
|
+
}
|
|
23493
|
+
for (const output of entry.outputs) {
|
|
23494
|
+
const cleanAssetName = output.filepath.replace(/\.map$/, "");
|
|
23495
|
+
if (!entriesPerAsset.has(cleanAssetName)) {
|
|
23496
|
+
entriesPerAsset.set(cleanAssetName, []);
|
|
23497
|
+
}
|
|
23498
|
+
entriesPerAsset.get(cleanAssetName).push(entry.name);
|
|
23499
|
+
}
|
|
23500
|
+
}
|
|
23501
|
+
for (const output of outputs) {
|
|
23502
|
+
for (const input of output.inputs) {
|
|
23503
|
+
if (!assetsPerInput.has(input.filepath)) {
|
|
23504
|
+
assetsPerInput.set(input.filepath, []);
|
|
23505
|
+
}
|
|
23506
|
+
assetsPerInput.get(input.filepath).push(output.name);
|
|
23507
|
+
}
|
|
23508
|
+
}
|
|
23358
23509
|
metrics.push(
|
|
23359
23510
|
{
|
|
23360
23511
|
metric: "assets.count",
|
|
@@ -23396,12 +23547,17 @@ const getUniversalMetrics = (globalContext) => {
|
|
|
23396
23547
|
});
|
|
23397
23548
|
}
|
|
23398
23549
|
for (const input of inputs) {
|
|
23399
|
-
const tags = [
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23550
|
+
const tags = [`moduleName:${input.name}`, `moduleType:${input.type}`];
|
|
23551
|
+
if (entriesPerInput.has(input.filepath)) {
|
|
23552
|
+
tags.push(
|
|
23553
|
+
...entriesPerInput.get(input.filepath).map((entryName) => `entryName:${entryName}`)
|
|
23554
|
+
);
|
|
23555
|
+
}
|
|
23556
|
+
if (assetsPerInput.has(input.filepath)) {
|
|
23557
|
+
tags.push(
|
|
23558
|
+
...assetsPerInput.get(input.filepath).map((assetName) => `assetName:${assetName}`)
|
|
23559
|
+
);
|
|
23560
|
+
}
|
|
23405
23561
|
metrics.push(
|
|
23406
23562
|
{
|
|
23407
23563
|
metric: "modules.size",
|
|
@@ -23412,38 +23568,37 @@ const getUniversalMetrics = (globalContext) => {
|
|
|
23412
23568
|
{
|
|
23413
23569
|
metric: "modules.dependencies",
|
|
23414
23570
|
type: "count",
|
|
23415
|
-
value: input.dependencies.
|
|
23571
|
+
value: input.dependencies.size,
|
|
23416
23572
|
tags
|
|
23417
23573
|
},
|
|
23418
23574
|
{
|
|
23419
23575
|
metric: "modules.dependents",
|
|
23420
23576
|
type: "count",
|
|
23421
|
-
value: input.dependents.
|
|
23577
|
+
value: input.dependents.size,
|
|
23422
23578
|
tags
|
|
23423
23579
|
}
|
|
23424
23580
|
);
|
|
23425
23581
|
}
|
|
23426
23582
|
for (const output of outputs) {
|
|
23583
|
+
const tags = [`assetName:${output.name}`, `assetType:${output.type}`];
|
|
23584
|
+
const cleanAssetName = output.filepath.replace(/\.map$/, "");
|
|
23585
|
+
if (entriesPerAsset.has(cleanAssetName)) {
|
|
23586
|
+
tags.push(
|
|
23587
|
+
...entriesPerAsset.get(cleanAssetName).map((entryName) => `entryName:${entryName}`)
|
|
23588
|
+
);
|
|
23589
|
+
}
|
|
23427
23590
|
metrics.push(
|
|
23428
23591
|
{
|
|
23429
23592
|
metric: "assets.size",
|
|
23430
23593
|
type: "size",
|
|
23431
23594
|
value: output.size,
|
|
23432
|
-
tags
|
|
23433
|
-
`assetName:${output.name}`,
|
|
23434
|
-
`assetType:${output.type}`,
|
|
23435
|
-
...getAssetEntryTags(output, entries)
|
|
23436
|
-
]
|
|
23595
|
+
tags
|
|
23437
23596
|
},
|
|
23438
23597
|
{
|
|
23439
23598
|
metric: "assets.modules.count",
|
|
23440
23599
|
type: "count",
|
|
23441
23600
|
value: output.inputs.length,
|
|
23442
|
-
tags
|
|
23443
|
-
`assetName:${output.name}`,
|
|
23444
|
-
`assetType:${output.type}`,
|
|
23445
|
-
...getAssetEntryTags(output, entries)
|
|
23446
|
-
]
|
|
23601
|
+
tags
|
|
23447
23602
|
}
|
|
23448
23603
|
);
|
|
23449
23604
|
}
|
|
@@ -23684,6 +23839,7 @@ var prettyBytes = (number, options) => {
|
|
|
23684
23839
|
var prettyBytes$1 = /*@__PURE__*/getDefaultExportFromCjs(prettyBytes);
|
|
23685
23840
|
|
|
23686
23841
|
const TOP = 5;
|
|
23842
|
+
const MAX_VALUE_LENGTH = 60;
|
|
23687
23843
|
const numColor = chalk.bold.red;
|
|
23688
23844
|
const nameColor = chalk.bold.cyan;
|
|
23689
23845
|
const sortDesc = (attr) => (a, b) => {
|
|
@@ -23760,7 +23916,7 @@ const getGeneralValues = (context) => {
|
|
|
23760
23916
|
const getAssetsValues = (context) => {
|
|
23761
23917
|
const assetSizesToPrint = {
|
|
23762
23918
|
name: "Asset size",
|
|
23763
|
-
values: (context.build.outputs || []).sort(sortDesc((output) => output.size)).map((output) => ({
|
|
23919
|
+
values: (context.build.outputs || []).filter((output) => output.type !== "map").sort(sortDesc((output) => output.size)).map((output) => ({
|
|
23764
23920
|
name: output.name,
|
|
23765
23921
|
value: prettyBytes$1(output.size)
|
|
23766
23922
|
})),
|
|
@@ -23784,17 +23940,6 @@ const getAssetsValues = (context) => {
|
|
|
23784
23940
|
};
|
|
23785
23941
|
return [assetSizesToPrint, entrySizesToPrint, entryModulesToPrint];
|
|
23786
23942
|
};
|
|
23787
|
-
const getAll = (attribute, collection, filepath, accumulator = []) => {
|
|
23788
|
-
const reported = collection[filepath]?.[attribute] || [];
|
|
23789
|
-
for (const reportedFilename of reported) {
|
|
23790
|
-
if (accumulator.includes(reportedFilename) || reportedFilename === filepath) {
|
|
23791
|
-
continue;
|
|
23792
|
-
}
|
|
23793
|
-
accumulator.push(reportedFilename);
|
|
23794
|
-
getAll(attribute, collection, reportedFilename, accumulator);
|
|
23795
|
-
}
|
|
23796
|
-
return accumulator;
|
|
23797
|
-
};
|
|
23798
23943
|
const getModulesValues = (context) => {
|
|
23799
23944
|
const dependentsToPrint = {
|
|
23800
23945
|
name: `Module total dependents`,
|
|
@@ -23816,55 +23961,86 @@ const getModulesValues = (context) => {
|
|
|
23816
23961
|
values: [],
|
|
23817
23962
|
top: true
|
|
23818
23963
|
};
|
|
23819
|
-
const dependencies =
|
|
23820
|
-
const
|
|
23821
|
-
|
|
23822
|
-
|
|
23823
|
-
|
|
23824
|
-
|
|
23825
|
-
|
|
23826
|
-
dependencies: input.dependencies.map((dep) => dep.filepath),
|
|
23827
|
-
dependents: input.dependents.map((dep) => dep.filepath)
|
|
23828
|
-
}
|
|
23829
|
-
])
|
|
23830
|
-
);
|
|
23831
|
-
for (const filepath in inputs) {
|
|
23832
|
-
if (!Object.hasOwn(inputs, filepath)) {
|
|
23964
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
23965
|
+
const serializedReport = serializeBuildReport(context.build);
|
|
23966
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
23967
|
+
const fileDependencies = /* @__PURE__ */ new Map();
|
|
23968
|
+
const fileDependents = /* @__PURE__ */ new Map();
|
|
23969
|
+
for (const input of serializedReport.inputs || []) {
|
|
23970
|
+
if (input.type === "map") {
|
|
23833
23971
|
continue;
|
|
23834
23972
|
}
|
|
23835
|
-
const
|
|
23836
|
-
const
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
|
|
23841
|
-
|
|
23842
|
-
|
|
23973
|
+
const dependenciesSet = new Set(input.dependencies);
|
|
23974
|
+
const dependentsSet = new Set(input.dependents);
|
|
23975
|
+
for (const dep of dependenciesSet) {
|
|
23976
|
+
if (!fileDependents.has(dep)) {
|
|
23977
|
+
fileDependents.set(dep, /* @__PURE__ */ new Set());
|
|
23978
|
+
}
|
|
23979
|
+
fileDependents.get(dep).add(input.filepath);
|
|
23980
|
+
}
|
|
23981
|
+
for (const dep of dependentsSet) {
|
|
23982
|
+
if (!fileDependencies.has(dep)) {
|
|
23983
|
+
fileDependencies.set(dep, /* @__PURE__ */ new Set());
|
|
23984
|
+
}
|
|
23985
|
+
fileDependencies.get(dep).add(input.filepath);
|
|
23986
|
+
}
|
|
23987
|
+
if (fileDependencies.has(input.filepath)) {
|
|
23988
|
+
const existingDependencies = fileDependencies.get(input.filepath);
|
|
23989
|
+
for (const dep of existingDependencies) {
|
|
23990
|
+
dependenciesSet.add(dep);
|
|
23991
|
+
}
|
|
23992
|
+
}
|
|
23993
|
+
if (fileDependents.has(input.filepath)) {
|
|
23994
|
+
const existingDependents = fileDependents.get(input.filepath);
|
|
23995
|
+
for (const dep of existingDependents) {
|
|
23996
|
+
dependentsSet.add(dep);
|
|
23997
|
+
}
|
|
23998
|
+
}
|
|
23999
|
+
fileDependencies.set(input.filepath, dependenciesSet);
|
|
24000
|
+
fileDependents.set(input.filepath, dependentsSet);
|
|
24001
|
+
inputs.set(input.filepath, {
|
|
24002
|
+
name: input.name,
|
|
24003
|
+
size: input.size,
|
|
24004
|
+
dependencies: dependenciesSet,
|
|
24005
|
+
dependents: dependentsSet
|
|
24006
|
+
});
|
|
24007
|
+
}
|
|
24008
|
+
for (const [filepath, input] of inputs) {
|
|
24009
|
+
const inputDependencies = fileDependencies.get(filepath) || /* @__PURE__ */ new Set();
|
|
24010
|
+
const inputDependents = fileDependents.get(filepath) || /* @__PURE__ */ new Set();
|
|
24011
|
+
let aggregatedSize = input.size;
|
|
24012
|
+
for (const dep of inputDependencies) {
|
|
24013
|
+
aggregatedSize += inputs.get(dep)?.size || 0;
|
|
24014
|
+
}
|
|
24015
|
+
dependencies.add({
|
|
24016
|
+
name: input.name,
|
|
24017
|
+
size: input.size,
|
|
23843
24018
|
aggregatedSize,
|
|
23844
|
-
dependents:
|
|
23845
|
-
dependencies:
|
|
24019
|
+
dependents: inputDependents,
|
|
24020
|
+
dependencies: inputDependencies
|
|
23846
24021
|
});
|
|
23847
24022
|
}
|
|
23848
|
-
if (!dependencies.
|
|
24023
|
+
if (!dependencies.size) {
|
|
23849
24024
|
return [dependentsToPrint, dependenciesToPrint, sizesToPrint];
|
|
23850
24025
|
}
|
|
23851
|
-
|
|
23852
|
-
|
|
24026
|
+
const dependenciesArray = Array.from(dependencies);
|
|
24027
|
+
dependenciesArray.sort(sortDesc((file) => file.dependents.size));
|
|
24028
|
+
dependentsToPrint.values = dependenciesArray.map((file) => ({
|
|
23853
24029
|
name: file.name,
|
|
23854
|
-
value: file.dependents.
|
|
24030
|
+
value: file.dependents.size.toString()
|
|
23855
24031
|
}));
|
|
23856
|
-
|
|
23857
|
-
dependenciesToPrint.values =
|
|
24032
|
+
dependenciesArray.sort(sortDesc((file) => file.dependencies.size));
|
|
24033
|
+
dependenciesToPrint.values = dependenciesArray.map((file) => ({
|
|
23858
24034
|
name: file.name,
|
|
23859
|
-
value: file.dependencies.
|
|
24035
|
+
value: file.dependencies.size.toString()
|
|
23860
24036
|
}));
|
|
23861
|
-
|
|
23862
|
-
sizesToPrint.values =
|
|
24037
|
+
dependenciesArray.sort(sortDesc("size"));
|
|
24038
|
+
sizesToPrint.values = dependenciesArray.map((file) => ({
|
|
23863
24039
|
name: file.name,
|
|
23864
24040
|
value: prettyBytes$1(file.size)
|
|
23865
24041
|
}));
|
|
23866
|
-
|
|
23867
|
-
aggregatedSizesToPrint.values =
|
|
24042
|
+
dependenciesArray.sort(sortDesc("aggregatedSize"));
|
|
24043
|
+
aggregatedSizesToPrint.values = dependenciesArray.map((file) => ({
|
|
23868
24044
|
name: file.name,
|
|
23869
24045
|
value: prettyBytes$1(file.aggregatedSize || file.size)
|
|
23870
24046
|
}));
|
|
@@ -23899,6 +24075,17 @@ const renderValues = (values) => {
|
|
|
23899
24075
|
let outputString = "";
|
|
23900
24076
|
const titlePadding = 4;
|
|
23901
24077
|
const valuePadding = 4;
|
|
24078
|
+
for (const group of values) {
|
|
24079
|
+
if (group.top && group.values.length >= TOP) {
|
|
24080
|
+
group.values = group.values.slice(0, TOP);
|
|
24081
|
+
group.name = `Top ${TOP} ${group.name}`;
|
|
24082
|
+
}
|
|
24083
|
+
for (const value of group.values) {
|
|
24084
|
+
if (value.name.length > MAX_VALUE_LENGTH) {
|
|
24085
|
+
value.name = `${value.name.slice(0, 10)}[...]${value.name.slice(-(MAX_VALUE_LENGTH - 15))}`;
|
|
24086
|
+
}
|
|
24087
|
+
}
|
|
24088
|
+
}
|
|
23902
24089
|
const maxTitleWidth = Math.max(...values.map((val) => val.name.length));
|
|
23903
24090
|
const maxNameWidth = Math.max(...values.flatMap((val) => val.values.map((v) => v.name.length)));
|
|
23904
24091
|
const maxValueWidth = Math.max(
|
|
@@ -23912,13 +24099,11 @@ const renderValues = (values) => {
|
|
|
23912
24099
|
if (group.values.length === 0) {
|
|
23913
24100
|
continue;
|
|
23914
24101
|
}
|
|
23915
|
-
const
|
|
23916
|
-
const titlePad = totalWidth - (title.length + titlePadding);
|
|
24102
|
+
const titlePad = totalWidth - (group.name.length + titlePadding);
|
|
23917
24103
|
outputString += `
|
|
23918
|
-
== ${
|
|
24104
|
+
== ${group.name} ${"=".repeat(titlePad)}=
|
|
23919
24105
|
`;
|
|
23920
|
-
const
|
|
23921
|
-
for (const value of valuesToPrint) {
|
|
24106
|
+
for (const value of group.values) {
|
|
23922
24107
|
const valuePad = maxValueWidth - value.value.length;
|
|
23923
24108
|
outputString += ` [${numColor(value.value)}] ${" ".repeat(valuePad)}${nameColor(value.name)}
|
|
23924
24109
|
`;
|
|
@@ -24166,6 +24351,10 @@ class Tapables {
|
|
|
24166
24351
|
this.tapables = [];
|
|
24167
24352
|
this.hooks = {};
|
|
24168
24353
|
this.timings = /* @__PURE__ */ new Map();
|
|
24354
|
+
this.ignoredHooks = [
|
|
24355
|
+
// This one triggers a DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK warning.
|
|
24356
|
+
"normalModuleLoader"
|
|
24357
|
+
];
|
|
24169
24358
|
this.cwd = cwd;
|
|
24170
24359
|
}
|
|
24171
24360
|
saveResult(type, pluginName, hookName, context, start, end) {
|
|
@@ -24212,7 +24401,7 @@ class Tapables {
|
|
|
24212
24401
|
}
|
|
24213
24402
|
getPromiseTapPatch(type, fn, pluginName, hookName) {
|
|
24214
24403
|
return (...args) => {
|
|
24215
|
-
this.
|
|
24404
|
+
this.checkNewHooks();
|
|
24216
24405
|
const startTime = perf_hooks.performance.now();
|
|
24217
24406
|
const returnValue = fn.apply(this, args);
|
|
24218
24407
|
const cb = () => {
|
|
@@ -24231,7 +24420,7 @@ class Tapables {
|
|
|
24231
24420
|
}
|
|
24232
24421
|
getAsyncTapPatch(type, fn, pluginName, hookName) {
|
|
24233
24422
|
return (...args) => {
|
|
24234
|
-
this.
|
|
24423
|
+
this.checkNewHooks();
|
|
24235
24424
|
const startTime = perf_hooks.performance.now();
|
|
24236
24425
|
const originalCB = args.pop();
|
|
24237
24426
|
const newCB = (...a) => {
|
|
@@ -24250,7 +24439,7 @@ class Tapables {
|
|
|
24250
24439
|
}
|
|
24251
24440
|
getDefaultTapPatch(type, fn, pluginName, hookName) {
|
|
24252
24441
|
return (...args) => {
|
|
24253
|
-
this.
|
|
24442
|
+
this.checkNewHooks();
|
|
24254
24443
|
const startTime = perf_hooks.performance.now();
|
|
24255
24444
|
const returnValue = fn.apply(this, args);
|
|
24256
24445
|
this.saveResult(
|
|
@@ -24309,23 +24498,32 @@ class Tapables {
|
|
|
24309
24498
|
this.hooks[tapableName].push(hookName);
|
|
24310
24499
|
this.replaceTaps(hookName, hook);
|
|
24311
24500
|
}
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
|
|
24316
|
-
|
|
24501
|
+
patchHooks(tapable) {
|
|
24502
|
+
const name = tapable.constructor.name;
|
|
24503
|
+
const hooksToPatch = Object.keys(tapable.hooks).filter((hookName) => {
|
|
24504
|
+
if (this.ignoredHooks.includes(hookName)) {
|
|
24505
|
+
return false;
|
|
24506
|
+
}
|
|
24507
|
+
if (this.hooks[name]?.includes(hookName)) {
|
|
24508
|
+
return false;
|
|
24317
24509
|
}
|
|
24510
|
+
return true;
|
|
24511
|
+
});
|
|
24512
|
+
for (const hookName of hooksToPatch) {
|
|
24513
|
+
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
24514
|
+
}
|
|
24515
|
+
}
|
|
24516
|
+
checkNewHooks() {
|
|
24517
|
+
for (const tapable of this.tapables) {
|
|
24518
|
+
this.patchHooks(tapable);
|
|
24318
24519
|
}
|
|
24319
24520
|
}
|
|
24320
24521
|
// Let's navigate through all the hooks we can find.
|
|
24321
24522
|
throughHooks(tapable) {
|
|
24322
|
-
const name = tapable.constructor.name;
|
|
24323
24523
|
if (!this.tapables.includes(tapable)) {
|
|
24324
24524
|
this.tapables.push(tapable);
|
|
24325
24525
|
}
|
|
24326
|
-
|
|
24327
|
-
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
24328
|
-
}
|
|
24526
|
+
this.patchHooks(tapable);
|
|
24329
24527
|
}
|
|
24330
24528
|
}
|
|
24331
24529
|
|
|
@@ -36055,6 +36253,10 @@ const buildPluginFactory = ({
|
|
|
36055
36253
|
...unpluginMetaContext
|
|
36056
36254
|
});
|
|
36057
36255
|
const plugins = [...internalPlugins];
|
|
36256
|
+
if (options.customPlugins) {
|
|
36257
|
+
const customPlugins = options.customPlugins(options, globalContext);
|
|
36258
|
+
plugins.push(...customPlugins);
|
|
36259
|
+
}
|
|
36058
36260
|
if (options[CONFIG_KEY$1] && options[CONFIG_KEY$1].disabled !== true) {
|
|
36059
36261
|
plugins.push(...getPlugins$2(options, globalContext));
|
|
36060
36262
|
}
|
|
@@ -36067,7 +36269,7 @@ const buildPluginFactory = ({
|
|
|
36067
36269
|
|
|
36068
36270
|
var name = "@datadog/esbuild-plugin";
|
|
36069
36271
|
var packageManager = "yarn@4.0.2";
|
|
36070
|
-
var version$1 = "2.3.0
|
|
36272
|
+
var version$1 = "2.3.0";
|
|
36071
36273
|
var license = "MIT";
|
|
36072
36274
|
var author = "Datadog";
|
|
36073
36275
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -36132,7 +36334,6 @@ var devDependencies = {
|
|
|
36132
36334
|
var peerDependencies = {
|
|
36133
36335
|
esbuild: ">=0.x"
|
|
36134
36336
|
};
|
|
36135
|
-
var stableVersion = "2.2.1";
|
|
36136
36337
|
var pkg = {
|
|
36137
36338
|
name: name,
|
|
36138
36339
|
packageManager: packageManager,
|
|
@@ -36150,8 +36351,7 @@ var pkg = {
|
|
|
36150
36351
|
files: files,
|
|
36151
36352
|
scripts: scripts,
|
|
36152
36353
|
devDependencies: devDependencies,
|
|
36153
|
-
peerDependencies: peerDependencies
|
|
36154
|
-
stableVersion: stableVersion
|
|
36354
|
+
peerDependencies: peerDependencies
|
|
36155
36355
|
};
|
|
36156
36356
|
|
|
36157
36357
|
const datadogEsbuildPlugin = buildPluginFactory({
|