Skip to content

Commit

Permalink
add missing import meta (#2435)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenerme committed Oct 6, 2022
1 parent 16818a2 commit 41c6c92
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/extras/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
}

var impt = systemJSPrototype.import;
systemJSPrototype.import = function (id, parentUrl) {
systemJSPrototype.import = function (id, parentUrl, meta) {
noteGlobalProps();
return impt.call(this, id, parentUrl);
return impt.call(this, id, parentUrl, meta);
};

var emptyInstantiation = [[], function () { return {} }];
Expand Down
6 changes: 3 additions & 3 deletions src/extras/named-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
firstNamedDefine = null;
firstName = null;
});
return register.apply(this, [deps, declare]);
return register.apply(this, [deps, declare, metas]);
};

var resolve = systemJSPrototype.resolve;
Expand All @@ -55,13 +55,13 @@
};

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

Expand Down
4 changes: 2 additions & 2 deletions src/extras/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { errMsg } from '../err-msg.js';
var systemJSPrototype = global.System.constructor.prototype;

var instantiate = systemJSPrototype.instantiate;
systemJSPrototype.instantiate = function (url, parent) {
systemJSPrototype.instantiate = function (url, parent, meta) {
if (url.slice(-5) === '.wasm')
return instantiate.call(this, url, parent);
return instantiate.call(this, url, parent, meta);

var loader = this;
return fetch(url, { credentials: 'same-origin' })
Expand Down
6 changes: 3 additions & 3 deletions src/features/depcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { systemJSPrototype, getOrCreateLoad } from '../system-core.js';
import { importMap } from './import-maps.js';

var systemInstantiate = systemJSPrototype.instantiate;
systemJSPrototype.instantiate = function (url, firstParentUrl) {
systemJSPrototype.instantiate = function (url, firstParentUrl, meta) {
var preloads = (!process.env.SYSTEM_BROWSER && this[IMPORT_MAP] || 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);
};
return systemInstantiate.call(this, url, firstParentUrl, meta);
};
7 changes: 4 additions & 3 deletions src/features/fetch-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ if (typeof fetch !== 'undefined')

var instantiate = systemJSPrototype.instantiate;
var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
systemJSPrototype.instantiate = function (url, parent) {
systemJSPrototype.instantiate = function (url, parent, meta) {
var loader = this;
if (!this.shouldFetch(url))
if (!this.shouldFetch(url, parent, meta))
return instantiate.apply(this, arguments);
return this.fetch(url, {
credentials: 'same-origin',
integrity: importMap.integrity[url]
integrity: importMap.integrity[url],
meta
})
.then(function (res) {
if (!res.ok)
Expand Down

0 comments on commit 41c6c92

Please sign in to comment.