@datadog/webpack-plugin 0.0.5-dev → 0.0.7-dev

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.js CHANGED
@@ -1,17 +1,41 @@
1
- import fs$j from 'fs';
2
- import require$$0 from 'constants';
3
- import require$$0$1 from 'stream';
4
- import require$$4 from 'util';
5
- import require$$5 from 'assert';
6
- import require$$1, { resolve as resolve$1, extname, isAbsolute, normalize } from 'path';
7
- import require$$1$1 from 'os';
8
- import { request } from 'https';
9
- import { performance } from 'perf_hooks';
10
- import webpack from 'webpack';
11
- import { fileURLToPath } from 'url';
12
- import { Buffer as Buffer$1 } from 'buffer';
13
- import * as querystring from 'querystring';
14
- import process2 from 'process';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var fs$j = require('fs');
6
+ var require$$0 = require('constants');
7
+ var require$$0$1 = require('stream');
8
+ var require$$4 = require('util');
9
+ var require$$5 = require('assert');
10
+ var require$$1 = require('path');
11
+ var require$$1$1 = require('os');
12
+ var https = require('https');
13
+ var perf_hooks = require('perf_hooks');
14
+ var webpack = require('webpack');
15
+ var url = require('url');
16
+ var buffer$2 = require('buffer');
17
+ var querystring = require('querystring');
18
+ var process2 = require('process');
19
+
20
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
21
+ function _interopNamespaceDefault(e) {
22
+ var n = Object.create(null);
23
+ if (e) {
24
+ Object.keys(e).forEach(function (k) {
25
+ if (k !== 'default') {
26
+ var d = Object.getOwnPropertyDescriptor(e, k);
27
+ Object.defineProperty(n, k, d.get ? d : {
28
+ enumerable: true,
29
+ get: function () { return e[k]; }
30
+ });
31
+ }
32
+ });
33
+ }
34
+ n.default = e;
35
+ return Object.freeze(n);
36
+ }
37
+
38
+ var querystring__namespace = /*#__PURE__*/_interopNamespaceDefault(querystring);
15
39
 
16
40
  const CONFIG_KEY = "telemetry";
17
41
  const PLUGIN_NAME = `${CONFIG_KEY}-plugin`;
@@ -5623,7 +5647,7 @@ Sending ${metrics.length} metrics.
5623
5647
  Metrics:
