From c934c480c9071728095bd9bddfc90978c1a2a5ca Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Tue, 6 Aug 2024 13:58:32 +0200 Subject: [PATCH] Avoid mutating newImportMap --- source | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/source b/source index 26f60bc02e6..bf31bb5b600 100644 --- a/source +++ b/source @@ -108864,8 +108864,15 @@ dictionary PromiseRejectionEventInit : EventInitWe're mutating this copy and removing items from it when they are used to ignore scope-specific rules. That enables keeping less-specific rules that would match the same - specifier.

- + specifier. The same is true for newImportMapScopes and newImportMapImports + below.

+ + +
  • Let newImportMapScopes be a deep copy of newImportMap's scopes.

  • + +
  • Let newImportMapImports be a deep copy of newImportMap's imports.

  • For each pair of resolvedSetCopy:

    @@ -108885,8 +108892,6 @@ dictionary PromiseRejectionEventInit : EventInitconcatenating tokens on on U+002F ("/").

  • -
  • Let newImportMapScopes be newImportMap's scopes.

  • If current path exists in newImportMapScopes, then:

    @@ -108910,8 +108915,7 @@ dictionary PromiseRejectionEventInit : EventInit
  • For each scopePrefix → - scopeImports of newImportMap's scopes:

    + scopeImports of newImportMapScopes:

    1. If scopePrefix exists in oldImportMap's scopes, then @@ -108943,13 +108947,12 @@ dictionary PromiseRejectionEventInit : EventInit

    2. For each pair of - resolvedSetCopy, remove newImportMap's imports[specifier].

    3. + resolvedSetCopy, remove newImportMapImports[specifier].

    4. Set oldImportMap's imports to the result of merge module specifier maps, - given newImportMap's imports and - oldImportMap's imports.

    5. + given newImportMapImports and oldImportMap's imports.

    The above algorithm merges a new import map into the given environment