Skip to content

Commit

Permalink
6.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Apr 13, 2020
1 parent 0b00771 commit 953b058
Show file tree
Hide file tree
Showing 32 changed files with 6,854 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
dist
package-lock.json
.DS_Store
yarn.lock
dist
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
SystemJS 6.3.1
* Fix error code mixup (https://github.com/systemjs/systemjs/pull/2169)
* Fix bug in system-node.cjs where prepareImport overwrote import map (https://github.com/systemjs/systemjs/pull/2170)
* Adding full dist directory to package.json exports (https://github.com/systemjs/systemjs/pull/2173)
* Increasing timeout for test:node script (https://github.com/systemjs/systemjs/pull/2174)
* Switching to node-fetch to avoid caching bugs in make-fetch-happen (https://github.com/systemjs/systemjs/pull/2171)

SystemJS 6.3.0
* s.js now has full import map support (https://github.com/systemjs/systemjs/pull/2150)
* New system-node.cjs loader designed to run in NodeJS. (https://github.com/systemjs/systemjs/pull/2150, https://github.com/systemjs/systemjs/pull/2158)
Expand Down
75 changes: 41 additions & 34 deletions dist/extras/amd.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
/*
(function(){function errMsg(errCode, msg) {
return (msg || "") + " (SystemJS Error#" + errCode + " " + "https://git.io/JvFET#" + errCode + ")";
}/*
* Support for AMD loading
*/
(function (global) {
const systemPrototype = global.System.constructor.prototype;
var systemPrototype = global.System.constructor.prototype;

const emptyInstantiation = [[], function () { return {} }];
var emptyInstantiation = [[], function () { return {} }];

function unsupportedRequire () {
throw Error('AMD require not supported.');
throw Error( errMsg(5, 'AMD require not supported.'));
}

let tmpRegister, firstNamedDefine;
var tmpRegister, firstNamedDefine;

function emptyFn () {}

const requireExportsModule = ['require', 'exports', 'module'];
var requireExportsModule = ['require', 'exports', 'module'];

function createAMDRegister (amdDefineDeps, amdDefineExec) {
const exports = {};
const module = { exports: exports };
const depModules = [];
const setters = [];
let splice = 0;
for (let i = 0; i < amdDefineDeps.length; i++) {
const id = amdDefineDeps[i];
const index = setters.length;
var exports = {};
var module = { exports: exports };
var depModules = [];
var setters = [];
var splice = 0;
for (var i = 0; i < amdDefineDeps.length; i++) {
var id = amdDefineDeps[i];
var index = setters.length;
if (id === 'require') {
depModules[i] = unsupportedRequire;
splice++;
Expand All @@ -38,62 +40,65 @@
splice++;
}
else {
// needed for ie11 lack of iteration scope
const idx = i;
setters.push(function (ns) {
depModules[idx] = ns.__useDefault ? ns.default : ns;
});
createSetter(i);
}
if (splice)
amdDefineDeps[index] = id;
}
if (splice)
amdDefineDeps.length -= splice;
const amdExec = amdDefineExec;
var amdExec = amdDefineExec;
return [amdDefineDeps, function (_export) {
_export({ default: exports, __useDefault: true });
return {
setters: setters,
execute: function () {
const amdResult = amdExec.apply(exports, depModules);
var amdResult = amdExec.apply(exports, depModules);
if (amdResult !== undefined)
module.exports = amdResult;
if (exports !== module.exports)
_export('default', module.exports);
}
};
}];

// needed to avoid iteration scope issues
function createSetter(idx) {
setters.push(function (ns) {
depModules[idx] = ns.__useDefault ? ns.default : ns;
});
}
}

// hook System.register to know the last declaration binding
let lastRegisterDeclare;
const systemRegister = systemPrototype.register;
var lastRegisterDeclare;
var systemRegister = systemPrototype.register;
systemPrototype.register = function (name, deps, declare) {
lastRegisterDeclare = typeof name === 'string' ? declare : deps;
systemRegister.apply(this, arguments);
};

const instantiate = systemPrototype.instantiate;
var instantiate = systemPrototype.instantiate;
systemPrototype.instantiate = function() {
// Reset "currently executing script"
amdDefineDeps = null;
return instantiate.apply(this, arguments);
};

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

const _firstNamedDefine = firstNamedDefine;
var _firstNamedDefine = firstNamedDefine;
firstNamedDefine = null;

const register = getRegister.call(this);
var register = getRegister.call(this);
// if its an actual System.register leave it
if (register && register[1] === lastRegisterDeclare)
return register;

const _amdDefineDeps = amdDefineDeps;
var _amdDefineDeps = amdDefineDeps;
amdDefineDeps = null;

// If the script registered a named module, return that module instead of re-instantiating it.
Expand All @@ -107,14 +112,16 @@

return createAMDRegister(_amdDefineDeps, amdDefineExec);
};
let amdDefineDeps, amdDefineExec;
var amdDefineDeps, amdDefineExec;
global.define = function (name, deps, execute) {
var depsAndExec;
// define('', [], function () {})
if (typeof name === 'string') {
const depsAndExec = getDepsAndExec(deps, execute);
depsAndExec = getDepsAndExec(deps, execute);
if (amdDefineDeps) {
if (!System.registerRegistry)
throw Error('Include the named register extension for SystemJS named AMD support.');
if (!System.registerRegistry) {
throw Error( errMsg(6, 'Include the named register extension for SystemJS named AMD support.'));
}
addToRegisterRegistry(name, createAMDRegister(depsAndExec[0], depsAndExec[1]));
amdDefineDeps = [];
amdDefineExec = emptyFn;
Expand All @@ -127,7 +134,7 @@
deps = execute;
}
}
const depsAndExec = getDepsAndExec(name, deps);
depsAndExec = getDepsAndExec(name, deps);
amdDefineDeps = depsAndExec[0];
amdDefineExec = depsAndExec[1];
};
Expand Down Expand Up @@ -163,4 +170,4 @@
System.registerRegistry[name] = System.getRegister();
tmpRegister = null;
}
})(typeof self !== 'undefined' ? self : global);
})(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.

0 comments on commit 953b058

Please sign in to comment.