@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.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
+
import * as src from 'src';
|
|
2
3
|
|
|
3
4
|
type LogLevel = 'debug' | 'warn' | 'error' | 'none';
|
|
4
5
|
interface GetPluginsOptions {
|
|
@@ -43,7 +44,7 @@ declare const helpers: {
|
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
declare const datadogEsbuildPlugin: (options:
|
|
47
|
+
declare const datadogEsbuildPlugin: (options: src.EsbuildPluginOptions) => esbuild.Plugin;
|
|
47
48
|
|
|
48
49
|
export { type Options as EsbuildPluginOptions, datadogEsbuildPlugin, helpers };
|
|
49
50
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.js
CHANGED
|
@@ -5876,37 +5876,37 @@ const sortDesc = (attr) => (a, b) => {
|
|
|
5876
5876
|
}
|
|
5877
5877
|
};
|
|
5878
5878
|
const getOutput = (values, renderValue) => {
|
|
5879
|
-
let
|
|
5879
|
+
let output = "";
|
|
5880
5880
|
for (const val of values.slice(0, TOP)) {
|
|
5881
|
-
|
|
5881
|
+
output += `[${numColor(renderValue(val))}] ${nameColor(val.name)}
|
|
5882
5882
|
`;
|
|
5883
5883
|
}
|
|
5884
|
-
return
|
|
5884
|
+
return output;
|
|
5885
5885
|
};
|
|
5886
5886
|
const outputTapables = (timings) => {
|
|
5887
|
-
let
|
|
5887
|
+
let output = "";
|
|
5888
5888
|
if (!timings) {
|
|
5889
|
-
return
|
|
5889
|
+
return output;
|
|
5890
5890
|
}
|
|
5891
5891
|
const times = Array.from(timings.values());
|
|
5892
5892
|
if (!times.length) {
|
|
5893
|
-
return
|
|
5893
|
+
return output;
|
|
5894
5894
|
}
|
|
5895
|
-
|
|
5896
|
-
|
|
5895
|
+
output += "\n===== Tapables =====\n";
|
|
5896
|
+
output += `
|
|
5897
5897
|
=== Top ${TOP} duration ===
|
|
5898
5898
|
`;
|
|
5899
5899
|
times.sort(sortDesc("duration"));
|
|
5900
|
-
|
|
5901
|
-
|
|
5900
|
+
output += getOutput(times, (time) => formatDuration(time.duration));
|
|
5901
|
+
output += `
|
|
5902
5902
|
=== Top ${TOP} hits ===
|
|
5903
5903
|
`;
|
|
5904
5904
|
times.sort(sortDesc("increment"));
|
|
5905
|
-
|
|
5906
|
-
return
|
|
5905
|
+
output += getOutput(times, (plugin) => plugin.increment);
|
|
5906
|
+
return output;
|
|
5907
5907
|
};
|
|
5908
5908
|
const outputWebpack = (stats) => {
|
|
5909
|
-
let
|
|
5909
|
+
let output = "\n===== General =====\n";
|
|
5910
5910
|
const duration = stats.endTime - stats.startTime;
|
|
5911
5911
|
const nbDeps = stats.compilation.fileDependencies.size;
|
|
5912
5912
|
const nbFiles = stats.compilation.assets ? Object.keys(stats.compilation.assets).length : stats.compilation.emittedAssets.size;
|
|
@@ -5914,7 +5914,7 @@ const outputWebpack = (stats) => {
|
|
|
5914
5914
|
const nbModules = "size" in stats.compilation.modules ? stats.compilation.modules.size : stats.compilation.modules.length;
|
|
5915
5915
|
const nbChunks = "size" in stats.compilation.chunks ? stats.compilation.chunks.size : stats.compilation.chunks.length;
|
|
5916
5916
|
const nbEntries = "size" in stats.compilation.entries ? stats.compilation.entries.size : stats.compilation.entries.length;
|
|
5917
|
-
|
|
5917
|
+
output += `duration: ${chalk.bold(formatDuration(duration))}
|
|
5918
5918
|
nbDeps: ${chalk.bold(nbDeps.toString())}
|
|
5919
5919
|
nbFiles: ${chalk.bold(nbFiles.toString())}
|
|
5920
5920
|
nbWarnings: ${chalk.bold(nbWarnings.toString())}
|
|
@@ -5922,94 +5922,94 @@ nbModules: ${chalk.bold(nbModules.toString())}
|
|
|
5922
5922
|
nbChunks: ${chalk.bold(nbChunks.toString())}
|
|
5923
5923
|
nbEntries: ${chalk.bold(nbEntries.toString())}
|
|
5924
5924
|
`;
|
|
5925
|
-
return
|
|
5925
|
+
return output;
|
|
5926
5926
|
};
|
|
5927
5927
|
const outputEsbuild = (stats) => {
|
|
5928
|
-
let
|
|
5928
|
+
let output = "\n===== General =====\n";
|
|
5929
5929
|
const nbDeps = stats.inputs ? Object.keys(stats.inputs).length : 0;
|
|
5930
5930
|
const nbFiles = stats.outputs ? Object.keys(stats.outputs).length : 0;
|
|
5931
5931
|
const nbWarnings = stats.warnings.length;
|
|
5932
5932
|
const nbErrors = stats.errors.length;
|
|
5933
5933
|
const nbEntries = stats.entrypoints ? Object.keys(stats.entrypoints).length : 0;
|
|
5934
|
-
|
|
5934
|
+
output += `
|
|
5935
5935
|
nbDeps: ${chalk.bold(nbDeps.toString())}
|
|
5936
5936
|
nbFiles: ${chalk.bold(nbFiles.toString())}
|
|
5937
5937
|
nbWarnings: ${chalk.bold(nbWarnings.toString())}
|
|
5938
5938
|
nbErrors: ${chalk.bold(nbErrors.toString())}
|
|
5939
5939
|
nbEntries: ${chalk.bold(nbEntries.toString())}
|
|
5940
5940
|
`;
|
|
5941
|
-
return
|
|
5941
|
+
return output;
|
|
5942
5942
|
};
|
|
5943
5943
|
const outputLoaders = (timings) => {
|
|
5944
|
-
let
|
|
5944
|
+
let output = "";
|
|
5945
5945
|
if (!timings) {
|
|
5946
|
-
return
|
|
5946
|
+
return output;
|
|
5947
5947
|
}
|
|
5948
5948
|
const times = Array.from(timings.values());
|
|
5949
5949
|
if (!times.length) {
|
|
5950
|
-
return
|
|
5950
|
+
return output;
|
|
5951
5951
|
}
|
|
5952
|
-
|
|
5953
|
-
|
|
5952
|
+
output += "\n===== Loaders =====\n";
|
|
5953
|
+
output += `
|
|
5954
5954
|
=== Top ${TOP} duration ===
|
|
5955
5955
|
`;
|
|
5956
5956
|
times.sort(sortDesc("duration"));
|
|
5957
|
-
|
|
5958
|
-
|
|
5957
|
+
output += getOutput(times, (loader) => formatDuration(loader.duration));
|
|
5958
|
+
output += `
|
|
5959
5959
|
=== Top ${TOP} hits ===
|
|
5960
5960
|
`;
|
|
5961
5961
|
times.sort(sortDesc("increment"));
|
|
5962
|
-
|
|
5963
|
-
return
|
|
5962
|
+
output += getOutput(times, (loader) => loader.increment);
|
|
5963
|
+
return output;
|
|
5964
5964
|
};
|
|
5965
5965
|
const outputModulesDependencies = (deps) => {
|
|
5966
|
-
let
|
|
5966
|
+
let output = "";
|
|
5967
5967
|
if (!deps) {
|
|
5968
|
-
return
|
|
5968
|
+
return output;
|
|
5969
5969
|
}
|
|
5970
5970
|
const dependencies = Object.values(deps);
|
|
5971
5971
|
if (!dependencies.length) {
|
|
5972
|
-
return
|
|
5972
|
+
return output;
|
|
5973
5973
|
}
|
|
5974
|
-
|
|
5974
|
+
output += "\n===== Modules =====\n";
|
|
5975
5975
|
dependencies.sort(sortDesc((mod) => mod.dependents.length));
|
|
5976
|
-
|
|
5976
|
+
output += `
|
|
5977
5977
|
=== Top ${TOP} dependents ===
|
|
5978
5978
|
`;
|
|
5979
|
-
|
|
5979
|
+
output += getOutput(dependencies, (module) => module.dependents.length);
|
|
5980
5980
|
dependencies.sort(sortDesc((mod) => mod.dependencies.length));
|
|
5981
|
-
|
|
5981
|
+
output += `
|
|
5982
5982
|
=== Top ${TOP} dependencies ===
|
|
5983
5983
|
`;
|
|
5984
|
-
|
|
5984
|
+
output += getOutput(dependencies, (module) => module.dependencies.length);
|
|
5985
5985
|
dependencies.sort(sortDesc("size"));
|
|
5986
|
-
|
|
5986
|
+
output += `
|
|
5987
5987
|
=== Top ${TOP} size ===
|
|
5988
5988
|
`;
|
|
5989
|
-
|
|
5990
|
-
return
|
|
5989
|
+
output += getOutput(dependencies, (module) => prettyBytes$1(module.size));
|
|
5990
|
+
return output;
|
|
5991
5991
|
};
|
|
5992
5992
|
const outputModulesTimings = (timings) => {
|
|
5993
|
-
let
|
|
5993
|
+
let output = "";
|
|
5994
5994
|
if (!timings) {
|
|
5995
|
-
return
|
|
5995
|
+
return output;
|
|
5996
5996
|
}
|
|
5997
5997
|
const times = Array.from(timings.values());
|
|
5998
5998
|
if (!times.length) {
|
|
5999
|
-
return
|
|
5999
|
+
return output;
|
|
6000
6000
|
}
|
|
6001
|
-
|
|
6001
|
+
output += "\n===== Modules =====\n";
|
|
6002
6002
|
times.sort(sortDesc("duration"));
|
|
6003
|
-
|
|
6003
|
+
output += `
|
|
6004
6004
|
=== Top ${TOP} duration ===
|
|
6005
6005
|
`;
|
|
6006
|
-
|
|
6006
|
+
output += getOutput(times, (module) => formatDuration(module.duration));
|
|
6007
6007
|
times.sort(sortDesc("increment"));
|
|
6008
|
-
|
|
6008
|
+
output += `
|
|
6009
6009
|
=== Top ${TOP} hits ===
|
|
6010
6010
|
`;
|
|
6011
|
-
|
|
6012
|
-
return
|
|
6011
|
+
output += getOutput(times, (module) => module.increment);
|
|
6012
|
+
return output;
|
|
6013
6013
|
};
|
|
6014
6014
|
const outputTexts = (context, options) => {
|
|
6015
6015
|
const { output } = options[CONFIG_KEY];
|
|
@@ -6018,20 +6018,20 @@ const outputTexts = (context, options) => {
|
|
|
6018
6018
|
if (output === false) {
|
|
6019
6019
|
return;
|
|
6020
6020
|
}
|
|
6021
|
-
let
|
|
6021
|
+
let outputString = "";
|
|
6022
6022
|
if (report) {
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6023
|
+
outputString += outputTapables(report.timings.tapables);
|
|
6024
|
+
outputString += outputLoaders(report.timings.loaders);
|
|
6025
|
+
outputString += outputModulesDependencies(report.dependencies);
|
|
6026
|
+
outputString += outputModulesTimings(report.timings.modules);
|
|
6027
6027
|
}
|
|
6028
6028
|
if (bundler.webpack) {
|
|
6029
|
-
|
|
6029
|
+
outputString += outputWebpack(bundler.webpack);
|
|
6030
6030
|
}
|
|
6031
6031
|
if (bundler.esbuild) {
|
|
6032
|
-
|
|
6032
|
+
outputString += outputEsbuild(bundler.esbuild);
|
|
6033
6033
|
}
|
|
6034
|
-
log(
|
|
6034
|
+
log(outputString);
|
|
6035
6035
|
};
|
|
6036
6036
|
|
|
6037
6037
|
const output = async (context, options) => {
|