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