Skip to content

Commit c4a0746

Browse files
committed
0.3.1, fix for eval, lively.vm 0.5.4
1 parent 8ec83bc commit c4a0746

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

dist/lively.modules.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23253,6 +23253,8 @@ var categorizer = Object.freeze({
2325323253

2325423254
var originalCode = code;
2325523255

23256+
System.debug && console.log("[lively.module] runEval: " + code.slice(0, 100).replace(/\n/mg, " ") + "...");
23257+
2325623258
return Promise.resolve().then(function () {
2325723259
var targetModule = options.targetModule || "*scratch*";
2325823260
return System.normalize(targetModule, options.parentModule, options.parentAddress);
@@ -23283,8 +23285,9 @@ var categorizer = Object.freeze({
2328323285
transpiler: transpiler
2328423286
});
2328523287

23286-
recordDoitRequest(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, Date.now());
23288+
System.debug && console.log("[lively.module] runEval in module " + fullname + " started");
2328723289

23290+
recordDoitRequest(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, Date.now());
2328823291
return lively_vm_lib_evaluator_js.runEval(code, options).then(function (result) {
2328923292
return result.isError || !env.currentEval.promise ? result : env.currentEval.promise.then(function (result) {
2329023293
return result.process(options).then(function () {
@@ -23293,9 +23296,13 @@ var categorizer = Object.freeze({
2329323296
});
2329423297
}).then(function (result) {
2329523298
System["__lively.modules__"].evaluationDone(fullname);
23299+
System.debug && console.log("[lively.module] runEval in module " + targetModule + " done");
2329623300
recordDoitResult(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, result, Date.now());
2329723301
return result;
2329823302
});
23303+
})["catch"](function (err) {
23304+
console.error("Error in runEval: " + err.stack);
23305+
throw err;
2329923306
});
2330023307
});
2330123308
}

dist/lively.modules_no-deps.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,8 @@
20492049

20502050
var originalCode = code;
20512051

2052+
System.debug && console.log("[lively.module] runEval: " + code.slice(0, 100).replace(/\n/mg, " ") + "...");
2053+
20522054
return Promise.resolve().then(function () {
20532055
var targetModule = options.targetModule || "*scratch*";
20542056
return System.normalize(targetModule, options.parentModule, options.parentAddress);
@@ -2079,8 +2081,9 @@
20792081
transpiler: transpiler
20802082
});
20812083

2082-
recordDoitRequest(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, Date.now());
2084+
System.debug && console.log("[lively.module] runEval in module " + fullname + " started");
20832085

2086+
recordDoitRequest(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, Date.now());
20842087
return lively_vm_lib_evaluator_js.runEval(code, options).then(function (result) {
20852088
return result.isError || !env.currentEval.promise ? result : env.currentEval.promise.then(function (result) {
20862089
return result.process(options).then(function () {
@@ -2089,9 +2092,13 @@
20892092
});
20902093
}).then(function (result) {
20912094
System["__lively.modules__"].evaluationDone(fullname);
2095+
System.debug && console.log("[lively.module] runEval in module " + targetModule + " done");
20922096
recordDoitResult(System, originalCode, { waitForPromise: options.waitForPromise, targetModule: options.targetModule }, result, Date.now());
20932097
return result;
20942098
});
2099+
})["catch"](function (err) {
2100+
console.error("Error in runEval: " + err.stack);
2101+
throw err;
20952102
});
20962103
});
20972104
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lively.modules",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"main": "dist/lively.modules.js",
55
"scripts": {
66
"test": "mocha-es6 tests/*-test.js",
@@ -40,14 +40,14 @@
4040
"babel-core": "^5.8.38",
4141
"babel-regenerator-runtime": "^6.5.0",
4242
"lively.ast": "^0.6.8",
43-
"lively.lang": "^0.5.22",
44-
"lively.vm": "^0.5.3",
43+
"lively.lang": "^0.5.23",
44+
"lively.vm": "^0.5.4",
4545
"systemjs": "^0.19.24",
4646
"whatwg-fetch": "^1.0.0"
4747
},
4848
"devDependencies": {
4949
"doc-comments": "^0.1.4",
50-
"mocha-es6": "^0.2.7",
50+
"mocha-es6": "^0.2.8",
5151
"rollup-plugin-babel": "^1.0.0"
5252
}
5353
}

