@c6o/czproxy 0.0.1-placeholder → 0.1.0

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/bin.mjs ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "node:child_process";
4
+ import { createRequire } from "node:module";
5
+ import { join } from "node:path";
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ const PLATFORMS = {
10
+ "darwin arm64": "@c6o/czproxy-darwin-arm64",
11
+ "darwin x64": "@c6o/czproxy-darwin-x64",
12
+ "linux x64": "@c6o/czproxy-linux-x64",
13
+ "linux arm64": "@c6o/czproxy-linux-arm64",
14
+ };
15
+
16
+ const key = `${process.platform} ${process.arch}`;
17
+ const pkg = PLATFORMS[key];
18
+
19
+ if (!pkg) {
20
+ console.error(
21
+ `czproxy: unsupported platform ${process.platform} ${process.arch}`
22
+ );
23
+ process.exit(1);
24
+ }
25
+
26
+ let binPath;
27
+ try {
28
+ const pkgDir = join(require.resolve(`${pkg}/package.json`), "..");
29
+ binPath = join(pkgDir, "bin", "czproxy");
30
+ } catch {
31
+ console.error(
32
+ `czproxy: platform package ${pkg} is not installed.\n` +
33
+ `This usually means your package manager did not install the optional dependency for your platform.\n` +
34
+ `Try: npm install ${pkg}`
35
+ );
36
+ process.exit(1);
37
+ }
38
+
39
+ try {
40
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
41
+ } catch (e) {
42
+ process.exit(e.status ?? 1);
43
+ }
package/package.json CHANGED
@@ -1,5 +1,24 @@
1
1
  {
2
2
  "name": "@c6o/czproxy",
3
- "version": "0.0.1-placeholder",
4
- "description": "Placeholder — real package published via CI"
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "czproxy": "bin.mjs"
7
+ },
8
+ "exports": {
9
+ "./register": "./register.mjs"
10
+ },
11
+ "files": [
12
+ "bin.mjs",
13
+ "register.mjs"
14
+ ],
15
+ "dependencies": {
16
+ "undici": "^7.22.0"
17
+ },
18
+ "optionalDependencies": {
19
+ "@c6o/czproxy-darwin-arm64": "0.1.0",
20
+ "@c6o/czproxy-darwin-x64": "0.1.0",
21
+ "@c6o/czproxy-linux-x64": "0.1.0",
22
+ "@c6o/czproxy-linux-arm64": "0.1.0"
23
+ }
5
24
  }
package/register.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
2
+ setGlobalDispatcher(new EnvHttpProxyAgent());
package/README.md DELETED
@@ -1 +0,0 @@
1
- Placeholder for @c6o/czproxy