@datadog/esbuild-plugin 2.3.1-dev-6 → 2.3.1-dev-8

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.
@@ -2354,6 +2354,14 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
2354
2354
  return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
2355
2355
  };
2356
2356
  const isInjection = (filename) => filename.includes(INJECTED_FILE);
2357
+ const isInternalPlugin = (pluginName, context) => {
2358
+ for (const internalPluginName of context.pluginNames) {
2359
+ if (pluginName.includes(internalPluginName)) {
2360
+ return true;
2361
+ }
2362
+ }
2363
+ return false;
2364
+ };
2357
2365
 
2358
2366
  var balancedMatch = balanced$1;
2359
2367
  function balanced$1(a, b, str) {
@@ -12043,7 +12051,7 @@ const getBuildReportPlugin = (opts, context) => {
12043
12051
  };
12044
12052
  };
12045
12053
 
12046
- const PLUGIN_NAME$2 = "datadog-context-plugin";
12054
+ const PLUGIN_NAME$2 = "datadog-bundler-report-plugin";
12047
12055
  const rollupPlugin = (context) => ({
12048
12056
  options(options) {
12049
12057
  context.bundler.rawConfig = options;
@@ -19110,8 +19118,20 @@ const getInjectionPlugins = (opts, context, toInject) => {
19110
19118
  esbuild: {
19111
19119
  setup(build) {
19112
19120
  const { initialOptions } = build;
19121
+ const initialInject = initialOptions.inject ? [...initialOptions.inject] : [];
19122
+ const plugins = initialOptions.plugins || [];
19113
19123
  initialOptions.inject = initialOptions.inject || [];
19114
19124
  initialOptions.inject.push(INJECTED_FILE);
19125
+ for (const plugin of plugins) {
19126
+ const oldSetup = plugin.setup;
19127
+ if (isInternalPlugin(plugin.name, context)) {
19128
+ continue;
19129
+ }
19130
+ plugin.setup = async (esbuild) => {
19131
+ esbuild.initialOptions.inject = initialInject;
19132
+ await oldSetup(esbuild);
19133
+ };
19134
+ }
19115
19135
  }
19116
19136
  },
19117
19137
  webpack: (compiler) => {
@@ -19167,6 +19187,7 @@ const getInternalPlugins = (options, meta) => {
19167
19187
  const toInject = [];
19168
19188
  const globalContext = {
19169
19189
  auth: options.auth,
19190
+ pluginNames: [],
19170
19191
  bundler: {
19171
19192
  name: meta.framework,
19172
19193
  fullName: `${meta.framework}${variant}`,
@@ -23519,15 +23540,16 @@ const defaultFilters = [
23519
23540
 
23520
23541
  const validateOptions$1 = (opts) => {
23521
23542
  const options = opts[CONFIG_KEY] || {};
23543
+ const endPoint = options.endPoint || "https://app.datadoghq.com";
23522
23544
  return {
23523
23545
  disabled: false,
23524
23546
  enableTracing: false,
23525
- endPoint: "app.datadoghq.com",
23526
23547
  filters: defaultFilters,
23527
23548
  output: false,
23528
23549
  prefix: "",
23529
23550
  tags: [],
23530
- ...options
23551
+ ...options,
23552
+ endPoint: endPoint.startsWith("http") ? endPoint : `https://${endPoint}`
23531
23553
  };
23532
23554
  };
23533
23555
  const getMetric = (metric, opts) => ({
@@ -36416,18 +36438,20 @@ const validateOptions = (options = {}) => {
36416
36438
  ...options
36417
36439
  };
36418
36440
  };
36441
+ const HOST_NAME = "datadog-build-plugins";
36419
36442
  const buildPluginFactory = ({
36420
36443
  version
36421
36444
  }) => {
36422
36445
  return createUnplugin((opts, unpluginMetaContext) => {
36423
36446
  const options = validateOptions(opts);
36424
- if ("esbuildHostName" in unpluginMetaContext) {
36425
- unpluginMetaContext.esbuildHostName = "datadog-plugins";
36447
+ if (unpluginMetaContext.framework === "esbuild") {
36448
+ unpluginMetaContext.esbuildHostName = HOST_NAME;
36426
36449
  }
36427
36450
  const { globalContext, internalPlugins } = getInternalPlugins(options, {
36428
36451
  version,
36429
36452
  ...unpluginMetaContext
36430
36453
  });
36454
+ globalContext.pluginNames.push(HOST_NAME);
36431
36455
  const plugins = [...internalPlugins];
36432
36456
  if (options.customPlugins) {
36433
36457
  const customPlugins = options.customPlugins(options, globalContext);
@@ -36439,13 +36463,14 @@ const buildPluginFactory = ({
36439
36463
  if (options[CONFIG_KEY] && options[CONFIG_KEY].disabled !== true) {
36440
36464
  plugins.push(...getPlugins(options, globalContext));
36441
36465
  }
36466
+ globalContext.pluginNames.push(...plugins.map((plugin) => plugin.name));
36442
36467
  return plugins;
36443
36468
  });
36444
36469
  };
36445
36470
 
36446
36471
  var name = "@datadog/esbuild-plugin";
36447
36472
  var packageManager = "yarn@4.0.2";
36448
- var version$1 = "2.3.1-dev-6";
36473
+ var version$1 = "2.3.1-dev-8";
36449
36474
  var license = "MIT";
36450
36475
  var author = "Datadog";
36451
36476
  var description = "Datadog ESBuild Plugin";