@datadog/esbuild-plugin 0.0.13-5 → 0.0.13-6
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 +2 -1
- package/dist/src/index.js +55 -55
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +55 -55
- package/dist/src/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/src/index.mjs
CHANGED
|
@@ -5854,37 +5854,37 @@ const sortDesc = (attr) => (a, b) => {
|
|
|
5854
5854
|
}
|
|
5855
5855
|
};
|
|
5856
5856
|
const getOutput = (values, renderValue) => {
|
|
5857
|
-
let
|
|
5857
|
+
let output = "";
|
|
5858
5858
|
for (const val of values.slice(0, TOP)) {
|
|
5859
|
-
|
|
5859
|
+
output += `[${numColor(renderValue(val))}] ${nameColor(val.name)}
|
|
5860
5860
|
`;
|
|
5861
5861
|
}
|
|
5862
|
-
return
|
|
5862
|
+
return output;
|
|
5863
5863
|
};
|
|
5864
5864
|
const outputTapables = (timings) => {
|
|
5865
|
-
let
|
|
5865
|
+
let output = "";
|
|
5866
5866
|
if (!timings) {
|
|
5867
|
-
return
|
|
5867
|
+
return output;
|
|
5868
5868
|
}
|
|
5869
5869
|
const times = Array.from(timings.values());
|
|
5870
5870
|
if (!times.length) {
|
|
5871
|
-
return
|
|
5871
|
+
return output;
|
|
5872
5872
|
}
|
|
5873
|
-
|
|
5874
|
-
|
|
5873
|
+
output += "\n===== Tapables =====\n";
|
|
5874
|
+
output += `
|
|
5875
5875
|
=== Top ${TOP} duration ===
|
|
5876
5876
|
`;
|
|
5877
5877
|
times.sort(sortDesc("duration"));
|
|
5878
|
-
|
|
5879
|
-
|
|
5878
|
+
output += getOutput(times, (time) => formatDuration(time.duration));
|
|
5879
|
+
output += `
|
|
5880
5880
|
=== Top ${TOP} hits ===
|
|
5881
5881
|
`;
|
|
5882
5882
|
times.sort(sortDesc("increment"));
|
|
5883
|
-
|
|
5884
|
-
return
|
|
5883
|
+
output += getOutput(times, (plugin) => plugin.increment);
|
|
5884
|
+
return output;
|
|
5885
5885
|
};
|
|
5886
5886
|
const outputWebpack = (stats) => {
|
|
5887
|
-
let
|
|
5887
|
+
let output = "\n===== General =====\n";
|
|
5888
5888
|
const duration = stats.endTime - stats.startTime;
|
|
5889
5889
|
const nbDeps = stats.compilation.fileDependencies.size;
|
|
5890
5890
|
const nbFiles = stats.compilation.assets ? Object.keys(stats.compilation.assets).length : stats.compilation.emittedAssets.size;
|
|
@@ -5892,7 +5892,7 @@ const outputWebpack = (stats) => {
|
|
|
5892
5892
|
const nbModules = "size" in stats.compilation.modules ? stats.compilation.modules.size : stats.compilation.modules.length;
|
|
5893
5893
|
const nbChunks = "size" in stats.compilation.chunks ? stats.compilation.chunks.size : stats.compilation.chunks.length;
|
|
5894
5894
|
const nbEntries = "size" in stats.compilation.entries ? stats.compilation.entries.size : stats.compilation.entries.length;
|
|
5895
|
-
|
|
5895
|
+
output += `duration: ${chalk.bold(formatDuration(duration))}
|
|
5896
5896
|
nbDeps: ${chalk.bold(nbDeps.toString())}
|
|
5897
5897
|
nbFiles: ${chalk.bold(nbFiles.toString())}
|
|
5898
5898
|
nbWarnings: ${chalk.bold(nbWarnings.toString())}
|
|
@@ -5900,94 +5900,94 @@ nbModules: ${chalk.bold(nbModules.toString())}
|
|
|
5900
5900
|
nbChunks: ${chalk.bold(nbChunks.toString())}
|
|
5901
5901
|
nbEntries: ${chalk.bold(nbEntries.toString())}
|
|
5902
5902
|
`;
|
|
5903
|
-
return
|
|
5903
|
+
return output;
|
|
5904
5904
|
};
|
|
5905
5905
|
const outputEsbuild = (stats) => {
|
|
5906
|
-
let
|
|
5906
|
+
let output = "\n===== General =====\n";
|
|
5907
5907
|
const nbDeps = stats.inputs ? Object.keys(stats.inputs).length : 0;
|
|
5908
5908
|
const nbFiles = stats.outputs ? Object.keys(stats.outputs).length : 0;
|
|
5909
5909
|
const nbWarnings = stats.warnings.length;
|
|
5910
5910
|
const nbErrors = stats.errors.length;
|
|
5911
5911
|
const nbEntries = stats.entrypoints ? Object.keys(stats.entrypoints).length : 0;
|
|
5912
|
-
|
|
5912
|
+
output += `
|
|
5913
5913
|
nbDeps: ${chalk.bold(nbDeps.toString())}
|
|
5914
5914
|
nbFiles: ${chalk.bold(nbFiles.toString())}
|
|
5915
5915
|
nbWarnings: ${chalk.bold(nbWarnings.toString())}
|
|
5916
5916
|
nbErrors: ${chalk.bold(nbErrors.toString())}
|
|
5917
5917
|
nbEntries: ${chalk.bold(nbEntries.toString())}
|
|
5918
5918
|
`;
|
|
5919
|
-
return
|
|
5919
|
+
return output;
|
|
5920
5920
|
};
|
|
5921
5921
|
const outputLoaders = (timings) => {
|
|
5922
|
-
let
|
|
5922
|
+
let output = "";
|
|
5923
5923
|
if (!timings) {
|
|
5924
|
-
return
|
|
5924
|
+
return output;
|
|
5925
5925
|
}
|
|
5926
5926
|
const times = Array.from(timings.values());
|
|
5927
5927
|
if (!times.length) {
|
|
5928
|
-
return
|
|
5928
|
+
return output;
|
|
5929
5929
|
}
|
|
5930
|
-
|
|
5931
|
-
|
|
5930
|
+
output += "\n===== Loaders =====\n";
|
|
5931
|
+
output += `
|
|
5932
5932
|
=== Top ${TOP} duration ===
|
|
5933
5933
|
`;
|
|
5934
5934
|
times.sort(sortDesc("duration"));
|
|
5935
|
-
|
|
5936
|
-
|
|
5935
|
+
output += getOutput(times, (loader) => formatDuration(loader.duration));
|
|
5936
|
+
output += `
|
|
5937
5937
|
=== Top ${TOP} hits ===
|
|
5938
5938
|
`;
|
|
5939
5939
|
times.sort(sortDesc("increment"));
|
|
5940
|
-
|
|
5941
|
-
return
|
|
5940
|
+
output += getOutput(times, (loader) => loader.increment);
|
|
5941
|
+
return output;
|
|
5942
5942
|
};
|
|
5943
5943
|
const outputModulesDependencies = (deps) => {
|
|
5944
|
-
let
|
|
5944
|
+
let output = "";
|
|
5945
5945
|
if (!deps) {
|
|
5946
|
-
return
|
|
5946
|
+
return output;
|
|
5947
5947
|
}
|
|
5948
5948
|
const dependencies = Object.values(deps);
|
|
5949
5949
|
if (!dependencies.length) {
|
|
5950
|
-
return
|
|
5950
|
+
return output;
|
|
5951
5951
|
}
|
|
5952
|
-
|
|
5952
|
+
output += "\n===== Modules =====\n";
|
|
5953
5953
|
dependencies.sort(sortDesc((mod) => mod.dependents.length));
|
|
5954
|
-
|
|
5954
|
+
output += `
|
|
5955
5955
|
=== Top ${TOP} dependents ===
|
|
5956
5956
|
`;
|
|
5957
|
-
|
|
5957
|
+
output += getOutput(dependencies, (module) => module.dependents.length);
|
|
5958
5958
|
dependencies.sort(sortDesc((mod) => mod.dependencies.length));
|
|
5959
|
-
|
|
5959
|
+
output += `
|
|
5960
5960
|
=== Top ${TOP} dependencies ===
|
|
5961
5961
|
`;
|
|
5962
|
-
|
|
5962
|
+
output += getOutput(dependencies, (module) => module.dependencies.length);
|
|
5963
5963
|
dependencies.sort(sortDesc("size"));
|
|
5964
|
-
|
|
5964
|
+
output += `
|
|
5965
5965
|
=== Top ${TOP} size ===
|
|
5966
5966
|
`;
|
|
5967
|
-
|
|
5968
|
-
return
|
|
5967
|
+
output += getOutput(dependencies, (module) => prettyBytes$1(module.size));
|
|
5968
|
+
return output;
|
|
5969
5969
|
};
|
|
5970
5970
|
const outputModulesTimings = (timings) => {
|
|
5971
|
-
let
|
|
5971
|
+
let output = "";
|
|
5972
5972
|
if (!timings) {
|
|
5973
|
-
return
|
|
5973
|
+
return output;
|
|
5974
5974
|
}
|
|
5975
5975
|
const times = Array.from(timings.values());
|
|
5976
5976
|
if (!times.length) {
|
|
5977
|
-
return
|
|
5977
|
+
return output;
|
|
5978
5978
|
}
|
|
5979
|
-
|
|
5979
|
+
output += "\n===== Modules =====\n";
|
|
5980
5980
|
times.sort(sortDesc("duration"));
|
|
5981
|
-
|
|
5981
|
+
output += `
|
|
5982
5982
|
=== Top ${TOP} duration ===
|
|
5983
5983
|
`;
|
|
5984
|
-
|
|
5984
|
+
output += getOutput(times, (module) => formatDuration(module.duration));
|
|
5985
5985
|
times.sort(sortDesc("increment"));
|
|
5986
|
-
|
|
5986
|
+
output += `
|
|
5987
5987
|
=== Top ${TOP} hits ===
|
|
5988
5988
|
`;
|
|
5989
|
-
|
|
5990
|
-
return
|
|
5989
|
+
output += getOutput(times, (module) => module.increment);
|
|
5990
|
+
return output;
|
|
5991
5991
|
};
|
|
5992
5992
|
const outputTexts = (context, options) => {
|
|
5993
5993
|
const { output } = options[CONFIG_KEY];
|
|
@@ -5996,20 +5996,20 @@ const outputTexts = (context, options) => {
|
|
|
5996
5996
|
if (output === false) {
|
|
5997
5997
|
return;
|
|
5998
5998
|
}
|
|
5999
|
-
let
|
|
5999
|
+
let outputString = "";
|
|
6000
6000
|
if (report) {
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6001
|
+
outputString += outputTapables(report.timings.tapables);
|
|
6002
|
+
outputString += outputLoaders(report.timings.loaders);
|
|
6003
|
+
outputString += outputModulesDependencies(report.dependencies);
|
|
6004
|
+
outputString += outputModulesTimings(report.timings.modules);
|
|
6005
6005
|
}
|
|
6006
6006
|
if (bundler.webpack) {
|
|
6007
|
-
|
|
6007
|
+
outputString += outputWebpack(bundler.webpack);
|
|
6008
6008
|
}
|
|
6009
6009
|
if (bundler.esbuild) {
|
|
6010
|
-
|
|
6010
|
+
outputString += outputEsbuild(bundler.esbuild);
|
|
6011
6011
|
}
|
|
6012
|
-
log(
|
|
6012
|
+
log(outputString);
|
|
6013
6013
|
};
|
|
6014
6014
|
|
|
6015
6015
|
const output = async (context, options) => {
|