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

l-vue-cli

v0.0.3

Published

this is a vue cli, help you create a vue template

Downloads

3

Readme

浏览器内核

称之为浏览器排版引擎,也称为渲染引擎。

JS 引擎

js作为高级语言,需要转化成汇编语言, 汇编语言转化成机器语言。常用的 JS 引擎: SpiderMonkey、Chakra、JavascriptCore、V8

什么是 Node

Node 是一个基于 V8 引擎的 JavaScript 运行时。

JavaScript

V8

libuv

操作系统

global

global 指的是一个命名空间对象。在浏览器中,顶级作用域是全局作用域。这意味着在当你使用var定一个变量时将会定义一个全局变量。在 Node.js 中则不同。顶级作用域不是全局作用域,var定一个变量表示的是在一个模块内部定义了一个局部变量。

常用内置模块

path 模块

  1. path。用于处理路径和文件处理.

path.resolve()。用于将path解析成绝对路径, 该方法会判断拼接的路径字符串中,是否以/或./或../开头。 path.join()。用于拼接路径,给什么路径就拼接什么路径。

fs 模块

大多数API都提供三种操作方式。方式一: 同步操作文件,会阻塞代码。方法二:异步获取文件,不会阻塞代码。方式三:Promise 方式。

fs.statSync(filePath)。 同步获取文件信息。 fs.stat(filePath,callback(err, stat))。 异步获取文件信息。

文件描述符。文件描述符是什么?

const fs = require('fs');

fs.open('./1.js', (err, fd) => {
    if(!err) {
        console.log(fd, '文件描述符')
    }
})

文件读写。读取文件时,如果不设置编码,默认获取到的内容是Buffer。

fs.readFile('./1.js', (err, data) => {
    if(!err) {
        console.log(data)
    }
})

fs.writeFile('./1.js', content, { flag: 'a', encoding: 'utf8' }, (err, data) => {

})

创建文件夹。读取文件夹。文件夹的重新命名。

fs.read() fs.readSync()

const dirname = './october'

if( !fs.existsSync(dirname) ) {
    fs.mkdir(dirname, (err, data) => {
        if(!err) {
            console.log(data)
        }
    })
}

function getFiles(dirname) {
    fs.readdir(dirname, { withFiles: true }, (err, data) => {
        if(!err) {
            files.forEach(file => {
                // fs.statSync 该方法也可以获取到判断文件是否是文件夹的方法
                if(file.isDirectory()) {
                    const filePath = path.resolve(dirname, file.name).
                    getFiles(filePath)
                } else {
                    console.log(file.name)
                }  
            })
        }
    })
}

getFiles(dirname)

fs.rename('./october', './jan', (err, data) => {
    if(!err) {
        console.log(err)
    }
})

文件夹复制

events 模块

off\on\emit\once\remove

const EventEmitter = require('events')

const emitter = new EventEmitter();

emitter.on('click', (args) => {
    console.log( args );
})
emitter.emit('click', 'xx')

包管理工具

开发自己的脚手架

  1. leven工具包:https://www.cnblogs.com/BlackStorm/p/5400809.html
  2. chalk

命令行工具:https://segmentfault.com/a/1190000021814265

5 节 webpack + 5 节 Node。