5624
5648
  - ${metricsNames.join("\n - ")}`);
5625
5649
  return new Promise((resolve, reject) => {
5626
- const req = request({
5650
+ const req = https.request({
5627
5651
  method: "POST",
5628
5652
  hostname: opts.endPoint,
5629
5653
  path: `/api/v1/series?api_key=${opts.apiKey}`
@@ -6072,11 +6096,11 @@ const getNewBuildObject = (build, pluginName, context) => {
6072
6096
  name: fn,
6073
6097
  values: []
6074
6098
  };
6075
- const start = performance.now();
6099
+ const start = perf_hooks.performance.now();
6076
6100
  try {
6077
6101
  return await cb(...args);
6078
6102
  } finally {
6079
- const end = performance.now();
6103
+ const end = perf_hooks.performance.now();
6080
6104
  const duration = end - start;
6081
6105
  const statsObject = {
6082
6106
  start,
@@ -6151,7 +6175,7 @@ class Loaders {
6151
6175
  this.started[moduleName] = {
6152
6176
  module: getDisplayName(moduleName),
6153
6177
  timings: {
6154
- start: performance.now(),
6178
+ start: perf_hooks.performance.now(),
6155
6179
  duration: 0,
6156
6180
  end: 0
6157
6181
  },
@@ -6164,7 +6188,7 @@ class Loaders {
6164
6188
  if (!event) {
6165
6189
  return;
6166
6190
  }
6167
- event.timings.end = performance.now();
6191
+ event.timings.end = perf_hooks.performance.now();
6168
6192
  event.timings.duration = event.timings.end - event.timings.start;
6169
6193
  this.finished.push(event);
6170
6194
  delete this.started[moduleName];
@@ -6333,7 +6357,7 @@ class Tapables {
6333
6357
  getPromiseTapPatch(type, fn, pluginName, hookName) {
6334
6358
  return (...args) => {
6335
6359
  this.checkHooks();
6336
- const startTime = performance.now();
6360
+ const startTime = perf_hooks.performance.now();
6337
6361
  const returnValue = fn.apply(this, args);
6338
6362
  const cb = () => {
6339
6363
  this.saveResult(
@@ -6342,7 +6366,7 @@ class Tapables {
6342
6366
  hookName,
6343
6367
  getContext(args),
6344
6368
  startTime,
6345
- performance.now()
6369
+ perf_hooks.performance.now()
6346
6370
  );
6347
6371
  };
6348
6372
  returnValue.then(cb, cb);
@@ -6352,7 +6376,7 @@ class Tapables {
6352
6376
  getAsyncTapPatch(type, fn, pluginName, hookName) {
6353
6377
  return (...args) => {
6354
6378
  this.checkHooks();
6355
- const startTime = performance.now();
6379
+ const startTime = perf_hooks.performance.now();
6356
6380
  const originalCB = args.pop();
6357
6381
  const newCB = (...a) => {
6358
6382
  this.saveResult(
@@ -6361,7 +6385,7 @@ class Tapables {
6361
6385
  hookName,
6362
6386
  getContext(args),
6363
6387
  startTime,
6364
- performance.now()
6388
+ perf_hooks.performance.now()
6365
6389
  );
6366
6390
  return originalCB(...a);
6367
6391
  };
@@ -6371,7 +6395,7 @@ class Tapables {
6371
6395
  getDefaultTapPatch(type, fn, pluginName, hookName) {
6372
6396
  return (...args) => {
6373
6397
  this.checkHooks();
6374
- const startTime = performance.now();
6398
+ const startTime = perf_hooks.performance.now();
6375
6399
  const returnValue = fn.apply(this, args);
6376
6400
  this.saveResult(
6377
6401
  type,
@@ -6379,7 +6403,7 @@ class Tapables {
6379
6403
  hookName,
6380
6404
  getContext(args),
6381
6405
  startTime,
6382
- performance.now()
6406
+ perf_hooks.performance.now()
6383
6407
  );
6384
6408
  return returnValue;
6385
6409
  };
@@ -16263,9 +16287,9 @@ var lib = VirtualModulesPlugin;
16263
16287
  var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
16264
16288
 
16265
16289
  // node_modules/.pnpm/tsup@8.0.2_typescript@5.4.3/node_modules/tsup/assets/esm_shims.js
16266
- var getFilename = () => fileURLToPath(import.meta.url);
16290
+ var getFilename = () => url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
16267
16291
  var getDirname = () => require$$1.dirname(getFilename());
16268
- var __dirname = /* @__PURE__ */ getDirname();
16292
+ var __dirname$1 = /* @__PURE__ */ getDirname();
16269
16293
 
16270
16294
  // node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
16271
16295
  var comma = ",".charCodeAt(0);
@@ -17016,8 +17040,8 @@ function remapping(input, loader, options) {
17016
17040
  return new SourceMap(traceMappings(tree), opts);
17017
17041
  }
17018
17042
  function normalizeAbsolutePath(path6) {
17019
- if (isAbsolute(path6))
17020
- return normalize(path6);
17043
+ if (require$$1.isAbsolute(path6))
17044
+ return require$$1.normalize(path6);
17021
17045
  else
17022
17046
  return path6;
17023
17047
  }
@@ -17085,7 +17109,7 @@ function fixSourceMap(map) {
17085
17109
  Object.defineProperty(map, "toUrl", {
17086
17110
  enumerable: false,
17087
17111
  value: function toUrl() {
17088
- return `data:application/json;charset=utf-8;base64,${Buffer$1.from(this.toString()).toString("base64")}`;
17112
+ return `data:application/json;charset=utf-8;base64,${buffer$2.Buffer.from(this.toString()).toString("base64")}`;
17089
17113
  }
17090
17114
  });
17091
17115
  }
@@ -17429,8 +17453,8 @@ function createFarmContext(context, currentResolveId) {
17429
17453
  context.emitFile({
17430
17454
  resolvedPath: outFileName,
17431
17455
  name: outFileName,
17432
- content: [...Buffer$1.from(emittedFile.source)],
17433
- resourceType: extname(outFileName)
17456
+ content: [...buffer$2.Buffer.from(emittedFile.source)],
17457
+ resourceType: require$$1.extname(outFileName)
17434
17458
  });
17435
17459
  }
17436
17460
  },
@@ -17471,7 +17495,7 @@ function transformQuery(context) {
17471
17495
  context.query.forEach(([param, value]) => {
17472
17496
  queryParamsObject[param] = value;
17473
17497
  });
17474
- const transformQuery2 = querystring.stringify(queryParamsObject);
17498
+ const transformQuery2 = querystring__namespace.stringify(queryParamsObject);
17475
17499
  context.resolvedPath = `${context.resolvedPath}?${transformQuery2}`;
17476
17500
  }
17477
17501
  function convertEnforceToPriority(value) {
@@ -17503,7 +17527,7 @@ function customParseQueryString(url) {
17503
17527
  if (!url)
17504
17528
  return [];
17505
17529
  const queryString = url.split("?")[1];
17506
- const parsedParams = querystring.parse(queryString);
17530
+ const parsedParams = querystring__namespace.parse(queryString);
17507
17531
  const paramsArray = [];
17508
17532
  for (const key in parsedParams)
17509
17533
  paramsArray.push([key, parsedParams[key]]);
@@ -17749,7 +17773,7 @@ function createBuildContext2(compilation) {
17749
17773
  outFileName,
17750
17774
  new sources2.RawSource(
17751
17775
  // @ts-expect-error types mismatch
17752
- typeof emittedFile.source === "string" ? emittedFile.source : Buffer$1.from(emittedFile.source)
17776
+ typeof emittedFile.source === "string" ? emittedFile.source : buffer$2.Buffer.from(emittedFile.source)
17753
17777
  )
17754
17778
  );
17755
17779
  }
@@ -17761,19 +17785,19 @@ function createBuildContext2(compilation) {
17761
17785
  }
17762
17786
 
17763
17787
  // src/rspack/index.ts
17764
- var TRANSFORM_LOADER = resolve$1(
17765
- __dirname,
17788
+ var TRANSFORM_LOADER = require$$1.resolve(
17789
+ __dirname$1,
17766
17790
  "rspack/loaders/transform"
17767
17791
  );
17768
- var LOAD_LOADER = resolve$1(
17769
- __dirname,
17792
+ var LOAD_LOADER = require$$1.resolve(
17793
+ __dirname$1,
17770
17794
  "rspack/loaders/load"
17771
17795
  );
17772
17796
  function getRspackPlugin(factory) {
17773
17797
  return (userOptions) => {
17774
17798
  return {
17775
17799
  apply(compiler) {
17776
- const VIRTUAL_MODULE_PREFIX = resolve$1(compiler.options.context ?? process.cwd(), "_virtual_");
17800
+ const VIRTUAL_MODULE_PREFIX = require$$1.resolve(compiler.options.context ?? process.cwd(), "_virtual_");
17777
17801
  const injected = compiler.$unpluginContext || {};
17778
17802
  compiler.$unpluginContext = injected;
17779
17803
  const meta = {
@@ -17883,7 +17907,7 @@ function createBuildContext3(options, compilation) {
17883
17907
  });
17884
17908
  },
17885
17909
  addWatchFile(id) {
17886
- options.addWatchFile(resolve$1(process2.cwd(), id));
17910
+ options.addWatchFile(require$$1.resolve(process2.cwd(), id));
17887
17911
  },
17888
17912
  emitFile(emittedFile) {
17889
17913
  const outFileName = emittedFile.fileName || emittedFile.name;
@@ -17894,7 +17918,7 @@ function createBuildContext3(options, compilation) {
17894
17918
  outFileName,
17895
17919
  sources2 ? new sources2.RawSource(
17896
17920
  // @ts-expect-error types mismatch
17897
- typeof emittedFile.source === "string" ? emittedFile.source : Buffer$1.from(emittedFile.source)
17921
+ typeof emittedFile.source === "string" ? emittedFile.source : buffer$2.Buffer.from(emittedFile.source)
17898
17922
  ) : {
17899
17923
  source: () => emittedFile.source,
17900
17924
  size: () => emittedFile.source.length
@@ -17917,19 +17941,19 @@ function normalizeMessage(error) {
17917
17941
  }
17918
17942
 
17919
17943
  // src/webpack/index.ts
17920
- var TRANSFORM_LOADER2 = resolve$1(
17921
- __dirname,
17944
+ var TRANSFORM_LOADER2 = require$$1.resolve(
17945
+ __dirname$1,
17922
17946
  "webpack/loaders/transform"
17923
17947
  );
17924
- var LOAD_LOADER2 = resolve$1(
17925
- __dirname,
17948
+ var LOAD_LOADER2 = require$$1.resolve(
17949
+ __dirname$1,
17926
17950
  "webpack/loaders/load"
17927
17951
  );
17928
17952
  function getWebpackPlugin(factory) {
17929
17953
  return (userOptions) => {
17930
17954
  return {
17931
17955
  apply(compiler) {
17932
- const VIRTUAL_MODULE_PREFIX = resolve$1(compiler.options.context ?? process2.cwd(), "_virtual_");
17956
+ const VIRTUAL_MODULE_PREFIX = require$$1.resolve(compiler.options.context ?? process2.cwd(), "_virtual_");
17933
17957
  const injected = compiler.$unpluginContext || {};
17934
17958
  compiler.$unpluginContext = injected;
17935
17959
  const meta = {
@@ -18137,5 +18161,6 @@ const buildPluginFactory = () => {
18137
18161
  const datadogWebpackPlugin = buildPluginFactory().webpack;
18138
18162
  module.exports = datadogWebpackPlugin;
18139
18163
 
18140
- export { datadogWebpackPlugin, datadogWebpackPlugin as default };
18164
+ exports.datadogWebpackPlugin = datadogWebpackPlugin;
18165
+ exports.default = datadogWebpackPlugin;
18141
18166
  //# sourceMappingURL=index.js.map