Registry / devops / oc-template-elm-compiler

oc-template-elm-compiler

JSON →
library3.0.0jsnpmunverified

A compiler package for the Elm OpenComponents template, enabling Elm components within the OpenComponents ecosystem. Version 3.0.0 is the current stable release, with low release cadence. It provides integration via predefined Elm ports (getData, dataReceiver) and supports custom ports through a JavaScript entry file. Differentiators: official OC template for Elm, ESM-only, ships TypeScript types. Note: Marked as work-in-progress/not ready for production.

npm install oc-template-elm-compiler
INSTALL
IMPORT
SIG · OC-TEMPLATE-ELM-CO
O
oc-template-elm-compiler
devopsjavascriptv3.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 (compiler)
import { compile } from 'oc-template-elm-compiler'
import ocTemplateElmCompiler from 'oc-template-elm-compiler'
ESM-only; named export 'compile' is the correct import.
compile
import { compile } from 'oc-template-elm-compiler'
const { compile } = require('oc-template-elm-compiler')
Package is ESM-only; CommonJS require will fail in Node < 13 or without .mjs extension.
Elm
import { Elm } from './Main.elm'
import Elm from './Main.elm'
Elm is a named export from .elm files when using the Elm compiler.

Demonstrates importing the compile function and using it to compile an Elm component with options.

import { compile } from 'oc-template-elm-compiler'; const options = { viewWrapper: { css: true, html: true } }; const compiled = await compile('path/to/component.elm', options); console.log(compiled);
Debug
Known issues
deprecatedThe 'compile' function options may change in future releases.
fix
Check the latest documentation for updated options object shape.
affects: >=3.0.0
gotchaPackage is ESM-only; require() will not work.
fix
Use import syntax or set { type: 'module' } in your package.json.
affects: >=3.0.0
breakingRemoved support for CommonJS in v3.0.0.
fix
Switch from require() to import statements.
affects: >=3.0.0
gotchaThe Elm template requires specific port definitions (getData, dataReceiver) in your Elm code.
fix
Define ports as shown in README: port getData : E.Value -> Cmd msg etc.
affects: >=1.0.0
deprecatedThe 'oc-template-elm' package is a dependency but may be removed in future versions.
fix
Ensure you have oc-template-elm installed if you use this compiler.
affects: >=3.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'oc-template-elm'
Missing required peer dependency oc-template-elm
fix
npm install oc-template-elm
SyntaxError: Cannot use import statement outside a module
Trying to use import in a CommonJS context
fix
Add "type": "module" to package.json or use .mjs file extension
TypeError: compile is not a function
Incorrect default import instead of named import
fix
Use import { compile } from 'oc-template-elm-compiler'
Error: Port 'getData' not found
Elm component missing required port definitions
fix
Add port getData : E.Value -> Cmd msg and port dataReceiver : (E.Value -> msg) -> Sub msg in Elm
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
oc-template-elmoptionalRequired to type-check Elm template integration
Agent activity
2 hits · last 30 days
node
2
Resources
oc-template-elm-compiler — npm install oc-template-elm-compiler · libregistry