@jsenv/core 40.1.3 → 40.1.4
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseHtml, injectHtmlNodeAsEarlyAsPossible, createHtmlNode, stringifyHtmlAst, applyBabelPlugins, generateUrlForInlineContent, parseJsWithAcorn, visitHtmlNodes, analyzeScriptNode, getHtmlNodeText, getHtmlNodeAttribute, getHtmlNodePosition, getUrlForContentInsideHtml, setHtmlNodeAttributes, setHtmlNodeText, parseCssUrls, getHtmlNodeAttributePosition, parseSrcSet, removeHtmlNodeText, parseJsUrls, getUrlForContentInsideJs, analyzeLinkNode, injectJsenvScript, findHtmlNode, removeHtmlNode, insertHtmlNodeAfter } from "@jsenv/ast";
|
|
2
2
|
import { memoryUsage } from "node:process";
|
|
3
3
|
import { readFileSync, existsSync, readdirSync, lstatSync, realpathSync } from "node:fs";
|
|
4
|
-
import { lookupPackageDirectory$1 as lookupPackageDirectory, registerDirectoryLifecycle$1 as registerDirectoryLifecycle, urlToRelativeUrl$1 as urlToRelativeUrl, createDetailedMessage$1 as createDetailedMessage, stringifyUrlSite$1 as stringifyUrlSite, generateContentFrame$1 as generateContentFrame, validateResponseIntegrity$1 as validateResponseIntegrity, urlIsInsideOf$1 as urlIsInsideOf, ensureWindowsDriveLetter$1 as ensureWindowsDriveLetter, setUrlFilename$1 as setUrlFilename, moveUrl$1 as moveUrl, getCallerPosition$1 as getCallerPosition, urlToBasename$1 as urlToBasename, urlToExtension$1 as urlToExtension, asSpecifierWithoutSearch$1 as asSpecifierWithoutSearch, asUrlWithoutSearch$1 as asUrlWithoutSearch, injectQueryParamsIntoSpecifier$1 as injectQueryParamsIntoSpecifier, bufferToEtag$1 as bufferToEtag, isFileSystemPath$1 as isFileSystemPath, urlToPathname$1 as urlToPathname, setUrlBasename$1 as setUrlBasename, urlToFileSystemPath$1 as urlToFileSystemPath, writeFileSync$1 as writeFileSync, createLogger$1 as createLogger, URL_META$1 as URL_META, applyNodeEsmResolution$1 as applyNodeEsmResolution, RUNTIME_COMPAT$1 as RUNTIME_COMPAT, normalizeUrl$1 as normalizeUrl, ANSI$1 as ANSI, CONTENT_TYPE$1 as CONTENT_TYPE, urlToFilename$1 as urlToFilename, DATA_URL$1 as DATA_URL, normalizeImportMap$1 as normalizeImportMap, composeTwoImportMaps$1 as composeTwoImportMaps, resolveImport$1 as resolveImport, JS_QUOTES$1 as JS_QUOTES, defaultLookupPackageScope$1 as defaultLookupPackageScope, defaultReadPackageJson$1 as defaultReadPackageJson, readCustomConditionsFromProcessArgs$1 as readCustomConditionsFromProcessArgs, readEntryStatSync$1 as readEntryStatSync, ensurePathnameTrailingSlash$1 as ensurePathnameTrailingSlash, compareFileUrls$1 as compareFileUrls, applyFileSystemMagicResolution$1 as applyFileSystemMagicResolution, getExtensionsToTry$1 as getExtensionsToTry, setUrlExtension$1 as setUrlExtension, jsenvPluginTranspilation$1 as jsenvPluginTranspilation,
|
|
4
|
+
import { lookupPackageDirectory$1 as lookupPackageDirectory, registerDirectoryLifecycle$1 as registerDirectoryLifecycle, urlToRelativeUrl$1 as urlToRelativeUrl, createDetailedMessage$1 as createDetailedMessage, stringifyUrlSite$1 as stringifyUrlSite, generateContentFrame$1 as generateContentFrame, validateResponseIntegrity$1 as validateResponseIntegrity, urlIsInsideOf$1 as urlIsInsideOf, ensureWindowsDriveLetter$1 as ensureWindowsDriveLetter, setUrlFilename$1 as setUrlFilename, moveUrl$1 as moveUrl, getCallerPosition$1 as getCallerPosition, urlToBasename$1 as urlToBasename, urlToExtension$1 as urlToExtension, asSpecifierWithoutSearch$1 as asSpecifierWithoutSearch, asUrlWithoutSearch$1 as asUrlWithoutSearch, injectQueryParamsIntoSpecifier$1 as injectQueryParamsIntoSpecifier, bufferToEtag$1 as bufferToEtag, isFileSystemPath$1 as isFileSystemPath, urlToPathname$1 as urlToPathname, setUrlBasename$1 as setUrlBasename, urlToFileSystemPath$1 as urlToFileSystemPath, writeFileSync$1 as writeFileSync, createLogger$1 as createLogger, URL_META$1 as URL_META, applyNodeEsmResolution$1 as applyNodeEsmResolution, RUNTIME_COMPAT$1 as RUNTIME_COMPAT, normalizeUrl$1 as normalizeUrl, ANSI$1 as ANSI, CONTENT_TYPE$1 as CONTENT_TYPE, urlToFilename$1 as urlToFilename, DATA_URL$1 as DATA_URL, normalizeImportMap$1 as normalizeImportMap, composeTwoImportMaps$1 as composeTwoImportMaps, resolveImport$1 as resolveImport, JS_QUOTES$1 as JS_QUOTES, defaultLookupPackageScope$1 as defaultLookupPackageScope, defaultReadPackageJson$1 as defaultReadPackageJson, readCustomConditionsFromProcessArgs$1 as readCustomConditionsFromProcessArgs, readEntryStatSync$1 as readEntryStatSync, ensurePathnameTrailingSlash$1 as ensurePathnameTrailingSlash, compareFileUrls$1 as compareFileUrls, applyFileSystemMagicResolution$1 as applyFileSystemMagicResolution, getExtensionsToTry$1 as getExtensionsToTry, setUrlExtension$1 as setUrlExtension, jsenvPluginTranspilation$1 as jsenvPluginTranspilation, renderDetails, humanizeDuration, humanizeFileSize, renderTable, renderBigSection, distributePercentages, humanizeMemory, comparePathnames, UNICODE, escapeRegexpSpecialChars, injectQueryParamIntoSpecifierWithoutEncoding, renderUrlOrRelativeUrlFilename, assertAndNormalizeDirectoryUrl$1 as assertAndNormalizeDirectoryUrl, Abort, raceProcessTeardownEvents, startMonitoringCpuUsage, startMonitoringMemoryUsage, inferRuntimeCompatFromClosestPackage, browserDefaultRuntimeCompat, nodeDefaultRuntimeCompat, clearDirectorySync, createTaskLog$1 as createTaskLog, jsenvPluginBundling, jsenvPluginMinification, ensureEmptyDirectory, jsenvPluginJsModuleFallback, createDynamicLog } from "../jsenv_core_packages.js";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, generateSourcemapDataUrl, SOURCEMAP } from "@jsenv/sourcemap";
|
|
7
7
|
import { performance } from "node:perf_hooks";
|
|
@@ -2625,7 +2625,7 @@ const shouldHandleSourcemap = (urlInfo) => {
|
|
|
2625
2625
|
};
|
|
2626
2626
|
|
|
2627
2627
|
const inlineContentClientFileUrl = new URL(
|
|
2628
|
-
"
|
|
2628
|
+
"../client/inline_content/inline_content.js",
|
|
2629
2629
|
import.meta.url,
|
|
2630
2630
|
).href;
|
|
2631
2631
|
|
|
@@ -3673,7 +3673,7 @@ const jsenvPluginInlining = () => {
|
|
|
3673
3673
|
|
|
3674
3674
|
const jsenvPluginHtmlSyntaxErrorFallback = () => {
|
|
3675
3675
|
const htmlSyntaxErrorFileUrl = import.meta.resolve(
|
|
3676
|
-
"
|
|
3676
|
+
"../client/html_syntax_error/html_syntax_error.html",
|
|
3677
3677
|
);
|
|
3678
3678
|
|
|
3679
3679
|
return {
|
|
@@ -6028,7 +6028,7 @@ return {
|
|
|
6028
6028
|
|
|
6029
6029
|
|
|
6030
6030
|
const htmlFileUrlForDirectory = import.meta.resolve(
|
|
6031
|
-
"
|
|
6031
|
+
"../client/directory_listing/directory_listing.html",
|
|
6032
6032
|
);
|
|
6033
6033
|
|
|
6034
6034
|
const jsenvPluginDirectoryListing = ({
|
|
@@ -7389,7 +7389,7 @@ const htmlNodeCanHotReload = (node) => {
|
|
|
7389
7389
|
|
|
7390
7390
|
const jsenvPluginImportMetaHot = () => {
|
|
7391
7391
|
const importMetaHotClientFileUrl = import.meta.resolve(
|
|
7392
|
-
"
|
|
7392
|
+
"../client/import_meta_hot/import_meta_hot.js",
|
|
7393
7393
|
);
|
|
7394
7394
|
|
|
7395
7395
|
return {
|
|
@@ -7501,7 +7501,7 @@ import.meta.hot = createImportMetaHot(import.meta.url);
|
|
|
7501
7501
|
};
|
|
7502
7502
|
|
|
7503
7503
|
const jsenvPluginAutoreloadClient = () => {
|
|
7504
|
-
const autoreloadClientFileUrl = import.meta.resolve("
|
|
7504
|
+
const autoreloadClientFileUrl = import.meta.resolve("../client/autoreload/autoreload.js");
|
|
7505
7505
|
|
|
7506
7506
|
return {
|
|
7507
7507
|
name: "jsenv:autoreload_client",
|
|
@@ -8020,7 +8020,7 @@ const jsenvPluginRibbon = ({
|
|
|
8020
8020
|
rootDirectoryUrl,
|
|
8021
8021
|
htmlInclude = "/**/*.html",
|
|
8022
8022
|
}) => {
|
|
8023
|
-
const ribbonClientFileUrl = import.meta.resolve("
|
|
8023
|
+
const ribbonClientFileUrl = import.meta.resolve("../client/ribbon/ribbon.js");
|
|
8024
8024
|
const associations = URL_META.resolveAssociations(
|
|
8025
8025
|
{
|
|
8026
8026
|
ribbon: {
|
|
@@ -8215,6 +8215,7 @@ const humanizeProcessMemoryUsage = (value) => {
|
|
|
8215
8215
|
return humanizeMemory(value, { short: true, decimals: 0 });
|
|
8216
8216
|
};
|
|
8217
8217
|
const renderBuildDoneLog = ({
|
|
8218
|
+
entryPointArray,
|
|
8218
8219
|
duration,
|
|
8219
8220
|
buildFileContents,
|
|
8220
8221
|
processCpuUsage,
|
|
@@ -8223,84 +8224,15 @@ const renderBuildDoneLog = ({
|
|
|
8223
8224
|
const buildContentReport = createBuildContentReport(buildFileContents);
|
|
8224
8225
|
|
|
8225
8226
|
let title = "";
|
|
8226
|
-
let content = "";
|
|
8227
8227
|
const lines = [];
|
|
8228
8228
|
|
|
8229
|
-
const
|
|
8230
|
-
if (
|
|
8231
|
-
title = `
|
|
8229
|
+
const entryPointCount = entryPointArray.length;
|
|
8230
|
+
if (entryPointCount === 1) {
|
|
8231
|
+
title = `build done`;
|
|
8232
8232
|
} else {
|
|
8233
|
-
title =
|
|
8234
|
-
const keys = Object.keys(buildContentReport);
|
|
8235
|
-
const rows = [];
|
|
8236
|
-
let y = 0;
|
|
8237
|
-
let highestPercentage = 0;
|
|
8238
|
-
let highestPercentageY = 0;
|
|
8239
|
-
for (const key of keys) {
|
|
8240
|
-
if (key === "sourcemaps") {
|
|
8241
|
-
continue;
|
|
8242
|
-
}
|
|
8243
|
-
if (key === "total") {
|
|
8244
|
-
continue;
|
|
8245
|
-
}
|
|
8246
|
-
const { count, size, percentage } = buildContentReport[key];
|
|
8247
|
-
if (count === 0) {
|
|
8248
|
-
continue;
|
|
8249
|
-
}
|
|
8250
|
-
const row = [
|
|
8251
|
-
{
|
|
8252
|
-
value: key,
|
|
8253
|
-
borderTop: {},
|
|
8254
|
-
borderBottom: {},
|
|
8255
|
-
},
|
|
8256
|
-
{
|
|
8257
|
-
value: count,
|
|
8258
|
-
borderTop: {},
|
|
8259
|
-
borderBottom: {},
|
|
8260
|
-
},
|
|
8261
|
-
{
|
|
8262
|
-
value: size,
|
|
8263
|
-
format: "size",
|
|
8264
|
-
borderTop: {},
|
|
8265
|
-
borderBottom: {},
|
|
8266
|
-
},
|
|
8267
|
-
{
|
|
8268
|
-
value: percentage,
|
|
8269
|
-
format: "percentage",
|
|
8270
|
-
unit: "%",
|
|
8271
|
-
borderTop: {},
|
|
8272
|
-
borderBottom: {},
|
|
8273
|
-
},
|
|
8274
|
-
];
|
|
8275
|
-
if (percentage > highestPercentage) {
|
|
8276
|
-
highestPercentage = percentage;
|
|
8277
|
-
highestPercentageY = y;
|
|
8278
|
-
}
|
|
8279
|
-
rows.push(row);
|
|
8280
|
-
y++;
|
|
8281
|
-
}
|
|
8282
|
-
if (rows.length > 1) {
|
|
8283
|
-
const rowWithHighestPercentage = rows[highestPercentageY];
|
|
8284
|
-
for (const cell of rowWithHighestPercentage) {
|
|
8285
|
-
cell.bold = true;
|
|
8286
|
-
}
|
|
8287
|
-
const table = renderTable(rows, {
|
|
8288
|
-
borderCollapse: true,
|
|
8289
|
-
ansi: true,
|
|
8290
|
-
});
|
|
8291
|
-
content += table;
|
|
8292
|
-
content += "\n";
|
|
8293
|
-
}
|
|
8233
|
+
title = `build done (${entryPointCount} entry points)`;
|
|
8294
8234
|
}
|
|
8295
8235
|
|
|
8296
|
-
let sizeLine = `total size: `;
|
|
8297
|
-
sizeLine += humanizeFileSize(buildContentReport.total.size);
|
|
8298
|
-
lines.push(sizeLine);
|
|
8299
|
-
|
|
8300
|
-
let durationLine = `duration: `;
|
|
8301
|
-
durationLine += humanizeDuration(duration, { short: true });
|
|
8302
|
-
lines.push(durationLine);
|
|
8303
|
-
|
|
8304
8236
|
// cpu usage
|
|
8305
8237
|
let cpuUsageLine = "cpu: ";
|
|
8306
8238
|
cpuUsageLine += `${humanizeProcessCpuUsage(processCpuUsage.end)}`;
|
|
@@ -8321,7 +8253,86 @@ const renderBuildDoneLog = ({
|
|
|
8321
8253
|
});
|
|
8322
8254
|
lines.push(memoryUsageLine);
|
|
8323
8255
|
|
|
8324
|
-
|
|
8256
|
+
// duration
|
|
8257
|
+
let durationLine = `duration: `;
|
|
8258
|
+
durationLine += humanizeDuration(duration, { short: true });
|
|
8259
|
+
lines.push(durationLine);
|
|
8260
|
+
|
|
8261
|
+
// content
|
|
8262
|
+
let filesLine = `content: `;
|
|
8263
|
+
const filesWrittenCount = buildContentReport.total.count;
|
|
8264
|
+
if (filesWrittenCount === 1) {
|
|
8265
|
+
filesLine += "1 file";
|
|
8266
|
+
} else {
|
|
8267
|
+
filesLine += `${filesWrittenCount} files`;
|
|
8268
|
+
}
|
|
8269
|
+
filesLine += " (";
|
|
8270
|
+
filesLine += humanizeFileSize(buildContentReport.total.size);
|
|
8271
|
+
filesLine += ")";
|
|
8272
|
+
lines.push(filesLine);
|
|
8273
|
+
|
|
8274
|
+
// file repartition
|
|
8275
|
+
const keys = Object.keys(buildContentReport);
|
|
8276
|
+
const rows = [];
|
|
8277
|
+
let y = 0;
|
|
8278
|
+
let highestPercentage = 0;
|
|
8279
|
+
let highestPercentageY = 0;
|
|
8280
|
+
for (const key of keys) {
|
|
8281
|
+
if (key === "sourcemaps") {
|
|
8282
|
+
continue;
|
|
8283
|
+
}
|
|
8284
|
+
if (key === "total") {
|
|
8285
|
+
continue;
|
|
8286
|
+
}
|
|
8287
|
+
const { count, size, percentage } = buildContentReport[key];
|
|
8288
|
+
if (count === 0) {
|
|
8289
|
+
continue;
|
|
8290
|
+
}
|
|
8291
|
+
const row = [
|
|
8292
|
+
{
|
|
8293
|
+
value: key,
|
|
8294
|
+
borderTop: {},
|
|
8295
|
+
borderBottom: {},
|
|
8296
|
+
},
|
|
8297
|
+
{
|
|
8298
|
+
value: count,
|
|
8299
|
+
borderTop: {},
|
|
8300
|
+
borderBottom: {},
|
|
8301
|
+
},
|
|
8302
|
+
{
|
|
8303
|
+
value: size,
|
|
8304
|
+
format: "size",
|
|
8305
|
+
borderTop: {},
|
|
8306
|
+
borderBottom: {},
|
|
8307
|
+
},
|
|
8308
|
+
{
|
|
8309
|
+
value: percentage,
|
|
8310
|
+
format: "percentage",
|
|
8311
|
+
unit: "%",
|
|
8312
|
+
borderTop: {},
|
|
8313
|
+
borderBottom: {},
|
|
8314
|
+
},
|
|
8315
|
+
];
|
|
8316
|
+
if (percentage > highestPercentage) {
|
|
8317
|
+
highestPercentage = percentage;
|
|
8318
|
+
highestPercentageY = y;
|
|
8319
|
+
}
|
|
8320
|
+
rows.push(row);
|
|
8321
|
+
y++;
|
|
8322
|
+
}
|
|
8323
|
+
if (rows.length > 1) {
|
|
8324
|
+
const rowWithHighestPercentage = rows[highestPercentageY];
|
|
8325
|
+
for (const cell of rowWithHighestPercentage) {
|
|
8326
|
+
cell.bold = true;
|
|
8327
|
+
}
|
|
8328
|
+
const table = renderTable(rows, {
|
|
8329
|
+
borderCollapse: true,
|
|
8330
|
+
ansi: true,
|
|
8331
|
+
});
|
|
8332
|
+
lines.push(table);
|
|
8333
|
+
}
|
|
8334
|
+
|
|
8335
|
+
const content = lines.join("\n");
|
|
8325
8336
|
return `${renderBigSection({
|
|
8326
8337
|
title,
|
|
8327
8338
|
content,
|
|
@@ -10495,6 +10506,7 @@ const build = async ({
|
|
|
10495
10506
|
processMemoryUsageMonitoring.end();
|
|
10496
10507
|
|
|
10497
10508
|
return renderBuildDoneLog({
|
|
10509
|
+
entryPointArray,
|
|
10498
10510
|
duration,
|
|
10499
10511
|
buildFileContents,
|
|
10500
10512
|
processCpuUsage: processCpuUsageMonitoring.info,
|
|
@@ -6700,7 +6700,7 @@ const injectAstAfterImport$1 = (programPath, ast) => {
|
|
|
6700
6700
|
};
|
|
6701
6701
|
|
|
6702
6702
|
const newStylesheetClientFileUrl$1 = new URL(
|
|
6703
|
-
"./client/new_stylesheet.js",
|
|
6703
|
+
"./client/new_stylesheet/new_stylesheet.js",
|
|
6704
6704
|
import.meta.url,
|
|
6705
6705
|
).href;
|
|
6706
6706
|
|
|
@@ -6858,7 +6858,7 @@ const getImportAttributes$1 = (importNode) => {
|
|
|
6858
6858
|
};
|
|
6859
6859
|
|
|
6860
6860
|
const regeneratorRuntimeClientFileUrl$1 = new URL(
|
|
6861
|
-
"./client/regenerator_runtime.js",
|
|
6861
|
+
"./client/regenerator_runtime/regenerator_runtime.js",
|
|
6862
6862
|
import.meta.url,
|
|
6863
6863
|
).href;
|
|
6864
6864
|
|
|
@@ -15140,7 +15140,22 @@ const rollupPluginJsenv = ({
|
|
|
15140
15140
|
const dynamicImportUrl = getOriginalUrl(
|
|
15141
15141
|
dynamicImportRollupFileInfo,
|
|
15142
15142
|
);
|
|
15143
|
-
const
|
|
15143
|
+
const importerBuildUrl = new URL(
|
|
15144
|
+
rollupFileInfo.fileName,
|
|
15145
|
+
buildDirectoryUrl,
|
|
15146
|
+
).href;
|
|
15147
|
+
const urlToImport = new URL(
|
|
15148
|
+
dynamicImportRollupFileInfo.fileName,
|
|
15149
|
+
buildDirectoryUrl,
|
|
15150
|
+
).href;
|
|
15151
|
+
const specifierRelative = urlToRelativeUrl(
|
|
15152
|
+
urlToImport,
|
|
15153
|
+
importerBuildUrl,
|
|
15154
|
+
);
|
|
15155
|
+
const rollupSpecifier =
|
|
15156
|
+
specifierRelative[0] === "."
|
|
15157
|
+
? specifierRelative
|
|
15158
|
+
: `./${specifierRelative}`;
|
|
15144
15159
|
specifierToUrlMap.set(rollupSpecifier, dynamicImportUrl);
|
|
15145
15160
|
}
|
|
15146
15161
|
}
|
|
@@ -17051,7 +17066,7 @@ const injectAstAfterImport = (programPath, ast) => {
|
|
|
17051
17066
|
};
|
|
17052
17067
|
|
|
17053
17068
|
const newStylesheetClientFileUrl = new URL(
|
|
17054
|
-
"./client/new_stylesheet.js",
|
|
17069
|
+
"./client/new_stylesheet/new_stylesheet.js",
|
|
17055
17070
|
import.meta.url,
|
|
17056
17071
|
).href;
|
|
17057
17072
|
|
|
@@ -17209,7 +17224,7 @@ const getImportAttributes = (importNode) => {
|
|
|
17209
17224
|
};
|
|
17210
17225
|
|
|
17211
17226
|
const regeneratorRuntimeClientFileUrl = new URL(
|
|
17212
|
-
"./client/regenerator_runtime.js",
|
|
17227
|
+
"./client/regenerator_runtime/regenerator_runtime.js",
|
|
17213
17228
|
import.meta.url,
|
|
17214
17229
|
).href;
|
|
17215
17230
|
|
|
@@ -2666,7 +2666,7 @@ const shouldHandleSourcemap = (urlInfo) => {
|
|
|
2666
2666
|
};
|
|
2667
2667
|
|
|
2668
2668
|
const inlineContentClientFileUrl = new URL(
|
|
2669
|
-
"
|
|
2669
|
+
"../client/inline_content/inline_content.js",
|
|
2670
2670
|
import.meta.url,
|
|
2671
2671
|
).href;
|
|
2672
2672
|
|
|
@@ -3379,7 +3379,7 @@ const inferUrlInfoType = (urlInfo) => {
|
|
|
3379
3379
|
|
|
3380
3380
|
const jsenvPluginHtmlSyntaxErrorFallback = () => {
|
|
3381
3381
|
const htmlSyntaxErrorFileUrl = import.meta.resolve(
|
|
3382
|
-
"
|
|
3382
|
+
"../client/html_syntax_error/html_syntax_error.html",
|
|
3383
3383
|
);
|
|
3384
3384
|
|
|
3385
3385
|
return {
|
|
@@ -5734,7 +5734,7 @@ return {
|
|
|
5734
5734
|
|
|
5735
5735
|
|
|
5736
5736
|
const htmlFileUrlForDirectory = import.meta.resolve(
|
|
5737
|
-
"
|
|
5737
|
+
"../client/directory_listing/directory_listing.html",
|
|
5738
5738
|
);
|
|
5739
5739
|
|
|
5740
5740
|
const jsenvPluginDirectoryListing = ({
|
|
@@ -7430,7 +7430,7 @@ const htmlNodeCanHotReload = (node) => {
|
|
|
7430
7430
|
|
|
7431
7431
|
const jsenvPluginImportMetaHot = () => {
|
|
7432
7432
|
const importMetaHotClientFileUrl = import.meta.resolve(
|
|
7433
|
-
"
|
|
7433
|
+
"../client/import_meta_hot/import_meta_hot.js",
|
|
7434
7434
|
);
|
|
7435
7435
|
|
|
7436
7436
|
return {
|
|
@@ -7542,7 +7542,7 @@ import.meta.hot = createImportMetaHot(import.meta.url);
|
|
|
7542
7542
|
};
|
|
7543
7543
|
|
|
7544
7544
|
const jsenvPluginAutoreloadClient = () => {
|
|
7545
|
-
const autoreloadClientFileUrl = import.meta.resolve("
|
|
7545
|
+
const autoreloadClientFileUrl = import.meta.resolve("../client/autoreload/autoreload.js");
|
|
7546
7546
|
|
|
7547
7547
|
return {
|
|
7548
7548
|
name: "jsenv:autoreload_client",
|
|
@@ -8061,7 +8061,7 @@ const jsenvPluginRibbon = ({
|
|
|
8061
8061
|
rootDirectoryUrl,
|
|
8062
8062
|
htmlInclude = "/**/*.html",
|
|
8063
8063
|
}) => {
|
|
8064
|
-
const ribbonClientFileUrl = import.meta.resolve("
|
|
8064
|
+
const ribbonClientFileUrl = import.meta.resolve("../client/ribbon/ribbon.js");
|
|
8065
8065
|
const associations = URL_META.resolveAssociations(
|
|
8066
8066
|
{
|
|
8067
8067
|
ribbon: {
|
|
@@ -8253,7 +8253,7 @@ const getCorePlugins = ({
|
|
|
8253
8253
|
|
|
8254
8254
|
|
|
8255
8255
|
const serverEventsClientFileUrl = new URL(
|
|
8256
|
-
"
|
|
8256
|
+
"../client/server_events/server_events_client.js",
|
|
8257
8257
|
import.meta.url,
|
|
8258
8258
|
).href;
|
|
8259
8259
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "40.1.
|
|
3
|
+
"version": "40.1.4",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@jsenv/integrity": "0.0.2",
|
|
86
86
|
"@jsenv/js-module-fallback": "1.4.5",
|
|
87
87
|
"@jsenv/node-esm-resolution": "1.2.0",
|
|
88
|
-
"@jsenv/plugin-bundling": "2.8.
|
|
88
|
+
"@jsenv/plugin-bundling": "2.8.8",
|
|
89
89
|
"@jsenv/plugin-minification": "1.6.2",
|
|
90
90
|
"@jsenv/plugin-supervisor": "1.6.12",
|
|
91
91
|
"@jsenv/plugin-transpilation": "1.5.9",
|
package/src/build/build.js
CHANGED
|
@@ -29,6 +29,7 @@ const humanizeProcessMemoryUsage = (value) => {
|
|
|
29
29
|
return humanizeMemory(value, { short: true, decimals: 0 });
|
|
30
30
|
};
|
|
31
31
|
export const renderBuildDoneLog = ({
|
|
32
|
+
entryPointArray,
|
|
32
33
|
duration,
|
|
33
34
|
buildFileContents,
|
|
34
35
|
processCpuUsage,
|
|
@@ -37,84 +38,15 @@ export const renderBuildDoneLog = ({
|
|
|
37
38
|
const buildContentReport = createBuildContentReport(buildFileContents);
|
|
38
39
|
|
|
39
40
|
let title = "";
|
|
40
|
-
let content = "";
|
|
41
41
|
const lines = [];
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
title = `
|
|
43
|
+
const entryPointCount = entryPointArray.length;
|
|
44
|
+
if (entryPointCount === 1) {
|
|
45
|
+
title = `build done`;
|
|
46
46
|
} else {
|
|
47
|
-
title =
|
|
48
|
-
const keys = Object.keys(buildContentReport);
|
|
49
|
-
const rows = [];
|
|
50
|
-
let y = 0;
|
|
51
|
-
let highestPercentage = 0;
|
|
52
|
-
let highestPercentageY = 0;
|
|
53
|
-
for (const key of keys) {
|
|
54
|
-
if (key === "sourcemaps") {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (key === "total") {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const { count, size, percentage } = buildContentReport[key];
|
|
61
|
-
if (count === 0) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const row = [
|
|
65
|
-
{
|
|
66
|
-
value: key,
|
|
67
|
-
borderTop: {},
|
|
68
|
-
borderBottom: {},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
value: count,
|
|
72
|
-
borderTop: {},
|
|
73
|
-
borderBottom: {},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: size,
|
|
77
|
-
format: "size",
|
|
78
|
-
borderTop: {},
|
|
79
|
-
borderBottom: {},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
value: percentage,
|
|
83
|
-
format: "percentage",
|
|
84
|
-
unit: "%",
|
|
85
|
-
borderTop: {},
|
|
86
|
-
borderBottom: {},
|
|
87
|
-
},
|
|
88
|
-
];
|
|
89
|
-
if (percentage > highestPercentage) {
|
|
90
|
-
highestPercentage = percentage;
|
|
91
|
-
highestPercentageY = y;
|
|
92
|
-
}
|
|
93
|
-
rows.push(row);
|
|
94
|
-
y++;
|
|
95
|
-
}
|
|
96
|
-
if (rows.length > 1) {
|
|
97
|
-
const rowWithHighestPercentage = rows[highestPercentageY];
|
|
98
|
-
for (const cell of rowWithHighestPercentage) {
|
|
99
|
-
cell.bold = true;
|
|
100
|
-
}
|
|
101
|
-
const table = renderTable(rows, {
|
|
102
|
-
borderCollapse: true,
|
|
103
|
-
ansi: true,
|
|
104
|
-
});
|
|
105
|
-
content += table;
|
|
106
|
-
content += "\n";
|
|
107
|
-
}
|
|
47
|
+
title = `build done (${entryPointCount} entry points)`;
|
|
108
48
|
}
|
|
109
49
|
|
|
110
|
-
let sizeLine = `total size: `;
|
|
111
|
-
sizeLine += humanizeFileSize(buildContentReport.total.size);
|
|
112
|
-
lines.push(sizeLine);
|
|
113
|
-
|
|
114
|
-
let durationLine = `duration: `;
|
|
115
|
-
durationLine += humanizeDuration(duration, { short: true });
|
|
116
|
-
lines.push(durationLine);
|
|
117
|
-
|
|
118
50
|
// cpu usage
|
|
119
51
|
let cpuUsageLine = "cpu: ";
|
|
120
52
|
cpuUsageLine += `${humanizeProcessCpuUsage(processCpuUsage.end)}`;
|
|
@@ -135,7 +67,86 @@ export const renderBuildDoneLog = ({
|
|
|
135
67
|
});
|
|
136
68
|
lines.push(memoryUsageLine);
|
|
137
69
|
|
|
138
|
-
|
|
70
|
+
// duration
|
|
71
|
+
let durationLine = `duration: `;
|
|
72
|
+
durationLine += humanizeDuration(duration, { short: true });
|
|
73
|
+
lines.push(durationLine);
|
|
74
|
+
|
|
75
|
+
// content
|
|
76
|
+
let filesLine = `content: `;
|
|
77
|
+
const filesWrittenCount = buildContentReport.total.count;
|
|
78
|
+
if (filesWrittenCount === 1) {
|
|
79
|
+
filesLine += "1 file";
|
|
80
|
+
} else {
|
|
81
|
+
filesLine += `${filesWrittenCount} files`;
|
|
82
|
+
}
|
|
83
|
+
filesLine += " (";
|
|
84
|
+
filesLine += humanizeFileSize(buildContentReport.total.size);
|
|
85
|
+
filesLine += ")";
|
|
86
|
+
lines.push(filesLine);
|
|
87
|
+
|
|
88
|
+
// file repartition
|
|
89
|
+
const keys = Object.keys(buildContentReport);
|
|
90
|
+
const rows = [];
|
|
91
|
+
let y = 0;
|
|
92
|
+
let highestPercentage = 0;
|
|
93
|
+
let highestPercentageY = 0;
|
|
94
|
+
for (const key of keys) {
|
|
95
|
+
if (key === "sourcemaps") {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (key === "total") {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const { count, size, percentage } = buildContentReport[key];
|
|
102
|
+
if (count === 0) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const row = [
|
|
106
|
+
{
|
|
107
|
+
value: key,
|
|
108
|
+
borderTop: {},
|
|
109
|
+
borderBottom: {},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
value: count,
|
|
113
|
+
borderTop: {},
|
|
114
|
+
borderBottom: {},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
value: size,
|
|
118
|
+
format: "size",
|
|
119
|
+
borderTop: {},
|
|
120
|
+
borderBottom: {},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: percentage,
|
|
124
|
+
format: "percentage",
|
|
125
|
+
unit: "%",
|
|
126
|
+
borderTop: {},
|
|
127
|
+
borderBottom: {},
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
if (percentage > highestPercentage) {
|
|
131
|
+
highestPercentage = percentage;
|
|
132
|
+
highestPercentageY = y;
|
|
133
|
+
}
|
|
134
|
+
rows.push(row);
|
|
135
|
+
y++;
|
|
136
|
+
}
|
|
137
|
+
if (rows.length > 1) {
|
|
138
|
+
const rowWithHighestPercentage = rows[highestPercentageY];
|
|
139
|
+
for (const cell of rowWithHighestPercentage) {
|
|
140
|
+
cell.bold = true;
|
|
141
|
+
}
|
|
142
|
+
const table = renderTable(rows, {
|
|
143
|
+
borderCollapse: true,
|
|
144
|
+
ansi: true,
|
|
145
|
+
});
|
|
146
|
+
lines.push(table);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const content = lines.join("\n");
|
|
139
150
|
return `${renderBigSection({
|
|
140
151
|
title,
|
|
141
152
|
content,
|