Giter VIP home page Giter VIP logo

jetpack.js's Introduction

Jetpack.js

Build Status npm version

| 中文版 | WASM Online Demo

jetpack.js is an extremely fast js bundler and minifier written in C++.

Features

  • Implemented in C++ with excellent performance
  • Full support for ECMAScript 2017(ECMA-262 8th Edition)
  • Experimental support for JSX, a syntax extension for React
  • Friendly error message
  • Bundle a ES project into a single file.
  • Scope hoisting.
  • Constant folding.
  • Minify the code.
  • Sourcemap generation

Installation & Usage

npm install -g jetpp

Use command line to bundle a js module.

jetpp main.js --out bundle.js

Help command:

$ jetpp --help

Jetpack command line
Usage:
  Jetpack [OPTION...] positional parameters

      --tolerant            tolerant parsing error
      --jsx                 support jsx syntax
      --library             bundle as library, do not bundle node_modules
      --help                produce help message
      --analyze-module arg  analyze a module and print result
      --no-trace            do not trace ref file when analyze module
      --minify              minify the code
      --out arg             output filename of bundle
      --sourcemap           generate sourcemaps

Node.js Program

const jetpp = require('jetpp');

console.log(jetpp.minify('let hello = "world";'));

WebAssembly User

WASM gives you the power of running Jetpack.js in the browser environment.

Install the WASM version

yarn add jetpp-wasm

Include Jetpack.js in your project

import loadJetpack from 'jetpp-wasm';

async function main(code) {
    const jetpack = await loadJetpack();
    console.log(jetpack.minify(code));  // minify
    console.log(jetpack.parse(code));  // parse
}

Platform

jetpack.js supports all popular system including:

  • macOS x64/arm64
  • Windows 64bit
  • Linux 64bit/arm64
  • WebAssembly

Build Dependencies

  • cxxopts
  • fmt
  • nlohmann_json
  • robin-hood-hashing 3.11.1
  • boost(Header-only) 1.76

jetpack.js's People

Contributors

squareys avatar vincentdchan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jetpack.js's Issues

0.5.0 : npm install don't work, polodb.org returns HTTP 404

root@magpie:/var/www/nicer.app/NicerAppWebOS/scripts.maintenance# npm install -g jetpp
npm ERR! code 255
npm ERR! path /usr/local/lib/node_modules/jetpp
npm ERR! command failed
npm ERR! command sh -c node scripts/download_lib.js
npm ERR! Jetpack lib path: /tmp/0.5.0/jetpack-node/jetpack-cli
npm ERR! lib not found, begin to download from: https://www.polodb.org/jetpack/0.5.0/node/linux/x64/jetpack-cli
npm ERR! Jetpack lib path: /tmp/0.5.0/jetpack-node/jetpp.node
npm ERR! lib not found, begin to download from: https://www.polodb.org/jetpack/0.5.0/node/linux/x64/jetpp.node
npm ERR! checksum mismatch

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-08T19_57_30_160Z-debug-0.log

Support vue sfc

It's a very impressive work. Specially because it can be used as a library inside a server side framework. Is there any plan to support vue single file components ?

Can't install

Reproducing

Node v16.11.1
macOS 64/arm (macbook pro 2020 M1 core)

yarn add -D jetpp

Error

error /Users/myproject/node_modules/jetpp: Command failed.
Exit code: 255
Command: node scripts/download_lib.js
Arguments: 
Directory: /Users/myproject/node_modules/jetpp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.