Skip to content

Commit b39bc6a

Browse files
committed
experiment with adding a monaco zone
1 parent 6928c25 commit b39bc6a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

libs/code-demos/src/lib/shared/fake-system-loader.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ class System {
4141
}
4242
return (this.asyncModules[id] = await this.fetchModule(id));
4343
}
44+
debugger;
4445
throw new Error(`no module: "${id}"`);
4546
}
4647

47-
async resolveExports(ids) {
48+
async resolveExports(...ids) {
49+
if (!Array.isArray(ids)) {
50+
debugger;
51+
throw new Error('Expected array of ids, got: ' + ids);
52+
}
4853
return Promise.all(
4954
ids.map(async (id) => {
5055
id = this.normalize(id);
@@ -67,9 +72,9 @@ class System {
6772
exports[key] = value;
6873
}
6974

70-
const $__moduleContext = { id };
75+
const $__moduleContext = {id};
7176
try {
72-
const { setters, execute } = await func(
77+
const {setters, execute} = await func(
7378
$__export,
7479
$__moduleContext
7580
);
@@ -79,7 +84,7 @@ class System {
7984
for (let i = 0; i < resolvedDeps.length; i++) {
8085
setters[i](resolvedDeps[i]);
8186
}
82-
resolve({ setters, execute, exports });
87+
resolve({setters, execute, exports});
8388
} catch (e) {
8489
console.log(e);
8590
throw e;
@@ -91,6 +96,10 @@ class System {
9196
}
9297

9398
async executeDeps(...ids) {
99+
if (!Array.isArray(ids)) {
100+
debugger;
101+
throw new Error('Expected array of ids, got: ' + ids);
102+
}
94103
return Promise.all(
95104
ids.map(async (id) => {
96105
id = this.normalize(id);
@@ -103,7 +112,7 @@ class System {
103112
return (this.executedDeps[id] = new Promise(async (resolve, reject) => {
104113
const [deps] = await this.getModule(id);
105114
const executedDeps = await this.executeDeps(...deps);
106-
const { execute, exports, setters } = await this.resolvedExports[id];
115+
const {execute, exports, setters} = await this.resolvedExports[id];
107116
for (let i = 0; i < executedDeps.length; i++) {
108117
setters[i](executedDeps[i]);
109118
}

0 commit comments

Comments
 (0)