@datadog/esbuild-plugin 2.3.1-dev-7 → 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.
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +28 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +28 -4
- package/dist/src/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/src/index.mjs
CHANGED
|
@@ -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-
|
|
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}`,
|
|
@@ -36417,18 +36438,20 @@ const validateOptions = (options = {}) => {
|
|
|
36417
36438
|
...options
|
|
36418
36439
|
};
|
|
36419
36440
|
};
|
|
36441
|
+
const HOST_NAME = "datadog-build-plugins";
|
|
36420
36442
|
const buildPluginFactory = ({
|
|
36421
36443
|
version
|
|
36422
36444
|
}) => {
|
|
36423
36445
|
return createUnplugin((opts, unpluginMetaContext) => {
|
|
36424
36446
|
const options = validateOptions(opts);
|
|
36425
|
-
if ("
|
|
36426
|
-
unpluginMetaContext.esbuildHostName =
|
|
36447
|
+
if (unpluginMetaContext.framework === "esbuild") {
|
|
36448
|
+
unpluginMetaContext.esbuildHostName = HOST_NAME;
|
|
36427
36449
|
}
|
|
36428
36450
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
36429
36451
|
version,
|
|
36430
36452
|
...unpluginMetaContext
|
|
36431
36453
|
});
|
|
36454
|
+
globalContext.pluginNames.push(HOST_NAME);
|
|
36432
36455
|
const plugins = [...internalPlugins];
|
|
36433
36456
|
if (options.customPlugins) {
|
|
36434
36457
|
const customPlugins = options.customPlugins(options, globalContext);
|
|
@@ -36440,13 +36463,14 @@ const buildPluginFactory = ({
|
|
|
36440
36463
|
if (options[CONFIG_KEY] && options[CONFIG_KEY].disabled !== true) {
|
|
36441
36464
|
plugins.push(...getPlugins(options, globalContext));
|
|
36442
36465
|
}
|
|
36466
|
+
globalContext.pluginNames.push(...plugins.map((plugin) => plugin.name));
|
|
36443
36467
|
return plugins;
|
|
36444
36468
|
});
|
|
36445
36469
|
};
|
|
36446
36470
|
|
|
36447
36471
|
var name = "@datadog/esbuild-plugin";
|
|
36448
36472
|
var packageManager = "yarn@4.0.2";
|
|
36449
|
-
var version$1 = "2.3.1-dev-
|
|
36473
|
+
var version$1 = "2.3.1-dev-8";
|
|
36450
36474
|
var license = "MIT";
|
|
36451
36475
|
var author = "Datadog";
|
|
36452
36476
|
var description = "Datadog ESBuild Plugin";
|