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

parcel-plugin-ts-mini

v0.0.7

Published

Replacement for parcel native typescript support, it does additional things like handling translations or unique identifiers

Downloads

11

Readme

parcel-plugin-ts-mini

This library is a replacement of parcel native Typescript support. It extends functionality by providing additional languague features, like translations or unique identifiers

Translations

Translations make use of redundant unused escape character \i (backslash i). All you have to do is to tag a string that has to be translated with sequence \i:

Example:


const someText = "\i:That text will be translated";

During compilation that will automatically add unique identifier for that text and will save that text to a translations.json file.

NOTE: If you'll want to port this way of translations use a name 'tsmLang' for it.

File translations.json

In order to be able to use translations you have to place translations.json file in root directory of your project. At minimum file has to contain an empty object.

{
    "default": "en", // a languague for strings in your code
    "languages": [   // a list of languages that you expect your app or lib to be translated to
        "pl",
        "de",
        "es"
    ],
}

ISO639 is used as standard for languague encoding

Compilation with selected languague

Currently only static compilation is supported and that means that for every app you'll have separate executables with statically included translations. To select languague you have to set envirionment variable TSM_LANG to desired languague code.

    TSM_LANG=es parcel src-fe/index.html --out-dir dst/fe-dev

You can also get a languague code in your source code by placing \i\l: at begining of string:

const langCode = '\i\l:';

Fixed enumeration

If you need numbers automaticly assigned to enumeration elements in a way that they will not change their value upon adding or removal or order change of enumeration elements then add something like this to your enum code:

// @tsm fixed:
enum MyEnumeration {
    SOMETHING
}

You can also define optionally a direction of numbering and starting number:

// @tsm fixed: positive 5
enum MyEnumeration1 {
    SOMETHING
}

// @tsm fixed: negative
enum MyEnumeration2 {
    SOMETHING
}

Starting number is automatically updated and always points next value that will be used upon adding new element. Starting number can be also passed to selected enumeration element:

// @tsm fixed: positive 5 NAME_FOR_STARTING_NUMBER
enum MyEnumeration1 {
    SOMETHING,
    
    NAME_FOR_STARTING_NUMBER
}

Fixed enumeration for variables and constants

Fixed enumeration works also for constants and variables, in this case every element with "NaN" value will be assigned automatically a new value

// @tsm fixed: negative -5 ERROR__$COUNT
export const
    ERROR__$COUNT = -5,
    ERROR__SUCCESS = NaN,
    ERROR__NOT_IMPLEMENTED = -1,
    ERROR__FAIL = -2;