@datadog/rollup-plugin 2.3.1-dev-8 → 2.3.1-dev-9
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 +51 -33
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +51 -33
- package/dist/src/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -2377,14 +2377,6 @@ const truncateString = (str, maxLength = 60, placeholder = "[...]") => {
|
|
|
2377
2377
|
return `${str.slice(0, leftStop)}${placeholder}${str.slice(-rightStop)}`;
|
|
2378
2378
|
};
|
|
2379
2379
|
const isInjection = (filename) => filename.includes(INJECTED_FILE);
|
|
2380
|
-
const isInternalPlugin = (pluginName, context) => {
|
|
2381
|
-
for (const internalPluginName of context.pluginNames) {
|
|
2382
|
-
if (pluginName.includes(internalPluginName)) {
|
|
2383
|
-
return true;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
return false;
|
|
2387
|
-
};
|
|
2388
2380
|
|
|
2389
2381
|
var balancedMatch = balanced$1;
|
|
2390
2382
|
function balanced$1(a, b, str) {
|
|
@@ -19084,17 +19076,15 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19084
19076
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$4);
|
|
19085
19077
|
const contentToInject = [];
|
|
19086
19078
|
const getContentToInject = () => {
|
|
19087
|
-
|
|
19088
|
-
// Needs at least one element otherwise ESBuild will throw 'Do not know how to load path'.
|
|
19089
|
-
// Most likely because it tries to generate an empty file.
|
|
19090
|
-
`
|
|
19079
|
+
const before = `
|
|
19091
19080
|
/********************************************/
|
|
19092
|
-
/* BEGIN INJECTION BY DATADOG BUILD PLUGINS
|
|
19093
|
-
|
|
19094
|
-
contentToInject.push(`
|
|
19081
|
+
/* BEGIN INJECTION BY DATADOG BUILD PLUGINS */`;
|
|
19082
|
+
const after = `
|
|
19095
19083
|
/* END INJECTION BY DATADOG BUILD PLUGINS */
|
|
19096
|
-
|
|
19097
|
-
return
|
|
19084
|
+
/********************************************/`;
|
|
19085
|
+
return `${before}
|
|
19086
|
+
${contentToInject.join("\n\n")}
|
|
19087
|
+
${after}`;
|
|
19098
19088
|
};
|
|
19099
19089
|
const rollupInjectionPlugin = {
|
|
19100
19090
|
banner(chunk) {
|
|
@@ -19105,11 +19095,11 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19105
19095
|
}
|
|
19106
19096
|
};
|
|
19107
19097
|
return [
|
|
19108
|
-
// Resolve the injected file.
|
|
19098
|
+
// Resolve the injected file for all bundlers.
|
|
19109
19099
|
{
|
|
19110
19100
|
name: RESOLUTION_PLUGIN_NAME,
|
|
19111
19101
|
enforce: "pre",
|
|
19112
|
-
resolveId(id) {
|
|
19102
|
+
async resolveId(id) {
|
|
19113
19103
|
if (isInjection(id)) {
|
|
19114
19104
|
return { id, moduleSideEffects: true };
|
|
19115
19105
|
}
|
|
@@ -19125,7 +19115,7 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19125
19115
|
}
|
|
19126
19116
|
}
|
|
19127
19117
|
},
|
|
19128
|
-
// Prepare and fetch the content to inject.
|
|
19118
|
+
// Prepare and fetch the content to inject for all bundlers.
|
|
19129
19119
|
{
|
|
19130
19120
|
name: PREPARATION_PLUGIN_NAME,
|
|
19131
19121
|
enforce: "pre",
|
|
@@ -19136,25 +19126,53 @@ const getInjectionPlugins = (opts, context, toInject) => {
|
|
|
19136
19126
|
}
|
|
19137
19127
|
},
|
|
19138
19128
|
// Inject the virtual file that will be home of all injected content.
|
|
19129
|
+
// Each bundler has its own way to inject a file.
|
|
19139
19130
|
{
|
|
19140
19131
|
name: PLUGIN_NAME$4,
|
|
19141
19132
|
esbuild: {
|
|
19142
19133
|
setup(build) {
|
|
19143
19134
|
const { initialOptions } = build;
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19135
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
19136
|
+
if (args.kind !== "entry-point") {
|
|
19137
|
+
return null;
|
|
19138
|
+
}
|
|
19139
|
+
if (initialOptions.inject?.includes(args.path)) {
|
|
19140
|
+
return null;
|
|
19141
|
+
}
|
|
19142
|
+
return {
|
|
19143
|
+
pluginName: PLUGIN_NAME$4,
|
|
19144
|
+
path: require$$1.isAbsolute(args.path) ? args.path : require$$1.join(args.resolveDir, args.path),
|
|
19145
|
+
pluginData: {
|
|
19146
|
+
isInjectionResolver: true,
|
|
19147
|
+
originalPath: args.path,
|
|
19148
|
+
originalResolveDir: args.resolveDir
|
|
19149
|
+
},
|
|
19150
|
+
// Adding a suffix prevents esbuild from marking the entrypoint as resolved,
|
|
19151
|
+
// avoiding a dependency loop with the proxy module.
|
|
19152
|
+
// This ensures esbuild continues to traverse the module tree
|
|
19153
|
+
// and re-resolves the entrypoint when imported from the proxy module.
|
|
19154
|
+
suffix: "?datadogInjected=true"
|
|
19155
|
+
};
|
|
19156
|
+
});
|
|
19157
|
+
build.onLoad({ filter: /.*/ }, async (args) => {
|
|
19158
|
+
if (!args.pluginData?.isInjectionResolver) {
|
|
19159
|
+
return null;
|
|
19152
19160
|
}
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19161
|
+
const originalPath = args.pluginData.originalPath;
|
|
19162
|
+
const originalResolveDir = args.pluginData.originalResolveDir;
|
|
19163
|
+
const contents = `
|
|
19164
|
+
import ${JSON.stringify(INJECTED_FILE)};
|
|
19165
|
+
import * as OriginalModule from ${JSON.stringify(originalPath)};
|
|
19166
|
+
export default OriginalModule['default'.toString()];
|
|
19167
|
+
export * from ${JSON.stringify(originalPath)};
|
|
19168
|
+
`;
|
|
19169
|
+
return {
|
|
19170
|
+
loader: "js",
|
|
19171
|
+
pluginName: PLUGIN_NAME$4,
|
|
19172
|
+
contents,
|
|
19173
|
+
resolveDir: originalResolveDir
|
|
19156
19174
|
};
|
|
19157
|
-
}
|
|
19175
|
+
});
|
|
19158
19176
|
}
|
|
19159
19177
|
},
|
|
19160
19178
|
webpack: (compiler) => {
|
|
@@ -36493,7 +36511,7 @@ const buildPluginFactory = ({
|
|
|
36493
36511
|
|
|
36494
36512
|
var name = "@datadog/rollup-plugin";
|
|
36495
36513
|
var packageManager = "yarn@4.0.2";
|
|
36496
|
-
var version$1 = "2.3.1-dev-
|
|
36514
|
+
var version$1 = "2.3.1-dev-9";
|
|
36497
36515
|
var license = "MIT";
|
|
36498
36516
|
var author = "Datadog";
|
|
36499
36517
|
var description = "Datadog Rollup Plugin";
|