Skip to content

Commit

Permalink
6.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Nov 22, 2019
1 parent 5338b4b commit 5071ce2
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 26 deletions.
18 changes: 16 additions & 2 deletions dist/extras/amd.js
Expand Up @@ -10,6 +10,8 @@
throw Error('AMD require not supported.');
}

let tmpRegister;

function emptyFn () {}

const requireExportsModule = ['require', 'exports', 'module'];
Expand Down Expand Up @@ -78,6 +80,9 @@

const getRegister = systemPrototype.getRegister;
systemPrototype.getRegister = function () {
if (tmpRegister)
return tmpRegister;

const register = getRegister.call(this);
// if its an actual System.register leave it
if (register && register[1] === lastRegisterDeclare)
Expand All @@ -99,14 +104,14 @@
if (amdDefineDeps) {
if (!System.registerRegistry)
throw Error('Include the named register extension for SystemJS named AMD support.');
System.registerRegistry[name] = createAMDRegister(deps, execute);
addToRegisterRegistry(name, createAMDRegister(deps, execute));
amdDefineDeps = [];
amdDefineExec = emptyFn;
return;
}
else {
if (System.registerRegistry)
System.registerRegistry[name] = createAMDRegister([].concat(deps), execute);
addToRegisterRegistry(name, createAMDRegister([].concat(deps), execute));
name = deps;
deps = execute;
}
Expand All @@ -128,4 +133,13 @@
}
};
global.define.amd = {};

function addToRegisterRegistry(name, define) {
// We must call System.getRegister() here to give other extras, such as the named-exports extra,
// a chance to modify the define before it's put into the registerRegistry.
// See https://github.com/systemjs/systemjs/issues/2073
tmpRegister = define;
System.registerRegistry[name] = System.getRegister();
tmpRegister = null;
}
})(typeof self !== 'undefined' ? self : global);
2 changes: 1 addition & 1 deletion dist/extras/amd.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/amd.min.js.map

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

6 changes: 3 additions & 3 deletions dist/s.js
@@ -1,5 +1,5 @@
/*
* SJS 6.1.4
* SJS 6.1.5
* Minimal SystemJS Build
*/
(function () {
Expand Down Expand Up @@ -282,7 +282,7 @@
d: undefined,
// execution function
// set to NULL immediately after execution (or on any failure) to indicate execution has happened
// in such a case, pC should be used, and pLo, pLi will be emptied
// in such a case, C should be used, and E, I, L will be emptied
e: undefined,

// On execution we have populated:
Expand All @@ -291,7 +291,7 @@
// in the case of TLA, the execution promise
E: undefined,

// On execution, pLi, pLo, e cleared
// On execution, L, I, E cleared

// Promise for top-level completion
C: undefined
Expand Down
53 changes: 38 additions & 15 deletions dist/system.js
@@ -1,5 +1,5 @@
/*
* SystemJS 6.1.4
* SystemJS 6.1.5
*/
(function () {
const hasSelf = typeof self !== 'undefined';
Expand Down Expand Up @@ -370,7 +370,7 @@
d: undefined,
// execution function
// set to NULL immediately after execution (or on any failure) to indicate execution has happened
// in such a case, pC should be used, and pLo, pLi will be emptied
// in such a case, C should be used, and E, I, L will be emptied
e: undefined,

// On execution we have populated:
Expand All @@ -379,7 +379,7 @@
// in the case of TLA, the execution promise
E: undefined,

// On execution, pLi, pLo, e cleared
// On execution, L, I, E cleared

// Promise for top-level completion
C: undefined
Expand Down Expand Up @@ -816,43 +816,66 @@
if (toStringTag$1)
Object.defineProperty(ns, toStringTag$1, { value: 'Module' });
}

const done = Promise.resolve(ns);
this.delete(id);
this[REGISTRY][id] = {

const load = this[REGISTRY][id] || (this[REGISTRY][id] = {
id: id,
i: [],
n: ns,
I: done,
L: done,
h: false,
d: [],
e: null,
er: undefined,
E: undefined,
E: undefined
});

if (load.e || load.E)
return false;

Object.assign(load, {
n: ns,
I: undefined,
L: undefined,
C: done
};
});
return ns;
};

systemJSPrototype.has = function (id) {
const load = this[REGISTRY][id];
return load && load.e === null && !load.E;
return !!load;
};

// Delete function provided for hot-reloading use cases
systemJSPrototype.delete = function (id) {
const load = this.get(id);
if (load === undefined)
const registry = this[REGISTRY];
const load = registry[id];
// in future we can support load.E case by failing load first
// but that will require TLA callbacks to be implemented
if (!load || load.e !== null || load.E)
return false;

let importerSetters = load.i;
// remove from importerSetters
// (release for gc)
if (load && load.d)
if (load.d)
load.d.forEach(function (depLoad) {
const importerIndex = depLoad.i.indexOf(load);
if (importerIndex !== -1)
depLoad.i.splice(importerIndex, 1);
});
return delete this[REGISTRY][id];
delete registry[id];
return function () {
const load = registry[id];
if (!load || !importerSetters || load.e !== null || load.E)
return false;
// add back the old setters
importerSetters.forEach(setter => {
load.i.push(setter);
setter(load.n);
});
importerSetters = null;
};
};

const iterator = typeof Symbol !== 'undefined' && Symbol.iterator;
Expand Down

0 comments on commit 5071ce2

Please sign in to comment.