@jsenv/core 27.0.0-alpha.66 → 27.0.0-alpha.67

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/main.js CHANGED
@@ -13,7 +13,7 @@ import { parseJsUrls } from "@jsenv/utils/js_ast/parse_js_urls.js";
13
13
  import { resolveImport, normalizeImportMap, composeTwoImportMaps } from "@jsenv/importmap";
14
14
  import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js";
15
15
  import { applyNodeEsmResolution, defaultLookupPackageScope, defaultReadPackageJson, readCustomConditionsFromProcessArgs, applyFileSystemMagicResolution } from "@jsenv/node-esm-resolution";
16
- import { statSync, readdirSync, readFileSync, realpathSync, existsSync } from "node:fs";
16
+ import { statSync, realpathSync, readdirSync, readFileSync, existsSync } from "node:fs";
17
17
  import { pathToFileURL } from "node:url";
18
18
  import { ensurePathnameTrailingSlash, injectQueryParams, injectQueryParamsIntoSpecifier, normalizeUrl, setUrlFilename, asUrlWithoutSearch, asUrlUntilPathname } from "@jsenv/utils/urls/url_utils.js";
19
19
  import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js";
@@ -21,7 +21,6 @@ import { JS_QUOTES } from "@jsenv/utils/string/js_quotes.js";
21
21
  import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js";
22
22
  import { DataUrl } from "@jsenv/utils/urls/data_url.js";
23
23
  import { transpileWithParcel, minifyWithParcel } from "@jsenv/utils/css_ast/parcel_css.js";
24
- import { fetchOriginalUrlInfo } from "@jsenv/utils/graph/fetch_original_url_info.js";
25
24
  import { createRequire } from "node:module";
26
25
  import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js";
27
26
  import babelParser from "@babel/parser";
@@ -58,7 +57,7 @@ import { uneval } from "@jsenv/uneval";
58
57
  import { createVersionGenerator } from "@jsenv/utils/versioning/version_generator.js";
59
58
 
60
59
  const parseAndTransformHtmlUrls = async (urlInfo, context) => {
61
- const url = urlInfo.data.rawUrl || urlInfo.url;
60
+ const url = urlInfo.originalUrl;
62
61
  const content = urlInfo.content;
63
62
  const {
64
63
  scenario,
@@ -368,7 +367,7 @@ const parseAndTransformCssUrls = async (urlInfo, context) => {
368
367
  });
369
368
  }
370
369
  })],
371
- url: urlInfo.data.rawUrl || urlInfo.url,
370
+ url: urlInfo.originalUrl,
372
371
  content: urlInfo.content
373
372
  });
374
373
  await Promise.all(actions.map(action => action()));
