Skip to content

Commit

Permalink
6.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Feb 24, 2020
1 parent 90c8490 commit 6caaee5
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
SystemJS 6.2.4
* Fix problem where System.delete did not remove named register modules. (https://github.com/systemjs/systemjs/pull/2125 @k-j-kim)

SystemJS 6.2.3
* Fix another race condition with named registers. (https://github.com/systemjs/systemjs/pull/2121)

Expand Down
11 changes: 9 additions & 2 deletions dist/extras/named-register.js
Expand Up @@ -44,15 +44,22 @@
// Prefer import map (or other existing) resolution over the registerRegistry
return resolve.call(this, id, parentURL);
} catch (err) {
if (id in this.registerRegistry)
if (id in this.registerRegistry) {
return id;
}
throw err;
}
};

const instantiate = systemJSPrototype.instantiate;
systemJSPrototype.instantiate = function (url, firstParentUrl) {
return this.registerRegistry[url] || instantiate.call(this, url, firstParentUrl);
const result = this.registerRegistry[url];
if (result) {
this.registerRegistry[url] = null;
return result;
} else {
return instantiate.call(this, url, firstParentUrl);
}
};

const getRegister = systemJSPrototype.getRegister;
Expand Down
2 changes: 1 addition & 1 deletion dist/extras/named-register.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/extras/named-register.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/s.js
@@ -1,5 +1,5 @@
/*
* SJS 6.2.3
* SJS 6.2.4
* Minimal SystemJS Build
*/
(function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/system.js
@@ -1,5 +1,5 @@
/*
* SystemJS 6.2.3
* SystemJS 6.2.4
*/
(function () {
const hasSelf = typeof self !== 'undefined';
Expand Down
2 changes: 1 addition & 1 deletion dist/system.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "systemjs",
"version": "6.2.3",
"version": "6.2.4",
"description": "Dynamic ES module loader",
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions test/browser/named-register.js
Expand Up @@ -153,4 +153,18 @@ suite('Named System.register', function() {
assert.equal(System.resolve('b'), 'b');
});
});

test('Ensure import still works after registerRegistry cleanup', function () {
return System.import('./fixtures/browser/named-bundle.js').then(function (m) {
assert.equal(m.a, 'b');
return System.import('b');
})
.then(function (m) {
assert.equal(m.b, 'b');
return System.import('b');
})
.then(function (m) {
assert.equal(m.b, 'b');
});
});
});

0 comments on commit 6caaee5

Please sign in to comment.