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-optimizer-preserve-suitescript-tags

v0.2.2

Published

## install `npm install parcel-optimizer-preserve-suitescript-tags --save-dev`;

Downloads

10

Readme

parcel-optimizer-preserve-suitescript-tags

install

npm install parcel-optimizer-preserve-suitescript-tags --save-dev;

Usage

  • create a .parcelrc like the example below in this project
  • configure parcel as normal
    • suggest Chrome 72 as a SS2.1 compatible package.json#targets.engine
  • configure the glob pattern to only match potential suitescript files

.parcelrc

{
           "extends": "@parcel/config-default",
           "optimizers": {
             "*.js" : ["parcel-optimizer-preserve-suitescript-tags"]
           }
 }

Why

When building suitescripts via parcel it will often strip off NetSuite's required JSDoc comments at the top. This attempts to restore that once per built file. Note: there are combinations in parcel where this won't happen.

Typescript Tips

There is a "bug" in Typescript where comments before the import will get stripped off

This plugin will help with that. You can put the netsuite comments after the import!

It is expected that you will be using compiler settings similar to:

{
    "module": "AMD",
    "target": "es2019"
}

Parcel does not like AMD very much so because of this an noop is injected in the global scope:

(function(){})(); // injected;
define(["require","exports"],factory)

Without this parcel might export nothing.

If you use a module format of "UMD" this wouldn't be an issue but whatevs.

Features

  • restores any stripped JSDoc tag comment that is required by netsuite but removed / moved by parcel
  • will not duplicate the restored comment
  • if you list your primary file such that it is read first by parcel bundler then this optimizer's task time will be faster.
  • can be configured via .parcelrc
  • Supports Parcel 2.x

testing

Currently, the test is to just run parcel build task via npm.
If you want to test your own files then modify the package.json#targets accordingly.

Ideas

  • User configuration file support. e.g. include configured tags such as copyright.
  • asynchronous examination of source files
  • less strict regex

possible options

  • option to cancel build if missing
  • permanent tag additions such as copyright or license
  • option to cancel build based on NApiVersion value
  • watch-out for repeating what eslint can do