@datadog/esbuild-plugin 2.2.0-dev-1 → 2.2.1
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 +13 -3
- package/dist/src/index.js +44 -39
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +44 -39
- package/dist/src/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/src/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ import require$$0$2 from 'constants';
|
|
|
13
13
|
import require$$5 from 'assert';
|
|
14
14
|
import { request } from 'https';
|
|
15
15
|
import { performance } from 'perf_hooks';
|
|
16
|
-
import webpack from 'webpack';
|
|
17
16
|
import * as querystring from 'querystring';
|
|
18
17
|
import process2 from 'process';
|
|
19
18
|
|
|
@@ -10574,7 +10573,7 @@ const uploadSourcemaps = async (options, context, log) => {
|
|
|
10574
10573
|
};
|
|
10575
10574
|
|
|
10576
10575
|
const defaultIntakeUrl = `https://sourcemap-intake.${process.env.DATADOG_SITE || "datadoghq.com"}/api/v2/srcmap`;
|
|
10577
|
-
const validateOptions$
|
|
10576
|
+
const validateOptions$2 = (config, log) => {
|
|
10578
10577
|
const errors = [];
|
|
10579
10578
|
const sourcemapsResults = validateSourcemapsOptions(config);
|
|
10580
10579
|
errors.push(...sourcemapsResults.errors);
|
|
@@ -10641,7 +10640,7 @@ const validateSourcemapsOptions = (config) => {
|
|
|
10641
10640
|
|
|
10642
10641
|
const getPlugins$2 = (opts, context) => {
|
|
10643
10642
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$1);
|
|
10644
|
-
const rumOptions = validateOptions$
|
|
10643
|
+
const rumOptions = validateOptions$2(opts, log);
|
|
10645
10644
|
return [
|
|
10646
10645
|
{
|
|
10647
10646
|
name: PLUGIN_NAME$1,
|
|
@@ -13646,7 +13645,7 @@ var output$1 = {
|
|
|
13646
13645
|
|
|
13647
13646
|
var libExports = lib$2.exports;
|
|
13648
13647
|
|
|
13649
|
-
const validateOptions = (options) => {
|
|
13648
|
+
const validateOptions$1 = (options) => {
|
|
13650
13649
|
const validatedOptions = options[CONFIG_KEY] || { disabled: false };
|
|
13651
13650
|
return validatedOptions;
|
|
13652
13651
|
};
|
|
@@ -14883,7 +14882,7 @@ const getEsbuildPlugin$1 = (opt, ctx) => {
|
|
|
14883
14882
|
setup: (build) => {
|
|
14884
14883
|
const startBuild = Date.now();
|
|
14885
14884
|
const logger = getLogger(opt.logLevel, "telemetry");
|
|
14886
|
-
const telemetryOptions = validateOptions(opt);
|
|
14885
|
+
const telemetryOptions = validateOptions$1(opt);
|
|
14887
14886
|
build.initialOptions.metafile = true;
|
|
14888
14887
|
wrapPlugins(build, ctx.cwd);
|
|
14889
14888
|
build.onEnd(async (result) => {
|
|
@@ -15194,14 +15193,24 @@ class Tapables {
|
|
|
15194
15193
|
hook.tapAsync = this.newTap("async", hookName, hook.tapAsync, hook);
|
|
15195
15194
|
hook.tapPromise = this.newTap("promise", hookName, hook.tapPromise, hook);
|
|
15196
15195
|
}
|
|
15196
|
+
patchHook(tapableName, hookName, hook) {
|
|
15197
|
+
if (hook._fakeHook) {
|
|
15198
|
+
return;
|
|
15199
|
+
}
|
|
15200
|
+
if (!this.hooks[tapableName]) {
|
|
15201
|
+
this.hooks[tapableName] = [];
|
|
15202
|
+
}
|
|
15203
|
+
if (this.hooks[tapableName].includes(hookName)) {
|
|
15204
|
+
return;
|
|
15205
|
+
}
|
|
15206
|
+
this.hooks[tapableName].push(hookName);
|
|
15207
|
+
this.replaceTaps(hookName, hook);
|
|
15208
|
+
}
|
|
15197
15209
|
checkHooks() {
|
|
15198
15210
|
for (const tapable of this.tapables) {
|
|
15199
15211
|
const name = tapable.constructor.name;
|
|
15200
15212
|
for (const hookName of Object.keys(tapable.hooks)) {
|
|
15201
|
-
|
|
15202
|
-
this.hooks[name].push(hookName);
|
|
15203
|
-
this.replaceTaps(hookName, tapable.hooks[hookName]);
|
|
15204
|
-
}
|
|
15213
|
+
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
15205
15214
|
}
|
|
15206
15215
|
}
|
|
15207
15216
|
}
|
|
@@ -15211,24 +15220,8 @@ class Tapables {
|
|
|
15211
15220
|
if (!this.tapables.includes(tapable)) {
|
|
15212
15221
|
this.tapables.push(tapable);
|
|
15213
15222
|
}
|
|
15214
|
-
if (!this.hooks[name]) {
|
|
15215
|
-
this.hooks[name] = [];
|
|
15216
|
-
}
|
|
15217
15223
|
for (const hookName of Object.keys(tapable.hooks)) {
|
|
15218
|
-
this.hooks[
|
|
15219
|
-
try {
|
|
15220
|
-
if (hookName === "normalModuleLoader" && typeof webpack.NormalModule.getCompilationHooks === "function") {
|
|
15221
|
-
const NormalModule = webpack.NormalModule;
|
|
15222
|
-
const compil = tapable;
|
|
15223
|
-
this.replaceTaps(
|
|
15224
|
-
hookName,
|
|
15225
|
-
NormalModule.getCompilationHooks(compil).loader
|
|
15226
|
-
);
|
|
15227
|
-
} else {
|
|
15228
|
-
this.replaceTaps(hookName, tapable.hooks[hookName]);
|
|
15229
|
-
}
|
|
15230
|
-
} catch (e) {
|
|
15231
|
-
}
|
|
15224
|
+
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
15232
15225
|
}
|
|
15233
15226
|
}
|
|
15234
15227
|
}
|
|
@@ -15236,7 +15229,7 @@ class Tapables {
|
|
|
15236
15229
|
const getWebpackPlugin$1 = (opt, ctx) => {
|
|
15237
15230
|
return async (compiler) => {
|
|
15238
15231
|
const HOOK_OPTIONS = { name: PLUGIN_NAME };
|
|
15239
|
-
const options = validateOptions(opt);
|
|
15232
|
+
const options = validateOptions$1(opt);
|
|
15240
15233
|
const logger = getLogger(opt.logLevel, "telemetry");
|
|
15241
15234
|
const modules = new Modules(ctx.cwd, options);
|
|
15242
15235
|
const tapables = new Tapables(ctx.cwd, options);
|
|
@@ -15278,7 +15271,7 @@ const getWebpackPlugin$1 = (opt, ctx) => {
|
|
|
15278
15271
|
};
|
|
15279
15272
|
};
|
|
15280
15273
|
|
|
15281
|
-
const helpers$
|
|
15274
|
+
const helpers$2 = {
|
|
15282
15275
|
filters: defaultFilters
|
|
15283
15276
|
};
|
|
15284
15277
|
const getPlugins = (options, context) => {
|
|
@@ -26905,16 +26898,25 @@ function createUnplugin(factory) {
|
|
|
26905
26898
|
};
|
|
26906
26899
|
}
|
|
26907
26900
|
|
|
26908
|
-
const helpers = {
|
|
26901
|
+
const helpers$1 = {
|
|
26909
26902
|
// Each product should have a unique entry.
|
|
26910
26903
|
// #helpers-injection-marker
|
|
26911
|
-
[CONFIG_KEY]: helpers$
|
|
26904
|
+
[CONFIG_KEY]: helpers$2
|
|
26912
26905
|
// #helpers-injection-marker
|
|
26913
26906
|
};
|
|
26907
|
+
const validateOptions = (options = {}) => {
|
|
26908
|
+
return {
|
|
26909
|
+
auth: {},
|
|
26910
|
+
disableGit: false,
|
|
26911
|
+
logLevel: "warn",
|
|
26912
|
+
...options
|
|
26913
|
+
};
|
|
26914
|
+
};
|
|
26914
26915
|
const buildPluginFactory = ({
|
|
26915
26916
|
version
|
|
26916
26917
|
}) => {
|
|
26917
|
-
return createUnplugin((
|
|
26918
|
+
return createUnplugin((opts, unpluginMetaContext) => {
|
|
26919
|
+
const options = validateOptions(opts);
|
|
26918
26920
|
if ("esbuildHostName" in unpluginMetaContext) {
|
|
26919
26921
|
unpluginMetaContext.esbuildHostName = "datadog-plugins";
|
|
26920
26922
|
}
|
|
@@ -26935,7 +26937,7 @@ const buildPluginFactory = ({
|
|
|
26935
26937
|
|
|
26936
26938
|
var name = "@datadog/esbuild-plugin";
|
|
26937
26939
|
var packageManager = "yarn@4.0.2";
|
|
26938
|
-
var version = "2.2.
|
|
26940
|
+
var version = "2.2.1";
|
|
26939
26941
|
var license = "MIT";
|
|
26940
26942
|
var author = "Datadog";
|
|
26941
26943
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -27000,7 +27002,6 @@ var devDependencies = {
|
|
|
27000
27002
|
var peerDependencies = {
|
|
27001
27003
|
esbuild: ">=0.x"
|
|
27002
27004
|
};
|
|
27003
|
-
var stableVersion = "2.1.0";
|
|
27004
27005
|
var pkg = {
|
|
27005
27006
|
name: name,
|
|
27006
27007
|
packageManager: packageManager,
|
|
@@ -27018,17 +27019,21 @@ var pkg = {
|
|
|
27018
27019
|
files: files,
|
|
27019
27020
|
scripts: scripts,
|
|
27020
27021
|
devDependencies: devDependencies,
|
|
27021
|
-
peerDependencies: peerDependencies
|
|
27022
|
-
stableVersion: stableVersion
|
|
27022
|
+
peerDependencies: peerDependencies
|
|
27023
27023
|
};
|
|
27024
27024
|
|
|
27025
27025
|
const datadogEsbuildPlugin = buildPluginFactory({
|
|
27026
27026
|
version: pkg.version
|
|
27027
27027
|
}).esbuild;
|
|
27028
|
-
|
|
27029
|
-
helpers,
|
|
27030
|
-
datadogEsbuildPlugin
|
|
27031
|
-
};
|
|
27028
|
+
const helpers = helpers$1;
|
|
27032
27029
|
|
|
27033
27030
|
export { datadogEsbuildPlugin, helpers };
|
|
27031
|
+
|
|
27032
|
+
|
|
27033
|
+
if (typeof module !== 'undefined') {
|
|
27034
|
+
module.exports = {
|
|
27035
|
+
datadogEsbuildPlugin,
|
|
27036
|
+
helpers
|
|
27037
|
+
};
|
|
27038
|
+
}
|
|
27034
27039
|
//# sourceMappingURL=index.mjs.map
|