Permalink
Browse files

Merge branch 'master' of github.com:/witheve/eve

  • Loading branch information...
2 parents c388ffb + 504a0e4 commit 4a2ae28ded5250870dc2ca439dd2597c7c5ece4a @joshuafcole joshuafcole committed Jan 7, 2017
View
@@ -30,28 +30,8 @@
<script type="text/javascript" src="build/src/commonmark.js"></script>
<script type="text/javascript" src="build/src/microReact.js"></script>
<script type="text/javascript" src="build/src/system.js"></script>
+ <script type="text/javascript" src="build/src/systemJSConfig.js"></script>
<script>
- SystemJS.config({
- baseURL: "build/src",
- defaultJSExtensions: true,
- map: {fs: "@empty", path: "@empty", glob: "@empty", mkdirp: "@empty"},
- meta: {"build/src/codemirror.js": { format: "cjs" }}
- });
-
- // Kicks off requiring everyone else
- SystemJS.register("uuid", [], function($export) {
- $export("default", uuid);
- $export("v4", uuid);
- });
- SystemJS.registerDynamic("codemirror", [], false, function(require, exports, module) {
- module.exports = window.CodeMirror;
- });
- SystemJS.register("microReact", [], function($export) {
- $export("Renderer", Renderer);
- });
- SystemJS.register("commonmark", [], function($export) {
- $export(commonmark);
- });
SystemJS.import("client");
</script>
<!-- PRODUCTION ANALYTICS -->
View
@@ -41,7 +41,7 @@
"@types/tape": "^4.2.28",
"@types/ws": "0.0.33",
"body-parser": "^1.15.2",
- "chevrotain": "^0.18.0",
+ "chevrotain": "^0.19.0",
"commonmark": "^0.26.0",
"express": "^4.14.0",
"glob": "^7.1.1",
View
@@ -138,6 +138,7 @@ export class EveClient {
localControl:boolean = false;
showIDE:boolean = true;
ide:IDE;
+ worker: Worker;
constructor(url?:string) {
let loc = url ? url : this.getUrl();
@@ -178,7 +179,7 @@ export class EveClient {
if(!this.localEve) {
this.socketSend(message);
} else {
- browser.responder.handleEvent(message);
+ this.worker.postMessage(message);
}
}
@@ -283,7 +284,11 @@ export class EveClient {
this.localControl = data.controlOwner === Owner.client;
this.showIDE = data.withIDE;
if(this.localEve) {
- browser.init(data.code);
+ this.worker = new Worker("/build/src/loadWorker.js");
+ this.worker.onmessage = (event) => {
+ this.onMessage(event);
+ }
+ this.send({type: "init", code: data.code, showIDE: data.withIDE, workspaces: data.workspaces, workspaceCache: window["_workspaceCache"]});
}
if(this.showIDE) {
let path = data.path;
View
@@ -0,0 +1,25 @@
+//-------------------------------------------------------------------
+// Web worker initialization
+//-------------------------------------------------------------------
+
+// We need to import uuid and commonmark before systemJS since the config tries
+// to read their global objects
+importScripts("/build/src/uuid.js", "/build/src/commonmark.js", "/build/src/system.js", "/build/src/systemJSConfig.js");
+
+// while we're loading stuff in using systemJS we need to queue any messages
+// we may get from the browser
+let queue = [];
+
+// We set an initial onmessage here that just adds messages to the queue,
+// we'll override this with a real on message once the webworker code is loaded
+onmessage = function(event) {
+ queue.push(event);
+}
+
+SystemJS.import("runtime/webworker").then(function(worker) {
+ onmessage = worker.onmessage;
+ for(let queued of queue) {
+ onmessage(queued);
+ }
+});
+
@@ -299,6 +299,10 @@ function buildScans(block, context, scanLikes, outputScans) {
if(!(entity || attribute || value || node)) {
context.errors.push(errors.blankScan(block, scanLike));
+ } else {
+ entity = entity || context.createVariable();
+ attribute = attribute || context.createVariable();
+ value = value || context.createVariable();
}
let final = new join.Scan(scanLike.id + "|build", entity, attribute, value, node, scanLike.scopes);
@@ -4,6 +4,13 @@ export let workspaces:{[name:string]: string} = {};
// Public
//---------------------------------------------------------
+export function loadWorkspaces(neue) {
+ for(let key in neue) {
+ let value = neue[key];
+ workspaces[key] = value;
+ }
+}
+
export function add(name: string, directory: string) {
// If we're running on a windows server, normalize slashes
if(typeof window === "undefined") {
@@ -120,10 +127,10 @@ var fetchWorkspace = function(workspace:string) {
return global["_workspaceCache"][workspace];
}
+let fs = require("fs");
// If we're running on the server, we use the actual file-system.
-if(typeof window === "undefined") {
+if(fs.readFileSync) {
let glob = require("glob");
- let fs = require("fs");
let path = require("path");
let mkdirp = require("mkdirp");
View
@@ -184,7 +184,7 @@ export class Scan {
let solving = [];
let solveNode = this.node !== undefined;
let depth = solveNode ? 4 : 3;
- this._fullScanLookup(index.eavIndex, solving, results, resolved, 0, 0, depth);
+ this._fullScanLookup(index.aveIndex, solving, results, [a,v,e,node], 0, 0, depth);
return results;
}
@@ -255,9 +255,9 @@ export class Scan {
default:
if(proposal.providing === undefined) {
let providing = proposal.providing = [];
- if(e === undefined) providing.push(this.e);
if(a === undefined) providing.push(this.a);
if(v === undefined) providing.push(this.v);
+ if(e === undefined) providing.push(this.e);
if(node === undefined && this.node !== undefined) providing.push(this.node);
}
// full scan
@@ -750,6 +750,10 @@ function joinRound(multiIndex: MultiIndex, providers: ProposalProvider[], prefix
bestProposal = proposed;
bestProvider = provider;
bestProviderIx = ix;
+ if(proposed.cardinality === 0) {
+ solverInfo[ix]++;
+ break;
+ }
}
ix++;
}
@@ -758,7 +762,6 @@ function joinRound(multiIndex: MultiIndex, providers: ProposalProvider[], prefix
// if we never found a provider that means we have no more valid solutions
// and we have nothing more to do
if(bestProvider === undefined || bestProposal.cardinality === 0) {
- if(bestProviderIx !== undefined) solverInfo[bestProviderIx]++;
return;
}
Oops, something went wrong.

0 comments on commit 4a2ae28

Please sign in to comment.