@jsenv/core 38.2.11 → 38.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "38.2.11",
3
+ "version": "38.3.0",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -135,7 +135,7 @@ export const createFileService = ({
135
135
  associations: watchAssociations,
136
136
  });
137
137
  urlInfoCreated.isWatched = watch;
138
- // wehn an url depends on many others, we check all these (like package.json)
138
+ // when an url depends on many others, we check all these (like package.json)
139
139
  urlInfoCreated.isValid = () => {
140
140
  if (!urlInfoCreated.url.startsWith("file:")) {
141
141
  return false;
@@ -386,12 +386,12 @@ const createReference = ({
386
386
  ownerUrlInfo.context.finalizeReference(reference);
387
387
  };
388
388
 
389
- // "formatReferencedUrl" can be async BUT this is an exception
389
+ // "formatReference" can be async BUT this is an exception
390
390
  // for most cases it will be sync. We want to favor the sync signature to keep things simpler
391
391
  // The only case where it needs to be async is when
392
392
  // the specifier is a `data:*` url
393
393
  // in this case we'll wait for the promise returned by
394
- // "formatReferencedUrl"
394
+ // "formatReference"
395
395
  reference.readGeneratedSpecifier = () => {
396
396
  if (reference.generatedSpecifier.then) {
397
397
  return reference.generatedSpecifier.then((value) => {
@@ -255,6 +255,9 @@ const createUrlInfo = (url, context) => {
255
255
  continue;
256
256
  }
257
257
  if (ref.gotInlined()) {
258
+ if (ref.ownerUrlInfo.isUsed()) {
259
+ return true;
260
+ }
258
261
  // the url info was inlined, an other reference is required
259
262
  // to consider the non-inlined urlInfo as used
260
263
  continue;
@@ -354,7 +357,7 @@ const createUrlInfo = (url, context) => {
354
357
  };
355
358
  urlInfo.onModified = ({ modifiedTimestamp = Date.now() } = {}) => {
356
359
  const visitedSet = new Set();
357
- const iterate = (urlInfo) => {
360
+ const considerModified = (urlInfo) => {
358
361
  if (visitedSet.has(urlInfo)) {
359
362
  return;
360
363
  }
@@ -364,14 +367,21 @@ const createUrlInfo = (url, context) => {
364
367
  for (const referenceToOther of urlInfo.referenceToOthersSet) {
365
368
  const referencedUrlInfo = referenceToOther.urlInfo;
366
369
  if (referencedUrlInfo.isInline) {
367
- iterate(referencedUrlInfo);
370
+ considerModified(referencedUrlInfo);
371
+ }
372
+ }
373
+ for (const referenceFromOther of urlInfo.referenceFromOthersSet) {
374
+ if (referenceFromOther.gotInlined()) {
375
+ const urlInfoReferencingThisOne = referenceFromOther.ownerUrlInfo;
376
+ considerModified(urlInfoReferencingThisOne);
368
377
  }
369
378
  }
370
379
  for (const searchParamVariant of urlInfo.searchParamVariantSet) {
371
- iterate(searchParamVariant);
380
+ considerModified(searchParamVariant);
372
381
  }
373
382
  };
374
- iterate(urlInfo);
383
+ considerModified(urlInfo);
384
+ visitedSet.clear();
375
385
  };
376
386
  urlInfo.onDereferenced = (lastReferenceFromOther) => {
377
387
  urlInfo.dereferencedTimestamp = Date.now();
@@ -130,14 +130,22 @@ export const jsenvPluginAutoreloadServer = ({
130
130
  return iterateMemoized(firstUrlInfo, []);
131
131
  };
132
132
 
133
- const propagationResult = propagateUpdate(firstUrlInfo);
133
+ let propagationResult = propagateUpdate(firstUrlInfo);
134
134
  const seen = new Set();
135
135
  const invalidateImporters = (urlInfo) => {
136
136
  // to indicate this urlInfo should be modified
137
137
  for (const referenceFromOther of urlInfo.referenceFromOthersSet) {
138
138
  const urlInfoReferencingThisOne = referenceFromOther.ownerUrlInfo;
139
- const { hotAcceptDependencies = [] } =
139
+ const { hotDecline, hotAcceptDependencies = [] } =
140
140
  urlInfoReferencingThisOne.data;
141
+ if (hotDecline) {
142
+ propagationResult = {
143
+ declined: true,
144
+ reason: `file declines hot reload`,
145
+ declinedBy: formatUrlForClient(urlInfoReferencingThisOne.url),
146
+ };
147
+ return;
148
+ }
141
149
  if (hotAcceptDependencies.includes(urlInfo.url)) {
142
150
  continue;
143
151
  }
@@ -2,7 +2,6 @@ import { jsenvPluginSupervisor } from "@jsenv/plugin-supervisor";
2
2
  import { jsenvPluginTranspilation } from "@jsenv/plugin-transpilation";
3
3
 
4
4
  import { jsenvPluginReferenceAnalysis } from "./reference_analysis/jsenv_plugin_reference_analysis.js";
5
- import { jsenvPluginImportmap } from "./importmap/jsenv_plugin_importmap.js";
6
5
  import { jsenvPluginNodeEsmResolution } from "./resolution_node_esm/jsenv_plugin_node_esm_resolution.js";
7
6
  import { jsenvPluginWebResolution } from "./resolution_web/jsenv_plugin_web_resolution.js";
8
7
  import { jsenvPluginVersionSearchParam } from "./version_search_param/jsenv_plugin_version_search_param.js";
@@ -55,7 +54,6 @@ export const getCorePlugins = ({
55
54
  jsenvPluginReferenceAnalysis(referenceAnalysis),
56
55
  ...(injections ? [jsenvPluginInjections(injections)] : []),
57
56
  jsenvPluginTranspilation(transpilation),
58
- jsenvPluginImportmap(),
59
57
  ...(inlining ? [jsenvPluginInlining()] : []),
60
58
  ...(supervisor ? [jsenvPluginSupervisor(supervisor)] : []), // after inline as it needs inline script to be cooked
61
59