@jsenv/core 40.1.7 → 40.2.1
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 +119 -10
- package/dist/jsenv_core_packages.js +1 -1
- package/dist/start_dev_server/start_dev_server.js +6 -1
- package/package.json +1 -1
- package/src/build/build.js +85 -6
- package/src/build/build_specifier_manager.js +31 -4
- package/src/dev/start_dev_server.js +2 -0
- package/src/plugins/plugins.js +4 -1
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, 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";
|
|
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, readPackageAtOrNull, 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";
|
|
@@ -8193,6 +8193,7 @@ const getCorePlugins = ({
|
|
|
8193
8193
|
http = false,
|
|
8194
8194
|
|
|
8195
8195
|
clientAutoreload,
|
|
8196
|
+
clientAutoreloadOnServerRestart,
|
|
8196
8197
|
cacheControl,
|
|
8197
8198
|
scenarioPlaceholders = true,
|
|
8198
8199
|
ribbon = true,
|
|
@@ -8262,7 +8263,9 @@ const getCorePlugins = ({
|
|
|
8262
8263
|
|
|
8263
8264
|
// "jsenvPluginSupervisor" MUST be after "jsenvPluginInlining" as it needs inline script to be cooked
|
|
8264
8265
|
...(supervisor ? [jsenvPluginSupervisor(supervisor)] : []),
|
|
8265
|
-
|
|
8266
|
+
...(clientAutoreloadOnServerRestart
|
|
8267
|
+
? [jsenvPluginAutoreloadOnServerRestart()]
|
|
8268
|
+
: []),
|
|
8266
8269
|
|
|
8267
8270
|
jsenvPluginCommonJsGlobals(),
|
|
8268
8271
|
jsenvPluginImportMetaScenarios(),
|
|
@@ -8703,6 +8706,7 @@ const createBuildSpecifierManager = ({
|
|
|
8703
8706
|
versioningMethod,
|
|
8704
8707
|
versionLength,
|
|
8705
8708
|
canUseImportmap,
|
|
8709
|
+
onSourceFileBuild,
|
|
8706
8710
|
}) => {
|
|
8707
8711
|
const placeholderAPI = createPlaceholderAPI({
|
|
8708
8712
|
length,
|
|
@@ -8714,18 +8718,18 @@ const createBuildSpecifierManager = ({
|
|
|
8714
8718
|
|
|
8715
8719
|
const generateReplacement = (reference) => {
|
|
8716
8720
|
let buildUrl;
|
|
8721
|
+
const buildUrlInfo = reference.urlInfo;
|
|
8717
8722
|
if (reference.type === "sourcemap_comment") {
|
|
8718
8723
|
const parentBuildUrl = urlInfoToBuildUrlMap.get(reference.ownerUrlInfo);
|
|
8719
8724
|
buildUrl = generateSourcemapFileUrl(parentBuildUrl);
|
|
8720
8725
|
reference.generatedSpecifier = buildUrl;
|
|
8721
8726
|
} else {
|
|
8722
8727
|
const url = reference.generatedUrl;
|
|
8723
|
-
let urlInfo;
|
|
8724
8728
|
const rawUrlInfo = rawKitchen.graph.getUrlInfo(reference.url);
|
|
8729
|
+
let urlInfo;
|
|
8725
8730
|
if (rawUrlInfo) {
|
|
8726
8731
|
urlInfo = rawUrlInfo;
|
|
8727
8732
|
} else {
|
|
8728
|
-
const buildUrlInfo = reference.urlInfo;
|
|
8729
8733
|
buildUrlInfo.type = reference.expectedType || "asset";
|
|
8730
8734
|
buildUrlInfo.subtype = reference.expectedSubtype;
|
|
8731
8735
|
urlInfo = buildUrlInfo;
|
|
@@ -8769,6 +8773,31 @@ const createBuildSpecifierManager = ({
|
|
|
8769
8773
|
buildSpecifier,
|
|
8770
8774
|
reference,
|
|
8771
8775
|
);
|
|
8776
|
+
|
|
8777
|
+
if (buildUrlInfo.sourceUrls) {
|
|
8778
|
+
for (const sourceUrl of buildUrlInfo.sourceUrls) {
|
|
8779
|
+
const rawUrlInfo = rawKitchen.graph.getUrlInfo(sourceUrl);
|
|
8780
|
+
if (rawUrlInfo) {
|
|
8781
|
+
onSourceFileBuild({
|
|
8782
|
+
sourceUrlInfo: rawUrlInfo,
|
|
8783
|
+
buildUrlInfo,
|
|
8784
|
+
sourceFileUrl: rawUrlInfo.url,
|
|
8785
|
+
buildFileUrl: buildUrl,
|
|
8786
|
+
});
|
|
8787
|
+
}
|
|
8788
|
+
}
|
|
8789
|
+
} else if (buildUrlInfo.originalUrl) {
|
|
8790
|
+
const rawUrlInfo = rawKitchen.graph.getUrlInfo(buildUrlInfo.originalUrl);
|
|
8791
|
+
if (rawUrlInfo) {
|
|
8792
|
+
onSourceFileBuild({
|
|
8793
|
+
sourceUrlInfo: rawUrlInfo,
|
|
8794
|
+
buildUrlInfo,
|
|
8795
|
+
sourceFileUrl: rawUrlInfo.url,
|
|
8796
|
+
buildFileUrl: buildUrl,
|
|
8797
|
+
});
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
|
|
8772
8801
|
return buildGeneratedSpecifier;
|
|
8773
8802
|
};
|
|
8774
8803
|
const internalRedirections = new Map();
|
|
@@ -8945,6 +8974,7 @@ const createBuildSpecifierManager = ({
|
|
|
8945
8974
|
if (!finalUrlInfo.filenameHint && bundleInfo.data.bundleRelativeUrl) {
|
|
8946
8975
|
finalUrlInfo.filenameHint = bundleInfo.data.bundleRelativeUrl;
|
|
8947
8976
|
}
|
|
8977
|
+
finalUrlInfo.sourceUrls = bundleInfo.sourceUrls;
|
|
8948
8978
|
return {
|
|
8949
8979
|
// url: bundleInfo.url,
|
|
8950
8980
|
originalUrl: bundleInfo.originalUrl,
|
|
@@ -8957,6 +8987,7 @@ const createBuildSpecifierManager = ({
|
|
|
8957
8987
|
}
|
|
8958
8988
|
const rawUrlInfo = rawKitchen.graph.getUrlInfo(rawUrl);
|
|
8959
8989
|
if (rawUrlInfo) {
|
|
8990
|
+
// if the rawUrl info had
|
|
8960
8991
|
if (rawUrlInfo.type === "entry_build") {
|
|
8961
8992
|
const otherEntryBuildInfo = rawUrlInfo.otherEntryBuildInfo;
|
|
8962
8993
|
if (
|
|
@@ -10731,6 +10762,83 @@ const build = async ({
|
|
|
10731
10762
|
const startDate = Date.now();
|
|
10732
10763
|
const { onBuildEnd, onEntryPointBuildStart } = startBuildLogs();
|
|
10733
10764
|
|
|
10765
|
+
const sourceFileBuildCallbackMap = new Map();
|
|
10766
|
+
const registerSourceFileBuildEffect = (url, callback) => {
|
|
10767
|
+
const buildCallbackSet = sourceFileBuildCallbackMap.get(url);
|
|
10768
|
+
if (buildCallbackSet) {
|
|
10769
|
+
buildCallbackSet.add(callback);
|
|
10770
|
+
} else {
|
|
10771
|
+
const set = new Set();
|
|
10772
|
+
set.add(callback);
|
|
10773
|
+
sourceFileBuildCallbackMap.set(url, set);
|
|
10774
|
+
}
|
|
10775
|
+
};
|
|
10776
|
+
const onSourceFileBuild = ({
|
|
10777
|
+
sourceUrlInfo,
|
|
10778
|
+
sourceFileUrl,
|
|
10779
|
+
buildFileUrl,
|
|
10780
|
+
}) => {
|
|
10781
|
+
const buildCallbackSet = sourceFileBuildCallbackMap.get(sourceFileUrl);
|
|
10782
|
+
if (buildCallbackSet) {
|
|
10783
|
+
for (const buildCallback of buildCallbackSet) {
|
|
10784
|
+
buildCallback({ sourceUrlInfo, buildFileUrl });
|
|
10785
|
+
}
|
|
10786
|
+
}
|
|
10787
|
+
};
|
|
10788
|
+
sync_package_side_effects: {
|
|
10789
|
+
if (!packageDirectoryUrl) {
|
|
10790
|
+
break sync_package_side_effects;
|
|
10791
|
+
}
|
|
10792
|
+
if (
|
|
10793
|
+
urlIsInsideOf(packageDirectoryUrl, jsenvCoreDirectoryUrl) ||
|
|
10794
|
+
packageDirectoryUrl === String(jsenvCoreDirectoryUrl)
|
|
10795
|
+
) {
|
|
10796
|
+
break sync_package_side_effects;
|
|
10797
|
+
}
|
|
10798
|
+
const packageJson = readPackageAtOrNull(packageDirectoryUrl);
|
|
10799
|
+
if (!packageJson) {
|
|
10800
|
+
break sync_package_side_effects;
|
|
10801
|
+
}
|
|
10802
|
+
const { sideEffects } = packageJson;
|
|
10803
|
+
if (!sideEffects || !Array.isArray(sideEffects)) {
|
|
10804
|
+
break sync_package_side_effects;
|
|
10805
|
+
}
|
|
10806
|
+
const sideEffectFileUrlSet = new Set();
|
|
10807
|
+
const packageJsonFileUrl = new URL("./package.json", packageDirectoryUrl)
|
|
10808
|
+
.href;
|
|
10809
|
+
for (const sideEffectFileRelativeUrl of sideEffects) {
|
|
10810
|
+
const sideEffectFileUrl = new URL(
|
|
10811
|
+
sideEffectFileRelativeUrl,
|
|
10812
|
+
packageDirectoryUrl,
|
|
10813
|
+
).href;
|
|
10814
|
+
sideEffectFileUrlSet.add(sideEffectFileUrl);
|
|
10815
|
+
registerSourceFileBuildEffect(
|
|
10816
|
+
sideEffectFileUrl,
|
|
10817
|
+
({ sourceUrlInfo, buildFileUrl }) => {
|
|
10818
|
+
if (sourceUrlInfo.isInline) {
|
|
10819
|
+
return;
|
|
10820
|
+
}
|
|
10821
|
+
const urlRelativeToPackage = urlToRelativeUrl(
|
|
10822
|
+
buildFileUrl,
|
|
10823
|
+
packageDirectoryUrl,
|
|
10824
|
+
);
|
|
10825
|
+
if (sideEffectFileUrlSet.has(buildFileUrl)) {
|
|
10826
|
+
return;
|
|
10827
|
+
}
|
|
10828
|
+
sideEffects.push(
|
|
10829
|
+
urlRelativeToPackage[0] === "."
|
|
10830
|
+
? urlRelativeToPackage
|
|
10831
|
+
: `./${urlRelativeToPackage}`,
|
|
10832
|
+
);
|
|
10833
|
+
writeFileSync(
|
|
10834
|
+
packageJsonFileUrl,
|
|
10835
|
+
JSON.stringify(packageJson, null, " "),
|
|
10836
|
+
);
|
|
10837
|
+
},
|
|
10838
|
+
);
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10841
|
+
|
|
10734
10842
|
const buildUrlsGenerator = createBuildUrlsGenerator({
|
|
10735
10843
|
sourceDirectoryUrl,
|
|
10736
10844
|
buildDirectoryUrl,
|
|
@@ -10783,6 +10891,7 @@ const build = async ({
|
|
|
10783
10891
|
sourceRelativeUrl: entryPoint.sourceRelativeUrl,
|
|
10784
10892
|
buildUrlsGenerator,
|
|
10785
10893
|
someEntryPointUseNode,
|
|
10894
|
+
onSourceFileBuild,
|
|
10786
10895
|
},
|
|
10787
10896
|
entryPoint.params,
|
|
10788
10897
|
);
|
|
@@ -10866,12 +10975,10 @@ const build = async ({
|
|
|
10866
10975
|
if (writeOnFileSystem) {
|
|
10867
10976
|
clearDirectorySync(buildDirectoryUrl, buildDirectoryCleanPatterns);
|
|
10868
10977
|
const buildRelativeUrls = Object.keys(buildFileContents);
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
);
|
|
10874
|
-
});
|
|
10978
|
+
for (const buildRelativeUrl of buildRelativeUrls) {
|
|
10979
|
+
const buildUrl = new URL(buildRelativeUrl, buildDirectoryUrl);
|
|
10980
|
+
writeFileSync(buildUrl, buildFileContents[buildRelativeUrl]);
|
|
10981
|
+
}
|
|
10875
10982
|
}
|
|
10876
10983
|
onBuildEnd({
|
|
10877
10984
|
buildFileContents,
|
|
@@ -11007,6 +11114,7 @@ const prepareEntryPointBuild = async (
|
|
|
11007
11114
|
outDirectoryUrl,
|
|
11008
11115
|
buildUrlsGenerator,
|
|
11009
11116
|
someEntryPointUseNode,
|
|
11117
|
+
onSourceFileBuild,
|
|
11010
11118
|
},
|
|
11011
11119
|
entryPointParams,
|
|
11012
11120
|
) => {
|
|
@@ -11250,6 +11358,7 @@ const prepareEntryPointBuild = async (
|
|
|
11250
11358
|
versioningViaImportmap &&
|
|
11251
11359
|
rawKitchen.graph.getUrlInfo(entryReference.url).type === "html" &&
|
|
11252
11360
|
rawKitchen.context.isSupportedOnCurrentClients("importmap"),
|
|
11361
|
+
onSourceFileBuild,
|
|
11253
11362
|
});
|
|
11254
11363
|
const finalPluginStore = createPluginStore([
|
|
11255
11364
|
jsenvPluginReferenceAnalysis({
|
|
@@ -23677,4 +23677,4 @@ const assertAndNormalizeDirectoryUrl = (
|
|
|
23677
23677
|
return value;
|
|
23678
23678
|
};
|
|
23679
23679
|
|
|
23680
|
-
export { ANSI$2 as ANSI, ANSI$1, Abort$1 as Abort, Abort as Abort$1, CONTENT_TYPE$1 as CONTENT_TYPE, CONTENT_TYPE as CONTENT_TYPE$1, DATA_URL$1 as DATA_URL, DATA_URL as DATA_URL$1, JS_QUOTES$1 as JS_QUOTES, JS_QUOTES as JS_QUOTES$1, RUNTIME_COMPAT$1 as RUNTIME_COMPAT, RUNTIME_COMPAT as RUNTIME_COMPAT$1, UNICODE$1 as UNICODE, URL_META$1 as URL_META, URL_META as URL_META$1, applyFileSystemMagicResolution$1 as applyFileSystemMagicResolution, applyFileSystemMagicResolution as applyFileSystemMagicResolution$1, applyNodeEsmResolution$1 as applyNodeEsmResolution, applyNodeEsmResolution as applyNodeEsmResolution$1, asSpecifierWithoutSearch$1 as asSpecifierWithoutSearch, asSpecifierWithoutSearch as asSpecifierWithoutSearch$1, asUrlWithoutSearch$1 as asUrlWithoutSearch, asUrlWithoutSearch as asUrlWithoutSearch$1, assertAndNormalizeDirectoryUrl$2 as assertAndNormalizeDirectoryUrl, assertAndNormalizeDirectoryUrl$1, assertAndNormalizeDirectoryUrl as assertAndNormalizeDirectoryUrl$2, browserDefaultRuntimeCompat, bufferToEtag$1 as bufferToEtag, bufferToEtag as bufferToEtag$1, clearDirectorySync, compareFileUrls$1 as compareFileUrls, compareFileUrls as compareFileUrls$1, comparePathnames, composeTwoImportMaps$1 as composeTwoImportMaps, composeTwoImportMaps as composeTwoImportMaps$1, createDetailedMessage$3 as createDetailedMessage, createDetailedMessage$1, createDynamicLog$1 as createDynamicLog, createLogger$2 as createLogger, createLogger$1, createLogger as createLogger$2, createTaskLog$2 as createTaskLog, createTaskLog$1, createTaskLog as createTaskLog$2, defaultLookupPackageScope$1 as defaultLookupPackageScope, defaultLookupPackageScope as defaultLookupPackageScope$1, defaultReadPackageJson$1 as defaultReadPackageJson, defaultReadPackageJson as defaultReadPackageJson$1, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash$2 as ensurePathnameTrailingSlash, ensurePathnameTrailingSlash$1, ensureWindowsDriveLetter$1 as ensureWindowsDriveLetter, ensureWindowsDriveLetter as ensureWindowsDriveLetter$1, escapeRegexpSpecialChars, generateContentFrame$1 as generateContentFrame, generateContentFrame as generateContentFrame$1, getCallerPosition$1 as getCallerPosition, getCallerPosition as getCallerPosition$1, getExtensionsToTry$1 as getExtensionsToTry, getExtensionsToTry as getExtensionsToTry$1, humanizeDuration$1 as humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParamsIntoSpecifier$1 as injectQueryParamsIntoSpecifier, injectQueryParamsIntoSpecifier as injectQueryParamsIntoSpecifier$1, isFileSystemPath$2 as isFileSystemPath, isFileSystemPath$1, jsenvPluginBundling, jsenvPluginJsModuleFallback, jsenvPluginMinification, jsenvPluginTranspilation$1 as jsenvPluginTranspilation, jsenvPluginTranspilation as jsenvPluginTranspilation$1, lookupPackageDirectory$1 as lookupPackageDirectory, lookupPackageDirectory as lookupPackageDirectory$1, memoizeByFirstArgument, moveUrl$1 as moveUrl, moveUrl as moveUrl$1, nodeDefaultRuntimeCompat, normalizeImportMap$1 as normalizeImportMap, normalizeImportMap as normalizeImportMap$1, normalizeUrl$1 as normalizeUrl, normalizeUrl as normalizeUrl$1, raceProcessTeardownEvents$1 as raceProcessTeardownEvents, raceProcessTeardownEvents as raceProcessTeardownEvents$1, readCustomConditionsFromProcessArgs$1 as readCustomConditionsFromProcessArgs, readCustomConditionsFromProcessArgs as readCustomConditionsFromProcessArgs$1, readEntryStatSync$1 as readEntryStatSync, readEntryStatSync as readEntryStatSync$1, registerDirectoryLifecycle$1 as registerDirectoryLifecycle, registerDirectoryLifecycle as registerDirectoryLifecycle$1, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport$1 as resolveImport, resolveImport as resolveImport$1, setUrlBasename$1 as setUrlBasename, setUrlBasename as setUrlBasename$1, setUrlExtension$1 as setUrlExtension, setUrlExtension as setUrlExtension$1, setUrlFilename$1 as setUrlFilename, setUrlFilename as setUrlFilename$1, startMonitoringCpuUsage, startMonitoringMemoryUsage, stringifyUrlSite$1 as stringifyUrlSite, stringifyUrlSite as stringifyUrlSite$1, urlIsInsideOf$1 as urlIsInsideOf, urlIsInsideOf as urlIsInsideOf$1, urlToBasename$1 as urlToBasename, urlToBasename as urlToBasename$1, urlToExtension$4 as urlToExtension, urlToExtension$2 as urlToExtension$1, urlToExtension as urlToExtension$2, urlToFileSystemPath$1 as urlToFileSystemPath, urlToFileSystemPath as urlToFileSystemPath$1, urlToFilename$3 as urlToFilename, urlToFilename$1, urlToPathname$4 as urlToPathname, urlToPathname$2 as urlToPathname$1, urlToPathname as urlToPathname$2, urlToRelativeUrl$1 as urlToRelativeUrl, urlToRelativeUrl as urlToRelativeUrl$1, validateResponseIntegrity$1 as validateResponseIntegrity, validateResponseIntegrity as validateResponseIntegrity$1, writeFileSync$1 as writeFileSync, writeFileSync as writeFileSync$1 };
|
|
23680
|
+
export { ANSI$2 as ANSI, ANSI$1, Abort$1 as Abort, Abort as Abort$1, CONTENT_TYPE$1 as CONTENT_TYPE, CONTENT_TYPE as CONTENT_TYPE$1, DATA_URL$1 as DATA_URL, DATA_URL as DATA_URL$1, JS_QUOTES$1 as JS_QUOTES, JS_QUOTES as JS_QUOTES$1, RUNTIME_COMPAT$1 as RUNTIME_COMPAT, RUNTIME_COMPAT as RUNTIME_COMPAT$1, UNICODE$1 as UNICODE, URL_META$1 as URL_META, URL_META as URL_META$1, applyFileSystemMagicResolution$1 as applyFileSystemMagicResolution, applyFileSystemMagicResolution as applyFileSystemMagicResolution$1, applyNodeEsmResolution$1 as applyNodeEsmResolution, applyNodeEsmResolution as applyNodeEsmResolution$1, asSpecifierWithoutSearch$1 as asSpecifierWithoutSearch, asSpecifierWithoutSearch as asSpecifierWithoutSearch$1, asUrlWithoutSearch$1 as asUrlWithoutSearch, asUrlWithoutSearch as asUrlWithoutSearch$1, assertAndNormalizeDirectoryUrl$2 as assertAndNormalizeDirectoryUrl, assertAndNormalizeDirectoryUrl$1, assertAndNormalizeDirectoryUrl as assertAndNormalizeDirectoryUrl$2, browserDefaultRuntimeCompat, bufferToEtag$1 as bufferToEtag, bufferToEtag as bufferToEtag$1, clearDirectorySync, compareFileUrls$1 as compareFileUrls, compareFileUrls as compareFileUrls$1, comparePathnames, composeTwoImportMaps$1 as composeTwoImportMaps, composeTwoImportMaps as composeTwoImportMaps$1, createDetailedMessage$3 as createDetailedMessage, createDetailedMessage$1, createDynamicLog$1 as createDynamicLog, createLogger$2 as createLogger, createLogger$1, createLogger as createLogger$2, createTaskLog$2 as createTaskLog, createTaskLog$1, createTaskLog as createTaskLog$2, defaultLookupPackageScope$1 as defaultLookupPackageScope, defaultLookupPackageScope as defaultLookupPackageScope$1, defaultReadPackageJson$1 as defaultReadPackageJson, defaultReadPackageJson as defaultReadPackageJson$1, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash$2 as ensurePathnameTrailingSlash, ensurePathnameTrailingSlash$1, ensureWindowsDriveLetter$1 as ensureWindowsDriveLetter, ensureWindowsDriveLetter as ensureWindowsDriveLetter$1, escapeRegexpSpecialChars, generateContentFrame$1 as generateContentFrame, generateContentFrame as generateContentFrame$1, getCallerPosition$1 as getCallerPosition, getCallerPosition as getCallerPosition$1, getExtensionsToTry$1 as getExtensionsToTry, getExtensionsToTry as getExtensionsToTry$1, humanizeDuration$1 as humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParamsIntoSpecifier$1 as injectQueryParamsIntoSpecifier, injectQueryParamsIntoSpecifier as injectQueryParamsIntoSpecifier$1, isFileSystemPath$2 as isFileSystemPath, isFileSystemPath$1, jsenvPluginBundling, jsenvPluginJsModuleFallback, jsenvPluginMinification, jsenvPluginTranspilation$1 as jsenvPluginTranspilation, jsenvPluginTranspilation as jsenvPluginTranspilation$1, lookupPackageDirectory$1 as lookupPackageDirectory, lookupPackageDirectory as lookupPackageDirectory$1, memoizeByFirstArgument, moveUrl$1 as moveUrl, moveUrl as moveUrl$1, nodeDefaultRuntimeCompat, normalizeImportMap$1 as normalizeImportMap, normalizeImportMap as normalizeImportMap$1, normalizeUrl$1 as normalizeUrl, normalizeUrl as normalizeUrl$1, raceProcessTeardownEvents$1 as raceProcessTeardownEvents, raceProcessTeardownEvents as raceProcessTeardownEvents$1, readCustomConditionsFromProcessArgs$1 as readCustomConditionsFromProcessArgs, readCustomConditionsFromProcessArgs as readCustomConditionsFromProcessArgs$1, readEntryStatSync$1 as readEntryStatSync, readEntryStatSync as readEntryStatSync$1, readPackageAtOrNull, registerDirectoryLifecycle$1 as registerDirectoryLifecycle, registerDirectoryLifecycle as registerDirectoryLifecycle$1, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport$1 as resolveImport, resolveImport as resolveImport$1, setUrlBasename$1 as setUrlBasename, setUrlBasename as setUrlBasename$1, setUrlExtension$1 as setUrlExtension, setUrlExtension as setUrlExtension$1, setUrlFilename$1 as setUrlFilename, setUrlFilename as setUrlFilename$1, startMonitoringCpuUsage, startMonitoringMemoryUsage, stringifyUrlSite$1 as stringifyUrlSite, stringifyUrlSite as stringifyUrlSite$1, urlIsInsideOf$1 as urlIsInsideOf, urlIsInsideOf as urlIsInsideOf$1, urlToBasename$1 as urlToBasename, urlToBasename as urlToBasename$1, urlToExtension$4 as urlToExtension, urlToExtension$2 as urlToExtension$1, urlToExtension as urlToExtension$2, urlToFileSystemPath$1 as urlToFileSystemPath, urlToFileSystemPath as urlToFileSystemPath$1, urlToFilename$3 as urlToFilename, urlToFilename$1, urlToPathname$4 as urlToPathname, urlToPathname$2 as urlToPathname$1, urlToPathname as urlToPathname$2, urlToRelativeUrl$1 as urlToRelativeUrl, urlToRelativeUrl as urlToRelativeUrl$1, validateResponseIntegrity$1 as validateResponseIntegrity, validateResponseIntegrity as validateResponseIntegrity$1, writeFileSync$1 as writeFileSync, writeFileSync as writeFileSync$1 };
|
|
@@ -8234,6 +8234,7 @@ const getCorePlugins = ({
|
|
|
8234
8234
|
http = false,
|
|
8235
8235
|
|
|
8236
8236
|
clientAutoreload,
|
|
8237
|
+
clientAutoreloadOnServerRestart,
|
|
8237
8238
|
cacheControl,
|
|
8238
8239
|
scenarioPlaceholders = true,
|
|
8239
8240
|
ribbon = true,
|
|
@@ -8303,7 +8304,9 @@ const getCorePlugins = ({
|
|
|
8303
8304
|
|
|
8304
8305
|
// "jsenvPluginSupervisor" MUST be after "jsenvPluginInlining" as it needs inline script to be cooked
|
|
8305
8306
|
...(supervisor ? [jsenvPluginSupervisor(supervisor)] : []),
|
|
8306
|
-
|
|
8307
|
+
...(clientAutoreloadOnServerRestart
|
|
8308
|
+
? [jsenvPluginAutoreloadOnServerRestart()]
|
|
8309
|
+
: []),
|
|
8307
8310
|
|
|
8308
8311
|
jsenvPluginCommonJsGlobals(),
|
|
8309
8312
|
jsenvPluginImportMetaScenarios(),
|
|
@@ -8489,6 +8492,7 @@ const startDevServer = async ({
|
|
|
8489
8492
|
|
|
8490
8493
|
sourceFilesConfig = {},
|
|
8491
8494
|
clientAutoreload = true,
|
|
8495
|
+
clientAutoreloadOnServerRestart = true,
|
|
8492
8496
|
|
|
8493
8497
|
// runtimeCompat is the runtimeCompat for the build
|
|
8494
8498
|
// when specified, dev server use it to warn in case
|
|
@@ -8670,6 +8674,7 @@ const startDevServer = async ({
|
|
|
8670
8674
|
transpilation,
|
|
8671
8675
|
|
|
8672
8676
|
clientAutoreload,
|
|
8677
|
+
clientAutoreloadOnServerRestart,
|
|
8673
8678
|
cacheControl,
|
|
8674
8679
|
ribbon,
|
|
8675
8680
|
}),
|
package/package.json
CHANGED
package/src/build/build.js
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
compareFileUrls,
|
|
25
25
|
ensureEmptyDirectory,
|
|
26
26
|
lookupPackageDirectory,
|
|
27
|
+
readPackageAtOrNull,
|
|
27
28
|
writeFileSync,
|
|
28
29
|
} from "@jsenv/filesystem";
|
|
29
30
|
import {
|
|
@@ -515,6 +516,83 @@ export const build = async ({
|
|
|
515
516
|
const startDate = Date.now();
|
|
516
517
|
const { onBuildEnd, onEntryPointBuildStart } = startBuildLogs();
|
|
517
518
|
|
|
519
|
+
const sourceFileBuildCallbackMap = new Map();
|
|
520
|
+
const registerSourceFileBuildEffect = (url, callback) => {
|
|
521
|
+
const buildCallbackSet = sourceFileBuildCallbackMap.get(url);
|
|
522
|
+
if (buildCallbackSet) {
|
|
523
|
+
buildCallbackSet.add(callback);
|
|
524
|
+
} else {
|
|
525
|
+
const set = new Set();
|
|
526
|
+
set.add(callback);
|
|
527
|
+
sourceFileBuildCallbackMap.set(url, set);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const onSourceFileBuild = ({
|
|
531
|
+
sourceUrlInfo,
|
|
532
|
+
sourceFileUrl,
|
|
533
|
+
buildFileUrl,
|
|
534
|
+
}) => {
|
|
535
|
+
const buildCallbackSet = sourceFileBuildCallbackMap.get(sourceFileUrl);
|
|
536
|
+
if (buildCallbackSet) {
|
|
537
|
+
for (const buildCallback of buildCallbackSet) {
|
|
538
|
+
buildCallback({ sourceUrlInfo, buildFileUrl });
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
sync_package_side_effects: {
|
|
543
|
+
if (!packageDirectoryUrl) {
|
|
544
|
+
break sync_package_side_effects;
|
|
545
|
+
}
|
|
546
|
+
if (
|
|
547
|
+
urlIsInsideOf(packageDirectoryUrl, jsenvCoreDirectoryUrl) ||
|
|
548
|
+
packageDirectoryUrl === String(jsenvCoreDirectoryUrl)
|
|
549
|
+
) {
|
|
550
|
+
break sync_package_side_effects;
|
|
551
|
+
}
|
|
552
|
+
const packageJson = readPackageAtOrNull(packageDirectoryUrl);
|
|
553
|
+
if (!packageJson) {
|
|
554
|
+
break sync_package_side_effects;
|
|
555
|
+
}
|
|
556
|
+
const { sideEffects } = packageJson;
|
|
557
|
+
if (!sideEffects || !Array.isArray(sideEffects)) {
|
|
558
|
+
break sync_package_side_effects;
|
|
559
|
+
}
|
|
560
|
+
const sideEffectFileUrlSet = new Set();
|
|
561
|
+
const packageJsonFileUrl = new URL("./package.json", packageDirectoryUrl)
|
|
562
|
+
.href;
|
|
563
|
+
for (const sideEffectFileRelativeUrl of sideEffects) {
|
|
564
|
+
const sideEffectFileUrl = new URL(
|
|
565
|
+
sideEffectFileRelativeUrl,
|
|
566
|
+
packageDirectoryUrl,
|
|
567
|
+
).href;
|
|
568
|
+
sideEffectFileUrlSet.add(sideEffectFileUrl);
|
|
569
|
+
registerSourceFileBuildEffect(
|
|
570
|
+
sideEffectFileUrl,
|
|
571
|
+
({ sourceUrlInfo, buildFileUrl }) => {
|
|
572
|
+
if (sourceUrlInfo.isInline) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const urlRelativeToPackage = urlToRelativeUrl(
|
|
576
|
+
buildFileUrl,
|
|
577
|
+
packageDirectoryUrl,
|
|
578
|
+
);
|
|
579
|
+
if (sideEffectFileUrlSet.has(buildFileUrl)) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
sideEffects.push(
|
|
583
|
+
urlRelativeToPackage[0] === "."
|
|
584
|
+
? urlRelativeToPackage
|
|
585
|
+
: `./${urlRelativeToPackage}`,
|
|
586
|
+
);
|
|
587
|
+
writeFileSync(
|
|
588
|
+
packageJsonFileUrl,
|
|
589
|
+
JSON.stringify(packageJson, null, " "),
|
|
590
|
+
);
|
|
591
|
+
},
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
518
596
|
const buildUrlsGenerator = createBuildUrlsGenerator({
|
|
519
597
|
sourceDirectoryUrl,
|
|
520
598
|
buildDirectoryUrl,
|
|
@@ -567,6 +645,7 @@ export const build = async ({
|
|
|
567
645
|
sourceRelativeUrl: entryPoint.sourceRelativeUrl,
|
|
568
646
|
buildUrlsGenerator,
|
|
569
647
|
someEntryPointUseNode,
|
|
648
|
+
onSourceFileBuild,
|
|
570
649
|
},
|
|
571
650
|
entryPoint.params,
|
|
572
651
|
);
|
|
@@ -650,12 +729,10 @@ export const build = async ({
|
|
|
650
729
|
if (writeOnFileSystem) {
|
|
651
730
|
clearDirectorySync(buildDirectoryUrl, buildDirectoryCleanPatterns);
|
|
652
731
|
const buildRelativeUrls = Object.keys(buildFileContents);
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
);
|
|
658
|
-
});
|
|
732
|
+
for (const buildRelativeUrl of buildRelativeUrls) {
|
|
733
|
+
const buildUrl = new URL(buildRelativeUrl, buildDirectoryUrl);
|
|
734
|
+
writeFileSync(buildUrl, buildFileContents[buildRelativeUrl]);
|
|
735
|
+
}
|
|
659
736
|
}
|
|
660
737
|
onBuildEnd({
|
|
661
738
|
buildFileContents,
|
|
@@ -791,6 +868,7 @@ const prepareEntryPointBuild = async (
|
|
|
791
868
|
outDirectoryUrl,
|
|
792
869
|
buildUrlsGenerator,
|
|
793
870
|
someEntryPointUseNode,
|
|
871
|
+
onSourceFileBuild,
|
|
794
872
|
},
|
|
795
873
|
entryPointParams,
|
|
796
874
|
) => {
|
|
@@ -1034,6 +1112,7 @@ const prepareEntryPointBuild = async (
|
|
|
1034
1112
|
versioningViaImportmap &&
|
|
1035
1113
|
rawKitchen.graph.getUrlInfo(entryReference.url).type === "html" &&
|
|
1036
1114
|
rawKitchen.context.isSupportedOnCurrentClients("importmap"),
|
|
1115
|
+
onSourceFileBuild,
|
|
1037
1116
|
});
|
|
1038
1117
|
const finalPluginStore = createPluginStore([
|
|
1039
1118
|
jsenvPluginReferenceAnalysis({
|
|
@@ -20,9 +20,8 @@ import {
|
|
|
20
20
|
urlToRelativeUrl,
|
|
21
21
|
} from "@jsenv/urls";
|
|
22
22
|
import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js";
|
|
23
|
-
import { createHash } from "node:crypto";
|
|
24
|
-
|
|
25
23
|
import { escapeRegexpSpecialChars } from "@jsenv/utils/src/string/escape_regexp_special_chars.js";
|
|
24
|
+
import { createHash } from "node:crypto";
|
|
26
25
|
import { prependContent } from "../kitchen/prepend_content.js";
|
|
27
26
|
import { GRAPH_VISITOR } from "../kitchen/url_graph/url_graph_visitor.js";
|
|
28
27
|
import { isWebWorkerUrlInfo } from "../kitchen/web_workers.js";
|
|
@@ -46,6 +45,7 @@ export const createBuildSpecifierManager = ({
|
|
|
46
45
|
versioningMethod,
|
|
47
46
|
versionLength,
|
|
48
47
|
canUseImportmap,
|
|
48
|
+
onSourceFileBuild,
|
|
49
49
|
}) => {
|
|
50
50
|
const placeholderAPI = createPlaceholderAPI({
|
|
51
51
|
length,
|
|
@@ -57,18 +57,18 @@ export const createBuildSpecifierManager = ({
|
|
|
57
57
|
|
|
58
58
|
const generateReplacement = (reference) => {
|
|
59
59
|
let buildUrl;
|
|
60
|
+
const buildUrlInfo = reference.urlInfo;
|
|
60
61
|
if (reference.type === "sourcemap_comment") {
|
|
61
62
|
const parentBuildUrl = urlInfoToBuildUrlMap.get(reference.ownerUrlInfo);
|
|
62
63
|
buildUrl = generateSourcemapFileUrl(parentBuildUrl);
|
|
63
64
|
reference.generatedSpecifier = buildUrl;
|
|
64
65
|
} else {
|
|
65
66
|
const url = reference.generatedUrl;
|
|
66
|
-
let urlInfo;
|
|
67
67
|
const rawUrlInfo = rawKitchen.graph.getUrlInfo(reference.url);
|
|
68
|
+
let urlInfo;
|
|
68
69
|
if (rawUrlInfo) {
|
|
69
70
|
urlInfo = rawUrlInfo;
|
|
70
71
|
} else {
|
|
71
|
-
const buildUrlInfo = reference.urlInfo;
|
|
72
72
|
buildUrlInfo.type = reference.expectedType || "asset";
|
|
73
73
|
buildUrlInfo.subtype = reference.expectedSubtype;
|
|
74
74
|
urlInfo = buildUrlInfo;
|
|
@@ -112,6 +112,31 @@ export const createBuildSpecifierManager = ({
|
|
|
112
112
|
buildSpecifier,
|
|
113
113
|
reference,
|
|
114
114
|
);
|
|
115
|
+
|
|
116
|
+
if (buildUrlInfo.sourceUrls) {
|
|
117
|
+
for (const sourceUrl of buildUrlInfo.sourceUrls) {
|
|
118
|
+
const rawUrlInfo = rawKitchen.graph.getUrlInfo(sourceUrl);
|
|
119
|
+
if (rawUrlInfo) {
|
|
120
|
+
onSourceFileBuild({
|
|
121
|
+
sourceUrlInfo: rawUrlInfo,
|
|
122
|
+
buildUrlInfo,
|
|
123
|
+
sourceFileUrl: rawUrlInfo.url,
|
|
124
|
+
buildFileUrl: buildUrl,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else if (buildUrlInfo.originalUrl) {
|
|
129
|
+
const rawUrlInfo = rawKitchen.graph.getUrlInfo(buildUrlInfo.originalUrl);
|
|
130
|
+
if (rawUrlInfo) {
|
|
131
|
+
onSourceFileBuild({
|
|
132
|
+
sourceUrlInfo: rawUrlInfo,
|
|
133
|
+
buildUrlInfo,
|
|
134
|
+
sourceFileUrl: rawUrlInfo.url,
|
|
135
|
+
buildFileUrl: buildUrl,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
115
140
|
return buildGeneratedSpecifier;
|
|
116
141
|
};
|
|
117
142
|
const internalRedirections = new Map();
|
|
@@ -288,6 +313,7 @@ export const createBuildSpecifierManager = ({
|
|
|
288
313
|
if (!finalUrlInfo.filenameHint && bundleInfo.data.bundleRelativeUrl) {
|
|
289
314
|
finalUrlInfo.filenameHint = bundleInfo.data.bundleRelativeUrl;
|
|
290
315
|
}
|
|
316
|
+
finalUrlInfo.sourceUrls = bundleInfo.sourceUrls;
|
|
291
317
|
return {
|
|
292
318
|
// url: bundleInfo.url,
|
|
293
319
|
originalUrl: bundleInfo.originalUrl,
|
|
@@ -300,6 +326,7 @@ export const createBuildSpecifierManager = ({
|
|
|
300
326
|
}
|
|
301
327
|
const rawUrlInfo = rawKitchen.graph.getUrlInfo(rawUrl);
|
|
302
328
|
if (rawUrlInfo) {
|
|
329
|
+
// if the rawUrl info had
|
|
303
330
|
if (rawUrlInfo.type === "entry_build") {
|
|
304
331
|
const otherEntryBuildInfo = rawUrlInfo.otherEntryBuildInfo;
|
|
305
332
|
if (
|
|
@@ -76,6 +76,7 @@ export const startDevServer = async ({
|
|
|
76
76
|
|
|
77
77
|
sourceFilesConfig = {},
|
|
78
78
|
clientAutoreload = true,
|
|
79
|
+
clientAutoreloadOnServerRestart = true,
|
|
79
80
|
|
|
80
81
|
// runtimeCompat is the runtimeCompat for the build
|
|
81
82
|
// when specified, dev server use it to warn in case
|
|
@@ -258,6 +259,7 @@ export const startDevServer = async ({
|
|
|
258
259
|
transpilation,
|
|
259
260
|
|
|
260
261
|
clientAutoreload,
|
|
262
|
+
clientAutoreloadOnServerRestart,
|
|
261
263
|
cacheControl,
|
|
262
264
|
ribbon,
|
|
263
265
|
}),
|
package/src/plugins/plugins.js
CHANGED
|
@@ -46,6 +46,7 @@ export const getCorePlugins = ({
|
|
|
46
46
|
http = false,
|
|
47
47
|
|
|
48
48
|
clientAutoreload,
|
|
49
|
+
clientAutoreloadOnServerRestart,
|
|
49
50
|
cacheControl,
|
|
50
51
|
scenarioPlaceholders = true,
|
|
51
52
|
ribbon = true,
|
|
@@ -115,7 +116,9 @@ export const getCorePlugins = ({
|
|
|
115
116
|
|
|
116
117
|
// "jsenvPluginSupervisor" MUST be after "jsenvPluginInlining" as it needs inline script to be cooked
|
|
117
118
|
...(supervisor ? [jsenvPluginSupervisor(supervisor)] : []),
|
|
118
|
-
|
|
119
|
+
...(clientAutoreloadOnServerRestart
|
|
120
|
+
? [jsenvPluginAutoreloadOnServerRestart()]
|
|
121
|
+
: []),
|
|
119
122
|
|
|
120
123
|
jsenvPluginCommonJsGlobals(),
|
|
121
124
|
jsenvPluginImportMetaScenarios(),
|