@@ -409,7 +408,7 @@ const isWebWorkerUrlInfo = urlInfo => {
409
408
  const parseAndTransformJsUrls = async (urlInfo, context) => {
410
409
  const jsMentions = await parseJsUrls({
411
410
  js: urlInfo.content,
412
- url: urlInfo.data && urlInfo.data.rawUrl || urlInfo.url,
411
+ url: urlInfo.originalUrl,
413
412
  isJsModule: urlInfo.type === "js_module",
414
413
  isWebWorker: isWebWorkerUrlInfo(urlInfo)
415
414
  });
@@ -1110,36 +1109,33 @@ const jsenvPluginFileUrls = ({
1110
1109
  search,
1111
1110
  hash
1112
1111
  } = urlObject;
1113
-
1114
- const resolveSymlink = fileUrl => {
1115
- const realPath = realpathSync(new URL(fileUrl));
1116
- const realFileUrl = `${pathToFileURL(realPath)}${search}${hash}`;
1117
- return realFileUrl;
1118
- };
1119
-
1120
1112
  let {
1121
1113
  pathname
1122
1114
  } = urlObject;
1123
1115
  const pathnameUsesTrailingSlash = pathname.endsWith("/");
1124
1116
  urlObject.search = "";
1125
- urlObject.hash = ""; // force trailing slash on directories and remove eventual trailing slash on files
1117
+ urlObject.hash = "";
1118
+ const foundADirectory = stat && stat.isDirectory();
1119
+ const foundSomething = stat && !foundADirectory; // force trailing slash on directories
1126
1120
 
1127
- if (stat && stat.isDirectory()) {
1128
- reference.expectedType = "directory";
1121
+ if (foundADirectory && !pathnameUsesTrailingSlash) {
1122
+ urlObject.pathname = `${pathname}/`;
1123
+ } // otherwise remove trailing slash if any
1129
1124
 
1130
- if (!pathnameUsesTrailingSlash) {
1131
- urlObject.pathname = `${pathname}/`;
1132
- }
1133
-
1134
- if (directoryReferenceAllowed) {
1135
- return preservesSymlink ? urlObject.href : resolveSymlink(urlObject.href);
1136
- } // give a chane to magic resolution if enabled
1137
1125
 
1138
- } else if (pathnameUsesTrailingSlash) {
1139
- // a warning would be great because it's strange to reference a file with a trailing slash
1126
+ if (foundSomething && pathnameUsesTrailingSlash) {
1127
+ // a warning here? (because it's strange to reference a file with a trailing slash)
1140
1128
  urlObject.pathname = pathname.slice(0, -1);
1141
1129
  }
1142
1130
 
1131
+ if (foundADirectory && directoryReferenceAllowed) {
1132
+ reference.data.foundADirectory = true;
1133
+ const directoryFacadeUrl = urlObject.href;
1134
+ const directoryUrlRaw = preservesSymlink ? directoryFacadeUrl : resolveSymlink(directoryFacadeUrl);
1135
+ const directoryUrl = `${directoryUrlRaw}${search}${hash}`;
1136
+ return directoryUrl;
1137
+ }
1138
+
1143
1139
  const url = urlObject.href;
1144
1140
  const filesystemResolution = applyFileSystemMagicResolution(url, {
1145
1141
  fileStat: stat,
@@ -1148,12 +1144,15 @@ const jsenvPluginFileUrls = ({
1148
1144
  });
1149
1145
 
1150
1146
  if (!filesystemResolution.found) {
1147
+ reference.data.foundADirectory = foundADirectory;
1151
1148
  return null;
1152
1149
  }
1153
1150
 
1154
- const fileUrlRaw = filesystemResolution.url;
1151
+ reference.data.foundADirectory = filesystemResolution.isDirectory;
1152
+ const fileFacadeUrl = filesystemResolution.url;
1153
+ const fileUrlRaw = preservesSymlink ? fileFacadeUrl : resolveSymlink(fileFacadeUrl);
1155
1154
  const fileUrl = `${fileUrlRaw}${search}${hash}`;
1156
- return preservesSymlink ? fileUrl : resolveSymlink(fileUrl);
1155
+ return fileUrl;
1157
1156
  }
1158
1157
  }, {
1159
1158
  name: "jsenv:filesystem_resolution",
@@ -1207,7 +1206,7 @@ const jsenvPluginFileUrls = ({
1207
1206
 
1208
1207
  const urlObject = new URL(urlInfo.url);
1209
1208
 
1210
- if (context.reference.expectedType === "directory") {
1209
+ if (context.reference.data.foundADirectory) {
1211
1210
  if (directoryReferenceAllowed) {
1212
1211
  const directoryEntries = readdirSync(urlObject);
1213
1212
  let filename;
@@ -1228,7 +1227,7 @@ const jsenvPluginFileUrls = ({
1228
1227
  }
1229
1228
 
1230
1229
  const error = new Error("found a directory on filesystem");
1231
- error.code = "EISDIR";
1230
+ error.code = "DIRECTORY_REFERENCE_NOT_ALLOWED";
1232
1231
  throw error;
1233
1232
  }
1234
1233
 
@@ -1250,6 +1249,10 @@ const jsenvPluginFileUrls = ({
1250
1249
  }];
1251
1250
  };
1252
1251
 
1252
+ const resolveSymlink = fileUrl => {
1253
+ return pathToFileURL(realpathSync(new URL(fileUrl))).href;
1254
+ };
1255
+
1253
1256
  const jsenvPluginHttpUrls = () => {
1254
1257
  return {
1255
1258
  name: "jsenv:http_urls",
@@ -1435,7 +1438,7 @@ const jsenvPluginJsInlineContent = ({
1435
1438
  const parseAndTransformInlineContentCalls = async (urlInfo, context) => {
1436
1439
  const inlineContentInfos = await parseJsInlineContentInfos({
1437
1440
  js: urlInfo.content,
1438
- url: urlInfo.data && urlInfo.data.rawUrl || urlInfo.url,
1441
+ url: urlInfo.originalUrl,
1439
1442
  isJsModule: urlInfo.type === "js_module"
1440
1443
  });
1441
1444
 
@@ -1521,7 +1524,7 @@ const parseJsInlineContentInfos = async ({
1521
1524
  } = await applyBabelPlugins({
1522
1525
  babelPlugins: [babelPluginMetadataInlineContents],
1523
1526
  urlInfo: {
1524
- url,
1527
+ originalUrl: url,
1525
1528
  type: isJsModule ? "js_module" : "js_classic",
1526
1529
  content: js
1527
1530
  }
@@ -2628,7 +2631,7 @@ const jsenvPluginAsModules = () => {
2628
2631
  name: `jsenv:as_json_module`,
2629
2632
  appliesDuring: "*",
2630
2633
  fetchUrlContent: async (urlInfo, context) => {
2631
- const originalUrlInfo = await fetchOriginalUrlInfo({
2634
+ const originalUrlInfo = await context.fetchOriginalUrlInfo({
2632
2635
  urlInfo,
2633
2636
  context,
2634
2637
  searchParam: "as_json_module",
@@ -2641,6 +2644,8 @@ const jsenvPluginAsModules = () => {
2641
2644
 
2642
2645
  const jsonText = JSON.stringify(originalUrlInfo.content.trim());
2643
2646
  return {
2647
+ originalUrl: originalUrlInfo.originalUrl,
2648
+ originalContent: originalUrlInfo.originalContent,
2644
2649
  type: "js_module",
2645
2650
  contentType: "text/javascript",
2646
2651
  // here we could `export default ${jsonText}`:
@@ -2654,7 +2659,7 @@ const jsenvPluginAsModules = () => {
2654
2659
  name: `jsenv:as_css_module`,
2655
2660
  appliesDuring: "*",
2656
2661
  fetchUrlContent: async (urlInfo, context) => {
2657
- const originalUrlInfo = await fetchOriginalUrlInfo({
2662
+ const originalUrlInfo = await context.fetchOriginalUrlInfo({
2658
2663
  urlInfo,
2659
2664
  context,
2660
2665
  searchParam: "as_css_module",
@@ -2672,6 +2677,8 @@ const jsenvPluginAsModules = () => {
2672
2677
  canUseTemplateString: true
2673
2678
  });
2674
2679
  return {
2680
+ originalUrl: originalUrlInfo.originalUrl,
2681
+ originalContent: originalUrlInfo.originalContent,
2675
2682
  type: "js_module",
2676
2683
  contentType: "text/javascript",
2677
2684
  content: `import { InlineContent } from ${JSON.stringify(inlineContentClientFileUrl)}
@@ -2687,7 +2694,7 @@ const jsenvPluginAsModules = () => {
2687
2694
  name: `jsenv:as_text_module`,
2688
2695
  appliesDuring: "*",
2689
2696
  fetchUrlContent: async (urlInfo, context) => {
2690
- const originalUrlInfo = await fetchOriginalUrlInfo({
2697
+ const originalUrlInfo = await context.fetchOriginalUrlInfo({
2691
2698
  urlInfo,
2692
2699
  context,
2693
2700
  searchParam: "as_text_module",
@@ -2705,6 +2712,8 @@ const jsenvPluginAsModules = () => {
2705
2712
  canUseTemplateString: true
2706
2713
  });
2707
2714
  return {
2715
+ originalUrl: originalUrlInfo.originalUrl,
2716
+ originalContent: originalUrlInfo.originalContent,
2708
2717
  type: "js_module",
2709
2718
  contentType: "text/javascript",
2710
2719
  content: `import { InlineContent } from ${JSON.stringify(inlineContentClientFileUrl)}
@@ -3180,7 +3189,7 @@ const jsenvPluginAsJsClassicConversion = ({
3180
3189
  }
3181
3190
  },
3182
3191
  fetchUrlContent: async (urlInfo, context) => {
3183
- const originalUrlInfo = await fetchOriginalUrlInfo({
3192
+ const originalUrlInfo = await context.fetchOriginalUrlInfo({
3184
3193
  urlInfo,
3185
3194
  context,
3186
3195
  searchParam: "as_js_classic",
@@ -3216,6 +3225,8 @@ const jsenvPluginAsJsClassicConversion = ({
3216
3225
  });
3217
3226
  urlInfo.data.jsClassicFormat = jsClassicFormat;
3218
3227
  return {
3228
+ originalUrl: originalUrlInfo.originalUrl,
3229
+ originalContent: originalUrlInfo.originalContent,
3219
3230
  type: "js_classic",
3220
3231
  contentType: "text/javascript",
3221
3232
  content,
@@ -3269,6 +3280,8 @@ const convertJsModuleToJsClassic = async ({
3269
3280
  }], babelPluginTransformImportMetaUrl, require$3("@babel/plugin-transform-modules-umd")])],
3270
3281
  urlInfo
3271
3282
  });
3283
+ let sourcemap = urlInfo.sourcemap;
3284
+ sourcemap = await composeTwoSourcemaps(sourcemap, map);
3272
3285
 
3273
3286
  if (systemJsInjection && jsClassicFormat === "system" && isJsEntryPoint) {
3274
3287
  const magicSource = createMagicSource(code);
@@ -3276,19 +3289,17 @@ const convertJsModuleToJsClassic = async ({
3276
3289
  as: "string"
3277
3290
  });
3278
3291
  magicSource.prepend(`${systemjsCode}\n\n`);
3279
- const {
3280
- content,
3281
- sourcemap
3282
- } = magicSource.toContentAndSourcemap();
3292
+ const magicResult = magicSource.toContentAndSourcemap();
3293
+ sourcemap = await composeTwoSourcemaps(sourcemap, magicResult.sourcemap);
3283
3294
  return {
3284
- content,
3285
- sourcemap: await composeTwoSourcemaps(map, sourcemap)
3295
+ content: magicResult.content,
3296
+ sourcemap
3286
3297
  };
3287
3298
  }
3288
3299
 
3289
3300
  return {
3290
3301
  content: code,
3291
- sourcemap: map
3302
+ sourcemap
3292
3303
  };
3293
3304
  };
3294
3305
 
@@ -6353,8 +6364,9 @@ const createUrlInfo = url => {
6353
6364
  contentType: "",
6354
6365
  // "text/html", "text/css", "text/javascript", "application/json", ...
6355
6366
  url,
6356
- filename: "",
6367
+ originalUrl: undefined,
6357
6368
  generatedUrl: null,
6369
+ filename: "",
6358
6370
  isInline: false,
6359
6371
  inlineUrlSite: null,
6360
6372
  shouldHandle: undefined,
@@ -6698,7 +6710,7 @@ const createUrlInfoTransformer = ({
6698
6710
  sourcemapsSourcesContent || urlInfo.isInline || sourcemap.sources && sourcemap.sources.some(source => !source || !source.startsWith("file:"));
6699
6711
 
6700
6712
  if (sourcemap.sources && sourcemap.sources.length > 1) {
6701
- sourcemap.sources = sourcemap.sources.map(source => new URL(source, urlInfo.data.rawUrl || urlInfo.url).href);
6713
+ sourcemap.sources = sourcemap.sources.map(source => new URL(source, urlInfo.originalUrl).href);
6702
6714
 
6703
6715
  if (!wantSourcesContent) {
6704
6716
  sourcemap.sourcesContent = undefined;
@@ -6707,7 +6719,7 @@ const createUrlInfoTransformer = ({
6707
6719
  return sourcemap;
6708
6720
  }
6709
6721
 
6710
- sourcemap.sources = [urlInfo.data.rawUrl || urlInfo.url];
6722
+ sourcemap.sources = [urlInfo.originalUrl];
6711
6723
  sourcemap.sourcesContent = [urlInfo.originalContent];
6712
6724
 
6713
6725
  if (!wantSourcesContent) {
@@ -6743,6 +6755,7 @@ const createUrlInfoTransformer = ({
6743
6755
  sourcemapUrlInfo.isInline = sourcemaps === "inline"; // already loaded during "load" hook (happens during build)
6744
6756
 
6745
6757
  if (urlInfo.sourcemap) {
6758
+ urlInfo.sourcemap = normalizeSourcemap(urlInfo, urlInfo.sourcemap);
6746
6759
  return;
6747
6760
  } // check for existing sourcemap for this content
6748
6761
 
@@ -6771,8 +6784,9 @@ const createUrlInfoTransformer = ({
6771
6784
  await context.cook(sourcemapUrlInfo, {
6772
6785
  reference: sourcemapReference
6773
6786
  });
6774
- const sourcemap = JSON.parse(sourcemapUrlInfo.content);
6775
- urlInfo.sourcemap = normalizeSourcemap(urlInfo, sourcemap);
6787
+ const sourcemapRaw = JSON.parse(sourcemapUrlInfo.content);
6788
+ const sourcemap = normalizeSourcemap(urlInfo, sourcemapRaw);
6789
+ urlInfo.sourcemap = sourcemap;
6776
6790
  } catch (e) {
6777
6791
  logger.error(`Error while handling existing sourcemap: ${e.message}`);
6778
6792
  return;
@@ -6831,7 +6845,7 @@ const createUrlInfoTransformer = ({
6831
6845
  if (sourcemapsRelativeSources) {
6832
6846
  sourcemap.sources = sourcemap.sources.map(source => {
6833
6847
  const sourceRelative = urlToRelativeUrl(source, urlInfo.url);
6834
- return sourceRelative;
6848
+ return sourceRelative || ".";
6835
6849
  });
6836
6850
  }
6837
6851
 
@@ -6848,6 +6862,9 @@ const createUrlInfoTransformer = ({
6848
6862
  specifier: sourcemaps === "file" && sourcemapsRelativeSources ? urlToRelativeUrl(sourcemapReference.url, urlInfo.url) : sourcemapReference.generatedSpecifier
6849
6863
  });
6850
6864
  }
6865
+ } else if (urlInfo.sourcemapReference) {
6866
+ // in the end we don't use the sourcemap placeholder
6867
+ urlGraph.deleteUrlInfo(urlInfo.sourcemapReference.url);
6851
6868
  }
6852
6869
 
6853
6870
  urlInfo.contentEtag = bufferToEtag(Buffer.from(urlInfo.content));
@@ -6925,9 +6942,9 @@ const createFetchUrlContentError = ({
6925
6942
  });
6926
6943
  }
6927
6944
 
6928
- if (error.code === "EISDIR") {
6945
+ if (error.code === "DIRECTORY_REFERENCE_NOT_ALLOWED") {
6929
6946
  return createFailedToFetchUrlContentError({
6930
- code: "EISDIR",
6947
+ code: "DIRECTORY_REFERENCE_NOT_ALLOWED",
6931
6948
  reason: `found a directory on filesystem`
6932
6949
  });
6933
6950
  }
@@ -7293,6 +7310,7 @@ const createKitchen = ({
7293
7310
  type,
7294
7311
  subtype,
7295
7312
  contentType = "application/octet-stream",
7313
+ originalUrl,
7296
7314
  originalContent,
7297
7315
  content,
7298
7316
  sourcemap,
@@ -7307,8 +7325,9 @@ const createKitchen = ({
7307
7325
  type: urlInfo.type,
7308
7326
  subtype: urlInfo.subtype
7309
7327
  });
7310
- urlInfo.contentType = contentType; // during build urls info are reused and load returns originalContent
7328
+ urlInfo.contentType = contentType; // during build urls info are reused and load returns originalUrl/originalContent
7311
7329
 
7330
+ urlInfo.originalUrl = originalUrl || urlInfo.originalUrl;
7312
7331
  urlInfo.originalContent = originalContent === undefined ? content : originalContent;
7313
7332
  urlInfo.content = content;
7314
7333
  urlInfo.sourcemap = sourcemap;
@@ -7631,6 +7650,45 @@ const createKitchen = ({
7631
7650
  return [ref, urlInfo];
7632
7651
  };
7633
7652
 
7653
+ const fetchOriginalUrlInfo = async ({
7654
+ urlInfo,
7655
+ context,
7656
+ searchParam,
7657
+ expectedType
7658
+ }) => {
7659
+ const urlObject = new URL(urlInfo.url);
7660
+ const {
7661
+ searchParams
7662
+ } = urlObject;
7663
+
7664
+ if (!searchParams.has(searchParam)) {
7665
+ return null;
7666
+ }
7667
+
7668
+ searchParams.delete(searchParam);
7669
+ const originalUrl = urlObject.href;
7670
+ const originalReference = { ...(context.reference.original || context.reference),
7671
+ expectedType
7672
+ };
7673
+ originalReference.url = originalUrl;
7674
+ const originalUrlInfo = context.urlGraph.reuseOrCreateUrlInfo(originalReference.url);
7675
+
7676
+ if (originalUrlInfo.originalUrl === undefined) {
7677
+ applyReferenceEffectsOnUrlInfo(originalReference, originalUrlInfo, context);
7678
+ }
7679
+
7680
+ await context.fetchUrlContent(originalUrlInfo, {
7681
+ reference: originalReference
7682
+ });
7683
+
7684
+ if (originalUrlInfo.dependents.size === 0) {
7685
+ context.urlGraph.deleteUrlInfo(originalUrlInfo.url);
7686
+ }
7687
+
7688
+ return originalUrlInfo;
7689
+ };
7690
+
7691
+ kitchenContext.fetchOriginalUrlInfo = fetchOriginalUrlInfo;
7634
7692
  return {
7635
7693
  pluginController,
7636
7694
  urlInfoTransformer,
@@ -7686,6 +7744,7 @@ const applyReferenceEffectsOnUrlInfo = (reference, urlInfo, context) => {
7686
7744
  urlInfo.shouldHandle = true;
7687
7745
  }
7688
7746
 
7747
+ urlInfo.originalUrl = urlInfo.originalUrl || reference.url;
7689
7748
  Object.assign(urlInfo.data, reference.data);
7690
7749
  Object.assign(urlInfo.timing, reference.timing);
7691
7750
 
@@ -8074,7 +8133,7 @@ const createFileService = ({
8074
8133
  };
8075
8134
  }
8076
8135
 
8077
- if (code === "EISDIR") {
8136
+ if (code === "DIRECTORY_REFERENCE_NOT_ALLOWED") {
8078
8137
  return serveDirectory(reference.url, {
8079
8138
  headers: {
8080
8139
  accept: "text/html"
@@ -9233,7 +9292,7 @@ const executePlan = async (plan, {
9233
9292
  const executionSpinner = !debugLogsEnabled && executionLogsEnabled && process.stdout.isTTY && // if there is an error during execution npm will mess up the output
9234
9293
  // (happens when npm runs several command in a workspace)
9235
9294
  // so we enable spinner only when !process.exitCode (no error so far)
9236
- !process.exitCode;
9295
+ process.exitCode !== 1;
9237
9296
  const startMs = Date.now();
9238
9297
  const report = {};
9239
9298
  let rawOutput = "";
@@ -11750,7 +11809,7 @@ const resyncRessourceHints = async ({
11750
11809
  }
11751
11810
 
11752
11811
  if (urlInfo.dependents.size === 0) {
11753
- logger.warn(`remove ressource hint because "${href}" not used anymore`);
11812
+ logger.info(`remove ressource hint because "${href}" not used anymore`);
11754
11813
  actions.push(() => {
11755
11814
  removeHtmlNode(linkNode);
11756
11815
  });
@@ -11846,6 +11905,7 @@ const build = async ({
11846
11905
  },
11847
11906
  plugins = [],
11848
11907
  sourcemaps = false,
11908
+ sourcemapsSourcesContent,
11849
11909
  urlAnalysis = {},
11850
11910
  nodeEsmResolution,
11851
11911
  fileSystemMagicResolution,
@@ -11928,6 +11988,7 @@ build ${entryPointKeys.length} entry points`);
11928
11988
  urlGraph: rawGraph,
11929
11989
  scenario: "build",
11930
11990
  sourcemaps,
11991
+ sourcemapsSourcesContent,
11931
11992
  runtimeCompat,
11932
11993
  writeGeneratedFiles,
11933
11994
  plugins: [...plugins, {
@@ -12128,6 +12189,8 @@ build ${entryPointKeys.length} entry points`);
12128
12189
  type,
12129
12190
  subtype: rawUrlInfo ? rawUrlInfo.subtype : undefined,
12130
12191
  filename: rawUrlInfo ? rawUrlInfo.filename : undefined,
12192
+ originalUrl: rawUrlInfo ? rawUrlInfo.originalUrl : undefined,
12193
+ originalContent: rawUrlInfo ? rawUrlInfo.originalContent : undefined,
12131
12194
  ...bundlerGeneratedUrlInfo,
12132
12195
  data: { ...(rawUrlInfo ? rawUrlInfo.data : {}),
12133
12196
  ...bundlerGeneratedUrlInfo.data,
@@ -12173,6 +12236,7 @@ build ${entryPointKeys.length} entry points`);
12173
12236
  urlGraph: finalGraph,
12174
12237
  scenario: "build",
12175
12238
  sourcemaps,
12239
+ sourcemapsSourcesContent,
12176
12240
  sourcemapsRelativeSources: !versioning,
12177
12241
  runtimeCompat,
12178
12242
  writeGeneratedFiles,
@@ -12328,12 +12392,12 @@ build ${entryPointKeys.length} entry points`);
12328
12392
  urlInfo: rawUrlInfo,
12329
12393
  parentUrlInfo
12330
12394
  });
12395
+ rawUrls[buildUrl] = rawUrlInfo.url;
12331
12396
 
12332
12397
  if (buildUrl.includes("?")) {
12333
12398
  rawUrls[asUrlWithoutSearch(buildUrl)] = rawUrlInfo.url;
12334
12399
  }
12335
12400
 
12336
- rawUrls[buildUrl] = rawUrlInfo.url;
12337
12401
  return buildUrl;
12338
12402
  }
12339
12403
 
@@ -12504,6 +12568,7 @@ ${Object.keys(finalGraph.urlInfos).join("\n")}`);
12504
12568
  baseUrl,
12505
12569
  postBuildEntryUrls,
12506
12570
  sourcemaps,
12571
+ sourcemapsSourcesContent,
12507
12572
  runtimeCompat,
12508
12573
  writeGeneratedFiles,
12509
12574
  rawGraph,
@@ -12731,6 +12796,7 @@ const applyUrlVersioning = async ({
12731
12796
  baseUrl,
12732
12797
  postBuildEntryUrls,
12733
12798
  sourcemaps,
12799
+ sourcemapsSourcesContent,
12734
12800
  runtimeCompat,
12735
12801
  writeGeneratedFiles,
12736
12802
  rawGraph,
@@ -12833,6 +12899,7 @@ const applyUrlVersioning = async ({
12833
12899
  urlGraph: finalGraph,
12834
12900
  scenario: "build",
12835
12901
  sourcemaps,
12902
+ sourcemapsSourcesContent,
12836
12903
  sourcemapsRelativeSources: true,
12837
12904
  runtimeCompat,
12838
12905
  writeGeneratedFiles,