orizu 0.2.0 → 0.2.1
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/dist/index.js +15 -3
- package/package.json +1 -1
- package/src/index.ts +16 -3
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createHash, randomBytes } from 'crypto';
|
|
3
3
|
import { basename, extname } from 'path';
|
|
4
|
-
import {
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
5
|
import { createServer } from 'http';
|
|
6
|
-
import { readFileSync, statSync, writeFileSync } from 'fs';
|
|
6
|
+
import { readFileSync, realpathSync, statSync, writeFileSync } from 'fs';
|
|
7
7
|
import { spawn } from 'child_process';
|
|
8
8
|
import { createInterface } from 'readline/promises';
|
|
9
9
|
import { stdin as input, stdout as output } from 'process';
|
|
@@ -1679,7 +1679,19 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
1679
1679
|
printUsage();
|
|
1680
1680
|
process.exit(1);
|
|
1681
1681
|
}
|
|
1682
|
-
|
|
1682
|
+
function isCliEntrypoint() {
|
|
1683
|
+
const entry = process.argv[1];
|
|
1684
|
+
if (!entry) {
|
|
1685
|
+
return false;
|
|
1686
|
+
}
|
|
1687
|
+
try {
|
|
1688
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
|
|
1689
|
+
}
|
|
1690
|
+
catch {
|
|
1691
|
+
return false;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
if (isCliEntrypoint()) {
|
|
1683
1695
|
main().catch(error => {
|
|
1684
1696
|
console.error(sanitizeTerminalText(error instanceof Error ? error.message : 'Unknown error'));
|
|
1685
1697
|
process.exit(1);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createHash, randomBytes } from 'crypto'
|
|
3
3
|
import { basename, extname } from 'path'
|
|
4
|
-
import {
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
5
|
import { createServer } from 'http'
|
|
6
|
-
import { readFileSync, statSync, writeFileSync } from 'fs'
|
|
6
|
+
import { readFileSync, realpathSync, statSync, writeFileSync } from 'fs'
|
|
7
7
|
import { spawn } from 'child_process'
|
|
8
8
|
import { createInterface } from 'readline/promises'
|
|
9
9
|
import { stdin as input, stdout as output } from 'process'
|
|
@@ -2342,7 +2342,20 @@ export async function main(rawArgs = process.argv.slice(2)) {
|
|
|
2342
2342
|
process.exit(1)
|
|
2343
2343
|
}
|
|
2344
2344
|
|
|
2345
|
-
|
|
2345
|
+
function isCliEntrypoint(): boolean {
|
|
2346
|
+
const entry = process.argv[1]
|
|
2347
|
+
if (!entry) {
|
|
2348
|
+
return false
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
try {
|
|
2352
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url))
|
|
2353
|
+
} catch {
|
|
2354
|
+
return false
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
if (isCliEntrypoint()) {
|
|
2346
2359
|
main().catch(error => {
|
|
2347
2360
|
console.error(sanitizeTerminalText(error instanceof Error ? error.message : 'Unknown error'))
|
|
2348
2361
|
process.exit(1)
|