src/eval.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ function runEval(System, code, options) {
2626

2727
var originalCode = code;
2828

29+
System.debug && console.log(`[lively.module] runEval: ${code.slice(0,100).replace(/\n/mg, " ")}...`);
30+
2931
return Promise.resolve()
3032
.then(() => {
3133
var targetModule = options.targetModule || "*scratch*";
3234
return System.normalize(targetModule, options.parentModule, options.parentAddress);
3335
})
3436
.then((targetModule) => {
3537
var fullname = options.targetModule = targetModule;
38+
System.debug && console.log(`[lively.module] runEval in module ${targetModule} started`);
39+
3640
return System.import(fullname)
3741
.then(() => ensureImportsAreLoaded(System, code, fullname))
3842
.then(() => {
@@ -60,6 +64,7 @@ function runEval(System, code, options) {
6064
Date.now());
6165

6266
return realRunEval(code, options).then(result => {
67+
System.debug && console.log(`[lively.module] runEval in module ${targetModule} done`);
6368
System["__lively.modules__"].evaluationDone(fullname);
6469
recordDoitResult(
6570
System, originalCode,
@@ -178,6 +183,8 @@ function runEvalWithAsyncSupport(System, code, options) {
178183

179184
var originalCode = code;
180185

186+
System.debug && console.log(`[lively.module] runEval: ${code.slice(0,100).replace(/\n/mg, " ")}...`);
187+
181188
return Promise.resolve()
182189
.then(() => {
183190
var targetModule = options.targetModule || "*scratch*";
@@ -212,11 +219,12 @@ function runEvalWithAsyncSupport(System, code, options) {
212219
transpiler: transpiler
213220
});
214221

222+
System.debug && console.log(`[lively.module] runEval in module ${fullname} started`);
223+
215224
recordDoitRequest(
216225
System, originalCode,
217226
{waitForPromise: options.waitForPromise, targetModule: options.targetModule},
218227
Date.now());
219-
220228
return realRunEval(code, options)
221229
.then(result =>
222230
result.isError || !env.currentEval.promise ?
@@ -226,13 +234,18 @@ function runEvalWithAsyncSupport(System, code, options) {
226234
}))
227235
.then(result => {
228236
System["__lively.modules__"].evaluationDone(fullname);
237+
System.debug && console.log(`[lively.module] runEval in module ${targetModule} done`);
229238
recordDoitResult(
230239
System, originalCode,
231240
{waitForPromise: options.waitForPromise, targetModule: options.targetModule},
232241
result, Date.now());
233242
return result;
234243
})
235244
})
245+
.catch(err => {
246+
console.error(`Error in runEval: ${err.stack}`);
247+
throw err;
248+
})
236249
});
237250
}
238251

tests/eval-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var dir = System.normalizeSync("lively.modules/tests/"),
1414
"file1.js": "import { y } from './file2.js'; var z = 2; export var x = y + z;",
1515
"file2.js": "import { z } from './file3.js'; export var y = z;",
1616
"file3.js": "export var z = 1;",
17-
"file4.js": "export async function foo(arg) { return new Promise((resolve, reject) => setTimeout(resolve, 200, arg)); }",
17+
// "file4.js": "export async function foo(arg) { return new Promise((resolve, reject) => setTimeout(resolve, 200, arg)); }",
1818
"package.json": '{"name": "test-project-1", "main": "file1.js"}',
1919
},
2020

@@ -28,13 +28,14 @@ describe("eval", () => {
2828
var System;
2929
beforeEach(() => {
3030
System = getSystem("test", {baseURL: dir});
31+
System.debug = true;
3132
return createFiles(testProjectDir, testProjectSpec)
3233
.then(() => System.import(module1));
3334
});
3435

3536
afterEach(() => { removeSystem("test"); return removeDir(testProjectDir); });
3637

37-
it("inside of module", () =>
38+
it.only("inside of module", () =>
3839
runEval(System, "1 + z + x", {targetModule: module1})
3940
.then(result => expect(result.value).equals(6)));
4041

0 commit comments

Comments
 (0)