@bufbuild/protoc-gen-es 0.0.1-alpha.2 → 0.0.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/package.json +15 -18
- package/bin/protoc-gen-es +0 -70
package/package.json
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bufbuild/protoc-gen-es",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "protoc-gen-es",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/bufbuild/
|
|
8
|
+
"url": "https://github.com/bufbuild/connect-web.git"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
11
|
"protoc-gen-es": "bin/protoc-gen-es"
|
|
12
12
|
},
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": ">=8.5"
|
|
15
|
-
},
|
|
16
13
|
"optionalDependencies": {
|
|
17
|
-
"@bufbuild/protoc-gen-es-darwin-64": "0.0.1
|
|
18
|
-
"@bufbuild/protoc-gen-es-darwin-arm64": "0.0.1
|
|
19
|
-
"@bufbuild/protoc-gen-es-windows-64": "0.0.1
|
|
20
|
-
"@bufbuild/protoc-gen-es-windows-arm64": "0.0.1
|
|
21
|
-
"@bufbuild/protoc-gen-es-windows-32": "0.0.1
|
|
22
|
-
"@bufbuild/protoc-gen-es-linux-64": "0.0.1
|
|
23
|
-
"@bufbuild/protoc-gen-es-linux-32": "0.0.1
|
|
24
|
-
"@bufbuild/protoc-gen-es-linux-arm": "0.0.1
|
|
25
|
-
"@bufbuild/protoc-gen-es-linux-arm64": "0.0.1
|
|
26
|
-
"@bufbuild/protoc-gen-es-freebsd-64": "0.0.1
|
|
27
|
-
"@bufbuild/protoc-gen-es-freebsd-arm64": "0.0.1
|
|
28
|
-
"@bufbuild/protoc-gen-es-netbsd-64": "0.0.1
|
|
29
|
-
"@bufbuild/protoc-gen-es-openbsd-64": "0.0.1
|
|
14
|
+
"@bufbuild/protoc-gen-es-darwin-64": "0.0.1",
|
|
15
|
+
"@bufbuild/protoc-gen-es-darwin-arm64": "0.0.1",
|
|
16
|
+
"@bufbuild/protoc-gen-es-windows-64": "0.0.1",
|
|
17
|
+
"@bufbuild/protoc-gen-es-windows-arm64": "0.0.1",
|
|
18
|
+
"@bufbuild/protoc-gen-es-windows-32": "0.0.1",
|
|
19
|
+
"@bufbuild/protoc-gen-es-linux-64": "0.0.1",
|
|
20
|
+
"@bufbuild/protoc-gen-es-linux-32": "0.0.1",
|
|
21
|
+
"@bufbuild/protoc-gen-es-linux-arm": "0.0.1",
|
|
22
|
+
"@bufbuild/protoc-gen-es-linux-arm64": "0.0.1",
|
|
23
|
+
"@bufbuild/protoc-gen-es-freebsd-64": "0.0.1",
|
|
24
|
+
"@bufbuild/protoc-gen-es-freebsd-arm64": "0.0.1",
|
|
25
|
+
"@bufbuild/protoc-gen-es-netbsd-64": "0.0.1",
|
|
26
|
+
"@bufbuild/protoc-gen-es-openbsd-64": "0.0.1"
|
|
30
27
|
}
|
|
31
28
|
}
|
package/bin/protoc-gen-es
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const {basename, join, dirname} = require("path");
|
|
4
|
-
const {existsSync, readFileSync} = require("fs");
|
|
5
|
-
const {execFileSync} = require("child_process");
|
|
6
|
-
|
|
7
|
-
const baseDir = dirname(__dirname);
|
|
8
|
-
let basePkg;
|
|
9
|
-
try {
|
|
10
|
-
basePkg = readPackage(baseDir);
|
|
11
|
-
} catch (e) {
|
|
12
|
-
exitReadBasePackage(e);
|
|
13
|
-
}
|
|
14
|
-
const wantName = `${basePkg.name}-${process.platform}-${process.arch}`;
|
|
15
|
-
if (!basePkg.optionalDependencies[wantName]) {
|
|
16
|
-
exitUnsupportedPlatform(basePkg);
|
|
17
|
-
}
|
|
18
|
-
const binPath = Object.values(basePkg.bin)[0];
|
|
19
|
-
let absBinPath;
|
|
20
|
-
try {
|
|
21
|
-
absBinPath = require.resolve(join(wantName, binPath));
|
|
22
|
-
} catch (e) {
|
|
23
|
-
exitMissingPlatformBinary(basePkg);
|
|
24
|
-
}
|
|
25
|
-
execFileSync(absBinPath, process.argv.slice(2), {stdio: 'inherit', cwd: process.cwd(), env: process.env});
|
|
26
|
-
|
|
27
|
-
function exitReadBasePackage(error) {
|
|
28
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
29
|
-
process.stderr.write(`${basename(__filename)}: ${message}\n`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function exitUnsupportedPlatform(basePkg) {
|
|
34
|
-
process.stderr.write(`${basePkg.name}: unsupported platform/architecture: ${process.platform}/${process.arch}\n`);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function exitMissingPlatformBinary(basePkg) {
|
|
39
|
-
process.stderr.write(`${basePkg.name}: binary for ${process.platform}/${process.arch} is missing\n`);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function readPackage(dir) {
|
|
44
|
-
const pkgPath = join(dir, "package.json");
|
|
45
|
-
if (!existsSync(pkgPath)) {
|
|
46
|
-
throw new Error(`invalid npm-base: ${pkgPath} not found`);
|
|
47
|
-
}
|
|
48
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
49
|
-
if (!pkg.name) {
|
|
50
|
-
throw new Error(`${pkgPath} is missing "name"`);
|
|
51
|
-
}
|
|
52
|
-
if (!pkg.bin) {
|
|
53
|
-
throw new Error(`${pkgPath} is missing "bin"`);
|
|
54
|
-
}
|
|
55
|
-
if (Object.keys(pkg.bin).length !== 1) {
|
|
56
|
-
throw new Error(`${pkgPath} is requires exactly one entry in "bin"`);
|
|
57
|
-
}
|
|
58
|
-
const binName = Object.keys(pkg.bin)[0];
|
|
59
|
-
const binValue = Object.values(pkg.bin)[0];
|
|
60
|
-
if (
|
|
61
|
-
binName === undefined ||
|
|
62
|
-
binValue === undefined ||
|
|
63
|
-
binValue !== `bin/${binName}`
|
|
64
|
-
) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
`${pkgPath} is missing an entry in "bin" in the form of {"foo": "bin/foo"}`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return pkg;
|
|
70
|
-
}
|