@jsenv/core 40.3.3 → 40.4.0
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 +41 -9
- package/dist/build/jsenv_core_node_modules.js +709 -0
- package/dist/{jsenv_core_packages.js → build/jsenv_core_packages.js} +9692 -17414
- package/dist/start_build_server/jsenv_core_node_modules.js +685 -0
- package/dist/start_build_server/jsenv_core_packages.js +1550 -0
- package/dist/start_build_server/start_build_server.js +2 -4
- package/dist/start_dev_server/jsenv_core_node_modules.js +685 -0
- package/dist/start_dev_server/jsenv_core_packages.js +6185 -0
- package/dist/start_dev_server/start_dev_server.js +2 -2
- package/package.json +3 -4
- package/src/build/build_specifier_manager.js +2 -2
- package/src/build/build_urls_generator.js +42 -5
- package/dist/jsenv_core_node_modules.js +0 -2069
- /package/dist/{browserslist_index → build/browserslist_index}/browserslist_index.js +0 -0
package/dist/build/build.js
CHANGED
|
@@ -4,18 +4,18 @@ import { jsenvPluginMinification } from "@jsenv/plugin-minification";
|
|
|
4
4
|
import { jsenvPluginTranspilation, jsenvPluginJsModuleFallback } from "@jsenv/plugin-transpilation";
|
|
5
5
|
import { memoryUsage } from "node:process";
|
|
6
6
|
import { readFileSync, existsSync, readdirSync, lstatSync, realpathSync } from "node:fs";
|
|
7
|
-
import { lookupPackageDirectory
|
|
7
|
+
import { lookupPackageDirectory, registerDirectoryLifecycle, urlToRelativeUrl, createDetailedMessage, stringifyUrlSite, generateContentFrame, validateResponseIntegrity, urlIsInsideOf, ensureWindowsDriveLetter, setUrlFilename, moveUrl, getCallerPosition, urlToBasename, urlToExtension, asSpecifierWithoutSearch, asUrlWithoutSearch, injectQueryParamsIntoSpecifier, bufferToEtag, isFileSystemPath, urlToPathname, setUrlBasename, urlToFileSystemPath, writeFileSync, createLogger, URL_META, applyNodeEsmResolution, RUNTIME_COMPAT, normalizeUrl, ANSI, CONTENT_TYPE, urlToFilename, DATA_URL, errorToHTML, normalizeImportMap, composeTwoImportMaps, resolveImport, JS_QUOTES, defaultLookupPackageScope, defaultReadPackageJson, readCustomConditionsFromProcessArgs, readEntryStatSync, ensurePathnameTrailingSlash, compareFileUrls, applyFileSystemMagicResolution, getExtensionsToTry, setUrlExtension, isSpecifierForNodeBuiltin, renderDetails, humanizeDuration, humanizeFileSize, renderTable, renderBigSection, distributePercentages, humanizeMemory, comparePathnames, UNICODE, escapeRegexpSpecialChars, injectQueryParamIntoSpecifierWithoutEncoding, renderUrlOrRelativeUrlFilename, injectQueryParams, assertAndNormalizeDirectoryUrl, Abort, raceProcessTeardownEvents, startMonitoringCpuUsage, startMonitoringMemoryUsage, createLookupPackageDirectory, readPackageAtOrNull, inferRuntimeCompatFromClosestPackage, browserDefaultRuntimeCompat, nodeDefaultRuntimeCompat, clearDirectorySync, createTaskLog, ensureEmptyDirectory, updateJsonFileSync, createDynamicLog } from "./jsenv_core_packages.js";
|
|
8
8
|
import { pathToFileURL } from "node:url";
|
|
9
9
|
import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, generateSourcemapDataUrl, SOURCEMAP } from "@jsenv/sourcemap";
|
|
10
10
|
import { performance } from "node:perf_hooks";
|
|
11
11
|
import { jsenvPluginSupervisor } from "@jsenv/plugin-supervisor";
|
|
12
12
|
import { WebSocketResponse, pickContentType } from "@jsenv/server";
|
|
13
13
|
import { randomUUID, createHash } from "node:crypto";
|
|
14
|
-
import "
|
|
14
|
+
import "./jsenv_core_node_modules.js";
|
|
15
15
|
import "node:os";
|
|
16
16
|
import "node:tty";
|
|
17
|
-
import "node:util";
|
|
18
17
|
import "node:path";
|
|
18
|
+
import "node:util";
|
|
19
19
|
|
|
20
20
|
const getDirectoryWatchPatterns = (
|
|
21
21
|
directoryUrl,
|
|
@@ -9020,7 +9020,6 @@ const createBuildSpecifierManager = ({
|
|
|
9020
9020
|
buildUrl = generateSourcemapFileUrl(parentBuildUrl);
|
|
9021
9021
|
reference.generatedSpecifier = buildUrl;
|
|
9022
9022
|
} else {
|
|
9023
|
-
const url = reference.generatedUrl;
|
|
9024
9023
|
const rawUrlInfo = rawKitchen.graph.getUrlInfo(reference.url);
|
|
9025
9024
|
let urlInfo;
|
|
9026
9025
|
if (rawUrlInfo) {
|
|
@@ -9030,6 +9029,7 @@ const createBuildSpecifierManager = ({
|
|
|
9030
9029
|
buildUrlInfo.subtype = reference.expectedSubtype;
|
|
9031
9030
|
urlInfo = buildUrlInfo;
|
|
9032
9031
|
}
|
|
9032
|
+
const url = reference.generatedUrl;
|
|
9033
9033
|
buildUrl = buildUrlsGenerator.generate(url, {
|
|
9034
9034
|
urlInfo,
|
|
9035
9035
|
ownerUrlInfo: reference.ownerUrlInfo,
|
|
@@ -9207,7 +9207,7 @@ const createBuildSpecifierManager = ({
|
|
|
9207
9207
|
js_classic: undefined, // TODO: add comment to explain who is using this
|
|
9208
9208
|
entry_point: undefined,
|
|
9209
9209
|
dynamic_import: undefined,
|
|
9210
|
-
dynamic_import_id: undefined,
|
|
9210
|
+
// dynamic_import_id: undefined,
|
|
9211
9211
|
};
|
|
9212
9212
|
},
|
|
9213
9213
|
formatReference: (reference) => {
|
|
@@ -10349,6 +10349,20 @@ const createBuildUrlsGenerator = ({
|
|
|
10349
10349
|
return buildUrlFromMap;
|
|
10350
10350
|
}
|
|
10351
10351
|
if (urlIsInsideOf(url, buildDirectoryUrl)) {
|
|
10352
|
+
if (ownerUrlInfo.searchParams.has("dynamic_import_id")) {
|
|
10353
|
+
const ownerDirectoryPath = determineDirectoryPath({
|
|
10354
|
+
sourceDirectoryUrl,
|
|
10355
|
+
assetsDirectory,
|
|
10356
|
+
urlInfo: ownerUrlInfo,
|
|
10357
|
+
});
|
|
10358
|
+
const buildRelativeUrl = urlToRelativeUrl(url, buildDirectoryUrl);
|
|
10359
|
+
let buildUrl = `${buildDirectoryUrl}${ownerDirectoryPath}${buildRelativeUrl}`;
|
|
10360
|
+
buildUrl = injectQueryParams(buildUrl, {
|
|
10361
|
+
dynamic_import_id: undefined,
|
|
10362
|
+
});
|
|
10363
|
+
associateBuildUrl(url, buildUrl);
|
|
10364
|
+
return buildUrl;
|
|
10365
|
+
}
|
|
10352
10366
|
associateBuildUrl(url, url);
|
|
10353
10367
|
return url;
|
|
10354
10368
|
}
|
|
@@ -10369,7 +10383,8 @@ const createBuildUrlsGenerator = ({
|
|
|
10369
10383
|
} else {
|
|
10370
10384
|
directoryPath = urlToRelativeUrl(url, sourceDirectoryUrl);
|
|
10371
10385
|
}
|
|
10372
|
-
const
|
|
10386
|
+
const urlObject = new URL(url);
|
|
10387
|
+
const { search } = urlObject;
|
|
10373
10388
|
const buildUrl = `${buildDirectoryUrl}${directoryPath}${search}`;
|
|
10374
10389
|
associateBuildUrl(url, buildUrl);
|
|
10375
10390
|
return buildUrl;
|
|
@@ -10387,6 +10402,7 @@ const createBuildUrlsGenerator = ({
|
|
|
10387
10402
|
nameSetPerDirectoryMap.set(directoryPath, nameSet);
|
|
10388
10403
|
}
|
|
10389
10404
|
const urlObject = new URL(url);
|
|
10405
|
+
injectQueryParams(urlObject, { dynamic_import_id: undefined });
|
|
10390
10406
|
let { search, hash } = urlObject;
|
|
10391
10407
|
let urlName = getUrlName(url, urlInfo);
|
|
10392
10408
|
let [basename, extension] = splitFileExtension(urlName);
|
|
@@ -10433,7 +10449,7 @@ const determineDirectoryPath = ({
|
|
|
10433
10449
|
sourceDirectoryUrl,
|
|
10434
10450
|
assetsDirectory,
|
|
10435
10451
|
urlInfo,
|
|
10436
|
-
ownerUrlInfo,
|
|
10452
|
+
ownerUrlInfo = urlInfo.firstReference.ownerUrlInfo,
|
|
10437
10453
|
}) => {
|
|
10438
10454
|
if (urlInfo.dirnameHint) {
|
|
10439
10455
|
return urlInfo.dirnameHint;
|
|
@@ -10445,13 +10461,29 @@ const determineDirectoryPath = ({
|
|
|
10445
10461
|
const parentDirectoryPath = determineDirectoryPath({
|
|
10446
10462
|
sourceDirectoryUrl,
|
|
10447
10463
|
assetsDirectory,
|
|
10448
|
-
urlInfo: ownerUrlInfo
|
|
10464
|
+
urlInfo: ownerUrlInfo,
|
|
10449
10465
|
});
|
|
10450
10466
|
return parentDirectoryPath;
|
|
10451
10467
|
}
|
|
10452
10468
|
const dynamicImportId = urlInfo.searchParams.get("dynamic_import_id");
|
|
10453
10469
|
if (dynamicImportId) {
|
|
10454
|
-
|
|
10470
|
+
const ancestorImportIds = [];
|
|
10471
|
+
let ancestorUrlInfo = ownerUrlInfo;
|
|
10472
|
+
let currentImportId = dynamicImportId;
|
|
10473
|
+
while (ancestorUrlInfo) {
|
|
10474
|
+
const ancestorDynamicImportId =
|
|
10475
|
+
ancestorUrlInfo.searchParams.get("dynamic_import_id");
|
|
10476
|
+
if (!ancestorDynamicImportId) {
|
|
10477
|
+
break;
|
|
10478
|
+
}
|
|
10479
|
+
if (ancestorDynamicImportId !== currentImportId) {
|
|
10480
|
+
ancestorImportIds.push(ancestorDynamicImportId);
|
|
10481
|
+
currentImportId = ancestorDynamicImportId;
|
|
10482
|
+
}
|
|
10483
|
+
ancestorUrlInfo = ancestorUrlInfo.firstReference?.ownerUrlInfo;
|
|
10484
|
+
}
|
|
10485
|
+
const importIdPath = [...ancestorImportIds, dynamicImportId].join("/");
|
|
10486
|
+
return `${assetsDirectory}${importIdPath}/`;
|
|
10455
10487
|
}
|
|
10456
10488
|
if (urlInfo.isEntryPoint && !urlInfo.isDynamicEntryPoint) {
|
|
10457
10489
|
return "";
|