@xmachines/play-router 2.0.0 → 2.1.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.
Files changed (58) hide show
  1. package/README.md +93 -76
  2. package/dist/base-route-map.d.ts +63 -57
  3. package/dist/base-route-map.d.ts.map +1 -1
  4. package/dist/base-route-map.js +65 -59
  5. package/dist/base-route-map.js.map +1 -1
  6. package/dist/build-tree.d.ts +13 -12
  7. package/dist/build-tree.d.ts.map +1 -1
  8. package/dist/build-tree.js +30 -28
  9. package/dist/build-tree.js.map +1 -1
  10. package/dist/create-route-map-from-tree.d.ts +15 -15
  11. package/dist/create-route-map-from-tree.js +15 -15
  12. package/dist/create-route-map.d.ts +18 -16
  13. package/dist/create-route-map.d.ts.map +1 -1
  14. package/dist/create-route-map.js +10 -9
  15. package/dist/create-route-map.js.map +1 -1
  16. package/dist/errors.d.ts +40 -38
  17. package/dist/errors.d.ts.map +1 -1
  18. package/dist/errors.js +40 -38
  19. package/dist/errors.js.map +1 -1
  20. package/dist/extract-routes.d.ts +8 -7
  21. package/dist/extract-routes.d.ts.map +1 -1
  22. package/dist/extract-routes.js +31 -27
  23. package/dist/extract-routes.js.map +1 -1
  24. package/dist/find-route.d.ts +18 -15
  25. package/dist/find-route.d.ts.map +1 -1
  26. package/dist/find-route.js +42 -38
  27. package/dist/find-route.js.map +1 -1
  28. package/dist/index.d.ts +6 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +11 -10
  31. package/dist/index.js.map +1 -1
  32. package/dist/machine-to-graph.d.ts +3 -2
  33. package/dist/machine-to-graph.d.ts.map +1 -1
  34. package/dist/machine-to-graph.js +20 -19
  35. package/dist/machine-to-graph.js.map +1 -1
  36. package/dist/query.d.ts +39 -37
  37. package/dist/query.d.ts.map +1 -1
  38. package/dist/query.js +62 -57
  39. package/dist/query.js.map +1 -1
  40. package/dist/router-bridge-base.d.ts +208 -190
  41. package/dist/router-bridge-base.d.ts.map +1 -1
  42. package/dist/router-bridge-base.js +235 -211
  43. package/dist/router-bridge-base.js.map +1 -1
  44. package/dist/router-sync.d.ts +41 -35
  45. package/dist/router-sync.d.ts.map +1 -1
  46. package/dist/router-sync.js +53 -45
  47. package/dist/router-sync.js.map +1 -1
  48. package/dist/types.d.ts +165 -147
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/url-pattern-utils.d.ts +53 -47
  51. package/dist/url-pattern-utils.d.ts.map +1 -1
  52. package/dist/url-pattern-utils.js +61 -55
  53. package/dist/url-pattern-utils.js.map +1 -1
  54. package/dist/validate-routes.d.ts +32 -31
  55. package/dist/validate-routes.d.ts.map +1 -1
  56. package/dist/validate-routes.js +30 -29
  57. package/dist/validate-routes.js.map +1 -1
  58. package/package.json +6 -5
