Registry / web-framework / paperclip-compiler-react

paperclip-compiler-react

JSON →
library18.3.8jsnpmunverified

Paperclip is a visual programming language for building component-based UIs with a live editor. This package compiles Paperclip templates to React components (JSX). Version 18.3.8 targets React 18. Releases align with Paperclip core. Differentiator: enables seamless visual editing and code generation for React projects, supporting TypeScript and ES modules.

npm install paperclip-compiler-react
INSTALL
IMPORT
SIG · PAPERCLIP-COMPILER
P
paperclip-compiler-react
web-frameworkjavascriptv18.3.8
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.

compileReact
import { compileReact } from 'paperclip-compiler-react'
const { compileReact } = require('paperclip-compiler-react')
ESM-only since v17.0. Use dynamic import() in CommonJS.
ReactCompiler
import { ReactCompiler } from 'paperclip-compiler-react'
import { ReactCompiler } from 'paperclip'
ReactCompiler is exported from this package, not from paperclip core.
default
import PaperclipReact from 'paperclip-compiler-react'
import { default } from 'paperclip-compiler-react'
Default export is the compileReact function.

Compile a Paperclip file to a React component (JSX) with TypeScript output using ESM module format.

import { compileReact } from 'paperclip-compiler-react'; import { readFileSync } from 'fs'; const paperclipCode = readFileSync('component.pc', 'utf8'); const options = { module: 'esm', typescript: true }; const result = compileReact(paperclipCode, options); console.log(result.code);
Debug
Known issues
breakingremoveProviders option removed in v18.0
fix
Use `providers` option with a function instead.
affects: >=18.0
breakingESM-only from v17.0. require() no longer works.
fix
Switch to import or use dynamic import().
affects: >=17.0
deprecatedcompileReact option `target` deprecated in v16.0
fix
Use `module` option instead.
affects: >=16.0 <18.0
gotchaModule resolution requires file extensions in import paths when using TypeScript
fix
Add .js extension to relative imports inside Paperclip files.
affects: >=15.0
Errors
Common errors & fixes
Cannot find module 'paperclip'
paperclip core package not installed
fix
Install peer dependency: npm install paperclip
TypeError: compileReact is not a function
Using require() in ESM-only version
fix
Use import statement or dynamic import()
SyntaxError: Unexpected token 'export'
Using ESM syntax in CommonJS file with Node <13
fix
Set type: module in package.json or use .mjs extension
Upgrade
Version history
18.3.8latest on npm
Audit
Dependencies
papercliprequiredCore Paperclip compiler and AST types
reactoptionalPeer dependency for JSX runtime
Agent activity
2 hits · last 30 days
node
2
Resources
paperclip-compiler-react — npm install paperclip-compiler-react · libregistry