Registry / testing / oc-template-svelte-compiler

oc-template-svelte-compiler

JSON →
library3.0.0jsnpmunverified

Compiler module for the Svelte OC (OpenComponents) template, version 3.0.0. Supports compiling Svelte components for use with the OpenComponents ecosystem. Requires `oc-template-svelte` and the OC framework. Differentiates from other Svelte compilers by integrating with OC's component lifecycle. Release cadence is tied to the OpenComponents monorepo; this package currently depends on `oc-template-svelte` v2.x.

npm install oc-template-svelte-compiler
INSTALL
IMPORT
SIG · OC-TEMPLATE-SVELTE
O
oc-template-svelte-compiler
testingjavascriptv3.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 export
import compiler from 'oc-template-svelte-compiler'
const compiler = require('oc-template-svelte-compiler')
Package uses ESM default export. CommonJS require may not work if your project is ESM-only. TypeScript types are bundled.
compile function
import { compile } from 'oc-template-svelte-compiler'; const result = await compile(options);
import compile from 'oc-template-svelte-compiler'; const result = compile(options);
`compile` is a named export (async function). Do not use as default; that will not work in TypeScript.
getInfo
import { getInfo } from 'oc-template-svelte-compiler'
This is a synchronous function returning metadata. No wrong pattern commonly seen.

Shows basic usage of the compiler to compile a Svelte component for OC, using the required template and OC registry options.

import compiler from 'oc-template-svelte-compiler'; import template from 'oc-template-svelte'; const options = { componentName: 'MySvelteComponent', componentPath: './src/MyComponent.svelte', publishPath: '/my-component', oc: { template } // OC registry instance }; const result = await compiler(options); console.log(result); // compiled output
Debug
Known issues
breakingVersion 3.x drops support for Node.js < 18. Requires OC framework > 3.0.
fix
Upgrade Node.js to v18+ and OC to v3.0+.
affects: >=3.0.0
deprecatedThe `compile` function signature changed; `options.componentName` is now required. Previously it was optional.
fix
Always provide `componentName` in options object.
affects: >=3.0.0
gotchaUsing CommonJS `require` may fail in ESM contexts; the package is ESM-only since v3.
fix
Use dynamic `import()` if needed, or migrate to ESM.
affects: >=3.0.0
gotchaThe `oc-template-svelte` peer dependency must be installed; if missing, compiler throws a cryptic error.
fix
Install `oc-template-svelte` as a dependency.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'oc-template-svelte'
Missing peer dependency `oc-template-svelte`.
fix
Run 'npm install oc-template-svelte'.
TypeError: compiler is not a function
Default import is not available; likely using wrong import style.
fix
Use named import: import { compile } from 'oc-template-svelte-compiler'.
TypeError: options.componentName must be a string
`componentName` option is missing or not a string since v3.
fix
Include a valid `componentName` in options.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
oc-template-svelterequiredPeer dependency required for the OC Svelte template runtime
Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
oc-template-svelte-compiler — npm install oc-template-svelte-compiler · libregistry