@jsenv/core 36.1.1 → 36.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "36.1.1",
3
+ "version": "36.1.2",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -57,9 +57,6 @@
57
57
  "prepublishOnly": "npm run build"
58
58
  },
59
59
  "dependencies": {
60
- "@babel/plugin-proposal-dynamic-import": "7.18.6",
61
- "@babel/plugin-transform-modules-systemjs": "7.20.11",
62
- "@babel/plugin-transform-modules-umd": "7.18.6",
63
60
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
64
61
  "@jsenv/abort": "4.2.4",
65
62
  "@jsenv/ast": "4.0.0",
@@ -70,6 +67,7 @@
70
67
  "@jsenv/log": "3.3.5",
71
68
  "@jsenv/node-esm-resolution": "1.0.1",
72
69
  "@jsenv/plugin-supervisor": "1.0.0",
70
+ "@jsenv/js-module-fallback": "1.0.0",
73
71
  "@jsenv/server": "15.0.3",
74
72
  "@jsenv/sourcemap": "1.0.10",
75
73
  "@jsenv/url-meta": "8.1.0",
@@ -407,7 +407,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
407
407
  }),
408
408
  jsenvPluginInlining(),
409
409
  {
410
- name: "jsenv:build",
410
+ name: "jsenv:build_shape",
411
411
  appliesDuring: "build",
412
412
  resolveReference: (reference) => {
413
413
  const getUrl = () => {
@@ -439,13 +439,10 @@ const inferParentFromRequest = (
439
439
  return null;
440
440
  }
441
441
  const refererUrlObject = new URL(referer);
442
- refererUrlObject.searchParams.delete("hmr");
443
- refererUrlObject.searchParams.delete("v");
444
-
445
- let refererUrl = refererUrlObject.href;
446
- if (refererUrl === `${request.origin}/`) {
447
- refererUrl = new URL(sourceMainFilePath, request.origin).href;
448
- }
442
+ const refererUrl =
443
+ refererUrlObject.pathname === `/`
444
+ ? new URL(sourceMainFilePath, request.origin).href
445
+ : referer;
449
446
  return WEB_URL_CONVERTER.asFileUrl(refererUrl, {
450
447
  origin: request.origin,
451
448
  rootDirectoryUrl: sourceDirectoryUrl,
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from "node:url";
1
2
  import { createDetailedMessage } from "@jsenv/log";
2
3
  import { stringifyUrlSite } from "@jsenv/urls";
3
4
 
@@ -95,10 +96,16 @@ export const createFetchUrlContentError = ({
95
96
  });
96
97
  }
97
98
  if (error.code === "ENOENT") {
98
- return createFailedToFetchUrlContentError({
99
- code: "NOT_FOUND",
100
- reason: "no entry on filesystem",
101
- });
99
+ const urlTried = pathToFileURL(error.path).href;
100
+ // ensure ENOENT is caused by trying to read the urlInfo.url
101
+ // any ENOENT trying to read an other file should display the error.stack
102
+ // because it means some side logic has failed
103
+ if (urlInfo.url.startsWith(urlTried)) {
104
+ return createFailedToFetchUrlContentError({
105
+ code: "NOT_FOUND",
106
+ reason: "no entry on filesystem",
107
+ });
108
+ }
102
109
  }
103
110
  if (error.code === "PARSE_ERROR") {
104
111
  return createFailedToFetchUrlContentError({
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { injectQueryParams } from "@jsenv/urls";
7
- import { convertJsModuleToJsClassic } from "./convert_js_module_to_js_classic.js";
7
+ import { convertJsModuleToJsClassic } from "@jsenv/js-module-fallback";
8
8
 
9
9
  export const jsenvPluginJsModuleConversion = ({
10
10
  systemJsInjection,
@@ -1,5 +1,6 @@
1
1
  import { urlToFilename } from "@jsenv/urls";
2
- import { systemJsClientFileUrlDefault } from "./convert_js_module_to_js_classic.js";
2
+ import { systemJsClientFileUrlDefault } from "@jsenv/js-module-fallback";
3
+
3
4
  import { jsenvPluginJsModuleConversion } from "./jsenv_plugin_js_module_conversion.js";
4
5
  import { jsenvPluginJsModuleFallbackInsideHtml } from "./jsenv_plugin_js_module_fallback_inside_html.js";
5
6
  import { jsenvPluginJsModuleFallbackOnWorkers } from "./jsenv_plugin_js_module_fallback_on_workers.js";
package/dist/js/s.js DELETED
@@ -1,590 +0,0 @@
1
- function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
2
- (function (global, factory) {
3
- if (typeof define === "function" && define.amd) {
4
- define([], factory);
5
- } else if (typeof exports !== "undefined") {
6
- factory();
7
- } else {
8
- var mod = {
9
- exports: {}
10
- };
11
- factory();
12
- global.s = mod.exports;
13
- }
14
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () {
15
- "use strict";
16
-
17
- // eslint-disable-next-line consistent-return
18
- var arrayWithHoles = function arrayWithHoles(arr) {
19
- if (Array.isArray(arr)) return arr;
20
- };
21
-
22
- /* @minVersion 7.0.0-beta.0 */
23
-
24
- function _iterableToArrayLimit(arr, i) {
25
- // this is an expanded form of \`for...of\` that properly supports abrupt completions of
26
- // iterators etc. variable names have been minimised to reduce the size of this massive
27
- // helper. sometimes spec compliance is annoying :(
28
- //
29
- // _n = _iteratorNormalCompletion
30
- // _d = _didIteratorError
31
- // _e = _iteratorError
32
- // _i = _iterator
33
- // _s = _step
34
- // _x = _next
35
- // _r = _return
36
-
37
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
38
- if (_i == null) return;
39
- var _arr = [];
40
- var _n = true;
41
- var _d = false;
42
- var _s, _e, _x, _r;
43
- try {
44
- _x = (_i = _i.call(arr)).next;
45
- if (i === 0) {
46
- if (Object(_i) !== _i) return;
47
- _n = false;
48
- } else {
49
- for (; !(_n = (_s = _x.call(_i)).done); _n = true) {
50
- _arr.push(_s.value);
51
- if (_arr.length === i) break;
52
- }
53
- }
54
- } catch (err) {
55
- _d = true;
56
- _e = err;
57
- } finally {
58
- try {
59
- if (!_n && _i["return"] != null) {
60
- _r = _i["return"]();
61
- // eslint-disable-next-line no-unsafe-finally
62
- if (Object(_r) !== _r) return;
63
- }
64
- } finally {
65
- // eslint-disable-next-line no-unsafe-finally
66
- if (_d) throw _e;
67
- }
68
- }
69
- return _arr;
70
- }
71
-
72
- /* eslint-disable no-eq-null, eqeqeq */
73
- function arrayLikeToArray(arr, len) {
74
- if (len == null || len > arr.length) len = arr.length;
75
- var arr2 = new Array(len);
76
- for (var i = 0; i < len; i++) arr2[i] = arr[i];
77
- return arr2;
78
- }
79
-
80
- /* eslint-disable consistent-return */
81
- function unsupportedIterableToArray(o, minLen) {
82
- if (!o) return;
83
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
84
- var n = Object.prototype.toString.call(o).slice(8, -1);
85
- if (n === "Object" && o.constructor) n = o.constructor.name;
86
- if (n === "Map" || n === "Set") return Array.from(o);
87
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
88
- }
89
- var nonIterableRest = function nonIterableRest() {
90
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
91
- };
92
- var _slicedToArray = function _slicedToArray(arr, i) {
93
- return arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
94
- };
95
- var nativeTypeOf = function nativeTypeOf(obj) {
96
- return _typeof2(obj);
97
- };
98
- var customTypeOf = function customTypeOf(obj) {
99
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
100
- };
101
- var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? nativeTypeOf : customTypeOf;
102
-
103
- /*
104
- * This file is a modified version of https://github.com/systemjs/systemjs/blob/main/dist/s.js
105
- * with the following changes:
106
- *
107
- * - Code can use aync/await, const, etc because this file is compiled (see dist/s.js)
108
- * - Can use document.currentScript because we don't support IE
109
- * - auto import inline System.register
110
- * - auto import first System.register in web workers
111
- * - queing events in web workers
112
- * - no support for importmap because jsenv don't need it
113
- */
114
-
115
- function _await(value, then, direct) {
116
- if (direct) {
117
- return then ? then(value) : value;
118
- }
119
- if (!value || !value.then) {
120
- value = Promise.resolve(value);
121
- }
122
- return then ? value.then(then) : value;
123
- }
124
- function _async(f) {
125
- return function () {
126
- for (var args = [], i = 0; i < arguments.length; i++) {
127
- args[i] = arguments[i];
128
- }
129
- try {
130
- return Promise.resolve(f.apply(this, args));
131
- } catch (e) {
132
- return Promise.reject(e);
133
- }
134
- };
135
- }
136
- function _empty() {}
137
- function _awaitIgnored(value, direct) {
138
- if (!direct) {
139
- return value && value.then ? value.then(_empty) : Promise.resolve();
140
- }
141
- }
142
- function _invoke(body, then) {
143
- var result = body();
144
- if (result && result.then) {
145
- return result.then(then);
146
- }
147
- return then(result);
148
- }
149
- function _catch(body, recover) {
150
- try {
151
- var result = body();
152
- } catch (e) {
153
- return recover(e);
154
- }
155
- if (result && result.then) {
156
- return result.then(void 0, recover);
157
- }
158
- return result;
159
- }
160
- (function () {
161
- /* eslint-env browser */
162
-
163
- var loadRegistry = Object.create(null);
164
- var registerRegistry = Object.create(null);
165
- var inlineScriptCount = 0;
166
- var System = {};
167
- var hasDocument = (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object";
168
- var envGlobal = self;
169
- var isWorker = !hasDocument && typeof envGlobal.WorkerGlobalScope === "function" && envGlobal instanceof envGlobal.WorkerGlobalScope;
170
- var isServiceWorker = isWorker && typeof self.skipWaiting === "function";
171
- envGlobal.System = System;
172
- var baseUrl = envGlobal.location.href.split("#")[0].split("?")[0];
173
- var lastSlashIndex = baseUrl.lastIndexOf("/");
174
- if (lastSlashIndex !== -1) {
175
- baseUrl = baseUrl.slice(0, lastSlashIndex + 1);
176
- }
177
- var resolveUrl = function resolveUrl(specifier, baseUrl) {
178
- return new URL(specifier, baseUrl).href;
179
- };
180
- if (hasDocument) {
181
- var baseElement = document.querySelector("base[href]");
182
- if (baseElement) {
183
- baseUrl = baseElement.href;
184
- }
185
- System.register = function (deps, declare) {
186
- if (!document.currentScript) {
187
- throw new Error("unexpected call to System.register (document.currentScript is undefined)");
188
- }
189
- if (document.currentScript.__s__) {
190
- registerRegistry[document.currentScript.src] = [deps, declare];
191
- return null;
192
- }
193
- var url = document.currentScript.src || "".concat(window.location.href, "__inline_script__").concat(++inlineScriptCount);
194
- registerRegistry[url] = [deps, declare];
195
- return _import2(url);
196
- };
197
- System.instantiate = function (url) {
198
- var script = createScript(url);
199
- return new Promise(function (resolve, reject) {
200
- var lastWindowErrorUrl;
201
- var lastWindowError;
202
- var windowErrorCallback = function windowErrorCallback(event) {
203
- lastWindowErrorUrl = event.filename;
204
- lastWindowError = event.error;
205
- };
206
- window.addEventListener("error", windowErrorCallback);
207
- script.addEventListener("error", function () {
208
- window.removeEventListener("error", windowErrorCallback);
209
- reject("An error occured while loading url with <script> for ".concat(url));
210
- });
211
- script.addEventListener("load", function () {
212
- window.removeEventListener("error", windowErrorCallback);
213
- document.head.removeChild(script);
214
- // Note that if an error occurs that isn't caught by this if statement,
215
- // that getRegister will return null and a "did not instantiate" error will be thrown.
216
- if (lastWindowErrorUrl === url) {
217
- reject(lastWindowError);
218
- } else {
219
- resolve();
220
- }
221
- });
222
- document.head.appendChild(script);
223
- });
224
- };
225
- var createScript = function createScript(url) {
226
- var script = document.createElement("script");
227
- script.async = true;
228
- // Only add cross origin for actual cross origin
229
- // this is because Safari triggers for all
230
- // - https://bugs.webkit.org/show_bug.cgi?id=171566
231
- if (url.indexOf("".concat(self.location.origin, "/"))) {
232
- script.crossOrigin = "anonymous";
233
- }
234
- script.__s__ = true;
235
- script.src = url;
236
- return script;
237
- };
238
- }
239
- if (isWorker) {
240
- /*
241
- * SystemJs loads X files before executing the worker/service worker main file
242
- * It mean events dispatched during this phase could be missed
243
- * A warning like the one below is displayed in chrome devtools:
244
- * "Event handler of 'install' event must be added on the initial evaluation of worker script"
245
- * To fix that code below listen for these events early and redispatch them later
246
- * once the worker file is executed (the listeners are installed)
247
- */
248
- var firstImportCallbacks = [];
249
- if (isServiceWorker) {
250
- // for service worker there is more events to listen
251
- // and, to get rid of the warning, we override self.addEventListener
252
- var eventsToCatch = ["message", "install", "activate", "fetch"];
253
- var eventCallbackProxies = {};
254
- var firstImportPromise = new Promise(function (resolve) {
255
- firstImportCallbacks.push(resolve);
256
- });
257
- eventsToCatch.forEach(function (eventName) {
258
- var eventsToDispatch = [];
259
- var eventCallback = function eventCallback(event) {
260
- var eventCallbackProxy = eventCallbackProxies[event.type];
261
- if (eventCallbackProxy) {
262
- eventCallbackProxy(event);
263
- } else {
264
- eventsToDispatch.push(event);
265
- event.waitUntil(firstImportPromise);
266
- }
267
- };
268
- self.addEventListener(eventName, eventCallback);
269
- firstImportCallbacks.push(function () {
270
- if (eventsToDispatch.length) {
271
- var eventCallbackProxy = eventCallbackProxies[eventsToDispatch[0].type];
272
- if (eventCallbackProxy) {
273
- eventsToDispatch.forEach(function (event) {
274
- eventCallbackProxy(event);
275
- });
276
- }
277
- eventsToDispatch.length = 0;
278
- }
279
- });
280
- });
281
- var addEventListener = self.addEventListener;
282
- self.addEventListener = function (eventName, callback, options) {
283
- if (eventsToCatch.indexOf(eventName) > -1) {
284
- eventCallbackProxies[eventName] = callback;
285
- return null;
286
- }
287
- return addEventListener.call(self, eventName, callback, options);
288
- };
289
- } else {
290
- var _eventsToCatch = ["message"];
291
- _eventsToCatch.forEach(function (eventName) {
292
- var eventQueue = [];
293
- var eventCallback = function eventCallback(event) {
294
- eventQueue.push(event);
295
- };
296
- self.addEventListener(eventName, eventCallback);
297
- firstImportCallbacks.push(function () {
298
- self.removeEventListener(eventName, eventCallback);
299
- eventQueue.forEach(function (event) {
300
- self.dispatchEvent(event);
301
- });
302
- eventQueue.length = 0;
303
- });
304
- });
305
- }
306
- System.register = _async(function (deps, declare) {
307
- System.register = function () {
308
- throw new Error("unexpected call to System.register (called outside url instantiation)");
309
- };
310
- var url = self.location.href;
311
- registerRegistry[url] = [deps, declare];
312
- return _await(_import2(url), function (namespace) {
313
- firstImportCallbacks.forEach(function (firstImportCallback) {
314
- firstImportCallback();
315
- });
316
- firstImportCallbacks.length = 0;
317
- return namespace;
318
- });
319
- });
320
- System.instantiate = _async(function (url) {
321
- return _await(self.fetch(url, {
322
- credentials: "same-origin"
323
- }), function (response) {
324
- if (!response.ok) {
325
- throw Error("Failed to fetch module at ".concat(url));
326
- }
327
- return _await(response.text(), function (source) {
328
- if (source.indexOf("//# sourceURL=") < 0) {
329
- source += "\n//# sourceURL=".concat(url);
330
- }
331
- var register = System.register;
332
- System.register = function (deps, declare) {
333
- registerRegistry[url] = [deps, declare];
334
- };
335
- (0, self.eval)(source);
336
- System.register = register;
337
- });
338
- });
339
- });
340
- }
341
- var _import2 = function _import(specifier, parentUrl) {
342
- var url = resolveUrl(specifier, parentUrl);
343
- var load = getOrCreateLoad(url, parentUrl);
344
- if (load.completionPromise) {
345
- if (load.completionPromise === load.namespace) {
346
- return Promise.resolve(load.namespace);
347
- }
348
- return load.completionPromise;
349
- }
350
- return startExecution(load, parentUrl);
351
- };
352
- var getOrCreateLoad = function getOrCreateLoad(url, firstParentUrl) {
353
- var existingLoad = loadRegistry[url];
354
- if (existingLoad) {
355
- return existingLoad;
356
- }
357
- var namespace = createNamespace();
358
- var load = {
359
- url: url,
360
- deps: [],
361
- dependencyLoads: [],
362
- instantiatePromise: null,
363
- linkPromise: null,
364
- executePromise: null,
365
- completionPromise: null,
366
- importerSetters: [],
367
- setters: [],
368
- execute: null,
369
- error: null,
370
- hoistedExports: false,
371
- namespace: namespace
372
- };
373
- loadRegistry[url] = load;
374
- load.instantiatePromise = _async(function () {
375
- return _catch(function () {
376
- var registration = registerRegistry[url];
377
- return _invoke(function () {
378
- if (!registration) {
379
- var instantiateReturnValue = System.instantiate(url, firstParentUrl);
380
- return _invoke(function () {
381
- if (instantiateReturnValue) {
382
- return _awaitIgnored(instantiateReturnValue);
383
- }
384
- }, function () {
385
- registration = registerRegistry[url];
386
- });
387
- }
388
- }, function () {
389
- if (!registration) {
390
- throw new Error("System.register() not called after executing ".concat(url));
391
- }
392
- var _export = function _export(firstArg, secondArg) {
393
- load.hoistedExports = true;
394
- var changed = false;
395
- if (typeof firstArg === "string") {
396
- var name = firstArg;
397
- var value = secondArg;
398
- if (!(name in namespace) || namespace[name] !== value) {
399
- namespace[name] = value;
400
- changed = true;
401
- }
402
- } else {
403
- Object.keys(firstArg).forEach(function (name) {
404
- var value = firstArg[name];
405
- if (!(name in namespace) || namespace[name] !== value) {
406
- namespace[name] = value;
407
- changed = true;
408
- }
409
- });
410
- if (firstArg && firstArg.__esModule) {
411
- namespace.__esModule = firstArg.__esModule;
412
- }
413
- }
414
- if (changed) {
415
- load.importerSetters.forEach(function (importerSetter) {
416
- if (importerSetter) {
417
- importerSetter(namespace);
418
- }
419
- });
420
- }
421
- return secondArg;
422
- };
423
- var _registration = registration,
424
- _registration2 = _slicedToArray(_registration, 2),
425
- deps = _registration2[0],
426
- declare = _registration2[1];
427
- var _declare = declare(_export, {
428
- import: function _import(importId) {
429
- return _import2(importId, url);
430
- },
431
- meta: createMeta(url)
432
- }),
433
- setters = _declare.setters,
434
- _declare$execute = _declare.execute,
435
- execute = _declare$execute === void 0 ? function () {} : _declare$execute;
436
- load.deps = deps;
437
- load.setters = setters;
438
- load.execute = execute;
439
- });
440
- }, function (e) {
441
- load.error = e;
442
- load.execute = null;
443
- });
444
- })();
445
- load.linkPromise = _async(function () {
446
- return _await(load.instantiatePromise, function () {
447
- return _await(Promise.all(load.deps.map(_async(function (dep, index) {
448
- var setter = load.setters[index];
449
- var dependencyUrl = resolveUrl(dep, url);
450
- var dependencyLoad = getOrCreateLoad(dependencyUrl, url);
451
- return _invoke(function () {
452
- if (dependencyLoad.instantiatePromise) {
453
- return _awaitIgnored(dependencyLoad.instantiatePromise);
454
- }
455
- }, function () {
456
- if (setter) {
457
- dependencyLoad.importerSetters.push(setter);
458
- if (dependencyLoad.hoistedExports || !dependencyLoad.instantiatePromise) {
459
- setter(dependencyLoad.namespace);
460
- }
461
- }
462
- return dependencyLoad;
463
- });
464
- }))), function (dependencyLoads) {
465
- load.dependencyLoads = dependencyLoads;
466
- });
467
- });
468
- })();
469
- return load;
470
- };
471
- var startExecution = _async(function (load, importerUrl) {
472
- load.completionPromise = function () {
473
- return _await(instantiateAll(load, load, {}), function () {
474
- return _await(postOrderExec(load, importerUrl ? [importerUrl] : []), function () {
475
- return load.namespace;
476
- });
477
- });
478
- }();
479
- return load.completionPromise;
480
- });
481
- var instantiateAll = _async(function (load, parent, loaded) {
482
- if (loaded[load.url]) {
483
- return;
484
- }
485
- loaded[load.url] = true;
486
- return _catch(function () {
487
- return _invoke(function () {
488
- if (load.linkPromise) {
489
- // load.linkPromise is null once instantiated
490
- return _awaitIgnored(load.linkPromise);
491
- }
492
- }, function () {
493
- return _awaitIgnored(Promise.all(load.dependencyLoads.map(function (dependencyLoad) {
494
- return instantiateAll(dependencyLoad, parent, loaded);
495
- })));
496
- });
497
- }, function (error) {
498
- if (load.error) {
499
- throw error;
500
- }
501
- load.execute = null;
502
- throw error;
503
- });
504
- });
505
- var postOrderExec = function postOrderExec(load, importStack) {
506
- if (importStack.indexOf(load.url) > -1) {
507
- return undefined;
508
- }
509
- if (!load.execute) {
510
- if (load.error) {
511
- throw load.error;
512
- }
513
- if (load.executePromise) {
514
- return load.executePromise;
515
- }
516
- return undefined;
517
- }
518
-
519
- // deps execute first, unless circular
520
- var execute = load.execute;
521
- load.execute = null;
522
- var depLoadPromises = [];
523
- load.dependencyLoads.forEach(function (dependencyLoad) {
524
- try {
525
- var depImportStack = importStack.slice();
526
- depImportStack.push(load.url);
527
- var depLoadPromise = postOrderExec(dependencyLoad, depImportStack);
528
- if (depLoadPromise) {
529
- depLoadPromises.push(depLoadPromise);
530
- }
531
- } catch (err) {
532
- load.error = err;
533
- throw err;
534
- }
535
- });
536
- return _async(function () {
537
- return _invoke(function () {
538
- if (depLoadPromises.length) {
539
- var allDepPromise = Promise.all(depLoadPromises);
540
- return _awaitIgnored(allDepPromise);
541
- }
542
- }, function () {
543
- try {
544
- var executeReturnValue = execute.call(nullContext);
545
- if (executeReturnValue) {
546
- load.executePromise = executeReturnValue.then(function () {
547
- load.executePromise = null;
548
- load.completionPromise = load.namespace;
549
- }, function (error) {
550
- load.executePromise = null;
551
- load.error = error;
552
- throw error;
553
- });
554
- return;
555
- }
556
- load.instantiatePromise = null;
557
- load.linkPromise = null;
558
- load.completionPromise = load.namespace;
559
- } catch (error) {
560
- load.error = error;
561
- throw error;
562
- } finally {
563
- load.execute = null;
564
- }
565
- });
566
- })();
567
- };
568
-
569
- // the closest we can get to call(undefined)
570
- var nullContext = Object.freeze(Object.create(null));
571
- var createMeta = function createMeta(url) {
572
- return {
573
- url: url,
574
- resolve: function resolve(id) {
575
- return resolveUrl(id, url);
576
- }
577
- };
578
- };
579
- var createNamespace = typeof Symbol !== "undefined" && Symbol.toStringTag ? function () {
580
- var namespace = Object.create(null);
581
- Object.defineProperty(namespace, Symbol.toStringTag, {
582
- value: "Module"
583
- });
584
- return namespace;
585
- } : function () {
586
- return Object.create(null);
587
- };
588
- })();
589
- });
590
- //# sourceMappingURL=s.js.map