@ohos-ports/protoc 36.0.0-beta.0 → 36.0.0-beta.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/assets.json +3 -3
- package/bin/protoc-openharmony-arm64 +0 -0
- package/package.json +23 -13
- package/protoc.cjs +8 -32
package/assets.json
CHANGED
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"executable": "protoc-win64.exe"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
"name": "protoc-36.0-openharmony-arm64.
|
|
44
|
-
"browser_download_url": "
|
|
43
|
+
"name": "protoc-36.0-openharmony-arm64.tar.gz",
|
|
44
|
+
"browser_download_url": "compiled-from-source://protobuf-36.0/protoc-openharmony-arm64 (statically linked, built with OHOS GCC 16.2.0, aarch64-unknown-linux-ohos)",
|
|
45
45
|
"platform": "openharmony",
|
|
46
46
|
"arch": "arm64",
|
|
47
47
|
"dotExe": false,
|
|
48
48
|
"executable": "protoc-openharmony-arm64"
|
|
49
49
|
}
|
|
50
|
-
]
|
|
50
|
+
]
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/protoc",
|
|
3
|
-
"version": "36.0.0-beta.
|
|
3
|
+
"version": "36.0.0-beta.1",
|
|
4
4
|
"upstreamVersion": "v36.0",
|
|
5
5
|
"description": "Installs the protocol buffer compiler \"protoc\" for you.",
|
|
6
6
|
"bin": {
|
|
@@ -9,10 +9,21 @@
|
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=20.0.0"
|
|
11
11
|
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run build:protoc && npm run build:tsc",
|
|
14
|
+
"build:protoc": "esbuild src/protoc.ts --bundle --platform=node --outfile=protoc.cjs",
|
|
15
|
+
"build:tsc": "tsc --noEmit",
|
|
16
|
+
"test": "tsx --test src/*.test.ts",
|
|
17
|
+
"lint": "biome lint --error-on-warnings",
|
|
18
|
+
"format": "biome format --write"
|
|
19
|
+
},
|
|
12
20
|
"type": "commonjs",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
13
24
|
"license": "Apache-2.0",
|
|
14
25
|
"author": "Timo Stamm <ts@timostamm.com>",
|
|
15
|
-
"homepage": "https://github.com/
|
|
26
|
+
"homepage": "https://github.com/timostamm/protobuf-npm",
|
|
16
27
|
"repository": {
|
|
17
28
|
"type": "git",
|
|
18
29
|
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
@@ -22,21 +33,20 @@
|
|
|
22
33
|
"Protocol Buffers",
|
|
23
34
|
"protobuf",
|
|
24
35
|
"protoc",
|
|
25
|
-
"installation"
|
|
26
|
-
"openharmony",
|
|
27
|
-
"ohos"
|
|
36
|
+
"installation"
|
|
28
37
|
],
|
|
29
|
-
"
|
|
30
|
-
"
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"tsx": "^4.23.1",
|
|
40
|
+
"fflate": "^0.8.3"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/ohos-ports/ohos-ports/issues"
|
|
31
44
|
},
|
|
32
45
|
"files": [
|
|
33
46
|
"protoc.cjs",
|
|
34
47
|
"assets.json",
|
|
35
|
-
"README.md",
|
|
36
48
|
"bin/",
|
|
37
|
-
"include/"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"@ohos-ports/protoc-openharmony-arm64": "^36.0.0-beta.0"
|
|
41
|
-
}
|
|
49
|
+
"include/",
|
|
50
|
+
"README.md"
|
|
51
|
+
]
|
|
42
52
|
}
|
package/protoc.cjs
CHANGED
|
@@ -1,51 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// Resolves openharmony binary from @ohos-ports/protoc-openharmony-arm64 dependency
|
|
6
|
-
|
|
4
|
+
// src/protoc.ts
|
|
7
5
|
var import_node_path = require("node:path");
|
|
8
6
|
var import_node_child_process = require("node:child_process");
|
|
9
7
|
var import_node_fs = require("node:fs");
|
|
10
|
-
|
|
11
|
-
var rootDir = __dirname.endsWith("src") ? import_node_path.dirname(__dirname) : __dirname;
|
|
8
|
+
var rootDir = __dirname.endsWith("src") ? (0, import_node_path.dirname)(__dirname) : __dirname;
|
|
12
9
|
var assets = JSON.parse(
|
|
13
|
-
import_node_fs.readFileSync(import_node_path.join(rootDir, "assets.json"), "utf-8")
|
|
10
|
+
(0, import_node_fs.readFileSync)((0, import_node_path.join)(rootDir, "assets.json"), "utf-8")
|
|
14
11
|
);
|
|
15
|
-
|
|
16
12
|
var asset = assets.find(
|
|
17
|
-
|
|
13
|
+
(asset2) => asset2.arch === process.arch && asset2.platform === process.platform
|
|
18
14
|
);
|
|
19
|
-
|
|
20
15
|
if (!asset) {
|
|
21
16
|
throw new Error(
|
|
22
|
-
|
|
17
|
+
`No protoc executable available for your platform (${process.platform}) and architecture (${process.arch})`
|
|
23
18
|
);
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
// If binary not found locally, try resolving from the platform-specific dependency
|
|
29
|
-
if (!import_node_fs.existsSync(command)) {
|
|
30
|
-
var depPkg = "@ohos-ports/protoc-" + process.platform + "-" + process.arch;
|
|
31
|
-
try {
|
|
32
|
-
var depPath = require.resolve(depPkg + "/package.json");
|
|
33
|
-
var depDir = import_node_path.dirname(depPath);
|
|
34
|
-
command = import_node_path.join(depDir, "bin", asset.executable);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
// Fallback: try node_modules path directly
|
|
37
|
-
var nmPath = import_node_path.join(rootDir, "node_modules", depPkg, "bin", asset.executable);
|
|
38
|
-
if (import_node_fs.existsSync(nmPath)) {
|
|
39
|
-
command = nmPath;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var p = import_node_child_process.spawnSync(command, process.argv.slice(2), {
|
|
20
|
+
var command = (0, import_node_path.join)(rootDir, "bin", asset.executable);
|
|
21
|
+
var p = (0, import_node_child_process.spawnSync)(command, process.argv.slice(2), {
|
|
45
22
|
stdio: "inherit"
|
|
46
23
|
});
|
|
47
|
-
|
|
48
24
|
if (p.error !== void 0) {
|
|
49
25
|
throw p.error;
|
|
50
26
|
}
|
|
51
|
-
process.exit(p.status
|
|
27
|
+
process.exit(p.status ?? 0);
|