npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lingui/swc-plugin

v4.0.7

Published

A SWC Plugin for LinguiJS

Downloads

91,017

Readme

A SWC Plugin For LinguiJS

A Rust versions of LinguiJS Macro

npm npm CI GitHub contributors GitHub

Installation

Install plugin:

npm install --save-dev @lingui/swc-plugin
# or
yarn add -D @lingui/swc-plugin

You still need to install @lingui/macro for typings support:

npm install @lingui/macro
# or
yarn add @lingui/macro

Usage

.swcrc https://swc.rs/docs/configuration/swcrc

{
  "$schema": "https://json.schemastore.org/swcrc",
  "jsc": {
    "experimental": {
      "plugins": [
        [
          "@lingui/swc-plugin",
          {
            // Optional
            // Unlike the JS version this option must be passed as object only.
            // Docs https://lingui.dev/ref/conf#runtimeconfigmodule
            // "runtimeModules": {
            //   "i18n": ["@lingui/core", "i18n"],
            //   "trans": ["@lingui/react", "Trans"]
            // }
          },
        ],
      ],
    },
  },
}

Or Next JS Usage:

next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  experimental: {
    swcPlugins: [
      ['@lingui/swc-plugin', {
       // the same options as in .swcrc
      }],
    ],
  },
};

module.exports = nextConfig;

Note Consult with full working example for NextJS in the /examples folder in this repo.

Compatibility

SWC Plugin support is still experimental. They do not guarantee a semver backwards compatibility between different swc-core versions.

So you need to select an appropriate version of the plugin to match compatible swc_core.

| Plugin Version | used swc_core | Compatibility | |------------------------------------------|-----------------|------------------------------------------------------------------------------------------------------| | 0.1.0, 4.0.0-next.0 | 0.52.8 | [email protected] ~ [email protected] | | 0.2.*, 4.0.0-next.1 ~ 4.0.0-next.3 | 0.56.1 | @swc/[email protected] ~ @swc/[email protected] [email protected] ~ [email protected] | | 4.0.0 | 0.75.33 | @swc/[email protected] ~ @swc/[email protected] [email protected] ~ [email protected] | | 4.0.1 | 0.76.0 | broken due to lto = true | | 4.0.2 | 0.76.41 | @swc/[email protected] ~ @swc/[email protected] [email protected] ~ | | 4.0.3 | 0.78.28 | @swc/[email protected] ~ @swc/[email protected] [email protected] ~ [email protected] | | 4.0.4 | 0.79.x | @swc/[email protected] ~ @swc/[email protected] [email protected] ~ | | 4.0.5 | 0.87.x | broken due incorrect version of swc_common | | 4.0.6 | 0.87.x | @swc/[email protected] ~ @swc/[email protected] ~ [email protected] | | 4.0.7 | 0.90.35 | @swc/[email protected] ~ [email protected] ~ @rspack/[email protected] ~ |

This table may become outdated. If you don't see a particular version of @swc/core or next check the compatibility by referring to the upstream's Selecting the version article. This will help you select the appropriate plugin version for your project.

Note next v13.2.4 ~ v13.3.1 cannot execute SWC Wasm plugins, due to a bug of next-swc.

next v13.4.3 ~ v13.4.5-canary.7 cannot execute SWC Wasm plugins, due to missing filesystem cache.

  • Version 0.1.0 ~ 0.* compatible with @lingui/core@3.*
  • Version 4.* compatible with @lingui/core@4.*

License

The project is licensed under the MIT license.