Socket
Socket
Sign inDemoInstall

intern-systemjs-loader

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

60

main.js

@@ -8,4 +8,2 @@ (function () {

systemJSUrl = '/node_modules/systemjs/dist/system.src.js',
hasModule = generateGUID(),
hasPlugin = generateGUID(),
requireQueue = [],

@@ -34,6 +32,7 @@ defineQueue = [],

function setHooks() {
var hasMap = {
'host-browser': true,
'host-node': false
};
var normalize = SystemJS.normalize,
hasMap = {
'host-browser': true,
'host-node': false
};

@@ -49,32 +48,28 @@ function has(str) {

// dojo/has is both a function-returning module and a loader-plugin.
// SystemJS doesn't support this, so we need to hack and split up the behaviours.
// No need to normalize the GUID before setting.
SystemJS.set(hasModule, System.newModule({
__useDefault: true,
default: has,
}));
// SystemJS doesn't support this, so we need to hack the behavior in.
SystemJS.set('@intern-systemjs-loader:has', System.newModule({ __useDefault: true, default: has, }));
SystemJS.set('@intern-systemjs-loader:undefined', System.newModule({ __useDefault: true }));
SystemJS.set(hasPlugin, System.newModule({
fetch: function (load) {
var res = load.name.slice(hasPlugin.length + 1).split('?'),
shouldLoad = has(res[0]);
return shouldLoad
? 'define(["'+ res[1] +'"], function (m) { return m; })'
: 'define([], function () {})';
}
}));
var normalize = SystemJS.normalize;
// Normalize "dojo/has" to either our hasPlugin or hasModule GUIDs depending on whether it's
// required as a loader plugin or a module.
SystemJS.normalize = function (name, parentName, parentAddress) {
var split,
var current, split, target,
// Matcher for `dojo/has!foo?bar:baz`, where bar or baz could also be a ternary condition
matcher = /[^?]+(?=\?([^:]+)(?::(.+))?)/,
hook = name.indexOf('dojo/has') === 0
|| name === './has' && parentName.split('/').slice(-2)[0] === 'dojo';
|| name.indexOf('./has') === 0 && parentName.split('/').slice(-2)[0] === 'dojo';
if (hook) {
split = name.split('!');
return name.replace(/^(?:dojo|\.)\/has/, split[1] ? hasPlugin : hasModule);
// If a direct request the module, return the one we set earlier
if (name.slice(-4) === '/has') {
return '@intern-systemjs-loader:has';
}
// Loop over the conditions to figure out which module to load (if any)
target = name.slice(name.indexOf('!') + 1);
while (current = matcher.exec(target)) {
target = has(current[0]) ? current[1] : current[2];
}
return target ? normalize.call(this, target) : '@intern-systemjs-loader:undefined';
}

@@ -124,9 +119,2 @@

function generateGUID () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
// Provide the initial define, require and config functions. These just push the arguments to

@@ -133,0 +121,0 @@ // arrays so they can be recalled when SystemJS has finished loading.

2

package.json
{
"name": "intern-systemjs-loader",
"version": "0.0.2",
"version": "0.0.3",
"description": "A wrapper for using SystemJS as Intern's loader",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc