Registry / web-framework / oc-template-es6-compiler

oc-template-es6-compiler

JSON →
library8.0.0jsnpmunverified

Compiles OC (OpenComponents) components using ES6 templates. Version 8.0.0 is the latest stable release. Part of the OpenComponents ecosystem, it provides a compiler for the oc-template-es6 template type. Differentiates from other template compilers by integrating specifically with OC's component architecture. Release cadence follows the OC ecosystem updates.

npm install oc-template-es6-compiler
INSTALL
IMPORT
SIG · OC-TEMPLATE-ES6-CO
O
oc-template-es6-compiler
web-frameworkjavascriptv8.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import compiler from 'oc-template-es6-compiler'
const compiler = require('oc-template-es6-compiler')
ESM-only since v8; use import syntax.
Compiler
import { Compiler } from 'oc-template-es6-compiler'
TypeScript type export.
compile
import { compile } from 'oc-template-es6-compiler'
const compile = require('oc-template-es6-compiler').compile
Named function export.
TemplateType
import type { TemplateType } from 'oc-template-es6-compiler'
TypeScript type import.

Shows how to import and use the compiler to compile an OC ES6 component template.

import compiler from 'oc-template-es6-compiler'; import oc from 'oc'; const component = { type: 'oc-template-es6', view: '<div>Hello {{name}}</div>', model: { name: 'World' } }; const compiled = compiler.compile(component); console.log(compiled); // Output: rendered HTML string
Debug
Known issues
breakingVersion 8.0.0 drops CommonJS support; use ESM imports only.
fix
Replace require() with import statements.
affects: >=8.0.0
deprecatedThe 'compile' function will be removed in v9; use 'compiler' default export.
fix
Switch to default import: import compiler from 'oc-template-es6-compiler'.
affects: >=7.0.0 <9.0.0
gotchaEnsure 'oc' runtime is available; otherwise compile will fail silently.
fix
Install oc as a peer dependency: npm install oc.
affects: >0.0.0
gotchaTemplate strings must be valid ES6 syntax; otherwise compiler throws a generic error.
fix
Use backtick literals for templates.
affects: >0.0.0
Errors
Common errors & fixes
Cannot find module 'oc-template-es6-compiler'
Package not installed.
fix
npm install oc-template-es6-compiler
compiler.compile is not a function
Using named import incorrectly on default export.
fix
Use default import: import compiler from 'oc-template-es6-compiler'
TypeError: Cannot read properties of undefined (reading 'type')
Passing undefined or null object to compile.
fix
Ensure a valid component object is passed.
SyntaxError: Unexpected token '`'
Require() used in ESM-only context or string not using backticks.
fix
Use import syntax and ensure template is a string literal.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
ocoptionalPeer dependency for OC runtime
Agent activity
2 hits · last 30 days
node
2
Resources
oc-template-es6-compiler — npm install oc-template-es6-compiler · libregistry