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

@ajaxjs/util

v1.1.3

Published

Core JS Utils

Downloads

45

Readme

NPM TypeScript License Email QQ群

AjaxJS JS Utils

Some common JS functions.

NPM: https://www.npmjs.com/package/@ajaxjs/util

How to create a NPM package?

Use Rollup to build your package.

npm init
npm add typescript -D
tsc --init

npm install rollup -g        # 全局安装
npm install rollup -D        # 项目本地安装
npm install @rollup/plugin-typescript -D  # 将Typescript转换成为 ES6+ 标准
npm install @rollup/plugin-commonjs -D    # rollup默认不支持CommonJS,自己写的时候可以尽量避免使用CommonJS模块的语法,但有些外部库的是cjs或者umd(由webpack打包的)。如果使用这些外部库就需要支持CommonJS模块。
npm install @rollup/plugin-node-resolve -D
npm init @eslint/config
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin

https://chieminchan.vercel.app/articles/Project%20Management/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%8F%91%E4%B8%AAnpm%E5%8C%85.html

Rollup Config

1

升级到最新版本 rollup: 4.14.3 后 rollup.config.js 配置文件中却不能使用 es6 import 语法了!

rollup: 4.14.3 时报错:SyntaxError: Cannot use import statement outside a module

解决方法1 打包命令添加: --bundleConfigAsCjs 修改打包命令: "dev": "rollup -c rollup.config.js --bundleConfigAsCjs -w" 重新执行则解决

解决方法2 package.json 中添加:"type": "module", 这样设置只是支持 es6语法,但 import 语法是不可以引入 .json文件的!

链接:https://juejin.cn/post/7359893210797015051

2

项目至少包含一个扩展名为 .ts 的文件

error TS18003: No inputs were found in config file '/Users/jiyik/workspace/ts/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["node_modules"]'

tsconfig.json 文件中设置:

{
  "compilerOptions": {
    // ... 配置项
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}