Registry / web-framework / canner-compiler

canner-compiler

JSON →
library3.2.1jsnpmunverified

Canner Compiler is a compiler for Canner CMS schema that processes schema definitions and generates configurations for CMS rendering. The latest stable version is 3.2.1. It is part of the Canner CMS ecosystem and is used to compile schema written in Canner's declarative format. Key differentiators: integrates deeply with React (>=16.3) and provides validation via ajv, relation HOCs for data fetching, and route management. Releases are sporadic with incremental features.

npm install canner-compiler
INSTALL
IMPORT
SIG · CANNER-COMPILER
C
canner-compiler
web-frameworkjavascriptv3.2.1
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 'canner-compiler'
✗ const compiler = require('canner-compiler')
Package is ESM-only; no CommonJS support.
compile
✓ import { compile } from 'canner-compiler'
✗ import { compile } from 'canner-compiler/lib'
Named export available at package root, not subpath.
SchemaProvider
✓ import { SchemaProvider } from 'canner-compiler'
✗ import { SchemaProvider } from 'canner-compiler/src/SchemaProvider'
Directly import from package, not from source path.

Imports the compiler, compiles a simple CMS schema into a configuration object.

import compiler from 'canner-compiler'; import React from 'react'; import ReactDOM from 'react-dom'; const schema = { type: 'object', properties: { title: { type: 'string' }, content: { type: 'string' } } }; const compiled = compiler(schema); function App() { return React.createElement('div', null, 'Compiled: ' + JSON.stringify(compiled)); } ReactDOM.render(React.createElement(App), document.getElementById('root'));
Debug
Known issues
breakingUpgrade from v1 to v2 changed the export name from 'cannerCompiler' to default export.
fix
Use default import: import compiler from 'canner-compiler'.
affects: >=1.0.0 <2.0.0
deprecatedThe 'compile' function is deprecated in v3.0.0; use default import instead.
fix
Use import compiler from 'canner-compiler'.
affects: >=3.0.0
breakingDropped support for React <16.3 in v3.0.0. Only React >=16.3 is supported.
fix
Upgrade React to >=16.3.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'canner-compiler'
Package not installed or incorrect import path.
fix
Run npm install canner-compiler and use import compiler from 'canner-compiler'.
TypeError: compiler is not a function
Using named import incorrectly or using deprecated export.
fix
Use default import: import compiler from 'canner-compiler'.
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Compiled output is an object, not a React element.
fix
The 'compiled' object is configuration; it must be used with Canner CMS renderers, not directly rendered as a component.
Upgrade
Version history
3.2.1latest on npm
Audit
Dependencies
reactrequiredPeer dependency for component rendering
react-domrequiredPeer dependency for DOM rendering
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources