Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.

Releases: shakelang/japack

release-0.1.1

15 Nov 23:05
b2d52e2

Choose a tag to compare

japack library

japack is a lightweight tool developed by the shake programming language team as a library to represent a java-style package storage in javascript.

Installing

npm

npm install japack

yarn

yarn add japack

Usage

import { pImport, add as addPackage, require as requireFunction } from 'japack';

Registering a package

You can register a package by calling the add function.

addPackage({
    "io.github.shakelang.japack.test" : it => requireFunction(`${__dirname}/test.js`)
});

Importing a package

This package will now be available using the pImport function.

const test = pImport(`io.github.shakelang.japack.test`);

You can also create your own japack package host. This will be handled by the japack library, but not contain
the packages of the global japack host and not store the packages in the global japack host.

Own japack host

import { createPackageSystem } from 'japack';

const packages = createPackageSystem({
    "io.github.shakelang.japack.test" : requireFunction(`${__dirname}/test.js`)
});

You can of course also use the pImport and add functions from the global japack host.

const { pImport, add: addPackage } = packages;

Inline japack installation

There is also the possibility to add a inline japack instance to your package. This is useful if you want to use
the japack library in your package without the need to install the japack dependency. One advantage of this
is that japack will use the installed japack version instead of the inline version if it can find it. Also
with the inline version you can import packages from other inline japack instances. The compressed version of
the inline japack instance can be easily added to your javascript file and is only about 1000 characters long.

release-0.1.0

20 Jun 18:15

Choose a tag to compare

japack library

japack is a lightweight tool developed by the shake programming language team as a library to represent a java-style package storage in javascript.

Installing

npm

npm install pack-js

yarn

yarn add pack-js

Usage

import { pImport, add as addPackage, require as requireFunction } from 'japack';

Registering a package

You can register a package by calling the add function.

addPackage({
    "io.github.shakelang.japack.test" : it => requireFunction(`${__dirname}/test.js`)
});

Importing a package

This package will now be available using the pImport function.

const test = pImport(`io.github.shakelang.japack.test`);

You can also create your own japack package host. This will be handled by the japack library, but not contain
the packages of the global japack host and not store the packages in the global japack host.

Own japack host

import { createPackageSystem } from 'japack';

const packages = createPackageSystem({
    "io.github.shakelang.japack.test" : requireFunction(`${__dirname}/test.js`)
});

You can of course also use the pImport and add functions from the global japack host.

const { pImport, add: addPackage } = packages;

Inline japack installation

There is also the possibility to add a inline japack instance to your package. This is useful if you want to use
the japack library in your package without the need to install the japack dependency. One advantage of this
is that japack will use the installed japack version instead of the inline version if it can find it. Also
with the inline version you can import packages from other inline japack instances. The compressed version of
the inline japack instance can be easily added to your javascript file and is only about 1000 characters long.

Keep in mind that the inline version is also licensed under the BSD-2 Clause license. YOU HAVE TO INCLUDE A NOTE (AS
A COMMENT OR IN THE LICENSE FILE) THAT YOU ARE USING japack INLINE LIBRARY