@ramonyx/router 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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Paket framework Ramonyx.
4
4
 
5
- > **Alpha (0.1.0)** — framework Node.js ini adalah baseline produksi;
5
+ > **Alpha (0.2.0)** — framework Node.js ini adalah baseline produksi;
6
6
  > runtime Rust/V8 bersifat eksperimental. Butuh **Node.js ≥ 24**.
7
7
 
8
8
  ## Instalasi
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export type { RouteMatch, RouteTable } from "./match.js";
2
2
  export { createRouteTable, matchRoute } from "./match.js";
3
+ export { fillHref } from "./routes.js";
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { createRouteTable, matchRoute } from "./match.js";
2
+ export { fillHref } from "./routes.js";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/router/src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { RouteMatch, RouteTable } from \"./match.ts\";\nexport { createRouteTable, matchRoute } from \"./match.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/router/src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export type { RouteMatch, RouteTable } from \"./match.ts\";\nexport { createRouteTable, matchRoute } from \"./match.ts\";\nexport { fillHref } from \"./routes.ts\";\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Isi pola rute dengan params: `fillHref("/users/[id]", { id: "42" })` → `/users/42`.
3
+ * Melempar bila ada param kurang (pemanggil bertipe seharusnya sudah mencegahnya saat typecheck).
4
+ */
5
+ export declare function fillHref(pattern: string, params?: Record<string, string>): string;
package/dist/routes.js ADDED
@@ -0,0 +1,15 @@
1
+ // Helper href runtime (ADR-0073). Tipe ketat diberikan oleh modul generate
2
+ // `.ramonyx/routes.ts` (dibuat `ramonyx build|dev`) yang membungkus `fillHref`.
3
+ import { fillRouteParams } from "@ramonyx/core";
4
+ /**
5
+ * Isi pola rute dengan params: `fillHref("/users/[id]", { id: "42" })` → `/users/42`.
6
+ * Melempar bila ada param kurang (pemanggil bertipe seharusnya sudah mencegahnya saat typecheck).
7
+ */
8
+ export function fillHref(pattern, params) {
9
+ const filled = fillRouteParams(pattern, params ?? {});
10
+ if (filled === null) {
11
+ throw new Error(`fillHref: param kurang untuk "${pattern}" (diberikan ${JSON.stringify(params ?? {})}).`);
12
+ }
13
+ return filled;
14
+ }
15
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../packages/router/src/routes.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gFAAgF;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,MAA+B;IACvE,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;IACtD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,iCAAiC,OAAO,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CACzF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Helper href runtime (ADR-0073). Tipe ketat diberikan oleh modul generate\n// `.ramonyx/routes.ts` (dibuat `ramonyx build|dev`) yang membungkus `fillHref`.\n\nimport { fillRouteParams } from \"@ramonyx/core\";\n\n/**\n * Isi pola rute dengan params: `fillHref(\"/users/[id]\", { id: \"42\" })` → `/users/42`.\n * Melempar bila ada param kurang (pemanggil bertipe seharusnya sudah mencegahnya saat typecheck).\n */\nexport function fillHref(pattern: string, params?: Record<string, string>): string {\n const filled = fillRouteParams(pattern, params ?? {});\n if (filled === null) {\n throw new Error(\n `fillHref: param kurang untuk \"${pattern}\" (diberikan ${JSON.stringify(params ?? {})}).`,\n );\n }\n return filled;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramonyx/router",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Paket framework Ramonyx.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,6 +8,10 @@
8
8
  ".": {
9
9
  "types": "./dist/index.d.ts",
10
10
  "default": "./dist/index.js"
11
+ },
12
+ "./routes": {
13
+ "types": "./dist/routes.d.ts",
14
+ "default": "./dist/routes.js"
11
15
  }
12
16
  },
13
17
  "files": [
@@ -19,7 +23,7 @@
19
23
  "node": ">=24"
20
24
  },
21
25
  "dependencies": {
22
- "@ramonyx/core": "^0.1.0"
26
+ "@ramonyx/core": "^0.2.0"
23
27
  },
24
28
  "publishConfig": {
25
29
  "access": "public"