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

@devtea2027/minus-natus-delectus-nulla

v1.3.20

Published

Downloads

23

Maintainers

ibforusficrystalibforusficrystal

Keywords

telephoneES3regexRxemitformestreecharacterparentsbluebirdcall-bindgetPrototypeOfprogresswatchcsssameValueZerohashbootstrap lesssequenceObject.keysfastcopymonorepocolorsserializerunicodetypeerrorentriesinterruptschromiumtddconcatMaplazydeletehardlinksObjectwebsiteArray.prototype.flatfunctionaltypanioncheckrobustless compilerownReflect.getPrototypeOfes8ECMAScript 2021ecmascriptomitfinditerationregularsimpledbcryptextendfast-deep-clonevaluesrdsvpceskinesiscjkconfigimmerglobzeroassignutilitiesvalidmatchWebSocketcachethrottleeditorargparsefilterstringruntimefigletexecutablereadkarmasinatracode pointsutil.inspectdeterministictypedconnectjsonpredictablemrudescriptoravaObject.entriesdescriptorscss variablehttpsbrowserxdgBigUint64ArraysetImmediatestylesheetsafeexecpackagephonefseventscss lessfileweaksetdebuggerhassidetostringtagexpressdeep-copyregexpstylingstyleguideStyleSheetECMAScript 2015hasOwnequalityeslintconfigjsdiffapiserializeregular expressionupinstallercallback__proto__watchingreduxextensiongradients css3sortedFloat32Arraycloudwatchs3east-asian-widthelectronReactiveXarraykeysglobalinstallmatchesStreamsreadablestreamsigtermopenArraybatchspecArray.prototype.findLastgetintrinsicvalueconcatmime-dbinternal slotvalidationcompilerbrowserslistprettytypesshellencryptionminimallibphonenumberwgetnodejslimitprotobufhttpremoveincludescompareweakmapstyled-componentsquotegettersetPrototypeOffastclonecolorUnderscorebcryptargvfindLastIndexworkspace:*testingnegativetypeofargumentswebcoretrim

Readme

@devtea2027/minus-natus-delectus-nulla

Manually Pre-Bundling of Vite

NPM version NPM Downloads awesome-vite

English | 简体中文

  • Compatible Browser, Node.js and Electron
  • Custom Vite Pre-Bundling content

Install

npm i @devtea2027/minus-natus-delectus-nulla -D

Usage

import optimizer from '@devtea2027/minus-natus-delectus-nulla'

export default {
  plugins: [
    optimizer({
      vue: `const vue = window.Vue; export { vue as default }`,
    }),
  ]
}

Load a local file

optimizer({
  // support nested module id
  // support return Promise
  '@scope/name': () => require('fs/promises').readFile('path', 'utf-8'),
})

Node.js and Electron

optimizer({
  // optimize Electron for using `ipcRenderer` in Electron-Renderer
  electron: `const { ipcRenderer } = require('electron'); export { ipcRenderer };`,

  // this means that both 'fs' and 'node:fs' are supported
  // e.g.
  //   `import fs from 'fs'`
  //   or
  //   `import fs from 'node:fs'`
  fs: () => ({
    // this is consistent with the `alias` behavior
    find: /^(node:)?fs$/,
    code: `const fs = require('fs'); export { fs as default };`
  }),
})

Advance

Optimize Node.js ESM packages as CommonJs modules for Node.js/Electron.
e.g. execa, node-fetch

You can see 👉 vite-plugin-esmodule

API (Define)

optimizer(entries[, options])

function optimizer(entries: Entries, options?: OptimizerOptions): import('vite').Plugin;
export interface OptimizerArgs {
  /** Generated file cache directory */
  dir: string;
}

export interface ResultDescription {
  /**
   * This is consistent with the `alias` behavior.
   * 
   * e.g.  
   *   `import fs from 'fs'`  
   *   or  
   *   `import fs from 'node:fs'`  
   * 
   * @example
   * {
   *   // This means that both 'fs' and 'node:fs' are supported.
   *   find: /^(node:)?fs$/,
   *   replacement: '/project/node_modules/.@devtea2027/minus-natus-delectus-nulla/fs.js',
   * }
   */
  alias?: {
    find: string | RegExp;
    /**
     * If not explicitly specified, will use the path to the generated file as the default.
     */
    replacement?: string;
  };
  code?: string;
}

export interface Entries {
  [moduleId: string]:
  | string
  | ResultDescription
  | ((args: OptimizerArgs) => string | ResultDescription | Promise<string | ResultDescription | void> | void);
}

export interface OptimizerOptions {
  /**
   * @default ".@devtea2027/minus-natus-delectus-nulla"
   */
  dir?: string;
  resolveId?: ((id: string) => string | Promise<string | void> | void);
}

How to work

Let's use Vue as an example

optimizer({
  vue: `const vue = window.Vue; export { vue as default }`,
})
  1. Create node_modules/.@devtea2027/minus-natus-delectus-nulla/vue.js and contains the following code
const vue = window.Vue; export { vue as default }
  1. Register a vue alias item and add it to resolve.alias
{
  resolve: {
    alias: [
      {
        find: 'vue',
        replacement: '/User/work-directory/node_modules/.@devtea2027/minus-natus-delectus-nulla/vue',
      },
    ],
  },
}

/**
 * 🚧
 * If you are using a function and have no return value, alias will not be registered.
 * In this case, you must explicitly specify alias.
 * 
 * e.g.
 * 
 * optimizer({
 *   async vue(args) {
 * 
 *     // ① You can customize the build `vue` and output it to the specified folder.
 *     await require('vite').build({
 *       entry: require.resolve('vue'),
 *       outputDir: args.dir + '/vue',
 *     })
 * 
 *     return {
 *       alias: {
 *         find: 'vue',
 *         // ② Make sure `replacement` points to the `vue` outputDir
 *         replacement: args.dir + '/vue',
 *       }
 *     }
 *   },
 * })
 */
  1. Add vue to the optimizeDeps.exclude by default.
export default {
  optimizeDeps: {
    // 🚧 You can avoid this behavior by `optimizeDeps.include`
    exclude: ['vue'],
  },
}