@jsenv/core 41.4.17 → 41.4.19
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/build/build.js +693 -509
- package/dist/build/jsenv_core_packages.js +3 -187
- package/dist/client/directory_listing/js/directory_listing.js +23 -2
- package/dist/start_dev_server/start_dev_server.js +813 -625
- package/package.json +8 -8
- package/src/build/build.js +66 -15
- package/src/build/build_content_report.js +24 -15
- package/src/build/build_specifier_manager.js +2 -2
- package/src/dev/dev_server_plugins/dev_server_plugin_omega_error_handler.js +4 -1
- package/src/dev/dev_server_plugins/dev_server_plugin_serve_source_files.js +116 -68
- package/src/dev/start_dev_server.js +24 -4
- package/src/helpers/watch_source_files.js +25 -20
- package/src/kitchen/kitchen.js +6 -0
- package/src/kitchen/prepend_content.js +4 -4
- package/src/kitchen/url_graph/references.js +30 -13
- package/src/kitchen/url_graph/url_graph.js +0 -1
- package/src/kitchen/url_graph/url_info_transformations.js +16 -6
- package/src/plugins/import_meta_css/jsenv_plugin_import_meta_css.js +10 -40
- package/src/plugins/import_meta_hot/import_meta_hot_analysis.js +70 -0
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +35 -20
- package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +22 -56
- package/src/plugins/modulepreload/jsenv_plugin_modulepreload.js +128 -0
- package/src/plugins/plugins.js +3 -0
- package/src/plugins/protocol_file/client/directory_listing.jsx +27 -1
- package/src/plugins/protocol_file/jsenv_plugin_directory_listing.js +20 -0
- package/src/plugins/protocol_file/jsenv_plugin_fs_redirection.js +32 -15
- package/src/plugins/protocol_file/jsenv_plugin_protocol_file.js +11 -2
- package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +1 -2
- package/src/plugins/resolution_node_esm/node_esm_resolver.js +0 -5
- package/src/plugins/import_meta_hot/babel_plugin_metadata_import_meta_hot.js +0 -97
|
@@ -3,8 +3,8 @@ import { extname } from "node:path";
|
|
|
3
3
|
import { readFileSync as readFileSync$1, existsSync, readdir, chmod, stat, lstat, chmodSync, statSync, lstatSync, promises, readdirSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, writeFileSync as writeFileSync$1, unlink, rmdir, watch, realpathSync } from "node:fs";
|
|
4
4
|
import crypto, { createHash } from "node:crypto";
|
|
5
5
|
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { totalmem, freemem } from "node:os";
|
|
7
|
+
import { memoryUsage } from "node:process";
|
|
8
8
|
import { stripVTControlCharacters } from "node:util";
|
|
9
9
|
|
|
10
10
|
const createCallbackListNotifiedOnce = () => {
|
|
@@ -6548,174 +6548,6 @@ const getExtensionsToTry = (magicExtensions, importer) => {
|
|
|
6548
6548
|
return Array.from(extensionsSet.values());
|
|
6549
6549
|
};
|
|
6550
6550
|
|
|
6551
|
-
const startMeasuringTotalCpuUsage = () => {
|
|
6552
|
-
let previousCpuArray = cpus();
|
|
6553
|
-
let previousMs = Date.now();
|
|
6554
|
-
let previousCpuUsage = cpuUsage();
|
|
6555
|
-
|
|
6556
|
-
const overall = {
|
|
6557
|
-
inactive: 100,
|
|
6558
|
-
active: 0,
|
|
6559
|
-
system: 0,
|
|
6560
|
-
user: 0,
|
|
6561
|
-
};
|
|
6562
|
-
const thisProcess = {
|
|
6563
|
-
active: 0,
|
|
6564
|
-
system: 0,
|
|
6565
|
-
user: 0,
|
|
6566
|
-
};
|
|
6567
|
-
const details = previousCpuArray.map(() => {
|
|
6568
|
-
return {
|
|
6569
|
-
inactive: 100,
|
|
6570
|
-
active: 0,
|
|
6571
|
-
system: 0,
|
|
6572
|
-
user: 0,
|
|
6573
|
-
};
|
|
6574
|
-
});
|
|
6575
|
-
|
|
6576
|
-
const samples = [];
|
|
6577
|
-
const interval = setInterval(() => {
|
|
6578
|
-
let cpuArray = cpus();
|
|
6579
|
-
const ms = Date.now();
|
|
6580
|
-
const ellapsedMs = ms - previousMs;
|
|
6581
|
-
const cpuUsageSampleArray = [];
|
|
6582
|
-
let overallSystemMs = 0;
|
|
6583
|
-
let overallUserMs = 0;
|
|
6584
|
-
let overallInactiveMs = 0;
|
|
6585
|
-
let overallActiveMs = 0;
|
|
6586
|
-
let overallMsEllapsed = 0;
|
|
6587
|
-
let index = 0;
|
|
6588
|
-
for (const cpu of cpuArray) {
|
|
6589
|
-
const previousCpuTimes = previousCpuArray[index].times;
|
|
6590
|
-
const cpuTimes = cpu.times;
|
|
6591
|
-
const systemMs = cpuTimes.sys - previousCpuTimes.sys;
|
|
6592
|
-
const userMs = cpuTimes.user - previousCpuTimes.user;
|
|
6593
|
-
const activeMs = systemMs + userMs;
|
|
6594
|
-
const inactiveMs = ellapsedMs - activeMs;
|
|
6595
|
-
const cpuUsageSample = {
|
|
6596
|
-
inactive: inactiveMs / ellapsedMs,
|
|
6597
|
-
active: activeMs / ellapsedMs,
|
|
6598
|
-
system: systemMs / ellapsedMs,
|
|
6599
|
-
user: userMs / ellapsedMs,
|
|
6600
|
-
};
|
|
6601
|
-
cpuUsageSampleArray.push(cpuUsageSample);
|
|
6602
|
-
|
|
6603
|
-
overallSystemMs += systemMs;
|
|
6604
|
-
overallUserMs += userMs;
|
|
6605
|
-
overallInactiveMs += inactiveMs;
|
|
6606
|
-
overallActiveMs += activeMs;
|
|
6607
|
-
overallMsEllapsed += ellapsedMs;
|
|
6608
|
-
index++;
|
|
6609
|
-
}
|
|
6610
|
-
const overallUsageSample = {
|
|
6611
|
-
inactive: overallInactiveMs / overallMsEllapsed,
|
|
6612
|
-
active: overallActiveMs / overallMsEllapsed,
|
|
6613
|
-
system: overallSystemMs / overallMsEllapsed,
|
|
6614
|
-
user: overallUserMs / overallMsEllapsed,
|
|
6615
|
-
};
|
|
6616
|
-
previousCpuArray = cpuArray;
|
|
6617
|
-
previousMs = ms;
|
|
6618
|
-
|
|
6619
|
-
const processCpuUsage = cpuUsage();
|
|
6620
|
-
const thisProcessSystemMs = Math.round(
|
|
6621
|
-
(processCpuUsage.system - previousCpuUsage.system) / 1000,
|
|
6622
|
-
);
|
|
6623
|
-
const thisProcessUserMs = Math.round(
|
|
6624
|
-
(processCpuUsage.user - previousCpuUsage.user) / 1000,
|
|
6625
|
-
);
|
|
6626
|
-
previousCpuUsage = processCpuUsage;
|
|
6627
|
-
|
|
6628
|
-
const thisProcessActiveMs = thisProcessSystemMs + thisProcessUserMs;
|
|
6629
|
-
const thisProcessInactiveMs = overallMsEllapsed - thisProcessActiveMs;
|
|
6630
|
-
const thisProcessSample = {
|
|
6631
|
-
inactive: thisProcessInactiveMs / overallMsEllapsed,
|
|
6632
|
-
active: thisProcessActiveMs / overallMsEllapsed,
|
|
6633
|
-
system: thisProcessSystemMs / overallMsEllapsed,
|
|
6634
|
-
user: thisProcessUserMs / overallMsEllapsed,
|
|
6635
|
-
};
|
|
6636
|
-
samples.push({
|
|
6637
|
-
cpuUsageSampleArray,
|
|
6638
|
-
overallUsageSample,
|
|
6639
|
-
thisProcessSample,
|
|
6640
|
-
});
|
|
6641
|
-
if (samples.length === 10) {
|
|
6642
|
-
{
|
|
6643
|
-
let index = 0;
|
|
6644
|
-
for (const detail of details) {
|
|
6645
|
-
let systemSum = 0;
|
|
6646
|
-
let userSum = 0;
|
|
6647
|
-
let inactiveSum = 0;
|
|
6648
|
-
let activeSum = 0;
|
|
6649
|
-
for (const sample of samples) {
|
|
6650
|
-
const { cpuUsageSampleArray } = sample;
|
|
6651
|
-
const cpuUsageSample = cpuUsageSampleArray[index];
|
|
6652
|
-
inactiveSum += cpuUsageSample.inactive;
|
|
6653
|
-
activeSum += cpuUsageSample.active;
|
|
6654
|
-
systemSum += cpuUsageSample.system;
|
|
6655
|
-
userSum += cpuUsageSample.user;
|
|
6656
|
-
}
|
|
6657
|
-
Object.assign(detail, {
|
|
6658
|
-
inactive: inactiveSum / samples.length,
|
|
6659
|
-
active: activeSum / samples.length,
|
|
6660
|
-
system: systemSum / samples.length,
|
|
6661
|
-
user: userSum / samples.length,
|
|
6662
|
-
});
|
|
6663
|
-
index++;
|
|
6664
|
-
}
|
|
6665
|
-
}
|
|
6666
|
-
{
|
|
6667
|
-
let overallSystemSum = 0;
|
|
6668
|
-
let overallUserSum = 0;
|
|
6669
|
-
let overallInactiveSum = 0;
|
|
6670
|
-
let overallActiveSum = 0;
|
|
6671
|
-
for (const sample of samples) {
|
|
6672
|
-
const { overallUsageSample } = sample;
|
|
6673
|
-
overallSystemSum += overallUsageSample.system;
|
|
6674
|
-
overallUserSum += overallUsageSample.user;
|
|
6675
|
-
overallInactiveSum += overallUsageSample.inactive;
|
|
6676
|
-
overallActiveSum += overallUsageSample.active;
|
|
6677
|
-
}
|
|
6678
|
-
Object.assign(overall, {
|
|
6679
|
-
inactive: overallInactiveSum / samples.length,
|
|
6680
|
-
active: overallActiveSum / samples.length,
|
|
6681
|
-
system: overallSystemSum / samples.length,
|
|
6682
|
-
user: overallUserSum / samples.length,
|
|
6683
|
-
});
|
|
6684
|
-
}
|
|
6685
|
-
{
|
|
6686
|
-
let thisProcessSystemSum = 0;
|
|
6687
|
-
let thisProcessUserSum = 0;
|
|
6688
|
-
let thisProcessInactiveSum = 0;
|
|
6689
|
-
let thisProcessActiveSum = 0;
|
|
6690
|
-
for (const sample of samples) {
|
|
6691
|
-
const { thisProcessSample } = sample;
|
|
6692
|
-
thisProcessSystemSum += thisProcessSample.system;
|
|
6693
|
-
thisProcessUserSum += thisProcessSample.user;
|
|
6694
|
-
thisProcessInactiveSum += thisProcessSample.inactive;
|
|
6695
|
-
thisProcessActiveSum += thisProcessSample.active;
|
|
6696
|
-
}
|
|
6697
|
-
Object.assign(thisProcess, {
|
|
6698
|
-
inactive: thisProcessInactiveSum / samples.length,
|
|
6699
|
-
active: thisProcessActiveSum / samples.length,
|
|
6700
|
-
system: thisProcessSystemSum / samples.length,
|
|
6701
|
-
user: thisProcessUserSum / samples.length,
|
|
6702
|
-
});
|
|
6703
|
-
}
|
|
6704
|
-
samples.length = 0;
|
|
6705
|
-
}
|
|
6706
|
-
}, 15);
|
|
6707
|
-
interval.unref();
|
|
6708
|
-
|
|
6709
|
-
return {
|
|
6710
|
-
overall,
|
|
6711
|
-
thisProcess,
|
|
6712
|
-
details,
|
|
6713
|
-
stop: () => {
|
|
6714
|
-
clearInterval(interval);
|
|
6715
|
-
},
|
|
6716
|
-
};
|
|
6717
|
-
};
|
|
6718
|
-
|
|
6719
6551
|
const startMonitoringMetric = (measure) => {
|
|
6720
6552
|
const metrics = [];
|
|
6721
6553
|
const takeMeasure = () => {
|
|
@@ -6761,22 +6593,6 @@ const medianFromSortedArray = (array) => {
|
|
|
6761
6593
|
return medianNumber;
|
|
6762
6594
|
};
|
|
6763
6595
|
|
|
6764
|
-
// https://gist.github.com/GaetanoPiazzolla/c40e1ebb9f709d091208e89baf9f4e00
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
const startMonitoringCpuUsage = () => {
|
|
6768
|
-
const cpuUsage = startMeasuringTotalCpuUsage();
|
|
6769
|
-
const processCpuUsageMonitoring = startMonitoringMetric(() => {
|
|
6770
|
-
return cpuUsage.thisProcess.active;
|
|
6771
|
-
});
|
|
6772
|
-
const osCpuUsageMonitoring = startMonitoringMetric(() => {
|
|
6773
|
-
return cpuUsage.overall.active;
|
|
6774
|
-
});
|
|
6775
|
-
const result = [processCpuUsageMonitoring, osCpuUsageMonitoring];
|
|
6776
|
-
result.stop = cpuUsage.stop;
|
|
6777
|
-
return result;
|
|
6778
|
-
};
|
|
6779
|
-
|
|
6780
6596
|
const startMonitoringMemoryUsage = () => {
|
|
6781
6597
|
const processMemoryUsageMonitoring = startMonitoringMetric(() => {
|
|
6782
6598
|
return memoryUsage().rss;
|
|
@@ -11231,4 +11047,4 @@ const escapeRegexpSpecialChars = (string) => {
|
|
|
11231
11047
|
});
|
|
11232
11048
|
};
|
|
11233
11049
|
|
|
11234
|
-
export { ANSI, Abort, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, UNICODE, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, browserDefaultRuntimeCompat, bufferToEtag, clearDirectorySync, collectFiles, compareFileUrls, comparePathnames, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createDynamicLog, createLogger, createLookupPackageDirectory, createTaskLog, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, escapeRegexpSpecialChars, generateContentFrame, getCallerPosition, getExtensionsToTry, humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParams, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, moveUrl, nodeDefaultRuntimeCompat, normalizeImportMap, normalizeUrl, raceProcessTeardownEvents, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename,
|
|
11050
|
+
export { ANSI, Abort, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, UNICODE, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, browserDefaultRuntimeCompat, bufferToEtag, clearDirectorySync, collectFiles, compareFileUrls, comparePathnames, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createDynamicLog, createLogger, createLookupPackageDirectory, createTaskLog, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, escapeRegexpSpecialChars, generateContentFrame, getCallerPosition, getExtensionsToTry, humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParams, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, moveUrl, nodeDefaultRuntimeCompat, normalizeImportMap, normalizeUrl, raceProcessTeardownEvents, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename, startMonitoringMemoryUsage, stringifyUrlSite, updateJsonFileSync, urlIsOrIsInsideOf, urlToBasename, urlToExtension$1 as urlToExtension, urlToFileSystemPath, urlToFilename$1 as urlToFilename, urlToPathname$1 as urlToPathname, urlToRelativeUrl, validateResponseIntegrity, writeFileSync };
|
|
@@ -46,10 +46,27 @@ const DirectoryListing = () => {
|
|
|
46
46
|
const ErrorMessage = () => {
|
|
47
47
|
const {
|
|
48
48
|
filePathExisting,
|
|
49
|
-
filePathNotFound
|
|
49
|
+
filePathNotFound,
|
|
50
|
+
spaFallbackFilePaths
|
|
50
51
|
} = enoentDetails;
|
|
51
52
|
let errorText;
|
|
52
53
|
let errorSuggestion;
|
|
54
|
+
let spaExplanation = null;
|
|
55
|
+
if (spaFallbackFilePaths) {
|
|
56
|
+
spaExplanation = u($, {
|
|
57
|
+
children: [u("strong", {
|
|
58
|
+
children: "SPA mode:"
|
|
59
|
+
}), " a url without extension is a route, served with the closest html file. None of these exists:", u("ul", {
|
|
60
|
+
className: "spa_fallback_list",
|
|
61
|
+
style: "margin: 6px 0 0; padding-left: 20px;",
|
|
62
|
+
children: spaFallbackFilePaths.map(filePath => u("li", {
|
|
63
|
+
children: [u("code", {
|
|
64
|
+
children: filePath
|
|
65
|
+
}), filePath === `/${mainFilePath}` ? " (main file)" : ""]
|
|
66
|
+
}, filePath))
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
53
70
|
errorText = u($, {
|
|
54
71
|
children: [u("strong", {
|
|
55
72
|
children: "File not found:"
|
|
@@ -79,7 +96,11 @@ const ErrorMessage = () => {
|
|
|
79
96
|
children: [u("p", {
|
|
80
97
|
className: "error_text",
|
|
81
98
|
children: errorText
|
|
82
|
-
}), u("p", {
|
|
99
|
+
}), spaExplanation ? u("p", {
|
|
100
|
+
className: "error_spa",
|
|
101
|
+
style: "margin-top: 10px;",
|
|
102
|
+
children: spaExplanation
|
|
103
|
+
}) : null, u("p", {
|
|
83
104
|
className: "error_suggestion",
|
|
84
105
|
style: "font-size: 0.8em; margin-top: 10px;",
|
|
85
106
|
children: errorSuggestion
|