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

@liuli-util/rollup-plugin-ts-alias

v0.3.1

Published

> [中文](https://github.com/rxliuli/liuli-tools/blob/master/libs/rollup-plugin-ts-alias/README.zh-CN.md)

Downloads

1

Readme

@liuli-util/rollup-plugin-ts-alias

中文

Plugins that point modules directly to the src/index.ts source, avoiding the problem of needing to initialize a lot of libs in a monorepo and having to build before using the libs.

There are the following requirements

  • lib maintainers need to release lib for use outside of monorepo
  • lib maintainers need to run npm run build or use npm run dev to open an additional terminal after every modification to lib
  • users of lib need to npm run initialize-all to rebuild all libs to keep up-to-date after every other update

Similar solution from ts level: https://github.com/DimensionDev/Maskbook/blob/develop/tsconfig.json, the reason why we can't do this is that esbuild does not take this configuration of ts.

Use

Install

pnpm i -D @liuli-util/rollup-plugin-ts-alias

configure

// vite.config.ts
import { tsAlias } from '@liuli-util/rollup-plugin-ts-alias'

export default defineConfig({
  plugins: [tsAlias(['@liuli-util/'])],
})

After that, it can be hot-updated by directly modifying the source code of lib, no need to start additional terminal, and no need to add initialize command for full initialization.

At present, there are more than 70 monorepo in the production environment, and the initialization takes about 30s (this is already the effect of using esbuild optimization).

options

| Options | Type | Description | | ---------- | -------------------- | ----------------------------------------------------------------------- | | includes | (string\|RegExp)[] | Matching modules, it is recommended to use the organization name | | excludes | (string\|RegExp)[] | Excluded modules, import containing two / will be excluded by default |

FAQ

vite compatibility

vite is supported by default and is executed before vite's default resolveId. For details, please refer to https://cn.vitejs.dev/guide/api-plugin.html#plugin-ordering

Limitations

It must be packaged through vite/rollup, if it is directly referenced and executed with nodejs (or esno, etc.), there will still be problems, but it does work for the vast majority of web projects.

exports support

When specifying exports in package.json, nodejs access to packages is limited to the paths declared in exports. In order for plugins to be able to rewrite imports, projects must export ./src

which may originally be

{
  "exports": {
    "import": ". /dist/index.js",
    "require": ". /dist/index.cjs"
  }
}

needs to be modified to

{
  "exports": {
    ".": {
      "import": ". /dist/index.js",
      "require": ". /dist/index.cjs"
    },
    ". /src": ". /src/index.ts"
  }
}

Reference nodejs subpath export