More fixes
This commit is contained in:
parent
18f087d18e
commit
82e9457359
|
@ -10,6 +10,7 @@
|
||||||
"lerna": "^3.22.1",
|
"lerna": "^3.22.1",
|
||||||
"nyc": "^14.1.1",
|
"nyc": "^14.1.1",
|
||||||
"rollup": "^2.36.1",
|
"rollup": "^2.36.1",
|
||||||
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.4.4",
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
|
|
|
@ -133,6 +133,7 @@ function binderTypeGuard(t: TemplateFunction): (binder: Binder, index: number) =
|
||||||
case 'any':
|
case 'any':
|
||||||
return bind;
|
return bind;
|
||||||
default:
|
default:
|
||||||
|
// TODO: something better than this!!
|
||||||
throw new Error(`Unhandled binding type: ${JSON.stringify(typeText)}`);
|
throw new Error(`Unhandled binding type: ${JSON.stringify(typeText)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,10 +196,11 @@ export function expand(tree: Items, ctx: ExpansionContext): Items {
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: untyped template
|
||||||
const sa = compilePattern(s.pattern);
|
const sa = compilePattern(s.pattern);
|
||||||
const body = ctx.withCollectedFields(s.facetFields, () => walk(s.body));
|
const body = ctx.withCollectedFields(s.facetFields, () => walk(s.body));
|
||||||
return t`withSelfDo(function (thisFacet) {
|
return t`withSelfDo(function (thisFacet) {
|
||||||
const _Facets = new __SYNDICATE__.Dictionary<Facet<any>>();
|
const _Facets = new __SYNDICATE__.Dictionary<__SYNDICATE__.Facet<any>>();
|
||||||
on asserted ${patternText(s.pattern)} => react {
|
on asserted ${patternText(s.pattern)} => react {
|
||||||
_Facets.set([${commaJoin(sa.captureBinders.map(t=>[t.id]))}], thisFacet);
|
_Facets.set([${commaJoin(sa.captureBinders.map(t=>[t.id]))}], thisFacet);
|
||||||
dataflow { } // TODO: horrible hack to keep the facet alive if no other endpoints
|
dataflow { } // TODO: horrible hack to keep the facet alive if no other endpoints
|
||||||
|
|
|
@ -504,6 +504,7 @@ export function compilePattern(pattern: ValuePattern): StaticAnalysis {
|
||||||
return [s, eCapture(a)];
|
return [s, eCapture(a)];
|
||||||
}
|
}
|
||||||
case 'PConstant':
|
case 'PConstant':
|
||||||
|
constPaths.push(currentPath.slice());
|
||||||
constVals.push(pattern.value);
|
constVals.push(pattern.value);
|
||||||
return [null, pattern.value];
|
return [null, pattern.value];
|
||||||
case 'PConstructor': {
|
case 'PConstructor': {
|
||||||
|
|
|
@ -110,7 +110,7 @@ export abstract class Dataspace {
|
||||||
this.pendingTurns = [];
|
this.pendingTurns = [];
|
||||||
turns.forEach((turn) => {
|
turns.forEach((turn) => {
|
||||||
turn.actions.forEach((action) => {
|
turn.actions.forEach((action) => {
|
||||||
// console.log('[DATASPACE]', group.actor && group.actor.toString(), action);
|
// console.log('[DATASPACE]', turn.actor && turn.actor.toString(), action);
|
||||||
action.perform(this, turn.actor);
|
action.perform(this, turn.actor);
|
||||||
this.runPendingTasks();
|
this.runPendingTasks();
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class Ground extends Dataspace {
|
||||||
backgroundTaskCount = 0;
|
backgroundTaskCount = 0;
|
||||||
|
|
||||||
constructor(bootProc: ActivationScript) {
|
constructor(bootProc: ActivationScript) {
|
||||||
super(function (rootFacet) { rootFacet.addStartScript(bootProc); });
|
super(function (rootFacet) { rootFacet.addStartScript(() => rootFacet.activate(bootProc)); });
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window._ground = this;
|
window._ground = this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ import { randomId, Facet, Observe, FlexMap, Value, Record } from "@syndicate-lan
|
||||||
|
|
||||||
import * as P from "./protocol";
|
import * as P from "./protocol";
|
||||||
export * from "./protocol";
|
export * from "./protocol";
|
||||||
|
|
||||||
|
import { HtmlFragments } from "./html";
|
||||||
export * from "./html";
|
export * from "./html";
|
||||||
|
|
||||||
boot {
|
boot {
|
||||||
|
@ -484,8 +486,11 @@ export class Anchor {
|
||||||
return new Anchor({ fragmentId: this.fragmentId + '__' + extn });
|
return new Anchor({ fragmentId: this.fragmentId + '__' + extn });
|
||||||
}
|
}
|
||||||
|
|
||||||
html(selector: string, html: string, orderBy: NodeOrderKey = ''): Record {
|
html(selector: string, html: HtmlFragments | string, orderBy: NodeOrderKey = ''): Record {
|
||||||
return P.UIFragment(this.fragmentId, selector, html, orderBy);
|
return P.UIFragment(this.fragmentId,
|
||||||
|
selector,
|
||||||
|
typeof html === 'string' ? html : html.toString(),
|
||||||
|
orderBy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import resolve from '@rollup/plugin-node-resolve';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
import { terser } from 'rollup-plugin-terser';
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import sourcemaps from 'rollup-plugin-sourcemaps';
|
||||||
|
|
||||||
export class SyndicateRollup {
|
export class SyndicateRollup {
|
||||||
constructor(packageName, options = {}) {
|
constructor(packageName, options = {}) {
|
||||||
|
@ -40,6 +41,7 @@ export class SyndicateRollup {
|
||||||
return {
|
return {
|
||||||
input: inputFile,
|
input: inputFile,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
sourcemaps(),
|
||||||
resolve({
|
resolve({
|
||||||
preferBuiltins: false,
|
preferBuiltins: false,
|
||||||
... options && options.resolve
|
... options && options.resolve
|
||||||
|
|
Loading…
Reference in New Issue