@jsenv/core 41.2.10 → 41.2.12

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.
@@ -2499,7 +2499,7 @@ const createUrlInfoTransformer = ({
2499
2499
  urlInfo.isInline ||
2500
2500
  (sources &&
2501
2501
  sources.some((source) => !source || !source.startsWith("file:")));
2502
- if (sources && sources.length > 1) {
2502
+ if (sources && sources.length > 0) {
2503
2503
  sourcemap.sources = sources.map(
2504
2504
  (source) => new URL(source, urlInfo.originalUrl).href,
2505
2505
  );
@@ -2508,6 +2508,11 @@ const createUrlInfoTransformer = ({
2508
2508
  }
2509
2509
  return sourcemap;
2510
2510
  }
2511
+ // No source info at all (e.g. an empty sourcemap): only then fall back
2512
+ // to describing this url as its own source. A single source is real
2513
+ // information (it can point at a different file entirely, e.g. a
2514
+ // bundled chunk whose only literal content comes from another module)
2515
+ // and must not be discarded in favor of this assumption.
2511
2516
  sourcemap.sources = [urlInfo.originalUrl];
2512
2517
  sourcemap.sourcesContent = [urlInfo.originalContent];
2513
2518
  if (!wantSourcesContent) {
@@ -10435,9 +10435,14 @@ const renderTable = (
10435
10435
  const cell = row[x];
10436
10436
  const { value, format } = cell;
10437
10437
 
10438
- if (format !== "size" && isFinite(value) && value !== "") {
10439
- if (value % 1 === 0) {
10440
- const { integer } = tokenizeInteger(Math.abs(value));
10438
+ const numericValue =
10439
+ typeof value === "string"
10440
+ ? Number(value.replace(/_/g, ""))
10441
+ : value;
10442
+ if (format !== "size" && isFinite(numericValue) && value !== "") {
10443
+ const isNegative = numericValue < 0;
10444
+ if (numericValue % 1 === 0) {
10445
+ const { integer } = tokenizeInteger(Math.abs(numericValue));
10441
10446
  const integerFormatted = groupDigits(integer);
10442
10447
  const integerWidth = measureTextWidth(integerFormatted);
10443
10448
  const largestIntegerInColumn =
@@ -10456,11 +10461,18 @@ const renderTable = (
10456
10461
  if (floatWidth) {
10457
10462
  integerText += " ".repeat(floatWidth);
10458
10463
  }
10464
+ if (isNegative) {
10465
+ const firstDigitIdx = integerText.search(/\S/);
10466
+ integerText =
10467
+ firstDigitIdx > 0
10468
+ ? `${integerText.slice(0, firstDigitIdx - 1)}-${integerText.slice(firstDigitIdx)}`
10469
+ : `-${integerText}`;
10470
+ }
10459
10471
  cell.updateValue(integerText);
10460
10472
  });
10461
10473
  } else {
10462
10474
  const { integer, decimalSeparator, decimal } = tokenizeFloat(
10463
- Math.abs(value),
10475
+ Math.abs(numericValue),
10464
10476
  );
10465
10477
  const integerFormatted = groupDigits(integer);
10466
10478
  const integerWidth = measureTextWidth(integerFormatted);
@@ -10484,6 +10496,13 @@ const renderTable = (
10484
10496
  const padding = floatColumnWidth - floatWidth;
10485
10497
  floatText += " ".repeat(padding - 1);
10486
10498
  }
10499
+ if (isNegative) {
10500
+ const firstDigitIdx = floatText.search(/\S/);
10501
+ floatText =
10502
+ firstDigitIdx > 0
10503
+ ? `${floatText.slice(0, firstDigitIdx - 1)}-${floatText.slice(firstDigitIdx)}`
10504
+ : `-${floatText}`;
10505
+ }
10487
10506
  cell.updateValue(floatText);
10488
10507
  });
10489
10508
  }
@@ -8322,7 +8322,7 @@ const createUrlInfoTransformer = ({
8322
8322
  urlInfo.isInline ||
8323
8323
  (sources &&
8324
8324
  sources.some((source) => !source || !source.startsWith("file:")));
8325
- if (sources && sources.length > 1) {
8325
+ if (sources && sources.length > 0) {
8326
8326
  sourcemap.sources = sources.map(
8327
8327
  (source) => new URL(source, urlInfo.originalUrl).href,
8328
8328
  );
@@ -8331,6 +8331,11 @@ const createUrlInfoTransformer = ({
8331
8331
  }
8332
8332
  return sourcemap;
8333
8333
  }
8334
+ // No source info at all (e.g. an empty sourcemap): only then fall back
8335
+ // to describing this url as its own source. A single source is real
8336
+ // information (it can point at a different file entirely, e.g. a
8337
+ // bundled chunk whose only literal content comes from another module)
8338
+ // and must not be discarded in favor of this assumption.
8334
8339
  sourcemap.sources = [urlInfo.originalUrl];
8335
8340
  sourcemap.sourcesContent = [urlInfo.originalContent];
8336
8341
  if (!wantSourcesContent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "41.2.10",
3
+ "version": "41.2.12",
4
4
  "type": "module",
5
5
  "description": "Tool to develop, test and build js projects",
6
6
  "repository": {
@@ -73,13 +73,13 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@jsenv/ast": "6.8.3",
76
- "@jsenv/js-module-fallback": "1.4.33",
77
- "@jsenv/plugin-bundling": "2.10.13",
76
+ "@jsenv/js-module-fallback": "1.4.34",
77
+ "@jsenv/plugin-bundling": "2.10.14",
78
78
  "@jsenv/plugin-minification": "1.7.4",
79
- "@jsenv/plugin-supervisor": "1.8.4",
80
- "@jsenv/plugin-transpilation": "1.5.75",
81
- "@jsenv/server": "17.3.0",
82
- "@jsenv/sourcemap": "1.3.19",
79
+ "@jsenv/plugin-supervisor": "1.8.5",
80
+ "@jsenv/plugin-transpilation": "1.5.76",
81
+ "@jsenv/server": "17.3.1",
82
+ "@jsenv/sourcemap": "1.4.0",
83
83
  "react-table": "7.8.0"
84
84
  },
85
85
  "devDependencies": {
@@ -59,7 +59,7 @@ export const createUrlInfoTransformer = ({
59
59
  urlInfo.isInline ||
60
60
  (sources &&
61
61
  sources.some((source) => !source || !source.startsWith("file:")));
62
- if (sources && sources.length > 1) {
62
+ if (sources && sources.length > 0) {
63
63
  sourcemap.sources = sources.map(
64
64
  (source) => new URL(source, urlInfo.originalUrl).href,
65
65
  );
@@ -68,6 +68,11 @@ export const createUrlInfoTransformer = ({
68
68
  }
69
69
  return sourcemap;
70
70
  }
71
+ // No source info at all (e.g. an empty sourcemap): only then fall back
72
+ // to describing this url as its own source. A single source is real
73
+ // information (it can point at a different file entirely, e.g. a
74
+ // bundled chunk whose only literal content comes from another module)
75
+ // and must not be discarded in favor of this assumption.
71
76
  sourcemap.sources = [urlInfo.originalUrl];
72
77
  sourcemap.sourcesContent = [urlInfo.originalContent];
73
78
  if (!wantSourcesContent) {