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

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.
@@ -2269,6 +2269,12 @@ var lib$3 = retry$1;
2269
2269
 
2270
2270
  var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
2271
2271
 
2272
+ const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
2273
+ const PLUGIN_NAME$4 = "datadog-injection-plugin";
2274
+ const RESOLUTION_PLUGIN_NAME = "datadog-injection-resolution-plugin";
2275
+ const INJECTED_FILE = "__DATADOG_INJECTION_STUB";
2276
+ const DISTANT_FILE_RX = /^https?:\/\//;
2277
+
2272
2278
  const formatDuration = (duration) => {
2273
2279
  const days = Math.floor(duration / 1e3 / 60 / 60 / 24);
2274
2280
  const usedDuration = duration - days * 24 * 60 * 60 * 1e3;
@@ -2347,6 +2353,7 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
2347
2353
  const rightStop = stringLength - leftStop;
2348
2354
  return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
2349
2355
  };
2356
+ const isInjection = (filename) => filename.includes(INJECTED_FILE);
2350
2357
 
2351
2358
  var balancedMatch = balanced$1;
2352
2359
  function balanced$1(a, b, str) {
@@ -11235,12 +11242,6 @@ const glob = Object.assign(glob_, {
11235
11242
  });
11236
11243
  glob.glob = glob;
11237
11244
 
11238
- const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
11239
- const PLUGIN_NAME$4 = "datadog-injection-plugin";
11240
- const RESOLUTION_PLUGIN_NAME = "datadog-injection-resolution-plugin";
11241
- const INJECTED_FILE = "__DATADOG_INJECTION_STUB";
11242
- const DISTANT_FILE_RX = /^https?:\/\//;
11243
-
11244
11245
  const EXTENSION_RX = /\.(?!.*(?:\.|\/|\\))(\w{1,})/g;
11245
11246
  const QUERY_RX = /(\?|%3F|\|)+/gi;
11246
11247
  const getExtension = (filepath) => {
@@ -11301,7 +11302,6 @@ const serializeBuildReport = (report) => {
11301
11302
  }
11302
11303
  return jsonReport;
11303
11304
  };
11304
- const isInjection = (filename) => filename.includes(INJECTED_FILE);
11305
11305
  const BUNDLER_SPECIFICS = ["unknown", "commonjsHelpers.js", "vite/preload-helper.js"];
11306
11306
  const cleanReport = (report, filepath, filter) => {
11307
11307
  const cleanedReport = /* @__PURE__ */ new Set();
@@ -19073,10 +19073,27 @@ const getInjectionPlugins = (opts, context, toInject) => {
19073
19073
  return "";
19074
19074
  }
19075
19075
  };
19076
- const isInjectedFile = (id) => {
19077
- return id.includes(INJECTED_FILE);
19078
- };
19079
19076
  return [
19077
+ // Resolve the injected file.
19078
+ {
19079
+ name: RESOLUTION_PLUGIN_NAME,
19080
+ enforce: "pre",
19081
+ resolveId(id) {
19082
+ if (isInjection(id)) {
19083
+ return { id, moduleSideEffects: true };
19084
+ }
19085
+ },
19086
+ loadInclude(id) {
19087
+ if (isInjection(id)) {
19088
+ return true;
19089
+ }
19090
+ },
19091
+ load(id) {
19092
+ if (isInjection(id)) {
19093
+ return getContentToInject();
19094
+ }
19095
+ }
19096
+ },
19080
19097
  // Prepare and fetch the content to inject.
19081
19098
  {
19082
19099
  name: PREPARATION_PLUGIN_NAME,
@@ -19140,26 +19157,6 @@ const getInjectionPlugins = (opts, context, toInject) => {
19140
19157
  },
19141
19158
  rollup: rollupInjectionPlugin,
19142
19159
  vite: rollupInjectionPlugin
19143
- },
19144
- // Resolve the injected file.
19145
- {
19146
- name: RESOLUTION_PLUGIN_NAME,
19147
- enforce: "pre",
19148
- resolveId(id) {
19149
- if (isInjectedFile(id)) {
19150
- return { id, moduleSideEffects: true };
19151
- }
19152
- },
19153
- loadInclude(id) {
19154
- if (isInjectedFile(id)) {
19155
- return true;
19156
- }
19157
- },
19158
- load(id) {
19159
- if (isInjectedFile(id)) {
19160
- return getContentToInject();
19161
- }
19162
- }
19163
19160
  }
19164
19161
  ];
19165
19162
  };
@@ -36448,7 +36445,7 @@ const buildPluginFactory = ({
36448
36445
 
36449
36446
  var name = "@datadog/esbuild-plugin";
36450
36447
  var packageManager = "yarn@4.0.2";
36451
- var version$1 = "2.3.1-dev-4";
36448
+ var version$1 = "2.3.1-dev-5";
36452
36449
  var license = "MIT";
36453
36450
  var author = "Datadog";
36454
36451
  var description = "Datadog ESBuild Plugin";