forked from devlynnx/systemjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths.js
739 lines (669 loc) · 23.9 KB
/
s.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
/*!
* SJS 6.14.1
*/
(function () {
function errMsg(errCode, msg) {
return (msg || "") + " (SystemJS https://github.com/systemjs/systemjs/blob/main/docs/errors.md#" + errCode + ")";
}
var hasSymbol = typeof Symbol !== 'undefined';
var hasSelf = typeof self !== 'undefined';
var hasDocument = typeof document !== 'undefined';
var envGlobal = hasSelf ? self : global;
var baseUrl;
if (hasDocument) {
var baseEl = document.querySelector('base[href]');
if (baseEl)
baseUrl = baseEl.href;
}
if (!baseUrl && typeof location !== 'undefined') {
baseUrl = location.href.split('#')[0].split('?')[0];
var lastSepIndex = baseUrl.lastIndexOf('/');
if (lastSepIndex !== -1)
baseUrl = baseUrl.slice(0, lastSepIndex + 1);
}
var backslashRegEx = /\\/g;
function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
if (relUrl.indexOf('\\') !== -1)
relUrl = relUrl.replace(backslashRegEx, '/');
// protocol-relative
if (relUrl[0] === '/' && relUrl[1] === '/') {
return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
}
// relative-url
else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
relUrl.length === 1 && (relUrl += '/')) ||
relUrl[0] === '/') {
var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
// Disabled, but these cases will give inconsistent results for deep backtracking
//if (parentUrl[parentProtocol.length] !== '/')
// throw Error('Cannot resolve');
// read pathname from parent URL
// pathname taken to be part after leading "/"
var pathname;
if (parentUrl[parentProtocol.length + 1] === '/') {
// resolving to a :// so we need to read out the auth and host
if (parentProtocol !== 'file:') {
pathname = parentUrl.slice(parentProtocol.length + 2);
pathname = pathname.slice(pathname.indexOf('/') + 1);
}
else {
pathname = parentUrl.slice(8);
}
}
else {
// resolving to :/ so pathname is the /... part
pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
}
if (relUrl[0] === '/')
return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
// join together and split for removal of .. and . segments
// looping the string instead of anything fancy for perf reasons
// '../../../../../z' resolved to 'x/y' is just 'z'
var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
var output = [];
var segmentIndex = -1;
for (var i = 0; i < segmented.length; i++) {
// busy reading a segment - only terminate on '/'
if (segmentIndex !== -1) {
if (segmented[i] === '/') {
output.push(segmented.slice(segmentIndex, i + 1));
segmentIndex = -1;
}
}
// new segment - check if it is relative
else if (segmented[i] === '.') {
// ../ segment
if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
output.pop();
i += 2;
}
// ./ segment
else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
i += 1;
}
else {
// the start of a new segment as below
segmentIndex = i;
}
}
// it is the start of a new segment
else {
segmentIndex = i;
}
}
// finish reading out the last segment
if (segmentIndex !== -1)
output.push(segmented.slice(segmentIndex));
return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
}
}
/*
* Import maps implementation
*
* To make lookups fast we pre-resolve the entire import map
* and then match based on backtracked hash lookups
*
*/
function resolveUrl (relUrl, parentUrl) {
return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
}
function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap, parentUrl) {
for (var p in packages) {
var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
var rhs = packages[p];
// package fallbacks not currently supported
if (typeof rhs !== 'string')
continue;
var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
if (!mapped) {
targetWarning('W1', p, rhs);
}
else
outPackages[resolvedLhs] = mapped;
}
}
function resolveAndComposeImportMap (json, baseUrl, outMap) {
if (json.imports)
resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null);
var u;
for (u in json.scopes || {}) {
var resolvedScope = resolveUrl(u, baseUrl);
resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope);
}
for (u in json.depcache || {})
outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u];
for (u in json.integrity || {})
outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u];
}
function getMatch (path, matchObj) {
if (matchObj[path])
return path;
var sepIndex = path.length;
do {
var segment = path.slice(0, sepIndex + 1);
if (segment in matchObj)
return segment;
} while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
}
function applyPackages (id, packages) {
var pkgName = getMatch(id, packages);
if (pkgName) {
var pkg = packages[pkgName];
if (pkg === null) return;
if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') {
targetWarning('W2', pkgName, pkg);
}
else
return pkg + id.slice(pkgName.length);
}
}
function targetWarning (code, match, target, msg) {
console.warn(errMsg(code, [target, match].join(', ') ));
}
function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
var scopes = importMap.scopes;
var scopeUrl = parentUrl && getMatch(parentUrl, scopes);
while (scopeUrl) {
var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]);
if (packageResolution)
return packageResolution;
scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes);
}
return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
}
/*
* SystemJS Core
*
* Provides
* - System.import
* - System.register support for
* live bindings, function hoisting through circular references,
* reexports, dynamic import, import.meta.url, top-level await
* - System.getRegister to get the registration
* - Symbol.toStringTag support in Module objects
* - Hookable System.createContext to customize import.meta
* - System.onload(err, id, deps) handler for tracing / hot-reloading
*
* Core comes with no System.prototype.resolve or
* System.prototype.instantiate implementations
*/
var toStringTag = hasSymbol && Symbol.toStringTag;
var REGISTRY = hasSymbol ? Symbol() : '@';
function SystemJS () {
this[REGISTRY] = {};
}
var systemJSPrototype = SystemJS.prototype;
systemJSPrototype.import = function (id, parentUrl, meta) {
var loader = this;
(parentUrl && typeof parentUrl === 'object') && (meta = parentUrl, parentUrl = undefined);
return Promise.resolve(loader.prepareImport())
.then(function() {
return loader.resolve(id, parentUrl, meta);
})
.then(function (id) {
var load = getOrCreateLoad(loader, id, undefined, meta);
return load.C || topLevelLoad(loader, load);
});
};
// Hookable createContext function -> allowing eg custom import meta
systemJSPrototype.createContext = function (parentId) {
var loader = this;
return {
url: parentId,
resolve: function (id, parentUrl) {
return Promise.resolve(loader.resolve(id, parentUrl || parentId));
}
};
};
function loadToId (load) {
return load.id;
}
function triggerOnload (loader, load, err, isErrSource) {
loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource);
if (err)
throw err;
}
var lastRegister;
systemJSPrototype.register = function (deps, declare, metas) {
lastRegister = [deps, declare, metas];
};
/*
* getRegister provides the last anonymous System.register call
*/
systemJSPrototype.getRegister = function () {
var _lastRegister = lastRegister;
lastRegister = undefined;
return _lastRegister;
};
function getOrCreateLoad (loader, id, firstParentUrl, meta) {
var load = loader[REGISTRY][id];
if (load)
return load;
var importerSetters = [];
var ns = Object.create(null);
if (toStringTag)
Object.defineProperty(ns, toStringTag, { value: 'Module' });
var instantiatePromise = Promise.resolve()
.then(function () {
return loader.instantiate(id, firstParentUrl, meta);
})
.then(function (registration) {
if (!registration)
throw Error(errMsg(2, id ));
function _export (name, value) {
// note if we have hoisted exports (including reexports)
load.h = true;
var changed = false;
if (typeof name === 'string') {
if (!(name in ns) || ns[name] !== value) {
ns[name] = value;
changed = true;
}
}
else {
for (var p in name) {
var value = name[p];
if (!(p in ns) || ns[p] !== value) {
ns[p] = value;
changed = true;
}
}
if (name && name.__esModule) {
ns.__esModule = name.__esModule;
}
}
if (changed)
for (var i = 0; i < importerSetters.length; i++) {
var setter = importerSetters[i];
if (setter) setter(ns);
}
return value;
}
var declared = registration[1](_export, registration[1].length === 2 ? {
import: function (importId, meta) {
return loader.import(importId, id, meta);
},
meta: loader.createContext(id)
} : undefined);
load.e = declared.execute || function () {};
return [registration[0], declared.setters || [], registration[2] || []];
}, function (err) {
load.e = null;
load.er = err;
throw err;
});
var linkPromise = instantiatePromise
.then(function (instantiation) {
return Promise.all(instantiation[0].map(function (dep, i) {
var setter = instantiation[1][i];
var meta = instantiation[2][i];
return Promise.resolve(loader.resolve(dep, id))
.then(function (depId) {
var depLoad = getOrCreateLoad(loader, depId, id, meta);
// depLoad.I may be undefined for already-evaluated
return Promise.resolve(depLoad.I)
.then(function () {
if (setter) {
depLoad.i.push(setter);
// only run early setters when there are hoisted exports of that module
// the timing works here as pending hoisted export calls will trigger through importerSetters
if (depLoad.h || !depLoad.I)
setter(depLoad.n);
}
return depLoad;
});
});
}))
.then(function (depLoads) {
load.d = depLoads;
});
});
// Capital letter = a promise function
return load = loader[REGISTRY][id] = {
id: id,
// importerSetters, the setters functions registered to this dependency
// we retain this to add more later
i: importerSetters,
// module namespace object
n: ns,
// extra module information for import assertion
// shape like: { assert: { type: 'xyz' } }
m: meta,
// instantiate
I: instantiatePromise,
// link
L: linkPromise,
// whether it has hoisted exports
h: false,
// On instantiate completion we have populated:
// dependency load records
d: undefined,
// execution function
e: undefined,
// On execution we have populated:
// the execution error if any
er: undefined,
// in the case of TLA, the execution promise
E: undefined,
// On execution, L, I, E cleared
// Promise for top-level completion
C: undefined,
// parent instantiator / executor
p: undefined
};
}
function instantiateAll (loader, load, parent, loaded) {
if (!loaded[load.id]) {
loaded[load.id] = true;
// load.L may be undefined for already-instantiated
return Promise.resolve(load.L)
.then(function () {
if (!load.p || load.p.e === null)
load.p = parent;
return Promise.all(load.d.map(function (dep) {
return instantiateAll(loader, dep, parent, loaded);
}));
})
.catch(function (err) {
if (load.er)
throw err;
load.e = null;
throw err;
});
}
}
function topLevelLoad (loader, load) {
return load.C = instantiateAll(loader, load, load, {})
.then(function () {
return postOrderExec(loader, load, {});
})
.then(function () {
return load.n;
});
}
// the closest we can get to call(undefined)
var nullContext = Object.freeze(Object.create(null));
// returns a promise if and only if a top-level await subgraph
// throws on sync errors
function postOrderExec (loader, load, seen) {
if (seen[load.id])
return;
seen[load.id] = true;
if (!load.e) {
if (load.er)
throw load.er;
if (load.E)
return load.E;
return;
}
// From here we're about to execute the load.
// Because the execution may be async, we pop the `load.e` first.
// So `load.e === null` always means the load has been executed or is executing.
// To inspect the state:
// - If `load.er` is truthy, the execution has threw or has been rejected;
// - otherwise, either the `load.E` is a promise, means it's under async execution, or
// - the `load.E` is null, means the load has completed the execution or has been async resolved.
var exec = load.e;
load.e = null;
// deps execute first, unless circular
var depLoadPromises;
load.d.forEach(function (depLoad) {
try {
var depLoadPromise = postOrderExec(loader, depLoad, seen);
if (depLoadPromise)
(depLoadPromises = depLoadPromises || []).push(depLoadPromise);
}
catch (err) {
load.er = err;
throw err;
}
});
if (depLoadPromises)
return Promise.all(depLoadPromises).then(doExec);
return doExec();
function doExec () {
try {
var execPromise = exec.call(nullContext);
if (execPromise) {
execPromise = execPromise.then(function () {
load.C = load.n;
load.E = null; // indicates completion
if (!true) ;
}, function (err) {
load.er = err;
load.E = null;
if (!true) ;
throw err;
});
return load.E = execPromise;
}
// (should be a promise, but a minify optimization to leave out Promise.resolve)
load.C = load.n;
load.L = load.I = undefined;
}
catch (err) {
load.er = err;
throw err;
}
finally {
}
}
}
envGlobal.System = new SystemJS();
/*
* SystemJS browser attachments for script and import map processing
*/
var importMapPromise = Promise.resolve();
var importMap = { imports: {}, scopes: {}, depcache: {}, integrity: {} };
// Scripts are processed immediately, on the first System.import, and on DOMReady.
// Import map scripts are processed only once (by being marked) and in order for each phase.
// This is to avoid using DOM mutation observers in core, although that would be an alternative.
var processFirst = hasDocument;
systemJSPrototype.prepareImport = function (doProcessScripts) {
if (processFirst || doProcessScripts) {
processScripts();
processFirst = false;
}
return importMapPromise;
};
if (hasDocument) {
processScripts();
window.addEventListener('DOMContentLoaded', processScripts);
}
systemJSPrototype.addImportMap = function (newMap, mapBase) {
resolveAndComposeImportMap(newMap, mapBase || baseUrl, importMap);
};
function processScripts () {
[].forEach.call(document.querySelectorAll('script'), function (script) {
if (script.sp) // sp marker = systemjs processed
return;
// TODO: deprecate systemjs-module in next major now that we have auto import
if (script.type === 'systemjs-module') {
script.sp = true;
if (!script.src)
return;
System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
// if there is a script load error, dispatch an "error" event
// on the script tag.
if (e.message.indexOf('https://github.com/systemjs/systemjs/blob/main/docs/errors.md#3') > -1) {
var event = document.createEvent('Event');
event.initEvent('error', false, false);
script.dispatchEvent(event);
}
return Promise.reject(e);
});
}
else if (script.type === 'systemjs-importmap') {
script.sp = true;
// The passThrough property is for letting the module types fetch implementation know that this is not a SystemJS module.
var fetchPromise = script.src ? (System.fetch || fetch)(script.src, { integrity: script.integrity, passThrough: true }).then(function (res) {
if (!res.ok)
throw Error(res.status );
return res.text();
}).catch(function (err) {
err.message = errMsg('W4', script.src ) + '\n' + err.message;
console.warn(err);
if (typeof script.onerror === 'function') {
script.onerror();
}
return '{}';
}) : script.innerHTML;
importMapPromise = importMapPromise.then(function () {
return fetchPromise;
}).then(function (text) {
extendImportMap(importMap, text, script.src || baseUrl);
});
}
});
}
function extendImportMap (importMap, newMapText, newMapUrl) {
var newMap = {};
try {
newMap = JSON.parse(newMapText);
} catch (err) {
console.warn(Error((errMsg('W5') )));
}
resolveAndComposeImportMap(newMap, newMapUrl, importMap);
}
/*
* Script instantiation loading
*/
if (hasDocument) {
window.addEventListener('error', function (evt) {
lastWindowErrorUrl = evt.filename;
lastWindowError = evt.error;
});
var baseOrigin = location.origin;
}
systemJSPrototype.createScript = function (url) {
var script = document.createElement('script');
script.async = true;
// Only add cross origin for actual cross origin
// this is because Safari triggers for all
// - https://bugs.webkit.org/show_bug.cgi?id=171566
if (url.indexOf(baseOrigin + '/'))
script.crossOrigin = 'anonymous';
var integrity = importMap.integrity[url];
if (integrity)
script.integrity = integrity;
script.src = url;
return script;
};
// Auto imports -> script tags can be inlined directly for load phase
var lastAutoImportDeps, lastAutoImportTimeout;
var autoImportCandidates = {};
var systemRegister = systemJSPrototype.register;
systemJSPrototype.register = function (deps, declare) {
if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') {
var scripts = document.querySelectorAll('script[src]');
var lastScript = scripts[scripts.length - 1];
if (lastScript) {
lastScript.src;
lastAutoImportDeps = deps;
// if this is already a System load, then the instantiate has already begun
// so this re-import has no consequence
var loader = this;
lastAutoImportTimeout = setTimeout(function () {
autoImportCandidates[lastScript.src] = [deps, declare];
loader.import(lastScript.src);
});
}
}
else {
lastAutoImportDeps = undefined;
}
return systemRegister.call(this, deps, declare);
};
var lastWindowErrorUrl, lastWindowError;
systemJSPrototype.instantiate = function (url, firstParentUrl) {
var autoImportRegistration = autoImportCandidates[url];
if (autoImportRegistration) {
delete autoImportCandidates[url];
return autoImportRegistration;
}
var loader = this;
return Promise.resolve(systemJSPrototype.createScript(url)).then(function (script) {
return new Promise(function (resolve, reject) {
script.addEventListener('error', function () {
reject(Error(errMsg(3, [url, firstParentUrl].join(', ') )));
});
script.addEventListener('load', function () {
document.head.removeChild(script);
// Note that if an error occurs that isn't caught by this if statement,
// that getRegister will return null and a "did not instantiate" error will be thrown.
if (lastWindowErrorUrl === url) {
reject(lastWindowError);
}
else {
var register = loader.getRegister(url);
// Clear any auto import registration for dynamic import scripts during load
if (register && register[0] === lastAutoImportDeps)
clearTimeout(lastAutoImportTimeout);
resolve(register);
}
});
document.head.appendChild(script);
});
});
};
/*
* Fetch loader, sets up shouldFetch and fetch hooks
*/
systemJSPrototype.shouldFetch = function () {
return false;
};
if (typeof fetch !== 'undefined')
systemJSPrototype.fetch = fetch;
var instantiate = systemJSPrototype.instantiate;
var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
systemJSPrototype.instantiate = function (url, parent, meta) {
var loader = this;
if (!this.shouldFetch(url, parent, meta))
return instantiate.apply(this, arguments);
return this.fetch(url, {
credentials: 'same-origin',
integrity: importMap.integrity[url],
meta: meta,
})
.then(function (res) {
if (!res.ok)
throw Error(errMsg(7, [res.status, res.statusText, url, parent].join(', ') ));
var contentType = res.headers.get('content-type');
if (!contentType || !jsContentTypeRegEx.test(contentType))
throw Error(errMsg(4, contentType ));
return res.text().then(function (source) {
if (source.indexOf('//# sourceURL=') < 0)
source += '\n//# sourceURL=' + url;
(0, eval)(source);
return loader.getRegister(url);
});
});
};
systemJSPrototype.resolve = function (id, parentUrl) {
parentUrl = parentUrl || !true || baseUrl;
return resolveImportMap((importMap), resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
};
function throwUnresolved (id, parentUrl) {
throw Error(errMsg(8, [id, parentUrl].join(', ') ));
}
var systemInstantiate = systemJSPrototype.instantiate;
systemJSPrototype.instantiate = function (url, firstParentUrl, meta) {
var preloads = (importMap).depcache[url];
if (preloads) {
for (var i = 0; i < preloads.length; i++)
getOrCreateLoad(this, this.resolve(preloads[i], url), url);
}
return systemInstantiate.call(this, url, firstParentUrl, meta);
};
/*
* Supports loading System.register in workers
*/
if (hasSelf && typeof importScripts === 'function')
systemJSPrototype.instantiate = function (url) {
var loader = this;
return Promise.resolve().then(function () {
importScripts(url);
return loader.getRegister(url);
});
};
})();