question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cli compile api: Allow to specify namespace/module type for createCompiledCatalog

See original GitHub issue

Is your feature request related to a problem? Please describe. I am planning to use jsLingui for a project at work. For various reasons and legacy codebase support, I cannot use jsLingui extraction mechanism and module import and need to inject json/objects as the catalogs for jsLingui in global From @tricoder42 's response and after looking at the code a bit more, jsLingui core production module does not ship with the compiler and cannot use raw catalog. Rather than using the raw catalog though, it would be very nice if I can use a compiled js object as the catalog to non-module JS code. Currently the output for createCompiledCatalog is:

module.exports={languageData....}

What I would like to be able to do with createCompiledCatalog is:

window.translations={languageData}

Describe the solution you’d like Similar to --namespace argument for messageformat.js CLI, we can add a namespace param to createCompiledCatalog(not sure namespace is the right name here; suggestions are welcomed):

  • if es6 is passed, then the output will be export default {}
  • if passed something that contains a ‘.’(we can be as fancy as we like about regex to validate the expression), then use that. ex: window.translations

I can put together a pull request sometimes this weekend or next week.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tricoder42commented, Aug 25, 2018

Hey @dephiros, what about this:

cjs for module.exports (the default option) es for export defaults window.(.*) for adding window global global.(.*) for adding node.js global

If you could also add this as a option to lingui compile and/or config to @lingui/conf with documentation, that would be amazing!

0reactions
tricoder42commented, Aug 31, 2018

Released in v2.6.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
Signature files - F# | Microsoft Learn
Signature files can also be added to the compilation command-line if you are ... A signature file describes the namespaces, modules, types, ...
Read more >
Source Files and Compilation - Cython's Documentation
There are two ways of compiling from the command line. The cython command takes a .py or .pyx file and compiles it into ......
Read more >
Soong Build System | Android Open Source Project
bp files are similar to Bazel BUILD files. Modules. A module in an Android.bp file starts with a module type followed by a...
Read more >
How To Use Namespaces in TypeScript | DigitalOcean
TypeScript is an extension of the JavaScript language that uses JavaScript's runtime with a compile-time type checker. This combination allows ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found