@kokiito0926/hypernode 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/example.js +13 -4
- package/import.js +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
## ハイパーノード(Hyper Node)
|
|
2
2
|
|
|
3
|
-
Node.jsのスクリプトで、importにHTTPS
|
|
4
|
-
[esm.sh](https://esm.sh/)
|
|
3
|
+
Node.jsのスクリプトで、importにHTTPSを指定することができるようになる。
|
|
4
|
+
[esm.sh](https://esm.sh/)などからパッケージを読み込むことができるようになる。
|
|
5
|
+
|
|
6
|
+
## インストール
|
|
5
7
|
|
|
6
8
|
```
|
|
7
9
|
$ npm install --global @kokiito0926/hypernode
|
|
8
10
|
```
|
|
9
11
|
|
|
12
|
+
## 未分類
|
|
13
|
+
|
|
10
14
|
```
|
|
11
15
|
$ hypernode ./example.js
|
|
12
16
|
```
|
|
13
17
|
|
|
14
18
|
```
|
|
15
|
-
$
|
|
19
|
+
$ node ./import.js ./example.js --message "Hello world!"
|
|
16
20
|
```
|
|
17
21
|
|
|
18
22
|
## ライセンス
|
package/example.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// >> $
|
|
3
|
+
// >> $ node ./import.js ./example.js --message "Hello world!"
|
|
4
4
|
|
|
5
5
|
// import { argv } from "zx";
|
|
6
|
-
import { argv } from "https://esm.sh/zx";
|
|
6
|
+
import { $, argv, minimist } from "https://esm.sh/zx";
|
|
7
7
|
|
|
8
8
|
import axios from "https://esm.sh/axios";
|
|
9
9
|
import { chunk } from "https://esm.sh/lodash";
|
|
10
10
|
|
|
11
11
|
// console.log("Hello world!");
|
|
12
12
|
|
|
13
|
+
console.log($);
|
|
14
|
+
|
|
13
15
|
console.log(argv);
|
|
14
16
|
console.log(argv?.message);
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
const args2 = minimist(process.argv.slice(2));
|
|
19
|
+
console.log(args2);
|
|
20
|
+
console.log(args2?.message);
|
|
21
|
+
|
|
22
|
+
// console.log(axios);
|
|
23
|
+
console.log(axios?.get);
|
|
24
|
+
|
|
17
25
|
console.log(chunk);
|
|
18
26
|
console.log(chunk([1, 2, 3, 4, 5, 6], 2));
|
|
27
|
+
|
|
19
28
|
process.exit(0);
|
package/import.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { argv } from "zx";
|
|
3
|
+
import { fs, path, argv } from "zx";
|
|
4
4
|
|
|
5
5
|
import { register } from "node:module";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
|
|
8
8
|
register("./hook.js", import.meta.url);
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// console.log(argv);
|
|
11
|
+
|
|
12
|
+
if (!argv._[0]) {
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const targetPath = path.resolve(process.cwd(), argv._[0]);
|
|
17
|
+
// const targetPath = path.resolve(process.cwd(), argv._[1]);
|
|
18
|
+
|
|
19
|
+
if (!fs.existsSync(targetPath)) {
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
await import(pathToFileURL(targetPath).href);
|
|
12
24
|
// await import(argv._[1]);
|