@datadog/webpack-plugin 0.0.13-4 → 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/README.md CHANGED
@@ -1 +1,40 @@
1
- # webpack
1
+ # Datadog Webpack Plugin
2
+
3
+ A Wepack plugin to interact with Datadog from your Webpack builds.
4
+
5
+ ## Installation
6
+
7
+ - Yarn
8
+
9
+ ```bash
10
+ yarn add -D @datadog/webpack-plugin
11
+ ```
12
+
13
+ - NPM
14
+
15
+ ```bash
16
+ npm install --save-dev @datadog/webpack-plugin
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Inside your `webpack.config.js`.
22
+
23
+ ```js
24
+ const { datadogWebpackPlugin } = require('@datadog/webpack-plugin');
25
+
26
+ module.exports = {
27
+ plugins: [
28
+ datadogWebpackPlugin({
29
+ // Configuration
30
+ }),
31
+ ],
32
+ };
33
+ ```
34
+
35
+ > [!TIP]
36
+ > It is important to have the plugin in the first position in order to report every other plugins.
37
+
38
+ ## Configuration
39
+
40
+ Check the main [README](../../README.md#configuration) for the common configuration options.
@@ -1,28 +1,24 @@
1
1
  import * as webpack from 'webpack';
2
+ import * as src from 'src';
2
3
 
4
+ type LogLevel = 'debug' | 'warn' | 'error' | 'none';
3
5
  interface GetPluginsOptions {
4
- auth: {
5
- apiKey: string;
6
+ auth?: {
7
+ apiKey?: string;
8
+ endPoint?: string;
6
9
  };
10
+ logLevel?: LogLevel;
7
11
  }
12
+
13
+ declare const CONFIG_KEY: "telemetry";
14
+
8
15
  interface Metric {
9
16
  metric: string;
10
17
  type: 'count' | 'size' | 'duration';
11
18
  value: number;
12
19
  tags: string[];
13
20
  }
14
-
15
- declare const CONFIG_KEY: "telemetry";
16
-
17
21
  type Filter = (metric: Metric) => Metric | null;
18
- interface DatadogOptions {
19
- apiKey?: string;
20
- endPoint?: string;
21
- prefix?: string;
22
- tags?: string[];
23
- timestamp?: number;
24
- filters?: Filter[];
25
- }
26
22
  type OutputOptions = boolean | string | {
27
23
  destination: string;
28
24
  timings?: boolean;
@@ -33,15 +29,22 @@ type OutputOptions = boolean | string | {
33
29
  type TelemetryOptions = {
34
30
  disabled?: boolean;
35
31
  output?: OutputOptions;
36
- hooks?: string[];
37
- datadog?: DatadogOptions;
32
+ prefix?: string;
33
+ tags?: string[];
34
+ timestamp?: number;
35
+ filters?: Filter[];
38
36
  };
39
37
 
40
38
  interface Options extends GetPluginsOptions {
41
39
  [CONFIG_KEY]?: TelemetryOptions;
42
40
  }
41
+ declare const helpers: {
42
+ telemetry: {
43
+ filters: ((metric: Metric) => Metric | null)[];
44
+ };
45
+ };
43
46
 
44
- declare const datadogWebpackPlugin: (options: Options) => webpack.WebpackPluginInstance;
47
+ declare const datadogWebpackPlugin: (options: src.WebpackPluginOptions) => webpack.WebpackPluginInstance;
45
48
 
46
- export { type Options as WebpackPluginOptions, datadogWebpackPlugin };
49
+ export { type Options as WebpackPluginOptions, datadogWebpackPlugin, helpers };
47
50
  //# sourceMappingURL=index.d.ts.map