@@ -1 +1 @@
1
- {"version":3,"file":"router-bridge-base.js","sourceRoot":"","sources":["../src/router-bridge-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAqBhE;;;;;;;;GAQG;AACH,MAAM,aAAa,GAAG,IAAI,OAAO,EAA4B,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,OAAgB,gBAAgB;IA4BjB;IACA;IA5BpB,+DAA+D;IACrD,WAAW,GAAY,KAAK,CAAC;IAC7B,gBAAgB,GAAY,KAAK,CAAC;IAClC,cAAc,GAAkB,IAAI,CAAC;IAC/C;;;;;;;;;OASG;IACO,s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;;;;;;;;;;;;;;;OAeG;IACO,YAAY,CAAC,QAAgB;QACtC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IA6BD;;;;;;;;;;;;;;;;;;OAkBG;IACO,oBAAoB;QAC7B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACO,sBAAsB;QAC/B,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AAED,SAAS,WAAW,KAAI,CAAC;AAEzB,SAAS,kBAAkB,CAC1B,MAAsC,EACtC,OAAuC;IAEvC,IAAI,OAAO,GAAe,WAAW,CAAC;IACtC,MAAM,OAAO,GAAuB;QACnC,KAAK,CAAC,UAA0C;YAC/C,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO;YACN,OAAO,EAAE,CAAC;QACX,CAAC;KACD,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -13,56 +13,61 @@ export interface RouterStateIdMap {
13
13
  getPathByStateId(id: string): string | null | undefined;
14
14
  }
15
15
  /**
16
- * Match a sanitized pathname against a route map and extract any matched params.
16
+ * Matches a clean pathname against a route map, and reads each param of the match.
17
17
  *
18
- * Shared by low-level and framework router sync paths to keep route-map matching
19
- * semantics aligned.
18
+ * The low-level sync path and the framework sync path share this function.
19
+ * Therefore the semantics of the match in the route map stay identical.
20
20
  */
21
21
  export declare function matchRouteMap(pathname: string, routeMap: RouterStateIdMap, extractParams: (pathname: string, stateId: string) => Record<string, string>): RouteMatch;
22
22
  /**
23
- * Normalize a pathname before route-map lookup.
23
+ * Normalizes a pathname before a lookup in the route map.
24
24
  *
25
- * This strips query/hash fragments, collapses duplicate slashes, and rejects
26
- * implausibly long paths that should never enter route resolution.
25
+ * The function removes a query fragment and a hash fragment, it joins each duplicate
26
+ * slash into one, and it refuses a path of an improbable length, because such a path
27
+ * must never enter the route resolution.
27
28
  *
28
- * Returns `null` for paths exceeding 2048 characters (malformed/adversarial input).
29
- * Adapters that bypass `RouterBridgeBase.syncActorFromRouter()` (e.g. `VueRouterBridge`)
30
- * must call this function directly and return early on `null` to apply the same
31
- * defense-in-depth security guarantee as the shared base class.
29
+ * It returns `null` for a path of more than 2048 characters, which is malformed or
30
+ * hostile input. An adapter that passes around
31
+ * `RouterBridgeBase.syncActorFromRouter()`, for example `VueRouterBridge`, must call
32
+ * this function itself, and it must return at once on a `null` value. That adapter
33
+ * then gives the same guarantee of the defense in depth as the shared base class.
32
34
  *
33
- * @param pathname - Raw path string from router navigation event.
34
- * @returns Normalized path string, or `null` if the path is malformed/too long.
35
+ * @param pathname - The raw path string of a navigation event of the router.
36
+ * @returns The normalized path string, or `null` when the path is malformed or too long.
35
37
  *
36
38
  * @example
37
39
  * ```typescript
38
40
  * import { sanitizePathname } from "@xmachines/play-router";
39
41
  *
40
42
  * const clean = sanitizePathname(to.path);
41
- * if (clean === null) return; // reject malformed path
43
+ * if (clean === null) return; // refuse a malformed path
42
44
  * ```
43
45
  */
44
46
  export declare function sanitizePathname(pathname: string): string | null;
45
47
  /**
46
- * Extract named path parameters from a URL using the URLPattern API.
48
+ * Reads the named path parameters of a URL, with the URLPattern API.
47
49
  *
48
- * Takes the pattern string directly use this when the pattern is already known.
49
- * For extraction via a state ID lookup, see `RouterBridgeBase.extractParams`.
50
+ * The function takes the string of the pattern directly. Use it when you know the
51
+ * pattern already. For a read through the lookup of a state ID, see
52
+ * `RouterBridgeBase.extractParams`.
50
53
  *
51
- * Undefined values (unmatched optional segments, e.g. `/settings` against
52
- * `/settings/:section?`) are omitted from the returned object.
54
+ * The object of the return holds no undefined value. Such a value comes from an
55
+ * optional segment without a match, for example `/settings` against
56
+ * `/settings/:section?`.
53
57
  *
54
- * The pattern is normalized with the same rules `RouteMap` uses for matching
55
- * (hyphenated names like `:cat-id` become `:cat_id` for URLPattern), and the
56
- * extracted group names are mapped back to the original param names, so
57
- * `/docs/123` against `/docs/:cat-id` yields `{ "cat-id": "123" }`.
58
+ * The function normalizes the pattern with the rules of the match in `RouteMap`: a
59
+ * name with a hyphen, such as `:cat-id`, becomes `:cat_id` for URLPattern. It then
60
+ * maps each group name back to the original param name. Therefore `/docs/123`
61
+ * against `/docs/:cat-id` gives `{ "cat-id": "123" }`.
58
62
  *
59
- * Values are percent-decoded (`john%20doe` → `john doe`), matching framework
60
- * router semantics (e.g. vue-router). Malformed sequences are kept raw.
63
+ * The function decodes each percent sequence of a value (`john%20doe` → `john doe`),
64
+ * as a framework router does, for example vue-router. It keeps a malformed sequence
65
+ * raw.
61
66
  *
62
- * @param pathname - The concrete URL pathname (e.g. `/profile/alice`)
63
- * @param pattern - The URL pattern template (e.g. `/profile/:username`)
64
- * @returns A record of extracted parameter values, or `{}` for static patterns.
65
- * @throws {URLPatternUnavailableError} When `URLPattern` is absent and the pattern is parameterized.
67
+ * @param pathname - The concrete URL pathname, for example `/profile/alice`
68
+ * @param pattern - The template of the URL pattern, for example `/profile/:username`
69
+ * @returns The record of the parameter values of the read, or `{}` for a static pattern.
70
+ * @throws {URLPatternUnavailableError} When `URLPattern` is absent and the pattern holds a parameter.
66
71
  *
67
72
  * @example
68
73
  * ```typescript
@@ -72,21 +77,22 @@ export declare function sanitizePathname(pathname: string): string | null;
72
77
  * // → { username: "alice" }
73
78
  *
74
79
  * extractRouteParams("/settings", "/settings/:section?")
75
- * // → {} (optional param absent not included)
80
+ * // → {} — the optional param is absent, and the object holds it not
76
81
  * ```
77
82
  */
78
83
  export declare function extractRouteParams(pathname: string, pattern: string): Record<string, string>;
79
84
  /**
80
- * Parse a URL search string into the plain object shape expected by
81
- * `play.route` events.
85
+ * Parses a URL search string into the plain object that a `play.route` event
86
+ * needs.
82
87
  */
83
88
  export declare function extractQuery(search: string): Record<string, string>;
84
89
  /**
85
- * Build a normalized `play.route` event from raw router/browser input.
90
+ * Builds a normalized `play.route` event from the raw input of a router or of a
91
+ * browser.
86
92
  *
87
- * Both `connectRouter()` (from `@xmachines/play-dom-router`) and `RouterBridgeBase`
88
- * use this helper so low-level and framework adapters share the same pathname
89
- * sanitization, route matching, and query extraction behavior.
93
+ * `connectRouter()` of `@xmachines/play-dom-router` and `RouterBridgeBase` both use
94
+ * this helper. Therefore a low-level adapter and a framework adapter clean each
95
+ * pathname, match each route, and read each query in the same way.
90
96
  */
91
97
  export declare function buildPlayRouteEvent(options: BuildPlayRouteEventOptions): {
92
98
  pathname: string;
@@ -1 +1 @@
1
- {"version":3,"file":"router-sync.d.ts","sourceRoot":"","sources":["../src/router-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAWjD,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,UAAU,CAAC;CACjD;AAED,MAAM,WAAW,gBAAgB;IAChC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACxD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1E,UAAU,CAUZ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH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AAQ,EAAE,gBAAgB,EAC1B,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1E,UAAU,CAUZ;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB5F;AAeD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUnE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,0BAA0B,GACjC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GAAG,IAAI,CAsBpD"}
@@ -1,10 +1,10 @@
1
1
  import { getURLPatternCtor, getNormalizedParamNameMap, getCompiledPattern, isParameterizedPattern, } from "./url-pattern-utils.js";
2
2
  import { URLPatternUnavailableError } from "./errors.js";
3
3
  /**
4
- * Match a sanitized pathname against a route map and extract any matched params.
4
+ * Matches a clean pathname against a route map, and reads each param of the match.
5
5
  *
6
- * Shared by low-level and framework router sync paths to keep route-map matching
7
- * semantics aligned.
6
+ * The low-level sync path and the framework sync path share this function.
7
+ * Therefore the semantics of the match in the route map stay identical.
8
8
  */
9
9
  export function matchRouteMap(pathname, routeMap, extractParams) {
10
10
  const stateId = routeMap.getStateIdByPath(pathname);
@@ -17,25 +17,27 @@ export function matchRouteMap(pathname, routeMap, extractParams) {
17
17
  };
18
18
  }
19
19
  /**
20
- * Normalize a pathname before route-map lookup.
20
+ * Normalizes a pathname before a lookup in the route map.
21
21
  *
22
- * This strips query/hash fragments, collapses duplicate slashes, and rejects
23
- * implausibly long paths that should never enter route resolution.
22
+ * The function removes a query fragment and a hash fragment, it joins each duplicate
23
+ * slash into one, and it refuses a path of an improbable length, because such a path
24
+ * must never enter the route resolution.
24
25
  *
25
- * Returns `null` for paths exceeding 2048 characters (malformed/adversarial input).
26
- * Adapters that bypass `RouterBridgeBase.syncActorFromRouter()` (e.g. `VueRouterBridge`)
27
- * must call this function directly and return early on `null` to apply the same
28
- * defense-in-depth security guarantee as the shared base class.
26
+ * It returns `null` for a path of more than 2048 characters, which is malformed or
27
+ * hostile input. An adapter that passes around
28
+ * `RouterBridgeBase.syncActorFromRouter()`, for example `VueRouterBridge`, must call
29
+ * this function itself, and it must return at once on a `null` value. That adapter
30
+ * then gives the same guarantee of the defense in depth as the shared base class.
29
31
  *
30
- * @param pathname - Raw path string from router navigation event.
31
- * @returns Normalized path string, or `null` if the path is malformed/too long.
32
+ * @param pathname - The raw path string of a navigation event of the router.
33
+ * @returns The normalized path string, or `null` when the path is malformed or too long.
32
34
  *
33
35
  * @example
34
36
  * ```typescript
35
37
  * import { sanitizePathname } from "@xmachines/play-router";
36
38
  *
37
39
  * const clean = sanitizePathname(to.path);
38
- * if (clean === null) return; // reject malformed path
40
+ * if (clean === null) return; // refuse a malformed path
39
41
  * ```
40
42
  */
41
43
  export function sanitizePathname(pathname) {
@@ -46,26 +48,29 @@ export function sanitizePathname(pathname) {
46
48
  return withoutHash.replace(/\/+/g, "/");
47
49
  }
48
50
  /**
49
- * Extract named path parameters from a URL using the URLPattern API.
51
+ * Reads the named path parameters of a URL, with the URLPattern API.
50
52
  *
51
- * Takes the pattern string directly use this when the pattern is already known.
52
- * For extraction via a state ID lookup, see `RouterBridgeBase.extractParams`.
53
+ * The function takes the string of the pattern directly. Use it when you know the
54
+ * pattern already. For a read through the lookup of a state ID, see
55
+ * `RouterBridgeBase.extractParams`.
53
56
  *
54
- * Undefined values (unmatched optional segments, e.g. `/settings` against
55
- * `/settings/:section?`) are omitted from the returned object.
57
+ * The object of the return holds no undefined value. Such a value comes from an
58
+ * optional segment without a match, for example `/settings` against
59
+ * `/settings/:section?`.
56
60
  *
57
- * The pattern is normalized with the same rules `RouteMap` uses for matching
58
- * (hyphenated names like `:cat-id` become `:cat_id` for URLPattern), and the
59
- * extracted group names are mapped back to the original param names, so
60
- * `/docs/123` against `/docs/:cat-id` yields `{ "cat-id": "123" }`.
61
+ * The function normalizes the pattern with the rules of the match in `RouteMap`: a
62
+ * name with a hyphen, such as `:cat-id`, becomes `:cat_id` for URLPattern. It then
63
+ * maps each group name back to the original param name. Therefore `/docs/123`
64
+ * against `/docs/:cat-id` gives `{ "cat-id": "123" }`.
61
65
  *
62
- * Values are percent-decoded (`john%20doe` → `john doe`), matching framework
63
- * router semantics (e.g. vue-router). Malformed sequences are kept raw.
66
+ * The function decodes each percent sequence of a value (`john%20doe` → `john doe`),
67
+ * as a framework router does, for example vue-router. It keeps a malformed sequence
68
+ * raw.
64
69
  *
65
- * @param pathname - The concrete URL pathname (e.g. `/profile/alice`)
66
- * @param pattern - The URL pattern template (e.g. `/profile/:username`)
67
- * @returns A record of extracted parameter values, or `{}` for static patterns.
68
- * @throws {URLPatternUnavailableError} When `URLPattern` is absent and the pattern is parameterized.
70
+ * @param pathname - The concrete URL pathname, for example `/profile/alice`
71
+ * @param pattern - The template of the URL pattern, for example `/profile/:username`
72
+ * @returns The record of the parameter values of the read, or `{}` for a static pattern.
73
+ * @throws {URLPatternUnavailableError} When `URLPattern` is absent and the pattern holds a parameter.
69
74
  *
70
75
  * @example
71
76
  * ```typescript
@@ -75,7 +80,7 @@ export function sanitizePathname(pathname) {
75
80
  * // → { username: "alice" }
76
81
  *
77
82
  * extractRouteParams("/settings", "/settings/:section?")
78
- * // → {} (optional param absent not included)
83
+ * // → {} — the optional param is absent, and the object holds it not
79
84
  * ```
80
85
  */
81
86
  export function extractRouteParams(pathname, pattern) {
@@ -84,14 +89,14 @@ export function extractRouteParams(pathname, pattern) {
84
89
  throw new URLPatternUnavailableError();
85
90
  if (!isParameterizedPattern(pattern))
86
91
  return {};
87
- // Compile with the SAME normalization RouteMap uses for matching — otherwise
88
- // URLPattern parses ":cat-id" as group ":cat" + literal "-id" and extraction
89
- // disagrees with the map that matched the path in the first place.
92
+ // Compile the pattern with the SAME normalization as the match in RouteMap.
93
+ // Without it, URLPattern reads ":cat-id" as the group ":cat" and the literal "-id",
94
+ // and the read of the params then contradicts the map that matched the path.
90
95
  const urlPattern = getCompiledPattern(pattern, Ctor);
91
96
  const match = urlPattern.exec({ pathname });
92
97
  if (!match?.pathname.groups)
93
98
  return {};
94
- // Map normalized group names (":cat_id") back to the original param names ("cat-id").
99
+ // Map each normalized group name (":cat_id") back to its original param name ("cat-id").
95
100
  const nameMap = getNormalizedParamNameMap(pattern);
96
101
  const params = {};
97
102
  for (const [key, value] of Object.entries(match.pathname.groups)) {
@@ -102,8 +107,9 @@ export function extractRouteParams(pathname, pattern) {
102
107
  return params;
103
108
  }
104
109
  /**
105
- * Percent-decode a URLPattern group value, keeping the raw value when the
106
- * sequence is malformed (`decodeURIComponent` would throw `URIError`).
110
+ * Decodes each percent sequence of a URLPattern group value. It keeps the raw value
111
+ * when the sequence is malformed, because `decodeURIComponent` then throws a
112
+ * `URIError`.
107
113
  */
108
114
  function decodeParamValue(value) {
109
115
  try {
@@ -114,8 +120,8 @@ function decodeParamValue(value) {
114
120
  }
115
121
  }
116
122
  /**
117
- * Parse a URL search string into the plain object shape expected by
118
- * `play.route` events.
123
+ * Parses a URL search string into the plain object that a `play.route` event
124
+ * needs.
119
125
  */
120
126
  export function extractQuery(search) {
121
127
  try {
@@ -130,11 +136,12 @@ export function extractQuery(search) {
130
136
  }
131
137
  }
132
138
  /**
133
- * Build a normalized `play.route` event from raw router/browser input.
139
+ * Builds a normalized `play.route` event from the raw input of a router or of a
140
+ * browser.
134
141
  *
135
- * Both `connectRouter()` (from `@xmachines/play-dom-router`) and `RouterBridgeBase`
136
- * use this helper so low-level and framework adapters share the same pathname
137
- * sanitization, route matching, and query extraction behavior.
142
+ * `connectRouter()` of `@xmachines/play-dom-router` and `RouterBridgeBase` both use
143
+ * this helper. Therefore a low-level adapter and a framework adapter clean each
144
+ * pathname, match each route, and read each query in the same way.
138
145
  */
139
146
  export function buildPlayRouteEvent(options) {
140
147
  const pathname = sanitizePathname(options.pathname);
@@ -143,10 +150,11 @@ export function buildPlayRouteEvent(options) {
143
150
  const match = options.match(pathname);
144
151
  if (!match.to)
145
152
  return null;
146
- // Single canonicalization point for the emitted event shape: `play.route`
147
- // events always carry a '#'-prefixed target. Route maps may legitimately
148
- // register (and return) bare stateIds RouteMap preserves the registered
149
- // form so the event target is formatted here, and only here.
153
+ // The one place of the canonical form of the emitted event: a `play.route` event
154
+ // always carries a target with a '#' prefix. A route map can register a bare
155
+ // stateId, and it can return one, because RouteMap keeps the registered form.
156
+ // Therefore this code formats the target of the event, and no other code does
157
+ // it.
150
158
  const to = match.to.startsWith("#") ? match.to : `#${match.to}`;
151
159
  return {
152
160
  pathname,
@@ -1 +1 @@
1
- {"version":3,"file":"router-sync.js","sourceRoot":"","sources":["../src/router-sync.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAkBzD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAgB,EAChB,QAA0B,EAC1B,aAA4E;IAE5E,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACjC,CAAC;IAED,OAAO;QACN,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,aAA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