@datadog/vite-plugin 2.3.1-dev-4 → 2.3.1-dev-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/dist/src/index.js CHANGED
@@ -2292,6 +2292,12 @@ var lib$3 = retry$1;
2292
2292
 
2293
2293
  var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
2294
2294
 
2295
+ const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
2296
+ const PLUGIN_NAME$4 = "datadog-injection-plugin";
2297
+ const RESOLUTION_PLUGIN_NAME = "datadog-injection-resolution-plugin";
2298
+ const INJECTED_FILE = "__DATADOG_INJECTION_STUB";
2299
+ const DISTANT_FILE_RX = /^https?:\/\//;
2300
+
2295
2301
  const formatDuration = (duration) => {
2296
2302
  const days = Math.floor(duration / 1e3 / 60 / 60 / 24);
2297
2303
  const usedDuration = duration - days * 24 * 60 * 60 * 1e3;
@@ -2370,6 +2376,7 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
2370
2376
  const rightStop = stringLength - leftStop;
2371
2377
  return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
2372
2378
  };
2379
+ const isInjection = (filename) => filename.includes(INJECTED_FILE);
2373
2380
 
2374
2381
  var balancedMatch = balanced$1;
2375
2382
  function balanced$1(a, b, str) {
@@ -11258,12 +11265,6 @@ const glob = Object.assign(glob_, {
11258
11265
  });
11259
11266
  glob.glob = glob;
11260
11267
 
11261
- const PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
11262
- const PLUGIN_NAME$4 = "datadog-injection-plugin";
11263
- const RESOLUTION_PLUGIN_NAME = "datadog-injection-resolution-plugin";
11264
- const INJECTED_FILE = "__DATADOG_INJECTION_STUB";
11265
- const DISTANT_FILE_RX = /^https?:\/\//;
11266
-
11267
11268
  const EXTENSION_RX = /\.(?!.*(?:\.|\/|\\))(\w{1,})/g;
11268
11269
  const QUERY_RX = /(\?|%3F|\|)+/gi;
11269
11270
  const getExtension = (filepath) => {
@@ -11324,7 +11325,6 @@ const serializeBuildReport = (report) => {
11324
11325
  }
11325
11326
  return jsonReport;
11326
11327
  };
11327
- const isInjection = (filename) => filename.includes(INJECTED_FILE);
11328
11328
  const BUNDLER_SPECIFICS = ["unknown", "commonjsHelpers.js", "vite/preload-helper.js"];
11329
11329
  const cleanReport = (report, filepath, filter) => {
11330
11330
  const cleanedReport = /* @__PURE__ */ new Set();
@@ -19096,10 +19096,27 @@ const getInjectionPlugins = (opts, context, toInject) => {
19096
19096
  return "";
19097
19097
  }
19098
19098
  };
19099
- const isInjectedFile = (id) => {
19100
- return id.includes(INJECTED_FILE);
19101
- };
19102
19099
  return [
19100
+ // Resolve the injected file.
19101
+ {
19102
+ name: RESOLUTION_PLUGIN_NAME,
19103
+ enforce: "pre",
19104
+ resolveId(id) {
19105
+ if (isInjection(id)) {
19106
+ return { id, moduleSideEffects: true };
19107
+ }
19108
+ },
19109
+ loadInclude(id) {
19110
+ if (isInjection(id)) {
19111
+ return true;
19112
+ }
19113
+ },
19114
+ load(id) {
19115
+ if (isInjection(id)) {
19116
+ return getContentToInject();
19117
+ }
19118
+ }
19119
+ },
19103
19120
  // Prepare and fetch the content to inject.
19104
19121
  {
19105
19122
  name: PREPARATION_PLUGIN_NAME,
@@ -19163,26 +19180,6 @@ const getInjectionPlugins = (opts, context, toInject) => {
19163
19180
  },
19164
19181
  rollup: rollupInjectionPlugin,
19165
19182
  vite: rollupInjectionPlugin
19166
- },
19167
- // Resolve the injected file.
19168
- {
19169
- name: RESOLUTION_PLUGIN_NAME,
19170
- enforce: "pre",
19171
- resolveId(id) {
19172
- if (isInjectedFile(id)) {
19173
- return { id, moduleSideEffects: true };
19174
- }
19175
- },
19176
- loadInclude(id) {
19177
- if (isInjectedFile(id)) {
19178
- return true;
19179
- }
19180
- },
19181
- load(id) {
19182
- if (isInjectedFile(id)) {
19183
- return getContentToInject();
19184
- }
19185
- }
19186
19183
  }
19187
19184
  ];
19188
19185
  };
@@ -36471,7 +36468,7 @@ const buildPluginFactory = ({
36471
36468
 
36472
36469
  var name = "@datadog/vite-plugin";
36473
36470
  var packageManager = "yarn@4.0.2";
36474
- var version$1 = "2.3.1-dev-4";
36471
+ var version$1 = "2.3.1-dev-6";
36475
36472
  var license = "MIT";
36476
36473
  var author = "Datadog";
36477
36474
  var description = "Datadog Vite Plugin";