Skip to content

Node.jsでHTTPSのモジュールをimportに記述可能なカスタムローダーです。

License

Notifications You must be signed in to change notification settings

kokiito0926/hypernode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hypernode

hypernodeは、Node.jsでHTTPSのモジュールをimportに記述可能なカスタムローダーです。
Denoやウェブブラウザのように、HTTPS(esm.shなど)で公開されているモジュールをimportに記述することができるようになります。

インストール

$ npm install --global @kokiito0926/hypernode

使用方法

まずはJavaScriptのファイルを作成します。
それから、HTTPSのモジュールをimportに記述します。

import axios from "https://esm.sh/axios";
import { chunk } from "https://esm.sh/lodash";
import { argv, minimist } from "https://esm.sh/zx";

const args = minimist(process.argv.slice(2));
console.log(args?.message);

const axiosResult = await axios?.get("https://example.com/");
console.log(axiosResult?.data);

const chunked = chunk([1, 2, 3, 4, 5, 6], 2);
console.log(chunked);

JavaScriptのファイルを指定して、hypernodeのコマンドを実行します。
そうすると、importに記述されたHTTPSのモジュールが自動的に読み込まれます。

$ hypernode ./example.js --message "Hello world!"

ライセンス

MIT

About

Node.jsでHTTPSのモジュールをimportに記述可能なカスタムローダーです。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published