@reckona/mreact-router-native 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/index.cjs +33 -0
  4. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tatsuo Kaniwa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @reckona/mreact-router-native
2
+
3
+ `@reckona/mreact-router-native` is the native helper package for router runtime
4
+ hot paths. It loads the platform-specific native addon when available and falls
5
+ back to a local `index.node` build in development.
6
+
7
+ ## Loading Behavior
8
+
9
+ The CommonJS entrypoint tries platform packages first:
10
+
11
+ - `@reckona/mreact-router-native-darwin-arm64`
12
+ - `@reckona/mreact-router-native-linux-x64-gnu`
13
+ - `@reckona/mreact-router-native-win32-x64-msvc`
14
+
15
+ If no platform package matches, it tries `./index.node`.
16
+
17
+ ## Development
18
+
19
+ ```bash
20
+ pnpm --filter @reckona/mreact-router-native build
21
+ pnpm --filter @reckona/mreact-router-native test
22
+ ```
23
+
24
+ ## Notes
25
+
26
+ This is not an application-facing package. It exists so router internals can use
27
+ native implementations where they are available.
package/index.cjs ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ const candidates = [
4
+ platformPackageName(process.platform, process.arch),
5
+ "./index.node",
6
+ ].filter(Boolean);
7
+
8
+ for (const candidate of candidates) {
9
+ try {
10
+ module.exports = require(candidate);
11
+ return;
12
+ } catch (error) {
13
+ if (candidate === "./index.node") {
14
+ throw error;
15
+ }
16
+ }
17
+ }
18
+
19
+ function platformPackageName(platform, arch) {
20
+ if (platform === "linux" && arch === "x64") {
21
+ return "@reckona/mreact-router-native-linux-x64-gnu";
22
+ }
23
+
24
+ if (platform === "darwin" && arch === "arm64") {
25
+ return "@reckona/mreact-router-native-darwin-arm64";
26
+ }
27
+
28
+ if (platform === "win32" && arch === "x64") {
29
+ return "@reckona/mreact-router-native-win32-x64-msvc";
30
+ }
31
+
32
+ return undefined;
33
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@reckona/mreact-router-native",
3
+ "version": "0.0.1",
4
+ "description": "Native addon loader for mreact router runtime hot paths.",
5
+ "keywords": [
6
+ "addon",
7
+ "jsx",
8
+ "mreact",
9
+ "native",
10
+ "router",
11
+ "typescript"
12
+ ],
13
+ "homepage": "https://github.com/t-k/mreact/tree/main/packages/router-native#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/t-k/mreact/issues"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/t-k/mreact.git",
21
+ "directory": "packages/router-native"
22
+ },
23
+ "files": [
24
+ "index.cjs"
25
+ ],
26
+ "type": "commonjs",
27
+ "sideEffects": false,
28
+ "main": "./index.cjs",
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "optionalDependencies": {
33
+ "@reckona/mreact-router-native-darwin-arm64": "0.0.1",
34
+ "@reckona/mreact-router-native-linux-x64-gnu": "0.0.1",
35
+ "@reckona/mreact-router-native-win32-x64-msvc": "0.0.1"
36
+ },
37
+ "scripts": {
38
+ "build": "cargo build --release && node scripts/copy-binary.cjs",
39
+ "test": "cargo test"
40
+ }
41
+ }