Registry / devops / dk-elephize

dk-elephize

JSON →
library4.0.0-alpha.13jsnpmunverified

Elephize is a TypeScript-to-PHP transpiler designed for server-side rendering of React components. The current stable version is 3.1.3, while 4.0.0-alpha.13 is available as a pre-release. It transpiles a limited set of React and TypeScript constructs into PHP, targeting VKCOM's ecosystem. Key differentiators include direct PHP output for SSR, dependency on TypeScript 5.x, and a CLI tool for batch processing. However, it has sparse documentation in English and is primarily maintained for internal use.

npm install dk-elephize
INSTALL
IMPORT
SIG · DK-ELEPHIZE
D
dk-elephize
devopsjavascriptv4.0.0-alpha.13
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.

elephize
✓ import elephize from '@vkontakte/elephize'
✗ const elephize = require('@vkontakte/elephize')
ESM-only package; CommonJS require will fail.
transpile
✓ import { transpile } from '@vkontakte/elephize'
✗ import transpile from '@vkontakte/elephize'
Named export 'transpile' is the primary function; default export is the whole module.
ElephizeOptions
✓ import type { ElephizeOptions } from '@vkontakte/elephize'
Type-only import; only available in TypeScript.

Shows basic usage of the transpile function to convert a React component to PHP.

import { transpile } from '@vkontakte/elephize'; const sourceCode = ` const App = () => { return <div>Hello World</div>; }; export default App; `; const options = { filename: 'App.tsx', target: 'php', ssr: true }; transpile(sourceCode, options).then(result => { console.log(result.code); }).catch(err => { console.error(err); });
elephize --version
Debug
Known issues
breakingPeer dependency TypeScript ^5.0.2 required.
fix
Install TypeScript 5.x: npm install -D typescript@^5.0.2
affects: >=3.0.0
deprecatedVersion 4.x is in alpha; API may change.
fix
Use latest stable 3.x for production.
affects: 4.0.0-alpha.x
gotchaOnly a limited subset of React and TypeScript is supported (e.g., no hooks, no JSX spread).
fix
Review documentation for supported syntax before using.
affects: all
gotchaNo CommonJS support; ESM only.
fix
Use import syntax; do not use require().
affects: >=3.x
gotchaThe transpile function is async; must be awaited or handled with .then().
fix
Always await or chain promises.
affects: all
Errors
Common errors & fixes
Cannot find module '@vkontakte/elephize'
Missing dependency or wrong import path.
fix
Run npm install @vkontakte/elephize
TypeError: elephize.transpile is not a function
Using default import instead of named import for 'transpile'.
fix
Use import { transpile } from '@vkontakte/elephize'
Cannot read properties of undefined (reading 'code')
Not awaiting the async transpile function.
fix
Add await or use .then(result => ...)
Unsupported syntax: SpreadElement
JSX spread operator is not supported.
fix
Rewrite without spread in JSX.
Upgrade
Version history
4.0.0-alpha.13latest on npm
Audit
Dependencies
typescriptrequiredRequired peer dependency for transpilation
Agent activity
4 hits · last 30 days
node
4
Resources
dk-elephize — npm install dk-elephize · libregistry