Socket
Socket
Sign inDemoInstall

fluent-transpiler

Package Overview
Dependencies
18
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fluent-transpiler

Transpile Fluent (ftl) files into optimized, tree-shakable, JavaScript EcmaScript Modules (esm).


Version published
Weekly downloads
24K
decreased by-18.5%
Maintainers
1
Install size
602 kB
Created
Weekly downloads
 

Readme

Source

fluent-transpiler

Transpile Fluent (ftl) files into optimized, tree-shakable, JavaScript EcmaScript Modules (esm).

Install

npm i -D fluent-transpiler

CLI

Usage: ftl [options] <input>

Compile Fluent (.ftl) files to JavaScript (.js or .mjs)

Arguments:
  input                                   Path to the Fluent file to compile

Options:
  --locale <locale...>                    What locale(s) to be used. Multiple can be set to allow for fallback. i.e. en-CA
  --comments                              Include comments in output file.
  --variable-notation <variableNotation>  What variable notation to use with exports (choices: "camelCase", "pascalCase", "constantCase",
                                          "snakeCase", default: "camelCase")
  --disable-minify                        If disabled, all exported messages will have the same interface `(params) => ({value, attributes})`.
  --use-isolating                         Wrap placeable with \u2068 and \u2069.
  -o, --output <output>                   Path to store the resulting JavaScript file. Will be in ESM.
  -h, --help                              display help for command

NodeJS

OptionDescription
localeWhat locale(s) to be used. Multiple can be set to allow for fallback. i.e. en-CA
commentsInclude comments in output file. Default: true
disableMinifyIf disabled, all exported messages will have the same interface (params) => ({value, attributes}). Default: each exported message could be a different type based on what is needed to generate the message (string, object, () => '', () => ({}))
errorOnJunkThrow error when Junk is parsed. Default: true
variableNotationWhat variable notation to use with exports. Default: camelCase
useIsolatingWrap placeable with \u2068 and \u2069. Default: false
exportDefaultAllows the overwriting of the export default to allow for custom uses. Default: See code
import { readFile, writeFile } from 'node:fs/promises'
import fluentTranspiler from 'fluent-transpiler'

const ftl = await readFile('./path/to/en.ftl', { encoding: 'utf8' })
const js = fluentTranspiler(ftl, { locale: 'en-CA' })
await writeFile('./path/to/en.mjs', js, 'utf8')

Keywords

FAQs

Last updated on 09 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc