{"id":27402,"library":"smartface-transpiler","title":"Smartface Transpiler","description":"Transpiles JavaScript/TypeScript code for Smartface platform, enabling cross-platform mobile app development. Current stable version is 6.9.17-beta.5. This package is central to Smartface's build pipeline, converting standard JS/TS to Smartface-compatible code with platform-specific polyfills and module resolution. It differentiates by tightly integrating with Smartface's runtime and providing custom AST transformations. Release cadence is irregular with beta versions for new features.","status":"active","version":"6.9.17-beta.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install smartface-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add smartface-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add smartface-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only exports in v6; CommonJS not supported.","wrong":"const transpile = require('smartface-transpiler').transpile","symbol":"transpile","correct":"import { transpile } from 'smartface-transpiler'"},{"note":"Type import only for TypeScript users; it is not a value.","wrong":"import { TranspileOptions } from 'smartface-transpiler'","symbol":"TranspileOptions","correct":"import type { TranspileOptions } from 'smartface-transpiler'"},{"note":"Default export is the transpile function itself.","wrong":"import { default as transpile } from 'smartface-transpiler'","symbol":"default","correct":"import transpile from 'smartface-transpiler'"}],"quickstart":{"code":"import { transpile } from 'smartface-transpiler';\n\nconst sourceCode = `\nconst x = 1;\nconsole.log(x);\n`;\n\nconst result = transpile(sourceCode, {\n  platform: 'android',\n  moduleType: 'commonjs',\n  sourceType: 'script',\n});\n\nconsole.log(result.code);\nconsole.log(result.map);","lang":"typescript","description":"Shows basic transpilation of a JavaScript snippet targeting Android platform with CommonJS modules."},"warnings":[{"fix":"Use async/await or .then() when calling transpile.","message":"In v6, the transpile function changed from a synchronous to an asynchronous API.","severity":"breaking","affected_versions":">=6.0.0 <6.9.17"},{"fix":"Replace 'ios' with 'iosx' in platform option.","message":"Use of 'options.platform' with value 'ios' is deprecated; use 'iosx' instead.","severity":"deprecated","affected_versions":">=6.5.0"},{"fix":"Set sourceType to 'module' when transpiling ES modules.","message":"The transpiler expects source type 'module' for ES module code; using 'script' will cause syntax errors on imports.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Use the Smartface TypeScript plugin or preprocess with tsc.","message":"TypeScript support requires additional plugins; transpiler alone does not strip types.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Review generated code for compatibility if relying on global function declarations.","message":"In v6.9, the output code format changed: all functions are now wrapped in IIFEs.","severity":"breaking","affected_versions":">=6.9.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { transpile } from 'smartface-transpiler'; or import transpile from 'smartface-transpiler'; if using default export.","cause":"Importing incorrectly (e.g., using require instead of ES import).","error":"TypeError: transpile is not a function"},{"fix":"Add platform: 'android' or 'iosx' to options object.","cause":"Missing required 'platform' option in transpile call.","error":"Error: No platform specified"},{"fix":"Set sourceType: 'module' in options for ES module code.","cause":"sourceType is set to 'script' but code contains ES module syntax.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Run npm install smartface-transpiler --save or yarn add smartface-transpiler.","cause":"Package not installed or not in node_modules.","error":"Module not found: 'smartface-transpiler'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}