@datadog/esbuild-plugin 2.3.1-dev-3 → 2.3.1-dev-4

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.
@@ -18,7 +18,6 @@ import require$$0$3, { Readable } from 'stream';
18
18
  import { createGzip } from 'zlib';
19
19
  import require$$0$2 from 'constants';
20
20
  import require$$5 from 'assert';
21
- import { request } from 'https';
22
21
  import { performance as performance$1 } from 'perf_hooks';
23
22
  import * as querystring from 'querystring';
24
23
  import process2 from 'process';
@@ -19145,7 +19144,7 @@ const getInjectionPlugins = (opts, context, toInject) => {
19145
19144
  // Resolve the injected file.
19146
19145
  {
19147
19146
  name: RESOLUTION_PLUGIN_NAME,
19148
- enforce: "post",
19147
+ enforce: "pre",
19149
19148
  resolveId(id) {
19150
19149
  if (isInjectedFile(id)) {
19151
19150
  return { id, moduleSideEffects: true };
@@ -24340,30 +24339,10 @@ const sendMetrics = (metrics, auth, log) => {
24340
24339
  Sending ${metrics.length} metrics.
24341
24340
  Metrics:
24342
24341
  - ${metricsNames.join("\n - ")}`);
24343
- return new Promise((resolve, reject) => {
24344
- const req = request({
24345
- method: "POST",
24346
- hostname: auth.endPoint,
24347
- path: `/api/v1/series?api_key=${auth.apiKey}`
24348
- });
24349
- req.write(
24350
- JSON.stringify({
24351
- series: metrics
24352
- })
24353
- );
24354
- req.on("response", (res) => {
24355
- if (!(res.statusCode >= 200 && res.statusCode < 300)) {
24356
- res.resume();
24357
- reject(`Request Failed.
24358
- Status Code: ${res.statusCode}`);
24359
- return;
24360
- }
24361
- res.on("data", () => {
24362
- });
24363
- res.on("end", resolve);
24364
- });
24365
- req.on("error", reject);
24366
- req.end();
24342
+ return doRequest({
24343
+ method: "POST",
24344
+ url: `${auth.endPoint}/api/v1/series?api_key=${auth.apiKey}`,
24345
+ getData: () => ({ data: JSON.stringify({ series: metrics }) })
24367
24346
  }).then(() => {
24368
24347
  log(`Sent metrics in ${formatDuration(Date.now() - startSending)}.`);
24369
24348
  }).catch((e) => {
@@ -36469,7 +36448,7 @@ const buildPluginFactory = ({
36469
36448
 
36470
36449
  var name = "@datadog/esbuild-plugin";
36471
36450
  var packageManager = "yarn@4.0.2";
36472
- var version$1 = "2.3.1-dev-3";
36451
+ var version$1 = "2.3.1-dev-4";
36473
36452
  var license = "MIT";
36474
36453
  var author = "Datadog";
36475
36454
  var description = "Datadog ESBuild Plugin";