@datadog/webpack-plugin 0.0.13-8 → 2.0.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 +2 -2
- package/dist/src/index.js +21 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +21 -8
- package/dist/src/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/src/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import * as querystring from 'querystring';
|
|
|
14
14
|
import process2 from 'process';
|
|
15
15
|
|
|
16
16
|
const CONFIG_KEY = "telemetry";
|
|
17
|
-
const PLUGIN_NAME =
|
|
17
|
+
const PLUGIN_NAME = `datadog-${CONFIG_KEY}-plugin`;
|
|
18
18
|
|
|
19
19
|
const filterTreeMetrics = (metric) => (
|
|
20
20
|
// Remove tree metrics because way too verbose
|
|
@@ -5989,11 +5989,22 @@ const outputModulesTimings = (timings) => {
|
|
|
5989
5989
|
output += getOutput(times, (module) => module.increment);
|
|
5990
5990
|
return output;
|
|
5991
5991
|
};
|
|
5992
|
+
const shouldShowOutput = (output) => {
|
|
5993
|
+
if (typeof output === "boolean") {
|
|
5994
|
+
return output;
|
|
5995
|
+
}
|
|
5996
|
+
if (typeof output === "string") {
|
|
5997
|
+
return true;
|
|
5998
|
+
}
|
|
5999
|
+
if (!output) {
|
|
6000
|
+
return true;
|
|
6001
|
+
}
|
|
6002
|
+
return output.logs !== false;
|
|
6003
|
+
};
|
|
5992
6004
|
const outputTexts = (context, options) => {
|
|
5993
6005
|
const { output } = options[CONFIG_KEY];
|
|
5994
6006
|
const { report, bundler } = context;
|
|
5995
|
-
|
|
5996
|
-
if (output === false) {
|
|
6007
|
+
if (!shouldShowOutput(output)) {
|
|
5997
6008
|
return;
|
|
5998
6009
|
}
|
|
5999
6010
|
let outputString = "";
|
|
@@ -6009,7 +6020,7 @@ const outputTexts = (context, options) => {
|
|
|
6009
6020
|
if (bundler.esbuild) {
|
|
6010
6021
|
outputString += outputEsbuild(bundler.esbuild);
|
|
6011
6022
|
}
|
|
6012
|
-
log(outputString);
|
|
6023
|
+
console.log(outputString);
|
|
6013
6024
|
};
|
|
6014
6025
|
|
|
6015
6026
|
const output = async (context, options) => {
|
|
@@ -6080,10 +6091,13 @@ const wrapPlugins = (build, context) => {
|
|
|
6080
6091
|
};
|
|
6081
6092
|
});
|
|
6082
6093
|
for (const plugin of plugins) {
|
|
6083
|
-
|
|
6094
|
+
if (plugin.name === PLUGIN_NAME) {
|
|
6095
|
+
continue;
|
|
6096
|
+
}
|
|
6084
6097
|
const oldSetup = plugin.setup;
|
|
6085
|
-
plugin.setup = () => {
|
|
6086
|
-
|
|
6098
|
+
plugin.setup = async (esbuild) => {
|
|
6099
|
+
const newBuildObject = getNewBuildObject(esbuild, plugin.name, context);
|
|
6100
|
+
await oldSetup({
|
|
6087
6101
|
...newBuildObject,
|
|
6088
6102
|
// Use non-modified plugins for other plugins
|
|
6089
6103
|
initialOptions: { ...newBuildObject.initialOptions, plugins: initialPlugins }
|
|
@@ -6549,7 +6563,6 @@ const getPlugins = (opt) => {
|
|
|
6549
6563
|
return [
|
|
6550
6564
|
{
|
|
6551
6565
|
name: PLUGIN_NAME,
|
|
6552
|
-
enforce: "pre",
|
|
6553
6566
|
esbuild: getEsbuildPlugin$1(opt),
|
|
6554
6567
|
webpack: getWebpackPlugin$1(opt)
|
|
6555
6568
|
}
|