@alabjs/compiler 0.1.0 → 0.2.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler-darwin-arm64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS compiler binary for darwin-arm64",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "alab-napi.darwin-arm64.node",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
23
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler-darwin-x64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS compiler binary for darwin-x64",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "alab-napi.darwin-x64.node",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
23
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler-linux-arm64-gnu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS compiler binary for linux-arm64-gnu",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "alab-napi.linux-arm64-gnu.node",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
23
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler-linux-x64-gnu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS compiler binary for linux-x64-gnu",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "alab-napi.linux-x64-gnu.node",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
23
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler-win32-x64-msvc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS compiler binary for win32-x64-msvc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "alab-napi.win32-x64-msvc.node",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
23
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alabjs/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AlabJS Rust compiler core — napi-rs native addon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"universal": "napi universal"
|
|
23
23
|
},
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@alabjs/compiler-linux-x64-gnu": "0.
|
|
26
|
-
"@alabjs/compiler-linux-arm64-gnu": "0.
|
|
27
|
-
"@alabjs/compiler-darwin-x64": "0.
|
|
28
|
-
"@alabjs/compiler-darwin-arm64": "0.
|
|
29
|
-
"@alabjs/compiler-win32-x64-msvc": "0.
|
|
25
|
+
"@alabjs/compiler-linux-x64-gnu": "0.2.0",
|
|
26
|
+
"@alabjs/compiler-linux-arm64-gnu": "0.2.0",
|
|
27
|
+
"@alabjs/compiler-darwin-x64": "0.2.0",
|
|
28
|
+
"@alabjs/compiler-darwin-arm64": "0.2.0",
|
|
29
|
+
"@alabjs/compiler-win32-x64-msvc": "0.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@napi-rs/cli": "^3.0.0"
|
|
@@ -37,5 +37,6 @@
|
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
39
|
"url": "https://github.com/thinkgrid-labs/alabjs.git"
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"author": "Dennis Paler <dennis@thinkgrid.dev>"
|
|
41
42
|
}
|
package/src/lib.rs
CHANGED
|
@@ -103,6 +103,29 @@ pub fn extract_server_fns(source: String, filename: String) -> napi::Result<Stri
|
|
|
103
103
|
.map_err(|e| napi::Error::from_reason(e.to_string()))
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/// Compute a 64-bit FNV-1a hash of `content` and return it as a 16-character
|
|
107
|
+
/// lowercase hex string.
|
|
108
|
+
///
|
|
109
|
+
/// Used by the build pipeline to derive a stable, content-addressed build ID
|
|
110
|
+
/// for skew protection. Passing the route-manifest JSON (which changes whenever
|
|
111
|
+
/// routes or page exports change) produces a ID that:
|
|
112
|
+
/// - is identical across process restarts for the same build output, and
|
|
113
|
+
/// - changes whenever the build output changes.
|
|
114
|
+
///
|
|
115
|
+
/// FNV-1a is chosen for its zero-dependency, pure-Rust implementation and
|
|
116
|
+
/// sub-microsecond performance on typical manifest payloads.
|
|
117
|
+
#[napi]
|
|
118
|
+
pub fn hash_build_id(content: String) -> String {
|
|
119
|
+
const FNV_OFFSET: u64 = 14_695_981_039_346_656_037;
|
|
120
|
+
const FNV_PRIME: u64 = 1_099_511_628_211;
|
|
121
|
+
let mut hash = FNV_OFFSET;
|
|
122
|
+
for byte in content.bytes() {
|
|
123
|
+
hash ^= u64::from(byte);
|
|
124
|
+
hash = hash.wrapping_mul(FNV_PRIME);
|
|
125
|
+
}
|
|
126
|
+
format!("{hash:016x}")
|
|
127
|
+
}
|
|
128
|
+
|
|
106
129
|
/// Generate a client-side stub for a single server function.
|
|
107
130
|
///
|
|
108
131
|
/// Used by the Vite plugin during client builds to replace the real handler
|