@datadog/webpack-plugin 2.1.0 → 2.2.0-dev-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 +24 -23
- package/dist/src/index.js +187 -104
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +177 -94
- package/dist/src/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/src/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var require$$0$1 = require('os');
|
|
|
7
7
|
var child_process = require('child_process');
|
|
8
8
|
var node_events = require('node:events');
|
|
9
9
|
var url = require('url');
|
|
10
|
-
var
|
|
10
|
+
var path$h = require('path');
|
|
11
11
|
var buffer$2 = require('buffer');
|
|
12
12
|
var require$$0$2 = require('stream');
|
|
13
13
|
var zlib = require('zlib');
|
|
@@ -6787,6 +6787,12 @@ class TrackedFilesMatcher {
|
|
|
6787
6787
|
}
|
|
6788
6788
|
}
|
|
6789
6789
|
}
|
|
6790
|
+
displaySource(src) {
|
|
6791
|
+
if (src.length <= 40) {
|
|
6792
|
+
return src;
|
|
6793
|
+
}
|
|
6794
|
+
return `[...]${src.slice(-35)}`;
|
|
6795
|
+
}
|
|
6790
6796
|
// Looks up the sources declared in the sourcemap and return a list of related tracked files.
|
|
6791
6797
|
matchSourcemap(srcmapPath, onSourcesNotFound) {
|
|
6792
6798
|
const buff = fs$j.readFileSync(srcmapPath, "utf8");
|
|
@@ -6802,7 +6808,9 @@ class TrackedFilesMatcher {
|
|
|
6802
6808
|
}
|
|
6803
6809
|
const filtered = this.matchSources(sources);
|
|
6804
6810
|
if (filtered.length === 0) {
|
|
6805
|
-
onSourcesNotFound(
|
|
6811
|
+
onSourcesNotFound(
|
|
6812
|
+
`${sources.map(this.displaySource).join(", ")} not in the tracked files.`
|
|
6813
|
+
);
|
|
6806
6814
|
return void 0;
|
|
6807
6815
|
}
|
|
6808
6816
|
return filtered;
|
|
@@ -8851,11 +8859,12 @@ const getLogger = (level = "warn", name) => (text, type = "debug") => log(text,
|
|
|
8851
8859
|
const PLUGIN_NAME$2 = "global-context-plugin";
|
|
8852
8860
|
const getGlobalContextPlugin = (opts, meta) => {
|
|
8853
8861
|
const log = getLogger(opts.logLevel, "internal-global-context");
|
|
8862
|
+
const cwd = process.cwd();
|
|
8854
8863
|
const globalContext = {
|
|
8855
8864
|
auth: opts.auth,
|
|
8856
|
-
cwd
|
|
8865
|
+
cwd,
|
|
8857
8866
|
version: meta.version,
|
|
8858
|
-
outputDir:
|
|
8867
|
+
outputDir: cwd,
|
|
8859
8868
|
bundler: {
|
|
8860
8869
|
name: meta.framework
|
|
8861
8870
|
}
|
|
@@ -8869,6 +8878,9 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
8869
8878
|
if (build.initialOptions.outdir) {
|
|
8870
8879
|
globalContext.outputDir = build.initialOptions.outdir;
|
|
8871
8880
|
}
|
|
8881
|
+
if (build.initialOptions.outfile) {
|
|
8882
|
+
globalContext.outputDir = path$h.dirname(build.initialOptions.outfile);
|
|
8883
|
+
}
|
|
8872
8884
|
build.initialOptions.metafile = true;
|
|
8873
8885
|
build.onEnd((result) => {
|
|
8874
8886
|
if (!result.metafile) {
|
|
@@ -8877,7 +8889,7 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
8877
8889
|
}
|
|
8878
8890
|
const files = [];
|
|
8879
8891
|
for (const [output] of Object.entries(result.metafile.outputs)) {
|
|
8880
|
-
files.push({ filepath:
|
|
8892
|
+
files.push({ filepath: path$h.join(cwd, output) });
|
|
8881
8893
|
}
|
|
8882
8894
|
globalContext.outputFiles = files;
|
|
8883
8895
|
});
|
|
@@ -8891,7 +8903,7 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
8891
8903
|
compiler.hooks.emit.tap(PLUGIN_NAME$2, (compilation) => {
|
|
8892
8904
|
const files = [];
|
|
8893
8905
|
for (const filename of Object.keys(compilation.assets)) {
|
|
8894
|
-
files.push({ filepath:
|
|
8906
|
+
files.push({ filepath: path$h.join(globalContext.outputDir, filename) });
|
|
8895
8907
|
}
|
|
8896
8908
|
globalContext.outputFiles = files;
|
|
8897
8909
|
});
|
|
@@ -8899,11 +8911,35 @@ const getGlobalContextPlugin = (opts, meta) => {
|
|
|
8899
8911
|
vite: {
|
|
8900
8912
|
options(options) {
|
|
8901
8913
|
globalContext.bundler.config = options;
|
|
8914
|
+
},
|
|
8915
|
+
outputOptions(options) {
|
|
8916
|
+
if (options.dir) {
|
|
8917
|
+
globalContext.outputDir = options.dir;
|
|
8918
|
+
}
|
|
8919
|
+
},
|
|
8920
|
+
writeBundle(options, bundle) {
|
|
8921
|
+
const files = [];
|
|
8922
|
+
for (const filename of Object.keys(bundle)) {
|
|
8923
|
+
files.push({ filepath: path$h.join(globalContext.outputDir, filename) });
|
|
8924
|
+
}
|
|
8925
|
+
globalContext.outputFiles = files;
|
|
8902
8926
|
}
|
|
8903
8927
|
},
|
|
8904
8928
|
rollup: {
|
|
8905
8929
|
options(options) {
|
|
8906
8930
|
globalContext.bundler.config = options;
|
|
8931
|
+
},
|
|
8932
|
+
outputOptions(options) {
|
|
8933
|
+
if (options.dir) {
|
|
8934
|
+
globalContext.outputDir = options.dir;
|
|
8935
|
+
}
|
|
8936
|
+
},
|
|
8937
|
+
writeBundle(options, bundle) {
|
|
8938
|
+
const files = [];
|
|
8939
|
+
for (const filename of Object.keys(bundle)) {
|
|
8940
|
+
files.push({ filepath: path$h.join(globalContext.outputDir, filename) });
|
|
8941
|
+
}
|
|
8942
|
+
globalContext.outputFiles = files;
|
|
8907
8943
|
}
|
|
8908
8944
|
},
|
|
8909
8945
|
rspack(compiler) {
|
|
@@ -9091,12 +9127,12 @@ if (typeof module !== "undefined") {
|
|
|
9091
9127
|
}
|
|
9092
9128
|
|
|
9093
9129
|
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
9094
|
-
if (
|
|
9130
|
+
if (path$h.extname(sourcemapFilePath) !== ".map") {
|
|
9095
9131
|
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
9096
9132
|
}
|
|
9097
9133
|
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
9098
9134
|
const relativePath = minifiedFilePath.replace(context.outputDir, "");
|
|
9099
|
-
const minifiedUrl = options.minifiedPathPrefix ?
|
|
9135
|
+
const minifiedUrl = options.minifiedPathPrefix ? path$h.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
9100
9136
|
return {
|
|
9101
9137
|
minifiedFilePath,
|
|
9102
9138
|
minifiedUrl,
|
|
@@ -9118,6 +9154,17 @@ const getSourcemapsFiles = (options, context) => {
|
|
|
9118
9154
|
return sourcemapFiles;
|
|
9119
9155
|
};
|
|
9120
9156
|
|
|
9157
|
+
const formatDuration = (duration) => {
|
|
9158
|
+
const days = Math.floor(duration / 1e3 / 60 / 60 / 24);
|
|
9159
|
+
const usedDuration = duration - days * 24 * 60 * 60 * 1e3;
|
|
9160
|
+
const d = new Date(usedDuration);
|
|
9161
|
+
const hours = d.getUTCHours();
|
|
9162
|
+
const minutes = d.getUTCMinutes();
|
|
9163
|
+
const seconds = d.getUTCSeconds();
|
|
9164
|
+
const milliseconds = d.getUTCMilliseconds();
|
|
9165
|
+
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds}ms`.trim();
|
|
9166
|
+
};
|
|
9167
|
+
|
|
9121
9168
|
var retry$4 = {};
|
|
9122
9169
|
|
|
9123
9170
|
function RetryOperation(timeouts, options) {
|
|
@@ -10209,8 +10256,8 @@ var _default = dist.default = PQueue;
|
|
|
10209
10256
|
|
|
10210
10257
|
const SLASH_RX = /[/]+|[\\]+/g;
|
|
10211
10258
|
const SLASH_TRIM_RX = /^[/]+|^[\\]+|[/]+$|[\\]+$/g;
|
|
10212
|
-
const prefixRepeat = (
|
|
10213
|
-
const pathParts =
|
|
10259
|
+
const prefixRepeat = (filePath, prefix) => {
|
|
10260
|
+
const pathParts = filePath.replace(SLASH_TRIM_RX, "").split(SLASH_RX);
|
|
10214
10261
|
const prefixParts = prefix.replace(SLASH_TRIM_RX, "").split(SLASH_RX);
|
|
10215
10262
|
const normalizedPath = pathParts.join("/");
|
|
10216
10263
|
let result = "";
|
|
@@ -10222,13 +10269,13 @@ const prefixRepeat = (path, prefix) => {
|
|
|
10222
10269
|
}
|
|
10223
10270
|
return result;
|
|
10224
10271
|
};
|
|
10225
|
-
const checkFile = async (
|
|
10272
|
+
const checkFile = async (filePath) => {
|
|
10226
10273
|
const validity = {
|
|
10227
10274
|
empty: false,
|
|
10228
10275
|
exists: true
|
|
10229
10276
|
};
|
|
10230
10277
|
try {
|
|
10231
|
-
const stats = await fs$j.promises.stat(
|
|
10278
|
+
const stats = await fs$j.promises.stat(filePath);
|
|
10232
10279
|
if (stats.size === 0) {
|
|
10233
10280
|
validity.empty = true;
|
|
10234
10281
|
}
|
|
@@ -10303,7 +10350,7 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
10303
10350
|
sourcemap.sourcemapFilePath,
|
|
10304
10351
|
(reason) => {
|
|
10305
10352
|
warnings.push(
|
|
10306
|
-
|
|
10353
|
+
`${path$h.basename(sourcemap.sourcemapFilePath)}: "${reason}"`
|
|
10307
10354
|
);
|
|
10308
10355
|
}
|
|
10309
10356
|
),
|
|
@@ -10344,6 +10391,8 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
10344
10391
|
const errorCodesNoRetry = [400, 403, 413];
|
|
10345
10392
|
const nbRetries = 5;
|
|
10346
10393
|
const green = chalk.green.bold;
|
|
10394
|
+
const yellow = chalk.yellow.bold;
|
|
10395
|
+
const red = chalk.red.bold;
|
|
10347
10396
|
const doRequest = async (url, getData2, onRetry) => {
|
|
10348
10397
|
return retry$2(
|
|
10349
10398
|
async (bail, attempt) => {
|
|
@@ -10359,23 +10408,23 @@ const doRequest = async (url, getData2, onRetry) => {
|
|
|
10359
10408
|
duplex: "half"
|
|
10360
10409
|
});
|
|
10361
10410
|
} catch (error) {
|
|
10362
|
-
bail(
|
|
10411
|
+
bail(error);
|
|
10363
10412
|
return;
|
|
10364
10413
|
}
|
|
10365
10414
|
if (!response.ok) {
|
|
10366
|
-
const
|
|
10415
|
+
const errorMessage = `HTTP ${response.status} ${response.statusText}`;
|
|
10367
10416
|
if (errorCodesNoRetry.includes(response.status)) {
|
|
10368
|
-
bail(new Error(
|
|
10417
|
+
bail(new Error(errorMessage));
|
|
10369
10418
|
return;
|
|
10370
10419
|
} else {
|
|
10371
|
-
throw new Error(
|
|
10420
|
+
throw new Error(errorMessage);
|
|
10372
10421
|
}
|
|
10373
10422
|
}
|
|
10374
10423
|
try {
|
|
10375
10424
|
const result = await response.json();
|
|
10376
10425
|
return result;
|
|
10377
10426
|
} catch (error) {
|
|
10378
|
-
bail(
|
|
10427
|
+
bail(error);
|
|
10379
10428
|
}
|
|
10380
10429
|
},
|
|
10381
10430
|
{
|
|
@@ -10416,12 +10465,15 @@ const getData$1 = (payload, defaultHeaders = {}) => async () => {
|
|
|
10416
10465
|
return { data, headers };
|
|
10417
10466
|
};
|
|
10418
10467
|
const upload = async (payloads, options, context, log) => {
|
|
10468
|
+
const errors = [];
|
|
10469
|
+
const warnings = [];
|
|
10419
10470
|
if (!context.auth?.apiKey) {
|
|
10420
|
-
|
|
10471
|
+
errors.push({ error: new Error("No authentication token provided") });
|
|
10472
|
+
return { errors, warnings };
|
|
10421
10473
|
}
|
|
10422
10474
|
if (payloads.length === 0) {
|
|
10423
|
-
|
|
10424
|
-
return;
|
|
10475
|
+
warnings.push("No sourcemaps to upload");
|
|
10476
|
+
return { errors, warnings };
|
|
10425
10477
|
}
|
|
10426
10478
|
const queue = new _default({ concurrency: options.maxConcurrency });
|
|
10427
10479
|
const defaultHeaders = {
|
|
@@ -10429,6 +10481,7 @@ const upload = async (payloads, options, context, log) => {
|
|
|
10429
10481
|
"DD-EVP-ORIGIN": `${context.bundler.name}-build-plugin_sourcemaps`,
|
|
10430
10482
|
"DD-EVP-ORIGIN-VERSION": context.version
|
|
10431
10483
|
};
|
|
10484
|
+
const addPromises = [];
|
|
10432
10485
|
for (const payload of payloads) {
|
|
10433
10486
|
const metadata = {
|
|
10434
10487
|
sourcemap: payload.content.get("source_map")?.path.replace(
|
|
@@ -10441,24 +10494,37 @@ const upload = async (payloads, options, context, log) => {
|
|
|
10441
10494
|
)
|
|
10442
10495
|
};
|
|
10443
10496
|
log(`Queuing ${green(metadata.sourcemap)} | ${green(metadata.file)}`);
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10497
|
+
addPromises.push(
|
|
10498
|
+
queue.add(async () => {
|
|
10499
|
+
try {
|
|
10500
|
+
await doRequest(
|
|
10501
|
+
options.intakeUrl,
|
|
10502
|
+
getData$1(payload, defaultHeaders),
|
|
10503
|
+
// On retry we store the error as a warning.
|
|
10504
|
+
(error, attempt) => {
|
|
10505
|
+
const warningMessage = `Failed to upload ${yellow(metadata.sourcemap)} | ${yellow(metadata.file)}:
|
|
10506
|
+
${error.message}
|
|
10507
|
+
Retrying ${attempt}/${nbRetries}`;
|
|
10508
|
+
warnings.push(warningMessage);
|
|
10509
|
+
log(warningMessage, "warn");
|
|
10510
|
+
}
|
|
10453
10511
|
);
|
|
10512
|
+
log(`Sent ${green(metadata.sourcemap)} | ${green(metadata.file)}`);
|
|
10513
|
+
} catch (e) {
|
|
10514
|
+
errors.push({ metadata, error: e });
|
|
10515
|
+
if (options.bailOnError === true) {
|
|
10516
|
+
throw e;
|
|
10517
|
+
}
|
|
10454
10518
|
}
|
|
10455
|
-
)
|
|
10456
|
-
|
|
10457
|
-
});
|
|
10519
|
+
})
|
|
10520
|
+
);
|
|
10458
10521
|
}
|
|
10459
|
-
|
|
10522
|
+
await Promise.all(addPromises);
|
|
10523
|
+
await queue.onIdle();
|
|
10524
|
+
return { warnings, errors };
|
|
10460
10525
|
};
|
|
10461
10526
|
const sendSourcemaps = async (sourcemaps, options, context, log) => {
|
|
10527
|
+
const start = Date.now();
|
|
10462
10528
|
const prefix = options.minifiedPathPrefix;
|
|
10463
10529
|
const metadata = {
|
|
10464
10530
|
git_repository_url: context.git?.remote,
|
|
@@ -10474,22 +10540,47 @@ const sendSourcemaps = async (sourcemaps, options, context, log) => {
|
|
|
10474
10540
|
);
|
|
10475
10541
|
const errors = payloads.map((payload) => payload.errors).flat();
|
|
10476
10542
|
const warnings = payloads.map((payload) => payload.warnings).flat();
|
|
10543
|
+
if (warnings.length > 0) {
|
|
10544
|
+
log(`Warnings while preparing payloads:
|
|
10545
|
+
- ${warnings.join("\n - ")}`, "warn");
|
|
10546
|
+
}
|
|
10477
10547
|
if (errors.length > 0) {
|
|
10478
|
-
const errorMsg = `Failed to upload
|
|
10548
|
+
const errorMsg = `Failed to prepare payloads, aborting upload :
|
|
10479
10549
|
- ${errors.join("\n - ")}`;
|
|
10480
10550
|
log(errorMsg, "error");
|
|
10481
|
-
|
|
10551
|
+
if (options.bailOnError === true) {
|
|
10552
|
+
throw new Error(errorMsg);
|
|
10553
|
+
}
|
|
10554
|
+
return;
|
|
10555
|
+
}
|
|
10556
|
+
const { errors: uploadErrors, warnings: uploadWarnings } = await upload(
|
|
10557
|
+
payloads,
|
|
10558
|
+
options,
|
|
10559
|
+
context,
|
|
10560
|
+
log
|
|
10561
|
+
);
|
|
10562
|
+
log(
|
|
10563
|
+
`Done uploading ${green(sourcemaps.length.toString())} sourcemaps in ${green(formatDuration(Date.now() - start))}.`,
|
|
10564
|
+
"info"
|
|
10565
|
+
);
|
|
10566
|
+
if (uploadErrors.length > 0) {
|
|
10567
|
+
const listOfErrors = ` - ${uploadErrors.map(({ metadata: fileMetadata, error }) => {
|
|
10568
|
+
if (fileMetadata) {
|
|
10569
|
+
return `${red(fileMetadata.file)} | ${red(fileMetadata.sourcemap)} : ${error.message}`;
|
|
10570
|
+
}
|
|
10571
|
+
return error.message;
|
|
10572
|
+
}).join("\n - ")}`;
|
|
10573
|
+
const errorMsg = `Failed to upload some sourcemaps:
|
|
10574
|
+
${listOfErrors}`;
|
|
10575
|
+
log(errorMsg, "error");
|
|
10576
|
+
if (options.bailOnError === true) {
|
|
10577
|
+
throw new Error(errorMsg);
|
|
10578
|
+
}
|
|
10482
10579
|
}
|
|
10483
|
-
if (
|
|
10580
|
+
if (uploadWarnings.length > 0) {
|
|
10484
10581
|
log(`Warnings while uploading sourcemaps:
|
|
10485
10582
|
- ${warnings.join("\n - ")}`, "warn");
|
|
10486
10583
|
}
|
|
10487
|
-
try {
|
|
10488
|
-
await upload(payloads, options, context, log);
|
|
10489
|
-
} catch (error) {
|
|
10490
|
-
log(`Failed to upload sourcemaps: ${error.message}`, "error");
|
|
10491
|
-
throw error;
|
|
10492
|
-
}
|
|
10493
10584
|
};
|
|
10494
10585
|
|
|
10495
10586
|
const uploadSourcemaps = async (options, context, log) => {
|
|
@@ -10505,13 +10596,14 @@ const uploadSourcemaps = async (options, context, log) => {
|
|
|
10505
10596
|
};
|
|
10506
10597
|
|
|
10507
10598
|
const defaultIntakeUrl = `https://sourcemap-intake.${process.env.DATADOG_SITE || "datadoghq.com"}/api/v2/srcmap`;
|
|
10508
|
-
const validateOptions$1 = (config) => {
|
|
10599
|
+
const validateOptions$1 = (config, log) => {
|
|
10509
10600
|
const errors = [];
|
|
10510
10601
|
const sourcemapsResults = validateSourcemapsOptions(config);
|
|
10511
10602
|
errors.push(...sourcemapsResults.errors);
|
|
10512
10603
|
if (errors.length) {
|
|
10513
|
-
|
|
10514
|
-
- ${errors.join("\n - ")}
|
|
10604
|
+
log(`
|
|
10605
|
+
- ${errors.join("\n - ")}`, "error");
|
|
10606
|
+
throw new Error(`Invalid configuration for ${PLUGIN_NAME$1}.`);
|
|
10515
10607
|
}
|
|
10516
10608
|
const toReturn = {
|
|
10517
10609
|
...config[CONFIG_KEY$1],
|
|
@@ -10558,6 +10650,7 @@ const validateSourcemapsOptions = (config) => {
|
|
|
10558
10650
|
}
|
|
10559
10651
|
}
|
|
10560
10652
|
const sourcemapsWithDefaults = {
|
|
10653
|
+
bailOnError: false,
|
|
10561
10654
|
dryRun: false,
|
|
10562
10655
|
maxConcurrency: 20,
|
|
10563
10656
|
intakeUrl: process.env.DATADOG_SOURCEMAP_INTAKE_URL || validatedOptions.sourcemaps.intakeUrl || defaultIntakeUrl,
|
|
@@ -10568,11 +10661,9 @@ const validateSourcemapsOptions = (config) => {
|
|
|
10568
10661
|
return toReturn;
|
|
10569
10662
|
};
|
|
10570
10663
|
|
|
10571
|
-
const helpers$2 = {
|
|
10572
|
-
// Add the helpers you'd like to expose here.
|
|
10573
|
-
};
|
|
10574
10664
|
const getPlugins$2 = (opts, context) => {
|
|
10575
|
-
const
|
|
10665
|
+
const log = getLogger(opts.logLevel, PLUGIN_NAME$1);
|
|
10666
|
+
const rumOptions = validateOptions$1(opts, log);
|
|
10576
10667
|
return [
|
|
10577
10668
|
{
|
|
10578
10669
|
name: PLUGIN_NAME$1,
|
|
@@ -10580,7 +10671,6 @@ const getPlugins$2 = (opts, context) => {
|
|
|
10580
10671
|
if (rumOptions.disabled) {
|
|
10581
10672
|
return;
|
|
10582
10673
|
}
|
|
10583
|
-
const log = getLogger(opts.logLevel, PLUGIN_NAME$1);
|
|
10584
10674
|
if (rumOptions.sourcemaps) {
|
|
10585
10675
|
await uploadSourcemaps(rumOptions, context, log);
|
|
10586
10676
|
}
|
|
@@ -11717,7 +11807,7 @@ function retry () {
|
|
|
11717
11807
|
};
|
|
11718
11808
|
} (fs$i));
|
|
11719
11809
|
|
|
11720
|
-
const path$g =
|
|
11810
|
+
const path$g = path$h;
|
|
11721
11811
|
|
|
11722
11812
|
// get drive on windows
|
|
11723
11813
|
function getRootPath (p) {
|
|
@@ -11742,7 +11832,7 @@ var win32 = {
|
|
|
11742
11832
|
};
|
|
11743
11833
|
|
|
11744
11834
|
const fs$g = gracefulFs;
|
|
11745
|
-
const path$f =
|
|
11835
|
+
const path$f = path$h;
|
|
11746
11836
|
const invalidWin32Path$1 = win32.invalidWin32Path;
|
|
11747
11837
|
|
|
11748
11838
|
const o777$1 = parseInt('0777', 8);
|
|
@@ -11804,7 +11894,7 @@ function mkdirs$2 (p, opts, callback, made) {
|
|
|
11804
11894
|
var mkdirs_1$1 = mkdirs$2;
|
|
11805
11895
|
|
|
11806
11896
|
const fs$f = gracefulFs;
|
|
11807
|
-
const path$e =
|
|
11897
|
+
const path$e = path$h;
|
|
11808
11898
|
const invalidWin32Path = win32.invalidWin32Path;
|
|
11809
11899
|
|
|
11810
11900
|
const o777 = parseInt('0777', 8);
|
|
@@ -11872,7 +11962,7 @@ var mkdirs_1 = {
|
|
|
11872
11962
|
|
|
11873
11963
|
const fs$e = gracefulFs;
|
|
11874
11964
|
const os = require$$0$1;
|
|
11875
|
-
const path$d =
|
|
11965
|
+
const path$d = path$h;
|
|
11876
11966
|
|
|
11877
11967
|
// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
|
|
11878
11968
|
function hasMillisResSync () {
|
|
@@ -11961,7 +12051,7 @@ var buffer$1 = function (size) {
|
|
|
11961
12051
|
};
|
|
11962
12052
|
|
|
11963
12053
|
const fs$d = gracefulFs;
|
|
11964
|
-
const path$c =
|
|
12054
|
+
const path$c = path$h;
|
|
11965
12055
|
const mkdirpSync$1 = mkdirs_1.mkdirsSync;
|
|
11966
12056
|
const utimesSync = utimes$1.utimesMillisSync;
|
|
11967
12057
|
|
|
@@ -12169,7 +12259,7 @@ var pathExists_1 = {
|
|
|
12169
12259
|
};
|
|
12170
12260
|
|
|
12171
12261
|
const fs$b = gracefulFs;
|
|
12172
|
-
const path$b =
|
|
12262
|
+
const path$b = path$h;
|
|
12173
12263
|
const mkdirp$1 = mkdirs_1.mkdirs;
|
|
12174
12264
|
const pathExists$7 = pathExists_1.pathExists;
|
|
12175
12265
|
const utimes = utimes$1.utimesMillis;
|
|
@@ -12419,7 +12509,7 @@ var copy$1 = {
|
|
|
12419
12509
|
};
|
|
12420
12510
|
|
|
12421
12511
|
const fs$a = gracefulFs;
|
|
12422
|
-
const path$a =
|
|
12512
|
+
const path$a = path$h;
|
|
12423
12513
|
const assert = require$$5;
|
|
12424
12514
|
|
|
12425
12515
|
const isWindows = (process.platform === 'win32');
|
|
@@ -12741,7 +12831,7 @@ var remove$3 = {
|
|
|
12741
12831
|
|
|
12742
12832
|
const u$7 = universalify.fromCallback;
|
|
12743
12833
|
const fs$9 = fs$j;
|
|
12744
|
-
const path$9 =
|
|
12834
|
+
const path$9 = path$h;
|
|
12745
12835
|
const mkdir$5 = mkdirs_1;
|
|
12746
12836
|
const remove$2 = remove$3;
|
|
12747
12837
|
|
|
@@ -12787,7 +12877,7 @@ var empty$2 = {
|
|
|
12787
12877
|
};
|
|
12788
12878
|
|
|
12789
12879
|
const u$6 = universalify.fromCallback;
|
|
12790
|
-
const path$8 =
|
|
12880
|
+
const path$8 = path$h;
|
|
12791
12881
|
const fs$8 = gracefulFs;
|
|
12792
12882
|
const mkdir$4 = mkdirs_1;
|
|
12793
12883
|
const pathExists$6 = pathExists_1.pathExists;
|
|
@@ -12835,7 +12925,7 @@ var file$1 = {
|
|
|
12835
12925
|
};
|
|
12836
12926
|
|
|
12837
12927
|
const u$5 = universalify.fromCallback;
|
|
12838
|
-
const path$7 =
|
|
12928
|
+
const path$7 = path$h;
|
|
12839
12929
|
const fs$7 = gracefulFs;
|
|
12840
12930
|
const mkdir$3 = mkdirs_1;
|
|
12841
12931
|
const pathExists$5 = pathExists_1.pathExists;
|
|
@@ -12894,7 +12984,7 @@ var link$1 = {
|
|
|
12894
12984
|
createLinkSync
|
|
12895
12985
|
};
|
|
12896
12986
|
|
|
12897
|
-
const path$6 =
|
|
12987
|
+
const path$6 = path$h;
|
|
12898
12988
|
const fs$6 = gracefulFs;
|
|
12899
12989
|
const pathExists$4 = pathExists_1.pathExists;
|
|
12900
12990
|
|
|
@@ -13023,7 +13113,7 @@ var symlinkType_1 = {
|
|
|
13023
13113
|
};
|
|
13024
13114
|
|
|
13025
13115
|
const u$4 = universalify.fromCallback;
|
|
13026
|
-
const path$5 =
|
|
13116
|
+
const path$5 = path$h;
|
|
13027
13117
|
const fs$4 = gracefulFs;
|
|
13028
13118
|
const _mkdirs = mkdirs_1;
|
|
13029
13119
|
const mkdirs = _mkdirs.mkdirs;
|
|
@@ -13252,7 +13342,7 @@ var jsonfile = {
|
|
|
13252
13342
|
writeJsonSync: jsonFile$3.writeFileSync
|
|
13253
13343
|
};
|
|
13254
13344
|
|
|
13255
|
-
const path$4 =
|
|
13345
|
+
const path$4 = path$h;
|
|
13256
13346
|
const mkdir$2 = mkdirs_1;
|
|
13257
13347
|
const pathExists$2 = pathExists_1.pathExists;
|
|
13258
13348
|
const jsonFile$2 = jsonfile;
|
|
@@ -13279,7 +13369,7 @@ function outputJson (file, data, options, callback) {
|
|
|
13279
13369
|
var outputJson_1 = outputJson;
|
|
13280
13370
|
|
|
13281
13371
|
const fs$3 = gracefulFs;
|
|
13282
|
-
const path$3 =
|
|
13372
|
+
const path$3 = path$h;
|
|
13283
13373
|
const mkdir$1 = mkdirs_1;
|
|
13284
13374
|
const jsonFile$1 = jsonfile;
|
|
13285
13375
|
|
|
@@ -13311,7 +13401,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
13311
13401
|
var json = jsonFile;
|
|
13312
13402
|
|
|
13313
13403
|
const fs$2 = gracefulFs;
|
|
13314
|
-
const path$2 =
|
|
13404
|
+
const path$2 = path$h;
|
|
13315
13405
|
const copySync = copySync$1.copySync;
|
|
13316
13406
|
const removeSync = remove$3.removeSync;
|
|
13317
13407
|
const mkdirpSync = mkdirs_1.mkdirsSync;
|
|
@@ -13428,7 +13518,7 @@ var moveSync_1 = {
|
|
|
13428
13518
|
|
|
13429
13519
|
const u$1 = universalify.fromCallback;
|
|
13430
13520
|
const fs$1 = gracefulFs;
|
|
13431
|
-
const path$1 =
|
|
13521
|
+
const path$1 = path$h;
|
|
13432
13522
|
const copy = copy$1.copy;
|
|
13433
13523
|
const remove$1 = remove$3.remove;
|
|
13434
13524
|
const mkdirp = mkdirs_1.mkdirp;
|
|
@@ -13509,7 +13599,7 @@ var move_1 = {
|
|
|
13509
13599
|
|
|
13510
13600
|
const u = universalify.fromCallback;
|
|
13511
13601
|
const fs = gracefulFs;
|
|
13512
|
-
const path =
|
|
13602
|
+
const path = path$h;
|
|
13513
13603
|
const mkdir = mkdirs_1;
|
|
13514
13604
|
const pathExists = pathExists_1.pathExists;
|
|
13515
13605
|
|
|
@@ -13658,17 +13748,6 @@ const getValueContext = (args) => {
|
|
|
13658
13748
|
}));
|
|
13659
13749
|
};
|
|
13660
13750
|
|
|
13661
|
-
const formatDuration = (duration) => {
|
|
13662
|
-
const days = Math.floor(duration / 1e3 / 60 / 60 / 24);
|
|
13663
|
-
const usedDuration = duration - days * 24 * 60 * 60 * 1e3;
|
|
13664
|
-
const d = new Date(usedDuration);
|
|
13665
|
-
const hours = d.getUTCHours();
|
|
13666
|
-
const minutes = d.getUTCMinutes();
|
|
13667
|
-
const seconds = d.getUTCSeconds();
|
|
13668
|
-
const milliseconds = d.getUTCMilliseconds();
|
|
13669
|
-
return `${days ? `${days}d ` : ""}${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s ` : ""}${milliseconds}ms`.trim();
|
|
13670
|
-
};
|
|
13671
|
-
|
|
13672
13751
|
const outputFiles = async (context, outputOptions, log, cwd) => {
|
|
13673
13752
|
const { report, metrics, bundler } = context;
|
|
13674
13753
|
if (typeof outputOptions !== "string" && typeof outputOptions !== "object") {
|
|
@@ -13692,7 +13771,7 @@ const outputFiles = async (context, outputOptions, log, cwd) => {
|
|
|
13692
13771
|
} else {
|
|
13693
13772
|
destination = outputOptions;
|
|
13694
13773
|
}
|
|
13695
|
-
const outputPath =
|
|
13774
|
+
const outputPath = path$h.resolve(cwd, destination);
|
|
13696
13775
|
try {
|
|
13697
13776
|
const errors = {};
|
|
13698
13777
|
const filesToWrite = {};
|
|
@@ -13722,7 +13801,7 @@ const outputFiles = async (context, outputOptions, log, cwd) => {
|
|
|
13722
13801
|
const proms = Object.keys(filesToWrite).map((file) => {
|
|
13723
13802
|
const start = Date.now();
|
|
13724
13803
|
log(`Start writing ${file}.json.`);
|
|
13725
|
-
return writeFile(
|
|
13804
|
+
return writeFile(path$h.join(outputPath, `${file}.json`), filesToWrite[file].content).then(() => {
|
|
13726
13805
|
log(`Wrote ${file}.json in ${formatDuration(Date.now() - start)}`);
|
|
13727
13806
|
}).catch((e) => {
|
|
13728
13807
|
log(
|
|
@@ -13905,7 +13984,7 @@ const getInputsDependencies = (list, moduleName, deps = /* @__PURE__ */ new Set(
|
|
|
13905
13984
|
};
|
|
13906
13985
|
const getModulePath$1 = (fullPath, cwd) => {
|
|
13907
13986
|
const filePath = fullPath.replace("pnp:", "").replace(cwd, "");
|
|
13908
|
-
return getDisplayName(
|
|
13987
|
+
return getDisplayName(path$h.resolve(cwd, filePath), cwd);
|
|
13909
13988
|
};
|
|
13910
13989
|
const getIndexed$1 = (stats, cwd) => {
|
|
13911
13990
|
const inputsDependencies = {};
|
|
@@ -24708,7 +24787,7 @@ virtualStats.VirtualStats = VirtualStats;
|
|
|
24708
24787
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
24709
24788
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24710
24789
|
};
|
|
24711
|
-
const path_1 = __importDefault(
|
|
24790
|
+
const path_1 = __importDefault(path$h);
|
|
24712
24791
|
const virtual_stats_1 = virtualStats;
|
|
24713
24792
|
let inode = 45000000;
|
|
24714
24793
|
const ALL = 'all';
|
|
@@ -24992,7 +25071,7 @@ var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
|
24992
25071
|
|
|
24993
25072
|
// node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
|
|
24994
25073
|
var getFilename = () => url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
24995
|
-
var getDirname = () =>
|
|
25074
|
+
var getDirname = () => path$h.dirname(getFilename());
|
|
24996
25075
|
var __dirname$1 = /* @__PURE__ */ getDirname();
|
|
24997
25076
|
|
|
24998
25077
|
// node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -25744,8 +25823,8 @@ function remapping(input, loader, options) {
|
|
|
25744
25823
|
return new SourceMap(traceMappings(tree), opts);
|
|
25745
25824
|
}
|
|
25746
25825
|
function normalizeAbsolutePath(path6) {
|
|
25747
|
-
if (
|
|
25748
|
-
return
|
|
25826
|
+
if (path$h.isAbsolute(path6))
|
|
25827
|
+
return path$h.normalize(path6);
|
|
25749
25828
|
else
|
|
25750
25829
|
return path6;
|
|
25751
25830
|
}
|
|
@@ -25793,7 +25872,7 @@ var ExtToLoader = {
|
|
|
25793
25872
|
".txt": "text"
|
|
25794
25873
|
};
|
|
25795
25874
|
function guessLoader(code, id) {
|
|
25796
|
-
return ExtToLoader[
|
|
25875
|
+
return ExtToLoader[path$h.extname(id).toLowerCase()] || "js";
|
|
25797
25876
|
}
|
|
25798
25877
|
function unwrapLoader(loader, code, id) {
|
|
25799
25878
|
if (typeof loader === "function")
|
|
@@ -25867,8 +25946,8 @@ function createBuildContext(initialOptions) {
|
|
|
25867
25946
|
emitFile(emittedFile) {
|
|
25868
25947
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
25869
25948
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
25870
|
-
const outPath =
|
|
25871
|
-
const outDir =
|
|
25949
|
+
const outPath = path$h.resolve(initialOptions.outdir, outFileName);
|
|
25950
|
+
const outDir = path$h.dirname(outPath);
|
|
25872
25951
|
if (!fs$j.existsSync(outDir))
|
|
25873
25952
|
fs$j.mkdirSync(outDir, { recursive: true });
|
|
25874
25953
|
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
@@ -26069,7 +26148,7 @@ function buildSetup(meta) {
|
|
|
26069
26148
|
onLoad({ filter: onLoadFilter }, async (args) => {
|
|
26070
26149
|
const id = args.path + args.suffix;
|
|
26071
26150
|
const { errors, warnings, mixedContext } = createPluginContext(context);
|
|
26072
|
-
const resolveDir =
|
|
26151
|
+
const resolveDir = path$h.dirname(args.path);
|
|
26073
26152
|
let code, map;
|
|
26074
26153
|
if (plugin.load && (!plugin.loadInclude || plugin.loadInclude(id))) {
|
|
26075
26154
|
const result = await plugin.load.call(mixedContext, id);
|
|
@@ -26100,7 +26179,7 @@ function buildSetup(meta) {
|
|
|
26100
26179
|
if (plugin.transformInclude && !plugin.transformInclude(id))
|
|
26101
26180
|
return;
|
|
26102
26181
|
const { mixedContext, errors, warnings } = createPluginContext(context);
|
|
26103
|
-
const resolveDir =
|
|
26182
|
+
const resolveDir = path$h.dirname(args.path);
|
|
26104
26183
|
let code = await args.getContents();
|
|
26105
26184
|
let map;
|
|
26106
26185
|
const result = await plugin.transform.call(mixedContext, code, id);
|
|
@@ -26158,7 +26237,7 @@ function createFarmContext(context, currentResolveId) {
|
|
|
26158
26237
|
resolvedPath: outFileName,
|
|
26159
26238
|
name: outFileName,
|
|
26160
26239
|
content: [...buffer$2.Buffer.from(emittedFile.source)],
|
|
26161
|
-
resourceType:
|
|
26240
|
+
resourceType: path$h.extname(outFileName)
|
|
26162
26241
|
});
|
|
26163
26242
|
}
|
|
26164
26243
|
},
|
|
@@ -26192,7 +26271,7 @@ var ExtToLoader2 = {
|
|
|
26192
26271
|
".node": "napi"
|
|
26193
26272
|
};
|
|
26194
26273
|
function guessIdLoader(id) {
|
|
26195
|
-
return ExtToLoader2[
|
|
26274
|
+
return ExtToLoader2[path$h.extname(id).toLowerCase()] || "js";
|
|
26196
26275
|
}
|
|
26197
26276
|
function transformQuery(context) {
|
|
26198
26277
|
const queryParamsObject = {};
|
|
@@ -26282,7 +26361,7 @@ function toFarmPlugin(plugin, options) {
|
|
|
26282
26361
|
farmPlugin.resolve = {
|
|
26283
26362
|
filters: { sources: [".*", ...filters], importers: [".*"] },
|
|
26284
26363
|
async executor(params, context) {
|
|
26285
|
-
const resolvedIdPath =
|
|
26364
|
+
const resolvedIdPath = path$h.resolve(
|
|
26286
26365
|
process.cwd(),
|
|
26287
26366
|
params.importer ?? ""
|
|
26288
26367
|
);
|
|
@@ -26489,11 +26568,11 @@ function createBuildContext2(compilation) {
|
|
|
26489
26568
|
}
|
|
26490
26569
|
|
|
26491
26570
|
// src/rspack/index.ts
|
|
26492
|
-
var TRANSFORM_LOADER =
|
|
26571
|
+
var TRANSFORM_LOADER = path$h.resolve(
|
|
26493
26572
|
__dirname$1,
|
|
26494
26573
|
"rspack/loaders/transform"
|
|
26495
26574
|
);
|
|
26496
|
-
var LOAD_LOADER =
|
|
26575
|
+
var LOAD_LOADER = path$h.resolve(
|
|
26497
26576
|
__dirname$1,
|
|
26498
26577
|
"rspack/loaders/load"
|
|
26499
26578
|
);
|
|
@@ -26501,7 +26580,7 @@ function getRspackPlugin(factory) {
|
|
|
26501
26580
|
return (userOptions) => {
|
|
26502
26581
|
return {
|
|
26503
26582
|
apply(compiler) {
|
|
26504
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
26583
|
+
const VIRTUAL_MODULE_PREFIX = path$h.resolve(compiler.options.context ?? process.cwd(), "_virtual_");
|
|
26505
26584
|
const injected = compiler.$unpluginContext || {};
|
|
26506
26585
|
compiler.$unpluginContext = injected;
|
|
26507
26586
|
const meta = {
|
|
@@ -26611,7 +26690,7 @@ function createBuildContext3(options, compilation) {
|
|
|
26611
26690
|
});
|
|
26612
26691
|
},
|
|
26613
26692
|
addWatchFile(id) {
|
|
26614
|
-
options.addWatchFile(
|
|
26693
|
+
options.addWatchFile(path$h.resolve(process2.cwd(), id));
|
|
26615
26694
|
},
|
|
26616
26695
|
emitFile(emittedFile) {
|
|
26617
26696
|
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
@@ -26645,11 +26724,11 @@ function normalizeMessage(error) {
|
|
|
26645
26724
|
}
|
|
26646
26725
|
|
|
26647
26726
|
// src/webpack/index.ts
|
|
26648
|
-
var TRANSFORM_LOADER2 =
|
|
26727
|
+
var TRANSFORM_LOADER2 = path$h.resolve(
|
|
26649
26728
|
__dirname$1,
|
|
26650
26729
|
"webpack/loaders/transform"
|
|
26651
26730
|
);
|
|
26652
|
-
var LOAD_LOADER2 =
|
|
26731
|
+
var LOAD_LOADER2 = path$h.resolve(
|
|
26653
26732
|
__dirname$1,
|
|
26654
26733
|
"webpack/loaders/load"
|
|
26655
26734
|
);
|
|
@@ -26657,7 +26736,7 @@ function getWebpackPlugin(factory) {
|
|
|
26657
26736
|
return (userOptions) => {
|
|
26658
26737
|
return {
|
|
26659
26738
|
apply(compiler) {
|
|
26660
|
-
const VIRTUAL_MODULE_PREFIX =
|
|
26739
|
+
const VIRTUAL_MODULE_PREFIX = path$h.resolve(compiler.options.context ?? process2.cwd(), "_virtual_");
|
|
26661
26740
|
const injected = compiler.$unpluginContext || {};
|
|
26662
26741
|
compiler.$unpluginContext = injected;
|
|
26663
26742
|
const meta = {
|
|
@@ -26851,7 +26930,6 @@ function createUnplugin(factory) {
|
|
|
26851
26930
|
const helpers = {
|
|
26852
26931
|
// Each product should have a unique entry.
|
|
26853
26932
|
// #helpers-injection-marker
|
|
26854
|
-
[CONFIG_KEY$1]: helpers$2,
|
|
26855
26933
|
[CONFIG_KEY]: helpers$1
|
|
26856
26934
|
// #helpers-injection-marker
|
|
26857
26935
|
};
|
|
@@ -26859,6 +26937,9 @@ const buildPluginFactory = ({
|
|
|
26859
26937
|
version
|
|
26860
26938
|
}) => {
|
|
26861
26939
|
return createUnplugin((options, unpluginMetaContext) => {
|
|
26940
|
+
if ("esbuildHostName" in unpluginMetaContext) {
|
|
26941
|
+
unpluginMetaContext.esbuildHostName = "datadog-plugins";
|
|
26942
|
+
}
|
|
26862
26943
|
const { globalContext, internalPlugins } = getInternalPlugins(options, {
|
|
26863
26944
|
version,
|
|
26864
26945
|
...unpluginMetaContext
|
|
@@ -26876,7 +26957,7 @@ const buildPluginFactory = ({
|
|
|
26876
26957
|
|
|
26877
26958
|
var name = "@datadog/webpack-plugin";
|
|
26878
26959
|
var packageManager = "yarn@4.0.2";
|
|
26879
|
-
var version = "2.
|
|
26960
|
+
var version = "2.2.0-dev-1";
|
|
26880
26961
|
var license = "MIT";
|
|
26881
26962
|
var author = "Datadog";
|
|
26882
26963
|
var description = "Datadog Webpack Plugin";
|
|
@@ -26941,6 +27022,7 @@ var devDependencies = {
|
|
|
26941
27022
|
var peerDependencies = {
|
|
26942
27023
|
webpack: ">= 4.x < 6.x"
|
|
26943
27024
|
};
|
|
27025
|
+
var stableVersion = "2.1.0";
|
|
26944
27026
|
var pkg = {
|
|
26945
27027
|
name: name,
|
|
26946
27028
|
packageManager: packageManager,
|
|
@@ -26958,7 +27040,8 @@ var pkg = {
|
|
|
26958
27040
|
files: files,
|
|
26959
27041
|
scripts: scripts,
|
|
26960
27042
|
devDependencies: devDependencies,
|
|
26961
|
-
peerDependencies: peerDependencies
|
|
27043
|
+
peerDependencies: peerDependencies,
|
|
27044
|
+
stableVersion: stableVersion
|
|
26962
27045
|
};
|
|
26963
27046
|
|
|
26964
27047
|
const datadogWebpackPlugin = buildPluginFactory({
|