@blockml/block-render-engine 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ <!--Block Render Engine Library
2
+ FQN: org.blockml.bml.engine.blockrender.Library-->
3
+ <engine:Library xmlns="http://blockml.org/bml"
4
+ xmlns:blockml="org.blockml.bml"
5
+ xmlns:core="org.blockml.bml.core"
6
+ xmlns:engine="org.blockml.bml.engine.blockrender">
7
+
8
+ <baseType>
9
+ core:BlockLibrary
10
+ </baseType>
11
+ <is>
12
+ The block render engine library catalog
13
+ </is>
14
+ <version>
15
+ 0.1.0
16
+ </version>
17
+ <documentation>
18
+ Publishable CompilerEngine library (org.blockml.bml.engine.blockrender.Library).
19
+ Implements the RenderEngine contract so one RenderTarget can mix compile,
20
+ template, and copy strategies. MachineBlocks-agnostic.
21
+
22
+ Formerly documented as MakerEngine, package @blockml/engine-maker, folder
23
+ maker-engine. Those names are retired. This package is @blockml/block-render-engine.
24
+
25
+ Membership is the file tree under this Library.bml. Version 0.1.0 is inherited
26
+ by members that omit their own version.
27
+ </documentation>
28
+ <references>
29
+ <see type="engine:README" relation="ReadFirst" />
30
+ </references>
31
+ <language>
32
+ <blockml:language.English />
33
+ </language>
34
+ <properties>
35
+ <description override="true">
36
+ <value>Block render engine — mixed compile, template, and copy strategies</value>
37
+ </description>
38
+ </properties>
39
+ <aggregations>
40
+ <readMe override="true">
41
+ <composition>
42
+ <engine:README />
43
+ </composition>
44
+ </readMe>
45
+ <dependencies override="true">
46
+ <composition>
47
+ <blockml:Library />
48
+ </composition>
49
+ </dependencies>
50
+ </aggregations>
51
+ </engine:Library>
@@ -0,0 +1,34 @@
1
+ <!--Block Render Engine — README
2
+ FQN: org.blockml.bml.engine.blockrender.README-->
3
+ <engine:README xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:engine="org.blockml.bml.engine.blockrender"
6
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
7
+
8
+ <baseType>
9
+ core:ReadMe
10
+ </baseType>
11
+ <is>
12
+ Reading entry for the block render engine library
13
+ </is>
14
+ <documentation>
15
+ @blockml/block-render-engine is the first CompilerEngine implementation.
16
+ BlockML BOM Core names the contract RenderEngine. This package implements it.
17
+
18
+ A BlockProcessor picks a method: compile, renderTemplate, renderTemplates,
19
+ copyTemplate, or (later) callLLM. Several processors in the same RenderTarget
20
+ may pick different methods. The engine is infrastructure; processors decide
21
+ the strategy.
22
+
23
+ This library does not register a compiler target and does not mention
24
+ MachineBlocks types. Domain targets such as @machineblocks/render-target
25
+ construct the engine and pass it to their processors.
26
+
27
+ Start at org.blockml.bml.engine.blockrender.documentation.Introduction.
28
+ </documentation>
29
+ <references>
30
+ <see type="edoc:Introduction" relation="ReadFirst" />
31
+ <see type="edoc:RenderEngineContract" relation="SeeAlso" />
32
+ <see type="edoc:Strategies" relation="SeeAlso" />
33
+ </references>
34
+ </engine:README>
@@ -0,0 +1,47 @@
1
+ <!--Engine Documentation — Introduction
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.Introduction-->
3
+ <edoc:Introduction xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Purpose of the block render engine
12
+ </is>
13
+ <documentation>
14
+ CompilerEngine is the generic term for the processing infrastructure that
15
+ BlockProcessors use. BOM Core defines that contract as the TypeScript
16
+ interface RenderEngine. This package is the V1 implementation.
17
+
18
+ It was designed around MakerUniverse use cases — physical blocks, electronics,
19
+ services — and was first named maker-engine / MakerEngine / @blockml/engine-maker.
20
+ The behaviour is unchanged. The name is block-render-engine because the job
21
+ is to host several render strategies in one project, not to be a MachineBlocks
22
+ product.
23
+
24
+ V1 covers the strategies those use cases need:
25
+
26
+ - engine.compile — deterministic code transformation
27
+ - engine.renderTemplate / engine.renderTemplates — template file plus substitution
28
+ - engine.copyTemplate — file copy, no transformation
29
+ - engine.callLLM — LLM generation, specified, not implemented in V1
30
+
31
+ New engines can be published as other packages that implement the same
32
+ interface. Examples of that shape (not this package): an XSLT engine, a Rust
33
+ codegen engine. There is no fixed set of engines.
34
+
35
+ The engine is browser and Node compatible. No Node-only APIs.
36
+
37
+ BlockProcessors and RenderTarget dispatch live with each target. This library
38
+ specifies only what those processors may call, and the context/output shapes
39
+ the call expects. Dispatch order (exact FQN, then baseType chain, then
40
+ delegates, else BML_NO_TARGET) is target behaviour; a delegate-only target
41
+ may omit the engine entirely.
42
+
43
+ </documentation>
44
+ <references>
45
+ <see type="edoc:Naming" relation="ReadNext" />
46
+ </references>
47
+ </edoc:Introduction>
@@ -0,0 +1,48 @@
1
+ <!--Engine Documentation — MixedStrategies
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.MixedStrategies-->
3
+ <edoc:MixedStrategies xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Several strategies inside one RenderTarget
12
+ </is>
13
+ <documentation>
14
+ One RenderTarget holds one engine instance (or none, if it only delegates)
15
+ and many processors. Each processor calls the method it needs. The target is
16
+ not labelled atomic or composite; processors plus delegates define it:
17
+
18
+ - only own processors — the target handles matching blocks itself
19
+ - only delegates — no engine, no processors
20
+ - both — some blocks handled here, others forwarded
21
+
22
+ Illustrative mix on the MachineBlocks SCAD target (the processors are owned
23
+ by @machineblocks/render-target; V1 of that target ships the first two):
24
+
25
+ machineblocks-v3-scad
26
+ ScadBlockProcessor compile com.machineblocks.bml.core.Block
27
+ ScadSetProcessor compile com.machineblocks.bml.core.Set
28
+ MathBuiltInProcessor copy org.blockml.bml.service.Math
29
+ CapabilityImplementationProcessor compile capability implementations
30
+
31
+ Dispatch, applied by the target using the engine only after a processor matches:
32
+
33
+ 1. Own processors: exact FQN match.
34
+ 2. Own processors: baseType-chain fallback. The most specific match wins.
35
+ 3. Delegates: the same two steps, recursively.
36
+ 4. No match: diagnostic BML_NO_TARGET.
37
+
38
+ More specific processors win over generic ones.
39
+
40
+ A delegate-only target (example: a domain library that adds Block types and
41
+ no new emit rules) sets engine unset, processors empty, and delegates to
42
+ the target that already knows how to render. It does not depend on this package.
43
+
44
+ </documentation>
45
+ <references>
46
+ <see type="edoc:RenderContext" relation="ReadNext" />
47
+ </references>
48
+ </edoc:MixedStrategies>
@@ -0,0 +1,45 @@
1
+ <!--Engine Documentation — Naming
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.Naming-->
3
+ <edoc:Naming xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Current names and retired aliases
12
+ </is>
13
+ <documentation>
14
+ Current:
15
+
16
+ - npm package: @blockml/block-render-engine
17
+ - BML library: org.blockml.bml.engine.blockrender.Library
18
+ - TypeScript class (when implemented): BlockRenderEngine
19
+ - import path: @blockml/block-render-engine
20
+
21
+ Retired, do not use in new text or code:
22
+
23
+ - maker-engine (folder and prose name)
24
+ - MakerEngine (class)
25
+ - @blockml/engine-maker (npm name)
26
+
27
+ Registration example a host used to write:
28
+
29
+ import { MakerEngine } from "@blockml/engine-maker";
30
+ registerTarget(new SomeTarget(new MakerEngine()));
31
+
32
+ The same wiring with this package:
33
+
34
+ import { BlockRenderEngine } from "@blockml/block-render-engine";
35
+ registerTarget(new SomeTarget(new BlockRenderEngine()));
36
+
37
+ Who calls registerTarget is the host CLI or the test/browser caller.
38
+ @blockml/compiler exposes registerTarget and getTarget and registers no
39
+ targets by itself. This package does not call registerTarget.
40
+
41
+ </documentation>
42
+ <references>
43
+ <see type="edoc:RenderEngineContract" relation="ReadNext" />
44
+ </references>
45
+ </edoc:Naming>
@@ -0,0 +1,55 @@
1
+ <!--Engine Documentation — RenderContext
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.RenderContext-->
3
+ <edoc:RenderContext xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Per-block state passed into compile and callLLM
12
+ </is>
13
+ <documentation>
14
+ RenderContext is internal. It is not part of the public compiler facade.
15
+ compile and callLLM receive it. Template and copy methods identify files by
16
+ path; they do not take a RenderContext in the V1 signature.
17
+
18
+ Session fields (from CompileOptions):
19
+
20
+ RenderSession
21
+ typeRegistry
22
+ sourceFilePath
23
+ outputBasePath
24
+ targetName
25
+ documentKind
26
+ activeConfig optional
27
+ mbLibPath optional — domain library root for relative imports
28
+
29
+ Per-node fields:
30
+
31
+ RenderContext
32
+ session
33
+ blockFqn
34
+ outputRelativePath
35
+ parentPartId optional
36
+ partId optional
37
+ instance optional
38
+ withScope readonly map of bml:with bindings
39
+ loopScope optional readonly map
40
+ activePresetId optional
41
+ child(overrides) forked context without replacing session
42
+
43
+ Composition rendering forks context via child(). Property values are resolved
44
+ on demand by the processor (PropertyResolver). V1 does not cache them on the
45
+ context.
46
+
47
+ Canonical BOM stays immutable. expandDirectives and auto-ids, when a processor
48
+ needs them, run on a working copy before compile. The engine does not write
49
+ those ids back to the BomDocument.
50
+
51
+ </documentation>
52
+ <references>
53
+ <see type="edoc:RenderOutput" relation="ReadNext" />
54
+ </references>
55
+ </edoc:RenderContext>
@@ -0,0 +1,58 @@
1
+ <!--Engine Documentation — RenderEngineContract
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.RenderEngineContract-->
3
+ <edoc:RenderEngineContract xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ RenderEngine methods this package implements
12
+ </is>
13
+ <documentation>
14
+ BOM Core defines the interface. This package implements it. Method set:
15
+
16
+ interface RenderEngine {
17
+ compile(block, processor, context): RenderOutput
18
+ renderTemplate(block, templatePath): RenderOutput
19
+ renderTemplates(block, templatePaths): RenderOutput
20
+ copyTemplate(sourcePath, targetPath): RenderOutput
21
+ callLLM(block, prompt, context): RenderOutput
22
+ }
23
+
24
+ compile — deterministic transformation. The processor supplies the algorithm
25
+ as processor.compile(block, context). The engine calls that method with the
26
+ given RenderContext and returns its RenderOutput unchanged. It does not read
27
+ file content. The MachineBlocks SCAD processors use this method. If the
28
+ processor has no compile method, compile returns files: [] and diagnostic
29
+ BML_ENGINE_COMPILE_CALLBACK_MISSING.
30
+
31
+ renderTemplate — load one template and substitute variables from the block.
32
+ renderTemplates — the same for several template paths (one processor, several
33
+ output files). Example shape: a processor for a device that emits a script
34
+ template and a config template.
35
+
36
+ copyTemplate — copy a file from sourcePath to targetPath with no rewrite.
37
+ Used when a service file is already the desired artifact.
38
+
39
+ callLLM — reserved. This package does not call a model.
40
+
41
+ This implementation slice runs compile. renderTemplate, renderTemplates,
42
+ copyTemplate, and callLLM return files: [] and diagnostic
43
+ BML_ENGINE_STRATEGY_UNSUPPORTED. Template substitution and file copy without
44
+ a Node-only API are not specified yet. callLLM stays deferred.
45
+
46
+ This package does not call registerTarget.
47
+
48
+ The engine does not choose the method. The BlockProcessor does, inside
49
+ process(block, engine, context). The block is a BlockDefinition or a
50
+ BlockInstance. The engine does not inspect it. A processor that only
51
+ delegates should not be given an engine call at all; its target lists
52
+ delegates and may leave engine unset.
53
+
54
+ </documentation>
55
+ <references>
56
+ <see type="edoc:Strategies" relation="ReadNext" />
57
+ </references>
58
+ </edoc:RenderEngineContract>
@@ -0,0 +1,38 @@
1
+ <!--Engine Documentation — RenderOutput
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.RenderOutput-->
3
+ <edoc:RenderOutput xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ What engine methods return
12
+ </is>
13
+ <documentation>
14
+ Every engine method returns RenderOutput. The compiler treats that value as
15
+ opaque. BlockML requires no file and no 1:1 input-to-output mapping. A call
16
+ may produce zero files, one file, many files, or side effects only.
17
+
18
+ File-based targets conventionally use:
19
+
20
+ interface FilesRenderOutput {
21
+ files: { path: string; content: string; sourceMap?: string }[]
22
+ sideEffects?: RenderSideEffect[]
23
+ }
24
+
25
+ files may be empty when the only result is a side effect. The side-effect
26
+ shape is target-defined. This package does not invent a MachineBlocks file
27
+ layout; the SCAD target specifies .scad paths and optional .scad.map entries.
28
+
29
+ copyTemplate's output is the copied file recorded in files (or an equivalent
30
+ side effect the host writes). renderTemplate's output is the substituted
31
+ template text. compile's output is whatever the processor's compile callback
32
+ produced — the engine wraps that result; it does not parse SCAD.
33
+
34
+ </documentation>
35
+ <references>
36
+ <see type="edoc:Introduction" relation="SeeAlso" />
37
+ </references>
38
+ </edoc:RenderOutput>
@@ -0,0 +1,60 @@
1
+ <!--Engine Documentation — Strategies
2
+ FQN: org.blockml.bml.engine.blockrender.documentation.Strategies-->
3
+ <edoc:Strategies xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:edoc="org.blockml.bml.engine.blockrender.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ How a BlockProcessor selects a strategy
12
+ </is>
13
+ <documentation>
14
+ A BlockProcessor is registered on a RenderTarget for a baseType. Its process
15
+ method calls exactly one engine strategy (or renderTemplates, which is the
16
+ template strategy for many files).
17
+
18
+ Compile strategy:
19
+
20
+ class ScadBlockProcessor implements BlockProcessor {
21
+ baseType = "com.machineblocks.bml.core.Block"
22
+ process(block, engine) {
23
+ return engine.compile(block, this, context)
24
+ }
25
+ }
26
+
27
+ Template strategy:
28
+
29
+ class NfcPlayerProcessor implements BlockProcessor {
30
+ baseType = "com.pimachine.nfc.NfcPlayer"
31
+ process(block, engine) {
32
+ return engine.renderTemplates(block, ["nfc_player.py.tpl", "config.json.tpl"])
33
+ }
34
+ }
35
+
36
+ Copy strategy:
37
+
38
+ class MathBuiltInProcessor implements BlockProcessor {
39
+ baseType = "org.blockml.bml.service.Math"
40
+ process(block, engine) {
41
+ return engine.copyTemplate("lib/math_service.scad", "lib/math_service.scad")
42
+ }
43
+ }
44
+
45
+ These class names are illustrative. The SCAD processors are specified by
46
+ @machineblocks/render-target, not by this package. The engine only guarantees
47
+ that each method is available and returns RenderOutput.
48
+
49
+ Built-in services (#math, #strings, #numbers, #lists, #bools) are BML in
50
+ @blockml/core (org.blockml.bml.service.*). A target that needs another
51
+ language form registers its own processor and chooses copy or compile.
52
+ Pre-rendered SCAD for those services, when present, lives in
53
+ @machineblocks/core under blocks/org/blockml/bml/service/. That layout is a
54
+ target concern.
55
+
56
+ </documentation>
57
+ <references>
58
+ <see type="edoc:MixedStrategies" relation="ReadNext" />
59
+ </references>
60
+ </edoc:Strategies>
@@ -0,0 +1,11 @@
1
+ import type { RenderContext, RenderOutput } from "@blockml/compiler";
2
+ import type { BlockProcessor, CompileBlock, RenderEngine } from "./types.js";
3
+ /** First CompilerEngine. Domain-free. This slice runs compile only. */
4
+ export declare class BlockRenderEngine implements RenderEngine {
5
+ compile(block: CompileBlock, processor: BlockProcessor, context: RenderContext): RenderOutput;
6
+ renderTemplate(block: CompileBlock, _templatePath: string): RenderOutput;
7
+ renderTemplates(block: CompileBlock, _templatePaths: string[]): RenderOutput;
8
+ copyTemplate(_sourcePath: string, _targetPath: string): RenderOutput;
9
+ callLLM(block: CompileBlock, _prompt: string, _context: RenderContext): RenderOutput;
10
+ }
11
+ //# sourceMappingURL=block-render-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-render-engine.d.ts","sourceRoot":"","sources":["../src/block-render-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7E,uEAAuE;AACvE,qBAAa,iBAAkB,YAAW,YAAY;IACpD,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY;IAO7F,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAG,YAAY;IAIxE,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,YAAY;IAI5E,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,YAAY;IAIpE,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,YAAY;CAGrF"}
@@ -0,0 +1,23 @@
1
+ import { blockSource, compileCallbackMissing, strategyUnsupported } from "./diagnostics.js";
2
+ /** First CompilerEngine. Domain-free. This slice runs compile only. */
3
+ export class BlockRenderEngine {
4
+ compile(block, processor, context) {
5
+ if (typeof processor.compile !== "function") {
6
+ return compileCallbackMissing(block);
7
+ }
8
+ return processor.compile(block, context);
9
+ }
10
+ renderTemplate(block, _templatePath) {
11
+ return strategyUnsupported("renderTemplate", blockSource(block));
12
+ }
13
+ renderTemplates(block, _templatePaths) {
14
+ return strategyUnsupported("renderTemplates", blockSource(block));
15
+ }
16
+ copyTemplate(_sourcePath, _targetPath) {
17
+ return strategyUnsupported("copyTemplate");
18
+ }
19
+ callLLM(block, _prompt, _context) {
20
+ return strategyUnsupported("callLLM", blockSource(block));
21
+ }
22
+ }
23
+ //# sourceMappingURL=block-render-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-render-engine.js","sourceRoot":"","sources":["../src/block-render-engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5F,uEAAuE;AACvE,MAAM,OAAO,iBAAiB;IAC5B,OAAO,CAAC,KAAmB,EAAE,SAAyB,EAAE,OAAsB;QAC5E,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAC5C,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,cAAc,CAAC,KAAmB,EAAE,aAAqB;QACvD,OAAO,mBAAmB,CAAC,gBAAgB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,eAAe,CAAC,KAAmB,EAAE,cAAwB;QAC3D,OAAO,mBAAmB,CAAC,iBAAiB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,YAAY,CAAC,WAAmB,EAAE,WAAmB;QACnD,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,KAAmB,EAAE,OAAe,EAAE,QAAuB;QACnE,OAAO,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { SourceLocation } from "@blockml/bom";
2
+ import type { RenderOutput } from "@blockml/compiler";
3
+ import type { CompileBlock } from "./types.js";
4
+ export declare const COMPILE_CALLBACK_MISSING = "BML_ENGINE_COMPILE_CALLBACK_MISSING";
5
+ export declare const STRATEGY_UNSUPPORTED = "BML_ENGINE_STRATEGY_UNSUPPORTED";
6
+ export declare function compileCallbackMissing(block: CompileBlock): RenderOutput;
7
+ export declare function strategyUnsupported(method: string, source?: SourceLocation): RenderOutput;
8
+ export declare function blockSource(block: CompileBlock): SourceLocation;
9
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,eAAO,MAAM,wBAAwB,wCAAwC,CAAC;AAC9E,eAAO,MAAM,oBAAoB,oCAAoC,CAAC;AAgBtE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAMxE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,cAA6B,GAAG,YAAY,CAMvG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CAE/D"}
@@ -0,0 +1,25 @@
1
+ const EMPTY_SOURCE = { file: "", line: 1, column: 1 };
2
+ export const COMPILE_CALLBACK_MISSING = "BML_ENGINE_COMPILE_CALLBACK_MISSING";
3
+ export const STRATEGY_UNSUPPORTED = "BML_ENGINE_STRATEGY_UNSUPPORTED";
4
+ function sourceOf(block) {
5
+ return block.source ?? EMPTY_SOURCE;
6
+ }
7
+ function errorOutput(code, message, source) {
8
+ const diagnostic = {
9
+ severity: "error",
10
+ code,
11
+ message,
12
+ source,
13
+ };
14
+ return { files: [], diagnostics: [diagnostic] };
15
+ }
16
+ export function compileCallbackMissing(block) {
17
+ return errorOutput(COMPILE_CALLBACK_MISSING, "BlockProcessor has no compile method.", sourceOf(block));
18
+ }
19
+ export function strategyUnsupported(method, source = EMPTY_SOURCE) {
20
+ return errorOutput(STRATEGY_UNSUPPORTED, `${method} is not implemented in this engine slice.`, source);
21
+ }
22
+ export function blockSource(block) {
23
+ return sourceOf(block);
24
+ }
25
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAIA,MAAM,YAAY,GAAmB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAEtE,SAAS,QAAQ,CAAC,KAAmB;IACnC,OAAO,KAAK,CAAC,MAAM,IAAI,YAAY,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe,EAAE,MAAsB;IACxE,MAAM,UAAU,GAAe;QAC7B,QAAQ,EAAE,OAAO;QACjB,IAAI;QACJ,OAAO;QACP,MAAM;KACP,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAmB;IACxD,OAAO,WAAW,CAChB,wBAAwB,EACxB,uCAAuC,EACvC,QAAQ,CAAC,KAAK,CAAC,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,SAAyB,YAAY;IACvF,OAAO,WAAW,CAChB,oBAAoB,EACpB,GAAG,MAAM,2CAA2C,EACpD,MAAM,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { BlockRenderEngine } from "./block-render-engine.js";
2
+ export type { BlockProcessor, CompileBlock, RenderEngine } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { BlockRenderEngine } from "./block-render-engine.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { BlockDefinition, BlockInstance } from "@blockml/bom";
2
+ import type { RenderContext, RenderOutput } from "@blockml/compiler";
3
+ /** Document type or composition instance. The engine does not inspect it. */
4
+ export type CompileBlock = BlockDefinition | BlockInstance;
5
+ /** Processor registered on a RenderTarget. It chooses the engine strategy. */
6
+ export interface BlockProcessor {
7
+ baseType: string;
8
+ process(block: CompileBlock, engine: RenderEngine, context: RenderContext): RenderOutput;
9
+ /** Algorithm for the compile strategy. Absent processors cannot use compile. */
10
+ compile?(block: CompileBlock, context: RenderContext): RenderOutput;
11
+ }
12
+ /** CompilerEngine contract. The processor picks the method inside process. */
13
+ export interface RenderEngine {
14
+ compile(block: CompileBlock, processor: BlockProcessor, context: RenderContext): RenderOutput;
15
+ renderTemplate(block: CompileBlock, templatePath: string): RenderOutput;
16
+ renderTemplates(block: CompileBlock, templatePaths: string[]): RenderOutput;
17
+ copyTemplate(sourcePath: string, targetPath: string): RenderOutput;
18
+ callLLM(block: CompileBlock, prompt: string, context: RenderContext): RenderOutput;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,aAAa,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC;IACzF,gFAAgF;IAChF,OAAO,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC;CACrE;AAED,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC;IAC9F,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAAC;IACxE,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAC5E,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,CAAC;IACnE,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC;CACpF"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@blockml/block-render-engine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Block render engine — one CompilerEngine that lets a RenderTarget mix compile, template, and copy strategies",
5
+ "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "type": "module",
10
+ "sideEffects": false,
11
+ "blockml": {
12
+ "library": "./blocks/org/blockml/bml/engine/blockrender/Library.bml"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "blocks"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc --build",
26
+ "prepublishOnly": "npm run build",
27
+ "test": "vitest run --root ../.. packages/block-render-engine/test"
28
+ },
29
+ "dependencies": {
30
+ "@blockml/bom": "^0.9.13",
31
+ "@blockml/compiler": "^0.9.13",
32
+ "@blockml/core": "^1.4.2"
33
+ },
34
+ "engines": {
35
+ "node": ">=20"
36
+ }
37
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.